diff options
Diffstat (limited to 'epan/dissectors/packet-megaco.c')
-rw-r--r-- | epan/dissectors/packet-megaco.c | 358 |
1 files changed, 161 insertions, 197 deletions
diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index c13fabee63..30f7a1b3a6 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -39,13 +39,14 @@ #include <epan/exported_pdu.h> #include <epan/asn1.h> #include <epan/sctpppids.h> +#include <epan/charsets.h> #include <wsutil/strtoi.h> #include "packet-ber.h" #include "packet-tpkt.h" #include "packet-h245.h" #include "packet-h248.h" #include "packet-ip.h" -#include "packet-http.h" +#include "packet-media-type.h" #include "packet-sdp.h" void proto_register_megaco(void); @@ -58,113 +59,113 @@ static pref_t *sip_hide_generated_call_ids; /* Define the megaco proto */ -static int proto_megaco = -1; +static int proto_megaco; /* Define headers for megaco */ -static int hf_megaco_start = -1; -static int hf_megaco_version = -1; -static int hf_megaco_transaction = -1; -static int hf_megaco_transid = -1; -static int hf_megaco_Context = -1; -/* static int hf_megaco_command_line = -1; */ -static int hf_megaco_command = -1; -static int hf_megaco_command_optional = -1; -static int hf_megaco_wildcard_response = -1; -static int hf_megaco_termid = -1; +static int hf_megaco_start; +static int hf_megaco_version; +static int hf_megaco_transaction; +static int hf_megaco_transid; +static int hf_megaco_Context; +/* static int hf_megaco_command_line; */ +static int hf_megaco_command; +static int hf_megaco_command_optional; +static int hf_megaco_wildcard_response; +static int hf_megaco_termid; /* Define headers in subtree for megaco */ -static int hf_megaco_modem_descriptor = -1; -static int hf_megaco_multiplex_descriptor = -1; -static int hf_megaco_media_descriptor = -1; -static int hf_megaco_Local_descriptor = -1; -static int hf_megaco_events_descriptor = -1; -static int hf_megaco_signal_descriptor = -1; -static int hf_megaco_audit_descriptor = -1; -/* static int hf_megaco_servicechange_descriptor = -1; */ -static int hf_megaco_digitmap_descriptor = -1; -static int hf_megaco_statistics_descriptor = -1; -static int hf_megaco_observedevents_descriptor = -1; -static int hf_megaco_topology_descriptor = -1; -static int hf_megaco_error_descriptor = -1; -static int hf_megaco_error_code = -1; -static int hf_megaco_error_string = -1; -static int hf_megaco_TerminationState_descriptor= -1; -static int hf_megaco_Remote_descriptor = -1; -static int hf_megaco_LocalControl_descriptor = -1; -static int hf_megaco_packages_descriptor = -1; -static int hf_megaco_Service_State = -1; -static int hf_megaco_Event_Buffer_Control = -1; -static int hf_megaco_mode = -1; -static int hf_megaco_reserve_group = -1; -static int hf_megaco_h324_muxtbl_in = -1; -static int hf_megaco_h324_muxtbl_out = -1; -static int hf_megaco_ds_dscp = -1; -static int hf_megaco_gm_saf = -1; -static int hf_megaco_gm_sam = -1; -static int hf_megaco_gm_spf = -1; -static int hf_megaco_gm_spr = -1; -static int hf_megaco_gm_esas = -1; -static int hf_megaco_tman_pol = -1; -static int hf_megaco_gm_rsb = -1; -static int hf_megaco_tman_sdr = -1; -static int hf_megaco_tman_mbs = -1; -static int hf_megaco_tman_pdr = -1; -static int hf_megaco_tman_dvt = -1; -static int hf_megaco_ipdc_realm = -1; -static int hf_megaco_h324_h223capr = -1; -static int hf_megaco_reserve_value = -1; -static int hf_megaco_streamid = -1; -static int hf_megaco_requestid = -1; -static int hf_megaco_pkgdname = -1; -static int hf_megaco_mId = -1; -static int hf_megaco_h245 = -1; -static int hf_megaco_h223Capability = -1; -static int hf_megaco_audititem = -1; -static int hf_megaco_priority = -1; +static int hf_megaco_modem_descriptor; +static int hf_megaco_multiplex_descriptor; +static int hf_megaco_media_descriptor; +static int hf_megaco_Local_descriptor; +static int hf_megaco_events_descriptor; +static int hf_megaco_signal_descriptor; +static int hf_megaco_audit_descriptor; +/* static int hf_megaco_servicechange_descriptor; */ +static int hf_megaco_digitmap_descriptor; +static int hf_megaco_statistics_descriptor; +static int hf_megaco_observedevents_descriptor; +static int hf_megaco_topology_descriptor; +static int hf_megaco_error_descriptor; +static int hf_megaco_error_code; +static int hf_megaco_error_string; +static int hf_megaco_TerminationState_descriptor; +static int hf_megaco_Remote_descriptor; +static int hf_megaco_LocalControl_descriptor; +static int hf_megaco_packages_descriptor; +static int hf_megaco_Service_State; +static int hf_megaco_Event_Buffer_Control; +static int hf_megaco_mode; +static int hf_megaco_reserve_group; +static int hf_megaco_h324_muxtbl_in; +static int hf_megaco_h324_muxtbl_out; +static int hf_megaco_ds_dscp; +static int hf_megaco_gm_saf; +static int hf_megaco_gm_sam; +static int hf_megaco_gm_spf; +static int hf_megaco_gm_spr; +static int hf_megaco_gm_esas; +static int hf_megaco_tman_pol; +static int hf_megaco_gm_rsb; +static int hf_megaco_tman_sdr; +static int hf_megaco_tman_mbs; +static int hf_megaco_tman_pdr; +static int hf_megaco_tman_dvt; +static int hf_megaco_ipdc_realm; +static int hf_megaco_h324_h223capr; +static int hf_megaco_reserve_value; +static int hf_megaco_streamid; +static int hf_megaco_requestid; +static int hf_megaco_pkgdname; +static int hf_megaco_mId; +static int hf_megaco_h245; +static int hf_megaco_h223Capability; +static int hf_megaco_audititem; +static int hf_megaco_priority; /* Define the trees for megaco */ -static int ett_megaco = -1; -static int ett_megaco_message = -1; -static int ett_megaco_message_body = -1; -static int ett_megaco_context = -1; -static int ett_megaco_command_line = -1; -static int ett_megaco_mediadescriptor = -1; -static int ett_megaco_descriptors = -1; -static int ett_megaco_raw_text = -1; -static int ett_megaco_error_descriptor = -1; -static int ett_megaco_TerminationState = -1; -static int ett_megaco_Localdescriptor = -1; -static int ett_megaco_Remotedescriptor = -1; -static int ett_megaco_LocalControldescriptor = -1; -static int ett_megaco_auditdescriptor = -1; -static int ett_megaco_eventsdescriptor = -1; -static int ett_megaco_statisticsdescriptor = -1; -static int ett_megaco_observedeventsdescriptor = -1; -static int ett_megaco_observedevent = -1; -static int ett_megaco_packagesdescriptor = -1; -static int ett_megaco_requestedevent = -1; -static int ett_megaco_signalsdescriptor = -1; -static int ett_megaco_requestedsignal = -1; -static int ett_megaco_h245 = -1; - -static gcp_hf_ett_t megaco_ctx_ids = {{-1,-1,-1,-1,-1,-1},{-1,-1,-1,-1}}; - -static expert_field ei_megaco_errored_command = EI_INIT; -static expert_field ei_megaco_no_command = EI_INIT; -static expert_field ei_megaco_no_descriptor = EI_INIT; -static expert_field ei_megaco_error_descriptor_transaction_list = EI_INIT; -static expert_field ei_megaco_parse_error = EI_INIT; -static expert_field ei_megaco_audit_descriptor = EI_INIT; -static expert_field ei_megaco_signal_descriptor = EI_INIT; -static expert_field ei_megaco_reason_invalid = EI_INIT; -static expert_field ei_megaco_error_code_invalid = EI_INIT; -static expert_field ei_megaco_invalid_sdr = EI_INIT; +static int ett_megaco; +static int ett_megaco_message; +static int ett_megaco_message_body; +static int ett_megaco_context; +static int ett_megaco_command_line; +static int ett_megaco_mediadescriptor; +static int ett_megaco_descriptors; +static int ett_megaco_raw_text; +static int ett_megaco_error_descriptor; +static int ett_megaco_TerminationState; +static int ett_megaco_Localdescriptor; +static int ett_megaco_Remotedescriptor; +static int ett_megaco_LocalControldescriptor; +static int ett_megaco_auditdescriptor; +static int ett_megaco_eventsdescriptor; +static int ett_megaco_statisticsdescriptor; +static int ett_megaco_observedeventsdescriptor; +static int ett_megaco_observedevent; +static int ett_megaco_packagesdescriptor; +static int ett_megaco_requestedevent; +static int ett_megaco_signalsdescriptor; +static int ett_megaco_requestedsignal; +static int ett_megaco_h245; + +static gcp_hf_ett_t megaco_ctx_ids; + +static expert_field ei_megaco_errored_command; +static expert_field ei_megaco_no_command; +static expert_field ei_megaco_no_descriptor; +static expert_field ei_megaco_error_descriptor_transaction_list; +static expert_field ei_megaco_parse_error; +static expert_field ei_megaco_audit_descriptor; +static expert_field ei_megaco_signal_descriptor; +static expert_field ei_megaco_reason_invalid; +static expert_field ei_megaco_error_code_invalid; +static expert_field ei_megaco_invalid_sdr; static dissector_handle_t megaco_text_handle; -static int megaco_tap = -1; +static int megaco_tap; static gint exported_pdu_tap = -1; @@ -183,7 +184,8 @@ typedef enum * Here are the global variables associated with * the various user definable characteristics of the dissection * -* MEGACO has two kinds of message formats: text and binary +* H.248/MEGACO has two kinds of message formats: text and binary (ASN.1). +* The binary message format is dissected in packet-h248.c * * global_megaco_raw_text determines whether we are going to display * the raw text of the megaco message, much like the HTTP dissector does. @@ -192,12 +194,6 @@ typedef enum * a detailed tree that expresses a somewhat more semantically meaningful * decode. */ -static guint global_megaco_txt_sctp_port = PORT_MEGACO_TXT; -#if 0 -static guint global_megaco_bin_sctp_port = PORT_MEGACO_BIN; -static guint global_megaco_bin_tcp_port = PORT_MEGACO_BIN; -static guint global_megaco_bin_udp_port = PORT_MEGACO_BIN; -#endif static gboolean global_megaco_raw_text = TRUE; static gboolean global_megaco_dissect_tree = TRUE; @@ -327,13 +323,13 @@ megacostat_filtercheck(const char *opt_arg _U_, const char **filter _U_, char** } if (!prefs_get_bool_value(megaco_ctx_track, pref_current) || !prefs_get_bool_value(h248_ctx_track, pref_current)) { - *err = g_strdup_printf("Track Context option at Protocols -> MEGACO and Protocols -> H248 preferences\n" + *err = ws_strdup_printf("Track Context option at Protocols -> MEGACO and Protocols -> H248 preferences\n" "has to be set to true to enable measurement of service response times.\n"); } } static tap_packet_status -megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi) +megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pmi, tap_flags_t flags _U_) { rtd_data_t* rtd_data = (rtd_data_t*)pms; rtd_stat_table* ms = &rtd_data->stat_table; @@ -425,7 +421,7 @@ megacostat_packet(void *pms, packet_info *pinfo, epan_dissect_t *edt _U_, const static void export_megaco_pdu(packet_info *pinfo, tvbuff_t *tvb) { - exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "megaco", EXP_PDU_TAG_PROTO_NAME); + exp_pdu_data_t *exp_pdu_data = export_pdu_create_common_tags(pinfo, "megaco", EXP_PDU_TAG_DISSECTOR_NAME); exp_pdu_data->tvb_captured_length = tvb_captured_length(tvb); exp_pdu_data->tvb_reported_length = tvb_reported_length(tvb); @@ -450,6 +446,8 @@ dissect_megaco_topologydescriptor(tvbuff_t *tvb, proto_tree *tree, gint tvb_RBRK static void dissect_megaco_errordescriptor(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, gint tvb_RBRKT, gint tvb_previous_offset); static void +dissect_megaco_statisticsdescriptor(tvbuff_t *tvb, proto_tree *megaco_tree_command_line, gint tvb_RBRKT, gint tvb_previous_offset); +static void dissect_megaco_TerminationStatedescriptor(tvbuff_t *tvb, proto_tree *tree, gint tvb_next_offset, gint tvb_current_offset); static void dissect_megaco_LocalRemotedescriptor(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint tvb_next_offset, gint tvb_current_offset, guint32 context, gboolean is_local); @@ -635,12 +633,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d */ tvb_offset = megaco_tvb_skip_wsp(tvb, tvb_offset); - /* Quick fix for MEGACO not following the RFC, hopefully not breaking any thing - * Turned out to be TPKT in case of TCP, added some code to handle that. - * - * tvb_offset = tvb_find_guint8(tvb, tvb_offset, 5, 'M'); - */ - if(!tvb_get_nstringz0(tvb,tvb_offset,sizeof(word),word)) return tvb_captured_length(tvb); + if(!tvb_get_raw_bytes_as_stringz(tvb,tvb_offset,sizeof(word),word)) return tvb_captured_length(tvb); /* Quick fix for MEGACO packet with Authentication Header, * marked as "AU" or "Authentication". @@ -668,7 +661,7 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d if (g_ascii_strncasecmp(word, "MEGACO", 6) != 0 && !short_form){ gint8 ber_class; - gboolean pc; + bool pc; gint32 tag; dissector_handle_t handle = data_handle; @@ -999,7 +992,7 @@ nextcontext: /* Find Commands */ - /* If Transaction is is Request, Reply or Pending */ + /* If Transaction is Request, Reply or Pending */ tvb_command_start_offset = megaco_tvb_skip_wsp(tvb, tvb_current_offset +1); tvb_command_end_offset = tvb_command_start_offset; @@ -1104,7 +1097,7 @@ nextcontext: megaco_command = MEGACO_CMD_NOT_SET; /* creation of the megaco_tree_command_line additionally Command and Transaction ID will be printed in this line */ /* Changed to use the lines above. this code is saved if there is complaints - sub_ti = proto_tree_add_item(megaco_tree,hf_megaco_command_line,tvb,tvb_command_start_offset,tokenlen, ENC_UTF_8|ENC_NA); + sub_ti = proto_tree_add_item(megaco_tree,hf_megaco_command_line,tvb,tvb_command_start_offset,tokenlen, ENC_UTF_8); megaco_tree_command_line = proto_item_add_subtree(sub_ti, ett_megaco_command_line); */ if (!global_megaco_dissect_tree) { @@ -1149,6 +1142,10 @@ nextcontext: } else { /* Try to find the first char of the command */ tvb_command_start_offset = megaco_tvb_skip_wsp(tvb, tvb_command_start_offset + 1); + RBRKT_counter = 0; + LBRKT_counter = 0; + tvb_LBRKT = tvb_command_start_offset; + tvb_RBRKT = tvb_command_start_offset; /*tvb_next_offset = tvb_find_guint8(tvb, tvb_command_start_offset, tvb_transaction_end_offset, '{');*/ continue; } @@ -1471,6 +1468,7 @@ nextcontext: term = wmem_new0(wmem_packet_scope(), gcp_term_t); wild_term = GCP_WILDCARD_NONE; term->type = GCP_TERM_TYPE_UNKNOWN; + int bytelen; switch ( tempchar ){ @@ -1479,17 +1477,18 @@ nextcontext: expert_add_info_format(pinfo, sub_ti, &ei_megaco_parse_error, "Parse error: Invalid TermID length (%d)", tokenlen+1); return tvb_captured_length(tvb); } - tvb_get_nstringz0(tvb,tvb_offset,tokenlen+1,TermID); + bytelen = tvb_get_raw_bytes_as_stringz(tvb,tvb_offset,tokenlen+1,TermID); TermID[0] = 'e'; - term->len = tokenlen; - term->str = (const gchar*)(term->buffer = TermID); + term->buffer = get_utf_8_string(wmem_packet_scope(), TermID, bytelen); + term->len = (int)strlen(term->buffer); + term->str = (const char *)term->buffer; gcp_cmd_add_term(msg, trx, cmd, term, wild_term, pinfo, keep_persistent_data); /*** TERM ***/ proto_tree_add_string(megaco_tree_command_line, hf_megaco_termid, tvb, - tvb_offset, tokenlen, TermID); + tvb_offset, tokenlen, term->str); break; case '*': @@ -1710,6 +1709,7 @@ dissect_megaco_multiplexdescriptor(tvbuff_t *tvb, proto_tree *megaco_tree_comman #define MEGACO_LOCAL_CONTROL_TOKEN 3 #define MEGACO_STREAM_TOKEN 4 #define MEGACO_TERMINATION_STATE_DESC 5 +// MEGACO_STATS_TOKEN is already defined as 6 above static const megaco_tokens_t megaco_mediaParm_names[] = { { "Unknown-token", NULL }, /* 0 Pad so that the real headers start at index 1 */ @@ -1718,6 +1718,7 @@ static const megaco_tokens_t megaco_mediaParm_names[] = { { "LocalControl", "O" }, /* 3 */ { "Stream", "ST" }, /* 4 */ { "TerminationState", "TS" }, /* 5 */ + { "Statistics", "SA" }, /* 6 */ }; /* Returns index of megaco_tokens_t */ @@ -1810,6 +1811,14 @@ dissect_megaco_mediadescriptor(tvbuff_t *tvb, proto_tree *megaco_tree_command_li tvb_RBRKT, tvb_current_offset); tvb_current_offset = tvb_RBRKT; break; + case MEGACO_STATS_TOKEN: + // dissect_megaco_statisticsdescriptor wants the previous + // offset, don't skip forward. + //tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_LBRKT+1); + dissect_megaco_statisticsdescriptor(tvb, megaco_mediadescriptor_tree, + tvb_RBRKT, tvb_current_offset); + tvb_current_offset = tvb_RBRKT; + break; default: break; }; @@ -2085,7 +2094,7 @@ dissect_megaco_eventsdescriptor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *m tokenlen = tvb_RBRKT+1 - tvb_previous_offset; } - megaco_requestedevent_ti = proto_tree_add_item(megaco_eventsdescriptor_tree,hf_megaco_pkgdname,tvb,tvb_previous_offset,tokenlen, ENC_UTF_8|ENC_NA); + megaco_requestedevent_ti = proto_tree_add_item(megaco_eventsdescriptor_tree,hf_megaco_pkgdname,tvb,tvb_previous_offset,tokenlen, ENC_UTF_8); megaco_requestedevent_tree = proto_item_add_subtree(megaco_requestedevent_ti, ett_megaco_requestedevent); if ( tvb_help_offset < tvb_RBRKT && tvb_help_offset != -1 ){ @@ -2228,7 +2237,7 @@ dissect_megaco_signaldescriptor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *m pkg_tokenlen = tvb_RBRKT+1 - tvb_previous_offset; } - megaco_requestedsignal_ti = proto_tree_add_item(megaco_signalsdescriptor_tree,hf_megaco_pkgdname,tvb,tvb_previous_offset,pkg_tokenlen, ENC_UTF_8|ENC_NA); + megaco_requestedsignal_ti = proto_tree_add_item(megaco_signalsdescriptor_tree,hf_megaco_pkgdname,tvb,tvb_previous_offset,pkg_tokenlen, ENC_UTF_8); megaco_requestedsignal_tree = proto_item_add_subtree(megaco_requestedsignal_ti, ett_megaco_requestedsignal); if ( tvb_help_offset < tvb_RBRKT && tvb_help_offset != -1 ){ @@ -2454,7 +2463,7 @@ dissect_megaco_servicechangedescriptor(tvbuff_t *tvb, packet_info* pinfo, proto_ if ( tvb_current_offset == -1) break; - tvb_get_nstringz0(tvb,tvb_current_offset,4,ServiceChangeReason_str); + tvb_get_raw_bytes_as_stringz(tvb,tvb_current_offset,4,ServiceChangeReason_str); reason_valid = ws_strtoi32(ServiceChangeReason_str, NULL, &reason); proto_item_append_text(item,"[ %s ]", val_to_str(reason, MEGACO_ServiceChangeReasons_vals,"Unknown (%u)")); if (!reason_valid) @@ -2642,7 +2651,7 @@ dissect_megaco_observedeventsdescriptor(tvbuff_t *tvb, packet_info *pinfo, proto megaco_observedevent_tree = proto_item_add_subtree(megaco_observedevent_ti, ett_megaco_observedevent); - proto_tree_add_item(megaco_observedevent_tree,hf_megaco_pkgdname,tvb,tvb_previous_offset,pkg_tokenlen, ENC_UTF_8|ENC_NA); + proto_tree_add_item(megaco_observedevent_tree,hf_megaco_pkgdname,tvb,tvb_previous_offset,pkg_tokenlen, ENC_UTF_8); if ( tvb_help_offset < tvb_RBRKT && tvb_help_offset != -1 ){ @@ -2702,10 +2711,8 @@ dissect_megaco_topologydescriptor(tvbuff_t *tvb, proto_tree *megaco_tree_command gint tokenlen; tokenlen = (tvb_RBRKT+1) - tvb_previous_offset; - proto_tree_add_string(megaco_tree_command_line, hf_megaco_topology_descriptor, tvb, - tvb_previous_offset, tokenlen, - tvb_format_text_wsp(wmem_packet_scope(), tvb, tvb_previous_offset, - tokenlen)); + proto_tree_add_item(megaco_tree_command_line, hf_megaco_topology_descriptor, tvb, + tvb_previous_offset, tokenlen, ENC_ASCII); } static void @@ -2719,7 +2726,7 @@ dissect_megaco_Packagesdescriptor(tvbuff_t *tvb, proto_tree *megaco_tree_command tokenlen = (tvb_RBRKT+1) - tvb_previous_offset; - megaco_packagesdescriptor_ti = proto_tree_add_item(megaco_tree_command_line,hf_megaco_packages_descriptor,tvb,tvb_previous_offset,tokenlen, ENC_UTF_8|ENC_NA); + megaco_packagesdescriptor_ti = proto_tree_add_item(megaco_tree_command_line,hf_megaco_packages_descriptor,tvb,tvb_previous_offset,tokenlen, ENC_UTF_8); megaco_packagesdescriptor_tree = proto_item_add_subtree(megaco_packagesdescriptor_ti, ett_megaco_packagesdescriptor); tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset, tvb_RBRKT, '='); @@ -2915,7 +2922,7 @@ dissect_megaco_errordescriptor(tvbuff_t *tvb, packet_info* pinfo, proto_tree *me error_tree = proto_item_add_subtree(item, ett_megaco_error_descriptor); /* Get the error code */ - tvb_get_nstringz0(tvb,tvb_current_offset,4,error); + tvb_get_raw_bytes_as_stringz(tvb,tvb_current_offset,4,error); error_code_valid = ws_strtoi32(error, NULL, &error_code); item = proto_tree_add_uint(error_tree, hf_megaco_error_code, tvb, tvb_current_offset, 3, error_code); if (!error_code_valid) @@ -2926,7 +2933,7 @@ dissect_megaco_errordescriptor(tvbuff_t *tvb, packet_info* pinfo, proto_tree *me tvb_current_offset = tvb_find_guint8(tvb, tvb_previous_offset+1, tvb_RBRKT, '\"'); tokenlen = tvb_current_offset - tvb_previous_offset-1; - proto_tree_add_item(error_tree, hf_megaco_error_string, tvb, tvb_previous_offset+1, tokenlen, ENC_UTF_8|ENC_NA); + proto_tree_add_item(error_tree, hf_megaco_error_string, tvb, tvb_previous_offset+1, tokenlen, ENC_UTF_8); } static void dissect_megaco_TerminationStatedescriptor(tvbuff_t *tvb, proto_tree *megaco_mediadescriptor_tree, gint tvb_next_offset, gint tvb_current_offset) @@ -3025,21 +3032,23 @@ dissect_megaco_LocalRemotedescriptor(tvbuff_t *tvb, proto_tree *megaco_mediadesc { gint tokenlen; tvbuff_t *next_tvb; - http_message_info_t message_info = { SIP_DATA, NULL, NULL, NULL }; + media_content_info_t content_info = { MEDIA_CONTAINER_SIP_DATA, NULL, NULL, NULL }; sdp_setup_info_t setup_info; /* Only fill in the info when we have valid contex */ if ((context != 0) && (context < 0xfffffffe)) { - setup_info.hf_id = hf_megaco_Context; - setup_info.hf_type = SDP_TRACE_ID_HF_TYPE_GUINT32; + setup_info = (sdp_setup_info_t){ + .hf_id = hf_megaco_Context, + .hf_type = SDP_TRACE_ID_HF_TYPE_GUINT32, + .trace_id.num = context, + }; if (!sip_hide_generated_call_ids) { setup_info.add_hidden = FALSE; } else { setup_info.add_hidden = prefs_get_bool_value(sip_hide_generated_call_ids, pref_current); } - setup_info.trace_id.num = context; - message_info.data = &setup_info; + content_info.data = &setup_info; } proto_tree *megaco_localdescriptor_tree; @@ -3057,7 +3066,7 @@ dissect_megaco_LocalRemotedescriptor(tvbuff_t *tvb, proto_tree *megaco_mediadesc if ( tokenlen > 3 ){ next_tvb = tvb_new_subset_length(tvb, tvb_current_offset, tokenlen); - call_dissector_with_data(sdp_handle, next_tvb, pinfo, megaco_localdescriptor_tree, &message_info); + call_dissector_with_data(sdp_handle, next_tvb, pinfo, megaco_localdescriptor_tree, &content_info); } } @@ -3271,7 +3280,7 @@ dissect_megaco_LocalControldescriptor(tvbuff_t *tvb, proto_tree *megaco_mediades break; case MEGACO_DS_DSCP: - tvb_get_nstringz0(tvb,tvb_current_offset,3,code_str); + tvb_get_raw_bytes_as_stringz(tvb,tvb_current_offset,3,code_str); item = proto_tree_add_uint(megaco_LocalControl_tree, hf_megaco_ds_dscp, tvb, tvb_help_offset, 1, (guint32) strtoul(code_str,NULL,16)); proto_item_set_len(item, tvb_offset-tvb_help_offset); @@ -3589,7 +3598,7 @@ megaco_fmt_content( gchar *result, guint32 context ) (void) g_strlcpy(result, val_to_str_const(context, megaco_context_vals, "Unknown"), ITEM_LABEL_LENGTH); break; default: - g_snprintf( result, ITEM_LABEL_LENGTH, "%d", context); + snprintf( result, ITEM_LABEL_LENGTH, "%d", context); } } @@ -3750,7 +3759,7 @@ proto_register_megaco(void) { "Termination State Descriptor", "megaco.terminationstate", FT_NONE, BASE_NONE, NULL, 0x0, "Termination State Descriptor in Media Descriptor", HFILL }}, { &hf_megaco_topology_descriptor, - { "Topology Descriptor", "megaco.topology", FT_STRING, BASE_NONE, NULL, 0x0, + { "Topology Descriptor", "megaco.topology", FT_STRING, BASE_STR_WSP, NULL, 0x0, "Topology Descriptor of the megaco Command", HFILL }}, { &hf_megaco_transaction, { "Transaction", "megaco.transaction", FT_STRING, BASE_NONE, NULL, 0x0, @@ -3835,29 +3844,7 @@ proto_register_megaco(void) /* Register our configuration options, particularly our ports */ - megaco_module = prefs_register_protocol(proto_megaco, proto_reg_handoff_megaco); - - prefs_register_uint_preference(megaco_module, "sctp.txt_port", - "MEGACO Text SCTP Port", - "Set the SCTP port for MEGACO text messages", - 10, &global_megaco_txt_sctp_port); - -#if 0 - prefs_register_uint_preference(megaco_module, "sctp.bin_port", - "MEGACO Binary SCTP Port", - "Set the SCTP port for MEGACO binary messages", - 10, &global_megaco_bin_sctp_port); - - prefs_register_uint_preference(megaco_module, "tcp.bin_port", - "MEGACO Binary TCP Port", - "Set the TCP port for MEGACO binary messages", - 10, &global_megaco_bin_tcp_port); - - prefs_register_uint_preference(megaco_module, "udp.bin_port", - "MEGACO Binary UDP Port", - "Set the UDP port for MEGACO binary messages", - 10, &global_megaco_bin_udp_port); -#endif + megaco_module = prefs_register_protocol(proto_megaco, NULL); prefs_register_bool_preference(megaco_module, "display_raw_text", "Display raw text for MEGACO message", @@ -3894,43 +3881,20 @@ proto_register_megaco(void) void proto_reg_handoff_megaco(void) { - static gboolean megaco_prefs_initialized = FALSE; - static dissector_handle_t megaco_text_tcp_handle; - - /* - * Variables to allow for proper deletion of dissector registration when - * the user changes port from the gui. - */ - static guint txt_sctp_port; -#if 0 - static guint bin_sctp_port; - static guint bin_tcp_port; - static guint bin_udp_port; -#endif - - if (!megaco_prefs_initialized) { - sdp_handle = find_dissector_add_dependency("sdp", proto_megaco); - h245_handle = find_dissector_add_dependency("h245dg", proto_megaco); - h248_handle = find_dissector_add_dependency("h248", proto_megaco); - h248_otp_handle = find_dissector_add_dependency("h248_otp", proto_megaco); - data_handle = find_dissector("data"); - - megaco_text_tcp_handle = create_dissector_handle(dissect_megaco_text_tcp, proto_megaco); - - dissector_add_uint_with_preference("tcp.port", PORT_MEGACO_TXT, megaco_text_tcp_handle); - dissector_add_uint_with_preference("udp.port", PORT_MEGACO_TXT, megaco_text_handle); - dissector_add_uint("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, megaco_text_handle); - - megaco_prefs_initialized = TRUE; - } else { - dissector_delete_uint("sctp.port", txt_sctp_port, megaco_text_handle); - } + dissector_handle_t megaco_text_tcp_handle; - /* Set our port number for future use */ + sdp_handle = find_dissector_add_dependency("sdp", proto_megaco); + h245_handle = find_dissector_add_dependency("h245dg", proto_megaco); + h248_handle = find_dissector_add_dependency("h248", proto_megaco); + h248_otp_handle = find_dissector_add_dependency("h248_otp", proto_megaco); + data_handle = find_dissector("data"); - txt_sctp_port = global_megaco_txt_sctp_port; + megaco_text_tcp_handle = create_dissector_handle(dissect_megaco_text_tcp, proto_megaco); - dissector_add_uint("sctp.port", global_megaco_txt_sctp_port, megaco_text_handle); + dissector_add_uint_with_preference("tcp.port", PORT_MEGACO_TXT, megaco_text_tcp_handle); + dissector_add_uint_with_preference("udp.port", PORT_MEGACO_TXT, megaco_text_handle); + dissector_add_uint_with_preference("sctp.port", PORT_MEGACO_TXT, megaco_text_handle); + dissector_add_uint("sctp.ppi", H248_PAYLOAD_PROTOCOL_ID, megaco_text_handle); exported_pdu_tap = find_tap_id(EXPORT_PDU_TAP_NAME_LAYER_7); |