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