summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-r09.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:33 +0000
commit9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9 (patch)
tree2784370cda9bbf2da9114d70f05399c0b229d28c /epan/dissectors/packet-r09.c
parentAdding debian version 4.2.6-1. (diff)
downloadwireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.tar.xz
wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-r09.c')
-rw-r--r--epan/dissectors/packet-r09.c87
1 files changed, 39 insertions, 48 deletions
diff --git a/epan/dissectors/packet-r09.c b/epan/dissectors/packet-r09.c
index fe77bee8..6936d0dd 100644
--- a/epan/dissectors/packet-r09.c
+++ b/epan/dissectors/packet-r09.c
@@ -24,24 +24,24 @@ void proto_reg_handoff_r09(void);
#define PSNAME "R09"
#define PFNAME "r09"
-static int proto_r09 = -1;
-static int hf_r09_modus = -1;
-static int hf_r09_ty = -1;
-static int hf_r09_tl = -1;
-static int hf_r09_zv = -1;
-static int hf_r09_zw = -1;
-static int hf_r09_mp8 = -1;
-static int hf_r09_mp16 = -1;
-static int hf_r09_pr = -1;
-static int hf_r09_ha = -1;
-static int hf_r09_ln = -1;
-static int hf_r09_kn = -1;
-static int hf_r09_zn = -1;
-static int hf_r09_zl = -1;
-static int hf_r09_fn = -1;
-static int hf_r09_un = -1;
-
-static gint ett_r09 = -1;
+static int proto_r09;
+static int hf_r09_modus;
+static int hf_r09_ty;
+static int hf_r09_tl;
+static int hf_r09_zv;
+static int hf_r09_zw;
+static int hf_r09_mp8;
+static int hf_r09_mp16;
+static int hf_r09_pr;
+static int hf_r09_ha;
+static int hf_r09_ln;
+static int hf_r09_kn;
+static int hf_r09_zn;
+static int hf_r09_zl;
+static int hf_r09_fn;
+static int hf_r09_un;
+
+static int ett_r09;
static dissector_handle_t r09_handle;
@@ -53,36 +53,29 @@ static const value_string r09_zv_vals[] = {
static const value_string r09_ha_vals[] = {
{ 0x00, "Ohne Bedeutung" },
- { 0x01, "Taste 'gerade' betätig" },
- { 0x02, "Taste 'links' betätig" },
- { 0x03, "Taste 'rechts' betätig" },
+ { 0x01, "Taste 'gerade' betätigt" },
+ { 0x02, "Taste 'links' betätigt" },
+ { 0x03, "Taste 'rechts' betätigt" },
{0, NULL}
};
-static dgt_set_t Dgt0_9_bcd = {
- {
- /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
- '0','1','2','3','4','5','6','7','8','9','?','?','?','?','?','?'
- }
-};
-
static int
dissect_r09(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
proto_item *ti= NULL;
proto_tree *r09_tree = NULL;
- guint8 ib1, ib2;
- guint8 ty, tl;
- guint16 mp;
- const gchar *r09x_str, *ln_str, *kn_str, *zn_str, *fn_str, *un_str;
+ uint8_t ib1, ib2;
+ uint8_t ty, tl;
+ uint16_t mp;
+ const char *r09x_str;
- ib1 = tvb_get_guint8(tvb, 0);
+ ib1 = tvb_get_uint8(tvb, 0);
ty = ib1 & 0x0F;
if (ib1 != 0x91) {
return 0;
}
- ib2 = tvb_get_guint8(tvb, 1);
+ ib2 = tvb_get_uint8(tvb, 1);
tl = ib2 & 0x0F;
r09x_str = wmem_strdup_printf(pinfo->pool, "R09.%u%u", ty, tl);
@@ -103,11 +96,11 @@ dissect_r09(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
if (tl == 0) {
/* Infobyte 3 */
proto_tree_add_item(r09_tree, hf_r09_mp8, tvb, 2, 1, ENC_BIG_ENDIAN);
- mp = tvb_get_guint8(tvb, 2);
+ mp = tvb_get_uint8(tvb, 2);
} else {
/* Infobyte 3, Zusatzbyte 1 */
proto_tree_add_item(r09_tree, hf_r09_mp16, tvb, 2, 2, ENC_BIG_ENDIAN);
- mp = tvb_get_guint16(tvb, 2, ENC_BIG_ENDIAN);
+ mp = tvb_get_uint16(tvb, 2, ENC_BIG_ENDIAN);
}
col_append_fstr(pinfo->cinfo, COL_INFO, " MP=%u", mp);
@@ -119,20 +112,19 @@ dissect_r09(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
if (tl >= 3) {
/* Zusatzbyte 2, 3 */
- ln_str = tvb_get_bcd_string(pinfo->pool, tvb, 4, 2, &Dgt0_9_bcd, TRUE, FALSE, TRUE);
- proto_tree_add_string(r09_tree, hf_r09_ln, tvb, 4, 2, ln_str);
+ proto_tree_add_item(r09_tree, hf_r09_ln, tvb, 4, 2,
+ ENC_BCD_DIGITS_0_9 | ENC_BIG_ENDIAN | ENC_BCD_SKIP_FIRST);
}
if (tl >= 4) {
/* Zusatzbyte 4 */
- kn_str = tvb_get_bcd_string(pinfo->pool, tvb, 6, 1, &Dgt0_9_bcd, FALSE, FALSE, TRUE);
- proto_tree_add_string(r09_tree, hf_r09_kn, tvb, 6, 1, kn_str);
+ proto_tree_add_item(r09_tree, hf_r09_kn, tvb, 6, 1, ENC_BCD_DIGITS_0_9 | ENC_BIG_ENDIAN);
}
if (tl >= 6) {
/* Zusatzbyte 5, 6 */
- zn_str = tvb_get_bcd_string(pinfo->pool, tvb, 7, 2, &Dgt0_9_bcd, FALSE, TRUE, TRUE);
- proto_tree_add_string(r09_tree, hf_r09_zn, tvb, 7, 2, zn_str);
+ proto_tree_add_item(r09_tree, hf_r09_zn, tvb, 7, 2,
+ ENC_BCD_DIGITS_0_9 | ENC_BIG_ENDIAN | ENC_BCD_ODD_NUM_DIG);
}
if (tl == 6) {
@@ -142,10 +134,9 @@ dissect_r09(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
if (tl == 8) {
/* Zusatzbyte 6, 7, 8 */
- fn_str = tvb_get_bcd_string(pinfo->pool, tvb, 8, 2, &Dgt0_9_bcd, TRUE, FALSE, TRUE);
- proto_tree_add_string(r09_tree, hf_r09_fn, tvb, 8, 2, fn_str);
- un_str = tvb_get_bcd_string(pinfo->pool, tvb, 10, 1, &Dgt0_9_bcd, FALSE, FALSE, TRUE);
- proto_tree_add_string(r09_tree, hf_r09_un, tvb, 10, 1, un_str);
+ proto_tree_add_item(r09_tree, hf_r09_fn, tvb, 8, 2,
+ ENC_BCD_DIGITS_0_9 | ENC_BIG_ENDIAN | ENC_BCD_SKIP_FIRST);
+ proto_tree_add_item(r09_tree, hf_r09_un, tvb, 10, 1, ENC_BCD_DIGITS_0_9 | ENC_BIG_ENDIAN);
}
return tvb_captured_length(tvb);
@@ -187,7 +178,7 @@ proto_register_r09(void)
FT_STRING, BASE_NONE, NULL, 0x00, "Liniennummer", HFILL}
},
{ &hf_r09_kn, { "KN", "r09.kn",
- FT_STRING, BASE_NONE, NULL, 0x00, "Kuzrsnummer", HFILL}
+ FT_STRING, BASE_NONE, NULL, 0x00, "Kursnummer", HFILL}
},
{ &hf_r09_zn, { "ZN", "r09.zn",
FT_STRING, BASE_NONE, NULL, 0x00, "Zielnummer", HFILL}
@@ -203,7 +194,7 @@ proto_register_r09(void)
},
};
- static gint* ett[] = {
+ static int* ett[] = {
&ett_r09,
};