Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * ppp-comp.h - Definitions for doing PPP packet compression.
0004  *
0005  * Copyright 1994-1998 Paul Mackerras.
0006  *
0007  *  This program is free software; you can redistribute it and/or
0008  *  modify it under the terms of the GNU General Public License
0009  *  version 2 as published by the Free Software Foundation.
0010  */
0011 #ifndef _UAPI_NET_PPP_COMP_H
0012 #define _UAPI_NET_PPP_COMP_H
0013 
0014 
0015 /*
0016  * CCP codes.
0017  */
0018 
0019 #define CCP_CONFREQ 1
0020 #define CCP_CONFACK 2
0021 #define CCP_TERMREQ 5
0022 #define CCP_TERMACK 6
0023 #define CCP_RESETREQ    14
0024 #define CCP_RESETACK    15
0025 
0026 /*
0027  * Max # bytes for a CCP option
0028  */
0029 
0030 #define CCP_MAX_OPTION_LENGTH   32
0031 
0032 /*
0033  * Parts of a CCP packet.
0034  */
0035 
0036 #define CCP_CODE(dp)        ((dp)[0])
0037 #define CCP_ID(dp)      ((dp)[1])
0038 #define CCP_LENGTH(dp)      (((dp)[2] << 8) + (dp)[3])
0039 #define CCP_HDRLEN      4
0040 
0041 #define CCP_OPT_CODE(dp)    ((dp)[0])
0042 #define CCP_OPT_LENGTH(dp)  ((dp)[1])
0043 #define CCP_OPT_MINLEN      2
0044 
0045 /*
0046  * Definitions for BSD-Compress.
0047  */
0048 
0049 #define CI_BSD_COMPRESS     21  /* config. option for BSD-Compress */
0050 #define CILEN_BSD_COMPRESS  3   /* length of config. option */
0051 
0052 /* Macros for handling the 3rd byte of the BSD-Compress config option. */
0053 #define BSD_NBITS(x)        ((x) & 0x1F)    /* number of bits requested */
0054 #define BSD_VERSION(x)      ((x) >> 5)  /* version of option format */
0055 #define BSD_CURRENT_VERSION 1       /* current version number */
0056 #define BSD_MAKE_OPT(v, n)  (((v) << 5) | (n))
0057 
0058 #define BSD_MIN_BITS        9   /* smallest code size supported */
0059 #define BSD_MAX_BITS        15  /* largest code size supported */
0060 
0061 /*
0062  * Definitions for Deflate.
0063  */
0064 
0065 #define CI_DEFLATE      26  /* config option for Deflate */
0066 #define CI_DEFLATE_DRAFT    24  /* value used in original draft RFC */
0067 #define CILEN_DEFLATE       4   /* length of its config option */
0068 
0069 #define DEFLATE_MIN_SIZE    9
0070 #define DEFLATE_MAX_SIZE    15
0071 #define DEFLATE_METHOD_VAL  8
0072 #define DEFLATE_SIZE(x)     (((x) >> 4) + 8)
0073 #define DEFLATE_METHOD(x)   ((x) & 0x0F)
0074 #define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
0075 #define DEFLATE_CHK_SEQUENCE    0
0076 
0077 /*
0078  * Definitions for MPPE.
0079  */
0080 
0081 #define CI_MPPE                18      /* config option for MPPE */
0082 #define CILEN_MPPE              6      /* length of config option */
0083 
0084 /*
0085  * Definitions for other, as yet unsupported, compression methods.
0086  */
0087 
0088 #define CI_PREDICTOR_1      1   /* config option for Predictor-1 */
0089 #define CILEN_PREDICTOR_1   2   /* length of its config option */
0090 #define CI_PREDICTOR_2      2   /* config option for Predictor-2 */
0091 #define CILEN_PREDICTOR_2   2   /* length of its config option */
0092 
0093 
0094 #endif /* _UAPI_NET_PPP_COMP_H */