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

A base class for transforming an incoming packet into a GSList of FrameSet class objects. More...

Collaboration diagram for PacketDecoder class:

Functions

FSTATIC Frame_framedata_to_frameobject (PacketDecoder *, gconstpointer, gconstpointer, gconstpointer)
 
FSTATIC FrameSet_decode_packet_get_frameset_data (gconstpointer vfsstart,gconstpointer vpktend,const void **fsnext)
 Construct a basic FrameSet object from the initial marshalled FrameSet data in a packet. More...
 
FSTATIC Frame_decode_packet_framedata_to_frameobject (PacketDecoder *self,gconstpointer *pktstart, gconstpointer *pktend,gpointer *newpacket)
 Given a pointer to a TLV entry for the data corresponding to a Frame, construct a corresponding Frame. More...
 
FSTATIC GSList * _pktdata_to_framesetlist (PacketDecoder *self,gconstpointer pktstart,gconstpointer pktend)
 Constructs a GSList list of FrameSet class objects from a datagram/packet. More...
 
FSTATIC void _packetdecoder_finalize (AssimObj *selfobj)
 Function for finalizing. More...
 
PacketDecoderpacketdecoder_new (guint objsize, const FrameTypeToFrame *framemap, gint mapsize)
 Initialize our frame type map. More...
 
typedef struct _FrameTypeToFrame FrameTypeToFrame
 
typedef Frame *(* FramePktConstructor )(gconstpointer tlvstart, gconstpointer pktend, gpointer *, gpointer *)
 
typedef struct _PacketDecoder PacketDecoder
 

Detailed Description

A base class for transforming an incoming packet into a GSList of FrameSet class objects.

Each FrameSet class is composed of a series of Frames.

Typedef Documentation

typedef Frame*(* FramePktConstructor)(gconstpointer tlvstart, gconstpointer pktend, gpointer *, gpointer *)

Definition at line 34 of file packetdecoder.h.

Definition at line 32 of file packetdecoder.h.

typedef struct _PacketDecoder PacketDecoder

Definition at line 43 of file packetdecoder.h.

Function Documentation

FSTATIC Frame * _decode_packet_framedata_to_frameobject ( PacketDecoder self,
gconstpointer *  pktstart,
gconstpointer *  pktend,
gpointer *  newpacket 
)

Given a pointer to a TLV entry for the data corresponding to a Frame, construct a corresponding Frame.

Returns
a decoded frame plus pointer to the first byte past this Frame (in 'nextframe')
Parameters
[in,out]selfPacketDecoder object
[in,out]pktstartMarshalled Frame data
[in,out]pktend1st byte past pkt end
[out]newpacketReplacement packet from frame decoding (if any)

Definition at line 120 of file packetdecoder.c.

References _Frame::dataspace, get_generic_tlv_type(), and unknownframe_tlvconstructor().

Referenced by _pktdata_to_framesetlist().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC FrameSet * _decode_packet_get_frameset_data ( gconstpointer  vfsstart,
gconstpointer  vpktend,
void const **  fsnext 
)

Construct a basic FrameSet object from the initial marshalled FrameSet data in a packet.

Parameters
[in]vfsstartStart of this FrameSet
[in]vpktendFirst byte past end of packet
[out]fsnextPointer to first byte after this FrameSet (that is, the first byte of contained frames)

Definition at line 150 of file packetdecoder.c.

References FRAMESET_INITSIZE, frameset_new(), frameset_set_flags(), GENERICTLV_HDRSZ, get_generic_tlv_len(), get_generic_tlv_type(), and tlv_get_guint16().

Referenced by _pktdata_to_framesetlist().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC Frame* _framedata_to_frameobject ( PacketDecoder ,
gconstpointer  ,
gconstpointer  ,
gconstpointer   
)
FSTATIC void _packetdecoder_finalize ( AssimObj selfobj)

Function for finalizing.

Definition at line 63 of file packetdecoder.c.

References CASTTOCLASS, and FREE.

Referenced by packetdecoder_new().

Here is the caller graph for this function:

GSList * _pktdata_to_framesetlist ( PacketDecoder self,
gconstpointer  pktstart,
gconstpointer  pktend 
)

Constructs a GSList list of FrameSet class objects from a datagram/packet.

That is, it decodes the datagram/packet.

Returns
GSList of FrameSet class object pointers.
Parameters
[in]selfPacketDecoder object
[in]pktstartstart of packet
[in]pktendfirst byte past end of packet

Definition at line 182 of file packetdecoder.c.

References _decode_packet_framedata_to_frameobject(), _decode_packet_get_frameset_data(), frameset_append_frame(), FRAMESET_INITSIZE, and UNREF.

Referenced by packetdecoder_new().

Here is the call graph for this function:

Here is the caller graph for this function:

PacketDecoder* packetdecoder_new ( guint  objsize,
const FrameTypeToFrame framemap,
gint  mapsize 
)

Initialize our frame type map.

Post-condition: Every element of 'frametypemap' is initialized with a valid function pointer.

Definition at line 76 of file packetdecoder.c.

References _AssimObj::_finalize, _packetdecoder_finalize(), _pktdata_to_framesetlist(), assimobj_new(), CASTTOCLASS, DIMOF, _FrameTypeToFrame::frametype, MALLOC0, proj_class_register_subclassed(), and unknownframe_tlvconstructor().

Referenced by cma.AssimCclasses.pyPacketDecoder::__init__(), main(), and nano_packet_decoder().

Here is the call graph for this function:

Here is the caller graph for this function: