summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-x75.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
commita86c5f7cae7ec9a3398300555a0b644689d946a1 (patch)
tree39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/packet-x75.c
parentReleasing progress-linux version 4.2.6-1~progress7.99u1. (diff)
downloadwireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz
wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--epan/dissectors/packet-x75.c67
1 files changed, 36 insertions, 31 deletions
diff --git a/epan/dissectors/packet-x75.c b/epan/dissectors/packet-x75.c
index df491b5c..c97446d9 100644
--- a/epan/dissectors/packet-x75.c
+++ b/epan/dissectors/packet-x75.c
@@ -14,10 +14,13 @@
#include "config.h"
+#include <epan/decode_as.h>
#include <epan/packet.h>
#include <wiretap/wtap.h>
#include <epan/xdlc.h>
+static dissector_table_t x75_subdissector_table;
+
void proto_register_x75(void);
void proto_reg_handoff_x75(void);
@@ -26,21 +29,21 @@ void proto_reg_handoff_x75(void);
#define X75_ADDRESS_MLP_STE_C 0x0F
#define X75_ADDRESS_MLP_STE_D 0x07
-static int proto_x75 = -1;
-static int hf_x75_address = -1;
-static int hf_x75_control = -1;
-static int hf_x75_n_r = -1;
-static int hf_x75_n_s = -1;
-static int hf_x75_p = -1;
-static int hf_x75_f = -1;
-static int hf_x75_s_ftype = -1;
-static int hf_x75_u_modifier_cmd = -1;
-static int hf_x75_u_modifier_resp = -1;
-static int hf_x75_ftype_i = -1;
-static int hf_x75_ftype_s_u = -1;
-
-static gint ett_x75 = -1;
-static gint ett_x75_control = -1;
+static int proto_x75;
+static int hf_x75_address;
+static int hf_x75_control;
+static int hf_x75_n_r;
+static int hf_x75_n_s;
+static int hf_x75_p;
+static int hf_x75_f;
+static int hf_x75_s_ftype;
+static int hf_x75_u_modifier_cmd;
+static int hf_x75_u_modifier_resp;
+static int hf_x75_ftype_i;
+static int hf_x75_ftype_s_u;
+
+static int ett_x75;
+static int ett_x75_control;
static dissector_handle_t data_handle;
static dissector_handle_t x75_handle;
@@ -61,15 +64,15 @@ static int
dissect_x75(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *x75_tree, *ti;
- guint16 control;
+ uint16_t control;
int is_response;
- guint8 byte0;
+ uint8_t byte0;
tvbuff_t *next_tvb;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "X.75");
col_set_str(pinfo->cinfo, COL_RES_NET_DST, "Broadcast");
- byte0 = tvb_get_guint8(tvb, 0);
+ byte0 = tvb_get_uint8(tvb, 0);
if (byte0 != X75_ADDRESS_SLP_STE_A && byte0 != X75_ADDRESS_SLP_STE_B &&
byte0 != X75_ADDRESS_MLP_STE_C && byte0 != X75_ADDRESS_MLP_STE_D) /* invalid X.75 frame */
@@ -100,9 +103,9 @@ dissect_x75(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
}
if (byte0 == X75_ADDRESS_SLP_STE_A || byte0 == X75_ADDRESS_MLP_STE_C)
- is_response = TRUE;
+ is_response = true;
else
- is_response = FALSE;
+ is_response = false;
break;
case P2P_DIR_RECV:
@@ -118,13 +121,13 @@ dissect_x75(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
}
if (byte0 == X75_ADDRESS_SLP_STE_B || byte0 == X75_ADDRESS_MLP_STE_D)
- is_response = TRUE;
+ is_response = true;
else
- is_response = FALSE;
+ is_response = false;
break;
default:
- is_response = FALSE;
+ is_response = false;
break;
}
@@ -144,7 +147,7 @@ dissect_x75(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
control = dissect_xdlc_control(tvb, 1, pinfo, x75_tree, hf_x75_control,
ett_x75_control, &x75_cf_items, NULL, NULL, NULL,
- is_response, FALSE, FALSE);
+ is_response, false, false);
/* information frame ==> data */
if (XDLC_IS_INFORMATION(control)) {
@@ -156,13 +159,11 @@ dissect_x75(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
if (len > 128)
len = 128;
- char *tmp = (char*)wmem_alloc(pinfo->pool, len + 1);
- tmp[len] = 0x00;
- tvb_memcpy(next_tvb, tmp, 0, len);
- col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", tmp);
- wmem_free(pinfo->pool, tmp);
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", tvb_format_text(pinfo->pool, next_tvb, 0, len));
- call_dissector(data_handle, next_tvb, pinfo, tree);
+ if (!dissector_try_payload_new(x75_subdissector_table, next_tvb, pinfo, tree, true, NULL)) {
+ call_dissector(data_handle, next_tvb, pinfo, tree);
+ }
}
return tvb_captured_length(tvb);
}
@@ -215,7 +216,7 @@ proto_register_x75(void)
{ "Frame type", "x75.control.ftype", FT_UINT8, BASE_HEX,
VALS(ftype_vals), XDLC_S_U_MASK, NULL, HFILL }},
};
- static gint *ett[] = {
+ static int *ett[] = {
&ett_x75,
&ett_x75_control,
};
@@ -226,6 +227,10 @@ proto_register_x75(void)
proto_register_subtree_array(ett, array_length(ett));
x75_handle = register_dissector("x75", dissect_x75, proto_x75);
+
+ x75_subdissector_table =
+ register_decode_as_next_proto(proto_x75,
+ "x75.subdissector", "X.75 payload subdissector", NULL);
}
void