]> git.ozlabs.org Git - ppp.git/blob - pppd/ecp.c
26749f85165655b527d113ebc56706bbcbbbea91
[ppp.git] / pppd / ecp.c
1 /*
2  * ecp.c - PPP Encryption Control Protocol.
3  *
4  * Copyright (c) 1994 The Australian National University.
5  * All rights reserved.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation is hereby granted, provided that the above copyright
9  * notice appears in all copies.  This software is provided without any
10  * warranty, express or implied. The Australian National University
11  * makes no representations about the suitability of this software for
12  * any purpose.
13  *
14  * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
15  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
17  * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
18  * OF SUCH DAMAGE.
19  *
20  * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
21  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23  * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
24  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25  * OR MODIFICATIONS.
26  *
27  * Copyright (c) 2002 Google, Inc.
28  * All rights reserved.
29  *
30  * Redistribution and use in source and binary forms are permitted
31  * provided that the above copyright notice and this paragraph are
32  * duplicated in all such forms and that any documentation,
33  * advertising materials, and other materials related to such
34  * distribution and use acknowledge that the software was developed
35  * by the Australian National University.  The name of the University
36  * may not be used to endorse or promote products derived from this
37  * software without specific prior written permission.
38  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
39  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
40  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
41  */
42
43 #define RCSID   "$Id: ecp.c,v 1.1 2002/05/22 18:16:54 dfs Exp $"
44
45 static const char rcsid[] = RCSID;
46
47 #include <string.h>
48
49 #include "pppd.h"
50 #include "fsm.h"
51 #include "ecp.h"
52
53 static option_t ecp_option_list[] = {
54     { "noecp", o_bool, &ecp_protent.enabled_flag,
55       "Disable ECP negotiation" },
56     { "-ecp", o_bool, &ecp_protent.enabled_flag,
57       "Disable ECP negotiation", OPT_ALIAS },
58
59     { NULL }
60 };
61
62 /*
63  * Protocol entry points from main code.
64  */
65 static void ecp_init __P((int unit));
66 /*
67 static void ecp_open __P((int unit));
68 static void ecp_close __P((int unit, char *));
69 static void ecp_lowerup __P((int unit));
70 static void ecp_lowerdown __P((int));
71 static void ecp_input __P((int unit, u_char *pkt, int len));
72 static void ecp_protrej __P((int unit));
73 */
74 static int  ecp_printpkt __P((u_char *pkt, int len,
75                               void (*printer) __P((void *, char *, ...)),
76                               void *arg));
77 /*
78 static void ecp_datainput __P((int unit, u_char *pkt, int len));
79 */
80
81 struct protent ecp_protent = {
82     PPP_ECP,
83     ecp_init,
84     NULL, /* ecp_input, */
85     NULL, /* ecp_protrej, */
86     NULL, /* ecp_lowerup, */
87     NULL, /* ecp_lowerdown, */
88     NULL, /* ecp_open, */
89     NULL, /* ecp_close, */
90     ecp_printpkt,
91     NULL, /* ecp_datainput, */
92     0,
93     "ECP",
94     "Encrypted",
95     ecp_option_list,
96     NULL,
97     NULL,
98     NULL
99 };
100
101 fsm ecp_fsm[NUM_PPP];
102 ecp_options ecp_wantoptions[NUM_PPP];   /* what to request the peer to use */
103 ecp_options ecp_gotoptions[NUM_PPP];    /* what the peer agreed to do */
104 ecp_options ecp_allowoptions[NUM_PPP];  /* what we'll agree to do */
105 ecp_options ecp_hisoptions[NUM_PPP];    /* what we agreed to do */
106
107 static fsm_callbacks ecp_callbacks = {
108     NULL, /* ecp_resetci, */
109     NULL, /* ecp_cilen, */
110     NULL, /* ecp_addci, */
111     NULL, /* ecp_ackci, */
112     NULL, /* ecp_nakci, */
113     NULL, /* ecp_rejci, */
114     NULL, /* ecp_reqci, */
115     NULL, /* ecp_up, */
116     NULL, /* ecp_down, */
117     NULL,
118     NULL,
119     NULL,
120     NULL,
121     NULL, /* ecp_extcode, */
122     "ECP"
123 };
124
125 /*
126  * ecp_init - initialize ECP.
127  */
128 static void
129 ecp_init(unit)
130     int unit;
131 {
132     fsm *f = &ecp_fsm[unit];
133
134     f->unit = unit;
135     f->protocol = PPP_ECP;
136     f->callbacks = &ecp_callbacks;
137     fsm_init(f);
138
139     memset(&ecp_wantoptions[unit],  0, sizeof(ecp_options));
140     memset(&ecp_gotoptions[unit],   0, sizeof(ecp_options));
141     memset(&ecp_allowoptions[unit], 0, sizeof(ecp_options));
142     memset(&ecp_hisoptions[unit],   0, sizeof(ecp_options));
143
144 }
145
146
147 static int
148 ecp_printpkt(p, plen, printer, arg)
149     u_char *p;
150     int plen;
151     void (*printer) __P((void *, char *, ...));
152     void *arg;
153 {
154     return 0;
155 }
156