]> git.ozlabs.org Git - ppp.git/blob - pppd/ecp.c
1ecd7be0d79e64007085e51763bee6b3c3f7fa6d
[ppp.git] / pppd / ecp.c
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-2002 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. The name(s) of the authors of this software must not be used to
43  *    endorse or promote products derived from this software without
44  *    prior written permission.
45  *
46  * 3. Redistributions of any form whatsoever must retain the following
47  *    acknowledgment:
48  *    "This product includes software developed by Paul Mackerras
49  *     <paulus@samba.org>".
50  *
51  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
52  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
53  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
54  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
55  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
56  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
57  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
58  */
59
60 #include <string.h>
61
62 #include "pppd.h"
63 #include "fsm.h"
64 #include "ecp.h"
65
66 static option_t ecp_option_list[] = {
67     { "noecp", o_bool, &ecp_protent.enabled_flag,
68       "Disable ECP negotiation" },
69     { "-ecp", o_bool, &ecp_protent.enabled_flag,
70       "Disable ECP negotiation", OPT_ALIAS },
71
72     { NULL }
73 };
74
75 /*
76  * Protocol entry points from main code.
77  */
78 static void ecp_init (int unit);
79 /*
80 static void ecp_open (int unit);
81 static void ecp_close (int unit, char *);
82 static void ecp_lowerup (int unit);
83 static void ecp_lowerdown (int);
84 static void ecp_input (int unit, u_char *pkt, int len);
85 static void ecp_protrej (int unit);
86 */
87 static int  ecp_printpkt (u_char *pkt, int len,
88                           void (*printer)(void *, char *, ...),
89                           void *arg);
90 /*
91 static void ecp_datainput (int unit, u_char *pkt, int len);
92 */
93
94 struct protent ecp_protent = {
95     PPP_ECP,
96     ecp_init,
97     NULL, /* ecp_input, */
98     NULL, /* ecp_protrej, */
99     NULL, /* ecp_lowerup, */
100     NULL, /* ecp_lowerdown, */
101     NULL, /* ecp_open, */
102     NULL, /* ecp_close, */
103     ecp_printpkt,
104     NULL, /* ecp_datainput, */
105     0,
106     "ECP",
107     "Encrypted",
108     ecp_option_list,
109     NULL,
110     NULL,
111     NULL
112 };
113
114 fsm ecp_fsm[NUM_PPP];
115 ecp_options ecp_wantoptions[NUM_PPP];   /* what to request the peer to use */
116 ecp_options ecp_gotoptions[NUM_PPP];    /* what the peer agreed to do */
117 ecp_options ecp_allowoptions[NUM_PPP];  /* what we'll agree to do */
118 ecp_options ecp_hisoptions[NUM_PPP];    /* what we agreed to do */
119
120 static fsm_callbacks ecp_callbacks = {
121     NULL, /* ecp_resetci, */
122     NULL, /* ecp_cilen, */
123     NULL, /* ecp_addci, */
124     NULL, /* ecp_ackci, */
125     NULL, /* ecp_nakci, */
126     NULL, /* ecp_rejci, */
127     NULL, /* ecp_reqci, */
128     NULL, /* ecp_up, */
129     NULL, /* ecp_down, */
130     NULL,
131     NULL,
132     NULL,
133     NULL,
134     NULL, /* ecp_extcode, */
135     "ECP"
136 };
137
138 /*
139  * ecp_init - initialize ECP.
140  */
141 static void
142 ecp_init(int unit)
143 {
144     fsm *f = &ecp_fsm[unit];
145
146     f->unit = unit;
147     f->protocol = PPP_ECP;
148     f->callbacks = &ecp_callbacks;
149     fsm_init(f);
150
151     memset(&ecp_wantoptions[unit],  0, sizeof(ecp_options));
152     memset(&ecp_gotoptions[unit],   0, sizeof(ecp_options));
153     memset(&ecp_allowoptions[unit], 0, sizeof(ecp_options));
154     memset(&ecp_hisoptions[unit],   0, sizeof(ecp_options));
155
156 }
157
158
159 static int
160 ecp_printpkt(u_char *p, int plen,
161              void (*printer)(void *, char *, ...), void *arg)
162 {
163     return 0;
164 }
165