The Assimilation Project  based on Assimilation version
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;
67  GHashTable* aliases;
68  double _rcvloss;
69  double _xmitloss;
70  gboolean _shouldlosepkts;
71  gboolean (*input_queued)
72  (const NetIO* self);
73  gboolean (*bindaddr)
74  (NetIO* self,
75  const NetAddr*,
76  gboolean silent)
77  ; // (separate line to work around doxygen bug)
78  NetAddr* (*boundaddr)(const NetIO* self);
79  gboolean (*mcastjoin)
80  (NetIO* self,
81  const NetAddr*,
82  const NetAddr*);
83  gboolean (*setmcast_ttl)
84  (NetIO* self,
85  guint8 ttl)
86  ; // ";" is here to work around a doxygen bug
87  void (*addalias)(NetIO*, NetAddr*, NetAddr*);
89  gint (*getfd)
90  (const NetIO* self);
91  void (*setblockio)
92  (const NetIO* self,
93  gboolean blocking)
94  ; // ";" is here to work around a doxygen bug
95  int (*getsockbufsize)
96  (const NetIO* self,
97  gboolean forinput)
98  ; // ";" is here to work around a doxygen bug
99  int (*setsockbufsize)
100  (const NetIO* self,
101  gboolean forinput,
102  gsize bufsize)
103  ; // ";" is here to work around a doxygen bug
106  gsize (*getmaxpktsize)
107  (const NetIO* self);
108  gsize (*setmaxpktsize)
109  (NetIO*,
110  gsize);
111  void (*sendaframeset)
112  (NetIO* self,
114  const NetAddr* dest,
115  FrameSet* frameset)
116  ; // ";" is here to work around a doxygen bug
117  void (*sendframesets)
118  (NetIO* self,
120  const NetAddr* dest,
121  GSList* framesets)
122  ; // ";" is here to work around a doxygen bug
123  GSList* (*recvframesets)
124  (NetIO*,
126  NetAddr** src);
127  gboolean (*sendareliablefs)
128  (NetIO*self,
130  NetAddr* dest,
131  guint16 queueid,
132  FrameSet* frameset)
133  ; // ";" is here to work around a doxygen bug
134  gboolean (*sendreliablefs)
135  (NetIO*self,
137  NetAddr* dest,
138  guint16 queueid,
139  GSList* fslist)
140  ; // ";" is here to work around a doxygen bug
141  gboolean (*ackmessage)
142  (NetIO* self,
143  NetAddr* dest,
144  FrameSet* frameset)
145  ; // ";" is here to work around a doxygen bug
150  gboolean (*supportsreliable)
151  (NetIO* self)
152  ; // ";" is here to work around a doxygen bug
153  gboolean (*outputpending)
154  (NetIO* self)
155  ; // ";" is here to work around a doxygen bug
156  void (*closeconn)
157  (NetIO* self,
158  guint16 qid,
159  const NetAddr* destaddr)
160  ; // ";" is here to work around a doxygen bug
161  SignFrame* (*signframe)
162  (NetIO*self);
163  CompressFrame* (*compressframe)
164  (NetIO*self)
165  ; // ";" is here to work around a doxygen bug
166  void (*setpktloss)
167  (NetIO* self,
168  double rcv,
169  double xmit)
170  ; // ";" is here to work around a doxygen bug
171  void (*enablepktloss)
172  (NetIO* self,
173  gboolean enable)
174  ; // ";" is here to work around a doxygen bug
175 };
181 #endif /* _NETIO_H */
guint64 recvcalls
How many recvfrom calls have we done?
Definition: netio.h:42
int setsockbufsize(const NetIO *self, gboolean forinput, gsize bufsize)
< Set socket buffer size - return new size or -1
void setblockio(const NetIO *self, gboolean blocking)
< 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!
Describes interfaces to Signature Frame (Signframe) C-Class - providing digital signatures.
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
void(* addalias)(NetIO *, NetAddr *, NetAddr *)
Add an alias to our received address alias table.
Definition: netio.h:87
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:66
AssimObj baseclass
Definition: netio.h:59
gboolean _shouldlosepkts
private: TRUE to enable packet loss...
Definition: netio.h:70
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:67
WINEXPORT gboolean netio_is_dual_ipv4v6_stack(void)
Definition: netio.c:859
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)
< 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)
int getsockbufsize(const NetIO *self, gboolean forinput)
< Return socket buffer size: -1 on failure
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:450
gint _maxpktsize
Maximum packet size for this transport.
Definition: netio.h:62
double _xmitloss
private: Transmit loss fraction
Definition: netio.h:69
gsize getmaxpktsize(const NetIO *self)
< Return maximum packet size for this NetIO
GIOChannel * giosock
Glib GIOChannel for this socket.
Definition: netio.h:61
double _rcvloss
private: Receive loss fraction
Definition: netio.h:68
gboolean mcastjoin(NetIO *self, const NetAddr *, const NetAddr *)
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