And finally (I hope) the last part from the patch
authorlroland <lroland@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 7 Feb 2005 21:09:23 +0000 (21:09 +0000)
committerlroland <lroland@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 7 Feb 2005 21:09:23 +0000 (21:09 +0000)
from Alejandro Vaquero:

  patch for "Voip analysis" to get the LRQ/LCF/LRJ messages included in the H323 calls for Gatekeeper to Gatekeeper configurations

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13347 f5534014-38df-0310-8fa8-9805f1628bb7

asn1/h225/h225.cnf
asn1/h225/packet-h225-template.c
asn1/h225/packet-h225-template.h
gtk/voip_calls.c

index 85327ab6e88920aa1a19daabbaee28ac967b7526..fd24d4f79b9cc6e11330ecd0d039107b1afc0f2e 100644 (file)
@@ -203,16 +203,25 @@ CallIdentifier/guid guid
        h225_pi->msg_tag = rasmessage_value;
 #.END
 #----------------------------------------------------------------------------------------
+#.FN_HDR DestinationInfo/_item
+
+  h225_pi->is_destinationInfo = TRUE;
+#.END
+#----------------------------------------------------------------------------------------
 # TODO asn2eth can't handle restriced string ?
 #.FN_BODY DialedDigits
-
-       offset=dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, 1, 128, "#,*0123456789", 13);
+  if (h225_pi->is_destinationInfo == TRUE) {
+    offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, 1, 128, "#,*0123456789", 13, (char *)&h225_pi->dialedDigits , 64);  
+       h225_pi->is_destinationInfo = FALSE;
+  }
+  else
+       offset = dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, 1, 128, "#,*0123456789", 13, NULL, NULL);
 #.END
 #----------------------------------------------------------------------------------------
 # TODO asn2eth can't handle restriced string ?
 #.FN_BODY NumberDigits
 
-       offset=dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, 1, 128, "#,*0123456789", 13);
+       offset=dissect_per_restricted_character_string(tvb, offset, pinfo, tree, hf_index, 1, 128, "#,*0123456789", 13, NULL, NULL);
 #.END
 #----------------------------------------------------------------------------------------
 #.FN_BODY H245TransportAddress/h245ipAddress/h245ipv4
index 94ced2434fbc66dd5ccbc81db90ad28f8edd3af8..993eeddfa31c545de5ac25808be829415eba9ebf 100644 (file)
@@ -298,6 +298,8 @@ static void reset_h225_packet_info(h225_packet_info *pi)
        pi->h245_address = 0;
        pi->h245_port = 0;
        pi->frame_label[0] = '\0';
+       pi->dialedDigits[0] = '\0';
+       pi->is_destinationInfo = FALSE;
 }
 
 /*
index 69492a3538f5465669c848c6b2df0d504e8a4c45..b7b7c0667bb1d1f186b29563bb6f8b70feed4e23 100644 (file)
@@ -65,6 +65,8 @@ typedef struct _h225_packet_info {
        gboolean is_h245Tunneling;
        guint32 h245_address;
        guint16 h245_port;
+       gchar dialedDigits[64]; /* Dialed Digits in the LRQ and LCF used for voip analysis */
+       gboolean is_destinationInfo;
        gchar frame_label[50]; /* the Fram label used by graph_analysis, what is a abreviation of cinfo */
 } h225_packet_info;
 
index 890d1fe7ea216394c53d44109b4307147629303d..7ecba97c4842f4ef5ec50d7880f8fdb2e8f6dcb0 100644 (file)
@@ -242,6 +242,28 @@ int append_to_frame_graph(voip_calls_tapinfo_t *tapinfo _U_, guint32 frame_num,
 
 }
 
+/****************************************************************************/
+/* Change all the graph items with call_num to new_call_num */
+guint change_call_num_graph(voip_calls_tapinfo_t *tapinfo _U_, guint16 call_num, guint16 new_call_num)
+{
+       graph_analysis_item_t *gai;
+       GList* list;
+       guint items_changed;
+
+       items_changed = 0;
+       list = g_list_first(tapinfo->graph_analysis->list);
+       while (list)
+       {
+               gai = list->data;
+               if (gai->conv_num == call_num){
+                       gai->conv_num = new_call_num;
+                       items_changed++;
+               }
+               list = g_list_next (list);
+       }
+       return items_changed;
+}
+
 /****************************************************************************/
 /* ***************************TAP for RTP **********************************/
 /****************************************************************************/
@@ -1011,15 +1033,17 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
        voip_calls_info_t *tmp_listinfo;
        voip_calls_info_t *strinfo = NULL;
        h323_calls_info_t *tmp_h323info;
+       h323_calls_info_t *tmp2_h323info;
        gchar *frame_label;
        gchar *comment;
        GList* list;
        guint32 tmp_src, tmp_dst;
+       guint foo;
 
        const h225_packet_info *pi = H225info;
 
-       /* if not guid and RAS return because did not belong to a call */
-       if ((memcmp(pi->guid, guid_allzero, GUID_LEN) == 0) && (pi->msg_type == H225_RAS))
+       /* if not guid and RAS and not LRQ, LCF or LRJ return because did not belong to a call */
+       if ((memcmp(pi->guid, guid_allzero, GUID_LEN) == 0) && (pi->msg_type == H225_RAS) && ((pi->msg_tag < 18) || (pi->msg_tag > 20)))
                return 0;
        
 
@@ -1039,6 +1063,24 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
                        list = g_list_next (list);
                }
                if (strinfo==NULL)      return 0;               
