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

Class representing a collection of Frames to be sent in a single datagram. More...

Collaboration diagram for FrameSet class:

Macros

#define SPECIALFRAME(ftype)   ((FRAMETYPE_COMPRESS == (ftype)) || (FRAMETYPE_CRYPTCURVE28819 == (ftype)) || (FRAMETYPE_SIG == (ftype)))
 

Functions

FSTATIC SeqnoFrame_frameset_getseqno (FrameSet *self)
 
FSTATIC void _frameset_indir_finalize (void *f)
 static: finalize (free) frame More...
 
FSTATIC void _frameset_finalize (AssimObj *obj)
 static: finalize (free) frameset and all its constituent frames... More...
 
FrameSetframeset_new (guint16 frameset_type)
 Construct a new frameset of the given type. More...
 
void frameset_prepend_frame (FrameSet *fs, Frame *f)
 Prepend frame to the front of the frame list. More...
 
void frameset_append_frame (FrameSet *fs, Frame *f)
 Append frame to the front of the end of the frame list. More...
 
void frameset_construct_packet (FrameSet *fs, SignFrame *sigframe, CryptFrame *cryptframe, CompressFrame *compressframe)
 Construct packet to go correspond to this frameset. More...
 
guint16 frameset_get_flags (FrameSet *fs)
 Return the flags currently set on this FrameSet. More...
 
guint16 frameset_set_flags (FrameSet *fs, guint16 flagbits)
 Set (OR in) the given set of FrameSet flags. More...
 
guint16 frameset_clear_flags (FrameSet *fs, guint16 flagbits)
 Clear the given set of FrameSet flags (& ~flagbits) More...
 
gpointer frame_append_to_frameset_packet (FrameSet *fs, Frame *f, gpointer curpktpos)
 Append the given Frame to a FrameSet packet. More...
 
void frameset_dump (const FrameSet *fs)
 Dump out a FrameSet. More...
 
FSTATIC char * _frameset_toString (gconstpointer)
 
WINEXPORT const char * frameset_sender_key_id (const FrameSet *self)
 Return the key_id of this Frameset's CryptFrame sender – NULL if None. More...
 
WINEXPORT const char * frameset_sender_identity (const FrameSet *self)
 Return the identity of this Frameset's CryptFrame sender – NULL if None or Unknown. More...
 

Detailed Description

Class representing a collection of Frames to be sent in a single datagram.

Note that more than one FrameSet can be sent in a datagram, but a FrameSet may not be split across datagrams.

Macro Definition Documentation

#define SPECIALFRAME (   ftype)    ((FRAMETYPE_COMPRESS == (ftype)) || (FRAMETYPE_CRYPTCURVE28819 == (ftype)) || (FRAMETYPE_SIG == (ftype)))

Definition at line 128 of file frameset.c.

Function Documentation

FSTATIC void _frameset_finalize ( AssimObj obj)

static: finalize (free) frameset and all its constituent frames...

Todo:
should only do this if the frameset won't need retransmitting -
  • of course that should be handled by reference counts - not by special code here...
Parameters
objframeset to finalize

Definition at line 83 of file frameset.c.

References _frameset_indir_finalize(), CASTTOCLASS, _FrameSet::framelist, FREE, FREECLASSOBJ, _FrameSet::packet, and _FrameSet::pktend.

Referenced by frameset_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC SeqnoFrame * _frameset_getseqno ( FrameSet self)

Definition at line 367 of file frameset.c.

References __FUNCTION__, CASTTOCLASS, DEBUGMSG4, FRAMETYPE_REQID, and _Frame::type.

Referenced by frameset_new().

Here is the caller graph for this function:

FSTATIC void _frameset_indir_finalize ( void *  f)

static: finalize (free) frame

Parameters
fFrame to finalize

Definition at line 75 of file frameset.c.

References CASTTOCLASS, and UNREF.

Referenced by _frameset_finalize().

Here is the caller graph for this function:

FSTATIC char * _frameset_toString ( gconstpointer  vself)

Definition at line 385 of file frameset.c.

References _Frame::baseclass, CASTTOCLASS, CASTTOCONSTCLASS, and _AssimObj::toString.

Referenced by frameset_new().

Here is the caller graph for this function:

WINEXPORT gpointer frame_append_to_frameset_packet ( FrameSet fs,
Frame f,
gpointer  curpktpos 
)

Append the given Frame to a FrameSet packet.

Returns
updated current position
Parameters
fsFrameSet to append frame to
fFrame to append...
curpktposCurrent position in packet (not NULL)

Definition at line 331 of file frameset.c.

References _Frame::dataspace, _Frame::length, _FrameSet::packet, _FrameSet::pktend, tlv_set_guint16(), tlv_set_guint24(), _Frame::type, and _Frame::value.

Here is the call graph for this function:

void frameset_append_frame ( FrameSet fs,
Frame f 
)

Append frame to the front of the end of the frame list.

Parameters
fsFrameSet to fetch flags for
fFrame to put at the back of the frame list

Definition at line 143 of file frameset.c.

References _FrameSet::framelist, and REF.

Referenced by _discovery_sendjson(), _fsprotocol_ackseqno(), _fsprotocol_fsa(), _nano_send_rscexitstatus(), _pktdata_to_framesetlist(), address_tests(), cma.AssimCclasses.pyFrameSet::append(), cast_frameset_tests(), construct_pcap_frameset(), create_sendexpecthb(), create_setconfig(), fakecma_startup(), main(), nano_reqconfig(), nanoprobe_report_upstream(), and obey_pingpong().

