diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c index 3209042b40..4f55027845 100644 --- a/epan/dissectors/packet-tpncp.c +++ b/epan/dissectors/packet-tpncp.c @@ -56,6 +56,7 @@ enum SpecialFieldType { TPNCP_SECURITY_OFFSET, RTP_STATE_START, RTP_STATE_OFFSET, + RTP_STATE_END, TPNCP_CHANNEL_CONFIGURATION }; @@ -69,6 +70,7 @@ typedef struct tpncp_data_field_info enum SpecialFieldType special_type; guchar size; guchar sign; + gint since; struct tpncp_data_field_info *p_next; } tpncp_data_field_info; @@ -132,7 +134,7 @@ enum AddressFamily { static void dissect_tpncp_data(guint data_id, packet_info *pinfo, tvbuff_t *tvb, proto_tree *ltree, - gint *offset, tpncp_data_field_info *data_fields_info, guint encoding) + gint *offset, tpncp_data_field_info *data_fields_info, gint ver, guint encoding) { gint8 g_char; guint8 g_uchar; @@ -141,10 +143,12 @@ dissect_tpncp_data(guint data_id, packet_info *pinfo, tvbuff_t *tvb, proto_tree gint bitindex = encoding == ENC_LITTLE_ENDIAN ? 7 : 0; enum AddressFamily address_family = TPNCP_IPV4; gint open_channel_start = -1, security_offset = 0, rtp_state_offset = 0; - gint channel_b_offset = 0; + gint channel_b_offset = 0, rtp_tx_state_offset = 0, rtp_state_size = 0; const gint initial_offset = *offset; for (field = &data_fields_info[data_id]; field; field = field->p_next) { + if (field->since > 0 && field->since > ver) + continue; switch (field->special_type) { case TPNCP_OPEN_CHANNEL_START: open_channel_start = *offset; @@ -156,8 +160,7 @@ dissect_tpncp_data(guint data_id, packet_info *pinfo, tvbuff_t *tvb, proto_tree break; } case TPNCP_SECURITY_START: - if (*offset < security_offset) - *offset = security_offset; + *offset = security_offset; open_channel_start = -1; security_offset = 0; break; @@ -167,17 +170,25 @@ dissect_tpncp_data(guint data_id, packet_info *pinfo, tvbuff_t *tvb, proto_tree rtp_state_offset += initial_offset + 4; /* The offset starts after CID */ break; case RTP_STATE_START: - if (*offset < rtp_state_offset) - *offset = rtp_state_offset; + *offset = rtp_state_offset; rtp_state_offset = 0; + if (rtp_tx_state_offset == 0) { + rtp_state_size = (tvb_reported_length_remaining(tvb, *offset) - 4) / 2; + rtp_tx_state_offset = *offset + rtp_state_size; + } else { + *offset = rtp_tx_state_offset; + rtp_tx_state_offset += rtp_state_size; + } + break; + case RTP_STATE_END: + rtp_tx_state_offset = 0; break; case TPNCP_CHANNEL_CONFIGURATION: if (channel_b_offset == 0) { gint channel_configuration_size = tvb_reported_length_remaining(tvb, *offset) / 2; channel_b_offset = *offset + channel_configuration_size; } else { - if (*offset < channel_b_offset) - *offset = channel_b_offset; + *offset = channel_b_offset; channel_b_offset = 0; } break; @@ -185,14 +196,12 @@ dissect_tpncp_data(guint data_id, packet_info *pinfo, tvbuff_t *tvb, proto_tree address_family = (enum AddressFamily)tvb_get_guint32(tvb, *offset, encoding); // fall-through default: - if (open_channel_start != -1 && security_offset > 0) { - if (*offset >= security_offset) - continue; - } - if (rtp_state_offset > 0) { - if (*offset >= rtp_state_offset) - continue; - } + if (open_channel_start != -1 && security_offset > 0 && *offset >= security_offset) + continue; + if (rtp_state_offset > 0 && *offset >= rtp_state_offset) + continue; + if (rtp_tx_state_offset > 0 && *offset >= rtp_tx_state_offset) + continue; if (channel_b_offset > 0 && *offset >= channel_b_offset) continue; break; @@ -301,35 +310,32 @@ dissect_tpncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U proto_tree_add_uint(tpncp_tree, hf_tpncp_event_id, tvb, 8, 4, id); proto_tree_add_int(tpncp_tree, hf_tpncp_cid, tvb, 12, 4, cid); offset += 16; - if (tpncp_events_info_db[id].size) { + if (tpncp_events_info_db[id].size && tvb_reported_length_remaining(tvb, offset) > 0) { event_tree = proto_tree_add_subtree_format( tree, tvb, offset, -1, ett_tpncp_body, NULL, "TPNCP Event: %s (%d)", val_to_str_const(id, tpncp_events_id_vals, "Unknown"), id); dissect_tpncp_data(id, pinfo, tvb, event_tree, &offset, tpncp_events_info_db, - encoding); + ver, encoding); } } - } else if (try_val_to_str(id, tpncp_commands_id_vals)) { - proto_tree_add_uint(tpncp_tree, hf_tpncp_command_id, tvb, 8, 4, id); - offset += 12; - if (tpncp_commands_info_db[id].size) { - command_tree = proto_tree_add_subtree_format( - tree, tvb, offset, -1, ett_tpncp_body, NULL, - "TPNCP Command: %s (%d)", - val_to_str_const(id, tpncp_commands_id_vals, "Unknown"), id); - dissect_tpncp_data(id, pinfo, tvb, command_tree, &offset, tpncp_commands_info_db, - encoding); - } - } - - if (pinfo->srcport == UDP_PORT_TPNCP_TRUNKPACK || - pinfo->srcport == HA_PORT_TPNCP_TRUNKPACK) { col_add_fstr(pinfo->cinfo, COL_INFO, "EvID=%s(%d), SeqNo=%d, CID=%d, Len=%d, Ver=%d", val_to_str_const(id, tpncp_events_id_vals, "Unknown"), id, seq_number, cid, fullLength, ver); } else { + if (try_val_to_str(id, tpncp_commands_id_vals)) { + proto_tree_add_uint(tpncp_tree, hf_tpncp_command_id, tvb, 8, 4, id); + offset += 12; + if (tpncp_commands_info_db[id].size && tvb_reported_length_remaining(tvb, offset) > 0) { + command_tree = proto_tree_add_subtree_format( + tree, tvb, offset, -1, ett_tpncp_body, NULL, + "TPNCP Command: %s (%d)", + val_to_str_const(id, tpncp_commands_id_vals, "Unknown"), id); + dissect_tpncp_data(id, pinfo, tvb, command_tree, &offset, tpncp_commands_info_db, + ver, encoding); + } + } col_add_fstr(pinfo->cinfo, COL_INFO, "CmdID=%s(%d), SeqNo=%d, CID=%d, Len=%d, Ver=%d", val_to_str_const(id, tpncp_commands_id_vals, "Unknown"), @@ -565,7 +571,7 @@ init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, FILE *file) guchar size; enum SpecialFieldType special_type; gboolean sign, is_address_family; - guint idx; + guint idx, since, ip_addr_field; tpncp_data_field_info *field = NULL; hf_register_info hf_entr; gboolean* registered_struct_ids = wmem_alloc0_array(wmem_epan_scope(), gboolean, MAX_TPNCP_DB_SIZE); @@ -694,10 +700,12 @@ init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, FILE *file) hf_size++; is_address_family = FALSE; + ip_addr_field = 0; /* Register standard data. */ while (fgetline(tpncp_db_entry, MAX_TPNCP_DB_ENTRY_LEN, file)) { special_type = TPNCP_NORMAL; + since = 0; g_snprintf(entry_copy, MAX_TPNCP_DB_ENTRY_LEN, "%s", tpncp_db_entry); if (!strncmp(tpncp_db_entry, "#####", 5)) { hf_size--; @@ -738,12 +746,20 @@ init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, FILE *file) special_type = TPNCP_SECURITY_START; else if (name[0] == 's' && !strcmp(name, "security_cmd_offset")) special_type = TPNCP_SECURITY_OFFSET; - else if (name[0] == 's' && !strcmp(name, "ssrc")) + else if (data_id != 1611 && name[0] == 's' && !strcmp(name, "ssrc")) + special_type = RTP_STATE_START; + else if (name[0] == 'r' && !strcmp(name, "rtp_tx_state_ssrc")) special_type = RTP_STATE_START; else if (name[0] == 'r' && !strcmp(name, "rtp_state_offset")) special_type = RTP_STATE_OFFSET; + else if (name[0] == 's' && !strcmp(name, "state_update_time_stamp")) + special_type = RTP_STATE_END; else if (data_id == 1611 && name[0] == 'c' && strstr(name, "configuration_type_updated")) special_type = TPNCP_CHANNEL_CONFIGURATION; + else if ((data_id == 4 && strstr(name, "secondary_rtp_seq_num")) || + (data_id == 1611 && strstr(name, "dtls_remote_fingerprint_alg"))) { + since = 7401; + } sign = !!((gboolean) g_ascii_strtoll(tmp, NULL, 10)); if ((tmp = strtok(NULL, " ")) == NULL) { report_failure( @@ -774,10 +790,11 @@ init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, FILE *file) continue; } - if (special_type == TPNCP_IP_ADDR) { + if (ip_addr_field > 0) { // ip address that comes after address family has 4 fields: ip_addr_0, ip_addr_1, 2 and 3 // On these cases, ignore 1, 2 and 3 and enlarge the field size of 0 to 128 char *seq = (char*)name + strlen(name) - 2; + --ip_addr_field; if (seq > name && *seq == '_') { if (seq[1] >= '1' && seq[1] <= '3') continue; @@ -785,6 +802,10 @@ init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, FILE *file) if (is_address_family) { *seq = 0; size = 128; + special_type = TPNCP_IP_ADDR; + } else { + report_warning("Bad address form. Field name: %s", name); + ip_addr_field = 0; } } } @@ -815,8 +836,10 @@ init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, FILE *file) hf_entr.hfinfo.strings = NULL; } else { hf_entr.hfinfo.strings = VALS(tpncp_enums_id_vals[enum_val]); - if (!strcmp(tmp, "AddressFamily")) + if (!strcmp(tmp, "AddressFamily")) { is_address_family = TRUE; + ip_addr_field = 4; + } } } else { hf_entr.hfinfo.strings = NULL; @@ -869,6 +892,7 @@ init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, FILE *file) field->size = size; field->array_dim = array_dim; field->special_type = is_address_family ? TPNCP_ADDRESS_FAMILY : special_type; + field->since = since; } return 0; diff --git a/tpncp/tpncp.dat b/tpncp/tpncp.dat index b60b27410a..94b67f4c2e 100644 --- a/tpncp/tpncp.dat +++ b/tpncp/tpncp.dat @@ -1,4 +1,4 @@ -Audiocodes TrunkPack Network Control Protocol (TPNCP) Version L7.40.012.001 +Audiocodes TrunkPack Network Control Protocol (TPNCP) Version L7.40.016.001 acEV_NONE 0 acEV_ERROR 1 acEV_DIGIT 2 @@ -510,10 +510,11 @@ acEV_MPE_NETWORK_GROUP_INFO 676 acEV_GAUGE_PM 677 acEV_HTTP_STREAMING_PLAY_ENDED 678 acEV_HTTP_STREAMING_RECORD_ENDED 679 -acEV_MPE_DEVICE_INFO 680 -acEV_DTLS_FAILED 681 -acEV_DTLS_SRTP_SUITES 682 -acEV_MPC_DTLS_PACKAGE 683 +acEV_DTLS_FAILED 680 +acEV_DTLS_SRTP_SUITES 681 +acEV_MPC_DTLS_PACKAGE 682 +acEV_MPE_DEVICE_INFO 683 +acEV_SECURITY_LOG 684 acEV_IP_ADDRESS_CHANGED 1202 acEV_SMDI_MWI_NEGATIVE 1204 acEV_VOICE_MENU_START 1206 @@ -567,6 +568,9 @@ acEV_MPC_MPE_NAME_CHANGED 1621 acEV_AUPD_FILE 1622 acEV_MPC_MPE_TRANSCODING_OVERLOAD 1623 acEV_HTTP_STREAMING_BACK_TO_NORMAL 1624 +acEV_FAULTY_DSP_DURING_BOOT 1625 +acEV_FAULTY_DSP 1626 +acEV_SUCCESSFUL_DSPS_BOOT 1627 acEV_CLOUD_PUBLIC_IP_CHANGED 1700 acEV_TLS_CONTEXT_CHANGED 1800 ##### @@ -993,7 +997,7 @@ acCMD_MTC_HA_INTEGRITY_CHECK_COMMAND 1605 acCMD_MTC_DR_SET_STATE 1606 acCMD_MTC_DR_SET_DEFAULT_IP_TARGET 1607 acCMD_MTC_DR_ADD_REMOVE_SYSTEM_TRACE_RULE 1608 -acCMD_MTC_DR_SET_CID_SESSION_ID_IP_TRACE_DATA 1609 +acCMD_MTC_DR_SET_CID_SESSION_ID_TRACE_DATA 1609 acCMD_MTC_UPLOAD_FILE 1610 acCMD_OPEN_OR_UPDATE_SBC_SESSION 1611 acCMD_CLOSE_OR_DISCONNECT_SBC_SESSION 1612 @@ -3824,6 +3828,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 65 hour 0 32 0 0 primitive 65 minute 0 32 0 0 primitive 65 second 0 32 0 0 primitive +65 slot_map_format 1 8 0 0 primitive 66 call_handle 0 32 0 0 primitive 66 trunk_id 0 32 0 0 primitive 66 conn_id 0 32 0 0 primitive @@ -3868,7 +3873,8 @@ FirmwareModule HA_MODULE_BOUNDARY 29 66 mlpp_domain_2 1 8 0 0 primitive 66 mlpp_domain_3 1 8 0 0 primitive 66 mlpp_domain_4 1 8 0 0 primitive -66 align 0 8 3 0 primitive +66 slot_map_format 1 8 0 0 primitive +66 align 0 8 2 0 primitive 66 isdn_progress_ind_description 0 32 0 0 ISDNProgressIndDescription 66 isdn_progress_ind_location 0 32 0 0 ISDNProgressIndLocation 66 emergency_call_coding_standard 0 32 0 0 EmergencyCallCodingStandard @@ -3949,6 +3955,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 69 isdn_progress_ind_location_1 0 32 0 0 ISDNProgressIndLocation 69 isdn_progress_ind_description_2 0 32 0 0 ISDNProgressIndDescription 69 isdn_progress_ind_location_2 0 32 0 0 ISDNProgressIndLocation +69 slot_map_format 1 8 0 0 primitive 72 call_handle 0 32 0 0 primitive 72 trunk_id 0 32 0 0 primitive 72 conn_id 0 32 0 0 primitive @@ -3983,6 +3990,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 73 isdn_progress_ind_location_1 0 32 0 0 ISDNProgressIndLocation 73 isdn_progress_ind_description_2 0 32 0 0 ISDNProgressIndDescription 73 isdn_progress_ind_location_2 0 32 0 0 ISDNProgressIndLocation +73 slot_map_format 1 8 0 0 primitive 74 trunk_id 0 32 0 0 primitive 74 comment 0 32 0 0 primitive 74 los 0 32 0 0 primitive @@ -10964,6 +10972,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 84 isdn_progress_ind_location_1 0 32 0 0 ISDNProgressIndLocation 84 isdn_progress_ind_description_2 0 32 0 0 ISDNProgressIndDescription 84 isdn_progress_ind_location_2 0 32 0 0 ISDNProgressIndLocation +84 slot_map_format 1 8 0 0 primitive 56 pattern_index 0 32 0 0 primitive 56 time_sec 0 32 0 0 primitive 56 time_milli_sec 0 16 0 0 primitive @@ -12951,13 +12960,6 @@ FirmwareModule HA_MODULE_BOUNDARY 29 1607 dest_udp_port 1 16 0 0 primitive 1608 remove_or_add 1 32 0 0 primitive 1608 packet_type 0 32 0 0 primitive -1609 cid 0 32 0 0 primitive -1609 ip_packet_type 1 8 0 0 primitive -1609 send_to_syslog 1 8 0 0 primitive -1609 reset_counter 1 8 0 0 primitive -1609 not_in_use 1 8 0 0 primitive -1609 session_id_high 1 32 0 0 primitive -1609 session_id_low 1 32 0 0 primitive 112 channel_id 0 32 0 0 primitive 112 dns_resolved 0 32 0 0 primitive 112 url 0 8 257 0 primitive @@ -13983,7 +13985,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 4 ssrtp_esn_0 1 16 0 0 primitive 4 ssrtp_esn_1 1 16 0 0 primitive 4 ssrtp_esn_2 1 16 0 0 primitive -4 l_intercept_rtp_seq_num 1 16 0 0 primitive +4 secondary_rtp_seq_num 1 16 0 0 primitive 4 rtp_tx_state_ssrc 1 32 0 0 primitive 4 rtp_tx_state_srtp_rtcp_index 1 32 0 0 primitive 4 rtp_tx_state_srtp_roc 1 32 0 0 primitive @@ -13992,7 +13994,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 4 rtp_tx_state_ssrtp_esn_0 1 16 0 0 primitive 4 rtp_tx_state_ssrtp_esn_1 1 16 0 0 primitive 4 rtp_tx_state_ssrtp_esn_2 1 16 0 0 primitive -4 rtp_tx_state_l_intercept_rtp_seq_num 1 16 0 0 primitive +4 rtp_tx_state_secondary_rtp_seq_num 1 16 0 0 primitive 4 state_update_time_stamp 1 32 0 0 primitive 610 channel_id 0 32 0 0 primitive 610 address_family 0 32 0 0 AddressFamily @@ -14068,7 +14070,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 610 ssrtp_esn_0 1 16 0 0 primitive 610 ssrtp_esn_1 1 16 0 0 primitive 610 ssrtp_esn_2 1 16 0 0 primitive -610 l_intercept_rtp_seq_num 1 16 0 0 primitive +610 secondary_rtp_seq_num 1 16 0 0 primitive 610 rtp_tx_state_ssrc 1 32 0 0 primitive 610 rtp_tx_state_srtp_rtcp_index 1 32 0 0 primitive 610 rtp_tx_state_srtp_roc 1 32 0 0 primitive @@ -14077,7 +14079,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 610 rtp_tx_state_ssrtp_esn_0 1 16 0 0 primitive 610 rtp_tx_state_ssrtp_esn_1 1 16 0 0 primitive 610 rtp_tx_state_ssrtp_esn_2 1 16 0 0 primitive -610 rtp_tx_state_l_intercept_rtp_seq_num 1 16 0 0 primitive +610 rtp_tx_state_secondary_rtp_seq_num 1 16 0 0 primitive 610 state_update_time_stamp 1 32 0 0 primitive 611 channel_id 0 32 0 0 primitive 611 address_family 0 32 0 0 AddressFamily @@ -14153,7 +14155,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 611 ssrtp_esn_0 1 16 0 0 primitive 611 ssrtp_esn_1 1 16 0 0 primitive 611 ssrtp_esn_2 1 16 0 0 primitive -611 l_intercept_rtp_seq_num 1 16 0 0 primitive +611 secondary_rtp_seq_num 1 16 0 0 primitive 611 rtp_tx_state_ssrc 1 32 0 0 primitive 611 rtp_tx_state_srtp_rtcp_index 1 32 0 0 primitive 611 rtp_tx_state_srtp_roc 1 32 0 0 primitive @@ -14162,7 +14164,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 611 rtp_tx_state_ssrtp_esn_0 1 16 0 0 primitive 611 rtp_tx_state_ssrtp_esn_1 1 16 0 0 primitive 611 rtp_tx_state_ssrtp_esn_2 1 16 0 0 primitive -611 rtp_tx_state_l_intercept_rtp_seq_num 1 16 0 0 primitive +611 rtp_tx_state_secondary_rtp_seq_num 1 16 0 0 primitive 611 state_update_time_stamp 1 32 0 0 primitive 35 channel_id 0 32 0 0 primitive 35 de_activation_option 1 32 0 0 primitive @@ -14195,6 +14197,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 34 reserved2 0 32 0 0 primitive 34 remote_t38_port 1 16 0 0 primitive 34 ip_tos_field_in_udp_packet 1 8 0 0 primitive +34 alignment1 1 8 0 0 primitive 34 address_family 0 32 0 0 AddressFamily 34 addr_0 1 32 0 0 primitive 34 addr_1 1 32 0 0 primitive @@ -14206,6 +14209,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 34 i_pvx_addr32_addr_2 1 32 0 0 primitive 34 i_pvx_addr32_addr_3 1 32 0 0 primitive 34 t38_fax_session_immediate_start 1 8 0 0 primitive +34 alignment2 1 8 0 0 primitive 34 local_port 1 16 0 0 primitive 34 local_interface_id 0 32 0 0 primitive 34 mpe_handle 1 16 0 0 primitive @@ -14399,7 +14403,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 1611 evs_build_cmr 1 8 0 0 primitive 1611 http_streaming 1 8 0 0 primitive 1611 evs_tx_bit_rate 1 16 0 0 primitive -1611 media_stun_forking_operation_mode 0 32 0 0 primitive +1611 media_stun_forking_operation_mode 1 8 0 0 primitive 1611 unused_alignment 1 8 0 0 primitive 1611 tls_context 0 32 0 0 primitive 1611 dtls_remote_fingerprint_alg 0 32 0 0 primitive @@ -14590,7 +14594,7 @@ FirmwareModule HA_MODULE_BOUNDARY 29 1611 open_sbc_channel_evs_build_cmr 1 8 0 0 primitive 1611 open_sbc_channel_http_streaming 1 8 0 0 primitive 1611 open_sbc_channel_evs_tx_bit_rate 1 16 0 0 primitive -1611 open_sbc_channel_media_stun_forking_operation_mode 0 32 0 0 primitive +1611 open_sbc_channel_media_stun_forking_operation_mode 1 8 0 0 primitive 1611 open_sbc_channel_unused_alignment 1 8 0 0 primitive 1611 open_sbc_channel_tls_context 0 32 0 0 primitive 1611 open_sbc_channel_dtls_remote_fingerprint_alg 0 32 0 0 primitive