diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2015-08-08 19:11:20 +0200 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2015-08-11 16:33:38 +0000 |
commit | de70d2a18a6d740df47ce764a81e195c158b2e51 (patch) | |
tree | c3509682fca829248b7fef74865a19c12b168243 /asn1 | |
parent | d6c6b0899d46c2592388c8830fc7a6e0e1e2ae8a (diff) |
H225: fix indent (use 2 spaces) and add modelines info
Change-Id: Ibe4cf8d004c6c94f745e5c620100af9483fa6a31
Reviewed-on: https://code.wireshark.org/review/9934
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/h225/h225.cnf | 168 | ||||
-rw-r--r-- | asn1/h225/packet-h225-template.c | 1673 | ||||
-rw-r--r-- | asn1/h225/packet-h225-template.h | 83 |
3 files changed, 974 insertions, 950 deletions
diff --git a/asn1/h225/h225.cnf b/asn1/h225/h225.cnf index 485d9cb589..b34e55a3e6 100644 --- a/asn1/h225/h225.cnf +++ b/asn1/h225/h225.cnf @@ -31,7 +31,7 @@ RasMessage EXTERN WS_DLL NonStandardParameter PublicTypeOfNumber PrivateTypeOfNumber -AliasAddress NO_PROT_PREFIX +AliasAddress NO_PROT_PREFIX PartyNumber PresentationIndicator ScreeningIndicator @@ -238,61 +238,61 @@ IsupNumber/nationalStandardPartyNumber isupNationalStandardPartyNumber #---------------------------------------------------------------------------------------- #.FN_BODY H323-UU-PDU/h323-message-body VAL_PTR = &message_body_val - gint32 message_body_val; + gint32 message_body_val; - contains_faststart = FALSE; - call_id_guid = NULL; + contains_faststart = FALSE; + call_id_guid = NULL; %(DEFAULT_BODY)s - col_append_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "CS: %%s ", - val_to_str(message_body_val, T_h323_message_body_vals, "<unknown>")); + col_append_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "CS: %%s ", + val_to_str(message_body_val, T_h323_message_body_vals, "<unknown>")); - if (h225_pi->msg_type == H225_CS) { - /* Don't override msg_tag value from IRR */ - h225_pi->msg_tag = message_body_val; - } + if (h225_pi->msg_type == H225_CS) { + /* Don't override msg_tag value from IRR */ + h225_pi->msg_tag = message_body_val; + } - if (call_id_guid) { - h225_pi->guid = *call_id_guid; - } + if (call_id_guid) { + h225_pi->guid = *call_id_guid; + } - if (contains_faststart == TRUE ) - { - col_append_str(%(ACTX)s->pinfo->cinfo, COL_INFO, "OpenLogicalChannel " ); - } + if (contains_faststart == TRUE ) + { + col_append_str(%(ACTX)s->pinfo->cinfo, COL_INFO, "OpenLogicalChannel " ); + } - col_set_fence(%(ACTX)s->pinfo->cinfo,COL_INFO); + col_set_fence(%(ACTX)s->pinfo->cinfo,COL_INFO); #.END #---------------------------------------------------------------------------------------- #.FN_BODY FastStart/_item VAL_PTR = &value_tvb - tvbuff_t *value_tvb = NULL; - char codec_str[50]; - codec_str[0] = '\0'; + tvbuff_t *value_tvb = NULL; + char codec_str[50]; + codec_str[0] = '\0'; %(DEFAULT_BODY)s - if (value_tvb && tvb_reported_length(value_tvb)) { - dissect_h245_FastStart_OLC(value_tvb, %(ACTX)s->pinfo, tree, codec_str); - } + if (value_tvb && tvb_reported_length(value_tvb)) { + dissect_h245_FastStart_OLC(value_tvb, %(ACTX)s->pinfo, tree, codec_str); + } - /* Add to packet info */ - g_snprintf(h225_pi->frame_label, 50, "%%s %%s", h225_pi->frame_label, codec_str); + /* Add to packet info */ + g_snprintf(h225_pi->frame_label, 50, "%%s %%s", h225_pi->frame_label, codec_str); - contains_faststart = TRUE; - h225_pi->is_faststart = TRUE; + contains_faststart = TRUE; + h225_pi->is_faststart = TRUE; #.END #---------------------------------------------------------------------------------------- #.FN_BODY RasMessage VAL_PTR = &rasmessage_value - gint32 rasmessage_value; + gint32 rasmessage_value; - call_id_guid = NULL; + call_id_guid = NULL; %(DEFAULT_BODY)s - col_add_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "RAS: %%s ", - val_to_str(rasmessage_value, h225_RasMessage_vals, "<unknown>")); + col_add_fstr(%(ACTX)s->pinfo->cinfo, COL_INFO, "RAS: %%s ", + val_to_str(rasmessage_value, h225_RasMessage_vals, "<unknown>")); - h225_pi->msg_tag = rasmessage_value; - if (call_id_guid) { - h225_pi->guid = *call_id_guid; - } + h225_pi->msg_tag = rasmessage_value; + if (call_id_guid) { + h225_pi->guid = *call_id_guid; + } #.END #---------------------------------------------------------------------------------------- #.FN_HDR DestinationInfo/_item @@ -330,14 +330,14 @@ IsupNumber/nationalStandardPartyNumber isupNationalStandardPartyNumber #.FN_PARS H245TransportAddress/ipAddress/port VAL_PTR = &ipv4_port #---------------------------------------------------------------------------------------- #.FN_BODY ParallelH245Control/_item VAL_PTR = &h245_tvb - tvbuff_t *h245_tvb = NULL; + tvbuff_t *h245_tvb = NULL; %(DEFAULT_BODY)s next_tvb_add_handle(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle); #.END #---------------------------------------------------------------------------------------- #.FN_BODY H245Control/_item VAL_PTR = &h245_tvb - tvbuff_t *h245_tvb = NULL; + tvbuff_t *h245_tvb = NULL; %(DEFAULT_BODY)s next_tvb_add_handle(&h245_list, h245_tvb, (h225_h245_in_tree)?tree:NULL, h245dg_handle); @@ -363,9 +363,9 @@ IsupNumber/nationalStandardPartyNumber isupNationalStandardPartyNumber /* Add to packet info */ h225_pi->cs_type = H225_PROGRESS; if (contains_faststart == TRUE ) - g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); + g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); else - g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); + g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); #.END #---------------------------------------------------------------------------------------- #.FN_FTR SetupAcknowledge-UUIE @@ -390,27 +390,27 @@ IsupNumber/nationalStandardPartyNumber isupNationalStandardPartyNumber /* Add to packet info */ h225_pi->cs_type = H225_SETUP; if (contains_faststart == TRUE ) - g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); + g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); else - g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); + g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); #.END #---------------------------------------------------------------------------------------- #.FN_FTR CallProceeding-UUIE /* Add to packet info */ h225_pi->cs_type = H225_CALL_PROCEDING; if (contains_faststart == TRUE ) - g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); + g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); else - g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); + g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); #.END #---------------------------------------------------------------------------------------- #.FN_FTR Alerting-UUIE /* Add to packet info */ h225_pi->cs_type = H225_ALERTING; if (contains_faststart == TRUE ) - g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); + g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); else - g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); + g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); #.END #---------------------------------------------------------------------------------------- #.FN_FTR ReleaseComplete-UUIE @@ -423,43 +423,43 @@ IsupNumber/nationalStandardPartyNumber isupNationalStandardPartyNumber /* Add to packet info */ h225_pi->cs_type = H225_CONNECT; if (contains_faststart == TRUE ) - g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); + g_snprintf(h225_pi->frame_label, 50, "%s OLC (%s)", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>"), h225_pi->frame_label); else - g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); + g_snprintf(h225_pi->frame_label, 50, "%s", val_to_str(h225_pi->cs_type, T_h323_message_body_vals, "<unknown>")); #.END #---------------------------------------------------------------------------------------- #.FN_HDR H245TransportAddress - ipv4_address=0; - ipv4_port=0; + ipv4_address=0; + ipv4_port=0; #.END #---------------------------------------------------------------------------------------- #.FN_FTR H245TransportAddress - /* we need this info for TAPing */ - h225_pi->is_h245 = TRUE; - h225_pi->h245_address = ipv4_address; - h225_pi->h245_port = ipv4_port; + /* we need this info for TAPing */ + h225_pi->is_h245 = TRUE; + h225_pi->h245_address = ipv4_address; + h225_pi->h245_port = ipv4_port; - if((!actx->pinfo->fd->flags.visited) && ipv4_address!=0 && ipv4_port!=0 && h245_handle){ - address src_addr; - conversation_t *conv=NULL; + if((!actx->pinfo->fd->flags.visited) && ipv4_address!=0 && ipv4_port!=0 && h245_handle){ + address src_addr; + conversation_t *conv=NULL; - SET_ADDRESS(&src_addr, AT_IPv4, 4, &ipv4_address); + SET_ADDRESS(&src_addr, AT_IPv4, 4, &ipv4_address); - conv=find_conversation(actx->pinfo->fd->num, &src_addr, &src_addr, PT_TCP, ipv4_port, ipv4_port, NO_ADDR_B|NO_PORT_B); - if(!conv){ - conv=conversation_new(actx->pinfo->fd->num, &src_addr, &src_addr, PT_TCP, ipv4_port, ipv4_port, NO_ADDR2|NO_PORT2); - conversation_set_dissector(conv, h245_handle); - } - } + conv=find_conversation(actx->pinfo->fd->num, &src_addr, &src_addr, PT_TCP, ipv4_port, ipv4_port, NO_ADDR_B|NO_PORT_B); + if(!conv){ + conv=conversation_new(actx->pinfo->fd->num, &src_addr, &src_addr, PT_TCP, ipv4_port, ipv4_port, NO_ADDR2|NO_PORT2); + conversation_set_dissector(conv, h245_handle); + } + } #.END #---------------------------------------------------------------------------------------- #.FN_BODY FacilityReason VAL_PTR = &value - gint32 value; + gint32 value; %(DEFAULT_BODY)s - h225_pi->reason = value; + h225_pi->reason = value; #.END #---------------------------------------------------------------------------------------- #.FN_BODY GatekeeperRejectReason VAL_PTR = &value @@ -553,12 +553,12 @@ IsupNumber/nationalStandardPartyNumber isupNationalStandardPartyNumber #.FN_PARS RequestSeqNum VAL_PTR = &(h225_pi->requestSeqNum) #---------------------------------------------------------------------------------------- #.FN_BODY H323-UU-PDU/h4501SupplementaryService/_item VAL_PTR = &h4501_tvb - tvbuff_t *h4501_tvb = NULL; + tvbuff_t *h4501_tvb = NULL; %(DEFAULT_BODY)s - if (h4501_tvb && tvb_reported_length(h4501_tvb)) { - call_dissector(h4501_handle, h4501_tvb, %(ACTX)s->pinfo, tree); - } + if (h4501_tvb && tvb_reported_length(h4501_tvb)) { + call_dissector(h4501_handle, h4501_tvb, %(ACTX)s->pinfo, tree); + } #.END #---------------------------------------------------------------------------------------- @@ -588,21 +588,21 @@ NonStandardIdentifier/object FN_VARIANT = _str VAL_PTR = &nsiOID #.END #.FN_BODY NonStandardIdentifier VAL_PTR = &value - gint32 value; + gint32 value; - nsiOID = ""; - h221NonStandard = 0; + nsiOID = ""; + h221NonStandard = 0; %(DEFAULT_BODY)s - switch (value) { - case 0 : /* object */ - nsp_handle = dissector_get_string_handle(nsp_object_dissector_table, nsiOID); - break; - case 1 : /* h221NonStandard */ - nsp_handle = dissector_get_uint_handle(nsp_h221_dissector_table, h221NonStandard); - break; - default : - nsp_handle = NULL; + switch (value) { + case 0 : /* object */ + nsp_handle = dissector_get_string_handle(nsp_object_dissector_table, nsiOID); + break; + case 1 : /* h221NonStandard */ + nsp_handle = dissector_get_uint_handle(nsp_h221_dissector_table, h221NonStandard); + break; + default : + nsp_handle = NULL; } #.END @@ -672,7 +672,7 @@ H221NonStandard/manufacturerCode VAL_PTR = &manufacturerCode gefx = gef_ctx_get(actx->private_data); if (gefx) { ti = proto_tree_add_string(tree, hf_h225_debug_dissector_try_string, tvb, offset>>3, 0, gefx->key); - PROTO_ITEM_SET_HIDDEN(ti); + PROTO_ITEM_SET_HIDDEN(ti); dissector_try_string(gef_name_dissector_table, gefx->key, tvb_new_subset(tvb, offset>>3, 0, 0), actx->pinfo, tree, actx); } actx->private_data = gefx; /* subdissector could overwrite it */ @@ -706,7 +706,7 @@ H221NonStandard/manufacturerCode VAL_PTR = &manufacturerCode gefx = gef_ctx_get(actx->private_data); if (gefx) { ti = proto_tree_add_string(tree, hf_h225_debug_dissector_try_string, tvb, offset>>3, 0, gefx->key); - PROTO_ITEM_SET_HIDDEN(ti); + PROTO_ITEM_SET_HIDDEN(ti); dissector_try_string(gef_content_dissector_table, gefx->key, value_tvb, %(ACTX)s->pinfo, %(TREE)s, %(ACTX)s); } #.END diff --git a/asn1/h225/packet-h225-template.c b/asn1/h225/packet-h225-template.c index 2a44e8b827..cf6cfc31fb 100644 --- a/asn1/h225/packet-h225-template.c +++ b/asn1/h225/packet-h225-template.c @@ -69,20 +69,20 @@ static void ras_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre /* Item of ras request list*/ typedef struct _h225ras_call_t { - guint32 requestSeqNum; - e_guid_t guid; - guint32 req_num; /* frame number request seen */ - guint32 rsp_num; /* frame number response seen */ - nstime_t req_time; /* arrival time of request */ - gboolean responded; /* true, if request has been responded */ - struct _h225ras_call_t *next_call; /* pointer to next ras request with same SequenceNumber and conversation handle */ + guint32 requestSeqNum; + e_guid_t guid; + guint32 req_num; /* frame number request seen */ + guint32 rsp_num; /* frame number response seen */ + nstime_t req_time; /* arrival time of request */ + gboolean responded; /* true, if request has been responded */ + struct _h225ras_call_t *next_call; /* pointer to next ras request with same SequenceNumber and conversation handle */ } h225ras_call_t; /* Item of ras-request key list*/ typedef struct _h225ras_call_info_key { - guint reqSeqNum; - conversation_t *conversation; + guint reqSeqNum; + conversation_t *conversation; } h225ras_call_info_key; static h225_packet_info pi_arr[5]; /* We assuming a maximum of 5 H.225 messages per packet */ @@ -157,32 +157,32 @@ static guint32 manufacturerCode; static const char *tpOID; static const value_string ras_message_category[] = { - { 0, "Gatekeeper "}, - { 1, "Registration "}, - { 2, "UnRegistration"}, - { 3, "Admission "}, - { 4, "Bandwidth "}, - { 5, "Disengage "}, - { 6, "Location "}, - { 0, NULL } + { 0, "Gatekeeper "}, + { 1, "Registration "}, + { 2, "UnRegistration"}, + { 3, "Admission "}, + { 4, "Bandwidth "}, + { 5, "Disengage "}, + { 6, "Location "}, + { 0, NULL } }; typedef enum _ras_type { - RAS_REQUEST, - RAS_CONFIRM, - RAS_REJECT, - RAS_OTHER + RAS_REQUEST, + RAS_CONFIRM, + RAS_REJECT, + RAS_OTHER }ras_type; typedef enum _ras_category { - RAS_GATEKEEPER, - RAS_REGISTRATION, - RAS_UNREGISTRATION, - RAS_ADMISSION, - RAS_BANDWIDTH, - RAS_DISENGAGE, - RAS_LOCATION, - RAS_OTHERS + RAS_GATEKEEPER, + RAS_REGISTRATION, + RAS_UNREGISTRATION, + RAS_ADMISSION, + RAS_BANDWIDTH, + RAS_DISENGAGE, + RAS_LOCATION, + RAS_OTHERS }ras_category; #define NUM_RAS_STATS 7 @@ -190,60 +190,60 @@ typedef enum _ras_category { static gboolean h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi) { - rtd_data_t* rtd_data = (rtd_data_t*)phs; - rtd_stat_table* rs = &rtd_data->stat_table; - const h225_packet_info *pi=(const h225_packet_info *)phi; - - ras_type rasmsg_type = RAS_OTHER; - ras_category rascategory = RAS_OTHERS; - - if (pi->msg_type != H225_RAS || pi->msg_tag == -1) { - /* No RAS Message or uninitialized msg_tag -> return */ - return FALSE; - } - - if (pi->msg_tag < 21) { - /* */ - rascategory = (ras_category)(pi->msg_tag / 3); - rasmsg_type = (ras_type)(pi->msg_tag % 3); - } - else { - /* No SRT yet (ToDo) */ - return FALSE; - } - - switch(rasmsg_type) { - - case RAS_REQUEST: - if(pi->is_duplicate){ - rs->time_stats[rascategory].req_dup_num++; - } - else { - rs->time_stats[rascategory].open_req_num++; - } - break; - - case RAS_CONFIRM: - /* no break - delay stats are identical for Confirm and Reject */ - case RAS_REJECT: - if(pi->is_duplicate){ - /* Duplicate is ignored */ - rs->time_stats[rascategory].rsp_dup_num++; - } - else if (!pi->request_available) { - /* no request was seen, ignore response */ - rs->time_stats[rascategory].disc_rsp_num++; - } - else { - rs->time_stats[rascategory].open_req_num--; - time_stat_update(&(rs->time_stats[rascategory].rtd[0]),&(pi->delta_time), pinfo); - } - break; - - default: - return FALSE; - } - return TRUE; + rtd_data_t* rtd_data = (rtd_data_t*)phs; + rtd_stat_table* rs = &rtd_data->stat_table; + const h225_packet_info *pi=(const h225_packet_info *)phi; + + ras_type rasmsg_type = RAS_OTHER; + ras_category rascategory = RAS_OTHERS; + + if (pi->msg_type != H225_RAS || pi->msg_tag == -1) { + /* No RAS Message or uninitialized msg_tag -> return */ + return FALSE; + } + + if (pi->msg_tag < 21) { + /* */ + rascategory = (ras_category)(pi->msg_tag / 3); + rasmsg_type = (ras_type)(pi->msg_tag % 3); + } + else { + /* No SRT yet (ToDo) */ + return FALSE; + } + + switch(rasmsg_type) { + + case RAS_REQUEST: + if(pi->is_duplicate){ + rs->time_stats[rascategory].req_dup_num++; + } + else { + rs->time_stats[rascategory].open_req_num++; + } + break; + + case RAS_CONFIRM: + /* no break - delay stats are identical for Confirm and Reject */ + case RAS_REJECT: + if(pi->is_duplicate){ + /* Duplicate is ignored */ + rs->time_stats[rascategory].rsp_dup_num++; + } + else if (!pi->request_available) { + /* no request was seen, ignore response */ + rs->time_stats[rascategory].disc_rsp_num++; + } + else { + rs->time_stats[rascategory].open_req_num--; + time_stat_update(&(rs->time_stats[rascategory].rtd[0]),&(pi->delta_time), pinfo); + } + break; + + default: + return FALSE; + } + return TRUE; } #include "packet-h225-fn.c" @@ -259,78 +259,78 @@ void proto_reg_handoff_h225(void); /* compare 2 keys */ static gint h225ras_call_equal(gconstpointer k1, gconstpointer k2) { - const h225ras_call_info_key* key1 = (const h225ras_call_info_key*) k1; - const h225ras_call_info_key* key2 = (const h225ras_call_info_key*) k2; + const h225ras_call_info_key* key1 = (const h225ras_call_info_key*) k1; + const h225ras_call_info_key* key2 = (const h225ras_call_info_key*) k2; - return (key1->reqSeqNum == key2->reqSeqNum && - key1->conversation == key2->conversation); + return (key1->reqSeqNum == key2->reqSeqNum && + key1->conversation == key2->conversation); } /* calculate a hash key */ static guint h225ras_call_hash(gconstpointer k) { - const h225ras_call_info_key* key = (const h225ras_call_info_key*) k; + const h225ras_call_info_key* key = (const h225ras_call_info_key*) k; - return key->reqSeqNum + GPOINTER_TO_UINT(key->conversation); + return key->reqSeqNum + GPOINTER_TO_UINT(key->conversation); } h225ras_call_t * find_h225ras_call(h225ras_call_info_key *h225ras_call_key ,int category) { - h225ras_call_t *h225ras_call = NULL; - h225ras_call = (h225ras_call_t *)g_hash_table_lookup(ras_calls[category], h225ras_call_key); + h225ras_call_t *h225ras_call = NULL; + h225ras_call = (h225ras_call_t *)g_hash_table_lookup(ras_calls[category], h225ras_call_key); - return h225ras_call; + return h225ras_call; } h225ras_call_t * new_h225ras_call(h225ras_call_info_key *h225ras_call_key, packet_info *pinfo, e_guid_t *guid, int category) { - h225ras_call_info_key *new_h225ras_call_key; - h225ras_call_t *h225ras_call = NULL; - - - /* Prepare the value data. - "req_num" and "rsp_num" are frame numbers; - frame numbers are 1-origin, so we use 0 - to mean "we don't yet know in which frame - the reply for this call appears". */ - new_h225ras_call_key = wmem_new(wmem_file_scope(), h225ras_call_info_key); - new_h225ras_call_key->reqSeqNum = h225ras_call_key->reqSeqNum; - new_h225ras_call_key->conversation = h225ras_call_key->conversation; - h225ras_call = wmem_new(wmem_file_scope(), h225ras_call_t); - h225ras_call->req_num = pinfo->fd->num; - h225ras_call->rsp_num = 0; - h225ras_call->requestSeqNum = h225ras_call_key->reqSeqNum; - h225ras_call->responded = FALSE; - h225ras_call->next_call = NULL; - h225ras_call->req_time=pinfo->fd->abs_ts; - h225ras_call->guid=*guid; - /* store it */ - g_hash_table_insert(ras_calls[category], new_h225ras_call_key, h225ras_call); - - return h225ras_call; + h225ras_call_info_key *new_h225ras_call_key; + h225ras_call_t *h225ras_call = NULL; + + + /* Prepare the value data. + "req_num" and "rsp_num" are frame numbers; + frame numbers are 1-origin, so we use 0 + to mean "we don't yet know in which frame + the reply for this call appears". */ + new_h225ras_call_key = wmem_new(wmem_file_scope(), h225ras_call_info_key); + new_h225ras_call_key->reqSeqNum = h225ras_call_key->reqSeqNum; + new_h225ras_call_key->conversation = h225ras_call_key->conversation; + h225ras_call = wmem_new(wmem_file_scope(), h225ras_call_t); + h225ras_call->req_num = pinfo->fd->num; + h225ras_call->rsp_num = 0; + h225ras_call->requestSeqNum = h225ras_call_key->reqSeqNum; + h225ras_call->responded = FALSE; + h225ras_call->next_call = NULL; + h225ras_call->req_time=pinfo->fd->abs_ts; + h225ras_call->guid=*guid; + /* store it */ + g_hash_table_insert(ras_calls[category], new_h225ras_call_key, h225ras_call); + + return h225ras_call; } h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pinfo, e_guid_t *guid, int category _U_) { - h225ras_call_t *h225ras_call = NULL; - - /* Prepare the value data. - "req_num" and "rsp_num" are frame numbers; - frame numbers are 1-origin, so we use 0 - to mean "we don't yet know in which frame - the reply for this call appears". */ - h225ras_call = wmem_new(wmem_file_scope(), h225ras_call_t); - h225ras_call->req_num = pinfo->fd->num; - h225ras_call->rsp_num = 0; - h225ras_call->requestSeqNum = prev_call->requestSeqNum; - h225ras_call->responded = FALSE; - h225ras_call->next_call = NULL; - h225ras_call->req_time=pinfo->fd->abs_ts; - h225ras_call->guid=*guid; - - prev_call->next_call = h225ras_call; - return h225ras_call; + h225ras_call_t *h225ras_call = NULL; + + /* Prepare the value data. + "req_num" and "rsp_num" are frame numbers; + frame numbers are 1-origin, so we use 0 + to mean "we don't yet know in which frame + the reply for this call appears". */ + h225ras_call = wmem_new(wmem_file_scope(), h225ras_call_t); + h225ras_call->req_num = pinfo->fd->num; + h225ras_call->rsp_num = 0; + h225ras_call->requestSeqNum = prev_call->requestSeqNum; + h225ras_call->responded = FALSE; + h225ras_call->next_call = NULL; + h225ras_call->req_time=pinfo->fd->abs_ts; + h225ras_call->guid=*guid; + + prev_call->next_call = h225ras_call; + return h225ras_call; } /* Init routine for hash tables and delay calculation @@ -341,94 +341,94 @@ h225ras_call_t * append_h225ras_call(h225ras_call_t *prev_call, packet_info *pin static void h225_init_routine(void) { - int i; - /* create new hash-tables for RAS SRT */ + int i; + /* create new hash-tables for RAS SRT */ - for(i=0;i<7;i++) { - ras_calls[i] = g_hash_table_new(h225ras_call_hash, h225ras_call_equal); - } + for(i=0;i<7;i++) { + ras_calls[i] = g_hash_table_new(h225ras_call_hash, h225ras_call_equal); + } } static void h225_cleanup_routine(void) { - int i; + int i; - /* free hash-tables for RAS SRT */ - for(i=0;i<7;i++) { - g_hash_table_destroy(ras_calls[i]); - } + /* free hash-tables for RAS SRT */ + for(i=0;i<7;i++) { + g_hash_table_destroy(ras_calls[i]); + } } static int dissect_h225_H323UserInformation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - proto_item *it; - proto_tree *tr; - int offset = 0; + proto_item *it; + proto_tree *tr; + int offset = 0; - pi_current++; - if(pi_current==5){ - pi_current=0; - } - h225_pi=&pi_arr[pi_current]; + pi_current++; + if(pi_current==5){ + pi_current=0; + } + h225_pi=&pi_arr[pi_current]; - /* Init struct for collecting h225_packet_info */ - reset_h225_packet_info(h225_pi); - h225_pi->msg_type = H225_CS; + /* Init struct for collecting h225_packet_info */ + reset_h225_packet_info(h225_pi); + h225_pi->msg_type = H225_CS; - next_tvb_init(&h245_list); - next_tvb_init(&tp_list); + next_tvb_init(&h245_list); + next_tvb_init(&tp_list); - col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); - col_clear(pinfo->cinfo, COL_INFO); + col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); + col_clear(pinfo->cinfo, COL_INFO); - it=proto_tree_add_protocol_format(tree, proto_h225, tvb, 0, -1, PSNAME" CS"); - tr=proto_item_add_subtree(it, ett_h225); + it=proto_tree_add_protocol_format(tree, proto_h225, tvb, 0, -1, PSNAME" CS"); + tr=proto_item_add_subtree(it, ett_h225); - offset = dissect_H323_UserInformation_PDU(tvb, pinfo, tr, NULL); + offset = dissect_H323_UserInformation_PDU(tvb, pinfo, tr, NULL); - if (h245_list.count){ - col_append_str(pinfo->cinfo, COL_PROTOCOL, "/"); - col_set_fence(pinfo->cinfo, COL_PROTOCOL); - } + if (h245_list.count){ + col_append_str(pinfo->cinfo, COL_PROTOCOL, "/"); + col_set_fence(pinfo->cinfo, COL_PROTOCOL); + } - next_tvb_call(&h245_list, pinfo, tree, h245dg_handle, data_handle); - next_tvb_call(&tp_list, pinfo, tree, NULL, data_handle); + next_tvb_call(&h245_list, pinfo, tree, h245dg_handle, data_handle); + next_tvb_call(&tp_list, pinfo, tree, NULL, data_handle); - tap_queue_packet(h225_tap, pinfo, h225_pi); + tap_queue_packet(h225_tap, pinfo, h225_pi); - return offset; + return offset; } static int dissect_h225_h225_RasMessage(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_){ - proto_item *it; - proto_tree *tr; - guint32 offset=0; + proto_item *it; + proto_tree *tr; + guint32 offset=0; - pi_current++; - if(pi_current==5){ - pi_current=0; - } - h225_pi=&pi_arr[pi_current]; + pi_current++; + if(pi_current==5){ + pi_current=0; + } + h225_pi=&pi_arr[pi_current]; - /* Init struct for collecting h225_packet_info */ - reset_h225_packet_info(h225_pi); - h225_pi->msg_type = H225_RAS; + /* Init struct for collecting h225_packet_info */ + reset_h225_packet_info(h225_pi); + h225_pi->msg_type = H225_RAS; - col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); + col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); - it=proto_tree_add_protocol_format(tree, proto_h225, tvb, offset, -1, PSNAME" RAS"); - tr=proto_item_add_subtree(it, ett_h225); + it=proto_tree_add_protocol_format(tree, proto_h225, tvb, offset, -1, PSNAME" RAS"); + tr=proto_item_add_subtree(it, ett_h225); - offset = dissect_RasMessage_PDU(tvb, pinfo, tr, NULL); + offset = dissect_RasMessage_PDU(tvb, pinfo, tr, NULL); - ras_call_matching(tvb, pinfo, tr, h225_pi); + ras_call_matching(tvb, pinfo, tr, h225_pi); - tap_queue_packet(h225_tap, pinfo, h225_pi); + tap_queue_packet(h225_tap, pinfo, h225_pi); - return offset; + return offset; } @@ -453,13 +453,13 @@ dissect_h225_h225_RasMessage(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree /* TAP STAT INFO */ typedef enum { - MESSAGE_TYPE_COLUMN = 0, - COUNT_COLUMN + MESSAGE_TYPE_COLUMN = 0, + COUNT_COLUMN } h225_stat_columns; typedef struct _h225_table_item { - guint count; /* Message count */ - guint table_idx; /* stat_table index */ + guint count; /* Message count */ + guint table_idx; /* stat_table index */ } h225_table_item_t; static stat_tap_table_item h225_stat_fields[] = {{TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "Message Type or Reason", "%-25s"}, {TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Count", "%d"}}; @@ -484,339 +484,339 @@ static guint other_idx; static void h225_stat_init(new_stat_tap_ui* new_stat, new_stat_tap_gui_init_cb gui_callback, void* gui_data) { - int num_fields = sizeof(h225_stat_fields)/sizeof(stat_tap_table_item); - new_stat_tap_table* table = new_stat_tap_init_table("H.225 Messages and Message Reasons", num_fields, 0, NULL, gui_callback, gui_data); - int row_idx = 0, msg_idx; - stat_tap_table_item_type items[sizeof(h225_stat_fields)/sizeof(stat_tap_table_item)]; - - new_stat_tap_add_table(new_stat, table); - - items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING; - items[COUNT_COLUMN].type = TABLE_ITEM_UINT; - items[COUNT_COLUMN].value.uint_value = 0; - - /* Add a row for each value type */ - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - h225_RasMessage_vals[msg_idx].strptr - ? h225_RasMessage_vals[msg_idx].strptr - : "Unknown RAS message"; - ras_msg_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (h225_RasMessage_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - T_h323_message_body_vals[msg_idx].strptr - ? T_h323_message_body_vals[msg_idx].strptr - : "Unknown CS message"; - cs_msg_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (T_h323_message_body_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - GatekeeperRejectReason_vals[msg_idx].strptr - ? GatekeeperRejectReason_vals[msg_idx].strptr - : "Unknown gatekeeper reject reason"; - grj_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (GatekeeperRejectReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - RegistrationRejectReason_vals[msg_idx].strptr - ? RegistrationRejectReason_vals[msg_idx].strptr - : "Unknown registration reject reason"; - rrj_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (RegistrationRejectReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - UnregRequestReason_vals[msg_idx].strptr - ? UnregRequestReason_vals[msg_idx].strptr - : "Unknown unregistration request reason"; - urq_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (UnregRequestReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - UnregRejectReason_vals[msg_idx].strptr - ? UnregRejectReason_vals[msg_idx].strptr - : "Unknown unregistration reject reason"; - urj_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (UnregRejectReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - AdmissionRejectReason_vals[msg_idx].strptr - ? AdmissionRejectReason_vals[msg_idx].strptr - : "Unknown admission reject reason"; - arj_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (AdmissionRejectReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - BandRejectReason_vals[msg_idx].strptr - ? BandRejectReason_vals[msg_idx].strptr - : "Unknown band reject reason"; - brj_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (BandRejectReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - DisengageReason_vals[msg_idx].strptr - ? DisengageReason_vals[msg_idx].strptr - : "Unknown disengage reason"; - drq_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (DisengageReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - DisengageRejectReason_vals[msg_idx].strptr - ? DisengageRejectReason_vals[msg_idx].strptr - : "Unknown disengage reject reason"; - drj_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (DisengageRejectReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - LocationRejectReason_vals[msg_idx].strptr - ? LocationRejectReason_vals[msg_idx].strptr - : "Unknown location reject reason"; - lrj_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (LocationRejectReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - InfoRequestNakReason_vals[msg_idx].strptr - ? InfoRequestNakReason_vals[msg_idx].strptr - : "Unknown info request nak reason"; - irqnak_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (InfoRequestNakReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - h225_ReleaseCompleteReason_vals[msg_idx].strptr - ? h225_ReleaseCompleteReason_vals[msg_idx].strptr - : "Unknown release complete reason"; - rel_cmp_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (h225_ReleaseCompleteReason_vals[msg_idx].strptr); - - msg_idx = 0; - do - { - items[MESSAGE_TYPE_COLUMN].value.string_value = - FacilityReason_vals[msg_idx].strptr - ? FacilityReason_vals[msg_idx].strptr - : "Unknown facility reason"; - facility_reason_idx[msg_idx] = row_idx; - - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - row_idx++; - msg_idx++; - } while (FacilityReason_vals[msg_idx].strptr); - - - items[MESSAGE_TYPE_COLUMN].value.string_value = "Unknown H.225 message"; - new_stat_tap_init_table_row(table, row_idx, num_fields, items); - other_idx = row_idx; + int num_fields = sizeof(h225_stat_fields)/sizeof(stat_tap_table_item); + new_stat_tap_table* table = new_stat_tap_init_table("H.225 Messages and Message Reasons", num_fields, 0, NULL, gui_callback, gui_data); + int row_idx = 0, msg_idx; + stat_tap_table_item_type items[sizeof(h225_stat_fields)/sizeof(stat_tap_table_item)]; + + new_stat_tap_add_table(new_stat, table); + + items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING; + items[COUNT_COLUMN].type = TABLE_ITEM_UINT; + items[COUNT_COLUMN].value.uint_value = 0; + + /* Add a row for each value type */ + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + h225_RasMessage_vals[msg_idx].strptr + ? h225_RasMessage_vals[msg_idx].strptr + : "Unknown RAS message"; + ras_msg_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (h225_RasMessage_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + T_h323_message_body_vals[msg_idx].strptr + ? T_h323_message_body_vals[msg_idx].strptr + : "Unknown CS message"; + cs_msg_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (T_h323_message_body_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + GatekeeperRejectReason_vals[msg_idx].strptr + ? GatekeeperRejectReason_vals[msg_idx].strptr + : "Unknown gatekeeper reject reason"; + grj_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (GatekeeperRejectReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + RegistrationRejectReason_vals[msg_idx].strptr + ? RegistrationRejectReason_vals[msg_idx].strptr + : "Unknown registration reject reason"; + rrj_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (RegistrationRejectReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + UnregRequestReason_vals[msg_idx].strptr + ? UnregRequestReason_vals[msg_idx].strptr + : "Unknown unregistration request reason"; + urq_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (UnregRequestReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + UnregRejectReason_vals[msg_idx].strptr + ? UnregRejectReason_vals[msg_idx].strptr + : "Unknown unregistration reject reason"; + urj_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (UnregRejectReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + AdmissionRejectReason_vals[msg_idx].strptr + ? AdmissionRejectReason_vals[msg_idx].strptr + : "Unknown admission reject reason"; + arj_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (AdmissionRejectReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + BandRejectReason_vals[msg_idx].strptr + ? BandRejectReason_vals[msg_idx].strptr + : "Unknown band reject reason"; + brj_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (BandRejectReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + DisengageReason_vals[msg_idx].strptr + ? DisengageReason_vals[msg_idx].strptr + : "Unknown disengage reason"; + drq_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (DisengageReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + DisengageRejectReason_vals[msg_idx].strptr + ? DisengageRejectReason_vals[msg_idx].strptr + : "Unknown disengage reject reason"; + drj_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (DisengageRejectReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + LocationRejectReason_vals[msg_idx].strptr + ? LocationRejectReason_vals[msg_idx].strptr + : "Unknown location reject reason"; + lrj_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (LocationRejectReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + InfoRequestNakReason_vals[msg_idx].strptr + ? InfoRequestNakReason_vals[msg_idx].strptr + : "Unknown info request nak reason"; + irqnak_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (InfoRequestNakReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + h225_ReleaseCompleteReason_vals[msg_idx].strptr + ? h225_ReleaseCompleteReason_vals[msg_idx].strptr + : "Unknown release complete reason"; + rel_cmp_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (h225_ReleaseCompleteReason_vals[msg_idx].strptr); + + msg_idx = 0; + do + { + items[MESSAGE_TYPE_COLUMN].value.string_value = + FacilityReason_vals[msg_idx].strptr + ? FacilityReason_vals[msg_idx].strptr + : "Unknown facility reason"; + facility_reason_idx[msg_idx] = row_idx; + + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + row_idx++; + msg_idx++; + } while (FacilityReason_vals[msg_idx].strptr); + + + items[MESSAGE_TYPE_COLUMN].value.string_value = "Unknown H.225 message"; + new_stat_tap_init_table_row(table, row_idx, num_fields, items); + other_idx = row_idx; } static gboolean h225_stat_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *hpi_ptr) { - new_stat_data_t* stat_data = (new_stat_data_t*)tapdata; - const h225_packet_info *hpi = (const h225_packet_info *)hpi_ptr; - int tag_idx = -1; - int reason_idx = -1; - - if(hpi->msg_tag < 0) { /* uninitialized */ - return FALSE; - } - - switch (hpi->msg_type) { - - case H225_RAS: - tag_idx = ras_msg_idx[MIN(hpi->msg_tag, (int)RAS_MSG_TYPES-1)]; - - /* Look for reason tag */ - if(hpi->reason < 0) { /* uninitialized */ - break; - } - - switch(hpi->msg_tag) { - - case 2: /* GRJ */ - reason_idx = grj_reason_idx[MIN(hpi->reason, (int)GRJ_REASONS-1)]; - break; - case 5: /* RRJ */ - reason_idx = rrj_reason_idx[MIN(hpi->reason, (int)RRJ_REASONS-1)]; - break; - case 6: /* URQ */ - reason_idx = urq_reason_idx[MIN(hpi->reason, (int)URQ_REASONS-1)]; - break; - case 8: /* URJ */ - reason_idx = urj_reason_idx[MIN(hpi->reason, (int)URJ_REASONS-1)]; - break; - case 11: /* ARJ */ - reason_idx = arj_reason_idx[MIN(hpi->reason, (int)ARJ_REASONS-1)]; - break; - case 14: /* BRJ */ - reason_idx = brj_reason_idx[MIN(hpi->reason, (int)BRJ_REASONS-1)]; - break; - case 15: /* DRQ */ - reason_idx = drq_reason_idx[MIN(hpi->reason, (int)DRQ_REASONS-1)]; - break; - case 17: /* DRJ */ - reason_idx = drj_reason_idx[MIN(hpi->reason, (int)DRJ_REASONS-1)]; - break; - case 20: /* LRJ */ - reason_idx = lrj_reason_idx[MIN(hpi->reason, (int)LRJ_REASONS-1)]; - break; - case 29: /* IRQ Nak */ - reason_idx = irqnak_reason_idx[MIN(hpi->reason, (int)IRQNAK_REASONS-1)]; - break; - default: - /* do nothing */ - break; - } - - break; - - case H225_CS: - tag_idx = cs_msg_idx[MIN(hpi->msg_tag, (int)CS_MSG_TYPES-1)]; - - /* Look for reason tag */ - if(hpi->reason < 0) { /* uninitialized */ - break; - } - - switch(hpi->msg_tag) { - - case 5: /* ReleaseComplete */ - reason_idx = rel_cmp_reason_idx[MIN(hpi->reason, (int)REL_CMP_REASONS-1)]; - break; - case 6: /* Facility */ - reason_idx = facility_reason_idx[MIN(hpi->reason, (int)FACILITY_REASONS-1)]; - break; - default: - /* do nothing */ - break; - } - - break; - - case H225_OTHERS: - default: - tag_idx = other_idx; - } - - if (tag_idx >= 0) { - new_stat_tap_table*table = g_array_index(stat_data->new_stat_tap_data->tables, new_stat_tap_table*, 0); - stat_tap_table_item_type* msg_data = new_stat_tap_get_field_data(table, tag_idx, COUNT_COLUMN);; - msg_data->value.uint_value++; - new_stat_tap_set_field_data(table, tag_idx, COUNT_COLUMN, msg_data); - - if (reason_idx >= 0) { - msg_data = new_stat_tap_get_field_data(table, reason_idx, COUNT_COLUMN);; - msg_data->value.uint_value++; - new_stat_tap_set_field_data(table, reason_idx, COUNT_COLUMN, msg_data); - } - - return TRUE; - } - return FALSE; + new_stat_data_t* stat_data = (new_stat_data_t*)tapdata; + const h225_packet_info *hpi = (const h225_packet_info *)hpi_ptr; + int tag_idx = -1; + int reason_idx = -1; + + if(hpi->msg_tag < 0) { /* uninitialized */ + return FALSE; + } + + switch (hpi->msg_type) { + + case H225_RAS: + tag_idx = ras_msg_idx[MIN(hpi->msg_tag, (int)RAS_MSG_TYPES-1)]; + + /* Look for reason tag */ + if(hpi->reason < 0) { /* uninitialized */ + break; + } + + switch(hpi->msg_tag) { + + case 2: /* GRJ */ + reason_idx = grj_reason_idx[MIN(hpi->reason, (int)GRJ_REASONS-1)]; + break; + case 5: /* RRJ */ + reason_idx = rrj_reason_idx[MIN(hpi->reason, (int)RRJ_REASONS-1)]; + break; + case 6: /* URQ */ + reason_idx = urq_reason_idx[MIN(hpi->reason, (int)URQ_REASONS-1)]; + break; + case 8: /* URJ */ + reason_idx = urj_reason_idx[MIN(hpi->reason, (int)URJ_REASONS-1)]; + break; + case 11: /* ARJ */ + reason_idx = arj_reason_idx[MIN(hpi->reason, (int)ARJ_REASONS-1)]; + break; + case 14: /* BRJ */ + reason_idx = brj_reason_idx[MIN(hpi->reason, (int)BRJ_REASONS-1)]; + break; + case 15: /* DRQ */ + reason_idx = drq_reason_idx[MIN(hpi->reason, (int)DRQ_REASONS-1)]; + break; + case 17: /* DRJ */ + reason_idx = drj_reason_idx[MIN(hpi->reason, (int)DRJ_REASONS-1)]; + break; + case 20: /* LRJ */ + reason_idx = lrj_reason_idx[MIN(hpi->reason, (int)LRJ_REASONS-1)]; + break; + case 29: /* IRQ Nak */ + reason_idx = irqnak_reason_idx[MIN(hpi->reason, (int)IRQNAK_REASONS-1)]; + break; + default: + /* do nothing */ + break; + } + + break; + + case H225_CS: + tag_idx = cs_msg_idx[MIN(hpi->msg_tag, (int)CS_MSG_TYPES-1)]; + + /* Look for reason tag */ + if(hpi->reason < 0) { /* uninitialized */ + break; + } + + switch(hpi->msg_tag) { + + case 5: /* ReleaseComplete */ + reason_idx = rel_cmp_reason_idx[MIN(hpi->reason, (int)REL_CMP_REASONS-1)]; + break; + case 6: /* Facility */ + reason_idx = facility_reason_idx[MIN(hpi->reason, (int)FACILITY_REASONS-1)]; + break; + default: + /* do nothing */ + break; + } + + break; + + case H225_OTHERS: + default: + tag_idx = other_idx; + } + + if (tag_idx >= 0) { + new_stat_tap_table*table = g_array_index(stat_data->new_stat_tap_data->tables, new_stat_tap_table*, 0); + stat_tap_table_item_type* msg_data = new_stat_tap_get_field_data(table, tag_idx, COUNT_COLUMN);; + msg_data->value.uint_value++; + new_stat_tap_set_field_data(table, tag_idx, COUNT_COLUMN, msg_data); + + if (reason_idx >= 0) { + msg_data = new_stat_tap_get_field_data(table, reason_idx, COUNT_COLUMN);; + msg_data->value.uint_value++; + new_stat_tap_set_field_data(table, reason_idx, COUNT_COLUMN, msg_data); + } + + return TRUE; + } + return FALSE; } static void h225_stat_reset(new_stat_tap_table* table) { - guint element; - stat_tap_table_item_type* item_data; - - for (element = 0; element < table->num_elements; element++) - { - item_data = new_stat_tap_get_field_data(table, element, COUNT_COLUMN); - item_data->value.uint_value = 0; - new_stat_tap_set_field_data(table, element, COUNT_COLUMN, item_data); - } + guint element; + stat_tap_table_item_type* item_data; + + for (element = 0; element < table->num_elements; element++) + { + item_data = new_stat_tap_get_field_data(table, element, COUNT_COLUMN); + item_data->value.uint_value = 0; + new_stat_tap_set_field_data(table, element, COUNT_COLUMN, item_data); + } } /*--- proto_register_h225 -------------------------------------------*/ @@ -824,109 +824,114 @@ void proto_register_h225(void) { /* List of fields */ static hf_register_info hf[] = { - { &hf_h221Manufacturer, - { "H.225 Manufacturer", "h225.Manufacturer", FT_UINT32, BASE_HEX, - VALS(H221ManufacturerCode_vals), 0, "h225.H.221 Manufacturer", HFILL }}, - { &hf_h225_ras_req_frame, - { "RAS Request Frame", "h225.ras.reqframe", FT_FRAMENUM, BASE_NONE, - NULL, 0, NULL, HFILL }}, - { &hf_h225_ras_rsp_frame, - { "RAS Response Frame", "h225.ras.rspframe", FT_FRAMENUM, BASE_NONE, - NULL, 0, NULL, HFILL }}, - { &hf_h225_ras_dup, - { "Duplicate RAS Message", "h225.ras.dup", FT_UINT32, BASE_DEC, - NULL, 0, NULL, HFILL }}, - { &hf_h225_ras_deltatime, - { "RAS Service Response Time", "h225.ras.timedelta", FT_RELATIVE_TIME, BASE_NONE, - NULL, 0, "Timedelta between RAS-Request and RAS-Response", HFILL }}, - { &hf_h225_debug_dissector_try_string, - { "*** DEBUG dissector_try_string", "h225.debug.dissector_try_string", FT_STRING, BASE_NONE, - NULL, 0, NULL, HFILL }}, + { &hf_h221Manufacturer, + { "H.225 Manufacturer", "h225.Manufacturer", FT_UINT32, BASE_HEX, + VALS(H221ManufacturerCode_vals), 0, "h225.H.221 Manufacturer", HFILL }}, + + { &hf_h225_ras_req_frame, + { "RAS Request Frame", "h225.ras.reqframe", FT_FRAMENUM, BASE_NONE, + NULL, 0, NULL, HFILL }}, + + { &hf_h225_ras_rsp_frame, + { "RAS Response Frame", "h225.ras.rspframe", FT_FRAMENUM, BASE_NONE, + NULL, 0, NULL, HFILL }}, + + { &hf_h225_ras_dup, + { "Duplicate RAS Message", "h225.ras.dup", FT_UINT32, BASE_DEC, + NULL, 0, NULL, HFILL }}, + + { &hf_h225_ras_deltatime, + { "RAS Service Response Time", "h225.ras.timedelta", FT_RELATIVE_TIME, BASE_NONE, + NULL, 0, "Timedelta between RAS-Request and RAS-Response", HFILL }}, + + { &hf_h225_debug_dissector_try_string, + { "*** DEBUG dissector_try_string", "h225.debug.dissector_try_string", FT_STRING, BASE_NONE, + NULL, 0, NULL, HFILL }}, #include "packet-h225-hfarr.c" - }; + }; /* List of subtrees */ - static gint *ett[] = { - &ett_h225, + static gint *ett[] = { + &ett_h225, #include "packet-h225-ettarr.c" - }; - - static tap_param h225_stat_params[] = { - { PARAM_FILTER, "filter", "Filter", NULL, TRUE } - }; - - static new_stat_tap_ui h225_stat_table = { - REGISTER_STAT_GROUP_TELEPHONY, - "H.225", - PFNAME, - "h225,counter", - h225_stat_init, - h225_stat_packet, - h225_stat_reset, - NULL, - NULL, - sizeof(h225_stat_fields)/sizeof(stat_tap_table_item), h225_stat_fields, - sizeof(h225_stat_params)/sizeof(tap_param), h225_stat_params, - NULL - }; - - module_t *h225_module; - int proto_h225_ras; - - /* Register protocol */ - proto_h225 = proto_register_protocol(PNAME, PSNAME, PFNAME); - - /* Create a "fake" protocol to get proper display strings for SRT dialogs */ - proto_h225_ras = proto_register_protocol("H.225 RAS", "H.225 RAS", "h225_ras"); - - /* Register fields and subtrees */ - proto_register_field_array(proto_h225, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - - h225_module = prefs_register_protocol(proto_h225, proto_reg_handoff_h225); - prefs_register_uint_preference(h225_module, "tls.port", - "H.225 TLS Port", - "H.225 Server TLS Port", - 10, &h225_tls_port); - prefs_register_bool_preference(h225_module, "reassembly", - "Reassemble H.225 messages spanning multiple TCP segments", - "Whether the H.225 dissector should reassemble messages spanning multiple TCP segments." - " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", - &h225_reassembly); - prefs_register_bool_preference(h225_module, "h245_in_tree", - "Display tunnelled H.245 inside H.225.0 tree", - "ON - display tunnelled H.245 inside H.225.0 tree, OFF - display tunnelled H.245 in root tree after H.225.0", - &h225_h245_in_tree); - prefs_register_bool_preference(h225_module, "tp_in_tree", - "Display tunnelled protocols inside H.225.0 tree", - "ON - display tunnelled protocols inside H.225.0 tree, OFF - display tunnelled protocols in root tree after H.225.0", - &h225_tp_in_tree); - - new_register_dissector(PFNAME, dissect_h225_H323UserInformation, proto_h225); - new_register_dissector("h323ui",dissect_h225_H323UserInformation, proto_h225); - new_register_dissector("h225.ras", dissect_h225_h225_RasMessage, proto_h225); - - nsp_object_dissector_table = register_dissector_table("h225.nsp.object", "H.225 NonStandardParameter (object)", FT_STRING, BASE_NONE); - nsp_h221_dissector_table = register_dissector_table("h225.nsp.h221", "H.225 NonStandardParameter (h221)", FT_UINT32, BASE_HEX); - tp_dissector_table = register_dissector_table("h225.tp", "H.225 TunnelledProtocol", FT_STRING, BASE_NONE); - gef_name_dissector_table = register_dissector_table("h225.gef.name", "H.225 Generic Extensible Framework (names)", FT_STRING, BASE_NONE); - gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", FT_STRING, BASE_NONE); - - register_init_routine(&h225_init_routine); - register_cleanup_routine(&h225_cleanup_routine); - h225_tap = register_tap(PFNAME); - - register_rtd_table(proto_h225_ras, PFNAME, NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL); - - register_new_stat_tap_ui(&h225_stat_table); - - oid_add_from_string("Version 1","0.0.8.2250.0.1"); - oid_add_from_string("Version 2","0.0.8.2250.0.2"); - oid_add_from_string("Version 3","0.0.8.2250.0.3"); - oid_add_from_string("Version 4","0.0.8.2250.0.4"); - oid_add_from_string("Version 5","0.0.8.2250.0.5"); - oid_add_from_string("Version 6","0.0.8.2250.0.6"); + }; + + static tap_param h225_stat_params[] = { + { PARAM_FILTER, "filter", "Filter", NULL, TRUE } + }; + + static new_stat_tap_ui h225_stat_table = { + REGISTER_STAT_GROUP_TELEPHONY, + "H.225", + PFNAME, + "h225,counter", + h225_stat_init, + h225_stat_packet, + h225_stat_reset, + NULL, + NULL, + sizeof(h225_stat_fields)/sizeof(stat_tap_table_item), h225_stat_fields, + sizeof(h225_stat_params)/sizeof(tap_param), h225_stat_params, + NULL + }; + + module_t *h225_module; + int proto_h225_ras; + + /* Register protocol */ + proto_h225 = proto_register_protocol(PNAME, PSNAME, PFNAME); + + /* Create a "fake" protocol to get proper display strings for SRT dialogs */ + proto_h225_ras = proto_register_protocol("H.225 RAS", "H.225 RAS", "h225_ras"); + + /* Register fields and subtrees */ + proto_register_field_array(proto_h225, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + h225_module = prefs_register_protocol(proto_h225, proto_reg_handoff_h225); + prefs_register_uint_preference(h225_module, "tls.port", + "H.225 TLS Port", + "H.225 Server TLS Port", + 10, &h225_tls_port); + prefs_register_bool_preference(h225_module, "reassembly", + "Reassemble H.225 messages spanning multiple TCP segments", + "Whether the H.225 dissector should reassemble messages spanning multiple TCP segments." + " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.", + &h225_reassembly); + prefs_register_bool_preference(h225_module, "h245_in_tree", + "Display tunnelled H.245 inside H.225.0 tree", + "ON - display tunnelled H.245 inside H.225.0 tree, OFF - display tunnelled H.245 in root tree after H.225.0", + &h225_h245_in_tree); + prefs_register_bool_preference(h225_module, "tp_in_tree", + "Display tunnelled protocols inside H.225.0 tree", + "ON - display tunnelled protocols inside H.225.0 tree, OFF - display tunnelled protocols in root tree after H.225.0", + &h225_tp_in_tree); + + new_register_dissector(PFNAME, dissect_h225_H323UserInformation, proto_h225); + new_register_dissector("h323ui",dissect_h225_H323UserInformation, proto_h225); + new_register_dissector("h225.ras", dissect_h225_h225_RasMessage, proto_h225); + + nsp_object_dissector_table = register_dissector_table("h225.nsp.object", "H.225 NonStandardParameter (object)", FT_STRING, BASE_NONE); + nsp_h221_dissector_table = register_dissector_table("h225.nsp.h221", "H.225 NonStandardParameter (h221)", FT_UINT32, BASE_HEX); + tp_dissector_table = register_dissector_table("h225.tp", "H.225 TunnelledProtocol", FT_STRING, BASE_NONE); + gef_name_dissector_table = register_dissector_table("h225.gef.name", "H.225 Generic Extensible Framework (names)", FT_STRING, BASE_NONE); + gef_content_dissector_table = register_dissector_table("h225.gef.content", "H.225 Generic Extensible Framework", FT_STRING, BASE_NONE); + + register_init_routine(&h225_init_routine); + register_cleanup_routine(&h225_cleanup_routine); + h225_tap = register_tap(PFNAME); + + register_rtd_table(proto_h225_ras, PFNAME, NUM_RAS_STATS, 1, ras_message_category, h225rassrt_packet, NULL); + + register_new_stat_tap_ui(&h225_stat_table); + + oid_add_from_string("Version 1","0.0.8.2250.0.1"); + oid_add_from_string("Version 2","0.0.8.2250.0.2"); + oid_add_from_string("Version 3","0.0.8.2250.0.3"); + oid_add_from_string("Version 4","0.0.8.2250.0.4"); + oid_add_from_string("Version 5","0.0.8.2250.0.5"); + oid_add_from_string("Version 6","0.0.8.2250.0.6"); } @@ -934,76 +939,76 @@ void proto_register_h225(void) { void proto_reg_handoff_h225(void) { - static gboolean h225_prefs_initialized = FALSE; - static dissector_handle_t h225ras_handle; - static guint saved_h225_tls_port; - - if (!h225_prefs_initialized) { - h225ras_handle=find_dissector("h225.ras"); - dissector_add_uint("udp.port", UDP_PORT_RAS1, h225ras_handle); - dissector_add_uint("udp.port", UDP_PORT_RAS2, h225ras_handle); - - h245_handle = find_dissector("h245"); - h245dg_handle = find_dissector("h245dg"); - h4501_handle = find_dissector("h4501"); - data_handle = find_dissector("data"); - h225_prefs_initialized = TRUE; - } else { - ssl_dissector_delete(saved_h225_tls_port, "q931.tpkt", TRUE); - } - - saved_h225_tls_port = h225_tls_port; - ssl_dissector_add(saved_h225_tls_port, "q931.tpkt", TRUE); + static gboolean h225_prefs_initialized = FALSE; + static dissector_handle_t h225ras_handle; + static guint saved_h225_tls_port; + + if (!h225_prefs_initialized) { + h225ras_handle=find_dissector("h225.ras"); + dissector_add_uint("udp.port", UDP_PORT_RAS1, h225ras_handle); + dissector_add_uint("udp.port", UDP_PORT_RAS2, h225ras_handle); + + h245_handle = find_dissector("h245"); + h245dg_handle = find_dissector("h245dg"); + h4501_handle = find_dissector("h4501"); + data_handle = find_dissector("data"); + h225_prefs_initialized = TRUE; + } else { + ssl_dissector_delete(saved_h225_tls_port, "q931.tpkt", TRUE); + } + + saved_h225_tls_port = h225_tls_port; + ssl_dissector_add(saved_h225_tls_port, "q931.tpkt", TRUE); } static void reset_h225_packet_info(h225_packet_info *pi) { - if(pi == NULL) { - return; - } - - pi->msg_type = H225_OTHERS; - pi->cs_type = H225_OTHER; - pi->msg_tag = -1; - pi->reason = -1; - pi->requestSeqNum = 0; - memset(&pi->guid,0,sizeof pi->guid); - pi->is_duplicate = FALSE; - pi->request_available = FALSE; - pi->is_faststart = FALSE; - pi->is_h245 = FALSE; - pi->is_h245Tunneling = FALSE; - pi->h245_address = 0; - pi->h245_port = 0; - pi->frame_label[0] = '\0'; - pi->dialedDigits[0] = '\0'; - pi->is_destinationInfo = FALSE; + if(pi == NULL) { + return; + } + + pi->msg_type = H225_OTHERS; + pi->cs_type = H225_OTHER; + pi->msg_tag = -1; + pi->reason = -1; + pi->requestSeqNum = 0; + memset(&pi->guid,0,sizeof pi->guid); + pi->is_duplicate = FALSE; + pi->request_available = FALSE; + pi->is_faststart = FALSE; + pi->is_h245 = FALSE; + pi->is_h245Tunneling = FALSE; + pi->h245_address = 0; + pi->h245_port = 0; + pi->frame_label[0] = '\0'; + pi->dialedDigits[0] = '\0'; + pi->is_destinationInfo = FALSE; } /* - The following function contains the routines for RAS request/response matching. - A RAS response matches with a request, if both messages have the same - RequestSequenceNumber, belong to the same IP conversation and belong to the same - RAS "category" (e.g. Admission, Registration). - - We use hashtables to access the lists of RAS calls (request/response pairs). - We have one hashtable for each RAS category. The hashkeys consist of the - non-unique 16-bit RequestSequenceNumber and values representing the conversation. - - In big capture files, we might get different requests with identical keys. - These requests aren't necessarily duplicates. They might be valid new requests. - At the moment we just use the timedelta between the last valid and the new request - to decide if the new request is a duplicate or not. There might be better ways. - Two thresholds are defined below. - - However the decision is made, another problem arises. We can't just add those - requests to our hashtables. Instead we create lists of RAS calls with identical keys. - The hashtables for RAS calls contain now pointers to the first RAS call in a list of - RAS calls with identical keys. - These lists aren't expected to contain more than 3 items and are usually single item - lists. So we don't need an expensive but intelligent way to access these lists - (e.g. hashtables). Just walk through such a list. + The following function contains the routines for RAS request/response matching. + A RAS response matches with a request, if both messages have the same + RequestSequenceNumber, belong to the same IP conversation and belong to the same + RAS "category" (e.g. Admission, Registration). + + We use hashtables to access the lists of RAS calls (request/response pairs). + We have one hashtable for each RAS category. The hashkeys consist of the + non-unique 16-bit RequestSequenceNumber and values representing the conversation. + + In big capture files, we might get different requests with identical keys. + These requests aren't necessarily duplicates. They might be valid new requests. + At the moment we just use the timedelta between the last valid and the new request + to decide if the new request is a duplicate or not. There might be better ways. + Two thresholds are defined below. + + However the decision is made, another problem arises. We can't just add those + requests to our hashtables. Instead we create lists of RAS calls with identical keys. + The hashtables for RAS calls contain now pointers to the first RAS call in a list of + RAS calls with identical keys. + These lists aren't expected to contain more than 3 items and are usually single item + lists. So we don't need an expensive but intelligent way to access these lists + (e.g. hashtables). Just walk through such a list. */ #define THRESHOLD_REPEATED_RESPONDED_CALL 300 @@ -1011,160 +1016,168 @@ static void reset_h225_packet_info(h225_packet_info *pi) static void ras_call_matching(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, h225_packet_info *pi) { - proto_item *hidden_item; - conversation_t* conversation = NULL; - h225ras_call_info_key h225ras_call_key; - h225ras_call_t *h225ras_call = NULL; - nstime_t delta; - guint msg_category; - - if(pi->msg_type == H225_RAS && pi->msg_tag < 21) { - /* make RAS request/response matching only for tags from 0 to 20 for now */ - - msg_category = pi->msg_tag / 3; - if(pi->msg_tag % 3 == 0) { /* Request Message */ - conversation = find_or_create_conversation(pinfo); - - /* prepare the key data */ - h225ras_call_key.reqSeqNum = pi->requestSeqNum; - h225ras_call_key.conversation = conversation; - - /* look up the request */ - h225ras_call = find_h225ras_call(&h225ras_call_key ,msg_category); - - if (h225ras_call != NULL) { - /* We've seen requests with this reqSeqNum, with the same - source and destination, before - do we have - *this* request already? */ - /* Walk through list of ras requests with identical keys */ - do { - if (pinfo->fd->num == h225ras_call->req_num) { - /* We have seen this request before -> do nothing */ - break; - } - - /* if end of list is reached, exit loop and decide if request is duplicate or not. */ - if (h225ras_call->next_call == NULL) { - if ( (pinfo->fd->num > h225ras_call->rsp_num && h225ras_call->rsp_num != 0 - && pinfo->fd->abs_ts.secs > (h225ras_call->req_time.secs + THRESHOLD_REPEATED_RESPONDED_CALL) ) - ||(pinfo->fd->num > h225ras_call->req_num && h225ras_call->rsp_num == 0 - && pinfo->fd->abs_ts.secs > (h225ras_call->req_time.secs + THRESHOLD_REPEATED_NOT_RESPONDED_CALL) ) ) - { - /* if last request has been responded - and this request appears after last response (has bigger frame number) - and last request occurred more than 300 seconds ago, - or if last request hasn't been responded - and this request appears after last request (has bigger frame number) - and last request occurred more than 1800 seconds ago, - we decide that we have a new request */ - /* Append new ras call to list */ - h225ras_call = append_h225ras_call(h225ras_call, pinfo, &pi->guid, msg_category); - } else { - /* No, so it's a duplicate request. - Mark it as such. */ - pi->is_duplicate = TRUE; - hidden_item = proto_tree_add_uint(tree, hf_h225_ras_dup, tvb, 0,0, pi->requestSeqNum); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } - break; - } - h225ras_call = h225ras_call->next_call; - } while (h225ras_call != NULL ); - } - else { - h225ras_call = new_h225ras_call(&h225ras_call_key, pinfo, &pi->guid, msg_category); - } - - /* add link to response frame, if available */ - if(h225ras_call && h225ras_call->rsp_num != 0){ - proto_item *ti = - proto_tree_add_uint_format(tree, hf_h225_ras_rsp_frame, tvb, 0, 0, h225ras_call->rsp_num, - "The response to this request is in frame %u", - h225ras_call->rsp_num); - PROTO_ITEM_SET_GENERATED(ti); - } - - /* end of request message handling*/ - } - else { /* Confirm or Reject Message */ - conversation = find_conversation(pinfo->fd->num, &pinfo->src, - &pinfo->dst, pinfo->ptype, pinfo->srcport, - pinfo->destport, 0); - if (conversation != NULL) { - /* look only for matching request, if - matching conversation is available. */ - h225ras_call_key.reqSeqNum = pi->requestSeqNum; - h225ras_call_key.conversation = conversation; - h225ras_call = find_h225ras_call(&h225ras_call_key ,msg_category); - if(h225ras_call) { - /* find matching ras_call in list of ras calls with identical keys */ - do { - if (pinfo->fd->num == h225ras_call->rsp_num) { - /* We have seen this response before -> stop now with matching ras call */ - break; - } - - /* Break when list end is reached */ - if(h225ras_call->next_call == NULL) { - break; - } - h225ras_call = h225ras_call->next_call; - } while (h225ras_call != NULL) ; - - if (!h225ras_call) { - return; - } - - /* if this is an ACF, ARJ or DCF, DRJ, give guid to tap and make it filterable */ - if (msg_category == 3 || msg_category == 5) { - pi->guid = h225ras_call->guid; - hidden_item = proto_tree_add_guid(tree, hf_h225_guid, tvb, 0, GUID_LEN, &pi->guid); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } - - if (h225ras_call->rsp_num == 0) { - /* We have not yet seen a response to that call, so - this must be the first response; remember its - frame number. */ - h225ras_call->rsp_num = pinfo->fd->num; - } - else { - /* We have seen a response to this call - but was it - *this* response? */ - if (h225ras_call->rsp_num != pinfo->fd->num) { - /* No, so it's a duplicate response. - Mark it as such. */ - pi->is_duplicate = TRUE; - hidden_item = proto_tree_add_uint(tree, hf_h225_ras_dup, tvb, 0,0, pi->requestSeqNum); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } - } - - if(h225ras_call->req_num != 0){ - proto_item *ti; - h225ras_call->responded = TRUE; - pi->request_available = TRUE; - - /* Indicate the frame to which this is a reply. */ - ti = proto_tree_add_uint_format(tree, hf_h225_ras_req_frame, tvb, 0, 0, h225ras_call->req_num, - "This is a response to a request in frame %u", h225ras_call->req_num); - PROTO_ITEM_SET_GENERATED(ti); - - /* Calculate RAS Service Response Time */ - nstime_delta(&delta, &pinfo->fd->abs_ts, &h225ras_call->req_time); - pi->delta_time = delta; /* give it to tap */ - - /* display Ras Service Response Time and make it filterable */ - ti = proto_tree_add_time(tree, hf_h225_ras_deltatime, tvb, 0, 0, &(pi->delta_time)); - PROTO_ITEM_SET_GENERATED(ti); - } - } - } - } - } + proto_item *hidden_item; + conversation_t* conversation = NULL; + h225ras_call_info_key h225ras_call_key; + h225ras_call_t *h225ras_call = NULL; + nstime_t delta; + guint msg_category; + + if(pi->msg_type == H225_RAS && pi->msg_tag < 21) { + /* make RAS request/response matching only for tags from 0 to 20 for now */ + + msg_category = pi->msg_tag / 3; + if(pi->msg_tag % 3 == 0) { /* Request Message */ + conversation = find_or_create_conversation(pinfo); + + /* prepare the key data */ + h225ras_call_key.reqSeqNum = pi->requestSeqNum; + h225ras_call_key.conversation = conversation; + + /* look up the request */ + h225ras_call = find_h225ras_call(&h225ras_call_key ,msg_category); + + if (h225ras_call != NULL) { + /* We've seen requests with this reqSeqNum, with the same + source and destination, before - do we have + *this* request already? */ + /* Walk through list of ras requests with identical keys */ + do { + if (pinfo->fd->num == h225ras_call->req_num) { + /* We have seen this request before -> do nothing */ + break; + } + + /* if end of list is reached, exit loop and decide if request is duplicate or not. */ + if (h225ras_call->next_call == NULL) { + if ( (pinfo->fd->num > h225ras_call->rsp_num && h225ras_call->rsp_num != 0 + && pinfo->fd->abs_ts.secs > (h225ras_call->req_time.secs + THRESHOLD_REPEATED_RESPONDED_CALL) ) + ||(pinfo->fd->num > h225ras_call->req_num && h225ras_call->rsp_num == 0 + && pinfo->fd->abs_ts.secs > (h225ras_call->req_time.secs + THRESHOLD_REPEATED_NOT_RESPONDED_CALL) ) ) + { + /* if last request has been responded + and this request appears after last response (has bigger frame number) + and last request occurred more than 300 seconds ago, + or if last request hasn't been responded + and this request appears after last request (has bigger frame number) + and last request occurred more than 1800 seconds ago, + we decide that we have a new request */ + /* Append new ras call to list */ + h225ras_call = append_h225ras_call(h225ras_call, pinfo, &pi->guid, msg_category); + } else { + /* No, so it's a duplicate request. + Mark it as such. */ + pi->is_duplicate = TRUE; + hidden_item = proto_tree_add_uint(tree, hf_h225_ras_dup, tvb, 0,0, pi->requestSeqNum); + PROTO_ITEM_SET_HIDDEN(hidden_item); + } + break; + } + h225ras_call = h225ras_call->next_call; + } while (h225ras_call != NULL ); + } + else { + h225ras_call = new_h225ras_call(&h225ras_call_key, pinfo, &pi->guid, msg_category); + } + + /* add link to response frame, if available */ + if(h225ras_call && h225ras_call->rsp_num != 0){ + proto_item *ti = + proto_tree_add_uint_format(tree, hf_h225_ras_rsp_frame, tvb, 0, 0, h225ras_call->rsp_num, + "The response to this request is in frame %u", + h225ras_call->rsp_num); + PROTO_ITEM_SET_GENERATED(ti); + } + + /* end of request message handling*/ + } + else { /* Confirm or Reject Message */ + conversation = find_conversation(pinfo->fd->num, &pinfo->src, + &pinfo->dst, pinfo->ptype, pinfo->srcport, + pinfo->destport, 0); + if (conversation != NULL) { + /* look only for matching request, if + matching conversation is available. */ + h225ras_call_key.reqSeqNum = pi->requestSeqNum; + h225ras_call_key.conversation = conversation; + h225ras_call = find_h225ras_call(&h225ras_call_key ,msg_category); + if(h225ras_call) { + /* find matching ras_call in list of ras calls with identical keys */ + do { + if (pinfo->fd->num == h225ras_call->rsp_num) { + /* We have seen this response before -> stop now with matching ras call */ + break; + } + + /* Break when list end is reached */ + if(h225ras_call->next_call == NULL) { + break; + } + h225ras_call = h225ras_call->next_call; + } while (h225ras_call != NULL) ; + + if (!h225ras_call) { + return; + } + + /* if this is an ACF, ARJ or DCF, DRJ, give guid to tap and make it filterable */ + if (msg_category == 3 || msg_category == 5) { + pi->guid = h225ras_call->guid; + hidden_item = proto_tree_add_guid(tree, hf_h225_guid, tvb, 0, GUID_LEN, &pi->guid); + PROTO_ITEM_SET_HIDDEN(hidden_item); + } + + if (h225ras_call->rsp_num == 0) { + /* We have not yet seen a response to that call, so + this must be the first response; remember its + frame number. */ + h225ras_call->rsp_num = pinfo->fd->num; + } + else { + /* We have seen a response to this call - but was it + *this* response? */ + if (h225ras_call->rsp_num != pinfo->fd->num) { + /* No, so it's a duplicate response. + Mark it as such. */ + pi->is_duplicate = TRUE; + hidden_item = proto_tree_add_uint(tree, hf_h225_ras_dup, tvb, 0,0, pi->requestSeqNum); + PROTO_ITEM_SET_HIDDEN(hidden_item); + } + } + + if(h225ras_call->req_num != 0){ + proto_item *ti; + h225ras_call->responded = TRUE; + pi->request_available = TRUE; + + /* Indicate the frame to which this is a reply. */ + ti = proto_tree_add_uint_format(tree, hf_h225_ras_req_frame, tvb, 0, 0, h225ras_call->req_num, + "This is a response to a request in frame %u", h225ras_call->req_num); + PROTO_ITEM_SET_GENERATED(ti); + + /* Calculate RAS Service Response Time */ + nstime_delta(&delta, &pinfo->fd->abs_ts, &h225ras_call->req_time); + pi->delta_time = delta; /* give it to tap */ + + /* display Ras Service Response Time and make it filterable */ + ti = proto_tree_add_time(tree, hf_h225_ras_deltatime, tvb, 0, 0, &(pi->delta_time)); + PROTO_ITEM_SET_GENERATED(ti); + } + } + } + } + } } - - - - +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/asn1/h225/packet-h225-template.h b/asn1/h225/packet-h225-template.h index 6559fcbc39..fa89a3ffc8 100644 --- a/asn1/h225/packet-h225-template.h +++ b/asn1/h225/packet-h225-template.h @@ -25,47 +25,47 @@ #define PACKET_H225_H typedef enum _h225_msg_type { - H225_RAS, - H225_CS, - H225_OTHERS + H225_RAS, + H225_CS, + H225_OTHERS } h225_msg_type; typedef enum _h225_cs_type { - H225_SETUP, - H225_CALL_PROCEDING, - H225_CONNECT, - H225_ALERTING, - H225_INFORMATION, - H225_RELEASE_COMPLET, - H225_FACILITY, - H225_PROGRESS, - H225_EMPTY, - H225_STATUS, - H225_STATUS_INQUIRY, - H225_SETUP_ACK, - H225_NOTIFY, - H225_OTHER + H225_SETUP, + H225_CALL_PROCEDING, + H225_CONNECT, + H225_ALERTING, + H225_INFORMATION, + H225_RELEASE_COMPLET, + H225_FACILITY, + H225_PROGRESS, + H225_EMPTY, + H225_STATUS, + H225_STATUS_INQUIRY, + H225_SETUP_ACK, + H225_NOTIFY, + H225_OTHER } h225_cs_type; typedef struct _h225_packet_info { - h225_msg_type msg_type; /* ras or cs message */ - h225_cs_type cs_type; /* cs message type */ - gint msg_tag; /* message tag*/ - gint reason; /* reason tag, if available */ - guint requestSeqNum; /* request sequence number of ras-message, if available */ - e_guid_t guid; /* globally unique call id */ - gboolean is_duplicate; /* true, if this is a repeated message */ - gboolean request_available; /* true, if response matches to a request */ - nstime_t delta_time; /* this is the RAS response time delay */ - /* added for h225 conversations analysis */ - gboolean is_faststart; /* true, if faststart field is included */ - gboolean is_h245; - gboolean is_h245Tunneling; - guint32 h245_address; - guint16 h245_port; - gchar dialedDigits[129]; /* Dialed Digits in the LRQ and LCF used for voip analysis */ - gboolean is_destinationInfo; - gchar frame_label[50]; /* the Frame label used by graph_analysis, what is a abreviation of cinfo */ + h225_msg_type msg_type; /* ras or cs message */ + h225_cs_type cs_type; /* cs message type */ + gint msg_tag; /* message tag*/ + gint reason; /* reason tag, if available */ + guint requestSeqNum; /* request sequence number of ras-message, if available */ + e_guid_t guid; /* globally unique call id */ + gboolean is_duplicate; /* true, if this is a repeated message */ + gboolean request_available; /* true, if response matches to a request */ + nstime_t delta_time; /* this is the RAS response time delay */ + /* added for h225 conversations analysis */ + gboolean is_faststart; /* true, if faststart field is included */ + gboolean is_h245; + gboolean is_h245Tunneling; + guint32 h245_address; + guint16 h245_port; + gchar dialedDigits[129]; /* Dialed Digits in the LRQ and LCF used for voip analysis */ + gboolean is_destinationInfo; + gchar frame_label[50]; /* the Frame label used by graph_analysis, what is a abreviation of cinfo */ } h225_packet_info; /* @@ -81,4 +81,15 @@ typedef struct _h225_packet_info { #endif /* PACKET_H225_H */ - +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ |