The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SeqnoFrame class

Class representing packet "sequence numbers" - subclass of Frame class. More...

Collaboration diagram for SeqnoFrame class:

Functions

FSTATIC void _seqnoframe_initsessionid (void)
 Initialize our session ID to something monotonically increasing. More...
 
FSTATIC void _seqnoframe_setreqid (SeqnoFrame *self, guint64 value)
 Set the request id value associated with a SeqnoFrame. More...
 
FSTATIC void _seqnoframe_setqid (SeqnoFrame *self, guint16 value)
 Set the Queue id value associated with a SeqnoFrame. More...
 
FSTATIC guint64 _seqnoframe_getreqid (SeqnoFrame *self)
 Get the request id associated with a SeqnoFrame. More...
 
FSTATIC guint16 _seqnoframe_getqid (SeqnoFrame *self)
 Get the queue id associated with a SeqnoFrame. More...
 
FSTATIC guint32 _seqnoframe_getsessionid (SeqnoFrame *self)
 Get the session id associated with a SeqnoFrame. More...
 
FSTATIC gboolean _seqnoframe_equal (SeqnoFrame *self, SeqnoFrame *rhs)
 Compare two SeqnoFrames for equality including the queue id. More...
 
FSTATIC int _seqnoframe_compare (SeqnoFrame *self, SeqnoFrame *rhs)
 Compare two SeqnoFrames - ignoring the queue id. More...
 
FSTATIC void _seqnoframe_updatedata (Frame *fself,gpointer tlvptr,gconstpointer pktend,FrameSet *fs)
 Update packet data from the frame. More...
 
Frameseqnoframe_tlvconstructor (gconstpointer tlvstart, gconstpointer pktend, gpointer *ignorednewpkt, gpointer *ignoredpktend)
 Construct Frame (SeqnoFrame) object from marshalled packet data. More...
 
FSTATIC gboolean _seqnoframe_isvalid (const Frame *self,gconstpointer tlvptr,gconstpointer pktend)
 Return TRUE if this sequence number is valid - if it's the right size. More...
 
SeqnoFrameseqnoframe_new (guint16 frametype, int objsize)
 Construct new SeqnoFrame object. More...
 
SeqnoFrameseqnoframe_new_init (guint16 frametype, guint64 reqid, guint16 qid)
 Construct a fully-iniitialized SeqnoFrame object. More...
 
FSTATIC char * _seqnoframe_toString (gconstpointer vself)
 
typedef struct _SeqnoFrame SeqnoFrame
 

Detailed Description

Class representing packet "sequence numbers" - subclass of Frame class.

Typedef Documentation

typedef struct _SeqnoFrame SeqnoFrame

Definition at line 35 of file seqnoframe.h.

Function Documentation

FSTATIC int _seqnoframe_compare ( SeqnoFrame self,
SeqnoFrame rhs 
)

Compare two SeqnoFrames - ignoring the queue id.

Definition at line 131 of file seqnoframe.c.

References _SeqnoFrame::getreqid, and _SeqnoFrame::getsessionid.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC gboolean _seqnoframe_equal ( SeqnoFrame self,
SeqnoFrame rhs 
)

Compare two SeqnoFrames for equality including the queue id.

Definition at line 122 of file seqnoframe.c.

References _SeqnoFrame::_qid.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC guint16 _seqnoframe_getqid ( SeqnoFrame self)

Get the queue id associated with a SeqnoFrame.

Definition at line 109 of file seqnoframe.c.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC guint64 _seqnoframe_getreqid ( SeqnoFrame self)

Get the request id associated with a SeqnoFrame.

Definition at line 103 of file seqnoframe.c.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC guint32 _seqnoframe_getsessionid ( SeqnoFrame self)

Get the session id associated with a SeqnoFrame.

Definition at line 115 of file seqnoframe.c.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC void _seqnoframe_initsessionid ( void  )

Initialize our session ID to something monotonically increasing.

There are a couple of ways of achieving this...

  • One method is to store a sequence number in a file - but this has problems when you restore machines or if you can't create persistent files
  • Another method is to use the time of day - but if the clock gets set back to a time before the previous session id, then this doesn't work.
  • The best idea seems to be to use the time of day, but also store that value in a file. If the time gets set back before the previous session id, then use the previous session id + 1.
Todo:
: cache this on disk and so on as described above...

Definition at line 78 of file seqnoframe.c.

References FIVESECONDS, and g_get_real_time().

Referenced by seqnoframe_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC gboolean _seqnoframe_isvalid ( const Frame self,
gconstpointer  tlvptr,
gconstpointer  pktend 
)

Return TRUE if this sequence number is valid - if it's the right size.

Parameters
selfFrame to validate
tlvptrTLV pointer to our TLV
pktendpointer to one byte past end of packet

Definition at line 193 of file seqnoframe.c.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC void _seqnoframe_setqid ( SeqnoFrame self,
guint16  value 
)

Set the Queue id value associated with a SeqnoFrame.

Definition at line 96 of file seqnoframe.c.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC void _seqnoframe_setreqid ( SeqnoFrame self,
guint64  value 
)

Set the request id value associated with a SeqnoFrame.

Definition at line 89 of file seqnoframe.c.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC char * _seqnoframe_toString ( gconstpointer  vself)

Definition at line 258 of file seqnoframe.c.

References CASTTOCONSTCLASS, and FMT_64BIT.

Referenced by seqnoframe_new().

Here is the caller graph for this function:

FSTATIC void _seqnoframe_updatedata ( Frame fself,
gpointer  tlvptr,
gconstpointer  pktend,
FrameSet fs 
)

Update packet data from the frame.

Todo:
add a new get_generic_nonconst_tlv_value() function.
Parameters
fselfobject whose data will be put into FrameSet packet
tlvptrpointer to our current TLV entry
pktendend of packet
fsFrameSet that we're doing this for

Definition at line 153 of file seqnoframe.c.

References CASTTOCLASS, get_generic_tlv_nonconst_value(), tlv_set_guint16(), tlv_set_guint32(), and tlv_set_guint64().

Referenced by seqnoframe_new().

Here is the call graph for this function:

Here is the caller graph for this function:

SeqnoFrame* seqnoframe_new_init ( guint16  frametype,
guint64  reqid,
guint16  qid 
)

Construct a fully-iniitialized SeqnoFrame object.

Parameters
frametypeType of frame to create with this value
reqidRequest id
qidQueue id

Definition at line 245 of file seqnoframe.c.

References seqnoframe_new(), _SeqnoFrame::setqid, and _SeqnoFrame::setreqid.

Referenced by _fsqueue_enq().

Here is the call graph for this function:

Here is the caller graph for this function:

Frame* seqnoframe_tlvconstructor ( gconstpointer  tlvstart,
gconstpointer  pktend,
gpointer *  ignorednewpkt,
gpointer *  ignoredpktend 
)

Construct Frame (SeqnoFrame) object from marshalled packet data.

Parameters
[in]tlvstartStart of SeqnoFrame TLV area
[in]pktendfirst byte past end of packet
ignorednewpkt[ignored] replacement packet
ignoredpktend[ignored] end of replacement packet

Definition at line 171 of file seqnoframe.c.

References _SeqnoFrame::_sessionid, CASTTOCLASS, get_generic_tlv_len(), get_generic_tlv_type(), get_generic_tlv_value(), seqnoframe_new(), _SeqnoFrame::setqid, _SeqnoFrame::setreqid, tlv_get_guint16(), tlv_get_guint32(), and tlv_get_guint64().

Here is the call graph for this function: