| 1 | /*************************************************************************** |
|---|
| 2 | * Linux PPP over X - Generic PPP transport layer sockets |
|---|
| 3 | * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516) |
|---|
| 4 | * |
|---|
| 5 | * This file supplies definitions required by the PPP over Ethernet driver |
|---|
| 6 | * (pppox.c). All version information wrt this file is located in pppox.c |
|---|
| 7 | * |
|---|
| 8 | * License: |
|---|
| 9 | * This program is free software; you can redistribute it and/or |
|---|
| 10 | * modify it under the terms of the GNU General Public License |
|---|
| 11 | * as published by the Free Software Foundation; either version |
|---|
| 12 | * 2 of the License, or (at your option) any later version. |
|---|
| 13 | * |
|---|
| 14 | */ |
|---|
| 15 | |
|---|
| 16 | #ifndef __LINUX_IF_PPPOX_H |
|---|
| 17 | #define __LINUX_IF_PPPOX_H |
|---|
| 18 | |
|---|
| 19 | #include <linux/if.h> |
|---|
| 20 | #include <linux/if_ether.h> |
|---|
| 21 | #include <asm/types.h> |
|---|
| 22 | #include <endian.h> |
|---|
| 23 | #include <byteswap.h> |
|---|
| 24 | #include <asm/byteorder.h> |
|---|
| 25 | |
|---|
| 26 | /* For user-space programs to pick up these definitions |
|---|
| 27 | * which they wouldn't get otherwise without defining __KERNEL__ |
|---|
| 28 | */ |
|---|
| 29 | #ifndef AF_PPPOX |
|---|
| 30 | #define AF_PPPOX 24 |
|---|
| 31 | #define PF_PPPOX AF_PPPOX |
|---|
| 32 | #endif /* !(AF_PPPOX) */ |
|---|
| 33 | |
|---|
| 34 | /************************************************************************ |
|---|
| 35 | * PPPoE addressing definition |
|---|
| 36 | */ |
|---|
| 37 | typedef __u16 sid_t; |
|---|
| 38 | struct pppoe_addr{ |
|---|
| 39 | sid_t sid; /* Session identifier */ |
|---|
| 40 | unsigned char remote[ETH_ALEN]; /* Remote address */ |
|---|
| 41 | char dev[IFNAMSIZ]; /* Local device to use */ |
|---|
| 42 | }; |
|---|
| 43 | |
|---|
| 44 | /************************************************************************ |
|---|
| 45 | * Protocols supported by AF_PPPOX |
|---|
| 46 | */ |
|---|
| 47 | #define PX_PROTO_OE 0 /* Currently just PPPoE */ |
|---|
| 48 | #define PX_MAX_PROTO 1 |
|---|
| 49 | |
|---|
| 50 | struct sockaddr_pppox { |
|---|
| 51 | sa_family_t sa_family; /* address family, AF_PPPOX */ |
|---|
| 52 | unsigned int sa_protocol; /* protocol identifier */ |
|---|
| 53 | union{ |
|---|
| 54 | struct pppoe_addr pppoe; |
|---|
| 55 | }sa_addr; |
|---|
| 56 | }__attribute__ ((packed)); |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | /********************************************************************* |
|---|
| 60 | * |
|---|
| 61 | * ioctl interface for defining forwarding of connections |
|---|
| 62 | * |
|---|
| 63 | ********************************************************************/ |
|---|
| 64 | |
|---|
| 65 | #define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) |
|---|
| 66 | #define PPPOEIOCDFWD _IO(0xB1 ,1) |
|---|
| 67 | /*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/ |
|---|
| 68 | |
|---|
| 69 | /* Codes to identify message types */ |
|---|
| 70 | #define PADI_CODE 0x09 |
|---|
| 71 | #define PADO_CODE 0x07 |
|---|
| 72 | #define PADR_CODE 0x19 |
|---|
| 73 | #define PADS_CODE 0x65 |
|---|
| 74 | #define PADT_CODE 0xa7 |
|---|
| 75 | struct pppoe_tag { |
|---|
| 76 | __u16 tag_type; |
|---|
| 77 | __u16 tag_len; |
|---|
| 78 | char tag_data[0]; |
|---|
| 79 | } __attribute ((packed)); |
|---|
| 80 | |
|---|
| 81 | /* Tag identifiers */ |
|---|
| 82 | #define PTT_EOL __constant_htons(0x0000) |
|---|
| 83 | #define PTT_SRV_NAME __constant_htons(0x0101) |
|---|
| 84 | #define PTT_AC_NAME __constant_htons(0x0102) |
|---|
| 85 | #define PTT_HOST_UNIQ __constant_htons(0x0103) |
|---|
| 86 | #define PTT_AC_COOKIE __constant_htons(0x0104) |
|---|
| 87 | #define PTT_VENDOR __constant_htons(0x0105) |
|---|
| 88 | #define PTT_RELAY_SID __constant_htons(0x0110) |
|---|
| 89 | #define PTT_SRV_ERR __constant_htons(0x0201) |
|---|
| 90 | #define PTT_SYS_ERR __constant_htons(0x0202) |
|---|
| 91 | #define PTT_GEN_ERR __constant_htons(0x0203) |
|---|
| 92 | |
|---|
| 93 | struct pppoe_hdr { |
|---|
| 94 | #if defined(__LITTLE_ENDIAN) |
|---|
| 95 | __u8 ver : 4; |
|---|
| 96 | __u8 type : 4; |
|---|
| 97 | #elif defined(__BIG_ENDIAN) |
|---|
| 98 | __u8 type : 4; |
|---|
| 99 | __u8 ver : 4; |
|---|
| 100 | #else |
|---|
| 101 | #error "Endian problem - this didn't happen" |
|---|
| 102 | #endif |
|---|
| 103 | __u8 code; |
|---|
| 104 | __u16 sid; |
|---|
| 105 | __u16 length; |
|---|
| 106 | struct pppoe_tag tag[0]; |
|---|
| 107 | } __attribute__ ((packed)); |
|---|
| 108 | |
|---|
| 109 | #endif /* !(__LINUX_IF_PPPOX_H) */ |
|---|