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