]> git.pld-linux.org Git - packages/kernel.git/blame - linux-2.4.18-mppe-include.patch
- obsolete
[packages/kernel.git] / linux-2.4.18-mppe-include.patch
CommitLineData
70c2972b
SZ
1--- linux/include/linux/ppp-comp.h.orig Fri Aug 6 10:44:11 1999
2+++ linux/include/linux/ppp-comp.h Mon Mar 25 09:11:33 2002
3@@ -187,6 +187,100 @@
4 #define DEFLATE_CHK_SEQUENCE 0
5
6 /*
7+ * Definitions for MPPE.
8+ */
9+
10+#define CI_MPPE 18 /* config option for MPPE */
11+#define CILEN_MPPE 6 /* length of config option */
12+
13+#define MPPE_PAD 4 /* MPPE growth per frame */
14+#define MPPE_MAX_KEY_LEN 16 /* largest key length (128-bit) */
15+
16+/* option bits for ccp_options.mppe */
17+#define MPPE_OPT_40 0x01 /* 40 bit */
18+#define MPPE_OPT_128 0x02 /* 128 bit */
19+#define MPPE_OPT_STATEFUL 0x04 /* stateful mode */
20+/* unsupported opts */
21+#define MPPE_OPT_56 0x08 /* 56 bit */
22+#define MPPE_OPT_MPPC 0x10 /* MPPC compression */
23+#define MPPE_OPT_D 0x20 /* Unknown */
24+#define MPPE_OPT_UNSUPPORTED (MPPE_OPT_56|MPPE_OPT_MPPC|MPPE_OPT_D)
25+#define MPPE_OPT_UNKNOWN 0x40 /* Bits !defined in RFC 3078 were set */
26+
27+/*
28+ * This is not nice ... the alternative is a bitfield struct though.
29+ * And unfortunately, we cannot share the same bits for the option
30+ * names above since C and H are the same bit. We could do a u_int32
31+ * but then we have to do a htonl() all the time and/or we still need
32+ * to know which octet is which.
33+ */
34+#define MPPE_C_BIT 0x01 /* MPPC */
35+#define MPPE_D_BIT 0x10 /* Obsolete, usage unknown */
36+#define MPPE_L_BIT 0x20 /* 40-bit */
37+#define MPPE_S_BIT 0x40 /* 128-bit */
38+#define MPPE_M_BIT 0x80 /* 56-bit, not supported */
39+#define MPPE_H_BIT 0x01 /* Stateless (in a different byte) */
40+
41+/* Does not include H bit; used for least significant octet only. */
42+#define MPPE_ALL_BITS (MPPE_D_BIT|MPPE_L_BIT|MPPE_S_BIT|MPPE_M_BIT|MPPE_H_BIT)
43+
44+/* Build a CI from mppe opts (see RFC 3078) */
45+#define MPPE_OPTS_TO_CI(opts, ci) \
46+ do { \
47+ u_char *ptr = ci; /* u_char[4] */ \
48+ \
49+ /* H bit */ \
50+ if (opts & MPPE_OPT_STATEFUL) \
51+ *ptr++ = 0x0; \
52+ else \
53+ *ptr++ = MPPE_H_BIT; \
54+ *ptr++ = 0; \
55+ *ptr++ = 0; \
56+ \
57+ /* S,L bits */ \
58+ *ptr = 0; \
59+ if (opts & MPPE_OPT_128) \
60+ *ptr |= MPPE_S_BIT; \
61+ if (opts & MPPE_OPT_40) \
62+ *ptr |= MPPE_L_BIT; \
63+ /* M,D,C bits not supported */ \
64+ } while (/* CONSTCOND */ 0)
65+
66+/* The reverse of the above */
67+#define MPPE_CI_TO_OPTS(ci, opts) \
68+ do { \
69+ u_char *ptr = ci; /* u_char[4] */ \
70+ \
71+ opts = 0; \
72+ \
73+ /* H bit */ \
74+ if (!(ptr[0] & MPPE_H_BIT)) \
75+ opts |= MPPE_OPT_STATEFUL; \
76+ \
77+ /* S,L bits */ \
78+ if (ptr[3] & MPPE_S_BIT) \
79+ opts |= MPPE_OPT_128; \
80+ if (ptr[3] & MPPE_L_BIT) \
81+ opts |= MPPE_OPT_40; \
82+ \
83+ /* M,D,C bits */ \
84+ if (ptr[3] & MPPE_M_BIT) \
85+ opts |= MPPE_OPT_56; \
86+ if (ptr[3] & MPPE_D_BIT) \
87+ opts |= MPPE_OPT_D; \
88+ if (ptr[3] & MPPE_C_BIT) \
89+ opts |= MPPE_OPT_MPPC; \
90+ \
91+ /* Other bits */ \
92+ if (ptr[0] & ~MPPE_H_BIT) \
93+ opts |= MPPE_OPT_UNKNOWN; \
94+ if (ptr[1] || ptr[2]) \
95+ opts |= MPPE_OPT_UNKNOWN; \
96+ if (ptr[3] & ~MPPE_ALL_BITS) \
97+ opts |= MPPE_OPT_UNKNOWN; \
98+ } while (/* CONSTCOND */ 0)
99+
100+/*
101 * Definitions for other, as yet unsupported, compression methods.
102 */
103
This page took 0.162097 seconds and 4 git commands to generate.