source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/netif/ppp_oe.h @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

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