2 * ecp.c - PPP Encryption Control Protocol.
4 * Copyright (c) 1994 The Australian National University.
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
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
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,
27 * Copyright (c) 2002 Google, Inc.
28 * All rights reserved.
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.
43 #define RCSID "$Id: ecp.c,v 1.1 2002/05/22 18:16:54 dfs Exp $"
45 static const char rcsid[] = RCSID;
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 },
63 * Protocol entry points from main code.
65 static void ecp_init __P((int unit));
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));
74 static int ecp_printpkt __P((u_char *pkt, int len,
75 void (*printer) __P((void *, char *, ...)),
78 static void ecp_datainput __P((int unit, u_char *pkt, int len));
81 struct protent ecp_protent = {
84 NULL, /* ecp_input, */
85 NULL, /* ecp_protrej, */
86 NULL, /* ecp_lowerup, */
87 NULL, /* ecp_lowerdown, */
89 NULL, /* ecp_close, */
91 NULL, /* ecp_datainput, */
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 */
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, */
116 NULL, /* ecp_down, */
121 NULL, /* ecp_extcode, */
126 * ecp_init - initialize ECP.
132 fsm *f = &ecp_fsm[unit];
135 f->protocol = PPP_ECP;
136 f->callbacks = &ecp_callbacks;
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));
148 ecp_printpkt(p, plen, printer, arg)
151 void (*printer) __P((void *, char *, ...));