The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/net/ppp_comp.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * ppp_comp.h - Definitions for doing PPP packet compression.
    3  */
    4 
    5 /*-
    6  * Copyright (c) 1994 The Australian National University.
    7  * All rights reserved.
    8  *
    9  * Permission to use, copy, modify, and distribute this software and its
   10  * documentation is hereby granted, provided that the above copyright
   11  * notice appears in all copies.  This software is provided without any
   12  * warranty, express or implied. The Australian National University
   13  * makes no representations about the suitability of this software for
   14  * any purpose.
   15  *
   16  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
   17  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
   18  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
   19  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
   20  * OF SUCH DAMAGE.
   21  *
   22  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   23  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
   24  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
   25  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
   26  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
   27  * OR MODIFICATIONS.
   28  *
   29  * $FreeBSD$
   30  */
   31 
   32 #ifndef _NET_PPP_COMP_H
   33 #define _NET_PPP_COMP_H
   34 
   35 /*
   36  * Structure giving methods for compression/decompression.
   37  */
   38 #ifdef PACKETPTR
   39 struct compressor {
   40         int     compress_proto; /* CCP compression protocol number */
   41 
   42         /* Allocate space for a compressor (transmit side) */
   43         void    *(*comp_alloc)(u_char *options, int opt_len);
   44         /* Free space used by a compressor */
   45         void    (*comp_free)(void *state);
   46         /* Initialize a compressor */
   47         int     (*comp_init)(void *state, u_char *options, int opt_len,
   48                     int unit, int hdrlen, int debug);
   49         /* Reset a compressor */
   50         void    (*comp_reset)(void *state);
   51         /* Compress a packet */
   52         int     (*compress)(void *state, PACKETPTR *mret, PACKETPTR mp,
   53                     int orig_len, int max_len);
   54         /* Return compression statistics */
   55         void    (*comp_stat)(void *state, struct compstat *stats);
   56 
   57         /* Allocate space for a decompressor (receive side) */
   58         void    *(*decomp_alloc)(u_char *options, int opt_len);
   59         /* Free space used by a decompressor */
   60         void    (*decomp_free)(void *state);
   61         /* Initialize a decompressor */
   62         int     (*decomp_init)(void *state, u_char *options, int opt_len,
   63                     int unit, int hdrlen, int mru, int debug);
   64         /* Reset a decompressor */
   65         void    (*decomp_reset)(void *state);
   66         /* Decompress a packet. */
   67         int     (*decompress)(void *state, PACKETPTR mp, PACKETPTR *dmpp);
   68         /* Update state for an incompressible packet received */
   69         void    (*incomp)(void *state, PACKETPTR mp);
   70         /* Return decompression statistics */
   71         void    (*decomp_stat)(void *state, struct compstat *stats);
   72 };
   73 #endif /* PACKETPTR */
   74 
   75 /*
   76  * Return values for decompress routine.
   77  * We need to make these distinctions so that we can disable certain
   78  * useful functionality, namely sending a CCP reset-request as a result
   79  * of an error detected after decompression.  This is to avoid infringing
   80  * a patent held by Motorola.
   81  * Don't you just lurve software patents.
   82  */
   83 #define DECOMP_OK               0       /* everything went OK */
   84 #define DECOMP_ERROR            1       /* error detected before decomp. */
   85 #define DECOMP_FATALERROR       2       /* error detected after decomp. */
   86 
   87 /*
   88  * CCP codes.
   89  */
   90 #define CCP_CONFREQ     1
   91 #define CCP_CONFACK     2
   92 #define CCP_TERMREQ     5
   93 #define CCP_TERMACK     6
   94 #define CCP_RESETREQ    14
   95 #define CCP_RESETACK    15
   96 
   97 /*
   98  * Max # bytes for a CCP option
   99  */
  100 #define CCP_MAX_OPTION_LENGTH   32
  101 
  102 /*
  103  * Parts of a CCP packet.
  104  */
  105 #define CCP_CODE(dp)            ((dp)[0])
  106 #define CCP_ID(dp)              ((dp)[1])
  107 #define CCP_LENGTH(dp)          (((dp)[2] << 8) + (dp)[3])
  108 #define CCP_HDRLEN              4
  109 
  110 #define CCP_OPT_CODE(dp)        ((dp)[0])
  111 #define CCP_OPT_LENGTH(dp)      ((dp)[1])
  112 #define CCP_OPT_MINLEN          2
  113 
  114 /*
  115  * Definitions for BSD-Compress.
  116  */
  117 #define CI_BSD_COMPRESS         21      /* config. option for BSD-Compress */
  118 #define CILEN_BSD_COMPRESS      3       /* length of config. option */
  119 
  120 /* Macros for handling the 3rd byte of the BSD-Compress config option. */
  121 #define BSD_NBITS(x)            ((x) & 0x1F)    /* number of bits requested */
  122 #define BSD_VERSION(x)          ((x) >> 5)      /* version of option format */
  123 #define BSD_CURRENT_VERSION     1               /* current version number */
  124 #define BSD_MAKE_OPT(v, n)      (((v) << 5) | (n))
  125 
  126 #define BSD_MIN_BITS            9       /* smallest code size supported */
  127 #define BSD_MAX_BITS            15      /* largest code size supported */
  128 
  129 /*
  130  * Definitions for Deflate.
  131  */
  132 #define CI_DEFLATE              26      /* config option for Deflate */
  133 #define CI_DEFLATE_DRAFT        24      /* value used in original draft RFC */
  134 #define CILEN_DEFLATE           4       /* length of its config option */
  135 
  136 #define DEFLATE_MIN_SIZE        8
  137 #define DEFLATE_MAX_SIZE        15
  138 #define DEFLATE_METHOD_VAL      8
  139 #define DEFLATE_SIZE(x)         (((x) >> 4) + DEFLATE_MIN_SIZE)
  140 #define DEFLATE_METHOD(x)       ((x) & 0x0F)
  141 #define DEFLATE_MAKE_OPT(w)     ((((w) - DEFLATE_MIN_SIZE) << 4) \
  142                                  + DEFLATE_METHOD_VAL)
  143 #define DEFLATE_CHK_SEQUENCE    0
  144 
  145 /*
  146  * Definitions for other, as yet unsupported, compression methods.
  147  */
  148 #define CI_PREDICTOR_1          1       /* config option for Predictor-1 */
  149 #define CILEN_PREDICTOR_1       2       /* length of its config option */
  150 #define CI_PREDICTOR_2          2       /* config option for Predictor-2 */
  151 #define CILEN_PREDICTOR_2       2       /* length of its config option */
  152 
  153 #endif /* _NET_PPP_COMP_H */

Cache object: ac14b152dba153bf2b094fd7146213fd


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.