The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netgraph/ng_pppoe.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * ng_pppoe.h
    3  */
    4 
    5 /*-
    6  * Copyright (c) 1996-1999 Whistle Communications, Inc.
    7  * All rights reserved.
    8  * 
    9  * Subject to the following obligations and disclaimer of warranty, use and
   10  * redistribution of this software, in source or object code forms, with or
   11  * without modifications are expressly permitted by Whistle Communications;
   12  * provided, however, that:
   13  * 1. Any and all reproductions of the source or object code must include the
   14  *    copyright notice above and the following disclaimer of warranties; and
   15  * 2. No rights are granted, in any manner or form, to use Whistle
   16  *    Communications, Inc. trademarks, including the mark "WHISTLE
   17  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
   18  *    such appears in the above copyright notice or in the software.
   19  * 
   20  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
   21  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
   22  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
   23  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
   24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
   25  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
   26  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
   27  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
   28  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
   29  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
   30  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
   31  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
   32  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
   33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   35  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
   36  * OF SUCH DAMAGE.
   37  *
   38  * Author: Julian Elischer <julian@freebsd.org>
   39  *
   40  * $FreeBSD$
   41  * $Whistle: ng_pppoe.h,v 1.7 1999/10/16 10:16:43 julian Exp $
   42  */
   43 
   44 #ifndef _NETGRAPH_NG_PPPOE_H_
   45 #define _NETGRAPH_NG_PPPOE_H_
   46 
   47 /********************************************************************
   48  * Netgraph hook constants etc.
   49  ********************************************************************/
   50 /* Node type name. This should be unique among all netgraph node types */
   51 #define NG_PPPOE_NODE_TYPE      "pppoe"
   52 
   53 #define NGM_PPPOE_COOKIE                1089893072
   54 
   55 /* Number of active sessions we can handle */
   56 #define PPPOE_NUM_SESSIONS              16 /* for now */
   57 #define PPPOE_SERVICE_NAME_SIZE         64 /* for now */
   58 
   59 /* Hook names */
   60 #define NG_PPPOE_HOOK_ETHERNET  "ethernet"
   61 #define NG_PPPOE_HOOK_PADI      "PADI"    /* default PADI requests come here */
   62 #define NG_PPPOE_HOOK_S_LEADIN  "service" /* PADO responses from PADI */
   63 #define NG_PPPOE_HOOK_C_LEADIN  "client"  /* Connect message starts this */
   64 #define NG_PPPOE_HOOK_DEBUG     "debug"
   65 
   66 /* Mode names */
   67 #define NG_PPPOE_STANDARD       "standard"
   68 #define NG_PPPOE_3COM           "3Com"
   69 #define NG_PPPOE_NONSTANDARD    NG_PPPOE_3COM
   70 #define NG_PPPOE_DLINK          "D-Link"
   71 
   72 /**********************************************************************
   73  * Netgraph commands understood by this node type.
   74  * FAIL, SUCCESS, CLOSE and ACNAME are sent by the node rather than received.
   75  ********************************************************************/
   76 enum cmd {
   77         NGM_PPPOE_SET_FLAG = 1,
   78         NGM_PPPOE_CONNECT  = 2, /* Client, Try find this service */
   79         NGM_PPPOE_LISTEN   = 3, /* Server, Await a request for this service */
   80         NGM_PPPOE_OFFER    = 4, /* Server, hook X should respond (*) */
   81         NGM_PPPOE_SUCCESS  = 5, /* State machine connected */
   82         NGM_PPPOE_FAIL     = 6, /* State machine could not connect */
   83         NGM_PPPOE_CLOSE    = 7, /* Session closed down */
   84         NGM_PPPOE_SERVICE  = 8, /* additional Service to advertise (in PADO) */
   85         NGM_PPPOE_ACNAME   = 9, /* AC_NAME for informational purposes */
   86         NGM_PPPOE_GET_STATUS = 10, /* data in/out */
   87         NGM_PPPOE_SESSIONID  = 11,  /* Session_ID for informational purposes */
   88         NGM_PPPOE_SETMODE  = 12, /* set to standard or compat modes */
   89         NGM_PPPOE_GETMODE  = 13, /* see current mode */
   90         NGM_PPPOE_SETENADDR = 14, /* set Ethernet address */
   91 };
   92 
   93 /***********************
   94  * Structures passed in the various netgraph command messages.
   95  ***********************/
   96 /* This structure is returned by the NGM_PPPOE_GET_STATUS command */
   97 struct ngpppoestat {
   98         u_int   packets_in;     /* packets in from ethernet */
   99         u_int   packets_out;    /* packets out towards ethernet */
  100 };
  101 
  102 /* Keep this in sync with the above structure definition */
  103 #define NG_PPPOESTAT_TYPE_INFO  {                               \
  104           { "packets_in",       &ng_parse_uint_type     },      \
  105           { "packets_out",      &ng_parse_uint_type     },      \
  106           { NULL }                                              \
  107 }
  108 
  109 /*
  110  * When this structure is accepted by the NGM_PPPOE_CONNECT command :
  111  * The data field is MANDATORY.
  112  * The session sends out a PADI request for the named service.
  113  *
  114  *
  115  * When this structure is accepted by the NGM_PPPOE_LISTEN command.
  116  * If no service is given this is assumed to accept ALL PADI requests.
  117  * This may at some time take a regexp expression, but not yet.
  118  * Matching PADI requests will be passed up the named hook.
  119  *
  120  *
  121  * When this structure is accepted by the NGM_PPPOE_OFFER command:
  122  * The AC-NAme field is set from that given and a PADI
  123  * packet is expected to arrive from the session control daemon, on the
  124  * named hook. The session will then issue the appropriate PADO
  125  * and begin negotiation.
  126  */
  127 struct ngpppoe_init_data {
  128         char            hook[NG_HOOKSIZ];       /* hook to monitor on */
  129         u_int16_t       data_len;               /* Length of the service name */
  130         char            data[];                 /* init data goes here */
  131 };
  132 
  133 /* Keep this in sync with the above structure definition */
  134 #define NG_PPPOE_INIT_DATA_TYPE_INFO    {               \
  135           { "hook",     &ng_parse_hookbuf_type  },      \
  136           { "data",     &ng_parse_sizedstring_type },   \
  137           { NULL }                                      \
  138 }
  139 
  140 /*
  141  * This structure is used by the asychronous success and failure messages.
  142  * (to report which hook has failed or connected). The message is sent
  143  * to whoever requested the connection. (close may use this too).
  144  */
  145 struct ngpppoe_sts {
  146         char    hook[NG_HOOKSIZ];       /* hook associated with event session */
  147 };
  148 
  149 /* Keep this in sync with the above structure definition */
  150 #define NG_PPPOE_STS_TYPE_INFO          {               \
  151           { "hook",     &ng_parse_hookbuf_type  },      \
  152           { NULL }                                      \
  153 }
  154 
  155 
  156 /********************************************************************
  157  * Constants and definitions specific to pppoe
  158  ********************************************************************/
  159 
  160 #define PPPOE_TIMEOUT_LIMIT 64
  161 #define PPPOE_OFFER_TIMEOUT 16
  162 #define PPPOE_INITIAL_TIMEOUT 2
  163 
  164 /* Codes to identify message types */
  165 #define PADI_CODE       0x09
  166 #define PADO_CODE       0x07
  167 #define PADR_CODE       0x19
  168 #define PADS_CODE       0x65
  169 #define PADT_CODE       0xa7
  170 
  171 /* Tag identifiers */
  172 #if BYTE_ORDER == BIG_ENDIAN
  173 #define PTT_EOL         (0x0000)
  174 #define PTT_SRV_NAME    (0x0101)
  175 #define PTT_AC_NAME     (0x0102)
  176 #define PTT_HOST_UNIQ   (0x0103)
  177 #define PTT_AC_COOKIE   (0x0104)
  178 #define PTT_VENDOR      (0x0105)
  179 #define PTT_RELAY_SID   (0x0110)
  180 #define PTT_SRV_ERR     (0x0201)
  181 #define PTT_SYS_ERR     (0x0202)
  182 #define PTT_GEN_ERR     (0x0203)
  183 
  184 #define ETHERTYPE_PPPOE_DISC    0x8863  /* pppoe discovery packets     */
  185 #define ETHERTYPE_PPPOE_SESS    0x8864  /* pppoe session packets       */
  186 #define ETHERTYPE_PPPOE_3COM_DISC 0x3c12 /* pppoe discovery packets 3com? */
  187 #define ETHERTYPE_PPPOE_3COM_SESS 0x3c13 /* pppoe session packets   3com? */
  188 #else
  189 #define PTT_EOL         (0x0000)
  190 #define PTT_SRV_NAME    (0x0101)
  191 #define PTT_AC_NAME     (0x0201)
  192 #define PTT_HOST_UNIQ   (0x0301)
  193 #define PTT_AC_COOKIE   (0x0401)
  194 #define PTT_VENDOR      (0x0501)
  195 #define PTT_RELAY_SID   (0x1001)
  196 #define PTT_SRV_ERR     (0x0102)
  197 #define PTT_SYS_ERR     (0x0202)
  198 #define PTT_GEN_ERR     (0x0302)
  199 
  200 #define ETHERTYPE_PPPOE_DISC    0x6388  /* pppoe discovery packets     */
  201 #define ETHERTYPE_PPPOE_SESS    0x6488  /* pppoe session packets       */
  202 #define ETHERTYPE_PPPOE_3COM_DISC 0x123c /* pppoe discovery packets 3com? */
  203 #define ETHERTYPE_PPPOE_3COM_SESS 0x133c /* pppoe session packets   3com? */
  204 #endif
  205 
  206 struct pppoe_tag {
  207         u_int16_t tag_type;
  208         u_int16_t tag_len;
  209         char tag_data[];
  210 }__packed;
  211 
  212 struct pppoe_hdr{
  213         u_int8_t ver:4;
  214         u_int8_t type:4;
  215         u_int8_t code;
  216         u_int16_t sid;
  217         u_int16_t length;
  218         struct pppoe_tag tag[];
  219 }__packed;
  220 
  221 
  222 struct pppoe_full_hdr {
  223         struct  ether_header eh;
  224         struct pppoe_hdr ph;
  225 }__packed;
  226 
  227 union   packet {
  228         struct pppoe_full_hdr   pkt_header;
  229         u_int8_t        bytes[2048];
  230 };
  231 
  232 struct datatag {
  233         struct pppoe_tag hdr;
  234         u_int8_t        data[PPPOE_SERVICE_NAME_SIZE];
  235 };     
  236 
  237 
  238 /*
  239  * Define the order in which we will place tags in packets
  240  * this may be ignored
  241  */
  242 /* for PADI */
  243 #define TAGI_SVC 0
  244 #define TAGI_HUNIQ 1
  245 /* for PADO */
  246 #define TAGO_ACNAME 0
  247 #define TAGO_SVC 1
  248 #define TAGO_COOKIE 2
  249 #define TAGO_HUNIQ 3
  250 /* for PADR */
  251 #define TAGR_SVC 0
  252 #define TAGR_HUNIQ 1
  253 #define TAGR_COOKIE 2
  254 /* for PADS */
  255 #define TAGS_ACNAME 0
  256 #define TAGS_SVC 1
  257 #define TAGS_COOKIE 2
  258 #define TAGS_HUNIQ 3
  259 /* for PADT */
  260 
  261 #endif /* _NETGRAPH_NG_PPPOE_H_ */
  262 

Cache object: 65ae1a259af1e3c02ebcb5582a235175


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.