diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:26 +0000 |
commit | c4e8a3222648fcf22ca207f1815ebbf7cd144eeb (patch) | |
tree | 93d5c6aa93d9987680dd1adad5685e2ad698f223 /plugins/epan/wimaxasncp | |
parent | Adding upstream version 4.2.6. (diff) | |
download | wireshark-upstream.tar.xz wireshark-upstream.zip |
Adding upstream version 4.4.0.upstream/4.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugins/epan/wimaxasncp')
-rw-r--r-- | plugins/epan/wimaxasncp/packet-wimaxasncp.c | 352 | ||||
-rw-r--r-- | plugins/epan/wimaxasncp/wimaxasncp_dict.h | 24 | ||||
-rw-r--r-- | plugins/epan/wimaxasncp/wimaxasncp_dict.l | 84 |
3 files changed, 224 insertions, 236 deletions
diff --git a/plugins/epan/wimaxasncp/packet-wimaxasncp.c b/plugins/epan/wimaxasncp/packet-wimaxasncp.c index 4de30ff3..e5d6e6bb 100644 --- a/plugins/epan/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/epan/wimaxasncp/packet-wimaxasncp.c @@ -37,71 +37,71 @@ void proto_register_wimaxasncp(void); void proto_reg_handoff_wimaxasncp(void); /* Initialize the protocol and registered fields */ -static int proto_wimaxasncp = -1; -static int hf_wimaxasncp_version = -1; -static int hf_wimaxasncp_flags = -1; -static int hf_wimaxasncp_function_type = -1; -static int hf_wimaxasncp_op_id = -1; -static int hf_wimaxasncp_message_type = -1; -/* static int hf_wimaxasncp_qos_msg = -1; */ -/* static int hf_wimaxasncp_ho_control_msg = -1; */ -/* static int hf_wimaxasncp_data_path_control_msg = -1; */ -/* static int hf_wimaxasncp_context_delivery_msg = -1; */ -/* static int hf_wimaxasncp_r3_mobility_msg = -1; */ -/* static int hf_wimaxasncp_paging_msg = -1; */ -/* static int hf_wimaxasncp_rrm_msg = -1; */ -/* static int hf_wimaxasncp_authentication_msg = -1; */ -/* static int hf_wimaxasncp_ms_state_msg = -1; */ -/* static int hf_wimaxasncp_reauthentication_msg = -1; */ -/* static int hf_wimaxasncp_session_msg = -1; */ -static int hf_wimaxasncp_length = -1; -static int hf_wimaxasncp_msid = -1; -static int hf_wimaxasncp_reserved1 = -1; -static int hf_wimaxasncp_transaction_id = -1; -static int hf_wimaxasncp_reserved2 = -1; -/* static int hf_wimaxasncp_tlv = -1; */ -static int hf_wimaxasncp_tlv_type = -1; -static int hf_wimaxasncp_tlv_length = -1; -static int hf_wimaxasncp_tlv_value_bytes = -1; -static int hf_wimaxasncp_tlv_value_bitflags8 = -1; -static int hf_wimaxasncp_tlv_value_bitflags16 = -1; -static int hf_wimaxasncp_tlv_value_bitflags32 = -1; -/* static int hf_wimaxasncp_tlv_value_protocol = -1; */ -/* static int hf_wimaxasncp_tlv_value_vendor_id = -1; */ +static int proto_wimaxasncp; +static int hf_wimaxasncp_version; +static int hf_wimaxasncp_flags; +static int hf_wimaxasncp_function_type; +static int hf_wimaxasncp_op_id; +static int hf_wimaxasncp_message_type; +/* static int hf_wimaxasncp_qos_msg; */ +/* static int hf_wimaxasncp_ho_control_msg; */ +/* static int hf_wimaxasncp_data_path_control_msg; */ +/* static int hf_wimaxasncp_context_delivery_msg; */ +/* static int hf_wimaxasncp_r3_mobility_msg; */ +/* static int hf_wimaxasncp_paging_msg; */ +/* static int hf_wimaxasncp_rrm_msg; */ +/* static int hf_wimaxasncp_authentication_msg; */ +/* static int hf_wimaxasncp_ms_state_msg; */ +/* static int hf_wimaxasncp_reauthentication_msg; */ +/* static int hf_wimaxasncp_session_msg; */ +static int hf_wimaxasncp_length; +static int hf_wimaxasncp_msid; +static int hf_wimaxasncp_reserved1; +static int hf_wimaxasncp_transaction_id; +static int hf_wimaxasncp_reserved2; +/* static int hf_wimaxasncp_tlv; */ +static int hf_wimaxasncp_tlv_type; +static int hf_wimaxasncp_tlv_length; +static int hf_wimaxasncp_tlv_value_bytes; +static int hf_wimaxasncp_tlv_value_bitflags8; +static int hf_wimaxasncp_tlv_value_bitflags16; +static int hf_wimaxasncp_tlv_value_bitflags32; +/* static int hf_wimaxasncp_tlv_value_protocol; */ +/* static int hf_wimaxasncp_tlv_value_vendor_id; */ /* Preferences */ -static gboolean show_transaction_id_d_bit = FALSE; -static gboolean debug_enabled = FALSE; +static bool show_transaction_id_d_bit; +static bool debug_enabled; /* Default WiMAX ASN control protocol port */ #define WIMAXASNCP_DEF_UDP_PORT 2231 /* Initialize the subtree pointers */ -static gint ett_wimaxasncp = -1; -static gint ett_wimaxasncp_flags = -1; -static gint ett_wimaxasncp_tlv = -1; -static gint ett_wimaxasncp_tlv_value_bitflags8 = -1; -static gint ett_wimaxasncp_tlv_value_bitflags16 = -1; -static gint ett_wimaxasncp_tlv_value_bitflags32 = -1; -static gint ett_wimaxasncp_tlv_protocol_list = -1; -static gint ett_wimaxasncp_tlv_port_range_list = -1; -static gint ett_wimaxasncp_tlv_ip_address_mask_list = -1; -static gint ett_wimaxasncp_tlv_ip_address_mask = -1; -static gint ett_wimaxasncp_tlv_eap = -1; -static gint ett_wimaxasncp_tlv_vendor_specific_information_field = -1; -static gint ett_wimaxasncp_port_range = -1; - -static expert_field ei_wimaxasncp_tlv_type = EI_INIT; -static expert_field ei_wimaxasncp_function_type = EI_INIT; -static expert_field ei_wimaxasncp_op_id = EI_INIT; -static expert_field ei_wimaxasncp_message_type = EI_INIT; -static expert_field ei_wimaxasncp_length_bad = EI_INIT; +static int ett_wimaxasncp; +static int ett_wimaxasncp_flags; +static int ett_wimaxasncp_tlv; +static int ett_wimaxasncp_tlv_value_bitflags8; +static int ett_wimaxasncp_tlv_value_bitflags16; +static int ett_wimaxasncp_tlv_value_bitflags32; +static int ett_wimaxasncp_tlv_protocol_list; +static int ett_wimaxasncp_tlv_port_range_list; +static int ett_wimaxasncp_tlv_ip_address_mask_list; +static int ett_wimaxasncp_tlv_ip_address_mask; +static int ett_wimaxasncp_tlv_eap; +static int ett_wimaxasncp_tlv_vendor_specific_information_field; +static int ett_wimaxasncp_port_range; + +static expert_field ei_wimaxasncp_tlv_type; +static expert_field ei_wimaxasncp_function_type; +static expert_field ei_wimaxasncp_op_id; +static expert_field ei_wimaxasncp_message_type; +static expert_field ei_wimaxasncp_length_bad; /* Header size, up to, but not including, the TLV fields. */ #define WIMAXASNCP_HEADER_SIZE 20 -/* Offset to end of the length field in the headder. */ +/* Offset to end of the length field in the header. */ #define WIMAXASNCP_HEADER_LENGTH_END 6 #define WIMAXASNCP_BIT32(n) (1U << (31 - (n))) @@ -116,7 +116,7 @@ typedef struct { wmem_array_t* ett; } wimaxasncp_build_dict_t; -static wimaxasncp_dict_t *wimaxasncp_dict = NULL; +static wimaxasncp_dict_t *wimaxasncp_dict; wimaxasncp_build_dict_t wimaxasncp_build_dict; @@ -182,7 +182,7 @@ static const value_string wimaxasncp_op_id_vals[] = /* struct to hold a value_string tuple, per version */ typedef struct _ver_value_string { - guint32 since; + uint32_t since; value_string vs; } ver_value_string; @@ -402,7 +402,7 @@ static const ver_value_string wimaxasncp_ms_state_msg_vals[] = /* ------------------------------------------------------------------------- */ -/* note - function type 10-im_operation, was once used for re-authrntication */ +/* note - function type 10-im_operation, was once used for re-authentication */ static const ver_value_string wimaxasncp_im_operations_msg_vals[] = { {0, { 1, "AR_EAP_Start"}}, @@ -450,12 +450,12 @@ static const enum_val_t wimaxasncp_nwg_versions[] = { /* NWG version */ #define WIMAXASNCP_DEF_NWGVER WIMAXASNCP_NWGVER_R10_V121 -static guint global_wimaxasncp_nwg_ver = WIMAXASNCP_DEF_NWGVER; +static unsigned global_wimaxasncp_nwg_ver = WIMAXASNCP_DEF_NWGVER; /* ========================================================================= */ typedef struct { - guint8 function_type; + uint8_t function_type; const ver_value_string *vals; } wimaxasncp_func_msg_t; @@ -479,7 +479,7 @@ static const wimaxasncp_func_msg_t wimaxasncp_func_to_msg_vals_map[] = /* ========================================================================= */ static const wimaxasncp_dict_tlv_t *wimaxasncp_get_tlv_info( - guint16 type) + uint16_t type) { wimaxasncp_dict_tlv_t *res = NULL; @@ -514,9 +514,9 @@ static const wimaxasncp_dict_tlv_t *wimaxasncp_get_tlv_info( /* ========================================================================= */ -static const gchar *wimaxasncp_get_enum_name( +static const char *wimaxasncp_get_enum_name( const wimaxasncp_dict_tlv_t *tlv_info, - guint32 code) + uint32_t code) { if (tlv_info->enum_vs) { @@ -568,14 +568,14 @@ static void wimaxasncp_proto_tree_add_tlv_ipv4_value( tvbuff_t *tvb, proto_tree *tree, proto_item *tlv_item, - guint offset, + unsigned offset, const wimaxasncp_dict_tlv_t *tlv_info) { int hf_value; - guint32 ip; - const gchar *addr_res; + uint32_t ip; + const char *addr_res; - if (tlv_info->hf_ipv4 != -1) + if (tlv_info->hf_ipv4 > 0) { hf_value = tlv_info->hf_ipv4; } @@ -603,14 +603,14 @@ static void wimaxasncp_proto_tree_add_tlv_ipv6_value( tvbuff_t *tvb, proto_tree *tree, proto_item *tlv_item, - guint offset, + unsigned offset, const wimaxasncp_dict_tlv_t *tlv_info) { int hf_value; ws_in6_addr ip; - const gchar *addr_res; + const char *addr_res; - if (tlv_info->hf_ipv4 != -1) + if (tlv_info->hf_ipv4 > 0) { hf_value = tlv_info->hf_ipv6; } @@ -638,15 +638,15 @@ static void wimaxasncp_proto_tree_add_ether_value( tvbuff_t *tvb, proto_tree *tree, proto_item *tlv_item, - guint offset, - guint length, + unsigned offset, + unsigned length, const wimaxasncp_dict_tlv_t *tlv_info) { int hf_value; - const guint8 *p; - const gchar *ether_name; + const uint8_t *p; + const char *ether_name; - if (tlv_info->hf_bsid != -1) + if (tlv_info->hf_bsid > 0) { hf_value = tlv_info->hf_bsid; } @@ -678,10 +678,10 @@ static void wimaxasncp_dissect_tlv_value( proto_item *tlv_item, const wimaxasncp_dict_tlv_t *tlv_info) { - guint offset = 0; - guint length; - const guint max_show_bytes = 24; /* arbitrary */ - static const gchar *hex_note = "[hex]"; + unsigned offset = 0; + unsigned length; + const unsigned max_show_bytes = 24; /* arbitrary */ + static const char *hex_note = "[hex]"; length = tvb_reported_length(tvb); @@ -706,10 +706,10 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint8 value; - const gchar *s; + uint8_t value; + const char *s; - value = tvb_get_guint8(tvb, offset); + value = tvb_get_uint8(tvb, offset); s = wimaxasncp_get_enum_name(tlv_info, value); @@ -742,8 +742,8 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint16 value; - const gchar *s; + uint16_t value; + const char *s; value = tvb_get_ntohs(tvb, offset); @@ -778,8 +778,8 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint32 value; - const gchar *s; + uint32_t value; + const char *s; value = tvb_get_ntohl(tvb, offset); @@ -815,7 +815,7 @@ static void wimaxasncp_dissect_tlv_value( { if (tree) { - const gchar *s = tvb_get_string_enc(pinfo->pool, tvb, offset, length, ENC_ASCII); + const char *s = tvb_get_string_enc(pinfo->pool, tvb, offset, length, ENC_ASCII); proto_tree_add_string_format( tree, tlv_info->hf_value, @@ -855,10 +855,10 @@ static void wimaxasncp_dissect_tlv_value( { proto_tree *flags_tree; proto_item *item; - guint8 value; - guint i; + uint8_t value; + unsigned i; - value = tvb_get_guint8(tvb, offset); + value = tvb_get_uint8(tvb, offset); item = proto_tree_add_item( tree, tlv_info->hf_value, @@ -873,12 +873,12 @@ static void wimaxasncp_dissect_tlv_value( for (i = 0; i < 8; ++i) { - guint8 mask; + uint8_t mask; mask = 1U << (7 - i); if (value & mask) { - const gchar *s; + const char *s; s = wimaxasncp_get_enum_name(tlv_info, value & mask); @@ -910,8 +910,8 @@ static void wimaxasncp_dissect_tlv_value( { proto_tree *flags_tree; proto_item *item; - guint16 value; - guint i; + uint16_t value; + unsigned i; value = tvb_get_ntohs(tvb, offset); @@ -928,12 +928,12 @@ static void wimaxasncp_dissect_tlv_value( for (i = 0; i < 16; ++i) { - guint16 mask; + uint16_t mask; mask = 1U << (15 - i); if (value & mask) { - const gchar *s; + const char *s; s = wimaxasncp_get_enum_name(tlv_info, value & mask); @@ -965,8 +965,8 @@ static void wimaxasncp_dissect_tlv_value( { proto_tree *flags_tree; proto_item *item; - guint32 value; - guint i; + uint32_t value; + unsigned i; value = tvb_get_ntohl(tvb, offset); @@ -983,12 +983,12 @@ static void wimaxasncp_dissect_tlv_value( for (i = 0; i < 32; ++i) { - guint32 mask; + uint32_t mask; mask = 1U << (31 - i); if (value & mask) { - const gchar *s; + const char *s; s = wimaxasncp_get_enum_name(tlv_info, value & mask); proto_tree_add_uint_format( @@ -1049,7 +1049,7 @@ static void wimaxasncp_dissect_tlv_value( tvb, offset, length, ENC_NA); if (length) { - const gchar* format; + const char* format; if (length <= max_show_bytes) { format = " - %s"; @@ -1058,7 +1058,7 @@ static void wimaxasncp_dissect_tlv_value( { format = " - %s..."; } - const gchar* s = tvb_bytes_to_str_punct( + const char* s = tvb_bytes_to_str_punct( pinfo->pool, tvb, offset, MIN(length, max_show_bytes), 0); proto_item_append_text( @@ -1080,9 +1080,9 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint8 value; + uint8_t value; - value = tvb_get_guint8(tvb, offset); + value = tvb_get_uint8(tvb, offset); proto_tree_add_uint_format( tree, tlv_info->hf_value, @@ -1104,7 +1104,7 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint16 value; + uint16_t value; value = tvb_get_ntohs(tvb, offset); @@ -1128,7 +1128,7 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint32 value; + uint32_t value; value = tvb_get_ntohl(tvb, offset); @@ -1152,9 +1152,9 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint8 value; + uint8_t value; - value = tvb_get_guint8(tvb, offset); + value = tvb_get_uint8(tvb, offset); proto_tree_add_uint_format( tree, tlv_info->hf_value, @@ -1176,7 +1176,7 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint16 value; + uint16_t value; value = tvb_get_ntohs(tvb, offset); @@ -1200,7 +1200,7 @@ static void wimaxasncp_dissect_tlv_value( if (tree) { - guint32 value; + uint32_t value; value = tvb_get_ntohl(tvb, offset); @@ -1306,7 +1306,7 @@ static void wimaxasncp_dissect_tlv_value( { proto_tree *protocol_list_tree; proto_item *item; - const guint max_protocols_in_tlv_item = 8; /* arbitrary */ + const unsigned max_protocols_in_tlv_item = 8; /* arbitrary */ protocol_list_tree = proto_tree_add_subtree( tree, tvb, offset, length, @@ -1321,8 +1321,8 @@ static void wimaxasncp_dissect_tlv_value( while (offset < tvb_reported_length(tvb)) { - guint16 protocol; - const gchar *protocol_name; + uint16_t protocol; + const char *protocol_name; protocol = tvb_get_ntohs(tvb, offset); protocol_name = ipprotostr(protocol); @@ -1363,7 +1363,7 @@ static void wimaxasncp_dissect_tlv_value( { proto_tree *port_range_list_tree; proto_item *item; - const guint max_port_ranges_in_tlv_item = 3; /* arbitrary */ + const unsigned max_port_ranges_in_tlv_item = 3; /* arbitrary */ port_range_list_tree = proto_tree_add_subtree( tree, tvb, offset, length, @@ -1378,8 +1378,8 @@ static void wimaxasncp_dissect_tlv_value( while (offset < tvb_reported_length(tvb)) { - guint16 portLow; - guint16 portHigh; + uint16_t portLow; + uint16_t portHigh; proto_tree* range_tree; portLow = tvb_get_ntohs(tvb, offset); @@ -1519,8 +1519,8 @@ static void wimaxasncp_dissect_tlv_value( while (offset < tvb_reported_length(tvb)) { proto_tree *ip_address_mask_tree; - guint32 ip; - const gchar *s; + uint32_t ip; + const char *s; ip_address_mask_tree = proto_tree_add_subtree( ip_address_mask_list_tree, tvb, offset, 8, @@ -1571,15 +1571,15 @@ static void wimaxasncp_dissect_tlv_value( /* * EAP payload, call eap dissector to dissect eap payload */ - guint8 eap_code; - guint8 eap_type = 0; + uint8_t eap_code; + uint8_t eap_type = 0; /* Get code */ - eap_code = tvb_get_guint8(tvb, offset); + eap_code = tvb_get_uint8(tvb, offset); if (eap_code == EAP_REQUEST || eap_code == EAP_RESPONSE) { /* Get type */ - eap_type = tvb_get_guint8(tvb, offset + 4); + eap_type = tvb_get_uint8(tvb, offset + 4); } /* Add code and type to info column */ @@ -1600,7 +1600,7 @@ static void wimaxasncp_dissect_tlv_value( { proto_tree *eap_tree; proto_item *item; - gboolean save_writable; + bool save_writable; tvbuff_t *eap_tvb; /* Create EAP subtree */ @@ -1627,7 +1627,7 @@ static void wimaxasncp_dissect_tlv_value( /* Disable writing to info column while calling eap dissector */ save_writable = col_get_writable(pinfo->cinfo, -1); - col_set_writable(pinfo->cinfo, -1, FALSE); + col_set_writable(pinfo->cinfo, -1, false); /* Call the EAP dissector. */ call_dissector(eap_handle, eap_tvb, pinfo, eap_tree); @@ -1664,8 +1664,8 @@ static void wimaxasncp_dissect_tlv_value( { proto_tree *vsif_tree; proto_item *item; - guint32 vendorId; - const gchar *vendorName; + uint32_t vendorId; + const char *vendorName; vsif_tree = proto_tree_add_subtree( tree, tvb, offset, length, @@ -1790,12 +1790,12 @@ static void wimaxasncp_dissect_tlv_value( /* ========================================================================= */ // NOLINTNEXTLINE(misc-no-recursion) -static guint dissect_wimaxasncp_tlvs( +static unsigned dissect_wimaxasncp_tlvs( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - guint offset; + unsigned offset; offset = 0; while (offset < tvb_reported_length(tvb)) @@ -1804,9 +1804,9 @@ static guint dissect_wimaxasncp_tlvs( proto_tree *tlv_tree; proto_item *tlv_item; - guint16 type; - guint16 length; - guint pad; + uint16_t type; + uint16_t length; + unsigned pad; /* -------------------------------------------------------------------- * type and length @@ -1829,8 +1829,8 @@ static guint dissect_wimaxasncp_tlvs( { proto_item *type_item; - gint tree_length = MIN( - (gint)(4 + length + pad), tvb_captured_length_remaining(tvb, offset)); + int tree_length = MIN( + (int)(4 + length + pad), tvb_captured_length_remaining(tvb, offset)); tlv_item = proto_tree_add_item( tree, tlv_info->hf_root, @@ -1931,17 +1931,17 @@ static guint dissect_wimaxasncp_tlvs( /* ========================================================================= */ -static guint dissect_wimaxasncp_backend( +static unsigned dissect_wimaxasncp_backend( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - guint offset = 0; - guint16 ui16; - guint32 ui32; - const guint8 *pmsid; - guint16 tid = 0; - gboolean dbit_show; + unsigned offset = 0; + uint16_t ui16; + uint32_t ui32; + const uint8_t *pmsid; + uint16_t tid = 0; + bool dbit_show; /* ------------------------------------------------------------------------ @@ -1980,12 +1980,12 @@ static guint dissect_wimaxasncp_backend( * ------------------------------------------------------------------------ */ - dbit_show = FALSE; + dbit_show = false; ui16 = tvb_get_ntohs(tvb, offset); if (show_transaction_id_d_bit) { - const guint16 mask = 0x7fff; + const uint16_t mask = 0x7fff; if (ui16 & 0x8000) { @@ -1995,7 +1995,7 @@ static guint dissect_wimaxasncp_backend( "Transaction ID: D + 0x%04x (0x%04x)", mask & ui16, ui16); tid = ui16 & mask; - dbit_show = TRUE; + dbit_show = true; } else { @@ -2064,11 +2064,11 @@ static guint dissect_wimaxasncp_backend( /* ========================================================================= */ -static const gchar* +static const char* match_ver_value_string( - const guint32 val, + const uint32_t val, const ver_value_string* const strings, - const guint32 max_ver) + const uint32_t max_ver) { const ver_value_string* vvs; const ver_value_string* res = NULL; @@ -2095,7 +2095,7 @@ dissect_wimaxasncp( proto_tree *tree, void *data _U_) { - static const gchar unknown[] = "Unknown"; + static const char unknown[] = "Unknown"; /* Set up structures needed to add the protocol subtree and manage it */ proto_item *packet_item = NULL; @@ -2103,17 +2103,17 @@ dissect_wimaxasncp( proto_tree *wimaxasncp_tree = NULL; tvbuff_t *subtree; - guint offset; - guint8 ui8; + unsigned offset; + uint8_t ui8; - guint8 function_type; - const gchar *function_type_name; + uint8_t function_type; + const char *function_type_name; proto_item *function_type_item; - guint16 length; + uint16_t length; const wimaxasncp_func_msg_t *p = NULL; - const gchar *message_name; - gsize i; + const char *message_name; + size_t i; /* ------------------------------------------------------------------------ * First, we do some heuristics to check if the packet cannot be our @@ -2131,7 +2131,7 @@ dissect_wimaxasncp( #endif /* We currently only support version 1. */ - if (tvb_bytes_exist(tvb, 0, 1) && tvb_get_guint8(tvb, 0) != 1) + if (tvb_bytes_exist(tvb, 0, 1) && tvb_get_uint8(tvb, 0) != 1) { return 0; } @@ -2162,7 +2162,7 @@ dissect_wimaxasncp( offset = 0; /* Register protocol fields, etc if haven't done yet. */ - if (hf_wimaxasncp_version == -1) + if (hf_wimaxasncp_version <= 0) { proto_registrar_get_byname("wimaxasncp.version"); } @@ -2196,7 +2196,7 @@ dissect_wimaxasncp( * ------------------------------------------------------------------------ */ - ui8 = tvb_get_guint8(tvb, offset); + ui8 = tvb_get_uint8(tvb, offset); if (tree) { @@ -2211,7 +2211,7 @@ dissect_wimaxasncp( } else { - guint j; + unsigned j; item = proto_tree_add_uint_format( wimaxasncp_tree, hf_wimaxasncp_flags, tvb, offset, 1, ui8, @@ -2239,7 +2239,7 @@ dissect_wimaxasncp( for (j = 0; j < 8; ++j) { - guint8 mask; + uint8_t mask; mask = 1U << (7 - j); /* Only add flags that are set */ @@ -2264,7 +2264,7 @@ dissect_wimaxasncp( * ------------------------------------------------------------------------ */ - function_type = tvb_get_guint8(tvb, offset); + function_type = tvb_get_uint8(tvb, offset); function_type_name = match_ver_value_string(function_type, wimaxasncp_function_type_vals, @@ -2299,7 +2299,7 @@ dissect_wimaxasncp( * ------------------------------------------------------------------------ */ - ui8 = tvb_get_guint8(tvb, offset); + ui8 = tvb_get_uint8(tvb, offset); /* -------------------------------------------------------------------- @@ -2776,10 +2776,10 @@ static void add_tlv_reg_info( static void register_wimaxasncp_fields(const char* unused _U_) { - gboolean debug_parser; - gboolean dump_dict; - gchar *dir; - gchar* dict_error; + bool debug_parser; + bool dump_dict; + char *dir; + char* dict_error; /* ------------------------------------------------------------------------ * List of header fields @@ -2788,16 +2788,16 @@ register_wimaxasncp_fields(const char* unused _U_) static hf_register_info hf_base[] = { { - &hf_wimaxasncp_version, /* ID */ + &hf_wimaxasncp_version, { - "Version", /* FIELDNAME */ - "wimaxasncp.version", /* PROTOABBREV.FIELDABBRE */ - FT_UINT8, /* FIELDTYPE */ - BASE_DEC, /* FIELDBASE */ - NULL, /* FIELDCONVERT */ - 0x0, /* BITMASK */ - NULL, /* FIELDDESCR */ - HFILL /* HFILL */ + "Version", + "wimaxasncp.version", + FT_UINT8, + BASE_DEC, + NULL, + 0x0, + NULL, + HFILL } }, { @@ -3212,7 +3212,7 @@ register_wimaxasncp_fields(const char* unused _U_) * ------------------------------------------------------------------------ */ - static gint *ett_base[] = { + static int *ett_base[] = { &ett_wimaxasncp, &ett_wimaxasncp_flags, &ett_wimaxasncp_tlv, @@ -3278,7 +3278,7 @@ register_wimaxasncp_fields(const char* unused _U_) wimaxasncp_build_dict.hf, hf_base, array_length(hf_base)); wimaxasncp_build_dict.ett = - wmem_array_new(wmem_epan_scope(), sizeof(gint*)); + wmem_array_new(wmem_epan_scope(), sizeof(int*)); wmem_array_append( wimaxasncp_build_dict.ett, ett_base, array_length(ett_base)); @@ -3373,7 +3373,7 @@ register_wimaxasncp_fields(const char* unused _U_) wmem_array_get_count(wimaxasncp_build_dict.hf)); proto_register_subtree_array( - (gint**)wmem_array_get_raw(wimaxasncp_build_dict.ett), + (int**)wmem_array_get_raw(wimaxasncp_build_dict.ett), wmem_array_get_count(wimaxasncp_build_dict.ett)); expert_wimaxasncp = expert_register_protocol(proto_wimaxasncp); @@ -3432,7 +3432,7 @@ proto_register_wimaxasncp(void) "Version of the NWG that the R6 protocol complies with", &global_wimaxasncp_nwg_ver, wimaxasncp_nwg_versions, - FALSE); + false); proto_register_prefix("wimaxasncp", register_wimaxasncp_fields); } diff --git a/plugins/epan/wimaxasncp/wimaxasncp_dict.h b/plugins/epan/wimaxasncp/wimaxasncp_dict.h index 6f136522..fffb9965 100644 --- a/plugins/epan/wimaxasncp/wimaxasncp_dict.h +++ b/plugins/epan/wimaxasncp/wimaxasncp_dict.h @@ -59,19 +59,19 @@ enum * ------------------------------------------------------------------------- */ struct _wimaxasncp_dict_namecode_t { - gchar *name; - guint code; + char *name; + unsigned code; struct _wimaxasncp_dict_namecode_t *next; }; typedef struct _wimaxasncp_dict_namecode_t wimaxasncp_dict_enum_t; typedef struct _wimaxasncp_dict_tlv_t { - guint16 type; - gchar *name; - gchar *description; - gint decoder; - guint since; + uint16_t type; + char *name; + char *description; + int decoder; + unsigned since; int hf_root; int hf_value; int hf_ipv4; @@ -90,9 +90,9 @@ typedef struct _wimaxasncp_dict_tlv_t { } wimaxasncp_dict_tlv_t; typedef struct _wimaxasncp_dict_xmlpi_t { - gchar *name; - gchar *key; - gchar *value; + char *name; + char *key; + char *value; struct _wimaxasncp_dict_xmlpi_t *next; } wimaxasncp_dict_xmlpi_t; @@ -105,8 +105,8 @@ extern void wimaxasncp_dict_print( FILE *fh, wimaxasncp_dict_t *d); extern wimaxasncp_dict_t *wimaxasncp_dict_scan( - const gchar *system_directory, const gchar *filename, int dbg, - gchar **error); + const char *system_directory, const char *filename, int dbg, + char **error); extern void wimaxasncp_dict_free( wimaxasncp_dict_t *d); diff --git a/plugins/epan/wimaxasncp/wimaxasncp_dict.l b/plugins/epan/wimaxasncp/wimaxasncp_dict.l index 05fa2e51..ca8cf99d 100644 --- a/plugins/epan/wimaxasncp/wimaxasncp_dict.l +++ b/plugins/epan/wimaxasncp/wimaxasncp_dict.l @@ -107,8 +107,8 @@ DIAG_OFF_FLEX() typedef struct entity_t { - gchar *name; - gchar *file; + char *name; + char *file; struct entity_t *next; } entity_t; @@ -132,14 +132,14 @@ typedef struct entity_t { typedef struct { GString *dict_error; - const gchar *sys_dir; + const char *sys_dir; - gchar *strbuf; - guint size_strbuf; - guint len_strbuf; + char *strbuf; + unsigned size_strbuf; + unsigned len_strbuf; - gchar *write_ptr; - gchar *read_ptr; + char *write_ptr; + char *read_ptr; wimaxasncp_dict_t *dict; wimaxasncp_dict_tlv_t *tlv; @@ -154,20 +154,20 @@ typedef struct { YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int include_stack_ptr; - size_t (*current_yyinput)(gchar*,size_t,yyscan_t); + size_t (*current_yyinput)(char*,size_t,yyscan_t); - gchar **attr_str; - guint *attr_uint; - gint16 *attr_uint16; + char **attr_str; + unsigned *attr_uint; + int16_t *attr_uint16; int start_state; } WimaxasncpDict_scanner_state_t; -static guint wimaxasncp_bits(guint bits, char *n); -static gint wimaxasncp_decode_type(const gchar *name); -static void wimaxasncp_dict_debug(const gchar *fmt, ...) G_GNUC_PRINTF(1, 2); -static void append_to_buffer(const gchar *txt, int len, WimaxasncpDict_scanner_state_t *state); -static FILE *wimaxasncp_dict_open(const gchar*, const gchar*); +static unsigned wimaxasncp_bits(unsigned bits, char *n); +static int wimaxasncp_decode_type(const char *name); +static void wimaxasncp_dict_debug(const char *fmt, ...) G_GNUC_PRINTF(1, 2); +static void append_to_buffer(const char *txt, int len, WimaxasncpDict_scanner_state_t *state); +static FILE *wimaxasncp_dict_open(const char*, const char*); /* * Sleazy hack to suppress compiler warnings in yy_fatal_error(). @@ -314,7 +314,7 @@ since_attr since=\042 <LOADING>{any} APPEND(yytext,yyleng); <LOADING,IN_DICT>{entity} { - gchar *p = ++yytext, *temp_str; + char *p = ++yytext, *temp_str; entity_t* e; while(*p != ';') p++; @@ -381,14 +381,14 @@ since_attr since=\042 } <GET_UINT_ATTR>{number} { - *yyextra->attr_uint = (guint)strtoul(yytext,NULL,0); + *yyextra->attr_uint = (unsigned)strtoul(yytext,NULL,0); D(("%s\n",yytext);); yyextra->attr_uint = NULL; BEGIN END_ATTR; } <GET_UINT16_ATTR>{number} { - *yyextra->attr_uint16 = (gint16) strtol(yytext,NULL,0); + *yyextra->attr_uint16 = (int16_t) strtol(yytext,NULL,0); D(("%s\n",yytext);); yyextra->attr_uint16 = NULL; BEGIN END_ATTR; @@ -449,18 +449,6 @@ since_attr since=\042 D(("tlv_start\n")); yyextra->tlv = wmem_new0(wmem_epan_scope(), wimaxasncp_dict_tlv_t); - yyextra->tlv->hf_root = -1; - yyextra->tlv->hf_value = -1; - yyextra->tlv->hf_ipv4 = -1; - yyextra->tlv->hf_ipv6 = -1; - yyextra->tlv->hf_bsid = -1; - yyextra->tlv->hf_protocol = -1; - yyextra->tlv->hf_port_low = -1; - yyextra->tlv->hf_port_high = -1; - yyextra->tlv->hf_ipv4_mask = -1; - yyextra->tlv->hf_ipv6_mask = -1; - yyextra->tlv->hf_vendor_id = -1; - yyextra->tlv->hf_vendor_rest_of_info = -1; if (! yyextra->dict->tlvs ) yyextra->last_tlv = yyextra->dict->tlvs = yyextra->tlv; @@ -521,7 +509,7 @@ DIAG_ON_FLEX() static int debugging = 0; -static void wimaxasncp_dict_debug(const gchar *fmt, ...) { +static void wimaxasncp_dict_debug(const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -531,7 +519,7 @@ static void wimaxasncp_dict_debug(const gchar *fmt, ...) { fflush(stderr); } -static guint wimaxasncp_bits(guint bits, char *n) +static unsigned wimaxasncp_bits(unsigned bits, char *n) { return 1u << ((bits - 1) - (strtoul(n, NULL, 10))); } @@ -567,9 +555,9 @@ static const value_string wimaxasncp_decode_type_vals[] = { 0, NULL} }; -static gint wimaxasncp_decode_type(const gchar *name) +static int wimaxasncp_decode_type(const char *name) { - gsize i; + size_t i; for (i = 0; i < array_length(wimaxasncp_decode_type_vals) - 1; ++i) { if (strcmp(name, wimaxasncp_decode_type_vals[i].strptr) == 0) @@ -588,14 +576,14 @@ void wimaxasncp_dict_unused(yyscan_t yyscanner) { yy_top_state(yyscanner); } -static void append_to_buffer(const gchar *txt, int len, WimaxasncpDict_scanner_state_t *state) { +static void append_to_buffer(const char *txt, int len, WimaxasncpDict_scanner_state_t *state) { if (state->strbuf == NULL) { - state->read_ptr = state->write_ptr = state->strbuf = (gchar *)g_malloc(state->size_strbuf); + state->read_ptr = state->write_ptr = state->strbuf = (char *)g_malloc(state->size_strbuf); } if (state->len_strbuf + len >= state->size_strbuf) { - state->read_ptr = state->strbuf = (gchar *)g_realloc(state->strbuf,state->size_strbuf *= 2); + state->read_ptr = state->strbuf = (char *)g_realloc(state->strbuf,state->size_strbuf *= 2); } state->write_ptr = state->strbuf + state->len_strbuf; @@ -603,7 +591,7 @@ static void append_to_buffer(const gchar *txt, int len, WimaxasncpDict_scanner_s state->len_strbuf += len; } -static size_t file_input(gchar *buf, size_t max, yyscan_t scanner) { +static size_t file_input(char *buf, size_t max, yyscan_t scanner) { FILE *in = yyget_in(scanner); size_t read_cnt; @@ -619,7 +607,7 @@ static size_t file_input(gchar *buf, size_t max, yyscan_t scanner) { } -static size_t string_input(gchar *buf, size_t max, yyscan_t scanner) { +static size_t string_input(char *buf, size_t max, yyscan_t scanner) { WimaxasncpDict_scanner_state_t *statep = yyget_extra(scanner); if (statep->read_ptr >= statep->write_ptr ) { @@ -635,11 +623,11 @@ static size_t string_input(gchar *buf, size_t max, yyscan_t scanner) { } static FILE *wimaxasncp_dict_open( - const gchar *system_directory, - const gchar *filename) + const char *system_directory, + const char *filename) { FILE *fh; - gchar *fname; + char *fname; if (system_directory) { fname = ws_strdup_printf("%s%s%s", @@ -661,8 +649,8 @@ static FILE *wimaxasncp_dict_open( } wimaxasncp_dict_t *wimaxasncp_dict_scan( - const gchar *system_directory, const gchar *filename, int dbg, - gchar **error) { + const char *system_directory, const char *filename, int dbg, + char **error) { WimaxasncpDict_scanner_state_t state; FILE *in; @@ -837,8 +825,8 @@ void wimaxasncp_dict_print(FILE *fh, wimaxasncp_dict_t *d) { #ifdef TEST_WIMAXASNCP_DICT_STANDALONE int main(int argc, char **argv) { wimaxasncp_dict_t *d; - gchar *dname = NULL; - gchar *fname; + char *dname = NULL; + char *fname; int i = 1; switch (argc) { |