Annotation of embedaddon/mpd/src/ccp.h, revision 1.1.1.1

1.1       misho       1: 
                      2: /*
                      3:  * ccp.h
                      4:  *
                      5:  * Written by Archie Cobbs <archie@freebsd.org>
                      6:  * Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
                      7:  * See ``COPYRIGHT.whistle''
                      8:  */
                      9: 
                     10: #ifndef _CCP_H_
                     11: #define        _CCP_H_
                     12: 
                     13: #include "defs.h"
                     14: #include "fsm.h"
                     15: #include "mbuf.h"
                     16: #include "comp.h"
                     17: #include "console.h"
                     18: #include "command.h"
                     19: #include "log.h"
                     20: 
                     21: #ifdef CCP_PRED1
                     22: #include "ccp_pred1.h"
                     23: #endif
                     24: #ifdef CCP_DEFLATE
                     25: #include "ccp_deflate.h"
                     26: #endif
                     27: #ifdef CCP_MPPC
                     28: #include "ccp_mppc.h"
                     29: #endif
                     30: 
                     31: #include <netgraph/ng_message.h>
                     32: 
                     33: /*
                     34:  * DEFINITIONS
                     35:  */
                     36: 
                     37:   /* Compression types */
                     38:   #define CCP_TY_OUI           0       /* OUI */
                     39:   #define CCP_TY_PRED1         1       /* Predictor type 1 */
                     40:   #define CCP_TY_PRED2         2       /* Predictor type 2 */
                     41:   #define CCP_TY_PUDDLE                3       /* Puddle Jumper */
                     42:   #define CCP_TY_HWPPC         16      /* Hewlett-Packard PPC */
                     43:   #define CCP_TY_STAC          17      /* Stac Electronics LZS */
                     44:   #define CCP_TY_MPPC          18      /* Microsoft PPC */
                     45:   #define CCP_TY_GAND          19      /* Gandalf FZA */
                     46:   #define CCP_TY_V42BIS                20      /* V.42bis compression */
                     47:   #define CCP_TY_BSD           21      /* BSD LZW Compress */
                     48:   #define CCP_TY_LZS_DCP       23      /* LZS-DCP Compression Protocol */
                     49:   #define CCP_TY_DEFLATE24     24      /* Gzip "deflate" compression WRONG! */
                     50:   #define CCP_TY_DCE           25      /* Data Compression in Data Circuit-Terminating Equipment */
                     51:   #define CCP_TY_DEFLATE       26      /* Gzip "deflate" compression */
                     52:   #define CCP_TY_V44           27      /* V.44/LZJH Compression Protocol */
                     53: 
                     54:   #define CCP_OVERHEAD         2
                     55: 
                     56:   /* CCP state */
                     57:   struct ccpstate {
                     58:     struct fsm         fsm;            /* CCP FSM */
                     59:     struct optinfo     options;        /* configured protocols */
                     60:     CompType           xmit;           /* xmit protocol */
                     61:     CompType           recv;           /* recv protocol */
                     62:     uint32_t           self_reject;    /* types rejected by me */
                     63:     uint32_t           peer_reject;    /* types rejected by peer */
                     64: #ifdef CCP_PRED1
                     65:     struct pred1info   pred1;          /* Predictor-1 state */
                     66: #endif
                     67: #ifdef CCP_DEFLATE
                     68:     struct deflateinfo deflate;        /* Deflate state */
                     69: #endif
                     70: #ifdef CCP_MPPC
                     71:     struct mppcinfo    mppc;           /* MPPC/MPPE state */
                     72: #endif
                     73:     ng_ID_t            comp_node_id;   /* compressor node id */
                     74:     ng_ID_t            decomp_node_id; /* decompressor node id */
                     75:     uint32_t           recv_resets;    /* Number of ResetReq we have got from other side */
                     76:     uint32_t           xmit_resets;    /* Number of ResetReq we have sent to other side */
                     77:     u_char             crypt_check;    /* We checked for required encryption */
                     78:   };
                     79:   typedef struct ccpstate      *CcpState;
                     80: 
                     81:   #define CCP_PEER_REJECTED(p,x)       ((p)->peer_reject & (1<<(x)))
                     82:   #define CCP_SELF_REJECTED(p,x)       ((p)->self_reject & (1<<(x)))
                     83: 
                     84:   #define CCP_PEER_REJ(p,x)    do{(p)->peer_reject |= (1<<(x));}while(0)
                     85:   #define CCP_SELF_REJ(p,x)    do{(p)->self_reject |= (1<<(x));}while(0)
                     86: 
                     87: /*
                     88:  * VARIABLES
                     89:  */
                     90: 
                     91:   extern const struct cmdtab   CcpSetCmds[];
                     92: 
                     93:   extern int           gCcpCsock;              /* Socket node control socket */
                     94:   extern int           gCcpDsock;              /* Socket node data socket */
                     95: 
                     96: /*
                     97:  * FUNCTIONS
                     98:  */
                     99: 
                    100:   extern int   CcpsInit(void);
                    101:   extern void  CcpsShutdown(void);
                    102: 
                    103:   extern void  CcpInit(Bund b);
                    104:   extern void  CcpInst(Bund b, Bund bt);
                    105:   extern void  CcpUp(Bund b);
                    106:   extern void  CcpDown(Bund b);
                    107:   extern void  CcpOpen(Bund b);
                    108:   extern void  CcpClose(Bund b);
                    109:   extern int   CcpOpenCmd(Context ctx);
                    110:   extern int   CcpCloseCmd(Context ctx);
                    111:   extern void  CcpInput(Bund b, Mbuf bp);
                    112:   extern Mbuf  CcpDataInput(Bund b, Mbuf bp);
                    113:   extern Mbuf  CcpDataOutput(Bund b, Mbuf bp);
                    114:   extern int   CcpSubtractBloat(Bund b, int size);
                    115:   extern void  CcpSendResetReq(Bund b);
                    116:   extern void  CcpRecvMsg(Bund b, struct ng_mesg *msg, int len);
                    117:   extern int   CcpStat(Context ctx, int ac, char *av[], void *arg);
                    118: 
                    119: #endif
                    120: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>