aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2019-07-06 15:27:20 +0200
committerMartin Kaiser <wireshark@kaiser.cx>2019-07-22 15:45:27 +0000
commit429082dd71a00e7eb67efb6c8c20d0b95c532da1 (patch)
treedc86115c9439cc6c17874ce1d66e40f19c3c41bf /epan/wslua
parentcc152014362fa584cfff97cc99afa5822b99af74 (diff)
wslua: pinfo: make p2p_dir accessible to lua dissectors
Some dissectors populate pinfo->p2p_dir with a packet's direction (incoming / outgoing). Make this info available to lua dissectors. Add a simple test for Pinfo's new p2p_dir attribute to the wslua test suite. It checks that p2p_dir is unknown for dhcp packets. (The dhcp dissector does not set p2p_dir). Change-Id: I8cc39a11cff840d10ef7fa94d30cbac8bf9b533f Reviewed-on: https://code.wireshark.org/review/33935 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/template-init.lua6
-rw-r--r--epan/wslua/wslua_pinfo.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/epan/wslua/template-init.lua b/epan/wslua/template-init.lua
index 197f1645d2..9293dcc0e1 100644
--- a/epan/wslua/template-init.lua
+++ b/epan/wslua/template-init.lua
@@ -106,6 +106,12 @@ end
%MENU_GROUPS%
+-- the possible values for Pinfo's p2p_dir attribute
+P2P_DIR_UNKNOWN = -1
+P2P_DIR_SENT = 0
+P2P_DIR_RECV = 1
+
+
-- other useful constants
-- DATA_DIR and USER_DIR have a trailing directory separator.
GUI_ENABLED = gui_enabled()
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c
index 71b895c309..9b6974eab8 100644
--- a/epan/wslua/wslua_pinfo.c
+++ b/epan/wslua/wslua_pinfo.c
@@ -292,6 +292,8 @@ PINFO_ADDRESS_SETTER(src);
PINFO_ADDRESS_GETTER(dst);
PINFO_ADDRESS_SETTER(dst);
+/* WSLUA_ATTRIBUTE Pinfo_p2p_dir RO direction of this Packet. (incoming / outgoing) */
+PINFO_NUMBER_GETTER(p2p_dir);
/* WSLUA_ATTRIBUTE Pinfo_match RO Port/Data we are matching. */
static int Pinfo_get_match(lua_State *L) {
@@ -457,6 +459,7 @@ WSLUA_ATTRIBUTES Pinfo_attributes[] = {
WSLUA_ATTRIBUTE_ROREG(Pinfo,match_uint),
WSLUA_ATTRIBUTE_ROREG(Pinfo,match_string),
WSLUA_ATTRIBUTE_WOREG(Pinfo,conversation),
+ WSLUA_ATTRIBUTE_ROREG(Pinfo,p2p_dir),
{ NULL, NULL, NULL }
};