4
/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
5
* Patrick Schaaf <bof@bof.de>
6
* Martin Josefsson <gandalf@wlug.westbo.se>
7
* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License version 2 as
11
* published by the Free Software Foundation.
14
/* The protocol version */
15
#define IPSET_PROTOCOL 6
17
/* The max length of strings including NUL: set and type identifiers */
18
#define IPSET_MAXNAMELEN 32
20
/* Message types and commands */
23
IPSET_CMD_PROTOCOL, /* 1: Return protocol version */
24
IPSET_CMD_CREATE, /* 2: Create a new (empty) set */
25
IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */
26
IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */
27
IPSET_CMD_RENAME, /* 5: Rename a set */
28
IPSET_CMD_SWAP, /* 6: Swap two sets */
29
IPSET_CMD_LIST, /* 7: List sets */
30
IPSET_CMD_SAVE, /* 8: Save sets */
31
IPSET_CMD_ADD, /* 9: Add an element to a set */
32
IPSET_CMD_DEL, /* 10: Delete an element from a set */
33
IPSET_CMD_TEST, /* 11: Test an element in a set */
34
IPSET_CMD_HEADER, /* 12: Get set header data only */
35
IPSET_CMD_TYPE, /* 13: Get set type */
36
IPSET_MSG_MAX, /* Netlink message commands */
38
/* Commands in userspace: */
39
IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */
40
IPSET_CMD_HELP, /* 15: Get help */
41
IPSET_CMD_VERSION, /* 16: Get program version */
42
IPSET_CMD_QUIT, /* 17: Quit from interactive mode */
46
IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */
49
/* Attributes at command level */
52
IPSET_ATTR_PROTOCOL, /* 1: Protocol version */
53
IPSET_ATTR_SETNAME, /* 2: Name of the set */
54
IPSET_ATTR_TYPENAME, /* 3: Typename */
55
IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */
56
IPSET_ATTR_REVISION, /* 4: Settype revision */
57
IPSET_ATTR_FAMILY, /* 5: Settype family */
58
IPSET_ATTR_FLAGS, /* 6: Flags at command level */
59
IPSET_ATTR_DATA, /* 7: Nested attributes */
60
IPSET_ATTR_ADT, /* 8: Multiple data containers */
61
IPSET_ATTR_LINENO, /* 9: Restore lineno */
62
IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */
63
IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */
66
#define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1)
68
/* CADT specific attributes */
70
IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1,
71
IPSET_ATTR_IP_FROM = IPSET_ATTR_IP,
72
IPSET_ATTR_IP_TO, /* 2 */
73
IPSET_ATTR_CIDR, /* 3 */
74
IPSET_ATTR_PORT, /* 4 */
75
IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT,
76
IPSET_ATTR_PORT_TO, /* 5 */
77
IPSET_ATTR_TIMEOUT, /* 6 */
78
IPSET_ATTR_PROTO, /* 7 */
79
IPSET_ATTR_CADT_FLAGS, /* 8 */
80
IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */
81
/* Reserve empty slots */
82
IPSET_ATTR_CADT_MAX = 16,
83
/* Create-only specific attributes */
93
IPSET_ATTR_REFERENCES,
96
__IPSET_ATTR_CREATE_MAX,
98
#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1)
100
/* ADT specific attributes */
102
IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1,
107
__IPSET_ATTR_ADT_MAX,
109
#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
111
/* IP specific attributes */
113
IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1,
114
IPSET_ATTR_IPADDR_IPV6,
115
__IPSET_ATTR_IPADDR_MAX,
117
#define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1)
121
IPSET_ERR_PRIVATE = 4096,
126
IPSET_ERR_EXIST_SETNAME2,
127
IPSET_ERR_TYPE_MISMATCH,
129
IPSET_ERR_INVALID_CIDR,
130
IPSET_ERR_INVALID_NETMASK,
131
IPSET_ERR_INVALID_FAMILY,
133
IPSET_ERR_REFERENCED,
134
IPSET_ERR_IPADDR_IPV4,
135
IPSET_ERR_IPADDR_IPV6,
137
/* Type specific error codes */
138
IPSET_ERR_TYPE_SPECIFIC = 4352,
141
/* Flags at command level */
142
enum ipset_cmd_flags {
143
IPSET_FLAG_BIT_EXIST = 0,
144
IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST),
147
/* Flags at CADT attribute level */
148
enum ipset_cadt_flags {
149
IPSET_FLAG_BIT_BEFORE = 0,
150
IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
153
/* Commands with settype-specific attributes */
159
IPSET_CREATE = IPSET_ADT_MAX,
163
#endif /* __IP_SET_H */