My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
NetCommHandler.h
Go to the documentation of this file.
1 #ifndef GCP_UTIL_NETCOMMHANDLER_H
2 #define GCP_UTIL_NETCOMMHANDLER_H
3 
11 #include "gcp/util/common/AntNum.h"
12 #include "gcp/util/common/NetMsgHandler.h"
13 #include "gcp/util/common/NetCmdHandler.h"
14 
15 namespace gcp {
16  namespace util {
17 
19  public:
20 
25 
29  virtual ~NetCommHandler();
30 
34  void attachReadStream(int fd);
35 
39  void attachSendStream(int fd);
40 
44  void attach(int fd);
45 
49  void packNetMsg(NetMsg* msg);
50 
54  bool packNewRtcNetMsg(NetMsg* msg);
55 
59  void packNetCmd(NetCmd* cmd);
60 
65  gcp::control::NetCmdId opcode);
66 
70  gcp::util::NetReadStr::NetReadId readNetMsg();
71 
75  gcp::util::NetSendStr::NetSendId sendNetMsg();
76 
80  gcp::util::NetReadStr::NetReadId readNetCmd();
81 
85  gcp::util::NetSendStr::NetSendId sendNetCmd();
86 
91 
96 
101 
106 
110  int getReadFd();
111 
112  /*
113  * Return the fd that our send streams are attached to.
114  */
115  int getSendFd();
116 
120  int getFd();
121 
126 
131 
135  inline AntNum::Id getId() {
136  return antNum_.getId();
137  }
138 
139  inline unsigned getIntId() {
140  return antNum_.getIntId();
141  }
142 
146  inline void setId(AntNum::Id id) {
147  antNum_.setId(id);
148  }
149 
150  private:
151 
152  int readFd_;
153  int sendFd_;
154  AntNum antNum_;
155  NetMsgHandler netMsgHandler_;
156  NetCmdHandler netCmdHandler_;
157 
158  }; // End class NetCommHandler
159 
160  } // End namespace util
161 } // End namespace gcp
162 
163 
164 
165 
166 #endif // End #ifndef GCP_UTIL_NETCOMMHANDLER_H
void attachReadStream(int fd)
Definition: NetCommHandler.cc:37
void packNetCmd(NetCmd *cmd)
Definition: NetCommHandler.cc:222
AntNum::Id getId()
Definition: NetCommHandler.h:135
NetCmdHandler * getNetCmdHandler()
Definition: NetCommHandler.cc:238
void attachSendStream(int fd)
Definition: NetCommHandler.cc:46
unsigned int getIntId()
Definition: AntNum.cc:343
gcp::util::NetCmd * getLastSentNetCmd()
Definition: NetCommHandler.cc:173
int getFd()
Definition: NetCommHandler.cc:100
NetMsgHandler * getNetMsgHandler()
Definition: NetCommHandler.cc:230
void setId(AntNum::Id id)
Definition: NetCommHandler.h:146
gcp::util::NetCmd * getLastReadNetCmd()
Definition: NetCommHandler.cc:165
virtual ~NetCommHandler()
Definition: NetCommHandler.cc:20
int getSendFd()
Definition: NetCommHandler.cc:146
gcp::util::NetReadStr::NetReadId readNetCmd()
Definition: NetCommHandler.cc:58
Definition: NetCmd.h:21
Definition: NetMsgHandler.h:19
Definition: NetMsg.h:26
Id getId()
Definition: AntNum.cc:713
bool packNewRtcNetMsg(NetMsg *msg)
Definition: NetCommHandler.cc:205
Definition: rtcnetcoms.h:2462
NetCommHandler()
Definition: NetCommHandler.cc:11
gcp::util::NetSendStr::NetSendId sendNetCmd()
Definition: NetCommHandler.cc:80
void packRtcNetCmd(gcp::control::RtcNetCmd *cmd, gcp::control::NetCmdId opcode)
Definition: NetCommHandler.cc:213
gcp::util::NetSendStr::NetSendId sendNetMsg()
Definition: NetCommHandler.cc:89
gcp::util::NetMsg * getLastReadNetMsg()
Definition: NetCommHandler.cc:181
int getReadFd()
Definition: NetCommHandler.cc:127
Id
Definition: AntNum.h:37
Definition: NetCommHandler.h:18
gcp::util::NetReadStr::NetReadId readNetMsg()
Definition: NetCommHandler.cc:69
void attach(int fd)
Definition: NetCommHandler.cc:25
Definition: NetCmdHandler.h:22
void packNetMsg(NetMsg *msg)
Definition: NetCommHandler.cc:197
void setId(AntNum::Id)
Definition: AntNum.cc:656
Definition: AntNum.h:23
gcp::util::NetMsg * getLastSentNetMsg()
Definition: NetCommHandler.cc:189