A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Committer:
root@mbed.org
Date:
Tue May 08 15:32:10 2012 +0100
Revision:
0:5e1631496985
initial commit

Who changed what in which revision?

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