The discovered bit in PGCCSR register indicates if the device has been
[linux-2.6/next.git] / include / linux / l2tp.h
blobe77d7f9bb2464d45bb6fa02e409852bc950fea58
1 /*
2 * L2TP-over-IP socket for L2TPv3.
4 * Author: James Chapman <jchapman@katalix.com>
5 */
7 #ifndef _LINUX_L2TP_H_
8 #define _LINUX_L2TP_H_
10 #include <linux/types.h>
11 #include <linux/socket.h>
12 #ifdef __KERNEL__
13 #include <linux/in.h>
14 #else
15 #include <netinet/in.h>
16 #endif
18 #define IPPROTO_L2TP 115
20 /**
21 * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
22 * @l2tp_family: address family number AF_L2TPIP.
23 * @l2tp_addr: protocol specific address information
24 * @l2tp_conn_id: connection id of tunnel
26 #define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
27 struct sockaddr_l2tpip {
28 /* The first fields must match struct sockaddr_in */
29 __kernel_sa_family_t l2tp_family; /* AF_INET */
30 __be16 l2tp_unused; /* INET port number (unused) */
31 struct in_addr l2tp_addr; /* Internet address */
33 __u32 l2tp_conn_id; /* Connection ID of tunnel */
35 /* Pad to size of `struct sockaddr'. */
36 unsigned char __pad[sizeof(struct sockaddr) -
37 sizeof(__kernel_sa_family_t) -
38 sizeof(__be16) - sizeof(struct in_addr) -
39 sizeof(__u32)];
42 /*****************************************************************************
43 * NETLINK_GENERIC netlink family.
44 *****************************************************************************/
47 * Commands.
48 * Valid TLVs of each command are:-
49 * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
50 * TUNNEL_DELETE - CONN_ID
51 * TUNNEL_MODIFY - CONN_ID, udpcsum
52 * TUNNEL_GETSTATS - CONN_ID, (stats)
53 * TUNNEL_GET - CONN_ID, (...)
54 * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
55 * SESSION_DELETE - SESSION_ID
56 * SESSION_MODIFY - SESSION_ID, data_seq
57 * SESSION_GET - SESSION_ID, (...)
58 * SESSION_GETSTATS - SESSION_ID, (stats)
61 enum {
62 L2TP_CMD_NOOP,
63 L2TP_CMD_TUNNEL_CREATE,
64 L2TP_CMD_TUNNEL_DELETE,
65 L2TP_CMD_TUNNEL_MODIFY,
66 L2TP_CMD_TUNNEL_GET,
67 L2TP_CMD_SESSION_CREATE,
68 L2TP_CMD_SESSION_DELETE,
69 L2TP_CMD_SESSION_MODIFY,
70 L2TP_CMD_SESSION_GET,
71 __L2TP_CMD_MAX,
74 #define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
77 * ATTR types defined for L2TP
79 enum {
80 L2TP_ATTR_NONE, /* no data */
81 L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
82 L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
83 L2TP_ATTR_OFFSET, /* u16 */
84 L2TP_ATTR_DATA_SEQ, /* u16 */
85 L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
86 L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */
87 L2TP_ATTR_PROTO_VERSION, /* u8 */
88 L2TP_ATTR_IFNAME, /* string */
89 L2TP_ATTR_CONN_ID, /* u32 */
90 L2TP_ATTR_PEER_CONN_ID, /* u32 */
91 L2TP_ATTR_SESSION_ID, /* u32 */
92 L2TP_ATTR_PEER_SESSION_ID, /* u32 */
93 L2TP_ATTR_UDP_CSUM, /* u8 */
94 L2TP_ATTR_VLAN_ID, /* u16 */
95 L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
96 L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
97 L2TP_ATTR_DEBUG, /* u32 */
98 L2TP_ATTR_RECV_SEQ, /* u8 */
99 L2TP_ATTR_SEND_SEQ, /* u8 */
100 L2TP_ATTR_LNS_MODE, /* u8 */
101 L2TP_ATTR_USING_IPSEC, /* u8 */
102 L2TP_ATTR_RECV_TIMEOUT, /* msec */
103 L2TP_ATTR_FD, /* int */
104 L2TP_ATTR_IP_SADDR, /* u32 */
105 L2TP_ATTR_IP_DADDR, /* u32 */
106 L2TP_ATTR_UDP_SPORT, /* u16 */
107 L2TP_ATTR_UDP_DPORT, /* u16 */
108 L2TP_ATTR_MTU, /* u16 */
109 L2TP_ATTR_MRU, /* u16 */
110 L2TP_ATTR_STATS, /* nested */
111 __L2TP_ATTR_MAX,
114 #define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
116 /* Nested in L2TP_ATTR_STATS */
117 enum {
118 L2TP_ATTR_STATS_NONE, /* no data */
119 L2TP_ATTR_TX_PACKETS, /* u64 */
120 L2TP_ATTR_TX_BYTES, /* u64 */
121 L2TP_ATTR_TX_ERRORS, /* u64 */
122 L2TP_ATTR_RX_PACKETS, /* u64 */
123 L2TP_ATTR_RX_BYTES, /* u64 */
124 L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */
125 L2TP_ATTR_RX_OOS_PACKETS, /* u64 */
126 L2TP_ATTR_RX_ERRORS, /* u64 */
127 __L2TP_ATTR_STATS_MAX,
130 #define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
132 enum l2tp_pwtype {
133 L2TP_PWTYPE_NONE = 0x0000,
134 L2TP_PWTYPE_ETH_VLAN = 0x0004,
135 L2TP_PWTYPE_ETH = 0x0005,
136 L2TP_PWTYPE_PPP = 0x0007,
137 L2TP_PWTYPE_PPP_AC = 0x0008,
138 L2TP_PWTYPE_IP = 0x000b,
139 __L2TP_PWTYPE_MAX
142 enum l2tp_l2spec_type {
143 L2TP_L2SPECTYPE_NONE,
144 L2TP_L2SPECTYPE_DEFAULT,
147 enum l2tp_encap_type {
148 L2TP_ENCAPTYPE_UDP,
149 L2TP_ENCAPTYPE_IP,
152 enum l2tp_seqmode {
153 L2TP_SEQ_NONE = 0,
154 L2TP_SEQ_IP = 1,
155 L2TP_SEQ_ALL = 2,
159 * NETLINK_GENERIC related info
161 #define L2TP_GENL_NAME "l2tp"
162 #define L2TP_GENL_VERSION 0x1
164 #endif