Use MAC address documentation range in filter examples
[metze/wireshark/wip.git] / epan / dissectors / packet-netlink.h
1 /* packet-netlink.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 2001 Gerald Combs
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef __PACKET_NETLINK_H__
23 #define __PACKET_NETLINK_H__
24
25 #include <epan/value_string.h>
26
27 /* from <linux/netlink.h> prefixed with WS_ */
28 enum {
29         WS_NETLINK_ROUTE = 0,
30         WS_NETLINK_UNUSED = 1,
31         WS_NETLINK_USERSOCK = 2,
32         WS_NETLINK_FIREWALL = 3,
33         WS_NETLINK_SOCK_DIAG = 4,
34         WS_NETLINK_NFLOG = 5,
35         WS_NETLINK_XFRM = 6,
36         WS_NETLINK_SELINUX = 7,
37         WS_NETLINK_ISCSI = 8,
38         WS_NETLINK_AUDIT = 9,
39         WS_NETLINK_FIB_LOOKUP = 10,
40         WS_NETLINK_CONNECTOR = 11,
41         WS_NETLINK_NETFILTER = 12,
42         WS_NETLINK_IP6_FW = 13,
43         WS_NETLINK_DNRTMSG = 14,
44         WS_NETLINK_KOBJECT_UEVENT = 15,
45         WS_NETLINK_GENERIC = 16,
46         /* leave room for NETLINK_DM (DM Events) */
47         WS_NETLINK_SCSITRANSPORT = 18,
48         WS_NETLINK_ECRYPTFS = 19,
49         WS_NETLINK_RDMA = 20,
50         WS_NETLINK_CRYPTO = 21
51 };
52
53 /* from <linux/netlink.h> prefixed with WS_ */
54 enum {
55         WS_NLM_F_REQUEST = 1,    /* It is request message.*/
56         WS_NLM_F_MULTI = 2,      /* Multipart message, terminated by NETLINK_MSG_DONE */
57         WS_NLM_F_ACK = 4,        /* Reply with ack, with zero or error code */
58         WS_NLM_F_ECHO = 8,       /* Echo this request */
59
60         /* Modifiers to Get request */
61         WS_NLM_F_ROOT = 0x100,   /* specify tree root */
62         WS_NLM_F_MATCH = 0x200,  /* return all matching */
63         WS_NLM_F_ATOMIC = 0x400, /* = (NETLINK_MSG_F_ROOT | NETLINK_MSG_F_MATCH) */
64
65         /* Modifiers to NEW request */
66         WS_NLM_F_REPLACE = 0x100,  /* Override existing */
67         WS_NLM_F_EXCL = 0x200,     /* Do not touch, if it exists */
68         WS_NLM_F_CREATE = 0x400,   /* Create, if it does */
69         WS_NLM_F_APPEND = 0x800    /* Add to end of list */
70 };
71
72
73 extern value_string_ext netlink_family_vals_ext;
74
75 enum {
76         WS_NLMSG_NOOP     = 0x01,
77         WS_NLMSG_ERROR    = 0x02,
78         WS_NLMSG_DONE     = 0x03,
79         WS_NLMSG_OVERRUN  = 0x04,
80         WS_NLMSG_MIN_TYPE     = 0x10    /** type < WS_NLMSG_MIN_TYPE are reserved */
81 };
82
83 enum {
84         NETLINK_RTM_BASE = 16,
85
86         NETLINK_RTM_NEWLINK = 16,
87         NETLINK_RTM_DELLINK,
88         NETLINK_RTM_GETLINK,
89         NETLINK_RTM_SETLINK,
90
91         NETLINK_RTM_NEWADDR = 20,
92         NETLINK_RTM_DELADDR,
93         NETLINK_RTM_GETADDR,
94
95         NETLINK_RTM_NEWROUTE = 24,
96         NETLINK_RTM_DELROUTE,
97         NETLINK_RTM_GETROUTE
98 };
99
100 #define PACKET_NETLINK_MAGIC 0x4A5ACCCE
101
102 struct packet_netlink_data {
103         guint32 magic; /* PACKET_NETLINK_MAGIC */
104
105         int encoding;
106         guint16 type;
107 };
108
109 typedef int netlink_attributes_cb_t(tvbuff_t *, void *data, proto_tree *, int nla_type, int offset, int len);
110
111 int dissect_netlink_attributes(tvbuff_t *tvb, header_field_info *hfi_type, int ett, void *data, proto_tree *tree, int offset, netlink_attributes_cb_t cb);
112
113 #endif /* __PACKET_NETLINK_H__ */