diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
commit | a86c5f7cae7ec9a3398300555a0b644689d946a1 (patch) | |
tree | 39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/packet-geonw.c | |
parent | Releasing progress-linux version 4.2.6-1~progress7.99u1. (diff) | |
download | wireshark-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 'epan/dissectors/packet-geonw.c')
-rw-r--r-- | epan/dissectors/packet-geonw.c | 854 |
1 files changed, 427 insertions, 427 deletions
diff --git a/epan/dissectors/packet-geonw.c b/epan/dissectors/packet-geonw.c index 77d7e282..fc2ecb54 100644 --- a/epan/dissectors/packet-geonw.c +++ b/epan/dissectors/packet-geonw.c @@ -62,10 +62,10 @@ #include <epan/address_types.h> #include <epan/addr_resolv.h> #include <epan/to_str.h> -#include <epan/to_str.h> #include <epan/conversation.h> #include <epan/tap.h> #include <epan/etypes.h> +#include <epan/unit_strings.h> #include <wsutil/utf8_entities.h> @@ -152,137 +152,137 @@ void proto_register_geonw(void); /* * Variables */ -static wmem_map_t *geonw_hashtable = NULL; - -static int proto_geonw = -1; -static int proto_btpa = -1; -static int proto_btpb = -1; - -static int geonw_tap = -1; -static int btpa_tap = -1; -static int btpa_follow_tap = -1; -static int btpb_tap = -1; -static int btpb_follow_tap = -1; - -static int hf_geonw_bh = -1; -static int hf_geonw_bh_version = -1; -static int hf_geonw_bh_next_header = -1; -static int hf_geonw_bh_reserved = -1; -static int hf_geonw_bh_life_time = -1; -static int hf_geonw_bh_lt_mult = -1; -static int hf_geonw_bh_lt_base = -1; -static int hf_geonw_bh_remain_hop_limit = -1; - -static int hf_geonw_ch = -1; -static int hf_geonw_ch_next_header = -1; -static int hf_geonw_ch_reserved1 = -1; -static int hf_geonw_ch_header_type = -1; -//static int hf_geonw_ch_header_subtype = -1; -static int hf_geonw_ch_traffic_class = -1; -static int hf_geonw_ch_tc_scf = -1; -static int hf_geonw_ch_tc_offload = -1; -static int hf_geonw_ch_tc_id = -1; -static int hf_geonw_ch_flags = -1; -static int hf_geonw_ch_flags_mob = -1; -static int hf_geonw_ch_flags_reserved = -1; -static int hf_geonw_ch_payload_length = -1; -static int hf_geonw_ch_max_hop_limit = -1; -static int hf_geonw_ch_reserved2 = -1; - -static int hf_geonw_seq_num = -1; -static int hf_geonw_reserved = -1; -static int hf_geonw_so_pv = -1; -static int hf_geonw_so_pv_addr = -1; -static int hf_geonw_so_pv_addr_manual = -1; -static int hf_geonw_so_pv_addr_type = -1; -static int hf_geonw_so_pv_addr_country = -1; -static int hf_geonw_so_pv_addr_mid = -1; -static int hf_geonw_so_pv_time = -1; -static int hf_geonw_so_pv_lat = -1; -static int hf_geonw_so_pv_lon = -1; -static int hf_geonw_so_pv_pai = -1; -static int hf_geonw_so_pv_speed = -1; -static int hf_geonw_so_pv_heading = -1; -static int hf_geonw_de_pv = -1; -static int hf_geonw_de_pv_addr = -1; -static int hf_geonw_de_pv_addr_manual = -1; -static int hf_geonw_de_pv_addr_type = -1; -static int hf_geonw_de_pv_addr_country = -1; -static int hf_geonw_de_pv_addr_mid = -1; -static int hf_geonw_de_pv_time = -1; -static int hf_geonw_de_pv_lat = -1; -static int hf_geonw_de_pv_lon = -1; - -static int hf_geonw_gxc_latitude = -1; -static int hf_geonw_gxc_longitude = -1; -static int hf_geonw_gxc_radius = -1; -static int hf_geonw_gxc_distancea = -1; -static int hf_geonw_gxc_distanceb = -1; -static int hf_geonw_gxc_angle = -1; -static int hf_geonw_gxc_reserved = -1; - -static int hf_geonw_shb_reserved = -1; - -static int hf_geonw_lsrq_addr = -1; -static int hf_geonw_lsrq_addr_manual = -1; -static int hf_geonw_lsrq_addr_type = -1; -static int hf_geonw_lsrq_addr_country = -1; -static int hf_geonw_lsrq_addr_mid = -1; - -static int hf_geonw_beacon = -1; -static int hf_geonw_guc = -1; -static int hf_geonw_gac = -1; -static int hf_geonw_gbc = -1; -static int hf_geonw_tsb = -1; -static int hf_geonw_ls = -1; -static int hf_geonw_analysis_flags = -1; - -static int hf_btpa_dstport = -1; -static int hf_btpa_srcport = -1; -static int hf_btpa_port = -1; -static int hf_btpb_dstport = -1; -static int hf_btpb_dstport_info = -1; - -static int hf_geonw_resp_in = -1; -static int hf_geonw_resp_to = -1; -static int hf_geonw_no_resp = -1; -static int hf_geonw_resptime = -1; - -static int hf_geonw_dccmco = -1; -static int hf_geonw_dccmco_cbr_l_0_hop = -1; -static int hf_geonw_dccmco_cbr_l_1_hop = -1; -static int hf_geonw_dccmco_output_power = -1; -static int hf_geonw_dccmco_reserved = -1; - -static gint ett_geonw = -1; -static gint ett_geonw_bh = -1; -static gint ett_geonw_bh_lt = -1; -static gint ett_geonw_ch = -1; -static gint ett_geonw_ch_tc = -1; -static gint ett_geonw_sh = -1; -static gint ett_geonw_so = -1; -static gint ett_geonw_so_add = -1; -static gint ett_geonw_de = -1; -static gint ett_geonw_de_add = -1; -static gint ett_geonw_lsrq_add = -1; -static gint ett_geonw_analysis = -1; -static gint ett_geonw_dccmco = -1; -static gint ett_btpa = -1; -static gint ett_btpb = -1; +static wmem_map_t *geonw_hashtable; + +static int proto_geonw; +static int proto_btpa; +static int proto_btpb; + +static int geonw_tap; +static int btpa_tap; +static int btpa_follow_tap; +static int btpb_tap; +static int btpb_follow_tap; + +static int hf_geonw_bh; +static int hf_geonw_bh_version; +static int hf_geonw_bh_next_header; +static int hf_geonw_bh_reserved; +static int hf_geonw_bh_life_time; +static int hf_geonw_bh_lt_mult; +static int hf_geonw_bh_lt_base; +static int hf_geonw_bh_remain_hop_limit; + +static int hf_geonw_ch; +static int hf_geonw_ch_next_header; +static int hf_geonw_ch_reserved1; +static int hf_geonw_ch_header_type; +//static int hf_geonw_ch_header_subtype; +static int hf_geonw_ch_traffic_class; +static int hf_geonw_ch_tc_scf; +static int hf_geonw_ch_tc_offload; +static int hf_geonw_ch_tc_id; +static int hf_geonw_ch_flags; +static int hf_geonw_ch_flags_mob; +static int hf_geonw_ch_flags_reserved; +static int hf_geonw_ch_payload_length; +static int hf_geonw_ch_max_hop_limit; +static int hf_geonw_ch_reserved2; + +static int hf_geonw_seq_num; +static int hf_geonw_reserved; +static int hf_geonw_so_pv; +static int hf_geonw_so_pv_addr; +static int hf_geonw_so_pv_addr_manual; +static int hf_geonw_so_pv_addr_type; +static int hf_geonw_so_pv_addr_country; +static int hf_geonw_so_pv_addr_mid; +static int hf_geonw_so_pv_time; +static int hf_geonw_so_pv_lat; +static int hf_geonw_so_pv_lon; +static int hf_geonw_so_pv_pai; +static int hf_geonw_so_pv_speed; +static int hf_geonw_so_pv_heading; +static int hf_geonw_de_pv; +static int hf_geonw_de_pv_addr; +static int hf_geonw_de_pv_addr_manual; +static int hf_geonw_de_pv_addr_type; +static int hf_geonw_de_pv_addr_country; +static int hf_geonw_de_pv_addr_mid; +static int hf_geonw_de_pv_time; +static int hf_geonw_de_pv_lat; +static int hf_geonw_de_pv_lon; + +static int hf_geonw_gxc_latitude; +static int hf_geonw_gxc_longitude; +static int hf_geonw_gxc_radius; +static int hf_geonw_gxc_distancea; +static int hf_geonw_gxc_distanceb; +static int hf_geonw_gxc_angle; +static int hf_geonw_gxc_reserved; + +static int hf_geonw_shb_reserved; + +static int hf_geonw_lsrq_addr; +static int hf_geonw_lsrq_addr_manual; +static int hf_geonw_lsrq_addr_type; +static int hf_geonw_lsrq_addr_country; +static int hf_geonw_lsrq_addr_mid; + +static int hf_geonw_beacon; +static int hf_geonw_guc; +static int hf_geonw_gac; +static int hf_geonw_gbc; +static int hf_geonw_tsb; +static int hf_geonw_ls; +static int hf_geonw_analysis_flags; + +static int hf_btpa_dstport; +static int hf_btpa_srcport; +static int hf_btpa_port; +static int hf_btpb_dstport; +static int hf_btpb_dstport_info; + +static int hf_geonw_resp_in; +static int hf_geonw_resp_to; +static int hf_geonw_no_resp; +static int hf_geonw_resptime; + +static int hf_geonw_dccmco; +static int hf_geonw_dccmco_cbr_l_0_hop; +static int hf_geonw_dccmco_cbr_l_1_hop; +static int hf_geonw_dccmco_output_power; +static int hf_geonw_dccmco_reserved; + +static int ett_geonw; +static int ett_geonw_bh; +static int ett_geonw_bh_lt; +static int ett_geonw_ch; +static int ett_geonw_ch_tc; +static int ett_geonw_sh; +static int ett_geonw_so; +static int ett_geonw_so_add; +static int ett_geonw_de; +static int ett_geonw_de_add; +static int ett_geonw_lsrq_add; +static int ett_geonw_analysis; +static int ett_geonw_dccmco; +static int ett_btpa; +static int ett_btpb; static int geonw_address_type = -1; -static expert_field ei_geonw_nz_reserved = EI_INIT; -static expert_field ei_geonw_version_err = EI_INIT; -static expert_field ei_geonw_rhl_lncb = EI_INIT; -static expert_field ei_geonw_rhl_too_low = EI_INIT; -static expert_field ei_geonw_mhl_lt_rhl = EI_INIT; -static expert_field ei_geonw_scc_too_big = EI_INIT; -static expert_field ei_geonw_analysis_duplicate = EI_INIT; -static expert_field ei_geonw_resp_not_found = EI_INIT; -static expert_field ei_geonw_out_of_range = EI_INIT; -static expert_field ei_geonw_payload_len = EI_INIT; -static expert_field ei_geonw_intx_too_big = EI_INIT; +static expert_field ei_geonw_nz_reserved; +static expert_field ei_geonw_version_err; +static expert_field ei_geonw_rhl_lncb; +static expert_field ei_geonw_rhl_too_low; +static expert_field ei_geonw_mhl_lt_rhl; +static expert_field ei_geonw_scc_too_big; +static expert_field ei_geonw_analysis_duplicate; +static expert_field ei_geonw_resp_not_found; +static expert_field ei_geonw_out_of_range; +static expert_field ei_geonw_payload_len; +static expert_field ei_geonw_intx_too_big; static dissector_table_t geonw_subdissector_table; static dissector_table_t ssp_subdissector_table; @@ -368,10 +368,10 @@ dissect_btpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ high_port = dst_port; } - if (dissector_try_uint_new(btpa_subdissector_table, low_port, next_tvb, pinfo, tree, TRUE, NULL)) + if (dissector_try_uint_new(btpa_subdissector_table, low_port, next_tvb, pinfo, tree, true, NULL)) return tvb_captured_length(tvb); - if (dissector_try_uint_new(btpa_subdissector_table, high_port, next_tvb, pinfo, tree, TRUE, NULL)) + if (dissector_try_uint_new(btpa_subdissector_table, high_port, next_tvb, pinfo, tree, true, NULL)) return tvb_captured_length(tvb); if (dissector_try_heuristic(btpa_heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) @@ -388,8 +388,8 @@ static int dissect_btpb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { heur_dtbl_entry_t *hdtbl_entry; - guint32 dst_port; - guint32 dst_info; + uint32_t dst_port; + uint32_t dst_info; struct btpbheader *btpbh; btpbh = wmem_new0(pinfo->pool, struct btpbheader); @@ -419,10 +419,10 @@ dissect_btpb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ if (have_tap_listener(btpb_follow_tap)) tap_queue_packet(btpb_follow_tap, pinfo, next_tvb); - if (dissector_try_uint_new(btpb_subdissector_table, dst_port, next_tvb, pinfo, tree, TRUE, NULL)) { + if (dissector_try_uint_new(btpb_subdissector_table, dst_port, next_tvb, pinfo, tree, true, NULL)) { return tvb_captured_length(tvb); } - if (dissector_try_heuristic(btpa_heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) { + if (dissector_try_heuristic(btpb_heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, NULL)) { return tvb_captured_length(tvb); } @@ -437,8 +437,8 @@ dissect_btpb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ */ typedef struct _geonw_transaction_t { - guint32 rqst_frame; - guint32 resp_frame; + uint32_t rqst_frame; + uint32_t resp_frame; nstime_t rqst_time; nstime_t resp_time; } geonw_transaction_t; @@ -448,14 +448,14 @@ typedef struct _geonw_conv_info_t { wmem_tree_t *matched_pdus; } geonw_conv_info_t; -static const gchar * get_geonw_name(const guint8 *addr); -static const gchar* geonw_name_resolution_str(const address* addr); +static const char * get_geonw_name(const uint8_t *addr); +static const char* geonw_name_resolution_str(const address* addr); static int geonw_name_resolution_len(void); static geonw_transaction_t *transaction_start(packet_info * pinfo, proto_tree * tree); static geonw_transaction_t *transaction_end(packet_info * pinfo, proto_tree * tree); -static gboolean geonw_analyze_seq = TRUE; +static bool geonw_analyze_seq = true; /* * GeoNetworking Address Type @@ -466,14 +466,14 @@ struct hashgeonw; typedef struct hashgeonw hashgeonw_t; struct hashgeonw { - guint status; - guint8 addr[8]; + unsigned status; + uint8_t addr[8]; char hexaddr[28]; char resolved_name[MAXNAMELEN]; // Node follow up used for duplication detection - guint32 timestamp; - guint32 sequence_number; + uint32_t timestamp; + uint32_t sequence_number; }; @@ -485,7 +485,7 @@ geonw_str_len(const address* addr _U_) } static int -_geonw_to_str(const guint8* addrdata, gchar *buf, int buf_len _U_) +_geonw_to_str(const uint8_t* addrdata, char *buf, int buf_len _U_) { address eth_addr; @@ -496,11 +496,11 @@ _geonw_to_str(const guint8* addrdata, gchar *buf, int buf_len _U_) *buf++ = '0'; *buf++ = '.'; // Station Type - guint32_to_str_buf((addrdata[0] & 0x7C) >> 2, buf, 26); + uint32_to_str_buf((addrdata[0] & 0x7C) >> 2, buf, 26); buf += (unsigned) strlen(buf); *buf++ = '.'; // Country Code - guint32_to_str_buf(((guint32)(addrdata[0] & 0x03) << 8) + addrdata[1], buf, 23); // > 23 + uint32_to_str_buf(((uint32_t)(addrdata[0] & 0x03) << 8) + addrdata[1], buf, 23); // > 23 buf += (unsigned) strlen(buf); *buf++ = '.'; // LL_ADDR @@ -511,13 +511,13 @@ _geonw_to_str(const guint8* addrdata, gchar *buf, int buf_len _U_) } static int -geonw_to_str(const address* addr, gchar *buf, int buf_len _U_) +geonw_to_str(const address* addr, char *buf, int buf_len _U_) { - return _geonw_to_str((const guint8 *)addr->data, buf, buf_len); + return _geonw_to_str((const uint8_t *)addr->data, buf, buf_len); } static const char* -geonw_col_filter_str(const address* addr _U_, gboolean is_src) +geonw_col_filter_str(const address* addr _U_, bool is_src) { if (is_src) return "geonw.src_pos.addr"; @@ -531,14 +531,14 @@ geonw_len(void) return 8; } -static guint -geonw_addr_hash(gconstpointer key) +static unsigned +geonw_addr_hash(const void *key) { - return wmem_strong_hash((const guint8 *)key, 8); + return wmem_strong_hash((const uint8_t *)key, 8); } static gboolean -geonw_addr_cmp(gconstpointer a, gconstpointer b) +geonw_addr_cmp(const void *a, const void *b) { return (memcmp(a, b, 8) == 0); } @@ -566,11 +566,11 @@ static const value_string itss_type_small_names[] = { /* Resolve geonetworking address */ static hashgeonw_t * geonw_addr_resolve(hashgeonw_t *tp) { - const guint8 *addr = tp->addr; - guint16 val; + const uint8_t *addr = tp->addr; + uint16_t val; char *rname = tp->resolved_name; address eth_addr; - guint8 l1, l2; + uint8_t l1, l2; // Initial or Manual if (addr[0] & 0x80) @@ -582,23 +582,23 @@ geonw_addr_resolve(hashgeonw_t *tp) { val = (addr[0] & 0x7C) >> 2; const char *string = try_val_to_str(val, itss_type_small_names); if (string == NULL) { - guint32_to_str_buf(val, rname, MAXNAMELEN-2); - l1 = (guint8) strlen(rname); + uint32_to_str_buf(val, rname, MAXNAMELEN-2); + l1 = (uint8_t) strlen(rname); } else { - l1 = (guint8) g_strlcpy(rname, string, MAXNAMELEN-2); + l1 = (uint8_t) g_strlcpy(rname, string, MAXNAMELEN-2); } rname += l1; *rname++ = '.'; // Country Code - val = ((guint32)(addr[0] & 0x03) << 8) + addr[1]; + val = ((uint32_t)(addr[0] & 0x03) << 8) + addr[1]; string = try_val_to_str(val, E164_ISO3166_country_code_short_value); if (string == NULL) { - guint32_to_str_buf(val, rname, MAXNAMELEN-12); - l2 = (guint8) strlen(rname); + uint32_to_str_buf(val, rname, MAXNAMELEN-12); + l2 = (uint8_t) strlen(rname); } else { - l2 = (guint8) g_strlcpy(rname, string, MAXNAMELEN-l1-3); + l2 = (uint8_t) g_strlcpy(rname, string, MAXNAMELEN-l1-3); } rname += l2; //l1 += l2; @@ -615,7 +615,7 @@ geonw_addr_resolve(hashgeonw_t *tp) { } static hashgeonw_t * -geonw_hash_new_entry(const guint8 *addr, gboolean resolve) +geonw_hash_new_entry(const uint8_t *addr, bool resolve) { hashgeonw_t *tp; @@ -637,7 +637,7 @@ geonw_hash_new_entry(const guint8 *addr, gboolean resolve) } /* geonw_hash_new_entry */ static hashgeonw_t * -geonw_name_lookup(const guint8 *addr, gboolean resolve) +geonw_name_lookup(const uint8_t *addr, bool resolve) { hashgeonw_t *tp; @@ -655,11 +655,11 @@ geonw_name_lookup(const guint8 *addr, gboolean resolve) } /* geonw_name_lookup */ -const gchar * -get_geonw_name(const guint8 *addr) +const char * +get_geonw_name(const uint8_t *addr) { hashgeonw_t *tp; - gboolean resolve = gbl_resolv_flags.network_name; + bool resolve = gbl_resolv_flags.network_name; tp = geonw_name_lookup(addr, resolve); @@ -667,9 +667,9 @@ get_geonw_name(const guint8 *addr) } /* get_geonw_name */ -const gchar* geonw_name_resolution_str(const address* addr) +const char* geonw_name_resolution_str(const address* addr) { - return get_geonw_name((const guint8 *)addr->data); + return get_geonw_name((const uint8_t *)addr->data); } int geonw_name_resolution_len(void) @@ -718,7 +718,7 @@ static geonw_transaction_t *transaction_start(packet_info * pinfo, proto_tree * wmem_stack_push(geonw_info->unmatched_pdus, (void *) geonw_trans); } else { /* Already visited this frame */ - guint32 frame_num = pinfo->num; + uint32_t frame_num = pinfo->num; geonw_key[0].length = 1; geonw_key[0].key = &frame_num; @@ -733,7 +733,7 @@ static geonw_transaction_t *transaction_start(packet_info * pinfo, proto_tree * it = proto_tree_add_item(tree, hf_geonw_no_resp, NULL, 0, 0, ENC_NA); proto_item_set_generated(it); - col_append_fstr(pinfo->cinfo, COL_INFO, " (no response found!)"); + col_append_str(pinfo->cinfo, COL_INFO, " (no response found!)"); /* Expert info. */ expert_add_info_format(pinfo, it, &ei_geonw_resp_not_found, "No response seen to LS Request"); @@ -775,7 +775,7 @@ static geonw_transaction_t *transaction_end(packet_info * pinfo, proto_tree * tr } if (!PINFO_FD_VISITED(pinfo)) { - guint32 frame_num; + uint32_t frame_num; geonw_trans = (geonw_transaction_t *)wmem_stack_peek(geonw_info->unmatched_pdus); if (geonw_trans == NULL) { @@ -803,7 +803,7 @@ static geonw_transaction_t *transaction_end(packet_info * pinfo, proto_tree * tr wmem_tree_insert32_array(geonw_info->matched_pdus, geonw_key, (void *) geonw_trans); } else { /* Already visited this frame */ - guint32 frame_num = pinfo->num; + uint32_t frame_num = pinfo->num; geonw_key[0].length = 1; geonw_key[0].key = &frame_num; @@ -838,74 +838,74 @@ static geonw_transaction_t *transaction_end(packet_info * pinfo, proto_tree * tr // Conversation data struct geonw_analysis { // Node follow up used for duplication detection - guint32 timestamp; - guint16 sequence_number; + uint32_t timestamp; + uint16_t sequence_number; }; /* * Secured geonetworking */ -static int hf_geonw_sec = -1; -static int hf_sgeonw_version = -1; -static int hf_sgeonw_profile = -1; -static int hf_sgeonw_hdr = -1; -static int hf_sgeonw_pl = -1; -static int hf_sgeonw_trl = -1; -static int hf_sgeonw_var_len = -1; -static int hf_sgeonw_var_len_det = -1; -static int hf_sgeonw_var_len_val = -1; -static int hf_sgeonw_header_field = -1; -static int hf_sgeonw_header_field_type_v1 = -1; -static int hf_sgeonw_header_field_type_v2 = -1; -static int hf_sgeonw_opaque = -1; - -static int hf_sgeonw_payload_field = -1; -static int hf_sgeonw_payload_field_type = -1; - -static int hf_sgeonw_trailer_field = -1; -static int hf_sgeonw_trailer_field_type = -1; - -static int hf_sgeonw_certificate = -1; -static int hf_sgeonw_encryption_parameter = -1; -static int hf_sgeonw_signature = -1; -static int hf_sgeonw_subject_info = -1; -static int hf_sgeonw_subject_attribute = -1; - -static int hf_sgeonw_intx = -1; -static int hf_sgeonw_time64 = -1; -static int hf_sgeonw_conf = -1; -static int hf_sgeonw_time32 = -1; -static int hf_sgeonw_lat = -1; -static int hf_sgeonw_lon = -1; -static int hf_sgeonw_elev = -1; -static int hf_sgeonw_hashedid3 = -1; -static int hf_sgeonw_hashedid8 = -1; -static int hf_sgeonw_duration = -1; -static int hf_sgeonw_duration_unit = -1; -static int hf_sgeonw_duration_value = -1; -static int hf_sgeonw_encryption_parameter_nonce = -1; - -static int hf_sgeonw_msg_id = -1; -static int hf_sgeonw_app_id = -1; - -static int ett_geonw_sec = -1; -static int ett_sgeonw_hdr = -1; -static int ett_sgeonw_field = -1; -static int ett_sgeonw_var_len = -1; -static int ett_sgeonw_intx = -1; -static int ett_sgeonw_duration = -1; -static int ett_sgeonw_encryption_parameter = -1; -static int ett_sgeonw_signature = -1; -static int ett_sgeonw_subject_info = -1; -static int ett_sgeonw_subject_attribute = -1; -static int ett_sgeonw_ssp = -1; - -static expert_field ei_sgeonw_len_unsupported = EI_INIT; -static expert_field ei_sgeonw_len_too_long = EI_INIT; -static expert_field ei_sgeonw_subj_info_too_long = EI_INIT; -static expert_field ei_sgeonw_ssp_too_long = EI_INIT; -static expert_field ei_sgeonw_bogus = EI_INIT; +static int hf_geonw_sec; +static int hf_sgeonw_version; +static int hf_sgeonw_profile; +static int hf_sgeonw_hdr; +static int hf_sgeonw_pl; +static int hf_sgeonw_trl; +static int hf_sgeonw_var_len; +static int hf_sgeonw_var_len_det; +static int hf_sgeonw_var_len_val; +static int hf_sgeonw_header_field; +static int hf_sgeonw_header_field_type_v1; +static int hf_sgeonw_header_field_type_v2; +static int hf_sgeonw_opaque; + +static int hf_sgeonw_payload_field; +static int hf_sgeonw_payload_field_type; + +static int hf_sgeonw_trailer_field; +static int hf_sgeonw_trailer_field_type; + +static int hf_sgeonw_certificate; +static int hf_sgeonw_encryption_parameter; +static int hf_sgeonw_signature; +static int hf_sgeonw_subject_info; +static int hf_sgeonw_subject_attribute; + +static int hf_sgeonw_intx; +static int hf_sgeonw_time64; +static int hf_sgeonw_conf; +static int hf_sgeonw_time32; +static int hf_sgeonw_lat; +static int hf_sgeonw_lon; +static int hf_sgeonw_elev; +static int hf_sgeonw_hashedid3; +static int hf_sgeonw_hashedid8; +static int hf_sgeonw_duration; +static int hf_sgeonw_duration_unit; +static int hf_sgeonw_duration_value; +static int hf_sgeonw_encryption_parameter_nonce; + +static int hf_sgeonw_msg_id; +static int hf_sgeonw_app_id; + +static int ett_geonw_sec; +static int ett_sgeonw_hdr; +static int ett_sgeonw_field; +static int ett_sgeonw_var_len; +static int ett_sgeonw_intx; +static int ett_sgeonw_duration; +static int ett_sgeonw_encryption_parameter; +static int ett_sgeonw_signature; +static int ett_sgeonw_subject_info; +static int ett_sgeonw_subject_attribute; +static int ett_sgeonw_ssp; + +static expert_field ei_sgeonw_len_unsupported; +static expert_field ei_sgeonw_len_too_long; +static expert_field ei_sgeonw_subj_info_too_long; +static expert_field ei_sgeonw_ssp_too_long; +static expert_field ei_sgeonw_bogus; typedef enum { generation_time = 0, @@ -977,8 +977,8 @@ static const value_string trailer_field_type_names[] = { { 0, NULL }, }; -static int hf_sgeonw_signer_info = -1; -static int hf_sgeonw_signer_info_type = -1; +static int hf_sgeonw_signer_info; +static int hf_sgeonw_signer_info_type; typedef enum { self = 0, @@ -1001,10 +1001,10 @@ static const value_string signer_info_type_names[] = { { 0, NULL }, }; -static int hf_sgeonw_public_key = -1; -static int ett_sgeonw_public_key = -1; -static int hf_sgeonw_public_key_algorithm = -1; -static int hf_sgeonw_ecdsasignature_s = -1; +static int hf_sgeonw_public_key; +static int ett_sgeonw_public_key; +static int hf_sgeonw_public_key_algorithm; +static int hf_sgeonw_ecdsasignature_s; typedef enum { ecdsa_nistp256_with_sha256 = 0, @@ -1026,7 +1026,7 @@ static const int etsits103097_table_2[] = { 32 // ecies_nistp256(1) }; -static int hf_sgeonw_symmetric_algorithm = -1; +static int hf_sgeonw_symmetric_algorithm; typedef enum { aes_128_ccm = 0, @@ -1043,8 +1043,8 @@ static const int etsits103097_table_4[] = { 16 // aes_128_ccm(0) }; -static int hf_sgeonw_region_type = -1; -static int hf_sgeonw_radius = -1; +static int hf_sgeonw_region_type; +static int hf_sgeonw_radius; typedef enum { none = 0, @@ -1067,9 +1067,9 @@ static const value_string region_type_names[] = { { 0, NULL }, }; -static int hf_sgeonw_region_dictionary = -1; -static int hf_sgeonw_region_identifier = -1; -static int hf_sgeonw_local_region = -1; +static int hf_sgeonw_region_dictionary; +static int hf_sgeonw_region_identifier; +static int hf_sgeonw_local_region; typedef enum { iso_3166_1 = 0, @@ -1084,7 +1084,7 @@ static const value_string region_dictionary_names[] = { { 0, NULL }, }; -static int hf_sgeonw_subject_type = -1; +static int hf_sgeonw_subject_type; typedef enum { enrollment_credential = 0, @@ -1108,8 +1108,8 @@ static const value_string subject_type_names[] = { { 0, NULL }, }; -static int hf_sgeonw_subject_attribute_type_v1 = -1; -static int hf_sgeonw_subject_attribute_type_v2 = -1; +static int hf_sgeonw_subject_attribute_type_v1; +static int hf_sgeonw_subject_attribute_type_v2; typedef enum { verification_key = 0, @@ -1146,7 +1146,7 @@ static const value_string subject_attribute_type_v2_names[] = { { 0, NULL }, }; -static int hf_sgeonw_validity_restriction_type = -1; +static int hf_sgeonw_validity_restriction_type; typedef enum { time_end = 0, @@ -1166,11 +1166,11 @@ static const value_string validity_restriction_type_names[] = { { 0, NULL }, }; -static int hf_sgeonw_eccpoint = -1; -static int ett_sgeonw_eccpoint = -1; -static int hf_sgeonw_eccpoint_type = -1; -static int hf_sgeonw_eccpoint_x = -1; -static int hf_sgeonw_eccpoint_y = -1; +static int hf_sgeonw_eccpoint; +static int ett_sgeonw_eccpoint; +static int hf_sgeonw_eccpoint_type; +static int hf_sgeonw_eccpoint_x; +static int hf_sgeonw_eccpoint_y; typedef enum { x_coordinate_only = 0, @@ -1192,22 +1192,22 @@ static const value_string eccpoint_type_names[] = { // Dissects a length and returns the value // The encoding of the length shall use at most 7 bits set to 1. We support only 3... 0xfffffff should be enough though to encode a length -static guint32 -dissect_sec_var_len(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +static uint32_t +dissect_sec_var_len(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - guint32 tmp_val; - guint32 var_len; - guint32 mask; - gint start = *offset; + uint32_t tmp_val; + uint32_t var_len; + uint32_t mask; + int start = *offset; proto_item *ti; proto_tree *subtree; // Determine length - var_len = tvb_get_guint8(tvb, *offset); + var_len = tvb_get_uint8(tvb, *offset); *offset+=1; mask = 0x80; while(mask && (var_len & mask)) { - tmp_val = tvb_get_guint8(tvb, *offset); + tmp_val = tvb_get_uint8(tvb, *offset); *offset += 1; var_len = ((var_len & ~mask) << 8) + tmp_val; mask <<= 7; @@ -1224,23 +1224,23 @@ dissect_sec_var_len(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree // IntX static int -dissect_sec_intx(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, int hf, guint32 *ret) +dissect_sec_intx(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, int hf, uint32_t *ret) { - //guint8 var_len = 1; - guint64 tmp_val; - guint64 mask; - gint start = *offset; + //uint8_t var_len = 1; + uint64_t tmp_val; + uint64_t mask; + int start = *offset; proto_item *ti; proto_tree *subtree; // Determine length - tmp_val = tvb_get_guint8(tvb, *offset); + tmp_val = tvb_get_uint8(tvb, *offset); *offset+=1; mask = 0x80; while(mask && (tmp_val & mask)) { tmp_val &= ~mask; tmp_val <<= 8; - tmp_val += tvb_get_guint8(tvb, *offset); + tmp_val += tvb_get_uint8(tvb, *offset); *offset += 1; mask <<= 7; //var_len++; @@ -1254,7 +1254,7 @@ dissect_sec_intx(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tr } else { proto_tree_add_uint_bits_format_value(subtree, hf, tvb, (start << 3) + (*offset) - start, - (((*offset) - start) << 3) - ((*offset) - start), (guint32)tmp_val, ENC_BIG_ENDIAN, "%s(%u)", val64_to_str_const(tmp_val, ieee1609dot2_Psid_vals, "Unknown") , (guint32)tmp_val); + (((*offset) - start) << 3) - ((*offset) - start), (uint32_t)tmp_val, ENC_BIG_ENDIAN, "%s(%u)", val64_to_str_const(tmp_val, ieee1609dot2_Psid_vals, "Unknown") , (uint32_t)tmp_val); } // ETSI TS 103 097 V1.2.1: The encoding of the length shall use at most 7 bits set to 1. if (!mask) @@ -1264,18 +1264,18 @@ dissect_sec_intx(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tr if(tmp_val & 0xffffffff00000000) { expert_add_info(pinfo, ti, &ei_geonw_intx_too_big); } - *ret = (guint32) tmp_val; + *ret = (uint32_t) tmp_val; } return (*offset) - start; } static int -dissect_sec_eccpoint(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, PublicKeyAlgorithm algorithm) +dissect_sec_eccpoint(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, PublicKeyAlgorithm algorithm) { - guint32 tmp_val; - guint32 param_len; - guint32 start = *offset; + uint32_t tmp_val; + uint32_t param_len; + uint32_t start = *offset; proto_item *ti; proto_tree *subtree; int field_size = etsits103097_table_2[algorithm]; @@ -1307,11 +1307,11 @@ dissect_sec_eccpoint(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree } static int -dissect_sec_publickey(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_publickey(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - guint32 tmp_val; - guint32 param_len; - gint start = *offset; + uint32_t tmp_val; + uint32_t param_len; + int start = *offset; proto_item *part_item; proto_tree *part_tree; @@ -1341,11 +1341,11 @@ dissect_sec_publickey(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tre } static int -dissect_sec_encryption_parameters(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_encryption_parameters(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - guint32 tmp_val; - guint32 param_len; - guint32 start = *offset; + uint32_t tmp_val; + uint32_t param_len; + uint32_t start = *offset; proto_item *part_item; proto_tree *part_tree; @@ -1370,9 +1370,9 @@ dissect_sec_encryption_parameters(tvbuff_t *tvb, gint *offset, packet_info *pinf } static int -dissect_sec_ecdsasignature(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, PublicKeyAlgorithm algorithm) +dissect_sec_ecdsasignature(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, PublicKeyAlgorithm algorithm) { - guint32 start = *offset; + uint32_t start = *offset; int field_size = etsits103097_table_2[algorithm]; dissect_sec_eccpoint(tvb, offset, pinfo, tree, algorithm); @@ -1382,11 +1382,11 @@ dissect_sec_ecdsasignature(tvbuff_t *tvb, gint *offset, packet_info *pinfo, prot } static int -dissect_sec_signature(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_signature(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - gint start = *offset; - guint32 param_len; - guint32 tmp_val; + int start = *offset; + uint32_t param_len; + uint32_t tmp_val; proto_item *part_item; proto_tree *part_tree; @@ -1410,7 +1410,7 @@ dissect_sec_signature(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tre } inline static int -dissect_sec_2dlocation(tvbuff_t *tvb, gint *offset, proto_tree *tree) +dissect_sec_2dlocation(tvbuff_t *tvb, int *offset, proto_tree *tree) { proto_tree_add_item(tree, hf_sgeonw_lat, tvb, *offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_sgeonw_lon, tvb, 4+*offset, 4, ENC_BIG_ENDIAN); @@ -1421,10 +1421,10 @@ dissect_sec_2dlocation(tvbuff_t *tvb, gint *offset, proto_tree *tree) static int -dissect_sec_subject_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_subject_info(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - guint32 param_len; - gint start = *offset; + uint32_t param_len; + int start = *offset; proto_item *ti; proto_item *part_item; proto_tree *part_tree; @@ -1445,11 +1445,11 @@ dissect_sec_subject_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_ } static int -dissect_sec_itsaidssp(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_itsaidssp(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - gint start = *offset; - guint32 param_len; - guint32 appid; + int start = *offset; + uint32_t param_len; + uint32_t appid; proto_item *ti; proto_tree *subtree; @@ -1470,12 +1470,12 @@ dissect_sec_itsaidssp(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tre return (*offset) - start; } -static int hf_sgeonw_priority = -1; +static int hf_sgeonw_priority; static int -dissect_sec_itsaidpriority(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_itsaidpriority(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - gint start = *offset; + int start = *offset; dissect_sec_intx(tvb, offset, pinfo, tree, hf_sgeonw_app_id, NULL); proto_tree_add_item(tree, hf_sgeonw_priority, tvb, *offset, 1, ENC_BIG_ENDIAN); @@ -1485,10 +1485,10 @@ dissect_sec_itsaidpriority(tvbuff_t *tvb, gint *offset, packet_info *pinfo, prot } static int -dissect_sec_itsaidpriorityssp(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_itsaidpriorityssp(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - gint start = *offset; - guint32 param_len; + int start = *offset; + uint32_t param_len; proto_item *ti; dissect_sec_intx(tvb, offset, pinfo, tree, hf_sgeonw_app_id, NULL); @@ -1504,18 +1504,18 @@ dissect_sec_itsaidpriorityssp(tvbuff_t *tvb, gint *offset, packet_info *pinfo, p return (*offset) - start; } -static int hf_sgeonw_subject_assurance = -1; -static int ett_sgeonw_subject_assurance = -1; -static int hf_sgeonw_subject_assurance_assurance = -1; -static int hf_sgeonw_subject_assurance_reserved = -1; -static int hf_sgeonw_subject_assurance_confidence = -1; +static int hf_sgeonw_subject_assurance; +static int ett_sgeonw_subject_assurance; +static int hf_sgeonw_subject_assurance_assurance; +static int hf_sgeonw_subject_assurance_reserved; +static int hf_sgeonw_subject_assurance_confidence; static int -dissect_sec_subject_attributes(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, guint8 version) +dissect_sec_subject_attributes(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, uint8_t version) { - gint start = *offset; - guint32 tmp_val; - guint32 param_len; + int start = *offset; + uint32_t tmp_val; + uint32_t param_len; proto_item *ti; proto_item *part_item; proto_tree *subtree; @@ -1596,7 +1596,7 @@ dissect_sec_subject_attributes(tvbuff_t *tvb, gint *offset, packet_info *pinfo, } static int -dissect_sec_circularregion(tvbuff_t *tvb, gint *offset, proto_tree *tree) +dissect_sec_circularregion(tvbuff_t *tvb, int *offset, proto_tree *tree) { dissect_sec_2dlocation(tvb, offset, tree); // uint16 @@ -1607,7 +1607,7 @@ dissect_sec_circularregion(tvbuff_t *tvb, gint *offset, proto_tree *tree) } static int -dissect_sec_rectangularregion(tvbuff_t *tvb, gint *offset, proto_tree *tree) +dissect_sec_rectangularregion(tvbuff_t *tvb, int *offset, proto_tree *tree) { dissect_sec_2dlocation(tvb, offset, tree); dissect_sec_2dlocation(tvb, offset, tree); @@ -1616,11 +1616,11 @@ dissect_sec_rectangularregion(tvbuff_t *tvb, gint *offset, proto_tree *tree) } static int -dissect_sec_polygonalregion(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_polygonalregion(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - gint start = *offset; - guint32 param_len; - guint32 tmp_val; + int start = *offset; + uint32_t param_len; + uint32_t tmp_val; tmp_val = dissect_sec_var_len(tvb, offset, pinfo, tree); while (tmp_val) { @@ -1634,9 +1634,9 @@ dissect_sec_polygonalregion(tvbuff_t *tvb, gint *offset, packet_info *pinfo, pro } static int -dissect_sec_identifiedregion(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_identifiedregion(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - gint start = *offset; + int start = *offset; proto_tree_add_item(tree, hf_sgeonw_region_dictionary, tvb, *offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_sgeonw_region_identifier, tvb, *offset, 2, ENC_BIG_ENDIAN); @@ -1647,11 +1647,11 @@ dissect_sec_identifiedregion(tvbuff_t *tvb, gint *offset, packet_info *pinfo, pr } static int -dissect_sec_geographicregion(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_geographicregion(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - gint start = *offset; - guint32 param_len; - guint32 tmp_val; + int start = *offset; + uint32_t param_len; + uint32_t tmp_val; proto_tree_add_item_ret_uint(tree, hf_sgeonw_region_type, tvb, *offset, 1, ENC_BIG_ENDIAN, &tmp_val); *offset += 1; @@ -1690,11 +1690,11 @@ static const value_string sgeonw_duration_unit_names[] = { }; static int -dissect_sec_validity_restrictions(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree) +dissect_sec_validity_restrictions(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree) { - gint start = *offset; - guint32 tmp_val; - guint32 param_len; + int start = *offset; + uint32_t tmp_val; + uint32_t param_len; proto_item *ti; proto_tree *subtree; @@ -1737,17 +1737,17 @@ dissect_sec_validity_restrictions(tvbuff_t *tvb, gint *offset, packet_info *pinf return (*offset) - start; } -static int dissect_sec_signer_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, guint8 version); +static int dissect_sec_signer_info(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, uint8_t version); -static int hf_sgeonw_certification_version = -1; +static int hf_sgeonw_certification_version; static int // NOLINTNEXTLINE(misc-no-recursion) -dissect_sec_certificate(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, guint8 version) +dissect_sec_certificate(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, uint8_t version) { - guint32 tmp_val; - guint32 param_len; - gint start = *offset; + uint32_t tmp_val; + uint32_t param_len; + int start = *offset; proto_tree_add_item_ret_uint(tree, hf_sgeonw_certification_version, tvb, *offset, 1, ENC_BIG_ENDIAN, &tmp_val); *offset += 1; @@ -1779,11 +1779,11 @@ dissect_sec_certificate(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_t static int // NOLINTNEXTLINE(misc-no-recursion) -dissect_sec_signer_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, guint8 version) +dissect_sec_signer_info(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, uint8_t version) { - gint start = *offset; - guint32 tmp_val; - guint32 param_len; + int start = *offset; + uint32_t tmp_val; + uint32_t param_len; proto_item *ti; proto_tree *subtree; proto_item *tinner; @@ -1791,7 +1791,7 @@ dissect_sec_signer_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_t increment_dissection_depth(pinfo); - tmp_val = tvb_get_guint8(tvb, *offset); + tmp_val = tvb_get_uint8(tvb, *offset); if (tmp_val == self) { // No additional data shall be given proto_tree_add_item(tree, hf_sgeonw_signer_info_type, tvb, *offset, 1, ENC_BIG_ENDIAN); @@ -1845,18 +1845,18 @@ dissect_sec_signer_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_t } -static int hf_sgeonw_encrypted_key = -1; -static int hf_sgeonw_auth_tag = -1; +static int hf_sgeonw_encrypted_key; +static int hf_sgeonw_auth_tag; // This structure defines how to transmit an EciesNistP256-encrypted symmetric key as defined in IEEE // Std 1363a-2004. // EciesNistP256EncryptedKey structure shall be preceded by an according // EncryptionParameters structure. static int -dissect_sec_eciesnistp256entryptedkey(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, PublicKeyAlgorithm pub_alg, SymmetricAlgorithm symm_alg, guint8 version) +dissect_sec_eciesnistp256entryptedkey(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, PublicKeyAlgorithm pub_alg, SymmetricAlgorithm symm_alg, uint8_t version) { - gint start = *offset; - guint8 symm_key_len = etsits103097_table_4[symm_alg]; + int start = *offset; + uint8_t symm_key_len = etsits103097_table_4[symm_alg]; dissect_sec_eccpoint(tvb, offset, pinfo, tree, pub_alg); proto_tree_add_item(tree, hf_sgeonw_encrypted_key, tvb, *offset, symm_key_len, ENC_NA); @@ -1869,11 +1869,11 @@ dissect_sec_eciesnistp256entryptedkey(tvbuff_t *tvb, gint *offset, packet_info * static int -dissect_sec_recipient_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, guint8 version) +dissect_sec_recipient_info(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *tree, uint8_t version) { - gint start = *offset; - guint32 tmp_val; - guint32 param_len; + int start = *offset; + uint32_t tmp_val; + uint32_t param_len; proto_tree_add_item(tree, hf_sgeonw_hashedid8, tvb, *offset, 8, ENC_NA); proto_tree_add_item_ret_uint(tree, hf_sgeonw_public_key_algorithm, tvb, 8+*offset, 1, ENC_BIG_ENDIAN, &tmp_val); @@ -1896,15 +1896,15 @@ dissect_sec_recipient_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, prot static int -dissect_sec_payload(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *part_tree) +dissect_sec_payload(tvbuff_t *tvb, int *offset, packet_info *pinfo, proto_tree *part_tree) { - gint start = *offset; - guint32 tmp_val; - guint32 param_len; + int start = *offset; + uint32_t tmp_val; + uint32_t param_len; proto_tree *field_tree; proto_item *ti; - tmp_val = tvb_get_guint8(tvb, *offset); + tmp_val = tvb_get_uint8(tvb, *offset); if (tmp_val == signed_external) { proto_tree_add_item(part_tree, hf_sgeonw_payload_field_type, tvb, *offset, 1, ENC_BIG_ENDIAN); *offset += 1; @@ -1944,25 +1944,25 @@ dissect_sec_payload(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree static int -dissect_secured_message(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_secured_message(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void *data _U_) { - guint32 msg_id; // Or Application ID, depending on version - guint8 version; - guint32 var_len; + uint32_t msg_id; // Or Application ID, depending on version + uint8_t version; + uint32_t var_len; proto_item *ti; - guint32 tmp_val; - guint32 param_len; + uint32_t tmp_val; + uint32_t param_len; proto_item *secmsg_item; proto_item *part_item; proto_tree *part_tree; proto_tree *field_tree; - gint sec_start = offset; + int sec_start = offset; // Secured message subtree secmsg_item = proto_tree_add_item(tree, hf_geonw_sec, tvb, offset, 0, ENC_NA); // Length cannot be determined now proto_tree *secmsg_tree = proto_item_add_subtree(secmsg_item, ett_geonw_sec); - version = tvb_get_guint8(tvb, offset); + version = tvb_get_uint8(tvb, offset); if (version == 3) { tvbuff_t *next_tvb = tvb_new_subset_remaining(tvb, offset); call_dissector(ieee1609dot2_handle, next_tvb, pinfo, secmsg_tree); @@ -1985,7 +1985,7 @@ dissect_secured_message(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tr var_len = dissect_sec_var_len(tvb, &offset, pinfo, part_tree); while (var_len > 0) { - guint32 start = offset; + uint32_t start = offset; ti = proto_tree_add_item(part_tree, hf_sgeonw_header_field, tvb, offset, 0, ENC_NA); field_tree = proto_item_add_subtree(ti, ett_sgeonw_field); @@ -2073,7 +2073,7 @@ dissect_secured_message(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tr var_len = dissect_sec_var_len(tvb, &offset, pinfo, part_tree); while (var_len > 0) { - guint32 start = offset; + uint32_t start = offset; dissect_sec_payload(tvb, &offset, pinfo, part_tree); if (var_len < (offset-start)) @@ -2093,7 +2093,7 @@ dissect_secured_message(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tr var_len = dissect_sec_var_len(tvb, &offset, pinfo, part_tree); while (var_len > 0) { - guint32 start = offset; + uint32_t start = offset; ti = proto_tree_add_item(part_tree, hf_sgeonw_trailer_field, tvb, offset, 0, ENC_NA); field_tree = proto_item_add_subtree(ti, ett_sgeonw_field); @@ -2135,24 +2135,24 @@ dissect_sgeonw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, void *da // BH_NH_SECURED_PKT - skip and continue to Secured Packet // XXX COL_INFO to be improved static int -dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_, guint8 skip_bh) -{ - guint8 bh_next_header; - guint32 ch_next_header; - guint32 header_type; - guint32 rhl; - guint32 tmp_val; - gint offset = 0; +dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_, uint8_t skip_bh) +{ + uint8_t bh_next_header; + uint32_t ch_next_header; + uint32_t header_type; + uint32_t rhl; + uint32_t tmp_val; + int offset = 0; proto_item *ti; proto_item *top_item; proto_item* rhl_ti = NULL; - gint hdr_len = 0; - guint32 payload_len = 0; - guint32 reserved; - guint32 timestamp; - guint32 sequence_number = SN_MAX + 1; + int hdr_len = 0; + uint32_t payload_len = 0; + uint32_t reserved; + uint32_t timestamp; + uint32_t sequence_number = SN_MAX + 1; struct geonwheader *geonwh; - gint32 latlon; + int32_t latlon; geonwh = wmem_new0(pinfo->pool, struct geonwheader); @@ -2161,14 +2161,14 @@ dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void col_clear(pinfo->cinfo,COL_INFO); if (!skip_bh) { - bh_next_header = tvb_get_guint8(tvb, 0) & 0x0f; + bh_next_header = tvb_get_uint8(tvb, 0) & 0x0f; hdr_len = BH_LEN; } else { bh_next_header = skip_bh; } if (bh_next_header == BH_NH_COMMON_HDR) { - header_type = tvb_get_guint8(tvb, hdr_len + 1); + header_type = tvb_get_uint8(tvb, hdr_len + 1); hdr_len += CH_LEN; switch(header_type & HT_MASK) { case HT_BEACON: @@ -2251,7 +2251,7 @@ dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void tvb = next_tvb; bh_next_header = BH_NH_COMMON_HDR; offset = 0; - header_type = tvb_get_guint8(tvb, 1); + header_type = tvb_get_uint8(tvb, 1); hdr_len = CH_LEN; switch(header_type & HT_MASK) { @@ -2484,7 +2484,7 @@ dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void // We do not try to consider GN_ADDR updates (due to duplicate address detection or anonymous setting) hashgeonw_t *tp = (hashgeonw_t *)wmem_map_lookup(geonw_hashtable, pinfo->net_src.data); if (tp == NULL) { - tp = geonw_hash_new_entry((const guint8 *)pinfo->net_src.data, FALSE); + tp = geonw_hash_new_entry((const uint8_t *)pinfo->net_src.data, false); tp->sequence_number = sequence_number; tp->timestamp = timestamp; } else { @@ -2521,8 +2521,8 @@ dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * 23 # TST(P) not greater than TST(SO) * 24 ENDIF */ - if (((timestamp > tp->timestamp) && (((guint64)timestamp - (guint64)tp->timestamp) <= (guint64)TST_MAX/2)) || - ((tp->timestamp > timestamp) && (((guint64)tp->timestamp - (guint64)timestamp) > (guint64)TST_MAX/2))) { + if (((timestamp > tp->timestamp) && (((uint64_t)timestamp - (uint64_t)tp->timestamp) <= (uint64_t)TST_MAX/2)) || + ((tp->timestamp > timestamp) && (((uint64_t)tp->timestamp - (uint64_t)timestamp) > (uint64_t)TST_MAX/2))) { // TST(P) is greater than TST(SO) tp->sequence_number = sequence_number; tp->timestamp = timestamp; // P is not a duplicate packet @@ -2557,8 +2557,8 @@ dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * 10 # P is a duplicate * 11 ENDIF */ - if (((timestamp > tp->timestamp) && (((guint64)timestamp - (guint64)tp->timestamp) <= (guint64)TST_MAX/2)) || - ((tp->timestamp > timestamp) && (((guint64)tp->timestamp - (guint64)timestamp) > (guint64)TST_MAX/2))) { + if (((timestamp > tp->timestamp) && (((uint64_t)timestamp - (uint64_t)tp->timestamp) <= (uint64_t)TST_MAX/2)) || + ((tp->timestamp > timestamp) && (((uint64_t)tp->timestamp - (uint64_t)timestamp) > (uint64_t)TST_MAX/2))) { // TST(P) is greater than TST(SO) tp->timestamp = timestamp; // P is not a duplicate packet } else { @@ -2640,7 +2640,7 @@ dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void case HTST_TSB_SINGLE: // Reserved 32 bits // See usage in 636-4 subpart 2 for ITS-5G - reserved = tvb_get_guint32(tvb, offset, ENC_BIG_ENDIAN); + reserved = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN); if (reserved) { ti = proto_tree_add_item(geonw_sh_tree, hf_geonw_dccmco, tvb, offset, 4, ENC_NA); proto_tree *dccmco = proto_item_add_subtree(ti, ett_geonw_dccmco); @@ -2767,50 +2767,50 @@ dissect_geonw_internal(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * Decode_as */ static void -btpa_src_prompt(packet_info *pinfo _U_, gchar* result) +btpa_src_prompt(packet_info *pinfo _U_, char* result) { - guint32 port = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpa_srcport, pinfo->curr_layer_num)); + uint32_t port = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpa_srcport, pinfo->curr_layer_num)); snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "source (%u%s)", port, UTF8_RIGHTWARDS_ARROW); } -static gpointer +static void * btpa_src_value(packet_info *pinfo _U_) { return p_get_proto_data(pinfo->pool, pinfo, hf_btpa_srcport, pinfo->curr_layer_num); } static void -btpa_dst_prompt(packet_info *pinfo, gchar *result) +btpa_dst_prompt(packet_info *pinfo, char *result) { - guint32 port = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpa_dstport, pinfo->curr_layer_num)); + uint32_t port = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpa_dstport, pinfo->curr_layer_num)); snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "destination (%s%u)", UTF8_RIGHTWARDS_ARROW, port); } -static gpointer +static void * btpa_dst_value(packet_info *pinfo) { return p_get_proto_data(pinfo->pool, pinfo, hf_btpa_dstport, pinfo->curr_layer_num); } static void -btpa_both_prompt(packet_info *pinfo, gchar *result) +btpa_both_prompt(packet_info *pinfo, char *result) { - guint32 srcport = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpa_srcport, pinfo->curr_layer_num)), + uint32_t srcport = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpa_srcport, pinfo->curr_layer_num)), destport = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpa_dstport, pinfo->curr_layer_num)); snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "both (%u%s%u)", srcport, UTF8_LEFT_RIGHT_ARROW, destport); } static void -btpb_dst_prompt(packet_info *pinfo, gchar *result) +btpb_dst_prompt(packet_info *pinfo, char *result) { - guint32 port = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpb_dstport, pinfo->curr_layer_num)); + uint32_t port = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_btpb_dstport, pinfo->curr_layer_num)); snprintf(result, MAX_DECODE_AS_PROMPT_LEN, "destination (%s%u)", UTF8_RIGHTWARDS_ARROW, port); } -static gpointer +static void * btpb_dst_value(packet_info *pinfo) { return p_get_proto_data(pinfo->pool, pinfo, hf_btpb_dstport, pinfo->curr_layer_num); @@ -2840,7 +2840,7 @@ proto_register_btpa(void) NULL, HFILL }}, }; - static gint *ett[] = { + static int *ett[] = { &ett_btpa, }; proto_btpa = proto_register_protocol("BTP-A", "BTPA", "btpa"); @@ -2853,7 +2853,7 @@ proto_register_btpa(void) btpa_subdissector_table = register_dissector_table("btpa.port", "BTP-A port", proto_btpa, FT_UINT16, BASE_HEX); - btpa_heur_subdissector_list = register_heur_dissector_list("btpa.payload", proto_btpa); + btpa_heur_subdissector_list = register_heur_dissector_list_with_description("btpa.payload", "BTP-A payload fallback", proto_btpa); // Decode as static build_valid_func btpa_da_src_values[1] = {btpa_src_value}; @@ -2864,6 +2864,9 @@ proto_register_btpa(void) decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; register_decode_as(&btpa_da); + + btpa_tap = register_tap("btpa"); + btpa_follow_tap = register_tap("btpa_follow"); } void @@ -2872,9 +2875,6 @@ proto_reg_handoff_btpa(void) dissector_add_uint("geonw.ch.nh", 1, btpa_handle); find_dissector_add_dependency("gnw", proto_btpa); - - btpa_tap = register_tap("btpa"); - btpa_follow_tap = register_tap("btpa_follow"); } void @@ -2893,7 +2893,7 @@ proto_register_btpb(void) NULL, HFILL }}, }; - static gint *ett[] = { + static int *ett[] = { &ett_btpb, }; proto_btpb = proto_register_protocol("BTP-B", "BTPB", "btpb"); @@ -2906,7 +2906,7 @@ proto_register_btpb(void) btpb_subdissector_table = register_dissector_table("btpb.port", "BTP-B dst port", proto_btpb, FT_UINT16, BASE_HEX); - btpb_heur_subdissector_list = register_heur_dissector_list("btpb.payload", proto_btpb); + btpb_heur_subdissector_list = register_heur_dissector_list_with_description("btpb.payload", "BTP-B payload fallback", proto_btpb); // Decode as static build_valid_func btpb_da_build_value[1] = {btpb_dst_value}; @@ -2915,6 +2915,9 @@ proto_register_btpb(void) decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; register_decode_as(&btpb_da); + + btpb_tap = register_tap("btpb"); + btpb_follow_tap = register_tap("btpb_follow"); } void @@ -2923,14 +2926,11 @@ proto_reg_handoff_btpb(void) dissector_add_uint("geonw.ch.nh", 2, btpb_handle); find_dissector_add_dependency("gnw", proto_btpb); - - btpb_tap = register_tap("btpb"); - btpb_follow_tap = register_tap("btpb_follow"); } // Display functions static void -display_latitude( gchar *result, gint32 hexver ) +display_latitude( char *result, int32_t hexver ) { snprintf( result, ITEM_LABEL_LENGTH, "%ud%u'%.2f\"%c (%d)", abs(hexver)/10000000, @@ -2941,7 +2941,7 @@ display_latitude( gchar *result, gint32 hexver ) } static void -display_longitude( gchar *result, gint32 hexver ) +display_longitude( char *result, int32_t hexver ) { snprintf( result, ITEM_LABEL_LENGTH, "%ud%u'%.2f\"%c (%d)", abs(hexver)/10000000, @@ -2952,19 +2952,19 @@ display_longitude( gchar *result, gint32 hexver ) } static void -display_speed( gchar *result, gint32 hexver ) +display_speed( char *result, int32_t hexver ) { snprintf( result, ITEM_LABEL_LENGTH, "%.2f m/s", hexver/100.); } static void -display_heading( gchar *result, guint32 hexver ) +display_heading( char *result, uint32_t hexver ) { snprintf( result, ITEM_LABEL_LENGTH, "%.1f degrees", hexver/10.); } static void -display_elevation( gchar *result, gint32 hexver ) +display_elevation( char *result, int32_t hexver ) { // 0x0000 to 0xEFFF: positive numbers with a range from 0 to +6 143,9 meters. All numbers above +6 143,9 are // also represented by 0xEFFF. @@ -3195,7 +3195,7 @@ proto_register_geonw(void) { &hf_geonw_so_pv_time, { "Timestamp", "geonw.src_pos.tst", - FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x00, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x00, NULL, HFILL }}, { &hf_geonw_so_pv_lat, @@ -3241,7 +3241,7 @@ proto_register_geonw(void) { &hf_geonw_dccmco_output_power, { "Output power", "geonw.outpower", - FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_dbm, 0xf8, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_dbm), 0xf8, NULL, HFILL }}, { &hf_geonw_dccmco_reserved, @@ -3282,7 +3282,7 @@ proto_register_geonw(void) { &hf_geonw_de_pv_time, { "Timestamp", "geonw.dst_pos.tst", - FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x00, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x00, NULL, HFILL }}, { &hf_geonw_de_pv_lat, @@ -3308,22 +3308,22 @@ proto_register_geonw(void) { &hf_geonw_gxc_radius, { "Radius r", "geonw.gxc.radius", - FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_meters, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_meters), 0x00, NULL, HFILL }}, { &hf_geonw_gxc_distancea, { "Distance a", "geonw.gxc.distancea", - FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_meters, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_meters), 0x00, NULL, HFILL }}, { &hf_geonw_gxc_distanceb, { "Distance b", "geonw.gxc.distanceb", - FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_meters, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_meters), 0x00, NULL, HFILL }}, { &hf_geonw_gxc_angle, { "Angle", "geonw.gxc.angle", - FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_degree_degrees, 0x00, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_degree_degrees), 0x00, NULL, HFILL }}, { &hf_geonw_gxc_reserved, @@ -3600,7 +3600,7 @@ proto_register_geonw(void) { &ei_sgeonw_bogus, { "geonw.sec.bogus", PI_MALFORMED, PI_ERROR, "Malformed message (check length)", EXPFILL }}, { &ei_geonw_intx_too_big, { "geonw.intx_too_big", PI_MALFORMED, PI_ERROR, "IntX value exceeds 32 bits", EXPFILL }}, }; - static gint *ett[] = { + static int *ett[] = { &ett_geonw, &ett_geonw_bh, &ett_geonw_bh_lt, @@ -3663,6 +3663,8 @@ proto_register_geonw(void) &geonw_analyze_seq); geonw_hashtable = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), geonw_addr_hash, geonw_addr_cmp); + + geonw_tap = register_tap("geonw"); } void @@ -3680,8 +3682,6 @@ proto_reg_handoff_geonw(void) ipv6_handle = find_dissector("ipv6"); dissector_add_uint("geonw.ch.nh", 3, ipv6_handle); - geonw_tap = register_tap("geonw"); - ieee1609dot2_handle = find_dissector_add_dependency("ieee1609dot2.data", proto_geonw); dissector_add_uint("ieee1609dot2.psid", psid_den_basic_services, sgeonw_handle_); |