Here is the caller graph for this function:

guint16 frameset_clear_flags ( FrameSet fs,
guint16  flagbits 
)

Clear the given set of FrameSet flags (& ~flagbits)

Parameters
fsFrameSet to fetch flags for
flagbitsBits to clear

Definition at line 319 of file frameset.c.

References _FrameSet::fsflags.

Referenced by cma.AssimCclasses.pyFrameSet::clear_flags().

Here is the caller graph for this function:

void frameset_construct_packet ( FrameSet fs,
SignFrame sigframe,
CryptFrame cryptframe,
CompressFrame compressframe 
)

Construct packet to go correspond to this frameset.

Once this is done, then this can be either sent out directly or queued with other framesets to send to the machine in question. If it needs to be retransmitted, that can also happen... If encryption methods have changed in the meantime, if we are asked to reconstruct a packet later.

Note

The order we put these special frames in the frameset is important. We apply them here from last to first, but on the other end they have to be applied from first to last. That means that we do these things in this order: Compress the frame - all the frame after the FRAMETYPE_COMPRESS TLV Encrypt the frame - all the frame after the FRAMETYPE_CRYPTCURVE25519 (or equivalent) TLV Perform a signature over the whole frame after the FRAMETYPE_SIG TLV

At the other end, this is reversed. Check the signature according to the initial FRAMETYPE_SIG frame, discard if incorrect. Decrypt the frame after the FRAMETYPE_CRYPTCURVE25519 (or similar) TLV Uncompress the frame after the FRAMETYPE_COMPRESS TLV

Encryption tends to make data hard to compress, so it's better to compress before encrypting.

Parameters
fsFrameSet for which we're creating a packet
sigframedigital Signature method (cannot be NULL)
cryptframeOptional Encryption method. This method might change the packet size.
compressframeOptional Compression method. This object modifies the packet "in place", and adjusts things accordingly.

Definition at line 159 of file frameset.c.

References _CompressFrame::baseclass, _CryptFrame::baseclass, CASTTOCLASS, compressframe_new(), _CompressFrame::compression_method, _CompressFrame::compression_threshold, _Frame::dataspace, frame_new(), _FrameSet::framelist, FRAMESET_INITSIZE, frameset_prepend_frame(), FRAMETYPE_COMPRESS, FRAMETYPE_CRYPTCURVE25519, FRAMETYPE_END, FRAMETYPE_SIG, FREE, _FrameSet::fsflags, _FrameSet::fstype, GENERICTLV_HDRSZ, _Frame::isvalid, _Frame::length, MALLOC0, _FrameSet::packet, _FrameSet::pktend, proj_class_classname(), set_generic_tlv_len(), set_generic_tlv_type(), tlv_set_guint16(), _Frame::type, UNREF, UNREF2, and _Frame::updatedata.

Referenced by _netio_sendaframeset(), _netio_sendframesets(), address_tests(), cast_frameset_tests(), and cma.AssimCclasses.pyFrameSet::construct_packet().

Here is the call graph for this function:

Here is the caller graph for this function:

void frameset_dump ( const FrameSet fs)

Dump out a FrameSet.

Parameters
fsFrameSet to dump

Definition at line 355 of file frameset.c.

References CASTTOCLASS, _Frame::dump, and _FrameSet::framelist.

Referenced by cma.AssimCclasses.pyFrameSet::dump().

Here is the caller graph for this function:

guint16 frameset_get_flags ( FrameSet fs)

Return the flags currently set on this FrameSet.

Parameters
fsFrameSet to fetch fsflags for

Definition at line 301 of file frameset.c.

References _FrameSet::fsflags.

Referenced by cma.AssimCclasses.pyFrameSet::get_flags().

Here is the caller graph for this function:

void frameset_prepend_frame ( FrameSet fs,
Frame f 
)

Prepend frame to the front of the frame list.

Parameters
fsFrameSet to fetch flags for
fFrame to put at the front of the frame list

Definition at line 132 of file frameset.c.

References _FrameSet::framelist, and REF.

Referenced by _fsqueue_enq(), frameset_construct_packet(), and cma.AssimCclasses.pyFrameSet::prepend().

Here is the caller graph for this function:

WINEXPORT const char* frameset_sender_identity ( const FrameSet self)

Return the identity of this Frameset's CryptFrame sender – NULL if None or Unknown.

Return Crypto identity.

Definition at line 432 of file frameset.c.

References cryptframe_whois_key_id(), and frameset_sender_key_id().

Referenced by _authlistener_got_frameset(), _nanoprobe_is_cma_frameset(), obey_pingpong(), and cma.AssimCclasses.pyFrameSet::sender_identity().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT const char* frameset_sender_key_id ( const FrameSet self)

Return the key_id of this Frameset's CryptFrame sender – NULL if None.

Return Crypto key_id.

Definition at line 415 of file frameset.c.

References CASTTOCLASS, OBJ_IS_A, and _CryptFrame::sender_key_id.

Referenced by _authlistener_got_frameset(), frameset_sender_identity(), obey_pingpong(), and cma.AssimCclasses.pyFrameSet::sender_id().

Here is the caller graph for this function:

guint16 frameset_set_flags ( FrameSet fs,
guint16  flagbits 
)

Set (OR in) the given set of FrameSet flags.

Parameters
fsFrameSet to fetch flags for
flagbitsBits to set

Definition at line 309 of file frameset.c.

References _FrameSet::fsflags.

Referenced by _decode_packet_get_frameset_data(), and cma.AssimCclasses.pyFrameSet::set_flags().

Here is the caller graph for this function: