Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ccp.h
00001 /* 00002 * ccp.h - Definitions for PPP Compression Control Protocol. 00003 * 00004 * Copyright (c) 1994-2002 Paul Mackerras. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * 2. The name(s) of the authors of this software must not be used to 00014 * endorse or promote products derived from this software without 00015 * prior written permission. 00016 * 00017 * 3. Redistributions of any form whatsoever must retain the following 00018 * acknowledgment: 00019 * "This product includes software developed by Paul Mackerras 00020 * <paulus@samba.org>". 00021 * 00022 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 00023 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00024 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 00025 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00026 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 00027 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 00028 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00029 * 00030 * $Id: ccp.h,v 1.12 2004/11/04 10:02:26 paulus Exp $ 00031 */ 00032 00033 #include "netif/ppp/ppp_opts.h" 00034 #if PPP_SUPPORT && CCP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 00035 00036 #ifndef CCP_H 00037 #define CCP_H 00038 00039 /* 00040 * CCP codes. 00041 */ 00042 00043 #define CCP_CONFREQ 1 00044 #define CCP_CONFACK 2 00045 #define CCP_TERMREQ 5 00046 #define CCP_TERMACK 6 00047 #define CCP_RESETREQ 14 00048 #define CCP_RESETACK 15 00049 00050 /* 00051 * Max # bytes for a CCP option 00052 */ 00053 00054 #define CCP_MAX_OPTION_LENGTH 32 00055 00056 /* 00057 * Parts of a CCP packet. 00058 */ 00059 00060 #define CCP_CODE(dp) ((dp)[0]) 00061 #define CCP_ID(dp) ((dp)[1]) 00062 #define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) 00063 #define CCP_HDRLEN 4 00064 00065 #define CCP_OPT_CODE(dp) ((dp)[0]) 00066 #define CCP_OPT_LENGTH(dp) ((dp)[1]) 00067 #define CCP_OPT_MINLEN 2 00068 00069 #if BSDCOMPRESS_SUPPORT 00070 /* 00071 * Definitions for BSD-Compress. 00072 */ 00073 00074 #define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ 00075 #define CILEN_BSD_COMPRESS 3 /* length of config. option */ 00076 00077 /* Macros for handling the 3rd byte of the BSD-Compress config option. */ 00078 #define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ 00079 #define BSD_VERSION(x) ((x) >> 5) /* version of option format */ 00080 #define BSD_CURRENT_VERSION 1 /* current version number */ 00081 #define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) 00082 00083 #define BSD_MIN_BITS 9 /* smallest code size supported */ 00084 #define BSD_MAX_BITS 15 /* largest code size supported */ 00085 #endif /* BSDCOMPRESS_SUPPORT */ 00086 00087 #if DEFLATE_SUPPORT 00088 /* 00089 * Definitions for Deflate. 00090 */ 00091 00092 #define CI_DEFLATE 26 /* config option for Deflate */ 00093 #define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */ 00094 #define CILEN_DEFLATE 4 /* length of its config option */ 00095 00096 #define DEFLATE_MIN_SIZE 9 00097 #define DEFLATE_MAX_SIZE 15 00098 #define DEFLATE_METHOD_VAL 8 00099 #define DEFLATE_SIZE(x) (((x) >> 4) + 8) 00100 #define DEFLATE_METHOD(x) ((x) & 0x0F) 00101 #define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL) 00102 #define DEFLATE_CHK_SEQUENCE 0 00103 #endif /* DEFLATE_SUPPORT */ 00104 00105 #if MPPE_SUPPORT 00106 /* 00107 * Definitions for MPPE. 00108 */ 00109 00110 #define CI_MPPE 18 /* config option for MPPE */ 00111 #define CILEN_MPPE 6 /* length of config option */ 00112 #endif /* MPPE_SUPPORT */ 00113 00114 #if PREDICTOR_SUPPORT 00115 /* 00116 * Definitions for other, as yet unsupported, compression methods. 00117 */ 00118 00119 #define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ 00120 #define CILEN_PREDICTOR_1 2 /* length of its config option */ 00121 #define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ 00122 #define CILEN_PREDICTOR_2 2 /* length of its config option */ 00123 #endif /* PREDICTOR_SUPPORT */ 00124 00125 typedef struct ccp_options { 00126 #if DEFLATE_SUPPORT 00127 unsigned int deflate :1; /* do Deflate? */ 00128 unsigned int deflate_correct :1; /* use correct code for deflate? */ 00129 unsigned int deflate_draft :1; /* use draft RFC code for deflate? */ 00130 #endif /* DEFLATE_SUPPORT */ 00131 #if BSDCOMPRESS_SUPPORT 00132 unsigned int bsd_compress :1; /* do BSD Compress? */ 00133 #endif /* BSDCOMPRESS_SUPPORT */ 00134 #if PREDICTOR_SUPPORT 00135 unsigned int predictor_1 :1; /* do Predictor-1? */ 00136 unsigned int predictor_2 :1; /* do Predictor-2? */ 00137 #endif /* PREDICTOR_SUPPORT */ 00138 00139 #if MPPE_SUPPORT 00140 u8_t mppe; /* MPPE bitfield */ 00141 #endif /* MPPE_SUPPORT */ 00142 #if BSDCOMPRESS_SUPPORT 00143 u_short bsd_bits; /* # bits/code for BSD Compress */ 00144 #endif /* BSDCOMPRESS_SUPPORT */ 00145 #if DEFLATE_SUPPORT 00146 u_short deflate_size; /* lg(window size) for Deflate */ 00147 #endif /* DEFLATE_SUPPORT */ 00148 u8_t method; /* code for chosen compression method */ 00149 } ccp_options; 00150 00151 extern const struct protent ccp_protent; 00152 00153 void ccp_resetrequest(ppp_pcb *pcb); /* Issue a reset-request. */ 00154 00155 #endif /* CCP_H */ 00156 #endif /* PPP_SUPPORT && CCP_SUPPORT */
Generated on Tue Jul 12 2022 12:21:45 by
