The Assimilation Project  based on Assimilation version 1.1.7.1474836767
fsprotocol.c File Reference

FrameSet queueing class. More...

#include <string.h>
#include <projectcommon.h>
#include <fsprotocol.h>
#include <framesettypes.h>
#include <frametypes.h>
#include <seqnoframe.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
Include dependency graph for fsprotocol.c:

Go to the source code of this file.

Macros

#define AUDITFSPE(fspe)   { if (fspe) _fsprotocol_auditfspe(fspe, __FUNCTION__, __LINE__); }
 
#define AUDITIREADY(self)   {_fsprotocol_auditiready(__FUNCTION__, __LINE__, self);}
 
#define A_CLOSE   (1<<0)
 0x01 - set cleanup timer More...
 
#define A_OOPS   (1<<1)
 0x02 - this should not happen - complain about it More...
 
#define A_DEBUG   (1<<2)
 0x04 - print state info, etc More...
 
#define A_SNDNAK   (1<<3)
 0x08 Don't appear to be using this action... More...
 
#define A_SNDSHUT   (1<<4)
 0x10 Send CONNSHUT packet More...
 
#define A_ACKTO   (1<<5)
 0x20 - Announce an ACK timeout - 0x20 More...
 
#define A_ACKME   (1<<6)
 0x40 - Ack this packet More...
 
#define A_TIMER   (1<<7)
 0x80 Start the FSPROTO_SHUT_TO timer - calls _fsprotocol_shuttimeout - More...
 
#define A_NOTIME   (1<<8)
 0x100 Cancel the FSPROTO_SHUT_TO timer More...
 
#define A_NOSHUT   (1<<9)
 0x200 Flush out any pending CONNSHUT packets More...
 
#define SHUTnTIMER   (A_SNDSHUT|A_TIMER)
 
#define ACKnSHUT   (A_ACKME|SHUTnTIMER)
 
#define ACKnCLOSE   (A_ACKME|A_CLOSE)
 
#define CLOSEnNOTIME   (A_CLOSE|A_NOTIME)
 
#define TRYXMIT(fspe)   {AUDITFSPE(fspe); _fsprotocol_xmitifwecan(fspe);}
 Try and transmit a packet after auditing the FSPE data structure. More...
 

Typedefs

typedef enum _FsProtoInput FsProtoInput
 

Enumerations

enum  _FsProtoInput {
  FSPROTO_GOTSTART = 0, FSPROTO_REQSEND = 1, FSPROTO_GOTCONN_NAK = 2, FSPROTO_REQSHUTDOWN = 3,
  FSPROTO_RCVSHUTDOWN = 4, FSPROTO_ACKTIMEOUT = 5, FSPROTO_OUTALLDONE = 6, FSPROTO_SHUT_TO = 7,
  FSPROTO_INVAL
}
 Inputs are: More...
 

Functions

FSTATIC void _fsprotocol_protoelem_destroy (gpointer fsprotoelemthing)
 Finalize function suitable for GHashTables holding FsProtoElems as keys (and values) More...
 
FSTATIC gboolean _fsprotocol_protoelem_equal (gconstpointer lhs, gconstpointer rhs)
 Equal-compare function for FsProtoElem structures suitable for GHashTables. More...
 
FSTATIC guint _fsprotocol_protoelem_hash (gconstpointer fsprotoelemthing)
 Hash function over FsProtoElem structures suitable for GHashTables. More...
 
FSTATIC gboolean _fsprotocol_timeoutfun (gpointer userdata)
 Retransmit timer function... More...
 
FSTATIC gboolean _fsprotocol_shuttimeout (gpointer userdata)
 Channel shutdown timer - invokes the FSA with FSPROTO_SHUT_TO. More...
 
FSTATIC gboolean _fsprotocol_finalizetimer (gpointer userdata)
 Close down (free up) an FSPE object when the timer pops - provided its still closed... More...
 
FSTATIC void _fsprotocol_finalize (AssimObj *aself)
 Finalize function for our FsProtocol class objects. More...
 
FSTATIC FsProtoElem_fsprotocol_addconn (FsProtocol *self, guint16 qid, NetAddr *destaddr)
 Add and return a FsProtoElem connection to our collection of connections... More...
 
FSTATIC void _fsprotocol_closeconn (FsProtocol *self, guint16 qid, const NetAddr *destaddr)
 Close a specific connection - allowing it to be reopened by more communication – effectively a reset. More...
 
FSTATIC FsProtoState _fsprotocol_connstate (FsProtocol *self, guint16 qid, const NetAddr *destaddr)
 
FSTATIC FsProtoElem_fsprotocol_find (FsProtocol *self, guint16 qid, const NetAddr *destaddr)
 Locate the FsProtoElem structure that corresponds to this (destaddr, qid) pair Convert everything to v6 addresses before lookup. More...
 
FSTATIC FsProtoElem_fsprotocol_findbypkt (FsProtocol *self, NetAddr *addr, FrameSet *fs)
 Find the FsProtoElem that corresponds to the given FrameSet class. More...
 
