diff options
Diffstat (limited to 'epan/dissectors/packet-componentstatus.c')
-rw-r--r-- | epan/dissectors/packet-componentstatus.c | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/epan/dissectors/packet-componentstatus.c b/epan/dissectors/packet-componentstatus.c index c34884c24b..0848c52cff 100644 --- a/epan/dissectors/packet-componentstatus.c +++ b/epan/dissectors/packet-componentstatus.c @@ -25,30 +25,32 @@ void proto_register_componentstatusprotocol(void); void proto_reg_handoff_componentstatusprotocol(void); +static dissector_handle_t componentstatusprotocol_handle; + /* Initialize the protocol and registered fields */ -static int proto_componentstatusprotocol = -1; +static int proto_componentstatusprotocol; static int tap_componentstatusprotocol = -1; /* Initialize the subtree pointers */ -static gint ett_componentstatusprotocol = -1; -static gint ett_message_flags = -1; -static gint ett_message_sender_id = -1; -static gint ett_cspreport_association_receiver_id = -1; -static gint ett_association = -1; +static gint ett_componentstatusprotocol; +static gint ett_message_flags; +static gint ett_message_sender_id; +static gint ett_cspreport_association_receiver_id; +static gint ett_association; #define COMPONENTSTATUSPROTOCOL_PORT 2960 /* Not IANA registered */ #define COMPONENTSTATUSPROTOCOL_VERSION 0x0200 -static int hf_message_type = -1; -static int hf_message_flags = -1; -static int hf_message_flags_final_bit = -1; -static int hf_message_length = -1; -static int hf_message_version = -1; -static int hf_message_sender_id = -1; -static int hf_message_sender_id_group = -1; -static int hf_message_sender_id_object = -1; -static int hf_message_sender_timestamp = -1; +static int hf_message_type; +static int hf_message_flags; +static int hf_message_flags_final_bit; +static int hf_message_length; +static int hf_message_version; +static int hf_message_sender_id; +static int hf_message_sender_id_group; +static int hf_message_sender_id_object; +static int hf_message_sender_timestamp; static guint64 componentstatusprotocol_total_msgs = 0; static guint64 componentstatusprotocol_total_bytes = 0; @@ -62,11 +64,11 @@ static const value_string message_type_values[] = { }; -static int hf_cspreport_report_interval = -1; -static int hf_cspreport_location = -1; -static int hf_cspreport_status = -1; -static int hf_cspreport_workload = -1; -static int hf_cspreport_associations = -1; +static int hf_cspreport_report_interval; +static int hf_cspreport_location; +static int hf_cspreport_status; +static int hf_cspreport_workload; +static int hf_cspreport_associations; #define CSPF_FINAL (1 << 0) static const true_false_string message_flags_final_bit = { @@ -90,13 +92,13 @@ static const value_string group_values[] = { #define CSR_GET_WORKLOAD(w) ((w == 0xffff) ? -1.0 : (float)(w / (float)0xfffe)) -static int hf_cspreport_association_receiver_id = -1; -static int hf_cspreport_association_receiver_id_group = -1; -static int hf_cspreport_association_receiver_id_object = -1; -static int hf_cspreport_association_duration = -1; -static int hf_cspreport_association_flags = -1; -static int hf_cspreport_association_protocolid = -1; -static int hf_cspreport_association_ppid = -1; +static int hf_cspreport_association_receiver_id; +static int hf_cspreport_association_receiver_id_group; +static int hf_cspreport_association_receiver_id_object; +static int hf_cspreport_association_duration; +static int hf_cspreport_association_flags; +static int hf_cspreport_association_protocolid; +static int hf_cspreport_association_ppid; /* Setup list of header fields */ @@ -178,8 +180,8 @@ dissect_componentstatusprotocol_cspreport_message(tvbuff_t *message_tvb, proto_t t.secs = (time_t)(interval / 1000000); t.nsecs = (int)((interval - 1000000 * t.secs) * 1000); proto_tree_add_time(message_tree, hf_cspreport_report_interval, message_tvb, 24, 4, &t); - proto_tree_add_item(message_tree, hf_cspreport_location, message_tvb, 28, 128, ENC_UTF_8|ENC_NA); - proto_tree_add_item(message_tree, hf_cspreport_status, message_tvb, 156, 128, ENC_UTF_8|ENC_NA); + proto_tree_add_item(message_tree, hf_cspreport_location, message_tvb, 28, 128, ENC_UTF_8); + proto_tree_add_item(message_tree, hf_cspreport_status, message_tvb, 156, 128, ENC_UTF_8); workload = (float)(100.0 * CSR_GET_WORKLOAD(tvb_get_ntohs(message_tvb, 284))); if(workload < 0.0) { /* Special value 0xffff -> -1.0 means "no load provided"! */ @@ -328,6 +330,7 @@ static void componentstatusprotocol_stat_init(stat_tap_table_ui* new_stat) table = stat_tap_init_table(table_name, num_fields, 0, NULL); stat_tap_add_table(new_stat, table); + memset(items, 0x0, sizeof(items)); /* Add a row for each value type */ while (message_type_values[i].strptr) { items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING; @@ -356,7 +359,7 @@ static void componentstatusprotocol_stat_init(stat_tap_table_ui* new_stat) } static tap_packet_status -componentstatusprotocol_stat_packet(void* tapdata, packet_info* pinfo _U_, epan_dissect_t* edt _U_, const void* data) +componentstatusprotocol_stat_packet(void* tapdata, packet_info* pinfo _U_, epan_dissect_t* edt _U_, const void* data, tap_flags_t flags _U_) { stat_data_t* stat_data = (stat_data_t*)tapdata; const tap_componentstatusprotocol_rec_t* tap_rec = (const tap_componentstatusprotocol_rec_t*)data; @@ -545,15 +548,15 @@ proto_register_componentstatusprotocol(void) proto_register_subtree_array(ett, array_length(ett)); tap_componentstatusprotocol = register_tap("componentstatusprotocol"); + /* Register the dissector */ + componentstatusprotocol_handle = register_dissector("componentstatusprotocol", dissect_componentstatusprotocol, proto_componentstatusprotocol); + register_stat_tap_table_ui(&componentstatusprotocol_stat_table); } void proto_reg_handoff_componentstatusprotocol(void) { - dissector_handle_t componentstatusprotocol_handle; - - componentstatusprotocol_handle = create_dissector_handle(dissect_componentstatusprotocol, proto_componentstatusprotocol); dissector_add_uint_with_preference("udp.port", COMPONENTSTATUSPROTOCOL_PORT, componentstatusprotocol_handle); } |