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  gboolean v4only;
63  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  int (*getsockbufsize)
97  (const NetIO* self,
98  gboolean forinput)
99  ; // ";" is here to work around a doxygen bug
100  int (*setsockbufsize)
101  (const NetIO* self,
102  gboolean forinput,
103  gsize bufsize)
104  ; // ";" is here to work around a doxygen bug
107  gsize (*getmaxpktsize)
108  (const NetIO* self);
109  gsize (*setmaxpktsize)
110  (NetIO*,
111  gsize);
112  void (*sendaframeset)
113  (NetIO* self,
115  const NetAddr* dest,
116  FrameSet* frameset)
117  ; // ";" is here to work around a doxygen bug
118  void (*sendframesets)
119  (NetIO* self,
121  const NetAddr* dest,
122  GSList* framesets)
123  ; // ";" is here to work around a doxygen bug
124  GSList* (*recvframesets)
125  (NetIO*,
127  NetAddr** src);
128  gboolean (*sendareliablefs)
129  (NetIO*self,
131  NetAddr* dest,
132  guint16 queueid,
133  FrameSet* frameset)
134  ; // ";" is here to work around a doxygen bug
135  gboolean (*sendreliablefs)
136  (NetIO*self,
138  NetAddr* dest,
139  guint16 queueid,
140  GSList* fslist)
141  ; // ";" is here to work around a doxygen bug
142  gboolean (*ackmessage)
143  (NetIO* self,
144  NetAddr* dest,
145  FrameSet* frameset)
146  ; // ";" is here to work around a doxygen bug
151  gboolean (*supportsreliable)
152  (NetIO* self)
153  ; // ";" is here to work around a doxygen bug
154  gboolean (*outputpending)
155  (NetIO* self)
156  ; // ";" is here to work around a doxygen bug
157  void (*closeconn)
158  (NetIO* self,
159  guint16 qid,
160  const NetAddr* destaddr)
161  ; // ";" is here to work around a doxygen bug
162  SignFrame* (*signframe)
163  (NetIO*self);
164  CompressFrame* (*compressframe)
165  (NetIO*self)
166  ; // ";" is here to work around a doxygen bug
167  void (*setpktloss)
168  (NetIO* self,
169  double rcv,
170  double xmit)
171  ; // ";" is here to work around a doxygen bug
172  void (*enablepktloss)
173  (NetIO* self,
174  gboolean enable)
175  ; // ";" is here to work around a doxygen bug
176 };
182 #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
gboolean v4only
True if giosock is an IPv4 socket.
Definition: netio.h:62
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:88
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:64
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:954
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:66
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:65
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:488
gint _maxpktsize
Maximum packet size for this transport.
Definition: netio.h:63
double _xmitloss
private: Transmit loss fraction
Definition: netio.h:70
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:69
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