1314817Sngie/*	$NetBSD$	*/
2272343Sngie
3272343Sngie/*
4272343Sngie * ecp.c - PPP Encryption Control Protocol.
5272343Sngie *
6272343Sngie * Copyright (c) 2002 Google, Inc.
7272343Sngie * All rights reserved.
8272343Sngie *
9272343Sngie * Redistribution and use in source and binary forms, with or without
10272343Sngie * modification, are permitted provided that the following conditions
11272343Sngie * are met:
12272343Sngie *
13272343Sngie * 1. Redistributions of source code must retain the above copyright
14272343Sngie *    notice, this list of conditions and the following disclaimer.
15272343Sngie *
16272343Sngie * 2. Redistributions in binary form must reproduce the above copyright
17272343Sngie *    notice, this list of conditions and the following disclaimer in
18272343Sngie *    the documentation and/or other materials provided with the
19272343Sngie *    distribution.
20272343Sngie *
21272343Sngie * 3. The name(s) of the authors of this software must not be used to
22272343Sngie *    endorse or promote products derived from this software without
23272343Sngie *    prior written permission.
24272343Sngie *
25272343Sngie * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
26272343Sngie * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
27272343Sngie * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
28272343Sngie * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
29272343Sngie * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
30272343Sngie * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
31272343Sngie * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32314817Sngie *
33272343Sngie * Derived from ccp.c, which is:
34272343Sngie *
35272343Sngie * Copyright (c) 1994-2002 Paul Mackerras. All rights reserved.
36272343Sngie *
37272343Sngie * Redistribution and use in source and binary forms, with or without
38272343Sngie * modification, are permitted provided that the following conditions
39272343Sngie * are met:
40272343Sngie *
41272343Sngie * 1. Redistributions of source code must retain the above copyright
42272343Sngie *    notice, this list of conditions and the following disclaimer.
43272343Sngie *
44272343Sngie * 2. The name(s) of the authors of this software must not be used to
45272343Sngie *    endorse or promote products derived from this software without
46272343Sngie *    prior written permission.
47272343Sngie *
48272343Sngie * 3. Redistributions of any form whatsoever must retain the following
49272343Sngie *    acknowledgment:
50272343Sngie *    "This product includes software developed by Paul Mackerras
51272343Sngie *     <paulus@samba.org>".
52272343Sngie *
53272343Sngie * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
54272343Sngie * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
55272343Sngie * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
56272343Sngie * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
57272343Sngie * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
58272343Sngie * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
59272343Sngie * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
60272343Sngie */
61272343Sngie
62272343Sngie#include <sys/cdefs.h>
63272343Sngie#ifndef lint
64272343Sngie#if 0
65272343Sngie#define RCSID	"Id: ecp.c,v 1.4 2004/11/04 10:02:26 paulus Exp"
66272343Sngie#else
67272343Sngie__RCSID("$NetBSD$");
68272343Sngie#endif
69272343Sngie#endif
70272343Sngie
71272343Sngie#ifdef RCSID
72272343Sngiestatic const char rcsid[] = RCSID;
73272343Sngie#endif
74272343Sngie
75272343Sngie#include <string.h>
76272343Sngie
77272343Sngie#include "pppd.h"
78272343Sngie#include "fsm.h"
79272343Sngie#include "ecp.h"
80272343Sngie
81272343Sngiestatic option_t ecp_option_list[] = {
82272343Sngie    { "noecp", o_bool, &ecp_protent.enabled_flag,
83272343Sngie      "Disable ECP negotiation" },
84272343Sngie    { "-ecp", o_bool, &ecp_protent.enabled_flag,
85272343Sngie      "Disable ECP negotiation", OPT_ALIAS },
86272343Sngie
87272343Sngie    { NULL }
88276478Sngie};
89276478Sngie
90276478Sngie/*
91272343Sngie * Protocol entry points from main code.
92276478Sngie */
93272343Sngiestatic void ecp_init __P((int unit));
94272343Sngie/*
95272343Sngiestatic void ecp_open __P((int unit));
96272343Sngiestatic void ecp_close __P((int unit, char *));
97272343Sngiestatic void ecp_lowerup __P((int unit));
98272343Sngiestatic void ecp_lowerdown __P((int));
99272343Sngiestatic void ecp_input __P((int unit, u_char *pkt, int len));
100272343Sngiestatic void ecp_protrej __P((int unit));
101272343Sngie*/
102272343Sngiestatic int  ecp_printpkt __P((u_char *pkt, int len,
103272343Sngie			      void (*printer) __P((void *, char *, ...)),
104272343Sngie			      void *arg));
105272343Sngie/*
106272343Sngiestatic void ecp_datainput __P((int unit, u_char *pkt, int len));
107272343Sngie*/
108272343Sngie
109272343Sngiestruct protent ecp_protent = {
110272343Sngie    PPP_ECP,
111272343Sngie    ecp_init,
112272343Sngie    NULL, /* ecp_input, */
113272343Sngie    NULL, /* ecp_protrej, */
114272343Sngie    NULL, /* ecp_lowerup, */
115272343Sngie    NULL, /* ecp_lowerdown, */
116272343Sngie    NULL, /* ecp_open, */
117272343Sngie    NULL, /* ecp_close, */
118272343Sngie    ecp_printpkt,
119272343Sngie    NULL, /* ecp_datainput, */
120272343Sngie    0,
121272343Sngie    "ECP",
122272343Sngie    "Encrypted",
123272343Sngie    ecp_option_list,
124272343Sngie    NULL,
125272343Sngie    NULL,
126272343Sngie    NULL
127272343Sngie};
128272343Sngie
129272343Sngiefsm ecp_fsm[NUM_PPP];
130272343Sngieecp_options ecp_wantoptions[NUM_PPP];	/* what to request the peer to use */
131272343Sngieecp_options ecp_gotoptions[NUM_PPP];	/* what the peer agreed to do */
132272343Sngieecp_options ecp_allowoptions[NUM_PPP];	/* what we'll agree to do */
133272343Sngieecp_options ecp_hisoptions[NUM_PPP];	/* what we agreed to do */
134272343Sngie
135272343Sngiestatic fsm_callbacks ecp_callbacks = {
136272343Sngie    NULL, /* ecp_resetci, */
137272343Sngie    NULL, /* ecp_cilen, */
138272343Sngie    NULL, /* ecp_addci, */
139272343Sngie    NULL, /* ecp_ackci, */
140272343Sngie    NULL, /* ecp_nakci, */
141272343Sngie    NULL, /* ecp_rejci, */
142272343Sngie    NULL, /* ecp_reqci, */
143272343Sngie    NULL, /* ecp_up, */
144272343Sngie    NULL, /* ecp_down, */
145272343Sngie    NULL,
146272343Sngie    NULL,
147272343Sngie    NULL,
148272343Sngie    NULL,
149272343Sngie    NULL, /* ecp_extcode, */
150272343Sngie    "ECP"
151272343Sngie};
152272343Sngie
153272343Sngie/*
154272343Sngie * ecp_init - initialize ECP.
155272343Sngie */
156272343Sngiestatic void
157272343Sngieecp_init(unit)
158272343Sngie    int unit;
159272343Sngie{
160272343Sngie    fsm *f = &ecp_fsm[unit];
161272343Sngie
162272343Sngie    f->unit = unit;
163    f->protocol = PPP_ECP;
164    f->callbacks = &ecp_callbacks;
165    fsm_init(f);
166
167    memset(&ecp_wantoptions[unit],  0, sizeof(ecp_options));
168    memset(&ecp_gotoptions[unit],   0, sizeof(ecp_options));
169    memset(&ecp_allowoptions[unit], 0, sizeof(ecp_options));
170    memset(&ecp_hisoptions[unit],   0, sizeof(ecp_options));
171
172}
173
174
175static int
176ecp_printpkt(p, plen, printer, arg)
177    u_char *p;
178    int plen;
179    void (*printer) __P((void *, char *, ...));
180    void *arg;
181{
182    return 0;
183}
184
185