Annotation of researchv9/jerq/src/mux/proto/packets.h, revision 1.1

1.1     ! root        1: #ifdef XT
        !             2: #ifndef        NPCBUFS
        !             3: #include       "sys/xtproto.h"
        !             4: #endif
        !             5: #define        freepkts        outen
        !             6: #define        user            flags
        !             7: #else  XT
        !             8: 
        !             9: /*
        !            10: **     Definition of a structure to hold status information
        !            11: **     for a conversation with a channel.
        !            12: */
        !            13: 
        !            14: #define        NPCBUFS         2                       /* Double buffered protocol */
        !            15: 
        !            16: struct Pktstate
        !            17: {
        !            18:        struct Packet   pkt;                    /* The packet */
        !            19:        short           timo;                   /* Timeout count */
        !            20:        unsigned char   state;                  /* Protocol state */
        !            21:        unsigned char   size;                   /* Packet size */
        !            22: };
        !            23: 
        !            24: typedef struct Pktstate        *Pks_p;
        !            25: 
        !            26: struct Pchannel
        !            27: {
        !            28:        struct Pktstate pkts[NPCBUFS];          /* The packets */
        !            29:        Pks_p           nextpkt;                /* Next packet to be acknowledged */
        !            30:        unsigned char   cdata[SEQMOD];          /* Remember control data */
        !            31:        unsigned char   rseq;                   /* Next receive sequence number */
        !            32:        unsigned char   xseq;                   /* Next transmit sequence number */
        !            33:        char            freepkts;               /* Number of free buffers */
        !            34:        char            user;                   /* Spare byte for users */
        !            35: };
        !            36: 
        !            37: typedef struct Pchannel        *       Pch_p;
        !            38: 
        !            39: /**    Transmit packet states  **/
        !            40: 
        !            41: enum pxenum /* required to have name for m32 sgs */ {  px_null, px_wait, px_ok };
        !            42: 
        !            43: #define        PX_NULL         (int)px_null            /* Empty packet */
        !            44: #define        PX_WAIT         (int)px_wait            /* Packet awaiting acknowledgement */
        !            45: #define        PX_OK           (int)px_ok              /* Packet has been acknowledged */
        !            46: 
        !            47: /**    Receive packet states   **/
        !            48: 
        !            49: enum prenum /* required to have name for m32 sgs */ { pr_null, pr_size, pr_data };
        !            50: 
        !            51: #define        PR_NULL         (int)pr_null            /* New packet expected */
        !            52: #define        PR_SIZE         (int)pr_size            /* Size byte next */
        !            53: #define        PR_DATA         (int)pr_data            /* Receiving data */
        !            54: #endif XT
        !            55: 
        !            56: /*
        !            57: **     Interface routines
        !            58: */
        !            59: 
        !            60: extern int             psend();                /* Send data to channel */
        !            61: extern void            precv();                /* Receive data/control from channel */
        !            62: extern void            ptimeout();             /* Catch alarm timeouts */
        !            63: extern int             pinit();                /* Initialise conversations */
        !            64: 
        !            65: /*
        !            66: **     Pointers to externally declared data and functions
        !            67: */
        !            68: 
        !            69: extern struct Pchannel pconvs[];               /* Array of conversations */
        !            70: extern Pch_p           pconvsend;              /* Pointer to end of pconvs */
        !            71: 
        !            72: /*
        !            73: **     Receiver data
        !            74: */
        !            75: 
        !            76: extern struct Pktstate precvpkt;               /* Current receive packet */
        !            77: extern Pbyte           pseqtable[];            /* Table of ordered sequence numbers */
        !            78: 
        !            79: #ifdef EBUG
        !            80: /*
        !            81: **     Debugging
        !            82: */
        !            83: 
        !            84: #define        PDEBUG          1
        !            85: #ifndef        PSTATISTICS
        !            86: #define        PSTATISTICS     1
        !            87: #endif
        !            88: #ifndef        PSTATSDESC
        !            89: #define        PSTATSDESC      1
        !            90: #endif
        !            91: #define        PKTHIST         40
        !            92: #define        PLOGIN          0
        !            93: #define        PLOGOUT         1
        !            94: 
        !            95: #include               <stdio.h>
        !            96: 
        !            97: extern FILE *          ptracefd;
        !            98: extern void            ptracepkt();
        !            99: extern void            plogpkt();
        !           100: extern void            pdumphist();
        !           101: 
        !           102: #define        ptrace(A)       fprintf(ptracefd,"trace: %s\n",A)
        !           103: 
        !           104: #else  EBUG
        !           105: 
        !           106: #define        ptrace(A)
        !           107: #define        ptracepkt(A,B)
        !           108: #define        plogpkt(A,B)
        !           109: #define        pdumphist(A)
        !           110: 
        !           111: #endif EBUG

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.