diff options
Diffstat (limited to 'epan/dissectors/packet-gsm_a_rp.c')
-rw-r--r-- | epan/dissectors/packet-gsm_a_rp.c | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/epan/dissectors/packet-gsm_a_rp.c b/epan/dissectors/packet-gsm_a_rp.c index f20e8a77..c3bb0777 100644 --- a/epan/dissectors/packet-gsm_a_rp.c +++ b/epan/dissectors/packet-gsm_a_rp.c @@ -23,7 +23,9 @@ #include <epan/packet.h> #include <epan/expert.h> #include <epan/proto_data.h> +#include <epan/tfs.h> #include <wsutil/wsjson.h> +#include <wsutil/array.h> #include "packet-gsm_a_common.h" #include "packet-media-type.h" @@ -68,41 +70,41 @@ static const value_string gsm_rp_elem_strings[] = { value_string_ext gsm_rp_elem_strings_ext = VALUE_STRING_EXT_INIT(gsm_rp_elem_strings); /* Initialize the protocol and registered fields */ -static int proto_a_rp = -1; +static int proto_a_rp; -static int hf_gsm_a_rp_msg_type = -1; -int hf_gsm_a_rp_elem_id = -1; +static int hf_gsm_a_rp_msg_type; +int hf_gsm_a_rp_elem_id; /* Generated from convert_proto_tree_add_text.pl */ -static int hf_gsm_a_rp_tpdu = -1; -static int hf_gsm_a_rp_extension = -1; -static int hf_gsm_a_rp_diagnostic_field = -1; -static int hf_gsm_a_rp_cause = -1; -static int hf_gsm_a_rp_message_elements = -1; -static int hf_gsm_a_rp_rp_message_reference = -1; +static int hf_gsm_a_rp_tpdu; +static int hf_gsm_a_rp_extension; +static int hf_gsm_a_rp_diagnostic_field; +static int hf_gsm_a_rp_cause; +static int hf_gsm_a_rp_message_elements; +static int hf_gsm_a_rp_rp_message_reference; /* Initialize the subtree pointers */ -static gint ett_rp_msg = -1; +static int ett_rp_msg; -static expert_field ei_gsm_a_rp_extraneous_data = EI_INIT; -static expert_field ei_gsm_a_rp_missing_mandatory_element = EI_INIT; +static expert_field ei_gsm_a_rp_extraneous_data; +static expert_field ei_gsm_a_rp_missing_mandatory_element; static dissector_handle_t gsm_sms_handle; /* SMS TPDU */ static dissector_handle_t gsm_a_dtap_handle; -static int proto_json = -1; +static int proto_json; static proto_tree *g_tree; -#define NUM_GSM_RP_ELEM (sizeof(gsm_rp_elem_strings)/sizeof(value_string)) -gint ett_gsm_rp_elem[NUM_GSM_RP_ELEM]; +#define NUM_GSM_RP_ELEM array_length(gsm_rp_elem_strings) +int ett_gsm_rp_elem[NUM_GSM_RP_ELEM]; /* * [5] 8.2.3 */ -static guint16 -de_rp_message_ref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) +static uint16_t +de_rp_message_ref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) { - guint32 curr_offset; + uint32_t curr_offset; curr_offset = offset; @@ -112,34 +114,34 @@ de_rp_message_ref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint /* no length check possible */ - return(curr_offset - offset); + return curr_offset - offset; } /* * [5] 8.2.5.1 */ -static guint16 -de_rp_orig_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) +static uint16_t +de_rp_orig_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string, int string_len) { - return(de_cld_party_bcd_num(tvb, tree, pinfo, offset, len, add_string, string_len)); + return de_cld_party_bcd_num(tvb, tree, pinfo, offset, len, add_string, string_len); } /* * [5] 8.2.5.2 */ -static guint16 -de_rp_dest_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) +static uint16_t +de_rp_dest_addr(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string, int string_len) { - return(de_cld_party_bcd_num(tvb, tree, pinfo, offset, len, add_string, string_len)); + return de_cld_party_bcd_num(tvb, tree, pinfo, offset, len, add_string, string_len); } /* * [5] 8.2.5.3 */ -static guint16 -de_rp_user_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_) +static uint16_t +de_rp_user_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_) { - guint32 curr_offset; + uint32_t curr_offset; tvbuff_t *tpdu_tvb; curr_offset = offset; @@ -157,7 +159,7 @@ de_rp_user_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 off EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_rp_extraneous_data); - return(curr_offset - offset); + return curr_offset - offset; } /* @@ -195,15 +197,15 @@ static value_string_ext gsm_rp_cause_vals_ext = VALUE_STRING_EXT_INIT(gsm_rp_cau static const true_false_string tfs_extended_no_extension = { "Extended", "No extension"}; -static guint16 -de_rp_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) +static uint16_t +de_rp_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string, int string_len) { - guint8 oct; - guint32 curr_offset; + uint8_t oct; + uint32_t curr_offset; curr_offset = offset; - oct = tvb_get_guint8(tvb, curr_offset); + oct = tvb_get_uint8(tvb, curr_offset); proto_tree_add_item(tree, hf_gsm_a_rp_extension, tvb, curr_offset, 1, ENC_NA); proto_tree_add_item(tree, hf_gsm_a_rp_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN); @@ -221,10 +223,10 @@ de_rp_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 off EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_rp_extraneous_data); - return(curr_offset - offset); + return curr_offset - offset; } -guint16 (*rp_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len) = { +uint16_t (*rp_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string, int string_len) = { /* Short Message Service Information Elements [5] 8.2 */ de_rp_message_ref, /* RP-Message Reference */ de_rp_orig_addr, /* RP-Originator Address */ @@ -240,11 +242,11 @@ guint16 (*rp_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gu * [5] 7.3.1.1 */ void -rp_data_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) +rp_data_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + uint32_t curr_offset; + uint32_t consumed; + unsigned curr_len; curr_offset = offset; curr_len = len; @@ -266,11 +268,11 @@ rp_data_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset * [5] 7.3.1.2 */ static void -rp_data_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) +rp_data_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + uint32_t curr_offset; + uint32_t consumed; + unsigned curr_len; curr_offset = offset; curr_len = len; @@ -292,11 +294,11 @@ rp_data_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset * [5] 7.3.2 */ static void -rp_smma(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) +rp_smma(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + uint32_t curr_offset; + uint32_t consumed; + unsigned curr_len; curr_offset = offset; curr_len = len; @@ -310,11 +312,11 @@ rp_smma(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, * [5] 7.3.3 */ static void -rp_ack_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) +rp_ack_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + uint32_t curr_offset; + uint32_t consumed; + unsigned curr_len; curr_offset = offset; curr_len = len; @@ -332,11 +334,11 @@ rp_ack_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, * [5] 7.3.3 */ static void -rp_ack_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) +rp_ack_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + uint32_t curr_offset; + uint32_t consumed; + unsigned curr_len; curr_offset = offset; curr_len = len; @@ -354,11 +356,11 @@ rp_ack_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, * [5] 7.3.4 */ static void -rp_error_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) +rp_error_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + uint32_t curr_offset; + uint32_t consumed; + unsigned curr_len; curr_offset = offset; curr_len = len; @@ -378,11 +380,11 @@ rp_error_n_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offse * [5] 7.3.4 */ static void -rp_error_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) +rp_error_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len) { - guint32 curr_offset; - guint32 consumed; - guint curr_len; + uint32_t curr_offset; + uint32_t consumed; + unsigned curr_len; curr_offset = offset; curr_len = len; @@ -398,9 +400,9 @@ rp_error_ms_n(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offse EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_rp_extraneous_data); } -#define NUM_GSM_RP_MSG (sizeof(gsm_rp_msg_strings)/sizeof(value_string)) -static gint ett_gsm_rp_msg[NUM_GSM_RP_MSG]; -static void (*rp_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len) = { +#define NUM_GSM_RP_MSG array_length(gsm_rp_msg_strings) +static int ett_gsm_rp_msg[NUM_GSM_RP_MSG]; +static void (*rp_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) = { rp_data_ms_n, /* RP-DATA (MS to Network) */ rp_data_n_ms, /* RP-DATA (Network to MS) */ rp_ack_ms_n, /* RP-ACK (MS to Network) */ @@ -416,13 +418,13 @@ static void (*rp_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo static int dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - guint8 oct; - guint32 offset, saved_offset; - guint32 len; - gint idx; + uint8_t oct; + uint32_t offset, saved_offset; + uint32_t len; + int idx; proto_item *rp_item = NULL; proto_tree *rp_tree = NULL; - const gchar *str; + const char *str; col_append_str(pinfo->cinfo, COL_INFO, "(RP) "); @@ -436,9 +438,9 @@ dissect_rp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) /* * add RP message name */ - oct = tvb_get_guint8(tvb, offset++); + oct = tvb_get_uint8(tvb, offset++); - str = try_val_to_str_idx((guint32) oct, gsm_rp_msg_strings, &idx); + str = try_val_to_str_idx((uint32_t) oct, gsm_rp_msg_strings, &idx); /* * create the protocol tree @@ -535,8 +537,8 @@ dissect_rp_media_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void void proto_register_gsm_a_rp(void) { - guint i; - guint last_offset; + unsigned i; + unsigned last_offset; /* Setup list of header fields */ @@ -570,7 +572,7 @@ proto_register_gsm_a_rp(void) /* Setup protocol subtree array */ #define NUM_INDIVIDUAL_ELEMS 1 - gint *ett[NUM_INDIVIDUAL_ELEMS + + int *ett[NUM_INDIVIDUAL_ELEMS + NUM_GSM_RP_MSG + NUM_GSM_RP_ELEM]; @@ -580,13 +582,11 @@ proto_register_gsm_a_rp(void) for (i=0; i < NUM_GSM_RP_MSG; i++, last_offset++) { - ett_gsm_rp_msg[i] = -1; ett[last_offset] = &ett_gsm_rp_msg[i]; } for (i=0; i < NUM_GSM_RP_ELEM; i++, last_offset++) { - ett_gsm_rp_elem[i] = -1; ett[last_offset] = &ett_gsm_rp_elem[i]; } |