]>
Commit | Line | Data |
---|---|---|
607ca46e DH |
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 _UAPI__LINUX_IF_PPPOX_H | |
17 | #define _UAPI__LINUX_IF_PPPOX_H | |
18 | ||
19 | ||
20 | #include <linux/types.h> | |
21 | #include <asm/byteorder.h> | |
22 | ||
23 | #include <linux/socket.h> | |
24 | #include <linux/if_ether.h> | |
25 | #include <linux/if_pppol2tp.h> | |
26 | ||
27 | /* For user-space programs to pick up these definitions | |
28 | * which they wouldn't get otherwise without defining __KERNEL__ | |
29 | */ | |
30 | #ifndef AF_PPPOX | |
31 | #define AF_PPPOX 24 | |
32 | #define PF_PPPOX AF_PPPOX | |
33 | #endif /* !(AF_PPPOX) */ | |
34 | ||
35 | /************************************************************************ | |
36 | * PPPoE addressing definition | |
37 | */ | |
38 | typedef __be16 sid_t; | |
39 | struct pppoe_addr { | |
40 | sid_t sid; /* Session identifier */ | |
41 | unsigned char remote[ETH_ALEN]; /* Remote address */ | |
42 | char dev[IFNAMSIZ]; /* Local device to use */ | |
43 | }; | |
44 | ||
45 | /************************************************************************ | |
46 | * PPTP addressing definition | |
47 | */ | |
48 | struct pptp_addr { | |
49 | __be16 call_id; | |
50 | struct in_addr sin_addr; | |
51 | }; | |
52 | ||
53 | /************************************************************************ | |
54 | * Protocols supported by AF_PPPOX | |
55 | */ | |
56 | #define PX_PROTO_OE 0 /* Currently just PPPoE */ | |
57 | #define PX_PROTO_OL2TP 1 /* Now L2TP also */ | |
58 | #define PX_PROTO_PPTP 2 | |
59 | #define PX_MAX_PROTO 3 | |
60 | ||
61 | struct sockaddr_pppox { | |
62 | __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ | |
63 | unsigned int sa_protocol; /* protocol identifier */ | |
64 | union { | |
65 | struct pppoe_addr pppoe; | |
66 | struct pptp_addr pptp; | |
67 | } sa_addr; | |
68 | } __packed; | |
69 | ||
70 | /* The use of the above union isn't viable because the size of this | |
71 | * struct must stay fixed over time -- applications use sizeof(struct | |
72 | * sockaddr_pppox) to fill it. We use a protocol specific sockaddr | |
73 | * type instead. | |
74 | */ | |
75 | struct sockaddr_pppol2tp { | |
76 | __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ | |
77 | unsigned int sa_protocol; /* protocol identifier */ | |
78 | struct pppol2tp_addr pppol2tp; | |
79 | } __packed; | |
80 | ||
81 | struct sockaddr_pppol2tpin6 { | |
82 | __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ | |
83 | unsigned int sa_protocol; /* protocol identifier */ | |
84 | struct pppol2tpin6_addr pppol2tp; | |
85 | } __packed; | |
86 | ||
87 | /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 | |
88 | * bits. So we need a different sockaddr structure. | |
89 | */ | |
90 | struct sockaddr_pppol2tpv3 { | |
91 | __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ | |
92 | unsigned int sa_protocol; /* protocol identifier */ | |
93 | struct pppol2tpv3_addr pppol2tp; | |
94 | } __packed; | |
95 | ||
96 | struct sockaddr_pppol2tpv3in6 { | |
97 | __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ | |
98 | unsigned int sa_protocol; /* protocol identifier */ | |
99 | struct pppol2tpv3in6_addr pppol2tp; | |
100 | } __packed; | |
101 | ||
102 | /********************************************************************* | |
103 | * | |
104 | * ioctl interface for defining forwarding of connections | |
105 | * | |
106 | ********************************************************************/ | |
107 | ||
108 | #define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) | |
109 | #define PPPOEIOCDFWD _IO(0xB1 ,1) | |
110 | /*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/ | |
111 | ||
112 | /* Codes to identify message types */ | |
113 | #define PADI_CODE 0x09 | |
114 | #define PADO_CODE 0x07 | |
115 | #define PADR_CODE 0x19 | |
116 | #define PADS_CODE 0x65 | |
117 | #define PADT_CODE 0xa7 | |
118 | struct pppoe_tag { | |
119 | __be16 tag_type; | |
120 | __be16 tag_len; | |
121 | char tag_data[0]; | |
122 | } __attribute__ ((packed)); | |
123 | ||
124 | /* Tag identifiers */ | |
125 | #define PTT_EOL __cpu_to_be16(0x0000) | |
126 | #define PTT_SRV_NAME __cpu_to_be16(0x0101) | |
127 | #define PTT_AC_NAME __cpu_to_be16(0x0102) | |
128 | #define PTT_HOST_UNIQ __cpu_to_be16(0x0103) | |
129 | #define PTT_AC_COOKIE __cpu_to_be16(0x0104) | |
130 | #define PTT_VENDOR __cpu_to_be16(0x0105) | |
131 | #define PTT_RELAY_SID __cpu_to_be16(0x0110) | |
132 | #define PTT_SRV_ERR __cpu_to_be16(0x0201) | |
133 | #define PTT_SYS_ERR __cpu_to_be16(0x0202) | |
134 | #define PTT_GEN_ERR __cpu_to_be16(0x0203) | |
135 | ||
136 | struct pppoe_hdr { | |
137 | #if defined(__LITTLE_ENDIAN_BITFIELD) | |
138 | __u8 ver : 4; | |
139 | __u8 type : 4; | |
140 | #elif defined(__BIG_ENDIAN_BITFIELD) | |
141 | __u8 type : 4; | |
142 | __u8 ver : 4; | |
143 | #else | |
144 | #error "Please fix <asm/byteorder.h>" | |
145 | #endif | |
146 | __u8 code; | |
147 | __be16 sid; | |
148 | __be16 length; | |
149 | struct pppoe_tag tag[0]; | |
150 | } __packed; | |
151 | ||
152 | /* Length of entire PPPoE + PPP header */ | |
153 | #define PPPOE_SES_HLEN 8 | |
154 | ||
155 | ||
156 | #endif /* _UAPI__LINUX_IF_PPPOX_H */ |