aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2013-12-08 12:42:10 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2013-12-08 12:42:10 +0000
commitfa01b39f338b16d809dc94a4161d59dee88346ab (patch)
tree6a12c879ecaa8198e8bcebe4aba422d92e11b820 /epan
parent4af107edfed1488c1fcc48e13bec6f8c15b4c3cc (diff)
Add more LINUX_AF_* values, create value_string_ext for them. Use it in netlink, nflog.
svn path=/trunk/; revision=53852
Diffstat (limited to 'epan')
-rw-r--r--epan/CMakeLists.txt1
-rw-r--r--epan/Makefile.common1
-rw-r--r--epan/aftypes.c75
-rw-r--r--epan/aftypes.h42
-rw-r--r--epan/dissectors/packet-netlink-route.c11
-rw-r--r--epan/dissectors/packet-nflog.c8
6 files changed, 124 insertions, 14 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt
index ad61b13b5d..bea6e26b89 100644
--- a/epan/CMakeLists.txt
+++ b/epan/CMakeLists.txt
@@ -1465,6 +1465,7 @@ set(LIBWIRESHARK_FILES
addr_resolv.c
address_to_str.c
afn.c
+ aftypes.c
app_mem_usage.c
asn1.c
atalk-utils.c
diff --git a/epan/Makefile.common b/epan/Makefile.common
index 2accf5deaa..202cac4978 100644
--- a/epan/Makefile.common
+++ b/epan/Makefile.common
@@ -28,6 +28,7 @@ LIBWIRESHARK_SRC = \
addr_resolv.c \
address_to_str.c \
afn.c \
+ aftypes.c \
app_mem_usage.c \
asn1.c \
atalk-utils.c \
diff --git a/epan/aftypes.c b/epan/aftypes.c
new file mode 100644
index 0000000000..d73095550b
--- /dev/null
+++ b/epan/aftypes.c
@@ -0,0 +1,75 @@
+/* aftypes.c
+ * AF_ values on various OSes; they're used in some network protocols, as
+ * well as in BSD DLT_NULL and DLT_LOOP headers.
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ *
+ * This file created and by Mike Hall <mlh@io.com>
+ * Copyright 1998
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <epan/value_string.h>
+#include <epan/aftypes.h>
+
+static const value_string linux_af_vals[] = {
+ { LINUX_AF_UNSPEC, "AF_UNSPEC" },
+ { LINUX_AF_LOCAL, "AF_LOCAL" }, /* AF_UNIX? */
+ { LINUX_AF_INET, "AF_INET" },
+ { LINUX_AF_AX25, "AF_AX25" },
+ { LINUX_AF_IPX, "AF_IPX" },
+ { LINUX_AF_APPLETALK, "AF_APPLETALK" },
+ { LINUX_AF_NETROM, "AF_NETROM" },
+ { LINUX_AF_BRIDGE, "AF_BRIDGE" },
+ { LINUX_AF_ATMPVC, "AF_ATMPVC" },
+ { LINUX_AF_X25, "AF_X25" },
+ { LINUX_AF_INET6, "AF_INET6" },
+ { LINUX_AF_ROSE, "AF_ROSE" },
+ { LINUX_AF_DECnet, "AF_DECnet" },
+ { LINUX_AF_NETBEUI, "AF_NETBEUI" },
+ { LINUX_AF_SECURITY, "AF_SECURITY" },
+ { LINUX_AF_KEY, "AF_KEY" },
+ { LINUX_AF_NETLINK, "AF_NETLINK" },
+ { LINUX_AF_PACKET, "AF_PACKET" },
+ { LINUX_AF_ASH, "AF_ASH" },
+ { LINUX_AF_ECONET, "AF_ECONET" },
+ { LINUX_AF_ATMSVC, "AF_ATMSVC" },
+ { LINUX_AF_RDS, "AF_RDS" },
+ { LINUX_AF_SNA, "AF_SNA" },
+ { LINUX_AF_IRDA, "AF_IRDA" },
+ { LINUX_AF_PPPOX, "AF_PPPOX" },
+ { LINUX_AF_WANPIPE, "AF_WANPIPE" },
+ { LINUX_AF_LLC, "AF_LLC" },
+ { LINUX_AF_CAN, "AF_CAN" },
+ { LINUX_AF_TIPC, "AF_TIPC" },
+ { LINUX_AF_BLUETOOTH, "AF_BLUETOOTH" },
+ { LINUX_AF_IUCV, "AF_IUCV" },
+ { LINUX_AF_RXRPC, "AF_RXRPC" },
+ { LINUX_AF_ISDN, "AF_ISDN" },
+ { LINUX_AF_PHONET, "AF_PHONET" },
+ { LINUX_AF_IEEE802154, "AF_IEEE802154" },
+ { LINUX_AF_CAIF, "AF_CAIF" },
+ { LINUX_AF_ALG, "AF_ALG" },
+ { LINUX_AF_NFC, "AF_NFC" },
+ { 0, NULL }
+};
+
+value_string_ext linux_af_vals_ext = VALUE_STRING_EXT_INIT(linux_af_vals);
diff --git a/epan/aftypes.h b/epan/aftypes.h
index 94e897fc8b..69077c7654 100644
--- a/epan/aftypes.h
+++ b/epan/aftypes.h
@@ -28,6 +28,8 @@
#ifndef __AFTYPES_H__
#define __AFTYPES_H__
+#include <epan/value_string.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -42,8 +44,46 @@ extern "C" {
#define BSD_AF_INET6_DARWIN 30
/* Linux AF_ values. */
-#define LINUX_AF_INET 2
+#define LINUX_AF_UNSPEC 0
+#define LINUX_AF_LOCAL 1
+#define LINUX_AF_INET 2
+#define LINUX_AF_AX25 3
+#define LINUX_AF_IPX 4
+#define LINUX_AF_APPLETALK 5
+#define LINUX_AF_NETROM 6
+#define LINUX_AF_BRIDGE 7
+#define LINUX_AF_ATMPVC 8
+#define LINUX_AF_X25 9
#define LINUX_AF_INET6 10
+#define LINUX_AF_ROSE 11
+#define LINUX_AF_DECnet 12
+#define LINUX_AF_NETBEUI 13
+#define LINUX_AF_SECURITY 14
+#define LINUX_AF_KEY 15
+#define LINUX_AF_NETLINK 16
+#define LINUX_AF_PACKET 17
+#define LINUX_AF_ASH 18
+#define LINUX_AF_ECONET 19
+#define LINUX_AF_ATMSVC 20
+#define LINUX_AF_RDS 21
+#define LINUX_AF_SNA 22
+#define LINUX_AF_IRDA 23
+#define LINUX_AF_PPPOX 24
+#define LINUX_AF_WANPIPE 25
+#define LINUX_AF_LLC 26
+#define LINUX_AF_CAN 29
+#define LINUX_AF_TIPC 30
+#define LINUX_AF_BLUETOOTH 31
+#define LINUX_AF_IUCV 32
+#define LINUX_AF_RXRPC 33
+#define LINUX_AF_ISDN 34
+#define LINUX_AF_PHONET 35
+#define LINUX_AF_IEEE802154 36
+#define LINUX_AF_CAIF 37
+#define LINUX_AF_ALG 38
+#define LINUX_AF_NFC 39
+
+extern value_string_ext linux_af_vals_ext;
/* Solaris AF_ values. */
#define SOLARIS_AF_INET 2
diff --git a/epan/dissectors/packet-netlink-route.c b/epan/dissectors/packet-netlink-route.c
index 4a91a35644..5f5853cc9e 100644
--- a/epan/dissectors/packet-netlink-route.c
+++ b/epan/dissectors/packet-netlink-route.c
@@ -30,6 +30,7 @@
#include <glib.h>
#include <epan/packet.h>
+#include <epan/aftypes.h>
#include "packet-arp.h"
#include "packet-netlink.h"
@@ -481,9 +482,8 @@ dissect_netlink_route_if_attrs(tvbuff_t *tvb, struct netlink_route_info *info, p
/* IP address */
static header_field_info hfi_netlink_route_ifa_family NETLINK_ROUTE_HFI_INIT =
- { "Address type", "netlink-route.ifa_family", FT_UINT8, BASE_DEC,
- /* XXX .strings = _linux_family_vals (nflog) */
- NULL, 0x00, NULL, HFILL };
+ { "Address type", "netlink-route.ifa_family", FT_UINT8, BASE_DEC | BASE_EXT_STRING,
+ &linux_af_vals_ext, 0x00, NULL, HFILL };
static int
dissect_netlink_route_ifaddrmsg(tvbuff_t *tvb, struct netlink_route_info *info _U_, proto_tree *tree, int offset)
@@ -496,9 +496,8 @@ dissect_netlink_route_ifaddrmsg(tvbuff_t *tvb, struct netlink_route_info *info _
/* Route */
static header_field_info hfi_netlink_route_rt_family NETLINK_ROUTE_HFI_INIT =
- { "Address family", "netlink-route.rt_family", FT_UINT8, BASE_DEC,
- /* XXX .strings = _linux_family_vals (nflog) */
- NULL, 0x00, NULL, HFILL };
+ { "Address family", "netlink-route.rt_family", FT_UINT8, BASE_DEC | BASE_EXT_STRING,
+ &linux_af_vals_ext, 0x00, NULL, HFILL };
static header_field_info hfi_netlink_route_rt_dst_len NETLINK_ROUTE_HFI_INIT =
{ "Length of destination", "netlink-route.rt_dst_len", FT_UINT8, BASE_DEC,
diff --git a/epan/dissectors/packet-nflog.c b/epan/dissectors/packet-nflog.c
index a0beebc393..1e028ce97a 100644
--- a/epan/dissectors/packet-nflog.c
+++ b/epan/dissectors/packet-nflog.c
@@ -67,12 +67,6 @@ static const enum_val_t byte_order_types[] = {
{ NULL, NULL, 0 }
};
-static const value_string _linux_family_vals[] = {
- { LINUX_AF_INET, "IP" },
- { LINUX_AF_INET6, "IPv6" },
- { 0, NULL }
-};
-
static const value_string _encoding_vals[] = {
{ ENC_BIG_ENDIAN, "Big Endian" },
{ ENC_LITTLE_ENDIAN, "Little Endian" },
@@ -113,7 +107,7 @@ static header_field_info *hfi_nflog = NULL;
/* Header */
static header_field_info hfi_nflog_family NFLOG_HFI_INIT =
- { "Family", "nflog.family", FT_UINT8, BASE_DEC, VALS(_linux_family_vals), 0x00, NULL, HFILL };
+ { "Family", "nflog.family", FT_UINT8, BASE_DEC | BASE_EXT_STRING, &linux_af_vals_ext, 0x00, NULL, HFILL };
static header_field_info hfi_nflog_version NFLOG_HFI_INIT =
{ "Version", "nflog.version", FT_UINT8, BASE_DEC, NULL, 0x00, NULL, HFILL };