Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/netif/ppp_oe.h need to be fixed.

0001 /*****************************************************************************
0002 * ppp_oe.h - PPP Over Ethernet implementation for lwIP.
0003 *
0004 * Copyright (c) 2006 by Marc Boucher, Services Informatiques (MBSI) inc.
0005 *
0006 * The authors hereby grant permission to use, copy, modify, distribute,
0007 * and license this software and its documentation for any purpose, provided
0008 * that existing copyright notices are retained in all copies and that this
0009 * notice and the following disclaimer are included verbatim in any 
0010 * distributions. No written agreement, license, or royalty fee is required
0011 * for any of the authorized uses.
0012 *
0013 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
0014 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0015 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
0016 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
0017 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0018 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0019 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0020 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0021 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0022 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0023 *
0024 ******************************************************************************
0025 * REVISION HISTORY
0026 *
0027 * 06-01-01 Marc Boucher <marc@mbsi.ca>
0028 *   Ported to lwIP.
0029 *****************************************************************************/
0030 
0031 
0032 
0033 /* based on NetBSD: if_pppoe.c,v 1.64 2006/01/31 23:50:15 martin Exp */
0034 
0035 /*-
0036  * Copyright (c) 2002 The NetBSD Foundation, Inc.
0037  * All rights reserved.
0038  *
0039  * This code is derived from software contributed to The NetBSD Foundation
0040  * by Martin Husemann <martin@NetBSD.org>.
0041  *
0042  * Redistribution and use in source and binary forms, with or without
0043  * modification, are permitted provided that the following conditions
0044  * are met:
0045  * 1. Redistributions of source code must retain the above copyright
0046  *    notice, this list of conditions and the following disclaimer.
0047  * 2. Redistributions in binary form must reproduce the above copyright
0048  *    notice, this list of conditions and the following disclaimer in the
0049  *    documentation and/or other materials provided with the distribution.
0050  * 3. All advertising materials mentioning features or use of this software
0051  *    must display the following acknowledgement:
0052  *        This product includes software developed by the NetBSD
0053  *        Foundation, Inc. and its contributors.
0054  * 4. Neither the name of The NetBSD Foundation nor the names of its
0055  *    contributors may be used to endorse or promote products derived
0056  *    from this software without specific prior written permission.
0057  *
0058  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
0059  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
0060  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
0061  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
0062  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0063  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0064  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0065  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0066  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0067  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0068  * POSSIBILITY OF SUCH DAMAGE.
0069  */
0070 #ifndef PPP_OE_H
0071 #define PPP_OE_H
0072 
0073 #include "lwip/opt.h"
0074 
0075 #if PPPOE_SUPPORT > 0
0076 
0077 #ifdef PACK_STRUCT_USE_INCLUDES
0078 #  include "arch/bpstruct.h"
0079 #endif
0080 PACK_STRUCT_BEGIN
0081 struct pppoehdr {
0082     PACK_STRUCT_FIELD(u8_t vertype);
0083     PACK_STRUCT_FIELD(u8_t code);
0084     PACK_STRUCT_FIELD(u16_t session);
0085     PACK_STRUCT_FIELD(u16_t plen);
0086 } PACK_STRUCT_STRUCT;
0087 PACK_STRUCT_END
0088 #ifdef PACK_STRUCT_USE_INCLUDES
0089 #  include "arch/epstruct.h"
0090 #endif
0091 
0092 #ifdef PACK_STRUCT_USE_INCLUDES
0093 #  include "arch/bpstruct.h"
0094 #endif
0095 PACK_STRUCT_BEGIN
0096 struct pppoetag {
0097     PACK_STRUCT_FIELD(u16_t tag);
0098     PACK_STRUCT_FIELD(u16_t len);
0099 } PACK_STRUCT_STRUCT;
0100 PACK_STRUCT_END
0101 #ifdef PACK_STRUCT_USE_INCLUDES
0102 #  include "arch/epstruct.h"
0103 #endif
0104 
0105 
0106 #define PPPOE_STATE_INITIAL 0
0107 #define PPPOE_STATE_PADI_SENT   1
0108 #define PPPOE_STATE_PADR_SENT   2
0109 #define PPPOE_STATE_SESSION 3
0110 #define PPPOE_STATE_CLOSING 4
0111 /* passive */
0112 #define PPPOE_STATE_PADO_SENT   1
0113 
0114 #define PPPOE_HEADERLEN sizeof(struct pppoehdr)
0115 #define PPPOE_VERTYPE   0x11    /* VER=1, TYPE = 1 */
0116 
0117 #define PPPOE_TAG_EOL       0x0000      /* end of list */
0118 #define PPPOE_TAG_SNAME     0x0101      /* service name */
0119 #define PPPOE_TAG_ACNAME    0x0102      /* access concentrator name */
0120 #define PPPOE_TAG_HUNIQUE   0x0103      /* host unique */
0121 #define PPPOE_TAG_ACCOOKIE  0x0104      /* AC cookie */
0122 #define PPPOE_TAG_VENDOR    0x0105      /* vendor specific */
0123 #define PPPOE_TAG_RELAYSID  0x0110      /* relay session id */
0124 #define PPPOE_TAG_SNAME_ERR 0x0201      /* service name error */
0125 #define PPPOE_TAG_ACSYS_ERR 0x0202      /* AC system error */
0126 #define PPPOE_TAG_GENERIC_ERR   0x0203      /* gerneric error */
0127 
0128 #define PPPOE_CODE_PADI     0x09        /* Active Discovery Initiation */
0129 #define PPPOE_CODE_PADO     0x07        /* Active Discovery Offer */
0130 #define PPPOE_CODE_PADR     0x19        /* Active Discovery Request */
0131 #define PPPOE_CODE_PADS     0x65        /* Active Discovery Session confirmation */
0132 #define PPPOE_CODE_PADT     0xA7        /* Active Discovery Terminate */
0133 
0134 #ifndef ETHERMTU
0135 #define ETHERMTU 1500
0136 #endif
0137 
0138 /* two byte PPP protocol discriminator, then IP data */
0139 #define PPPOE_MAXMTU    (ETHERMTU-PPPOE_HEADERLEN-2)
0140 
0141 struct pppoe_softc;
0142 
0143 
0144 void pppoe_init(void);
0145 
0146 err_t pppoe_create(struct netif *ethif, int pd, void (*linkStatusCB)(int pd, int up), struct pppoe_softc **scptr);
0147 err_t pppoe_destroy(struct netif *ifp);
0148 
0149 int pppoe_connect(struct pppoe_softc *sc);
0150 void pppoe_disconnect(struct pppoe_softc *sc);
0151 
0152 void pppoe_disc_input(struct netif *netif, struct pbuf *p);
0153 void pppoe_data_input(struct netif *netif, struct pbuf *p);
0154 
0155 err_t pppoe_xmit(struct pppoe_softc *sc, struct pbuf *pb);
0156 
0157 extern int pppoe_hdrlen;
0158 
0159 #endif /* PPPOE_SUPPORT */
0160 
0161 #endif /* PPP_OE_H */