My fork of the HTTPServer (working)

Dependents:   DGWWebServer LAN2

Committer:
screamer
Date:
Mon Aug 06 09:23:14 2012 +0000
Revision:
0:7a64fbb4069d
[mbed] converted /DGWWebServer/HTTPServer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:7a64fbb4069d 1 /*****************************************************************************
screamer 0:7a64fbb4069d 2 * ppp_oe.h - PPP Over Ethernet implementation for lwIP.
screamer 0:7a64fbb4069d 3 *
screamer 0:7a64fbb4069d 4 * Copyright (c) 2006 by Marc Boucher, Services Informatiques (MBSI) inc.
screamer 0:7a64fbb4069d 5 *
screamer 0:7a64fbb4069d 6 * The authors hereby grant permission to use, copy, modify, distribute,
screamer 0:7a64fbb4069d 7 * and license this software and its documentation for any purpose, provided
screamer 0:7a64fbb4069d 8 * that existing copyright notices are retained in all copies and that this
screamer 0:7a64fbb4069d 9 * notice and the following disclaimer are included verbatim in any
screamer 0:7a64fbb4069d 10 * distributions. No written agreement, license, or royalty fee is required
screamer 0:7a64fbb4069d 11 * for any of the authorized uses.
screamer 0:7a64fbb4069d 12 *
screamer 0:7a64fbb4069d 13 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
screamer 0:7a64fbb4069d 14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
screamer 0:7a64fbb4069d 15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
screamer 0:7a64fbb4069d 16 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
screamer 0:7a64fbb4069d 17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
screamer 0:7a64fbb4069d 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
screamer 0:7a64fbb4069d 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
screamer 0:7a64fbb4069d 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
screamer 0:7a64fbb4069d 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
screamer 0:7a64fbb4069d 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
screamer 0:7a64fbb4069d 23 *
screamer 0:7a64fbb4069d 24 ******************************************************************************
screamer 0:7a64fbb4069d 25 * REVISION HISTORY
screamer 0:7a64fbb4069d 26 *
screamer 0:7a64fbb4069d 27 * 06-01-01 Marc Boucher <marc@mbsi.ca>
screamer 0:7a64fbb4069d 28 * Ported to lwIP.
screamer 0:7a64fbb4069d 29 *****************************************************************************/
screamer 0:7a64fbb4069d 30
screamer 0:7a64fbb4069d 31
screamer 0:7a64fbb4069d 32
screamer 0:7a64fbb4069d 33 /* based on NetBSD: if_pppoe.c,v 1.64 2006/01/31 23:50:15 martin Exp */
screamer 0:7a64fbb4069d 34
screamer 0:7a64fbb4069d 35 /*-
screamer 0:7a64fbb4069d 36 * Copyright (c) 2002 The NetBSD Foundation, Inc.
screamer 0:7a64fbb4069d 37 * All rights reserved.
screamer 0:7a64fbb4069d 38 *
screamer 0:7a64fbb4069d 39 * This code is derived from software contributed to The NetBSD Foundation
screamer 0:7a64fbb4069d 40 * by Martin Husemann <martin@NetBSD.org>.
screamer 0:7a64fbb4069d 41 *
screamer 0:7a64fbb4069d 42 * Redistribution and use in source and binary forms, with or without
screamer 0:7a64fbb4069d 43 * modification, are permitted provided that the following conditions
screamer 0:7a64fbb4069d 44 * are met:
screamer 0:7a64fbb4069d 45 * 1. Redistributions of source code must retain the above copyright
screamer 0:7a64fbb4069d 46 * notice, this list of conditions and the following disclaimer.
screamer 0:7a64fbb4069d 47 * 2. Redistributions in binary form must reproduce the above copyright
screamer 0:7a64fbb4069d 48 * notice, this list of conditions and the following disclaimer in the
screamer 0:7a64fbb4069d 49 * documentation and/or other materials provided with the distribution.
screamer 0:7a64fbb4069d 50 * 3. All advertising materials mentioning features or use of this software
screamer 0:7a64fbb4069d 51 * must display the following acknowledgement:
screamer 0:7a64fbb4069d 52 * This product includes software developed by the NetBSD
screamer 0:7a64fbb4069d 53 * Foundation, Inc. and its contributors.
screamer 0:7a64fbb4069d 54 * 4. Neither the name of The NetBSD Foundation nor the names of its
screamer 0:7a64fbb4069d 55 * contributors may be used to endorse or promote products derived
screamer 0:7a64fbb4069d 56 * from this software without specific prior written permission.
screamer 0:7a64fbb4069d 57 *
screamer 0:7a64fbb4069d 58 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
screamer 0:7a64fbb4069d 59 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
screamer 0:7a64fbb4069d 60 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
screamer 0:7a64fbb4069d 61 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
screamer 0:7a64fbb4069d 62 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
screamer 0:7a64fbb4069d 63 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
screamer 0:7a64fbb4069d 64 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
screamer 0:7a64fbb4069d 65 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
screamer 0:7a64fbb4069d 66 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
screamer 0:7a64fbb4069d 67 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
screamer 0:7a64fbb4069d 68 * POSSIBILITY OF SUCH DAMAGE.
screamer 0:7a64fbb4069d 69 */
screamer 0:7a64fbb4069d 70 #ifndef PPP_OE_H
screamer 0:7a64fbb4069d 71 #define PPP_OE_H
screamer 0:7a64fbb4069d 72
screamer 0:7a64fbb4069d 73 #include "lwip/opt.h"
screamer 0:7a64fbb4069d 74
screamer 0:7a64fbb4069d 75 #if PPPOE_SUPPORT > 0
screamer 0:7a64fbb4069d 76
screamer 0:7a64fbb4069d 77 #ifdef __cplusplus
screamer 0:7a64fbb4069d 78 extern "C" {
screamer 0:7a64fbb4069d 79 #endif
screamer 0:7a64fbb4069d 80
screamer 0:7a64fbb4069d 81 #ifdef PACK_STRUCT_USE_INCLUDES
screamer 0:7a64fbb4069d 82 # include "arch/bpstruct.h"
screamer 0:7a64fbb4069d 83 #endif
screamer 0:7a64fbb4069d 84 PACK_STRUCT_BEGIN
screamer 0:7a64fbb4069d 85 struct pppoehdr {
screamer 0:7a64fbb4069d 86 PACK_STRUCT_FIELD(u8_t vertype);
screamer 0:7a64fbb4069d 87 PACK_STRUCT_FIELD(u8_t code);
screamer 0:7a64fbb4069d 88 PACK_STRUCT_FIELD(u16_t session);
screamer 0:7a64fbb4069d 89 PACK_STRUCT_FIELD(u16_t plen);
screamer 0:7a64fbb4069d 90 } PACK_STRUCT_STRUCT;
screamer 0:7a64fbb4069d 91 PACK_STRUCT_END
screamer 0:7a64fbb4069d 92 #ifdef PACK_STRUCT_USE_INCLUDES
screamer 0:7a64fbb4069d 93 # include "arch/epstruct.h"
screamer 0:7a64fbb4069d 94 #endif
screamer 0:7a64fbb4069d 95
screamer 0:7a64fbb4069d 96 #ifdef PACK_STRUCT_USE_INCLUDES
screamer 0:7a64fbb4069d 97 # include "arch/bpstruct.h"
screamer 0:7a64fbb4069d 98 #endif
screamer 0:7a64fbb4069d 99 PACK_STRUCT_BEGIN
screamer 0:7a64fbb4069d 100 struct pppoetag {
screamer 0:7a64fbb4069d 101 PACK_STRUCT_FIELD(u16_t tag);
screamer 0:7a64fbb4069d 102 PACK_STRUCT_FIELD(u16_t len);
screamer 0:7a64fbb4069d 103 } PACK_STRUCT_STRUCT;
screamer 0:7a64fbb4069d 104 PACK_STRUCT_END
screamer 0:7a64fbb4069d 105 #ifdef PACK_STRUCT_USE_INCLUDES
screamer 0:7a64fbb4069d 106 # include "arch/epstruct.h"
screamer 0:7a64fbb4069d 107 #endif
screamer 0:7a64fbb4069d 108
screamer 0:7a64fbb4069d 109
screamer 0:7a64fbb4069d 110 #define PPPOE_STATE_INITIAL 0
screamer 0:7a64fbb4069d 111 #define PPPOE_STATE_PADI_SENT 1
screamer 0:7a64fbb4069d 112 #define PPPOE_STATE_PADR_SENT 2
screamer 0:7a64fbb4069d 113 #define PPPOE_STATE_SESSION 3
screamer 0:7a64fbb4069d 114 #define PPPOE_STATE_CLOSING 4
screamer 0:7a64fbb4069d 115 /* passive */
screamer 0:7a64fbb4069d 116 #define PPPOE_STATE_PADO_SENT 1
screamer 0:7a64fbb4069d 117
screamer 0:7a64fbb4069d 118 #define PPPOE_HEADERLEN sizeof(struct pppoehdr)
screamer 0:7a64fbb4069d 119 #define PPPOE_VERTYPE 0x11 /* VER=1, TYPE = 1 */
screamer 0:7a64fbb4069d 120
screamer 0:7a64fbb4069d 121 #define PPPOE_TAG_EOL 0x0000 /* end of list */
screamer 0:7a64fbb4069d 122 #define PPPOE_TAG_SNAME 0x0101 /* service name */
screamer 0:7a64fbb4069d 123 #define PPPOE_TAG_ACNAME 0x0102 /* access concentrator name */
screamer 0:7a64fbb4069d 124 #define PPPOE_TAG_HUNIQUE 0x0103 /* host unique */
screamer 0:7a64fbb4069d 125 #define PPPOE_TAG_ACCOOKIE 0x0104 /* AC cookie */
screamer 0:7a64fbb4069d 126 #define PPPOE_TAG_VENDOR 0x0105 /* vendor specific */
screamer 0:7a64fbb4069d 127 #define PPPOE_TAG_RELAYSID 0x0110 /* relay session id */
screamer 0:7a64fbb4069d 128 #define PPPOE_TAG_SNAME_ERR 0x0201 /* service name error */
screamer 0:7a64fbb4069d 129 #define PPPOE_TAG_ACSYS_ERR 0x0202 /* AC system error */
screamer 0:7a64fbb4069d 130 #define PPPOE_TAG_GENERIC_ERR 0x0203 /* gerneric error */
screamer 0:7a64fbb4069d 131
screamer 0:7a64fbb4069d 132 #define PPPOE_CODE_PADI 0x09 /* Active Discovery Initiation */
screamer 0:7a64fbb4069d 133 #define PPPOE_CODE_PADO 0x07 /* Active Discovery Offer */
screamer 0:7a64fbb4069d 134 #define PPPOE_CODE_PADR 0x19 /* Active Discovery Request */
screamer 0:7a64fbb4069d 135 #define PPPOE_CODE_PADS 0x65 /* Active Discovery Session confirmation */
screamer 0:7a64fbb4069d 136 #define PPPOE_CODE_PADT 0xA7 /* Active Discovery Terminate */
screamer 0:7a64fbb4069d 137
screamer 0:7a64fbb4069d 138 #ifndef ETHERMTU
screamer 0:7a64fbb4069d 139 #define ETHERMTU 1500
screamer 0:7a64fbb4069d 140 #endif
screamer 0:7a64fbb4069d 141
screamer 0:7a64fbb4069d 142 /* two byte PPP protocol discriminator, then IP data */
screamer 0:7a64fbb4069d 143 #define PPPOE_MAXMTU (ETHERMTU-PPPOE_HEADERLEN-2)
screamer 0:7a64fbb4069d 144
screamer 0:7a64fbb4069d 145 struct pppoe_softc;
screamer 0:7a64fbb4069d 146
screamer 0:7a64fbb4069d 147
screamer 0:7a64fbb4069d 148 void pppoe_init(void);
screamer 0:7a64fbb4069d 149
screamer 0:7a64fbb4069d 150 err_t pppoe_create(struct netif *ethif, int pd, void (*linkStatusCB)(int pd, int up), struct pppoe_softc **scptr);
screamer 0:7a64fbb4069d 151 err_t pppoe_destroy(struct netif *ifp);
screamer 0:7a64fbb4069d 152
screamer 0:7a64fbb4069d 153 int pppoe_connect(struct pppoe_softc *sc);
screamer 0:7a64fbb4069d 154 void pppoe_disconnect(struct pppoe_softc *sc);
screamer 0:7a64fbb4069d 155
screamer 0:7a64fbb4069d 156 void pppoe_disc_input(struct netif *netif, struct pbuf *p);
screamer 0:7a64fbb4069d 157 void pppoe_data_input(struct netif *netif, struct pbuf *p);
screamer 0:7a64fbb4069d 158
screamer 0:7a64fbb4069d 159 err_t pppoe_xmit(struct pppoe_softc *sc, struct pbuf *pb);
screamer 0:7a64fbb4069d 160
screamer 0:7a64fbb4069d 161 extern int pppoe_hdrlen;
screamer 0:7a64fbb4069d 162
screamer 0:7a64fbb4069d 163 #ifdef __cplusplus
screamer 0:7a64fbb4069d 164 }
screamer 0:7a64fbb4069d 165 #endif
screamer 0:7a64fbb4069d 166
screamer 0:7a64fbb4069d 167 #endif /* PPPOE_SUPPORT */
screamer 0:7a64fbb4069d 168
screamer 0:7a64fbb4069d 169 #endif /* PPP_OE_H */