1/* 2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23/* 24 * ecp.c - PPP Encryption Control Protocol. 25 * 26 * Copyright (c) 2002 Google, Inc. 27 * All rights reserved. 28 * 29 * Redistribution and use in source and binary forms, with or without 30 * modification, are permitted provided that the following conditions 31 * are met: 32 * 33 * 1. Redistributions of source code must retain the above copyright 34 * notice, this list of conditions and the following disclaimer. 35 * 36 * 2. Redistributions in binary form must reproduce the above copyright 37 * notice, this list of conditions and the following disclaimer in 38 * the documentation and/or other materials provided with the 39 * distribution. 40 * 41 * 3. The name(s) of the authors of this software must not be used to 42 * endorse or promote products derived from this software without 43 * prior written permission. 44 * 45 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 46 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 47 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 48 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 49 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 50 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 51 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 52 * 53 * Derived from ccp.c, which is: 54 * 55 * Copyright (c) 1994-2002 Paul Mackerras. All rights reserved. 56 * 57 * Redistribution and use in source and binary forms, with or without 58 * modification, are permitted provided that the following conditions 59 * are met: 60 * 61 * 1. Redistributions of source code must retain the above copyright 62 * notice, this list of conditions and the following disclaimer. 63 * 64 * 2. Redistributions in binary form must reproduce the above copyright 65 * notice, this list of conditions and the following disclaimer in 66 * the documentation and/or other materials provided with the 67 * distribution. 68 * 69 * 3. The name(s) of the authors of this software must not be used to 70 * endorse or promote products derived from this software without 71 * prior written permission. 72 * 73 * 4. Redistributions of any form whatsoever must retain the following 74 * acknowledgment: 75 * "This product includes software developed by Paul Mackerras 76 * <paulus@samba.org>". 77 * 78 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 79 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 80 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 81 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 82 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 83 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 84 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 85 */ 86 87#define RCSID "$Id: ecp.c,v 1.6 2005/12/13 06:30:15 lindak Exp $" 88 89#ifndef lint 90static const char rcsid[] = RCSID; 91#endif 92 93#include <string.h> 94 95#include "pppd.h" 96#include "fsm.h" 97#include "ecp.h" 98 99static option_t ecp_option_list[] = { 100 { "noecp", o_bool, &ecp_protent.enabled_flag, 101 "Disable ECP negotiation" }, 102 { "-ecp", o_bool, &ecp_protent.enabled_flag, 103 "Disable ECP negotiation", OPT_ALIAS }, 104 105 { NULL } 106}; 107 108/* 109 * Protocol entry points from main code. 110 */ 111static void ecp_init __P((int unit)); 112/* 113static void ecp_open __P((int unit)); 114static void ecp_close __P((int unit, char *)); 115static void ecp_lowerup __P((int unit)); 116static void ecp_lowerdown __P((int)); 117static void ecp_input __P((int unit, u_char *pkt, int len)); 118static void ecp_protrej __P((int unit)); 119*/ 120static int ecp_printpkt __P((u_char *pkt, int len, 121 void (*printer) __P((void *, char *, ...)), 122 void *arg)); 123/* 124static void ecp_datainput __P((int unit, u_char *pkt, int len)); 125*/ 126 127struct protent ecp_protent = { 128 PPP_ECP, 129 ecp_init, 130 NULL, /* ecp_input, */ 131 NULL, /* ecp_protrej, */ 132 NULL, /* ecp_lowerup, */ 133 NULL, /* ecp_lowerdown, */ 134 NULL, /* ecp_open, */ 135 NULL, /* ecp_close, */ 136 ecp_printpkt, 137 NULL, /* ecp_datainput, */ 138 0, 139 "ECP", 140 "Encrypted", 141 ecp_option_list, 142 NULL, 143 NULL, 144 NULL, 145#ifdef __APPLE__ 146 NULL, 147 NULL, 148 NULL, 149 NULL 150#endif 151}; 152 153fsm ecp_fsm[NUM_PPP]; 154ecp_options ecp_wantoptions[NUM_PPP]; /* what to request the peer to use */ 155ecp_options ecp_gotoptions[NUM_PPP]; /* what the peer agreed to do */ 156ecp_options ecp_allowoptions[NUM_PPP]; /* what we'll agree to do */ 157ecp_options ecp_hisoptions[NUM_PPP]; /* what we agreed to do */ 158 159static fsm_callbacks ecp_callbacks = { 160 NULL, /* ecp_resetci, */ 161 NULL, /* ecp_cilen, */ 162 NULL, /* ecp_addci, */ 163 NULL, /* ecp_ackci, */ 164 NULL, /* ecp_nakci, */ 165 NULL, /* ecp_rejci, */ 166 NULL, /* ecp_reqci, */ 167 NULL, /* ecp_up, */ 168 NULL, /* ecp_down, */ 169 NULL, 170 NULL, 171 NULL, 172 NULL, 173 NULL, /* ecp_extcode, */ 174 "ECP" 175}; 176 177/* 178 * ecp_init - initialize ECP. 179 */ 180static void 181ecp_init(unit) 182 int unit; 183{ 184 fsm *f = &ecp_fsm[unit]; 185 186 f->unit = unit; 187 f->protocol = PPP_ECP; 188 f->callbacks = &ecp_callbacks; 189 fsm_init(f); 190 191 memset(&ecp_wantoptions[unit], 0, sizeof(ecp_options)); 192 memset(&ecp_gotoptions[unit], 0, sizeof(ecp_options)); 193 memset(&ecp_allowoptions[unit], 0, sizeof(ecp_options)); 194 memset(&ecp_hisoptions[unit], 0, sizeof(ecp_options)); 195 196} 197 198 199static int 200ecp_printpkt(p, plen, printer, arg) 201 u_char *p; 202 int plen; 203 void (*printer) __P((void *, char *, ...)); 204 void *arg; 205{ 206 return 0; 207} 208 209