(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-catapult-dct2000.c) |
| |
| 1519 | | | dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) |
| 1520 | | | { |
| 1521 | | | proto_tree *dct2000_tree = NULL; |
| 1522 | | | proto_item *ti = NULL; |
| 1523 | | | gint offset = 0; |
| 1524 | | | gint context_length; |
| 1525 | | | guint8 port_number; |
| 1526 | | | gint protocol_start; |
| 1527 | | | gint protocol_length; |
| 1528 | | | gint timestamp_start; |
| 1529 | | | gint timestamp_length; |
| 1530 | | | gint variant_start; |
| 1531 | | | gint variant_length; |
| 1532 | | | gint outhdr_start; |
| 1533 | | | gint outhdr_length; |
| 1534 | | | guint8 direction; |
| 1535 | | | tvbuff_t *next_tvb; |
| 1536 | | | int encap; |
| 1537 | | | dissector_handle_t protocol_handle = 0; |
| 1538 | | | dissector_handle_t heur_protocol_handle = 0; |
| 1539 | | | int sub_dissector_result = 0; |
| 1540 | | | char *protocol_name; |
| 1541 | | | |
| 1542 | | | |
| 1543 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 1544 | | | { |
| 1545 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "DCT2000"); |
| 1546 | | | } |
| 1547 | | | |
| 1548 | | | |
| 1549 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 1550 | | | { |
| 1551 | | | col_clear(pinfo->cinfo, COL_INFO); |
| 1552 | | | } |
| 1553 | | | |
| 1554 | | | |
| 1555 | | | if (tree) |
| 1556 | | | { |
| 1557 | | | ti = proto_tree_add_item(tree, proto_catapult_dct2000, tvb, offset, -1, FALSE); |
| 1558 | | | dct2000_tree = proto_item_add_subtree(ti, ett_catapult_dct2000); |
| 1559 | | | } |
| 1560 | | | |
| 1561 | | | |
| 1562 | | | |
| 1563 | | | |
| 1564 | | | |
| 1565 | | | |
| 1566 | | | context_length = tvb_strsize(tvb, offset); |
| 1567 | | | if (dct2000_tree) { |
| 1568 | | | proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_context, tvb, |
| 1569 | | | offset, context_length, FALSE); |
| 1570 | | | } |
| 1571 | | | offset += context_length; |
| 1572 | | | |
| 1573 | | | |
| 1574 | | | port_number = tvb_get_guint8(tvb, offset); |
| 1575 | | | if (dct2000_tree) { |
| 1576 | | | proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_port_number, tvb, |
| 1577 | | | offset, 1, FALSE); |
| 1578 | | | } |
| 1579 | | | offset++; |
| 1580 | | | |
| 1581 | | | |
| 1582 | | | timestamp_start = offset; |
| 1583 | | | timestamp_length = tvb_strsize(tvb, offset); |
| 1584 | | | if (dct2000_tree) { |
| 1585 | | | |
| 1586 | | | |
| 1587 | | | proto_tree_add_double(dct2000_tree, hf_catapult_dct2000_timestamp, tvb, |
| 1588 | | | offset, timestamp_length, |
| 1589 | | | atof(tvb_get_ptr(tvb, offset, timestamp_length))); |
| 1590 | | | } |
| 1591 | | | offset += timestamp_length; |
| 1592 | | | |
| 1593 | | | |
| 1594 | | | |
| 1595 | | | protocol_start = offset; |
| 1596 | | | protocol_length = tvb_strsize(tvb, offset); |
| 1597 | | | if (dct2000_tree) { |
| 1598 | | | proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_protocol, tvb, |
| 1599 | | | offset, protocol_length, FALSE); |
| 1600 | | | } |
| 1601 | | | offset += protocol_length; |
| 1602 | | | |
| 1603 | | | |
| 1604 | | | variant_start = offset; |
| 1605 | | | variant_length = tvb_strsize(tvb, offset); |
| 1606 | | | if (dct2000_tree) { |
| 1607 | | | proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_variant, tvb, |
| 1608 | | | offset, variant_length, FALSE); |
| 1609 | | | } |
| 1610 | | | offset += variant_length; |
| 1611 | | | |
| 1612 | | | |
| 1613 | | | outhdr_start = offset; |
| 1614 | | | outhdr_length = tvb_strsize(tvb, offset); |
| 1615 | | | if ((outhdr_length > 1) && dct2000_tree) |
| 1616 | | | { |
| 1617 | | | proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_outhdr, tvb, |
| 1618 | | | offset, outhdr_length, FALSE); |
| 1619 | | | } |
| 1620 | | | offset += outhdr_length; |
| 1621 | | | |
| 1622 | | | |
| 1623 | | | |
| 1624 | | | direction = tvb_get_guint8(tvb, offset); |
| 1625 | | | if (dct2000_tree) { |
| 1626 | | | proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_direction, tvb, |
| 1627 | | | offset, 1, FALSE); |
| 1628 | | | } |
| 1629 | | | offset++; |
| 1630 | | | |
| 1631 | | | |
| 1632 | | | if (dct2000_tree) { |
| 1633 | | | proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_encap, tvb, offset, 1, FALSE); |
| 1634 | | | } |
| 1635 | | | encap = tvb_get_guint8(tvb, offset); |
| 1636 | | | offset++; |
| 1637 | | | |
| 1638 | | | if (dct2000_tree) |
| 1639 | | | { |
| 1640 | | | |
| 1641 | | | proto_item_set_len(dct2000_tree, offset); |
| 1642 | | | } |
| 1643 | | | |
| 1644 | | | |
| 1645 | | | protocol_name = (char*)tvb_get_ptr(tvb, protocol_start, protocol_length); |
| 1646 | | | if (tree) |
| 1647 | | | { |
| 1648 | | | proto_item_append_text(ti, " context=%s.%u t=%s %c prot=%s (v=%s)", |
| 1649 | | | tvb_get_ptr(tvb, 0, context_length), |
| 1650 | | | port_number, |
| 1651 | | | tvb_get_ptr(tvb, timestamp_start, timestamp_length), |
| 1652 | | | (direction == 0) ? 'S' : 'R', |
| 1653 | | | protocol_name, |
| 1654 | | | tvb_get_ptr(tvb, variant_start, variant_length)); |
| 1655 | | | } |
| 1656 | | | |
| 1657 | | | |
| 1658 | | | |
| 1659 | | | |
| 1660 | | | if ((strcmp(protocol_name, "fp") == 0) || |
| 1661 | | | (strcmp(protocol_name, "fp_r4") == 0) || |
| 1662 | | | (strcmp(protocol_name, "fp_r5") == 0) || |
| 1663 | | | (strcmp(protocol_name, "fp_r6") == 0) || |
| 1664 | | | (strcmp(protocol_name, "fp_r7") == 0) || |
| 1665 | | | (strcmp(protocol_name, "fpiur_r5") == 0)) |
| 1666 | | | { |
| 1667 | | | parse_outhdr_string(tvb_get_ptr(tvb, outhdr_start, outhdr_length)); |
| 1668 | | | attach_fp_info(pinfo, direction, protocol_name, |
| 1669 | | | atoi((char*)tvb_get_ptr(tvb, variant_start, variant_length))); |
| 1670 | | | } |
| 1671 | | | |
| 1672 | | | |
| 1673 | | | else if (strcmp(protocol_name, "mac_r8_lte") == 0) |
| 1674 | | | { |
| 1675 | | | parse_outhdr_string(tvb_get_ptr(tvb, outhdr_start, outhdr_length)); |
| 1676 | | | attach_mac_lte_info(pinfo); |
| 1677 | | | } |
| 1678 | | | |
| 1679 | | | |
| 1680 | | | else if (strcmp(protocol_name, "rlc_r8_lte") == 0) |
| 1681 | | | { |
| 1682 | | | parse_outhdr_string(tvb_get_ptr(tvb, outhdr_start, outhdr_length)); |
| 1683 | | | attach_rlc_lte_info(pinfo); |
| 1684 | | | } |
| 1685 | | | |
| 1686 | | | |
| 1687 | | | else if (strcmp(protocol_name, "pdcp_r8_lte") == 0) |
| 1688 | | | { |
| 1689 | | | parse_outhdr_string(tvb_get_ptr(tvb, outhdr_start, outhdr_length)); |
| 1690 | | | attach_pdcp_lte_info(pinfo); |
| 1691 | | | } |
| 1692 | | | |
| 1693 | | | |
| 1694 | | | |
| 1695 | | | |
| 1696 | | | |
| 1697 | | | |
| 1698 | | | |
| 1699 | | | |
| 1700 | | | |
| 1701 | | | |
| 1702 | | | |
| 1703 | | | |
| 1704 | | | |
| 1705 | | | |
| 1706 | | | switch (encap) |
| 1707 | | | { |
| 1708 | | | case WTAP_ENCAP_RAW_IP: |
| 1709 | | | protocol_handle = find_dissector("ip"); |
| 1710 | | | break; |
| 1711 | | | case WTAP_ENCAP_ETHERNET: |
| 1712 | | | protocol_handle = find_dissector("eth_withoutfcs"); |
| 1713 | | | break; |
| 1714 | | | case WTAP_ENCAP_ISDN: |
| 1715 | | | protocol_handle = find_dissector("lapd"); |
| 1716 | | | pinfo->p2p_dir = pinfo->->isdn.uton; |
| 1717 | | | break; |
| 1718 | | | case WTAP_ENCAP_ATM_PDUS_UNTRUNCATED: |
| 1719 | | | protocol_handle = find_dissector("atm_untruncated"); |
| 1720 | | | break; |
| 1721 | | | case WTAP_ENCAP_PPP: |
| 1722 | | | protocol_handle = find_dissector("ppp_hdlc"); |
| 1723 | | | pinfo->p2p_dir = pinfo->->p2p.sent; |
| 1724 | | | break; |
| 1725 | | | case DCT2000_ENCAP_SSCOP: |
| 1726 | | | protocol_handle = find_dissector("sscop"); |
| 1727 | | | break; |
| 1728 | | | case WTAP_ENCAP_FRELAY: |
| 1729 | | | protocol_handle = find_dissector("fr"); |
| 1730 | | | break; |
| 1731 | | | case DCT2000_ENCAP_MTP2: |
| 1732 | | | protocol_handle = find_dissector("mtp2"); |
| 1733 | | | break; |
| 1734 | | | case DCT2000_ENCAP_NBAP: |
| 1735 | | | protocol_handle = find_dissector("nbap"); |
| 1736 | | | break; |
| 1737 | | | |
| 1738 | | | case DCT2000_ENCAP_UNHANDLED: |
| 1739 | | | |
| 1740 | | | |
| 1741 | | | |
| 1742 | | | |
| 1743 | | | |
| 1744 | | | |
| 1745 | | | |
| 1746 | | | |
| 1747 | | | if (check_col(pinfo->cinfo, COL_DEF_SRC) && direction == 0) |
| 1748 | | | { |
| 1749 | | | col_add_fstr(pinfo->cinfo, COL_DEF_SRC, |
| 1750 | | | "%s.%u", |
| 1751 | | | tvb_get_ptr(tvb, 0, context_length), |
| 1752 | | | port_number); |
| 1753 | | | } |
| 1754 | | | else |
| 1755 | | | if (check_col(pinfo->cinfo, COL_DEF_DST) && direction == 1) |
| 1756 | | | { |
| 1757 | | | col_add_fstr(pinfo->cinfo, COL_DEF_DST, |
| 1758 | | | "%s.%u", |
| 1759 | | | tvb_get_ptr(tvb, 0, context_length), |
| 1760 | | | port_number); |
| 1761 | | | } |
| 1762 | | | |
| 1763 | | | |
| 1764 | | | |
| 1765 | | | |
| 1766 | | | if (strcmp(protocol_name, "mac_r8_lte") == 0) |
| 1767 | | | { |
| 1768 | | | protocol_handle = mac_lte_handle; |
| 1769 | | | } |
| 1770 | | | |
| 1771 | | | else |
| 1772 | | | if (strcmp(protocol_name, "rlc_r8_lte") == 0) |
| 1773 | | | { |
| 1774 | | | protocol_handle = rlc_lte_handle; |
| 1775 | | | } |
| 1776 | | | |
| 1777 | | | else |
| 1778 | | | if (strcmp(protocol_name, "pdcp_r8_lte") == 0) |
| 1779 | | | { |
| 1780 | | | |
| 1781 | | | dissect_pdcp_lte(tvb, offset, pinfo, tree); |
| 1782 | | | return; |
| 1783 | | | } |
| 1784 | | | |
| 1785 | | | |
| 1786 | | | |
| 1787 | | | else |
| 1788 | | | if (strcmp(protocol_name, "xml") == 0) |
| 1789 | | | { |
| 1790 | | | protocol_handle = find_dissector("xml"); |
| 1791 | | | } |
| 1792 | | | |
| 1793 | | | |
| 1794 | | | |
| 1795 | | | else |
| 1796 | | | if (strcmp(protocol_name, "tty") == 0) |
| 1797 | | | { |
| 1798 | | | dissect_tty_lines(tvb, pinfo, dct2000_tree, offset); |
| 1799 | | | return; |
| 1800 | | | } |
| 1801 | | | |
| 1802 | | | else |
| 1803 | | | if (strcmp(protocol_name, "sipprim") == 0) |
| 1804 | | | { |
| 1805 | | | protocol_handle = find_dissector("sipprim"); |
| 1806 | | | } |
| 1807 | | | |
| 1808 | | | else |
| 1809 | | | if ((strcmp(protocol_name, "rrc_r8_lte") == 0) || |
| 1810 | | | (strcmp(protocol_name, "rrcpdcpprim_r8_lte") == 0)) |
| 1811 | | | { |
| 1812 | | | |
| 1813 | | | |
| 1814 | | | dissect_rrc_lte(tvb, offset, pinfo, tree); |
| 1815 | | | return; |
| 1816 | | | } |
| 1817 | | | |
| 1818 | | | |
| 1819 | | | |
| 1820 | | | |
| 1821 | | | |
| 1822 | | | |
| 1823 | | | |
| 1824 | | | if (!protocol_handle && catapult_dct2000_try_ipprim_heuristic) |
| 1825 | | | { |
| 1826 | | | guint32 source_addr_offset = 0, dest_addr_offset = 0; |
| 1827 | | | guint8 source_addr_length = 0, dest_addr_length = 0; |
| 1828 | | | guint32 source_port_offset = 0, dest_port_offset = 0; |
| 1829 | | | port_type type_of_port = PT_NONE; |
| 1830 | | | guint16 conn_id_offset = 0; |
| 1831 | | | int = offset; |
| 1832 | | | |
| 1833 | | | |
| 1834 | | | heur_protocol_handle = look_for_dissector(protocol_name); |
| 1835 | | | if ((heur_protocol_handle != 0) && |
| 1836 | | | find_ipprim_data_offset(tvb, &offset, direction, |
| 1837 | | | &source_addr_offset, &source_addr_length, |
| 1838 | | | &dest_addr_offset, &dest_addr_length, |
| 1839 | | | &source_port_offset, &dest_port_offset, |
| 1840 | | | &type_of_port, |
| 1841 | | | &conn_id_offset)) |
| 1842 | | | { |
| 1843 | | | proto_tree *ipprim_tree; |
| 1844 | | | proto_item *ipprim_ti; |
| 1845 | | | |
| 1846 | | | |
| 1847 | | | protocol_handle = heur_protocol_handle; |
| 1848 | | | |
| 1849 | | | |
| 1850 | | | |
| 1851 | | | |
| 1852 | | | |
| 1853 | | | ipprim_ti = proto_tree_add_string_format(dct2000_tree, hf_catapult_dct2000_ipprim_addresses, |
| 1854 | | | tvb, , 0, |
| 1855 | | | "", "IPPrim transport (%s): %s:%u -> %s:%u", |
| 1856 | | | (type_of_port == PT_UDP) ? "UDP" : "TCP", |
| 1857 | | | (source_addr_offset) ? |
| 1858 | | | ((source_addr_length == 4) ? |
| 1859 | | | (char *)get_hostname(tvb_get_ipv4(tvb, source_addr_offset)) : |
| 1860 | | | "<ipv6-address>" |
| 1861 | | | ) : |
| 1862 | | | "0.0.0.0", |
| 1863 | | | (source_port_offset) ? |
| 1864 | | | tvb_get_ntohs(tvb, source_port_offset) : |
| 1865 | | | 0, |
| 1866 | | | (dest_addr_offset) ? |
| 1867 | | | ((source_addr_length == 4) ? |
| 1868 | | | (char *)get_hostname(tvb_get_ipv4(tvb, dest_addr_offset)) : |
| 1869 | | | "<ipv6-address>" |
| 1870 | | | ) : |
| 1871 | | | "0.0.0.0", |
| 1872 | | | (dest_port_offset) ? |
| 1873 | | | tvb_get_ntohs(tvb, dest_port_offset) : |
| 1874 | | | 0); |
| 1875 | | | if ((type_of_port == PT_TCP) && (conn_id_offset != 0)) { |
| 1876 | | | proto_item_append_text(ipprim_ti, " (conn_id=%u)", tvb_get_ntohs(tvb, conn_id_offset)); |
| 1877 | | | } |
| 1878 | | | |
| 1879 | | | |
| 1880 | | | ipprim_tree = proto_item_add_subtree(ipprim_ti, ett_catapult_dct2000_ipprim); |
| 1881 | | | |
| 1882 | | | |
| 1883 | | | pinfo->ptype = type_of_port; |
| 1884 | | | switch (type_of_port) { |
| 1885 | | | case PT_UDP: |
| 1886 | | | pinfo->ipproto = IP_PROTO_UDP;
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/ipproto.h |
| |
52 | #define IP_PROTO_UDP 17 /* user datagram protocol - RFC768 */ |
| |
|
| 1887 | | | break; |
| 1888 | | | case PT_TCP: |
| 1889 | | | pinfo->ipproto = IP_PROTO_TCP; |
| 1890 | | | break; |
| 1891 | | | default: |
| 1892 | | | pinfo->ipproto = IP_PROTO_NONE; |
| 1893 | | | } |
| 1894 | | | |
| 1895 | | | |
| 1896 | | | |
| 1897 | | | if (source_addr_offset != 0) |
| 1898 | | | { |
| 1899 | | | proto_item *addr_ti; |
| 1900 | | | |
| 1901 | | | SET_ADDRESS(&pinfo->net_src,
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 | } |
| |
|
| 1902 | | | (source_addr_length == 4) ? AT_IPv4 : AT_IPv6, |
| 1903 | | | source_addr_length, |
| 1904 | | | (tvb_get_ptr(tvb, source_addr_offset, source_addr_length))); |
| 1905 | | | SET_ADDRESS(&pinfo->src,
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 | } |
| |
|
| 1906 | | | (source_addr_length == 4) ? AT_IPv4 : AT_IPv6, |
| 1907 | | | source_addr_length, |
| 1908 | | | (tvb_get_ptr(tvb, source_addr_offset, source_addr_length))); |
| 1909 | | | |
| 1910 | | | proto_tree_add_item(ipprim_tree, |
| 1911 | | | (source_addr_length == 4) ? |
| 1912 | | | hf_catapult_dct2000_ipprim_src_addr_v4 : |
| 1913 | | | hf_catapult_dct2000_ipprim_src_addr_v6, |
| 1914 | | | tvb, source_addr_offset, source_addr_length, FALSE); |
| 1915 | | | |
| 1916 | | | |
| 1917 | | | addr_ti = proto_tree_add_item(ipprim_tree, |
| 1918 | | | (source_addr_length == 4) ? |
| 1919 | | | hf_catapult_dct2000_ipprim_addr_v4 : |
| 1920 | | | hf_catapult_dct2000_ipprim_addr_v6, |
| 1921 | | | tvb, source_addr_offset, |
| 1922 | | | source_addr_length, FALSE); |
| 1923 | | | PROTO_ITEM_SET_HIDDEN(addr_ti);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 1924 | | | } |
| 1925 | | | if (source_port_offset != 0) |
| 1926 | | | { |
| 1927 | | | proto_item *port_ti; |
| 1928 | | | |
| 1929 | | | pinfo->srcport = tvb_get_ntohs(tvb, source_port_offset); |
| 1930 | | | |
| 1931 | | | proto_tree_add_item(ipprim_tree, |
| 1932 | | | (type_of_port == PT_UDP) ? |
| 1933 | | | hf_catapult_dct2000_ipprim_udp_src_port : |
| 1934 | | | hf_catapult_dct2000_ipprim_tcp_src_port, |
| 1935 | | | tvb, source_port_offset, 2, FALSE); |
| 1936 | | | port_ti = proto_tree_add_item(ipprim_tree, |
| 1937 | | | (type_of_port == PT_UDP) ? |
| 1938 | | | hf_catapult_dct2000_ipprim_udp_port : |
| 1939 | | | hf_catapult_dct2000_ipprim_tcp_port, |
| 1940 | | | tvb, source_port_offset, 2, FALSE); |
| 1941 | | | PROTO_ITEM_SET_HIDDEN(port_ti);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 1942 | | | } |
| 1943 | | | if (dest_addr_offset != 0) |
| 1944 | | | { |
| 1945 | | | proto_item *addr_ti; |
| 1946 | | | |
| 1947 | | | SET_ADDRESS(&pinfo->net_dst,
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 | } |
| |
|
| 1948 | | | (dest_addr_length == 4) ? AT_IPv4 : AT_IPv6, |
| 1949 | | | dest_addr_length, |
| 1950 | | | (tvb_get_ptr(tvb, dest_addr_offset, dest_addr_length))); |
| 1951 | | | SET_ADDRESS(&pinfo->dst,
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 | } |
| |
|
| 1952 | | | (dest_addr_length == 4) ? AT_IPv4 : AT_IPv6, |
| 1953 | | | dest_addr_length, |
| 1954 | | | (tvb_get_ptr(tvb, dest_addr_offset, dest_addr_length))); |
| 1955 | | | proto_tree_add_item(ipprim_tree, |
| 1956 | | | (dest_addr_length == 4) ? |
| 1957 | | | hf_catapult_dct2000_ipprim_dst_addr_v4 : |
| 1958 | | | hf_catapult_dct2000_ipprim_dst_addr_v6, |
| 1959 | | | tvb, dest_addr_offset, dest_addr_length, FALSE); |
| 1960 | | | |
| 1961 | | | |
| 1962 | | | addr_ti = proto_tree_add_item(ipprim_tree, |
| 1963 | | | (dest_addr_length == 4) ? |
| 1964 | | | hf_catapult_dct2000_ipprim_addr_v4 : |
| 1965 | | | hf_catapult_dct2000_ipprim_addr_v6, |
| 1966 | | | tvb, dest_addr_offset, dest_addr_length, FALSE); |
| 1967 | | | PROTO_ITEM_SET_HIDDEN(addr_ti);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 1968 | | | } |
| 1969 | | | if (dest_port_offset != 0) |
| 1970 | | | { |
| 1971 | | | proto_item *port_ti; |
| 1972 | | | |
| 1973 | | | pinfo->destport = tvb_get_ntohs(tvb, dest_port_offset); |
| 1974 | | | |
| 1975 | | | proto_tree_add_item(ipprim_tree, |
| 1976 | | | (type_of_port == PT_UDP) ? |
| 1977 | | | hf_catapult_dct2000_ipprim_udp_dst_port : |
| 1978 | | | hf_catapult_dct2000_ipprim_tcp_dst_port, |
| 1979 | | | tvb, dest_port_offset, 2, FALSE); |
| 1980 | | | port_ti = proto_tree_add_item(ipprim_tree, |
| 1981 | | | (type_of_port == PT_UDP) ? |
| 1982 | | | hf_catapult_dct2000_ipprim_udp_port : |
| 1983 | | | hf_catapult_dct2000_ipprim_tcp_port, |
| 1984 | | | tvb, dest_port_offset, 2, FALSE); |
| 1985 | | | PROTO_ITEM_SET_HIDDEN(port_ti);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 1986 | | | } |
| 1987 | | | if (conn_id_offset != 0) |
| 1988 | | | { |
| 1989 | | | proto_tree_add_item(ipprim_tree, |
| 1990 | | | hf_catapult_dct2000_ipprim_conn_id, |
| 1991 | | | tvb, conn_id_offset, 2, FALSE); |
| 1992 | | | } |
| 1993 | | | |
| 1994 | | | |
| 1995 | | | |
| 1996 | | | |
| 1997 | | | if (source_addr_offset && check_col(pinfo->cinfo, COL_DEF_SRC)) |
| 1998 | | | { |
| 1999 | | | col_append_fstr(pinfo->cinfo, COL_DEF_SRC, |
| 2000 | | | "(%s:%u)", |
| 2001 | | | (char*)get_hostname(tvb_get_ipv4(tvb, source_addr_offset)), |
| 2002 | | | tvb_get_ntohs(tvb, source_port_offset)); |
| 2003 | | | } |
| 2004 | | | if (dest_addr_offset && check_col(pinfo->cinfo, COL_DEF_DST)) |
| 2005 | | | { |
| 2006 | | | col_append_fstr(pinfo->cinfo, COL_DEF_DST, |
| 2007 | | | "(%s:%u)", |
| 2008 | | | (char*)get_hostname(tvb_get_ipv4(tvb, dest_addr_offset)), |
| 2009 | | | tvb_get_ntohs(tvb, dest_port_offset)); |
| 2010 | | | } |
| 2011 | | | |
| 2012 | | | |
| 2013 | | | proto_item_set_len(ipprim_tree, offset - ); |
| 2014 | | | } |
| 2015 | | | } |
| 2016 | | | |
| 2017 | | | |
| 2018 | | | |
| 2019 | | | if (!protocol_handle && catapult_dct2000_try_sctpprim_heuristic) |
| 2020 | | | { |
| 2021 | | | guint32 dest_addr_offset = 0; |
| 2022 | | | guint16 dest_addr_length = 0; |
| 2023 | | | guint32 dest_port_offset = 0; |
| 2024 | | | int = offset; |
| 2025 | | | |
| 2026 | | | heur_protocol_handle = look_for_dissector(protocol_name); |
| 2027 | | | if ((heur_protocol_handle != 0) && |
| 2028 | | | (find_sctpprim_variant1_data_offset(tvb, &offset, |
| 2029 | | | &dest_addr_offset, |
| 2030 | | | &dest_addr_length, |
| 2031 | | | &dest_port_offset) || |
| 2032 | | | find_sctpprim_variant3_data_offset(tvb, &offset, |
| 2033 | | | &dest_addr_offset, |
| 2034 | | | &dest_addr_length, |
| 2035 | | | &dest_port_offset))) |
| 2036 | | | { |
| 2037 | | | proto_tree *sctpprim_tree; |
| 2038 | | | proto_item *ti_local; |
| 2039 | | | |
| 2040 | | | |
| 2041 | | | protocol_handle = heur_protocol_handle; |
| 2042 | | | |
| 2043 | | | ti_local = proto_tree_add_string_format(dct2000_tree, hf_catapult_dct2000_sctpprim_addresses, |
| 2044 | | | tvb, , 0, |
| 2045 | | | "", "SCTPPrim transport: -> %s:%u", |
| 2046 | | | (dest_addr_offset) ? |
| 2047 | | | ((dest_addr_length == 4) ? |
| 2048 | | | (char *)get_hostname(tvb_get_ipv4(tvb, dest_addr_offset)) : |
| 2049 | | | "<ipv6-address>" |
| 2050 | | | ) : |
| 2051 | | | "0.0.0.0", |
| 2052 | | | (dest_port_offset) ? |
| 2053 | | | tvb_get_ntohs(tvb, dest_port_offset) : |
| 2054 | | | 0); |
| 2055 | | | |
| 2056 | | | |
| 2057 | | | sctpprim_tree = proto_item_add_subtree(ti_local, ett_catapult_dct2000_sctpprim); |
| 2058 | | | |
| 2059 | | | pinfo->ipproto = IP_PROTO_SCTP;
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/ipproto.h |
| |
181 | #define IP_PROTO_SCTP 132 /* Stream Control Transmission Protocol */ |
| |
|
| 2060 | | | |
| 2061 | | | |
| 2062 | | | if (dest_addr_offset != 0) |
| 2063 | | | { |
| 2064 | | | proto_item *addr_ti; |
| 2065 | | | |
| 2066 | | | SET_ADDRESS(&pinfo->net_dst,
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 | } |
| |
|
| 2067 | | | (dest_addr_length == 4) ? AT_IPv4 : AT_IPv6, |
| 2068 | | | dest_addr_length, |
| 2069 | | | (tvb_get_ptr(tvb, dest_addr_offset, dest_addr_length))); |
| 2070 | | | SET_ADDRESS(&pinfo->dst,
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 | } |
| |
|
| 2071 | | | (dest_addr_length == 4) ? AT_IPv4 : AT_IPv6, |
| 2072 | | | dest_addr_length, |
| 2073 | | | (tvb_get_ptr(tvb, dest_addr_offset, dest_addr_length))); |
| 2074 | | | proto_tree_add_item(sctpprim_tree, |
| 2075 | | | (dest_addr_length == 4) ? |
| 2076 | | | hf_catapult_dct2000_sctpprim_dst_addr_v4 : |
| 2077 | | | hf_catapult_dct2000_sctpprim_dst_addr_v6, |
| 2078 | | | tvb, dest_addr_offset, dest_addr_length, FALSE); |
| 2079 | | | |
| 2080 | | | |
| 2081 | | | addr_ti = proto_tree_add_item(sctpprim_tree, |
| 2082 | | | (dest_addr_length == 4) ? |
| 2083 | | | hf_catapult_dct2000_sctpprim_addr_v4 : |
| 2084 | | | hf_catapult_dct2000_sctpprim_addr_v6, |
| 2085 | | | tvb, dest_addr_offset, dest_addr_length, FALSE); |
| 2086 | | | PROTO_ITEM_SET_HIDDEN(addr_ti);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
319 | #define PROTO_ITEM_SET_HIDDEN(proto_item) \ |
320 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 2087 | | | } |
| 2088 | | | |
| 2089 | | | if (dest_port_offset != 0) |
| 2090 | | | { |
| 2091 | | | pinfo->destport = tvb_get_ntohs(tvb, dest_port_offset); |
| 2092 | | | |
| 2093 | | | proto_tree_add_item(sctpprim_tree, |
| 2094 | | | hf_catapult_dct2000_sctpprim_dst_port, |
| 2095 | | | tvb, dest_port_offset, 2, FALSE); |
| 2096 | | | } |
| 2097 | | | |
| 2098 | | | |
| 2099 | | | proto_item_set_len(sctpprim_tree, offset - ); |
| 2100 | | | } |
| 2101 | | | } |
| 2102 | | | |
| 2103 | | | break; |
| 2104 | | | |
| 2105 | | | default: |
| 2106 | | | |
| 2107 | | | |
| 2108 | | | |
| 2109 | | | DISSECTOR_ASSERT_NOT_REACHED();
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
131 | #define DISSECTOR_ASSERT_NOT_REACHED() \ |
132 | (REPORT_DISSECTOR_BUG( \ |
133 | ep_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \ |
134 | __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 2110 | | | return; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 2111 | | | } |
| 2112 | | | |
| 2113 | | | |
| 2114 | | | |
| 2115 | | | if (protocol_handle != 0) |
| 2116 | | | { |
| 2117 | | | |
| 2118 | | | next_tvb = tvb_new_subset(tvb, offset, -1, tvb_reported_length(tvb)-offset); |
| 2119 | | | sub_dissector_result = call_dissector_only(protocol_handle, next_tvb, pinfo, tree); |
| 2120 | | | } |
| 2121 | | | |
| 2122 | | | |
| 2123 | | | if (protocol_handle == 0 || sub_dissector_result == 0) |
| 2124 | | | { |
| 2125 | | | |
| 2126 | | | |
| 2127 | | | |
| 2128 | | | |
| 2129 | | | |
| 2130 | | | proto_tree_add_item(dct2000_tree, hf_catapult_dct2000_unparsed_data, |
| 2131 | | | tvb, offset, -1, FALSE); |
| 2132 | | | |
| 2133 | | | if (check_col(pinfo->cinfo, COL_INFO)) |
| 2134 | | | { |
| 2135 | | | col_add_fstr(pinfo->cinfo, COL_INFO, |
| 2136 | | | "Not dissected (context=%s.%u t=%s %c prot=%s (v=%s))", |
| 2137 | | | tvb_get_ptr(tvb, 0, context_length), |
| 2138 | | | port_number, |
| 2139 | | | tvb_get_ptr(tvb, timestamp_start, timestamp_length), |
| 2140 | | | (direction == 0) ? 'S' : 'R', |
| 2141 | | | tvb_get_ptr(tvb, protocol_start, protocol_length), |
| 2142 | | | tvb_get_ptr(tvb, variant_start, variant_length)); |
| 2143 | | | } |
| 2144 | | | } |
| 2145 | | | else |
| 2146 | | | { |
| 2147 | | | |
| 2148 | | | if (dct2000_tree) { |
| 2149 | | | proto_item *ti_local = proto_tree_add_uint(dct2000_tree, |
| 2150 | | | hf_catapult_dct2000_dissected_length, |
| 2151 | | | tvb, 0, 0, tvb_reported_length(tvb)-offset); |
| 2152 | | | PROTO_ITEM_SET_GENERATED(ti_local);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
325 | #define PROTO_ITEM_SET_GENERATED(proto_item) \ |
326 | ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_GENERATED) : 0) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
246 | #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag) |
| |
|
| 2153 | | | } |
| 2154 | | | } |
| 2155 | | | } |
| |