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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
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 "ppp_opts.h" 00034 #if PPP_SUPPORT && CCP_SUPPORT /* don't build if not configured for use in ppp_opts.h */ 00035 00036 #ifndef CCP_H 00037 #define CCP_H 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 /* 00044 * CCP codes. 00045 */ 00046 00047 #define CCP_CONFREQ 1 00048 #define CCP_CONFACK 2 00049 #define CCP_TERMREQ 5 00050 #define CCP_TERMACK 6 00051 #define CCP_RESETREQ 14 00052 #define CCP_RESETACK 15 00053 00054 /* 00055 * Max # bytes for a CCP option 00056 */ 00057 00058 #define CCP_MAX_OPTION_LENGTH 32 00059 00060 /* 00061 * Parts of a CCP packet. 00062 */ 00063 00064 #define CCP_CODE(dp) ((dp)[0]) 00065 #define CCP_ID(dp) ((dp)[1]) 00066 #define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3]) 00067 #define CCP_HDRLEN 4 00068 00069 #define CCP_OPT_CODE(dp) ((dp)[0]) 00070 #define CCP_OPT_LENGTH(dp) ((dp)[1]) 00071 #define CCP_OPT_MINLEN 2 00072 00073 #if BSDCOMPRESS_SUPPORT 00074 /* 00075 * Definitions for BSD-Compress. 00076 */ 00077 00078 #define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */ 00079 #define CILEN_BSD_COMPRESS 3 /* length of config. option */ 00080 00081 /* Macros for handling the 3rd byte of the BSD-Compress config option. */ 00082 #define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */ 00083 #define BSD_VERSION(x) ((x) >> 5) /* version of option format */ 00084 #define BSD_CURRENT_VERSION 1 /* current version number */ 00085 #define BSD_MAKE_OPT(v, n) (((v) << 5) | (n)) 00086 00087 #define BSD_MIN_BITS 9 /* smallest code size supported */ 00088 #define BSD_MAX_BITS 15 /* largest code size supported */ 00089 #endif /* BSDCOMPRESS_SUPPORT */ 00090 00091 #if DEFLATE_SUPPORT 00092 /* 00093 * Definitions for Deflate. 00094 */ 00095 00096 #define CI_DEFLATE 26 /* config option for Deflate */ 00097 #define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */ 00098 #define CILEN_DEFLATE 4 /* length of its config option */ 00099 00100 #define DEFLATE_MIN_SIZE 9 00101 #define DEFLATE_MAX_SIZE 15 00102 #define DEFLATE_METHOD_VAL 8 00103 #define DEFLATE_SIZE(x) (((x) >> 4) + 8) 00104 #define DEFLATE_METHOD(x) ((x) & 0x0F) 00105 #define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL) 00106 #define DEFLATE_CHK_SEQUENCE 0 00107 #endif /* DEFLATE_SUPPORT */ 00108 00109 #if MPPE_SUPPORT 00110 /* 00111 * Definitions for MPPE. 00112 */ 00113 00114 #define CI_MPPE 18 /* config option for MPPE */ 00115 #define CILEN_MPPE 6 /* length of config option */ 00116 #endif /* MPPE_SUPPORT */ 00117 00118 #if PREDICTOR_SUPPORT 00119 /* 00120 * Definitions for other, as yet unsupported, compression methods. 00121 */ 00122 00123 #define CI_PREDICTOR_1 1 /* config option for Predictor-1 */ 00124 #define CILEN_PREDICTOR_1 2 /* length of its config option */ 00125 #define CI_PREDICTOR_2 2 /* config option for Predictor-2 */ 00126 #define CILEN_PREDICTOR_2 2 /* length of its config option */ 00127 #endif /* PREDICTOR_SUPPORT */ 00128 00129 typedef struct ccp_options { 00130 #if DEFLATE_SUPPORT 00131 unsigned int deflate :1; /* do Deflate? */ 00132 unsigned int deflate_correct :1; /* use correct code for deflate? */ 00133 unsigned int deflate_draft :1; /* use draft RFC code for deflate? */ 00134 #endif /* DEFLATE_SUPPORT */ 00135 #if BSDCOMPRESS_SUPPORT 00136 unsigned int bsd_compress :1; /* do BSD Compress? */ 00137 #endif /* BSDCOMPRESS_SUPPORT */ 00138 #if PREDICTOR_SUPPORT 00139 unsigned int predictor_1 :1; /* do Predictor-1? */ 00140 unsigned int predictor_2 :1; /* do Predictor-2? */ 00141 #endif /* PREDICTOR_SUPPORT */ 00142 00143 #if MPPE_SUPPORT 00144 u8_t mppe; /* MPPE bitfield */ 00145 #endif /* MPPE_SUPPORT */ 00146 #if BSDCOMPRESS_SUPPORT 00147 u_short bsd_bits; /* # bits/code for BSD Compress */ 00148 #endif /* BSDCOMPRESS_SUPPORT */ 00149 #if DEFLATE_SUPPORT 00150 u_short deflate_size; /* lg(window size) for Deflate */ 00151 #endif /* DEFLATE_SUPPORT */ 00152 u8_t method; /* code for chosen compression method */ 00153 } ccp_options; 00154 00155 extern const struct protent ccp_protent; 00156 00157 void ccp_resetrequest(ppp_pcb *pcb); /* Issue a reset-request. */ 00158 00159 #ifdef __cplusplus 00160 } 00161 #endif 00162 00163 #endif /* CCP_H */ 00164 #endif /* PPP_SUPPORT && CCP_SUPPORT */
Generated on Tue Jul 12 2022 13:54:05 by
