File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / mpd / src / comp.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 08:44:29 2013 UTC (11 years ago) by misho
Branches: mpd, MAIN
CVS tags: v5_9p16, v5_9, v5_8p7, v5_8p1_cross, v5_8p1, v5_8, v5_7p0, v5_7, v5_6, HEAD
5.7

    1: 
    2: /*
    3:  * comp.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 _COMP_H_
   11: #define	_COMP_H_
   12: 
   13: /*
   14:  * DEFINITIONS
   15:  */
   16: 
   17:   #define COMP_DIR_XMIT		1
   18:   #define COMP_DIR_RECV		2
   19: 
   20:   /* Compression type descriptor */
   21:   struct ccpstate;
   22: 
   23:   struct comptype {
   24:     const char	*name;
   25:     u_char	type;
   26:     u_char	mode;
   27:     /*
   28:      * This function should initialize internal state according
   29:      * to the direction parameter (recv or xmit or both).
   30:      */
   31:     int		(*Init)(Bund b, int dir);
   32:     /*
   33:      * Reset any type-specific configuration options to their defaults.
   34:      */
   35:     int		(*Configure)(Bund b);
   36:     /*
   37:      * Do the opposite of Configure
   38:      */
   39:     void	(*UnConfigure)(Bund b);
   40:     /*
   41:      * This returns a string describing the configuration (optional).
   42:      */
   43:     char	*(*Describe)(Bund b, int dir, char *buf, size_t len);
   44:     /*
   45:      * Given that "size" is our MTU, return the maximum length frame
   46:      * we can compress without the result being longer than "size".
   47:      */
   48:     int		(*SubtractBloat)(Bund b, int size);
   49:     /*
   50:      * Do the opposite of Init: ie., free memory, etc.
   51:      */
   52:     void	(*Cleanup)(Bund b, int dir);
   53:     /*
   54:      * This should add the type-specific stuff for a config-request
   55:      * to the building config-request packet
   56:      */
   57:     u_char	*(*BuildConfigReq)(Bund b, u_char *cp, int *ok);
   58:     /*
   59:      * This should decode type-specific config request stuff.
   60:      */
   61:     void	(*DecodeConfig)(Fsm fp, FsmOption opt, int mode);
   62:     /*
   63:      * This should return an mbuf containing type-specific reset-request
   64:      * contents if any, or else NULL.
   65:      */
   66:     Mbuf	(*SendResetReq)(Bund b);
   67:     /*
   68:      * Receive type-specific reset-request contents (possibly NULL).
   69:      * Should return contents of reset-ack (NULL for empty). If no
   70:      * reset-ack is desired, set *noAck to non-zero.
   71:      */
   72:     Mbuf	(*RecvResetReq)(Bund b, int id, Mbuf bp, int *noAck);
   73:     /*
   74:      * Receive type-specific reset-ack contents (possibly NULL).
   75:      */
   76:     void	(*RecvResetAck)(Bund b, int id, Mbuf bp);
   77:     /*
   78:      * Return true if compression was successfully negotiated in
   79:      * the indicated direction.
   80:      */
   81:     int		(*Negotiated)(Bund b, int dir);
   82:     /*
   83:      * Prints current compressor status
   84:      */
   85:     int		(*Stat)(Context ctx, int dir);
   86:     /*
   87:      * For compression methods which is not implemented in kernel
   88:      * here is support for user level functions.
   89:      */
   90:     Mbuf	(*Compress)(Bund b, Mbuf plain);
   91:     Mbuf	(*Decompress)(Bund b, Mbuf comp);
   92:   };
   93:   typedef const struct comptype	*CompType;
   94: 
   95: #endif
   96: 

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