The Assimilation Project  based on Assimilation version
Go to the documentation of this file.
34 #ifndef _FSPROTOCOL_H
35 #define _FSPROTOCOL_H
36 #include <assimobj.h>
37 #include <frameset.h>
38 #include <netaddr.h>
39 #include <fsqueue.h>
40 #include <netio.h>
45 typedef struct _FsProtocol FsProtocol;
46 typedef struct _FsProtoElem FsProtoElem;
57  FSPR_NONE = 0,
58  FSPR_INIT = 1,
59  FSPR_UP = 2,
64  FSPR_SHUT1 = 3,
65  FSPR_SHUT2 = 4,
66  FSPR_SHUT3 = 5,
68 };
70 #define FSPR_INSHUTDOWN(state) ((state) >= FSPR_SHUT1)
71 #define FSPE_HISTSIZE 8
76 struct _FsProtoElem {
78  guint16 _qid;
84  gint64 nextrexmit;
85  gint64 acktimeout;
87  guint shuttimer;
88  guint finalizetimer;
89  gboolean shutdown_complete;//< TRUE if the shutdown we asked for completed
90  gboolean is_encrypted;
91  char* peer_identity;
92  int hist_next;
96 };
100  const NetAddr* endpoint;
101  guint16 _qid;
102 };
107 struct _FsProtocol {
110  GHashTable* endpoints;
111  GList* unacked;
112  GQueue* ipend;
113  guint window_size;
115  gint64 acktimeout;
116  guint _timersrc;
117  FsProtoElem* (*find)(FsProtocol*,guint16,const NetAddr*);
118  FsProtoElem* (*findbypkt)(FsProtocol*, NetAddr*, FrameSet*);
119  FsProtoElem* (*addconn)(FsProtocol*, guint16, NetAddr*);
120  void (*closeconn)(FsProtocol*, guint16, const NetAddr*);
121  FsProtoState (*connstate)(FsProtocol*, guint16,const NetAddr*);
122  gboolean (*iready)(FsProtocol*);
123  gboolean (*outputpending)(FsProtocol*);
124  FrameSet* (*read)(FsProtocol*, NetAddr**);
125  void (*receive)(FsProtocol*, NetAddr*, FrameSet*);
126  gboolean (*send1)(FsProtocol*, FrameSet*, guint16, NetAddr*);
127  gboolean (*send)(FsProtocol*, GSList*, guint16, NetAddr*);
128  void (*ackmessage)(FsProtocol*, NetAddr*, FrameSet*);
129  void (*closeall)(FsProtocol*);
130  int (*activeconncount)(FsProtocol*);
131  void (*log_conn)(FsProtocol*, guint16, NetAddr*);
132 };
133 WINEXPORT FsProtocol* fsprotocol_new(guint objsize, NetIO* ioobj, guint rexmit_timer_uS);
134 #define DEFAULT_FSP_QID 0
136 #define FSPROTO_REXMITINTERVAL (2000000)
141 #endif /* _FSPROTOCOL_H */
It is REQUIRED that these fields are the same as the first two in the FsProtoElem structure...
Definition: fsprotocol.h:99
gboolean is_encrypted
TRUE if this channel is encrypted.
Definition: fsprotocol.h:90
guint16 _qid
Queue id of far endpoint.
Definition: fsprotocol.h:101
guint16 _qid
Queue id of far endpoint.
Definition: fsprotocol.h:78
Output drained, Waiting for CONNSHUT.
Definition: fsprotocol.h:66
guint shuttimer
FSPROTO_SHUT_TO timer (see FSA for details)
Definition: fsprotocol.h:87
guint finalizetimer
Timer for removing these objects (if not reopened)
Definition: fsprotocol.h:88
Implements minimal client-oriented Frame and Frameset capabilities.
No connection in progress.
Definition: fsprotocol.h:57
gint64 rexmit_interval
How often to retransmit - in uS.
Definition: fsprotocol.h:114
FsQueue * inq
Queue of incoming messages - perhaps missing packets...
Definition: fsprotocol.h:80
Connection initiated, awaiting first ACK packet from far side.
Definition: fsprotocol.h:58
Definition: projectcommon.h:45
gint64 nextrexmit
When to retransmit next...
Definition: fsprotocol.h:84
WINEXPORT FsProtocol * fsprotocol_new(guint objsize, NetIO *ioobj, guint rexmit_timer_uS)
Construct an FsProtocol object.
Definition: fsprotocol.c:784
int hist_next
current index into history circular queue
Definition: fsprotocol.h:92
guint16 fsa_actions[FSPE_HISTSIZE]
history of FSA actions
Definition: fsprotocol.h:95
Defines an abstract Network I/O class.
guint window_size
Window size of our connections.
Definition: fsprotocol.h:113
This file defines our base object class: AssimObj.
enum _FsProtoState FsProtoState
Definition: fsprotocol.h:48
NetAddr * endpoint
Who is our partner in this?
Definition: fsprotocol.h:77
SeqnoFrame * lastseqsent
Last sequence number which has been sent at least once.
Definition: fsprotocol.h:82
gint64 acktimeout
ACK timeout interval.
Definition: fsprotocol.h:115
FsQueue * outq
Queue of outbound messages.
Definition: fsprotocol.h:79
FsProtocol * parent
Our parent FsProtocol object.
Definition: fsprotocol.h:83
Note that the startup packet always has packet sequence number 1.
Definition: fsprotocol.h:56
This is an FsQueue class object - designed for queueuing up FrameSet class objects for transmission...
Definition: fsqueue.h:45
Connection fully established - received at least one ACK.
Definition: fsprotocol.h:63
Received a CONNSHUT packet, waiting for output to drain.
Definition: fsprotocol.h:65
guint8 fsa_inputs[FSPE_HISTSIZE]
history of FSA inputs
Definition: fsprotocol.h:94
gboolean shutdown_complete
Definition: fsprotocol.h:89
End marker - Invalid state.
Definition: fsprotocol.h:67
gint64 acktimeout
When to timeout waiting for an ACK.
Definition: fsprotocol.h:85
Definition: fsprotocol.h:71
char * peer_identity
Identity of the far end...
Definition: fsprotocol.h:91
Implements the FsQueue object.
GQueue * ipend
List of FsProtoElems ready to be read.
Definition: fsprotocol.h:112
SeqnoFrame * lastacksent
The highest sequence number we&#39;ve sent an ACK for.
Definition: fsprotocol.h:81
AssimObj baseclass
base AssimObj class object
Definition: fsprotocol.h:108
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.
FsProtoState fsa_states[FSPE_HISTSIZE]
history of FSA inputs
Definition: fsprotocol.h:93
NetIO * io
Our parent NetIO object.
Definition: fsprotocol.h:109
FrameSet class - used for collecting Frames when not on the wire, and for marshalling/demarshalling t...
Definition: frameset.h:46
guint _timersrc
gmainloop timer source id
Definition: fsprotocol.h:116
GHashTable * endpoints
All our FsProtoElem endpoints.
Definition: fsprotocol.h:110
FsProtoState state
State of this connection.
Definition: fsprotocol.h:86
This is a basic NetIO class abstract class for doing network I/O.
Definition: netio.h:58
GList * unacked
List of FsProtoElems awaiting ACKs.
Definition: fsprotocol.h:111
const NetAddr * endpoint
Who is our partner in this?
Definition: fsprotocol.h:100
This is an SeqnoFrame class TLV (type, length, value) frame.
Definition: seqnoframe.h:43
Not a full-blown class - just a utility structure.
Definition: fsprotocol.h:76
This is an FsProtocol class object - implementing a reliable user-level FrameSet class delivery syste...
Definition: fsprotocol.h:107
Waiting on CONNSHUT and ACK.
Definition: fsprotocol.h:64