FSTATIC gboolean _fsprotocol_iready (FsProtocol *self)
 Return TRUE if there are any packets available to read. More...
 
FSTATIC gboolean _fsprotocol_outputpending (FsProtocol *self)
 Return TRUE if there are any unACKed packets in any output queue. More...
 
FSTATIC FrameSet_fsprotocol_read (FsProtocol *self, NetAddr **fromaddr)
 Read the next available FrameSet from any of our sources. More...
 
FSTATIC void _fsprotocol_receive (FsProtocol *self, NetAddr *fromaddr, FrameSet *fs)
 Enqueue a received packet - handling ACKs when they show up. More...
 
FSTATIC gboolean _fsprotocol_send1 (FsProtocol *self, FrameSet *fs, guint16 qid, NetAddr *toaddr)
 Enqueue and send a single reliable frameset. More...
 
FSTATIC gboolean _fsprotocol_send (FsProtocol *self, GSList *framesets, guint16 qid, NetAddr *toaddr)
 Enqueue and send a list of reliable FrameSets (send all or none) More...
 
FSTATIC void _fsprotocol_ackmessage (FsProtocol *self, NetAddr *destaddr, FrameSet *fs)
 Send an ACK packet that corresponds to this FrameSet. More...
 
FSTATIC void _fsprotocol_ackseqno (FsProtocol *self, NetAddr *destaddr, SeqnoFrame *seq)
 Send an ACK packet that corresponds to this sequence number frame. More...
 
FSTATIC void _fsprotocol_closeall (FsProtocol *self)
 Start the process of shutting down all our connections. More...
 
FSTATIC int _fsprotocol_activeconncount (FsProtocol *self)
 
FSTATIC void _fsprotocol_xmitifwecan (FsProtoElem *fspe)
 Our role in life is to send any packets that need sending. More...
 
FSTATIC void _fsproto_sendconnak (FsProtoElem *fspe, NetAddr *dest)
 
FSTATIC void _fsprotocol_fspe_closeconn (FsProtoElem *self)
 Close down (destroy) an FSPE-level connection Note that this depends on FsProtoElemSearchKey being the same as start of FsProtoElem. More...
 
FSTATIC void _fsprotocol_fspe_reinit (FsProtoElem *self)
 
FSTATIC gboolean _fsprotocol_canclose_immediately (gpointer v_fspe, gpointer unused, gpointer unused_user)
 Returns TRUE if the given FSPE can be closed immediately. More...
 
FSTATIC void _fsprotocol_log_conn (FsProtocol *self, guint16 qid, NetAddr *destaddr)
 Dump information about this connection to our logs. More...
 
FSTATIC void _fsprotocol_auditfspe (const FsProtoElem *self, const char *function, int lineno)
 Audit a FsProtoElem object for consistency */. More...
 
FSTATIC void _fsprotocol_auditiready (const char *fun, unsigned lineno, const FsProtocol *self)
 
FSTATIC void _fsprotocol_fsa (FsProtoElem *fspe,FsProtoInput input, FrameSet *fs)
 FsProtocol Finite state Automaton modelling connection establishment and shutdown. More...
 
FSTATIC const char * _fsprotocol_fsa_states (FsProtoState state)
 Returns the state name (string) for state - returns static data. More...
 
FSTATIC const char * _fsprotocol_fsa_inputs (FsProtoInput input)
 Returns the input name (string) for an input - returns static array. More...
 
FSTATIC const char * _fsprotocol_fsa_actions (unsigned int actionbits)
 
FSTATIC void _fsprotocol_fsa_history (FsProtoElem *self,FsProtoState state,FsProtoInput input,guint16 actions)
 Add a (state, input, action) to the history for this particular FSA. More...
 
FSTATIC void _fsprotocol_fsa_log_history (FsProtoElem *self,FsProtoState curstate,FsProtoState nextstate,FsProtoInput input,guint16 nextactions)
 Log our FSA history for all to see... More...
 
FSTATIC void _fsprotocol_flush_pending_connshut (FsProtoElem *fspe)
 Flush the leading CONNSHUT packet in the queue – if any. More...
 
FSTATIC const char * _fsprotocol_fsa_actions (unsigned actionmask)
 Returns a string representing a set of actions - static array returned. More...
 
WINEXPORT FsProtocolfsprotocol_new (guint objsize, NetIO *io, guint rexmit_timer_uS)
 Construct an FsProtocol object. More...
 

Detailed Description

FrameSet queueing class.

This includes code to implement FrameSet queueing for reliable communication

This file is part of the Assimilation Project.

Author
Copyright © 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file fsprotocol.c.

Macro Definition Documentation

#define AUDITIREADY (   self)    {_fsprotocol_auditiready(__FUNCTION__, __LINE__, self);}

Typedef Documentation

Definition at line 64 of file fsprotocol.c.

Function Documentation

FSTATIC void _fsproto_sendconnak ( FsProtoElem fspe,
NetAddr dest 
)
FSTATIC const char* _fsprotocol_fsa_actions ( unsigned int  actionbits)

Referenced by _fsprotocol_fsa(), and _fsprotocol_fsa_log_history().

Here is the caller graph for this function: