The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Go to the documentation of this file.
26 #ifndef _NETIO_H
27 #define _NETIO_H
28 #include <projectcommon.h>
29 #include <assimobj.h>
30 #include <glib.h>
31 #include <netaddr.h>
32 #include <frame.h>
33 #include <signframe.h>
34 #include <compressframe.h>
35 #include <configcontext.h>
36 #include <packetdecoder.h>
40 typedef struct _NetIOstats NetIOstats;
41 struct _NetIOstats {
42  guint64 recvcalls;
43  guint64 pktsread;
44  guint64 fsreads;
45  guint64 sendcalls;
46  guint64 pktswritten;
47  guint64 fswritten;
48  guint64 reliablesends;
49  guint64 reliablereads;
50  guint64 ackssent;
51  guint64 acksrecvd;
52 };
53 typedef struct _NetIO NetIO;
58 struct _NetIO {
61  GIOChannel* giosock;
62  gint _maxpktsize;
68  GHashTable* aliases;
69  double _rcvloss;
70  double _xmitloss;
71  gboolean _shouldlosepkts;
72  gboolean (*input_queued)
73  (const NetIO* self);
74  gboolean (*bindaddr)
75  (NetIO* self,
76  const NetAddr*,
77  gboolean silent)
78  ; // (separate line to work around doxygen bug)
79  NetAddr* (*boundaddr)(const NetIO* self);
80  gboolean (*mcastjoin)
81  (NetIO* self,
82  const NetAddr*,
83  const NetAddr*);
84  gboolean (*setmcast_ttl)
85  (NetIO* self,
86  guint8 ttl)
87  ; // ";" is here to work around a doxygen bug
88  void (*addalias)(NetIO*, NetAddr*, NetAddr*);
90  gint (*getfd)
91  (const NetIO* self);
92  void (*setblockio)
93  (const NetIO* self,
94  gboolean blocking)
95  ; // ";" is here to work around a doxygen bug
96  gsize (*getmaxpktsize)
97  (const NetIO* self);
98  gsize (*setmaxpktsize)
99  (NetIO*,
100  gsize);
101  void (*sendaframeset)
102  (NetIO* self,
104  const NetAddr* dest,
105  FrameSet* frameset)
106  ; // ";" is here to work around a doxygen bug
107  void (*sendframesets)
108  (NetIO* self,
110  const NetAddr* dest,
111  GSList* framesets)
112  ; // ";" is here to work around a doxygen bug
113  GSList* (*recvframesets)
114  (NetIO*,
116  NetAddr** src);
117  gboolean (*sendareliablefs)
118  (NetIO*self,
120  NetAddr* dest,
121  guint16 queueid,
122  FrameSet* frameset)
123  ; // ";" is here to work around a doxygen bug
124  gboolean (*sendreliablefs)
125  (NetIO*self,
127  NetAddr* dest,
128  guint16 queueid,
129  GSList* fslist)
130  ; // ";" is here to work around a doxygen bug
131  gboolean (*ackmessage)
132  (NetIO* self,
133  NetAddr* dest,
134  FrameSet* frameset)
135  ; // ";" is here to work around a doxygen bug
140  gboolean (*supportsreliable)
141  (NetIO* self)
142  ; // ";" is here to work around a doxygen bug
143  gboolean (*outputpending)
144  (NetIO* self)
145  ; // ";" is here to work around a doxygen bug
146  void (*closeconn)
147  (NetIO* self,
148  guint16 qid,
149  const NetAddr* destaddr)
150  ; // ";" is here to work around a doxygen bug
151  SignFrame* (*signframe)
152  (NetIO*self);
153  Frame* (*cryptframe)
154  (NetIO*self);
155  CompressFrame* (*compressframe)
156  (NetIO*self)
157  ; // ";" is here to work around a doxygen bug
158  void (*setpktloss)
159  (NetIO* self,
160  double rcv,
161  double xmit)
162  ; // ";" is here to work around a doxygen bug
163  void (*enablepktloss)
164  (NetIO* self,
165  gboolean enable)
166  ; // ";" is here to work around a doxygen bug
167 };
173 #endif /* _NETIO_H */
guint64 recvcalls
How many recvfrom calls have we done?
Definition: netio.h:42
void setblockio(const NetIO *self, gboolean blocking)
<[in] Set blocking/non-blocking mode
guint64 ackssent
How many ACKs have we sent?
Definition: netio.h:50
NetAddr * destaddr
Definition: nanomain.c:75
gboolean sendreliablefs(NetIO *self, NetAddr *dest, guint16 queueid, GSList *fslist)
< Reliably send multiple FrameSets (if possible)
gboolean outputpending(NetIO *self)
< return TRUE if this object has output pending
void setpktloss(NetIO *self, double rcv, double xmit)
< Set desired fraction of packet loss - TESTING ONLY!
void(* addalias)(NetIO *, NetAddr *, NetAddr *)
Add an alias to our received address alias table.
Definition: netio.h:88
Describes interfaces to Signature Frame (Signframe) C-Class - providing digital signatures.
This is the base Frame class object (in-memory TLV (type, length, value)) for every general component...
Definition: frame.h:43
gboolean ackmessage(NetIO *self, NetAddr *dest, FrameSet *frameset)
< User-level ACK of a message sent reliably
gboolean input_queued(const NetIO *self)
<[in] TRUE if input is queued ready to be read
guint64 reliablesends
How many reliable FrameSets have we sent?
Definition: netio.h:48
gboolean bindaddr(NetIO *self, const NetAddr *, gboolean silent)
<[in] Bind this NetIO to the given address
The SignFrame class object - implements digital signatures for FrameSets.
Definition: signframe.h:47
Definition: projectcommon.h:45
This file defines our base object class: AssimObj.
ConfigContext * _configinfo
I/O and other configuration information.
Definition: netio.h:63
void closeconn(NetIO *self, guint16 qid, const NetAddr *destaddr)
< Flush packets in queues to this address
CompressFrame * _compressframe
Compression frame to use in compressing FrameSets.
Definition: netio.h:67
AssimObj baseclass
Definition: netio.h:59
gboolean _shouldlosepkts
private: TRUE to enable packet loss...
Definition: netio.h:71
This is our CompressFrame class object - used for representing a compression method.
Definition: compressframe.h:41
GHashTable * aliases
IP address aliases for received packets.
Definition: netio.h:68
WINEXPORT gboolean netio_is_dual_ipv4v6_stack(void)
Definition: netio.c:755
void sendaframeset(NetIO *self, const NetAddr *dest, FrameSet *frameset)
< Send a FrameSet list to a NetIO class
Describes interfaces to C-String Frame (Compressframe) C-Class It holds conventional zero-terminated ...
Implements basic Frame class.
gint getfd(const NetIO *self)
<[in] Return file/socket descriptor
NetIOstats stats
Net I/O stats.
Definition: netio.h:60
guint64 reliablereads
How many reliable FrameSets have we read?
Definition: netio.h:49
Project common header file.
Implements Configuration Context class.
guint64 acksrecvd
How many ACKs have we received?
Definition: netio.h:51
SignFrame * _signframe
Signature frame to use in signing FrameSets.
Definition: netio.h:65
gboolean sendareliablefs(NetIO *self, NetAddr *dest, guint16 queueid, FrameSet *frameset)
[out] source address of return result
guint64 sendcalls
How many sendto calls have we done?
Definition: netio.h:45
void enablepktloss(NetIO *self, gboolean enable)
< enable packet loss (as set above)
guint64 fswritten
How many FrameSet class were successfully written?
Definition: netio.h:47
PacketDecoder * _decoder
Decodes packets into FrameSets.
Definition: netio.h:64
The NetAddr class class represents a general network address - whether IP, MAC, or any other type of ...
Definition: netaddr.h:43
Defines interfaces for the NetAddr (network address) object.
gsize setmaxpktsize(NetIO *, gsize)
< Set maximum packet size
guint64 pktsread
How many packets have been successfully read?
Definition: netio.h:43
FrameSet class - used for collecting Frames when not on the wire, and for marshalling/demarshalling t...
Definition: frameset.h:46
gboolean supportsreliable(NetIO *self)
< return TRUE if this object supports reliable transport
WINEXPORT NetIO * netio_new(gsize objsize, ConfigContext *, PacketDecoder *)
Don't call directly! - this is an abstract class...
Definition: netio.c:369
gint _maxpktsize
Maximum packet size for this transport.
Definition: netio.h:62
double _xmitloss
private: Transmit loss fraction
Definition: netio.h:70
gsize getmaxpktsize(const NetIO *self)
< Return maximum packet size for this NetIO
Frame * _cryptframe
Encryption frame to use in encrypting FrameSets.
Definition: netio.h:66
GIOChannel * giosock
Glib GIOChannel for this socket.
Definition: netio.h:61
double _rcvloss
private: Receive loss fraction
Definition: netio.h:69
gboolean mcastjoin(NetIO *self, const NetAddr *, const NetAddr *)
<Join multicast group
This file defines a few functions and interfaces for unmarshalling packet data into FrameSets...
guint64 fsreads
How many FrameSet class were successfully read?
Definition: netio.h:44
This is a basic NetIO class abstract class for doing network I/O.
Definition: netio.h:58
gboolean setmcast_ttl(NetIO *self, guint8 ttl)
< Set ipv4 multicast TTL
void sendframesets(NetIO *self, const NetAddr *dest, GSList *framesets)
< Send a FrameSet list to a NetIO class
guint64 pktswritten
How many packets have been successfully written?
Definition: netio.h:46