liblogging: beepframe.h Source File

Main Page | Compound List | File List | Compound Members | File Members | Related Pages

# beepframe.h

Go to the documentation of this file.

    00001
    00042 #ifndef __LIB3195_BEEPFRAME_H_INCLUDED__
    00043 #define __LIB3195_BEEPFRAME_H_INCLUDED__ 1
    00044
    00045 #include "beepmessage.h"
    00046 #include "beepchannel.h"
    00047 #define sbFramCHECKVALIDOBJECT(x) {assert(x != NULL); assert(x->OID == OIDsbFram);}
    00048
    00050 enum sbFramState_
    00051 {
    00052         /* RX flags */
    00053         sbFRAMSTATE_WAITING_HDR1,
    00054         sbFRAMSTATE_WAITING_HDR2,
    00055         sbFRAMSTATE_WAITING_HDR3,
    00056         sbFRAMSTATE_WAITING_SP_CHAN,
    00057         sbFRAMSTATE_IN_CHAN,
    00058         sbFRAMSTATE_WAITING_SP_MSGNO,
    00059         sbFRAMSTATE_IN_MSGNO,
    00060         sbFRAMSTATE_WAITING_SP_MORE,
    00061         sbFRAMSTATE_IN_MORE,
    00062         sbFRAMSTATE_WAITING_SP_SEQNO,
    00063         sbFRAMSTATE_IN_SEQNO,
    00064         sbFRAMSTATE_WAITING_SP_SIZE,
    00065         sbFRAMSTATE_IN_SIZE,
    00066         sbFRAMSTATE_WAITING_SP_ANSNO,
    00067         sbFRAMSTATE_IN_ANSNO,
    00068         sbFRAMSTATE_WAITING_SP_ACKNO,
    00069         sbFRAMSTATE_IN_ACKNO,
    00070         sbFRAMSTATE_WAITING_SP_WINDOW,
    00071         sbFRAMSTATE_IN_WINDOW,
    00072         sbFRAMSTATE_WAITING_HDRCR,
    00073         sbFRAMSTATE_WAITING_HDRLF,
    00074         sbFRAMSTATE_IN_PAYLOAD,
    00075         sbFRAMSTATE_WAITING_END1,
    00076         sbFRAMSTATE_WAITING_END2,
    00077         sbFRAMSTATE_WAITING_END3,
    00078         sbFRAMSTATE_WAITING_END4,
    00079         sbFRAMSTATE_WAITING_END5,
    00080         sbFRAMSTATE_RECEIVED,
    00082         /* TX flags */
    00083         sbFRAMSTATE_BEING_BUILD,
    00084         sbFRAMSTATE_READY_TO_SEND,
    00085         sbFRAMSTATE_SENDING,
    00086         sbFRAMSTATE_SENT,
    00088         sbFRAMSTATE_UNKNOWN = 0
    00089 };
    00090 typedef enum sbFramState_ sbFramState;
    00091
    00092 struct sbFramObject
    00096 {
    00097         srObjID OID;
    00098         struct sMesgObject* pMsg;
    00101         sbFramState iState;
    00102         char* szRawBuf;
    00103         int iFrameLen;
    00104         BEEPHdrID idHdr;
    00105         SBackno uAckno;
    00106         SBwindow uWindow;
    00107         SBchannel uChannel;
    00108         SBmsgno uMsgno;
    00109         SBseqno uSeqno;
    00110         SBsize uSize;
    00111         char cMore;
    00112         SBansno uAnsno;
    00113 #if FEATURE_LISTENER == 1
    00114         unsigned uBytesSend;
    00115         struct sbChanObject *pChan;
    00116         struct sbStrBObject *pStrBuf;
    00117         unsigned uToReceive;
    00118         void (*OnFramDestroy)(struct sbFramObject*);
    00119         void* pUsr;
    00120 #endif
    00121 };
    00122 typedef struct sbFramObject sbFramObj;
    00123
    00124 char* sbFramGetFrame(sbFramObj* pThis);
    00125 int sbFramGetFrameLen(sbFramObj* pThis);
    00126 BEEPHdrID sbFramGetHdrID(sbFramObj *pThis);
    00128 srRetVal sbFramDestroy(sbFramObj *pThis);
    00150 sbFramObj* sbFramCreateFramFromMesg(sbChanObj* pChan, sbMesgObj* pMesg, char* pszCmd, SBansno uAnsno);
    00151
    00171 sbFramObj* sbFramActualRecvFram(sbSessObj *pSess);
    00172
    00183 sbFramObj* sbFramRecvFram(sbChanObj* pChan);
    00184
    00197 srRetVal sbFramSendFram(sbFramObj* pThis, sbChanObj*pChan);
    00198
    00208 BEEPHdrID sbFramHdrID(char* szCmd);
    00209
    00214 srRetVal sbFramConstruct(sbFramObj **ppThis);
    00215
    00224 srRetVal sbFramCreateSEQFram(sbFramObj **ppThis, sbChanObj* pChan, SBackno uAckno, SBwindow uWindow);
    00225
    00234 srRetVal sbFramSetOnDestroyEvent(sbFramObj *pThis, void (*OnFramDestroy)(struct sbFramObject *), void *pUsr);
    00235
    00236 #endif