aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2013-07-22 19:38:38 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2013-07-22 19:38:38 +0000
commit7ec1a78fe8a7e7f61f241a89ade467c476e01656 (patch)
treea76017762631b8178af36a9981afb422227a0e7a /epan
parentb0a94d2b988d20aee2631ff152bb4e5ce1183049 (diff)
Abuse epan_t more: add callback to get interface name.
svn path=/trunk/; revision=50794
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-frame.c10
-rw-r--r--epan/epan-int.h1
-rw-r--r--epan/epan.c9
-rw-r--r--epan/epan.h2
4 files changed, 20 insertions, 2 deletions
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c
index c3e40f116d..1abdbe8d88 100644
--- a/epan/dissectors/packet-frame.c
+++ b/epan/dissectors/packet-frame.c
@@ -288,8 +288,14 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
fh_tree = proto_item_add_subtree(ti, ett_frame);
- if (pinfo->fd->flags.has_if_id)
- proto_tree_add_uint(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->fd->interface_id);
+ if (pinfo->fd->flags.has_if_id && proto_field_is_referenced(tree, hf_frame_interface_id)) {
+ const char *interface_name = epan_get_interface_name(pinfo->epan, pinfo->fd->interface_id);
+
+ if (interface_name)
+ proto_tree_add_uint_format_value(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->fd->interface_id, "%u (%s)", pinfo->fd->interface_id, interface_name);
+ else
+ proto_tree_add_uint(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->fd->interface_id);
+ }
if (pinfo->fd->flags.has_pack_flags) {
proto_tree *flags_tree;
diff --git a/epan/epan-int.h b/epan/epan-int.h
index 6580c55c26..0fa38d0427 100644
--- a/epan/epan-int.h
+++ b/epan/epan-int.h
@@ -30,6 +30,7 @@ struct epan_session {
void *data;
const nstime_t *(*get_frame_ts)(void *data, guint32 frame_num);
+ const char *(*get_interface_name)(void *data, guint32 interface_id);
};
#endif
diff --git a/epan/epan.c b/epan/epan.c
index e4a7c2dd48..70db022c53 100644
--- a/epan/epan.c
+++ b/epan/epan.c
@@ -146,6 +146,15 @@ epan_new(void)
return session;
}
+const char *
+epan_get_interface_name(const epan_t *session, guint32 interface_id)
+{
+ if (session->get_interface_name)
+ return session->get_interface_name(session->data, interface_id);
+
+ return NULL;
+}
+
const nstime_t *
epan_get_frame_ts(const epan_t *session, guint32 frame_num)
{
diff --git a/epan/epan.h b/epan/epan.h
index 252d748ee8..63d1e41828 100644
--- a/epan/epan.h
+++ b/epan/epan.h
@@ -129,6 +129,8 @@ typedef struct epan_session epan_t;
WS_DLL_PUBLIC epan_t *epan_new(void);
+const char *epan_get_interface_name(const epan_t *session, guint32 interface_id);
+
const nstime_t *epan_get_frame_ts(const epan_t *session, guint32 frame_num);
WS_DLL_PUBLIC void epan_free(epan_t *session);