forest-net
an overlay networks for large-scale virtual worlds
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
IoProcessor.h
Go to the documentation of this file.
1 
9 #ifndef IOPROCESSOR_H
10 #define IOPROCESSOR_H
11 
12 #include "Forest.h"
13 #include "IfaceTable.h"
14 #include "LinkTable.h"
15 #include "PacketStore.h"
16 #include "StatsModule.h"
17 
18 namespace forest {
19 
20 
21 class IoProcessor {
22 public:
23  IoProcessor(int, ipp_t, IfaceTable*, LinkTable*,
25  ~IoProcessor();
26 
27  bool setup(int);
28  bool ready(int);
29  bool setupBootSock(ipa_t, ipa_t);
30  void closeBootSock();
31 
32  int receive();
33  void send(int,int);
34 
35 private:
36  ipp_t bootIp;
37  ipa_t nmIp;
38  int bootSock;
39  ipp_t portNum;
40 
41  int maxIface;
42  int maxSockNum;
43  fd_set *sockets;
44  int cIf;
45  int nRdy;
46  int *sock;
47 
52 };
53 
54 inline bool IoProcessor::ready(int iface) { return sock[iface] > 0; }
55 
56 } // ends namespace
57 
58 
59 #endif