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