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

Cache object: 49d27c19b4f672627da3e6a880214bb6


[ 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.