My fork of the HTTPServer (working)
Embed:
(wiki syntax)
Show/hide line numbers
ppp_oe.h
00001 /***************************************************************************** 00002 * ppp_oe.h - PPP Over Ethernet implementation for lwIP. 00003 * 00004 * Copyright (c) 2006 by Marc Boucher, Services Informatiques (MBSI) inc. 00005 * 00006 * The authors hereby grant permission to use, copy, modify, distribute, 00007 * and license this software and its documentation for any purpose, provided 00008 * that existing copyright notices are retained in all copies and that this 00009 * notice and the following disclaimer are included verbatim in any 00010 * distributions. No written agreement, license, or royalty fee is required 00011 * for any of the authorized uses. 00012 * 00013 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 00014 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00015 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00016 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00017 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00018 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00019 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00020 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00021 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00022 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00023 * 00024 ****************************************************************************** 00025 * REVISION HISTORY 00026 * 00027 * 06-01-01 Marc Boucher <marc@mbsi.ca> 00028 * Ported to lwIP. 00029 *****************************************************************************/ 00030 00031 00032 00033 /* based on NetBSD: if_pppoe.c,v 1.64 2006/01/31 23:50:15 martin Exp */ 00034 00035 /*- 00036 * Copyright (c) 2002 The NetBSD Foundation, Inc. 00037 * All rights reserved. 00038 * 00039 * This code is derived from software contributed to The NetBSD Foundation 00040 * by Martin Husemann <martin@NetBSD.org>. 00041 * 00042 * Redistribution and use in source and binary forms, with or without 00043 * modification, are permitted provided that the following conditions 00044 * are met: 00045 * 1. Redistributions of source code must retain the above copyright 00046 * notice, this list of conditions and the following disclaimer. 00047 * 2. Redistributions in binary form must reproduce the above copyright 00048 * notice, this list of conditions and the following disclaimer in the 00049 * documentation and/or other materials provided with the distribution. 00050 * 3. All advertising materials mentioning features or use of this software 00051 * must display the following acknowledgement: 00052 * This product includes software developed by the NetBSD 00053 * Foundation, Inc. and its contributors. 00054 * 4. Neither the name of The NetBSD Foundation nor the names of its 00055 * contributors may be used to endorse or promote products derived 00056 * from this software without specific prior written permission. 00057 * 00058 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 00059 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00060 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00061 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 00062 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00063 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00064 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00065 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00066 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00067 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00068 * POSSIBILITY OF SUCH DAMAGE. 00069 */ 00070 #ifndef PPP_OE_H 00071 #define PPP_OE_H 00072 00073 #include "lwip/opt.h" 00074 00075 #if PPPOE_SUPPORT > 0 00076 00077 #ifdef __cplusplus 00078 extern "C" { 00079 #endif 00080 00081 #ifdef PACK_STRUCT_USE_INCLUDES 00082 # include "arch/bpstruct.h" 00083 #endif 00084 PACK_STRUCT_BEGIN 00085 struct pppoehdr { 00086 PACK_STRUCT_FIELD(u8_t vertype); 00087 PACK_STRUCT_FIELD(u8_t code); 00088 PACK_STRUCT_FIELD(u16_t session); 00089 PACK_STRUCT_FIELD(u16_t plen); 00090 } PACK_STRUCT_STRUCT; 00091 PACK_STRUCT_END 00092 #ifdef PACK_STRUCT_USE_INCLUDES 00093 # include "arch/epstruct.h" 00094 #endif 00095 00096 #ifdef PACK_STRUCT_USE_INCLUDES 00097 # include "arch/bpstruct.h" 00098 #endif 00099 PACK_STRUCT_BEGIN 00100 struct pppoetag { 00101 PACK_STRUCT_FIELD(u16_t tag); 00102 PACK_STRUCT_FIELD(u16_t len); 00103 } PACK_STRUCT_STRUCT; 00104 PACK_STRUCT_END 00105 #ifdef PACK_STRUCT_USE_INCLUDES 00106 # include "arch/epstruct.h" 00107 #endif 00108 00109 00110 #define PPPOE_STATE_INITIAL 0 00111 #define PPPOE_STATE_PADI_SENT 1 00112 #define PPPOE_STATE_PADR_SENT 2 00113 #define PPPOE_STATE_SESSION 3 00114 #define PPPOE_STATE_CLOSING 4 00115 /* passive */ 00116 #define PPPOE_STATE_PADO_SENT 1 00117 00118 #define PPPOE_HEADERLEN sizeof(struct pppoehdr) 00119 #define PPPOE_VERTYPE 0x11 /* VER=1, TYPE = 1 */ 00120 00121 #define PPPOE_TAG_EOL 0x0000 /* end of list */ 00122 #define PPPOE_TAG_SNAME 0x0101 /* service name */ 00123 #define PPPOE_TAG_ACNAME 0x0102 /* access concentrator name */ 00124 #define PPPOE_TAG_HUNIQUE 0x0103 /* host unique */ 00125 #define PPPOE_TAG_ACCOOKIE 0x0104 /* AC cookie */ 00126 #define PPPOE_TAG_VENDOR 0x0105 /* vendor specific */ 00127 #define PPPOE_TAG_RELAYSID 0x0110 /* relay session id */ 00128 #define PPPOE_TAG_SNAME_ERR 0x0201 /* service name error */ 00129 #define PPPOE_TAG_ACSYS_ERR 0x0202 /* AC system error */ 00130 #define PPPOE_TAG_GENERIC_ERR 0x0203 /* gerneric error */ 00131 00132 #define PPPOE_CODE_PADI 0x09 /* Active Discovery Initiation */ 00133 #define PPPOE_CODE_PADO 0x07 /* Active Discovery Offer */ 00134 #define PPPOE_CODE_PADR 0x19 /* Active Discovery Request */ 00135 #define PPPOE_CODE_PADS 0x65 /* Active Discovery Session confirmation */ 00136 #define PPPOE_CODE_PADT 0xA7 /* Active Discovery Terminate */ 00137 00138 #ifndef ETHERMTU 00139 #define ETHERMTU 1500 00140 #endif 00141 00142 /* two byte PPP protocol discriminator, then IP data */ 00143 #define PPPOE_MAXMTU (ETHERMTU-PPPOE_HEADERLEN-2) 00144 00145 struct pppoe_softc; 00146 00147 00148 void pppoe_init(void); 00149 00150 err_t pppoe_create(struct netif *ethif, int pd, void (*linkStatusCB)(int pd, int up), struct pppoe_softc **scptr); 00151 err_t pppoe_destroy(struct netif *ifp); 00152 00153 int pppoe_connect(struct pppoe_softc *sc); 00154 void pppoe_disconnect(struct pppoe_softc *sc); 00155 00156 void pppoe_disc_input(struct netif *netif, struct pbuf *p); 00157 void pppoe_data_input(struct netif *netif, struct pbuf *p); 00158 00159 err_t pppoe_xmit(struct pppoe_softc *sc, struct pbuf *pb); 00160 00161 extern int pppoe_hdrlen; 00162 00163 #ifdef __cplusplus 00164 } 00165 #endif 00166 00167 #endif /* PPPOE_SUPPORT */ 00168 00169 #endif /* PPP_OE_H */
Generated on Tue Jul 12 2022 19:24:05 by 1.7.2