Text   |  XML   |  ReML   |   Visible Warnings:

Useless Assignment  at voip_calls.c:1556

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

q931_calls_packet

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/voip_calls.c)expand/collapse
Show more  
 1397  q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *q931_info _U_)
 1398  {
 1399          GList *list,*list2;
 1400          voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
 1401          h323_calls_info_t *tmp_h323info,*tmp2_h323info;
 1402          actrace_isdn_calls_info_t *tmp_actrace_isdn_info;
 1403          voip_calls_info_t *tmp_listinfo;
 1404          voip_calls_info_t *callsinfo = NULL;
 1405          h245_address_t *h245_add = NULL;
 1406          gchar *comment;
 1407   
 1408          const q931_packet_info *pi = q931_info;
 1409   
 1410          /* free previously allocated q931_calling/ed_number */
 1411          g_free(q931_calling_number);
 1412          g_free(q931_called_number);
 1413   
 1414          if (pi->calling_number!=NULL)
 1415                  q931_calling_number = g_strdup(pi->calling_number);
 1416          else 
 1417                  q931_calling_number = g_strdup("");
 1418   
 1419          if (pi->called_number!=NULL)
 1420                  q931_called_number = g_strdup(pi->called_number);
 1421          else 
 1422                  q931_called_number = g_strdup("");
 1423          q931_cause_value = pi->cause_value;
 1424          q931_frame_num = pinfo->fd->num;
 1425          q931_crv = pi->crv;
 1426   
 1427   
 1428          /* add staff to H323 calls */
 1429          if (h225_frame_num == q931_frame_num) {
 1430                  tmp_h323info = NULL;
 1431                  list = g_list_first(tapinfo->callsinfo_list);
 1432                  while (list)
 1433                  {
 1434                          tmp_listinfo=list->data;
 1435                          if ( (tmp_listinfo->protocol == VOIP_H323) && (tmp_listinfo->call_num == h225_call_num) ){
 1436                                  tmp_h323info = tmp_listinfo->prot_info;
 1437                                  callsinfo = (voip_calls_info_t*)(list->data);
 1438   
 1439                                  /* Add the CRV to the h323 call */
 1440                                  if (tmp_h323info->q931_crv == -1) {
 1441                                          tmp_h323info->q931_crv = q931_crv;
 1442                                  } else if (tmp_h323info->q931_crv != q931_crv) {
 1443                                          tmp_h323info->q931_crv2 = q931_crv;
 1444                                  }
 1445                                  break;
 1446                          }
 1447                          list = g_list_next (list);
 1448                  }
 1449   
 1450                  if (callsinfo != NULL) {
 1451                          comment = NULL;
 1452                          if (h225_cstype == H225_SETUP) {
 1453                                  /* set te calling and called number from the Q931 packet */
 1454                                  if (q931_calling_number != NULL){
 1455                                          g_free(callsinfo->from_identity);
 1456                                          callsinfo->from_identity=g_strdup(q931_calling_number);
 1457                                  }
 1458                                  if (q931_called_number != NULL){
 1459                                          g_free(callsinfo->to_identity);
 1460                                          callsinfo->to_identity=g_strdup(q931_called_number);
 1461                                  }
 1462   
 1463                                  /* check if there is an LRQ/LCF that match this Setup */
 1464                                  /* TODO: we are just checking the DialedNumer in LRQ/LCF agains the Setup 
 1465                                          we should also check if the h225 signaling IP and port match the destination
 1466                                          Setup ip and port */
 1467                                  list = g_list_first(tapinfo->callsinfo_list);
 1468                                  while (list)
 1469                                  {
 1470                                          tmp_listinfo=list->data;
 1471                                          if (tmp_listinfo->protocol == VOIP_H323){
 1472                                                  tmp2_h323info = tmp_listinfo->prot_info;
 1473   
 1474                                                  /* check if the called number match a LRQ/LCF */
 1475                                                  if ( (strcmp(callsinfo->to_identity, tmp_listinfo->to_identity)==0)
 1476                                                           && (memcmp(&tmp2_h323info->guid, &guid_allzero, GUID_LEN) == 0) ){
 1477                                                          /* change the call graph to the LRQ/LCF to belong to this call */
 1478                                                          callsinfo->npackets += change_call_num_graph(tapinfo, tmp_listinfo->call_num, callsinfo->call_num);
 1479   
 1480                                                          /* remove this LRQ/LCF call entry because we have found the Setup that match them */
 1481                                                          g_free(tmp_listinfo->from_identity);
 1482                                                          g_free(tmp_listinfo->to_identity);
 1483                                                          g_free(tmp2_h323info->guid);
 1484   
 1485                                                          list2 = g_list_first(tmp2_h323info->h245_list);
 1486                                                          while (list2)
 1487                                                          {
 1488                                                                  h245_add=list2->data;
 1489                                                                  g_free((void *)h245_add->h245_address.data);
 1490                                                                  g_free(list2->data);
 1491                                                                  list2 = g_list_next(list2);
 1492                                                          }
 1493                                                          g_list_free(tmp_h323info->h245_list);
 1494                                                          tmp_h323info->h245_list = NULL;
 1495                                                          g_free(tmp_listinfo->prot_info);
 1496                                                          tapinfo->callsinfo_list = g_list_remove(tapinfo->callsinfo_list, tmp_listinfo);
 1497                                                          break;
 1498                                                  }
 1499                                          }
 1500                                  list = g_list_next (list);
 1501                                  }
 1502   
 1503                                  comment = g_strdup_printf("H225 From: %s To:%s  TunnH245:%s FS:%s", callsinfo->from_identity, callsinfo->to_identity, (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
 1504                                                            (h225_is_faststart==TRUE?"on":"off"));
 1505                          } else if (h225_cstype == H225_RELEASE_COMPLET) {
 1506                                  /* get the Q931 Release cause code */
 1507                                  if (q931_cause_value != 0xFF){
 1508                                          comment = g_strdup_printf("H225 Q931 Rel Cause (%i):%s", q931_cause_value, val_to_str(q931_cause_value, q931_cause_code_vals, "<unknown>"));
 1509                                  } else { /* Cause not set */
 1510                                          comment = g_strdup("H225 No Q931 Rel Cause");
 1511                                  }
 1512                          }
 1513                          /* change the graph comment for this new one */
 1514                          if (comment != NULL) {
 1515                                  change_frame_graph(tapinfo, h225_frame_num, NULL, comment);
 1516                                  g_free(comment);
 1517                          }
 1518                  }
 1519                  /* we reset the h225_frame_num to 0 because there could be empty h225 in the same frame
 1520                     as non empty h225 (e.g connect), so we don't have to be here twice */
 1521                  h225_frame_num = 0;
 1522   
 1523          /* add staff to H245 */
 1524          } else if (h245_labels.frame_num == q931_frame_num) {
 1525          /* there are empty H225 frames that don't have guid (guaid=0) but they have h245 info,
 1526             so the only way to match those frames is with the Q931 CRV number */
 1527                  list = g_list_first(tapinfo->callsinfo_list);
 1528                  while (list)
 1529                  {
 1530                          tmp_listinfo=list->data;
 1531                          if (tmp_listinfo->protocol == VOIP_H323){
 1532                                  tmp_h323info = tmp_listinfo->prot_info;
 1533                                  if ( ((tmp_h323info->q931_crv == q931_crv) || (tmp_h323info->q931_crv2 == q931_crv)) && (q931_crv!=-1)){
 1534                                          /* if the frame number exists in graph, append to it*/
 1535                                          if (!append_to_frame_graph(tapinfo, q931_frame_num, NULL, NULL)) {
 1536                                                  /* if not exist, add to the graph */
 1537                                                  add_to_graph(tapinfo, pinfo, NULL, NULL, tmp_listinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
 1538                                                  ++(tmp_listinfo->npackets);
 1539                                                  /* increment the packets counter of all calls */
 1540                                                  ++(tapinfo->npackets);
 1541                                          }
 1542   
 1543                                          /* Add the H245 info if exists to the Graph */
 1544                                          h245_add_to_graph(pinfo->fd->num);
 1545                                          break;
 1546                                  }
 1547                          }
 1548                          list = g_list_next (list);
 1549                  }
 1550   
 1551          /* add staff to ACTRACE */
 1552          } else if (actrace_frame_num == q931_frame_num) {
 1553                  address pstn_add;
 1554   
 1555                  comment = NULL;
 1556                  callsinfo = NULL;
 1557                  list = g_list_first(tapinfo->callsinfo_list);
 1558                  while (list)
 1559                  {
 1560                          tmp_listinfo=list->data;
 1561                          if ( tmp_listinfo->protocol == VOIP_AC_ISDN ){
 1562                                  tmp_actrace_isdn_info = tmp_listinfo->prot_info;
 1563                                  /* TODO: Also check the IP of the Blade, and if the call is complete (no active) */
 1564                                  if ( (tmp_actrace_isdn_info->crv == q931_crv) && (tmp_actrace_isdn_info->trunk == actrace_trunk) ) {
 1565                                          callsinfo = (voip_calls_info_t*)(list->data);
 1566                                          break;
 1567                                  }
 1568                          }
 1569                          list = g_list_next (list);
 1570                  }
 1571   
 1572                  SET_ADDRESS(&pstn_add, AT_STRINGZ, 5, g_strdup("PSTN"));
 1573   
 1574                  /* if it is a new call, add it to the list */
 1575                  if (!callsinfo) {
 1576                          callsinfo = g_malloc0(sizeof(voip_calls_info_t));
 1577                          callsinfo->call_active_state = VOIP_ACTIVE;
 1578                          callsinfo->call_state = VOIP_CALL_SETUP;
 1579                          callsinfo->from_identity=g_strdup(q931_calling_number);
 1580                          callsinfo->to_identity=g_strdup(q931_called_number);
 1581                          COPY_ADDRESS(&(callsinfo->initial_speaker),actrace_direction?&pstn_add:&(pinfo->src));
 1582                          callsinfo->first_frame_num=pinfo->fd->num;
 1583                          callsinfo->selected=FALSE;
 1584                          callsinfo->start_sec=(gint32) (pinfo->fd->rel_ts.secs);
 1585                          callsinfo->start_usec=pinfo->fd->rel_ts.nsecs/1000;
 1586                          callsinfo->protocol=VOIP_AC_ISDN;
 1587                          callsinfo->prot_info=g_malloc(sizeof(actrace_isdn_calls_info_t));
 1588                          callsinfo->free_prot_info = g_free;
 1589                          tmp_actrace_isdn_info=callsinfo->prot_info;
 1590                          tmp_actrace_isdn_info->crv=q931_crv;
 1591                          tmp_actrace_isdn_info->trunk=actrace_trunk;
 1592                          callsinfo->npackets = 0;
 1593                          callsinfo->call_num = tapinfo->ncalls++;
 1594                          tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
 1595                  }
 1596   
 1597                  callsinfo->stop_sec=(gint32) (pinfo->fd->rel_ts.secs);
 1598                  callsinfo->stop_usec=pinfo->fd->rel_ts.nsecs/1000;
 1599                  callsinfo->last_frame_num=pinfo->fd->num;
 1600                  ++(callsinfo->npackets);
 1601                  /* increment the packets counter of all calls */
 1602                  ++(tapinfo->npackets);
 1603   
 1604                  switch(pi->message_type){
 1605                  case Q931_SETUP:
 1606                          comment = g_strdup_printf("AC_ISDN trunk:%u Calling: %s  Called:%s", actrace_trunk, q931_calling_number, q931_called_number);
 1607                          callsinfo->call_state=VOIP_CALL_SETUP;
 1608                          break;
 1609                  case Q931_CONNECT:
 1610                          callsinfo->call_state=VOIP_IN_CALL;
 1611                          break;
 1612                  case Q931_RELEASE_COMPLETE:
 1613                  case Q931_RELEASE:
 1614                  case Q931_DISCONNECT:
 1615                          if (callsinfo->call_state==VOIP_CALL_SETUP){
 1616                                  if (ADDRESSES_EQUAL(&(callsinfo->initial_speaker), actrace_direction?&pstn_add:&(pinfo->src) )){  /* forward direction */
 1617                                          callsinfo->call_state=VOIP_CANCELLED;
 1618                                  }
 1619                                  else{                                                                                           /* reverse */
 1620                                          callsinfo->call_state=VOIP_REJECTED;
 1621                                          tapinfo->rejected_calls++;
 1622                                  }
 1623                          } else if ( (callsinfo->call_state!=VOIP_CANCELLED) && (callsinfo->call_state!=VOIP_REJECTED) ){
 1624                                          callsinfo->call_state=VOIP_COMPLETED;
 1625                                          tapinfo->completed_calls++;
 1626                          }
 1627                          if (q931_cause_value != 0xFF){
 1628                                  comment = g_strdup_printf("AC_ISDN trunk:%u Q931 Rel Cause (%i):%s", actrace_trunk, q931_cause_value, val_to_str(q931_cause_value, q931_cause_code_vals, "<unknown>"));
 1629                          } else { /* Cause not set */
 1630                                  comment = g_strdup("AC_ISDN No Q931 Rel Cause");
 1631                          }
 1632                          break;
 1633                  }
 1634   
 1635                  if (!comment)
 1636                          comment = g_strdup_printf("AC_ISDN  trunk:%u", actrace_trunk );
 1637   
 1638                  add_to_graph(tapinfo, pinfo, val_to_str(pi->message_type, q931_message_type_vals, "<unknown>") , comment, callsinfo->call_num,
 1639                                  actrace_direction?&pstn_add:&(pinfo->src),
 1640                                  actrace_direction?&(pinfo->src):&pstn_add,
 1641                                  1 );
 1642   
 1643                  g_free(comment);
 1644                  g_free((char *)pstn_add.data);
 1645          }
 1646   
 1647          tapinfo->redraw = TRUE;
 1648   
 1649          return 1;  /* refresh output */
 1650  }
Show more  




Change Warning 4303.30583 : Useless Assignment

Priority:
State:
Finding:
Owner:
Note: