ReactOS 0.4.16-dev-297-gc569aee
ccp.h
Go to the documentation of this file.
1/*
2 * ccp.h - Definitions for PPP Compression Control Protocol.
3 *
4 * Copyright (c) 1994-2002 Paul Mackerras. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. The name(s) of the authors of this software must not be used to
14 * endorse or promote products derived from this software without
15 * prior written permission.
16 *
17 * 3. Redistributions of any form whatsoever must retain the following
18 * acknowledgment:
19 * "This product includes software developed by Paul Mackerras
20 * <paulus@samba.org>".
21 *
22 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
23 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
25 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
26 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
27 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
28 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 *
30 * $Id: ccp.h,v 1.12 2004/11/04 10:02:26 paulus Exp $
31 */
32
33#include "netif/ppp/ppp_opts.h"
34#if PPP_SUPPORT && CCP_SUPPORT /* don't build if not configured for use in lwipopts.h */
35
36#ifndef CCP_H
37#define CCP_H
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/*
44 * CCP codes.
45 */
46
47#define CCP_CONFREQ 1
48#define CCP_CONFACK 2
49#define CCP_TERMREQ 5
50#define CCP_TERMACK 6
51#define CCP_RESETREQ 14
52#define CCP_RESETACK 15
53
54/*
55 * Max # bytes for a CCP option
56 */
57
58#define CCP_MAX_OPTION_LENGTH 32
59
60/*
61 * Parts of a CCP packet.
62 */
63
64#define CCP_CODE(dp) ((dp)[0])
65#define CCP_ID(dp) ((dp)[1])
66#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3])
67#define CCP_HDRLEN 4
68
69#define CCP_OPT_CODE(dp) ((dp)[0])
70#define CCP_OPT_LENGTH(dp) ((dp)[1])
71#define CCP_OPT_MINLEN 2
72
73#if BSDCOMPRESS_SUPPORT
74/*
75 * Definitions for BSD-Compress.
76 */
77
78#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */
79#define CILEN_BSD_COMPRESS 3 /* length of config. option */
80
81/* Macros for handling the 3rd byte of the BSD-Compress config option. */
82#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */
83#define BSD_VERSION(x) ((x) >> 5) /* version of option format */
84#define BSD_CURRENT_VERSION 1 /* current version number */
85#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n))
86
87#define BSD_MIN_BITS 9 /* smallest code size supported */
88#define BSD_MAX_BITS 15 /* largest code size supported */
89#endif /* BSDCOMPRESS_SUPPORT */
90
91#if DEFLATE_SUPPORT
92/*
93 * Definitions for Deflate.
94 */
95
96#define CI_DEFLATE 26 /* config option for Deflate */
97#define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */
98#define CILEN_DEFLATE 4 /* length of its config option */
99
100#define DEFLATE_MIN_SIZE 9
101#define DEFLATE_MAX_SIZE 15
102#define DEFLATE_METHOD_VAL 8
103#define DEFLATE_SIZE(x) (((x) >> 4) + 8)
104#define DEFLATE_METHOD(x) ((x) & 0x0F)
105#define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
106#define DEFLATE_CHK_SEQUENCE 0
107#endif /* DEFLATE_SUPPORT */
108
109#if MPPE_SUPPORT
110/*
111 * Definitions for MPPE.
112 */
113
114#define CI_MPPE 18 /* config option for MPPE */
115#define CILEN_MPPE 6 /* length of config option */
116#endif /* MPPE_SUPPORT */
117
118#if PREDICTOR_SUPPORT
119/*
120 * Definitions for other, as yet unsupported, compression methods.
121 */
122
123#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */
124#define CILEN_PREDICTOR_1 2 /* length of its config option */
125#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */
126#define CILEN_PREDICTOR_2 2 /* length of its config option */
127#endif /* PREDICTOR_SUPPORT */
128
129typedef struct ccp_options {
130#if DEFLATE_SUPPORT
131 unsigned int deflate :1; /* do Deflate? */
132 unsigned int deflate_correct :1; /* use correct code for deflate? */
133 unsigned int deflate_draft :1; /* use draft RFC code for deflate? */
134#endif /* DEFLATE_SUPPORT */
135#if BSDCOMPRESS_SUPPORT
136 unsigned int bsd_compress :1; /* do BSD Compress? */
137#endif /* BSDCOMPRESS_SUPPORT */
138#if PREDICTOR_SUPPORT
139 unsigned int predictor_1 :1; /* do Predictor-1? */
140 unsigned int predictor_2 :1; /* do Predictor-2? */
141#endif /* PREDICTOR_SUPPORT */
142
143#if MPPE_SUPPORT
144 u8_t mppe; /* MPPE bitfield */
145#endif /* MPPE_SUPPORT */
146#if BSDCOMPRESS_SUPPORT
147 u_short bsd_bits; /* # bits/code for BSD Compress */
148#endif /* BSDCOMPRESS_SUPPORT */
149#if DEFLATE_SUPPORT
150 u_short deflate_size; /* lg(window size) for Deflate */
151#endif /* DEFLATE_SUPPORT */
152 u8_t method; /* code for chosen compression method */
153} ccp_options;
154
155extern const struct protent ccp_protent;
156
157void ccp_resetrequest(ppp_pcb *pcb); /* Issue a reset-request. */
158
159#ifdef __cplusplus
160}
161#endif
162
163#endif /* CCP_H */
164#endif /* PPP_SUPPORT && CCP_SUPPORT */
unsigned short u_short
Definition: types.h:81
int deflate(z_streamp strm, int flush) DECLSPEC_HIDDEN
Definition: deflate.c:815
method
Definition: dragdrop.c:54
uint8_t u8_t
Definition: arch.h:125