Debian Codegraph @

pppd/ecp.c

raw
1 /*
2 * ecp.c - PPP Encryption Control Protocol.
3 *
4 * Copyright (c) 2002 Google, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 *
19 * 3. The name(s) of the authors of this software must not be used to
20 * endorse or promote products derived from this software without
21 * prior written permission.
22 *
23 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
24 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
25 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
26 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
28 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
29 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30 *
31 * Derived from ccp.c, which is:
32 *
33 * Copyright (c) 1994-2024 Paul Mackerras. All rights reserved.
34 *
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
37 * are met:
38 *
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 *
42 * 2. Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 *
47 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
48 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
49 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
50 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
51 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
52 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
53 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
54 */
55
56 #ifdef HAVE_CONFIG_H
57 #include "config.h"
58 #endif
59
60 #include <string.h>
61
62 #include "pppd-private.h"
63 #include "options.h"
64 #include "fsm.h"
65 #include "ecp.h"
66
67 static struct option ecp_option_list[] = {
68 { "noecp", o_bool, &ecp_protent.enabled_flag,
69 "Disable ECP negotiation" },
70 { "-ecp", o_bool, &ecp_protent.enabled_flag,
71 "Disable ECP negotiation", OPT_ALIAS },
72
73 { NULL }
74 };
75
76 /*
77 * Protocol entry points from main code.
78 */
79 static void ecp_init (int unit);
80 /*
81 static void ecp_open (int unit);
82 static void ecp_close (int unit, char *);
83 static void ecp_lowerup (int unit);
84 static void ecp_lowerdown (int);
85 static void ecp_input (int unit, u_char *pkt, int len);
86 static void ecp_protrej (int unit);
87 */
88 static int ecp_printpkt (u_char *pkt, int len,
89 void (*printer)(void *, char *, ...),
90 void *arg);
91 /*
92 static void ecp_datainput (int unit, u_char *pkt, int len);
93 */
94
95 struct protent ecp_protent = {
96 PPP_ECP,
97 ecp_init,
98 NULL, /* ecp_input, */
99 NULL, /* ecp_protrej, */
100 NULL, /* ecp_lowerup, */
101 NULL, /* ecp_lowerdown, */
102 NULL, /* ecp_open, */
103 NULL, /* ecp_close, */
104 ecp_printpkt,
105 NULL, /* ecp_datainput, */
106 0,
107 "ECP",
108 "Encrypted",
109 ecp_option_list,
110 NULL,
111 NULL,
112 NULL
113 };
114
115 fsm ecp_fsm[NUM_PPP];
116 ecp_options ecp_wantoptions[NUM_PPP]; /* what to request the peer to use */
117 ecp_options ecp_gotoptions[NUM_PPP]; /* what the peer agreed to do */
118 ecp_options ecp_allowoptions[NUM_PPP]; /* what we'll agree to do */
119 ecp_options ecp_hisoptions[NUM_PPP]; /* what we agreed to do */
120
121 static fsm_callbacks ecp_callbacks = {
122 NULL, /* ecp_resetci, */
123 NULL, /* ecp_cilen, */
124 NULL, /* ecp_addci, */
125 NULL, /* ecp_ackci, */
126 NULL, /* ecp_nakci, */
127 NULL, /* ecp_rejci, */
128 NULL, /* ecp_reqci, */
129 NULL, /* ecp_up, */
130 NULL, /* ecp_down, */
131 NULL,
132 NULL,
133 NULL,
134 NULL,
135 NULL, /* ecp_extcode, */
136 "ECP"
137 };
138
139 /*
140 * ecp_init - initialize ECP.
141 */
142 static void
143 ecp_init(int unit)
144 {
145 fsm *f = &ecp_fsm[unit];
146
147 f->unit = unit;
148 f->protocol = PPP_ECP;
149 f->callbacks = &ecp_callbacks;
150 fsm_init(f);
151
152 memset(&ecp_wantoptions[unit], 0, sizeof(ecp_options));
153 memset(&ecp_gotoptions[unit], 0, sizeof(ecp_options));
154 memset(&ecp_allowoptions[unit], 0, sizeof(ecp_options));
155 memset(&ecp_hisoptions[unit], 0, sizeof(ecp_options));
156
157 }
158
159
160 static int
161 ecp_printpkt(u_char *p, int plen,
162 void (*printer)(void *, char *, ...), void *arg)
163 {
164 return 0;
165 }
166