+       } else if ( (pi->msg_type == H225_RAS) && ((pi->msg_tag == 19) || (pi->msg_tag == 20))) { /* RAS LCF or LRJ*/
+               /* if the LCF/LRJ doesn't match to a LRQ, just return */
+               if (!pi->request_available) return 0;
+
+               /* check wether we already have a call with this request SeqNum */
+               list = g_list_first(tapinfo->strinfo_list);
+               while (list)
+               {
+                       tmp_listinfo=list->data;
+                       if (tmp_listinfo->protocol == VOIP_H323){
+                               tmp_h323info = tmp_listinfo->prot_info;
+                               if (tmp_h323info->requestSeqNum == pi->requestSeqNum) {
+                                       strinfo = (voip_calls_info_t*)(list->data);
+                                       break;
+                               }
+                       }
+                       list = g_list_next (list);
+               }
        } else {
                /* check wether we already have a call with this guid in the list */
                list = g_list_first(tapinfo->strinfo_list);
@@ -1047,7 +1089,7 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
                        tmp_listinfo=list->data;
                        if (tmp_listinfo->protocol == VOIP_H323){
                                tmp_h323info = tmp_listinfo->prot_info;
-                               if (memcmp(tmp_h323info->guid, pi->guid,GUID_LEN)==0){ 
+                               if ( (memcmp(tmp_h323info->guid, guid_allzero, GUID_LEN) != 0) && (memcmp(tmp_h323info->guid, pi->guid,GUID_LEN)==0) ){ 
                                        strinfo = (voip_calls_info_t*)(list->data);
                                        break;
                                }
@@ -1081,6 +1123,7 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
                tmp_h323info->is_h245 = FALSE;
                tmp_h323info->q931_crv = -1;
                tmp_h323info->q931_crv2 = -1;
+               tmp_h323info->requestSeqNum = 0;
                strinfo->call_num = tapinfo->ncalls++;
                strinfo->npackets = 0;
 
@@ -1120,7 +1163,6 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
                        switch(pi->cs_type){
                        case H225_SETUP:
                                tmp_h323info->is_faststart_Setup = pi->is_faststart;
-
                                /* set te calling and called number from the Q931 packet */
                                if (q931_frame_num == pinfo->fd->num){
                                        if (q931_calling_number != NULL){
@@ -1132,6 +1174,39 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
                                                strinfo->to_identity=g_strdup(q931_called_number);
                                        }
                                }
+                               /* check if there is an LRQ/LCF that match this Setup */
+                               /* TODO: we are just checking the DialedNumer in LRQ/LCF agains the Setup 
+                                 we should also check if the h225 signaling IP and port match the destination 
+                                 Setup ip and port */
+                               list = g_list_first(tapinfo->strinfo_list);
+                                               foo=    g_list_length(list);
+                               while (list)
+                               {
+                                       tmp_listinfo=list->data;
+                                       if (tmp_listinfo->protocol == VOIP_H323){
+                                               tmp2_h323info = tmp_listinfo->prot_info;
+
+                                               /* check if there called number match a LRQ/LCF */
+                                               if ( (strcmp(strinfo->to_identity, tmp_listinfo->to_identity)==0)  
+                                                               && (memcmp(tmp2_h323info->guid, guid_allzero, GUID_LEN) == 0) ){ 
+                                                       /* change the call graph to the LRQ/LCF to belong to this call */
+                                                       strinfo->npackets += change_call_num_graph(tapinfo, tmp_listinfo->call_num, strinfo->call_num);
+
+                                                       /* remove this LRQ/LCF call entry because we have found the Setup that match them */
+                                                       g_free(tmp_listinfo->from_identity);
+                                                       g_free(tmp_listinfo->to_identity);
+                                                       g_free(tmp2_h323info->guid);
+                                                       g_list_free(tmp2_h323info->h245_list);
+                                                       tmp2_h323info->h245_list = NULL;                
+                                                       g_free(tmp_listinfo->prot_info);
+                                                       tapinfo->strinfo_list = g_list_remove(tapinfo->strinfo_list, tmp_listinfo);
+                                                       break;
+                                               }
+                                       }
+                                       list = g_list_next (list);
+                               }
+                                               foo=    g_list_length(list);
+                               /* Set the Setup address if it was not set */
                                if (tmp_h323info->h225SetupAddr == 0) g_memmove(&(tmp_h323info->h225SetupAddr), pinfo->src.data,4);
                                strinfo->call_state=VOIP_CALL_SETUP;
                                comment = g_strdup_printf("H225 From: %s To:%s  TunnH245:%s FS:%s", strinfo->from_identity, strinfo->to_identity, (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"), 
@@ -1179,8 +1254,23 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
 
                        }
                } else if (pi->msg_type == H225_RAS){
+                       switch(pi->msg_tag){
+                       case 18:  /* LRQ */
+                               if (!pi->is_duplicate){
+                                       g_free(strinfo->to_identity);
+                                       strinfo->to_identity=g_strdup(pi->dialedDigits);
+                                       tmp_h323info->requestSeqNum = pi->requestSeqNum;
+                               }
+                       case 19: /* LCF */
+                               if (strlen(pi->dialedDigits)) 
+                                       comment = g_strdup_printf("H225 RAS dialedDigits: %s", pi->dialedDigits);
+                               else
+                                       comment = g_strdup("H225 RAS");
+                               break;
+                       default:
+                               comment = g_strdup("H225 RAS");
+                       }
                        frame_label = g_strdup_printf("%s", val_to_str(pi->msg_tag, RasMessage_vals, "<unknown>"));
-                       comment = g_strdup("H225 RAS");
                } else {
                        frame_label = g_strdup("H225: Unknown");
                        comment = g_strdup("");