sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
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
37
#include "
netif/ppp/ppp_opts.h
"
38
#if PPP_SUPPORT && CCP_SUPPORT
/* don't build if not configured for use in lwipopts.h */
39
40
#ifndef CCP_H
41
#define CCP_H
42
43
#ifdef __cplusplus
44
extern
"C"
{
45
#endif
46
47
/*
48
* CCP codes.
49
*/
50
51
#define CCP_CONFREQ 1
52
#define CCP_CONFACK 2
53
#define CCP_TERMREQ 5
54
#define CCP_TERMACK 6
55
#define CCP_RESETREQ 14
56
#define CCP_RESETACK 15
57
58
/*
59
* Max # bytes for a CCP option
60
*/
61
62
#define CCP_MAX_OPTION_LENGTH 32
63
64
/*
65
* Parts of a CCP packet.
66
*/
67
68
#define CCP_CODE(dp) ((dp)[0])
69
#define CCP_ID(dp) ((dp)[1])
70
#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3])
71
#define CCP_HDRLEN 4
72
73
#define CCP_OPT_CODE(dp) ((dp)[0])
74
#define CCP_OPT_LENGTH(dp) ((dp)[1])
75
#define CCP_OPT_MINLEN 2
76
77
#if BSDCOMPRESS_SUPPORT
78
/*
79
* Definitions for BSD-Compress.
80
*/
81
82
#define CI_BSD_COMPRESS 21
/* config. option for BSD-Compress */
83
#define CILEN_BSD_COMPRESS 3
/* length of config. option */
84
85
/* Macros for handling the 3rd byte of the BSD-Compress config option. */
86
#define BSD_NBITS(x) ((x) & 0x1F)
/* number of bits requested */
87
#define BSD_VERSION(x) ((x) >> 5)
/* version of option format */
88
#define BSD_CURRENT_VERSION 1
/* current version number */
89
#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n))
90
91
#define BSD_MIN_BITS 9
/* smallest code size supported */
92
#define BSD_MAX_BITS 15
/* largest code size supported */
93
#endif
/* BSDCOMPRESS_SUPPORT */
94
95
#if DEFLATE_SUPPORT
96
/*
97
* Definitions for Deflate.
98
*/
99
100
#define CI_DEFLATE 26
/* config option for Deflate */
101
#define CI_DEFLATE_DRAFT 24
/* value used in original draft RFC */
102
#define CILEN_DEFLATE 4
/* length of its config option */
103
104
#define DEFLATE_MIN_SIZE 9
105
#define DEFLATE_MAX_SIZE 15
106
#define DEFLATE_METHOD_VAL 8
107
#define DEFLATE_SIZE(x) (((x) >> 4) + 8)
108
#define DEFLATE_METHOD(x) ((x) & 0x0F)
109
#define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
110
#define DEFLATE_CHK_SEQUENCE 0
111
#endif
/* DEFLATE_SUPPORT */
112
113
#if MPPE_SUPPORT
114
/*
115
* Definitions for MPPE.
116
*/
117
118
#define CI_MPPE 18
/* config option for MPPE */
119
#define CILEN_MPPE 6
/* length of config option */
120
#endif
/* MPPE_SUPPORT */
121
122
#if PREDICTOR_SUPPORT
123
/*
124
* Definitions for other, as yet unsupported, compression methods.
125
*/
126
127
#define CI_PREDICTOR_1 1
/* config option for Predictor-1 */
128
#define CILEN_PREDICTOR_1 2
/* length of its config option */
129
#define CI_PREDICTOR_2 2
/* config option for Predictor-2 */
130
#define CILEN_PREDICTOR_2 2
/* length of its config option */
131
#endif
/* PREDICTOR_SUPPORT */
132
133
typedef
struct
ccp_options {
134
#if DEFLATE_SUPPORT
135
unsigned
int
deflate :1;
/* do Deflate? */
136
unsigned
int
deflate_correct :1;
/* use correct code for deflate? */
137
unsigned
int
deflate_draft :1;
/* use draft RFC code for deflate? */
138
#endif
/* DEFLATE_SUPPORT */
139
#if BSDCOMPRESS_SUPPORT
140
unsigned
int
bsd_compress :1;
/* do BSD Compress? */
141
#endif
/* BSDCOMPRESS_SUPPORT */
142
#if PREDICTOR_SUPPORT
143
unsigned
int
predictor_1 :1;
/* do Predictor-1? */
144
unsigned
int
predictor_2 :1;
/* do Predictor-2? */
145
#endif
/* PREDICTOR_SUPPORT */
146
147
#if MPPE_SUPPORT
148
u8_t mppe;
/* MPPE bitfield */
149
#endif
/* MPPE_SUPPORT */
150
#if BSDCOMPRESS_SUPPORT
151
u_short bsd_bits;
/* # bits/code for BSD Compress */
152
#endif
/* BSDCOMPRESS_SUPPORT */
153
#if DEFLATE_SUPPORT
154
u_short deflate_size;
/* lg(window size) for Deflate */
155
#endif
/* DEFLATE_SUPPORT */
156
u8_t method;
/* code for chosen compression method */
157
} ccp_options;
158
159
extern
const
struct
protent ccp_protent;
160
161
void
ccp_resetrequest(ppp_pcb *pcb);
/* Issue a reset-request. */
162
163
#ifdef __cplusplus
164
}
165
#endif
166
167
#endif
/* CCP_H */
168
#endif
/* PPP_SUPPORT && CCP_SUPPORT */
ppp_opts.h
core
ps2ip
include
lwip_include
netif
ppp
ccp.h
Generated by
1.18.0