(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/voip_calls.c) |
| |
| 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 *; |
| 1407 | | | |
| 1408 | | | const q931_packet_info *pi = q931_info; |
| 1409 | | | |
| 1410 | | | |
| 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 | | | |
| 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 | | | |
| 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);
x /usr/include/glib-2.0/glib/glist.h |
| |
113 | #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) |
| |
|
| 1448 | | | } |
| 1449 | | | |
| 1450 | | | if (callsinfo != NULL) { |
| 1451 | | | = NULL; |
| 1452 | | | if (h225_cstype == H225_SETUP) { |
| 1453 | | | |
| 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 | | | |
| 1464 | | | |
| 1465 | | | |
| 1466 | | | |
| 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 | | | |
| 1475 | | | if ( (strcmp(callsinfo->to_identity, tmp_listinfo->to_identity)==0) |
| 1476 | | | && (memcmp(&tmp2_h323info->guid, &guid_allzero, GUID_LEN) == 0) ){ |
| 1477 | | | |
| 1478 | | | callsinfo->npackets += change_call_num_graph(tapinfo, tmp_listinfo->call_num, callsinfo->call_num); |
| 1479 | | | |
| 1480 | | | |
| 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);
x /usr/include/glib-2.0/glib/glist.h |
| |
113 | #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) |
| |
|
| 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);
x /usr/include/glib-2.0/glib/glist.h |
| |
113 | #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) |
| |
|
| 1501 | | | } |
| 1502 | | | |
| 1503 | | | = 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 | | | |
| 1507 | | | if (q931_cause_value != 0xFF){ |
| 1508 | | | = 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 { |
| 1510 | | | = g_strdup("H225 No Q931 Rel Cause"); |
| 1511 | | | } |
| 1512 | | | } |
| 1513 | | | |
| 1514 | | | if ( != NULL) { |
| 1515 | | | change_frame_graph(tapinfo, h225_frame_num, NULL, ); |
| 1516 | | | g_free(); |
| 1517 | | | } |
| 1518 | | | } |
| 1519 | | | |
| 1520 | | | |
| 1521 | | | h225_frame_num = 0; |
| 1522 | | | |
| 1523 | | | |
| 1524 | | | } else if (h245_labels.frame_num == q931_frame_num) { |
| 1525 | | | |
| 1526 | | | |
| 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 | | | |
| 1535 | | | if (!append_to_frame_graph(tapinfo, q931_frame_num, NULL, NULL)) { |
| 1536 | | | |
| 1537 | | | add_to_graph(tapinfo, pinfo, NULL, NULL, tmp_listinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); |
| 1538 | | | ++(tmp_listinfo->npackets); |
| 1539 | | | |
| 1540 | | | ++(tapinfo->npackets); |
| 1541 | | | } |
| 1542 | | | |
| 1543 | | | |
| 1544 | | | h245_add_to_graph(pinfo->fd->num); |
| 1545 | | | break; |
| 1546 | | | } |
| 1547 | | | } |
| 1548 | | | list = g_list_next (list);
x /usr/include/glib-2.0/glib/glist.h |
| |
113 | #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) |
| |
|
| 1549 | | | } |
| 1550 | | | |
| 1551 | | | |
| 1552 | | | } else if (actrace_frame_num == q931_frame_num) { |
| 1553 | | | address pstn_add; |
| 1554 | | | |
| 1555 | | | = NULL; |
| 1556 | | | callsinfo = NULL; |
Useless Assignment
This code assigns the variable the same value it already had. |
|
| 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 | | | |
| 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);
x /usr/include/glib-2.0/glib/glist.h |
| |
113 | #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL) |
| |
|
| 1570 | | | } |
| 1571 | | | |
| 1572 | | | SET_ADDRESS(&pstn_add, AT_STRINGZ, 5, g_strdup("PSTN"));
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/address.h |
| |
66 | #define SET_ADDRESS(addr, addr_type, addr_len, addr_data) { \ |
67 | (addr)->type = (addr_type); \ |
68 | (addr)->len = (addr_len); \ |
69 | (addr)->data = (addr_data); \ |
70 | } |
| |
|
| 1573 | | | |
| 1574 | | | |
| 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));
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/address.h |
| |
107 | #define COPY_ADDRESS(to, from) { \ |
108 | guint8 *COPY_ADDRESS_data; \ |
109 | (to)->type = (from)->type; \ |
110 | (to)->len = (from)->len; \ |
111 | COPY_ADDRESS_data = g_malloc((from)->len); \ |
112 | memcpy(COPY_ADDRESS_data, (from)->data, (from)->len); \ |
113 | (to)->data = COPY_ADDRESS_data; \ |
114 | } |
| |
|
| 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 | | | |
| 1602 | | | ++(tapinfo->npackets); |
| 1603 | | | |
| 1604 | | | switch(pi->message_type){ |
| 1605 | | | case Q931_SETUP: |
| 1606 | | | = 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) )){
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/address.h |
| |
92 | #define ADDRESSES_EQUAL(addr1, addr2) \ |
93 | ( \ |
94 | (addr1)->type == (addr2)->type && \ |
95 | ( \ |
96 | (addr1)->type == AT_NONE || \ |
97 | ( \ |
98 | (addr1)->len == (addr2)->len && \ |
99 | memcmp((addr1)->data, (addr2)->data, (addr1)->len) == 0 \ |
100 | ) \ |
101 | ) \ |
102 | ) |
| |
|
| 1617 | | | callsinfo->call_state=VOIP_CANCELLED; |
| 1618 | | | } |
| 1619 | | | else{ |
| 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 | | | = 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 { |
| 1630 | | | = g_strdup("AC_ISDN No Q931 Rel Cause"); |
| 1631 | | | } |
| 1632 | | | break; |
| 1633 | | | } |
| 1634 | | | |
| 1635 | | | if (!) |
| 1636 | | | = 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>") , , callsinfo->call_num, |
| 1639 | | | actrace_direction?&pstn_add:&(pinfo->src), |
| 1640 | | | actrace_direction?&(pinfo->src):&pstn_add, |
| 1641 | | | 1 ); |
| 1642 | | | |
| 1643 | | | g_free(); |
| 1644 | | | g_free((char *)pstn_add.data); |
| 1645 | | | } |
| 1646 | | | |
| 1647 | | | tapinfo->redraw = TRUE; |
| 1648 | | | |
| 1649 | | | return 1; |
| 1650 | | | } |
| |