dm: factor out max_io_len_target_boundary
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / l2tp.h
blob4bdb31df8e7284cb9cf8b49050e0a8af3f1df12f
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 #ifdef __KERNEL__
12 #include <linux/socket.h>
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 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) - sizeof(sa_family_t) -
37 sizeof(__be16) - sizeof(struct in_addr) -
38 sizeof(__u32)];
41 /*****************************************************************************
42 * NETLINK_GENERIC netlink family.
43 *****************************************************************************/
46 * Commands.
47 * Valid TLVs of each command are:-
48 * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
49 * TUNNEL_DELETE - CONN_ID
50 * TUNNEL_MODIFY - CONN_ID, udpcsum
51 * TUNNEL_GETSTATS - CONN_ID, (stats)
52 * TUNNEL_GET - CONN_ID, (...)
53 * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
54 * SESSION_DELETE - SESSION_ID
55 * SESSION_MODIFY - SESSION_ID, data_seq
56 * SESSION_GET - SESSION_ID, (...)
57 * SESSION_GETSTATS - SESSION_ID, (stats)
60 enum {
61 L2TP_CMD_NOOP,
62 L2TP_CMD_TUNNEL_CREATE,
63 L2TP_CMD_TUNNEL_DELETE,
64 L2TP_CMD_TUNNEL_MODIFY,
65 L2TP_CMD_TUNNEL_GET,
66 L2TP_CMD_SESSION_CREATE,
67 L2TP_CMD_SESSION_DELETE,
68 L2TP_CMD_SESSION_MODIFY,
69 L2TP_CMD_SESSION_GET,
70 __L2TP_CMD_MAX,
73 #define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
76 * ATTR types defined for L2TP
78 enum {
79 L2TP_ATTR_NONE, /* no data */
80 L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
81 L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
82 L2TP_ATTR_OFFSET, /* u16 */
83 L2TP_ATTR_DATA_SEQ, /* u16 */
84 L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
85 L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */
86 L2TP_ATTR_PROTO_VERSION, /* u8 */
87 L2TP_ATTR_IFNAME, /* string */
88 L2TP_ATTR_CONN_ID, /* u32 */
89 L2TP_ATTR_PEER_CONN_ID, /* u32 */
90 L2TP_ATTR_SESSION_ID, /* u32 */
91 L2TP_ATTR_PEER_SESSION_ID, /* u32 */
92 L2TP_ATTR_UDP_CSUM, /* u8 */
93 L2TP_ATTR_VLAN_ID, /* u16 */
94 L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
95 L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
96 L2TP_ATTR_DEBUG, /* u32 */
97 L2TP_ATTR_RECV_SEQ, /* u8 */
98 L2TP_ATTR_SEND_SEQ, /* u8 */
99 L2TP_ATTR_LNS_MODE, /* u8 */
100 L2TP_ATTR_USING_IPSEC, /* u8 */
101 L2TP_ATTR_RECV_TIMEOUT, /* msec */
102 L2TP_ATTR_FD, /* int */
103 L2TP_ATTR_IP_SADDR, /* u32 */
104 L2TP_ATTR_IP_DADDR, /* u32 */
105 L2TP_ATTR_UDP_SPORT, /* u16 */
106 L2TP_ATTR_UDP_DPORT, /* u16 */
107 L2TP_ATTR_MTU, /* u16 */
108 L2TP_ATTR_MRU, /* u16 */
109 L2TP_ATTR_STATS, /* nested */
110 __L2TP_ATTR_MAX,
113 #define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
115 /* Nested in L2TP_ATTR_STATS */
116 enum {
117 L2TP_ATTR_STATS_NONE, /* no data */
118 L2TP_ATTR_TX_PACKETS, /* u64 */
119 L2TP_ATTR_TX_BYTES, /* u64 */
120 L2TP_ATTR_TX_ERRORS, /* u64 */
121 L2TP_ATTR_RX_PACKETS, /* u64 */
122 L2TP_ATTR_RX_BYTES, /* u64 */
123 L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */
124 L2TP_ATTR_RX_OOS_PACKETS, /* u64 */
125 L2TP_ATTR_RX_ERRORS, /* u64 */
126 __L2TP_ATTR_STATS_MAX,
129 #define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
131 enum l2tp_pwtype {
132 L2TP_PWTYPE_NONE = 0x0000,
133 L2TP_PWTYPE_ETH_VLAN = 0x0004,
134 L2TP_PWTYPE_ETH = 0x0005,
135 L2TP_PWTYPE_PPP = 0x0007,
136 L2TP_PWTYPE_PPP_AC = 0x0008,
137 L2TP_PWTYPE_IP = 0x000b,
138 __L2TP_PWTYPE_MAX
141 enum l2tp_l2spec_type {
142 L2TP_L2SPECTYPE_NONE,
143 L2TP_L2SPECTYPE_DEFAULT,
146 enum l2tp_encap_type {
147 L2TP_ENCAPTYPE_UDP,
148 L2TP_ENCAPTYPE_IP,
151 enum l2tp_seqmode {
152 L2TP_SEQ_NONE = 0,
153 L2TP_SEQ_IP = 1,
154 L2TP_SEQ_ALL = 2,
158 * NETLINK_GENERIC related info
160 #define L2TP_GENL_NAME "l2tp"
161 #define L2TP_GENL_VERSION 0x1
163 #endif