/usr/include/wireshark/epan/proto.h is in libwireshark-dev 2.0.2+ga16e22e-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 | /* proto.h
* Definitions for protocol display
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*! @file proto.h
The protocol tree related functions.<BR>
A protocol tree will hold all necessary data to display the whole dissected packet.
Creating a protocol tree is done in a two stage process:
A static part at program startup, and a dynamic part when the dissection with the real packet data is done.<BR>
The "static" information is provided by creating a hf_register_info hf[] array, and register it using the
proto_register_field_array() function. This is usually done at dissector registering.<BR>
The "dynamic" information is added to the protocol tree by calling one of the proto_tree_add_...() functions,
e.g. proto_tree_add_bytes().
*/
#ifndef __PROTO_H__
#define __PROTO_H__
#include <stdarg.h>
#include <glib.h>
#include <epan/wmem/wmem.h>
#include "ipv4.h"
#include "wsutil/nstime.h"
#include "time_fmt.h"
#include "tvbuff.h"
#include "ftypes/ftypes.h"
#include "register.h"
#include "ws_symbol_export.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** @defgroup prototree The Protocol Tree
*
* Dissectors use proto_tree_add_* to add items to the protocol tree. In
* most cases you'll want to use proto_tree_add_item().
*
* @{
*/
/** The header-field index for the special text pseudo-field. Exported by libwireshark.dll */
WS_DLL_PUBLIC int hf_text_only;
/** the maximum length of a protocol field string representation */
#define ITEM_LABEL_LENGTH 240
struct _value_string;
struct expert_field;
/** Make a const value_string[] look like a _value_string pointer, used to set header_field_info.strings */
#define VALS(x) (const struct _value_string*)(x)
/** Make a const val64_string[] look like a _val64_string pointer, used to set header_field_info.strings */
#define VALS64(x) (const struct _val64_string*)(x)
/** Something to satisfy checkAPIs when you have a pointer to a value_string_ext (e.g., one built with value_string_ext_new()) */
#define VALS_EXT_PTR(x) (x)
/** Make a const true_false_string[] look like a _true_false_string pointer, used to set header_field_info.strings */
#define TFS(x) (const struct true_false_string*)(x)
typedef void (*custom_fmt_func_t)(gchar *, guint32);
typedef void (*custom_fmt_func_64_t)(gchar *, guint64);
/** Make a custom format function pointer look like a void pointer. Used to set header_field_info.strings.
*
* We cast to gsize first, which 1) is guaranteed to be wide enough to
* hold a pointer and 2) lets us side-step warnings about casting function
* pointers to 'void *'. This violates ISO C but should be fine on POSIX
* and Windows.
*/
#define CF_FUNC(x) ((const void *) (gsize) (x))
/** Make a const range_string[] look like a _range_string pointer, used to set
* header_field_info.strings */
#define RVALS(x) (const struct _range_string*)(x)
/** Cast a ft_framenum_type_t, used to set header_field_info.strings */
#define FRAMENUM_TYPE(x) GINT_TO_POINTER(x)
struct _protocol;
/** Structure for information about a protocol */
typedef struct _protocol protocol_t;
/** Function used for reporting errors in dissectors; it throws a
* DissectorError exception, with the string passed as an argument
* as the message for the exception, so that it can show up in
* the Info column and the protocol tree.
*
* If that string is dynamically allocated, it should be allocated with
* wmem_alloc() with wmem_packet_scope(); using wmem_strdup_printf() would work.
*
* If the WIRESHARK_ABORT_ON_DISSECTOR_BUG environment variable is set,
* it will call abort(), instead, to make it easier to get a stack trace.
*
* @param message string to use as the message
*/
WS_DLL_PUBLIC WS_MSVC_NORETURN void proto_report_dissector_bug(const char *message) G_GNUC_NORETURN;
#define REPORT_DISSECTOR_BUG(message) \
proto_report_dissector_bug(message)
/** Macro used to provide a hint to static analysis tools.
* (Currently only Visual C++.)
*/
#if _MSC_VER >= 1400
/* XXX - Is there a way to say "quit checking at this point"? */
#define __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(expression) \
; __analysis_assume(expression);
#else
#define __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(expression)
#endif
/** Macro used for assertions in dissectors; it doesn't abort, it just
* throws a DissectorError exception, with the assertion failure
* message as a parameter, so that it can show up in the protocol tree.
*
* NOTE: this should only be used to detect bugs in the dissector (e.g., logic
* conditions that shouldn't happen). It should NOT be used for showing
* that a packet is malformed. For that, use expert_infos instead.
*
* @param s expression to test in the assertion
*/
#define __DISSECTOR_ASSERT_STRINGIFY(s) # s
#define __DISSECTOR_ASSERT(expression, file, lineno) \
(REPORT_DISSECTOR_BUG( \
wmem_strdup_printf(wmem_packet_scope(), \
"%s:%u: failed assertion \"%s\"", \
file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression))))
#define __DISSECTOR_ASSERT_HINT(expression, file, lineno, hint) \
(REPORT_DISSECTOR_BUG( \
wmem_strdup_printf(wmem_packet_scope(), \
"%s:%u: failed assertion \"%s\" (%s)", \
file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression), hint)))
#define DISSECTOR_ASSERT(expression) \
((void) ((expression) ? (void)0 : \
__DISSECTOR_ASSERT (expression, __FILE__, __LINE__))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(expression)
/**
* Same as DISSECTOR_ASSERT(), but takes an extra 'hint' parameter that
* can be used to provide information as to why the assertion might fail.
*
* @param expression expression to test in the assertion
* @param hint message providing extra information
*/
#define DISSECTOR_ASSERT_HINT(expression, hint) \
((void) ((expression) ? (void)0 : \
__DISSECTOR_ASSERT_HINT (expression, __FILE__, __LINE__, hint))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(expression)
#if 0
/* win32: using a debug breakpoint (int 3) can be very handy while debugging,
* as the assert handling of GTK/GLib is currently not very helpful */
#define DISSECTOR_ASSERT(expression) \
{ if(!(expression)) _asm { int 3}; }
#endif
/** Same as DISSECTOR_ASSERT(), but will throw DissectorError exception
* unconditionally, much like GLIB's g_assert_not_reached works.
*
* NOTE: this should only be used to detect bugs in the dissector (e.g., logic
* conditions that shouldn't happen). It should NOT be used for showing
* that a packet is malformed. For that, use expert_infos instead.
*
*/
#define DISSECTOR_ASSERT_NOT_REACHED() \
(REPORT_DISSECTOR_BUG( \
wmem_strdup_printf(wmem_packet_scope(), \
"%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \
__FILE__, __LINE__)))
/** Compare two integers.
*
* This is functionally the same as `DISSECTOR_ASSERT(a op b)` except that it
* will display the values of a and b upon failure.
*
* DISSECTOR_ASSERT_CMPINT(a, ==, b);
* DISSECTOR_ASSERT_CMPINT(min, <=, max);
*
* This function can currently compare values that fit inside a gint64.
*
* WARNING: The number of times the arguments are evaluated is undefined. Do
* not use expressions with side effects as arguments.
*
* @param a The first integer.
* @param op Any binary operator.
* @param b The second integer.
* @param type the type operator
* @param fmt the fmt operator
*/
#define __DISSECTOR_ASSERT_CMPINT(a, op, b, type, fmt) \
(REPORT_DISSECTOR_BUG( \
wmem_strdup_printf(wmem_packet_scope(), \
"%s:%u: failed assertion " #a " " #op " " #b " (" fmt " " #op " " fmt ")", \
__FILE__, __LINE__, (type)a, (type)b)))
#define DISSECTOR_ASSERT_CMPINT(a, op, b) \
((void) ((a op b) ? (void)0 : \
__DISSECTOR_ASSERT_CMPINT (a, op, b, gint64, "%" G_GINT64_MODIFIER "d"))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(a op b)
/** Like DISSECTOR_ASSERT_CMPINT() except the arguments are treated as
* unsigned values.
*
* This function can currently compare values that fit inside a guint64.
*/
#define DISSECTOR_ASSERT_CMPUINT(a, op, b) \
((void) ((a op b) ? (void)0 : \
__DISSECTOR_ASSERT_CMPINT (a, op, b, guint64, "%" G_GINT64_MODIFIER "u"))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(a op b)
/** Like DISSECTOR_ASSERT_CMPUINT() except the values are displayed in
* hexadecimal upon assertion failure.
*/
#define DISSECTOR_ASSERT_CMPUINTHEX(a, op, b) \
((void) ((a op b) ? (void)0 : \
__DISSECTOR_ASSERT_CMPINT (a, op, b, guint64, "0x%" G_GINT64_MODIFIER "X"))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(a op b)
/*
* This is similar to DISSECTOR_ASSERT(hfinfo->type == type) except that
* it will report the name of the field with the wrong type as well as
* the type.
*
* @param hfinfo The hfinfo for the field being tested
* @param type The type it's expected to have
*/
#define __DISSECTOR_ASSERT_FIELD_TYPE(hfinfo, t) \
(REPORT_DISSECTOR_BUG( \
wmem_strdup_printf(wmem_packet_scope(), \
"%s:%u: field %s is not of type "#t, \
__FILE__, __LINE__, (hfinfo)->abbrev)))
#define DISSECTOR_ASSERT_FIELD_TYPE(hfinfo, t) \
((void) (((hfinfo)->type == t) ? (void)0 : \
__DISSECTOR_ASSERT_FIELD_TYPE ((hfinfo), t))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT((hfinfo)->type == t)
#define DISSECTOR_ASSERT_FIELD_TYPE_IS_INTEGRAL(hfinfo) \
((void) ((IS_FT_INT((hfinfo)->type) || \
IS_FT_UINT((hfinfo)->type)) ? (void)0 : \
REPORT_DISSECTOR_BUG( \
wmem_strdup_printf(wmem_packet_scope(), \
"%s:%u: field %s is not of an FT_{U}INTn type", \
__FILE__, __LINE__, (hfinfo)->abbrev)))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(IS_FT_INT((hfinfo)->type) || \
IS_FT_UINT((hfinfo)->type))
#define DISSECTOR_ASSERT_FIELD_TYPE_IS_TIME(hfinfo) \
((void) (((hfinfo)->type == FT_ABSOLUTE_TIME || \
(hfinfo)->type == FT_RELATIVE_TIME) ? (void)0 : \
__DISSECTOR_ASSERT_FIELD_TYPE_IS_TIME ((hfinfo)))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT((hfinfo)->type == FT_ABSOLUTE_TIME || \
(hfinfo)->type == FT_RELATIVE_TIME)
#define __DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING(hfinfo) \
(REPORT_DISSECTOR_BUG( \
wmem_strdup_printf(wmem_packet_scope(), \
"%s:%u: field %s is not of type FT_STRING, FT_STRINGZ, or FT_STRINGZPAD", \
__FILE__, __LINE__, (hfinfo)->abbrev)))
#define DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING(hfinfo) \
((void) (((hfinfo)->type == FT_STRING || (hfinfo)->type == FT_STRINGZ || \
(hfinfo)->type == FT_STRINGZPAD) ? (void)0 : \
__DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING ((hfinfo)))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT((hfinfo)->type == FT_STRING || \
(hfinfo)->type == FT_STRINGZ || \
(hfinfo)->type == FT_STRINGZPAD)
#define __DISSECTOR_ASSERT_FIELD_TYPE_IS_TIME(hfinfo) \
(REPORT_DISSECTOR_BUG( \
wmem_strdup_printf(wmem_packet_scope(), \
"%s:%u: field %s is not of type FT_ABSOLUTE_TIME or FT_RELATIVE_TIME", \
__FILE__, __LINE__, (hfinfo)->abbrev)))
/*
* The encoding of a field of a particular type may involve more
* than just whether it's big-endian or little-endian and its size.
*
* For integral values, that's it, as 99.9999999999999% of the machines
* out there are 2's complement binary machines with 8-bit bytes,
* so the protocols out there expect that and, for example, any Unisys
* 2200 series machines out there just have to translate between 2's
* complement and 1's complement (and nobody's put any IBM 709x's on
* any networks lately :-)).
*
* However:
*
* for floating-point numbers, in addition to IEEE decimal
* floating-point, there's also IBM System/3x0 and PDP-11/VAX
* floating-point - most protocols use IEEE binary, but DCE RPC
* can use other formats if that's what the sending host uses;
*
* for character strings, there are various character encodings
* (various ISO 646 sets, ISO 8859/x, various other national
* standards, various DOS and Windows encodings, various Mac
* encodings, UTF-8, UTF-16, other extensions to ASCII, EBCDIC,
* etc.);
*
* for absolute times, there's UNIX time_t, UNIX time_t followed
* by 32-bit microseconds, UNIX time_t followed by 32-bit
* nanoseconds, DOS date/time, Windows FILETIME, NTP time, etc..
*
* We might also, in the future, want to allow a field specifier to
* indicate the encoding of the field, or at least its default
* encoding, as most fields in most protocols always use the
* same encoding (although that's not true of all fields, so we
* still need to be able to specify that at run time).
*
* So, for now, we define ENC_BIG_ENDIAN and ENC_LITTLE_ENDIAN as
* bit flags, to be combined, in the future, with other information
* to specify the encoding in the last argument to
* proto_tree_add_item(), and possibly to specify in a field
* definition (e.g., ORed in with the type value).
*
* Currently, proto_tree_add_item() treats its last argument as a
* Boolean - if it's zero, the field is big-endian, and if it's non-zero,
* the field is little-endian - and other code in epan/proto.c does
* the same. We therefore define ENC_BIG_ENDIAN as 0x00000000 and
* ENC_LITTLE_ENDIAN as 0x80000000 - we're using the high-order bit
* so that we could put a field type and/or a value such as a character
* encoding in the lower bits.
*/
#define ENC_BIG_ENDIAN 0x00000000
#define ENC_LITTLE_ENDIAN 0x80000000
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define ENC_HOST_ENDIAN ENC_LITTLE_ENDIAN
#else
#define ENC_HOST_ENDIAN ENC_BIG_ENDIAN
#endif
/*
* Historically FT_TIMEs were only timespecs; the only question was whether
* they were stored in big- or little-endian format.
*
* For backwards compatibility, we interpret an encoding of 1 as meaning
* "little-endian timespec", so that passing TRUE is interpreted as that.
*/
#define ENC_TIME_TIMESPEC 0x00000000 /* "struct timespec" */
#define ENC_TIME_NTP 0x00000002 /* NTP times */
#define ENC_TIME_TOD 0x00000004 /* System/3xx and z/Architecture time-of-day clock */
/*
* Historically, the only place the representation mattered for strings
* was with FT_UINT_STRINGs, where we had FALSE for the string length
* being big-endian and TRUE for it being little-endian.
*
* We now have encoding values for the character encoding. The encoding
* values are encoded in all but the top bit (which is the byte-order
* bit, required for FT_UINT_STRING and for UCS-2 and UTF-16 strings)
* and the bottom bit (which we ignore for now so that programs that
* pass TRUE for the encoding just do ASCII). (The encodings are given
* directly as even numbers in hex, so that make-init-lua.pl can just
* turn them into numbers for use in init.lua.)
*
* We don't yet process ASCII and UTF-8 differently. Ultimately, for
* ASCII, all bytes with the 8th bit set should be mapped to some "this
* is not a valid character" code point, as ENC_ASCII should mean "this
* is ASCII, not some extended variant thereof". We should also map
* 0x00 to that as well - null-terminated and null-padded strings
* never have NULs in them, but counted strings might. (Either that,
* or the values for strings should be counted, not null-terminated.)
* For UTF-8, invalid UTF-8 sequences should be mapped to the same
* code point.
*
* For display, perhaps we should also map control characters to the
* Unicode glyphs showing the name of the control character in small
* caps, diagonally. (Unfortunately, those only exist for C0, not C1.)
*/
#define ENC_CHARENCODING_MASK 0x7FFFFFFE /* mask out byte-order bits */
#define ENC_ASCII 0x00000000
#define ENC_UTF_8 0x00000002
#define ENC_UTF_16 0x00000004
#define ENC_UCS_2 0x00000006
#define ENC_UCS_4 0x00000008
#define ENC_ISO_8859_1 0x0000000A
#define ENC_ISO_8859_2 0x0000000C
#define ENC_ISO_8859_3 0x0000000E
#define ENC_ISO_8859_4 0x00000010
#define ENC_ISO_8859_5 0x00000012
#define ENC_ISO_8859_6 0x00000014
#define ENC_ISO_8859_7 0x00000016
#define ENC_ISO_8859_8 0x00000018
#define ENC_ISO_8859_9 0x0000001A
#define ENC_ISO_8859_10 0x0000001C
#define ENC_ISO_8859_11 0x0000001E
/* #define ENC_ISO_8859_12 0x00000020 ISO 8859-12 was abandoned */
#define ENC_ISO_8859_13 0x00000022
#define ENC_ISO_8859_14 0x00000024
#define ENC_ISO_8859_15 0x00000026
#define ENC_ISO_8859_16 0x00000028
#define ENC_WINDOWS_1250 0x0000002A
#define ENC_3GPP_TS_23_038_7BITS 0x0000002C
#define ENC_EBCDIC 0x0000002E
#define ENC_MAC_ROMAN 0x00000030
#define ENC_CP437 0x00000032
#define ENC_ASCII_7BITS 0x00000034
/*
* TODO:
*
* These could probably be used by existing code:
*
* "IBM MS DBCS"
* JIS C 6226
*
* As those are added, change code such as the code in packet-bacapp.c
* to use them.
*/
/*
* For protocols (FT_PROTOCOL), aggregate items with subtrees (FT_NONE),
* opaque byte-array fields (FT_BYTES), and other fields where there
* is no choice of encoding (either because it's "just a bucket
* of bytes" or because the encoding is completely fixed), we
* have ENC_NA (for "Not Applicable").
*/
#define ENC_NA 0x00000000
/* For cases where either native type or string encodings could both be
* valid arguments, we need something to distinguish which one is being
* passed as the argument, because ENC_BIG_ENDIAN and ENC_ASCII are both
* 0x00000000. So we use ENC_STR_NUM or ENC_STR_HEX bit-or'ed with
* ENC_ASCII and its ilk.
*/
/* this is for strings as numbers "12345" */
#define ENC_STR_NUM 0x01000000
/* this is for strings as hex "1a2b3c" */
#define ENC_STR_HEX 0x02000000
/* a convenience macro for either of the above */
#define ENC_STRING 0x03000000
/* mask out ENC_STR_* and related bits - should this replace ENC_CHARENCODING_MASK? */
#define ENC_STR_MASK 0x0000FFFE
/* for cases where the number is allowed to have a leading '+'/'-' */
/* this can't collide with ENC_SEP_* because they can be used simultaneously */
#define ENC_NUM_PREF 0x00200000
/* For cases where a string encoding contains hex, bit-or one or more
* of these for the allowed separator(s), as well as with ENC_STR_HEX.
* See hex_str_to_bytes_encoding() in epan/strutil.h for details.
*/
#define ENC_SEP_NONE 0x00010000
#define ENC_SEP_COLON 0x00020000
#define ENC_SEP_DASH 0x00040000
#define ENC_SEP_DOT 0x00080000
#define ENC_SEP_SPACE 0x00100000
/* a convenience macro for the above */
#define ENC_SEP_MASK 0x001F0000
/* For cases where a string encoding contains a timestamp, use one
* of these (but only one). These values can collide with above, because
* you can't do both at the same time.
*/
#define ENC_ISO_8601_DATE 0x00010000
#define ENC_ISO_8601_TIME 0x00020000
#define ENC_ISO_8601_DATE_TIME 0x00030000
#define ENC_RFC_822 0x00040000
#define ENC_RFC_1123 0x00080000
/* a convenience macro for the above - for internal use only */
#define ENC_STR_TIME_MASK 0x000F0000
/* Values for header_field_info.display */
/* For integral types, the display format is a BASE_* field_display_e value
* possibly ORed with BASE_*_STRING */
/** FIELD_DISPLAY_E_MASK selects the field_display_e value. */
#define FIELD_DISPLAY_E_MASK 0xFF
typedef enum {
/* Integral types */
BASE_NONE = 0, /**< none */
BASE_DEC = 1, /**< decimal */
BASE_HEX = 2, /**< hexadecimal */
BASE_OCT = 3, /**< octal */
BASE_DEC_HEX = 4, /**< decimal (hexadecimal) */
BASE_HEX_DEC = 5, /**< hexadecimal (decimal) */
BASE_CUSTOM = 6, /**< call custom routine (in ->strings) to format */
/* String types */
STR_ASCII = BASE_NONE, /**< shows non-printable ASCII characters as C-style escapes */
/* XXX, support for format_text_wsp() ? */
STR_UNICODE = 7, /**< shows non-printable UNICODE characters as \\uXXXX (XXX for now non-printable characters display depends on UI) */
/* Byte types */
SEP_DOT = 8, /**< hexadecimal bytes with a period (.) between each byte */
SEP_DASH = 9, /**< hexadecimal bytes with a dash (-) between each byte */
SEP_COLON = 10, /**< hexadecimal bytes with a colon (:) between each byte */
SEP_SPACE = 11, /**< hexadecimal bytes with a space between each byte */
/* Address types */
BASE_NETMASK = 12, /**< Used for IPv4 address that shouldn't be resolved (like for netmasks) */
/* Port types */
BASE_PT_UDP = 13, /**< UDP port */
BASE_PT_TCP = 14, /**< TCP port */
BASE_PT_DCCP = 15, /**< DCCP port */
BASE_PT_SCTP = 16 /**< SCTP port */
} field_display_e;
#define FIELD_DISPLAY(d) ((d) & FIELD_DISPLAY_E_MASK)
/* Following constants have to be ORed with a field_display_e when dissector
* want to use specials value-string MACROs for a header_field_info */
#define BASE_RANGE_STRING 0x100
#define BASE_EXT_STRING 0x200
#define BASE_VAL64_STRING 0x400
/** BASE_ values that cause the field value to be displayed twice */
#define IS_BASE_DUAL(b) ((b)==BASE_DEC_HEX||(b)==BASE_HEX_DEC)
/** BASE_PT_ values display decimal and transport port service name */
#define IS_BASE_PORT(b) (((b)==BASE_PT_UDP||(b)==BASE_PT_TCP||(b)==BASE_PT_DCCP||(b)==BASE_PT_SCTP))
/* For FT_ABSOLUTE_TIME, the display format is an absolute_time_display_e
* as per time_fmt.h. */
typedef enum {
HF_REF_TYPE_NONE, /**< Field is not referenced */
HF_REF_TYPE_INDIRECT, /**< Field is indirectly referenced (only applicable for FT_PROTOCOL) via. its child */
HF_REF_TYPE_DIRECT /**< Field is directly referenced */
} hf_ref_type;
/** information describing a header field */
typedef struct _header_field_info header_field_info;
/** information describing a header field */
struct _header_field_info {
/* ---------- set by dissector --------- */
const char *name; /**< [FIELDNAME] full name of this field */
const char *abbrev; /**< [FIELDABBREV] abbreviated name of this field */
enum ftenum type; /**< [FIELDTYPE] field type, one of FT_ (from ftypes.h) */
int display; /**< [FIELDDISPLAY] one of BASE_, or field bit-width if FT_BOOLEAN and non-zero bitmask */
const void *strings; /**< [FIELDCONVERT] value_string, val64_string, range_string or true_false_string,
typically converted by VALS(), RVALS() or TFS().
If this is an FT_PROTOCOL then it points to the
associated protocol_t structure */
guint64 bitmask; /**< [BITMASK] bitmask of interesting bits */
const char *blurb; /**< [FIELDDESCR] Brief description of field */
/* ------- set by proto routines (prefilled by HFILL macro, see below) ------ */
int id; /**< Field ID */
int parent; /**< parent protocol tree */
hf_ref_type ref_type; /**< is this field referenced by a filter */
int same_name_prev_id; /**< ID of previous hfinfo with same abbrev */
header_field_info *same_name_next; /**< Link to next hfinfo with same abbrev */
};
/**
* HFILL initializes all the "set by proto routines" fields in a
* _header_field_info. If new fields are added or removed, it should
* be changed as necessary.
*/
#define HFILL -1, 0, HF_REF_TYPE_NONE, -1, NULL
#define HFILL_INIT(hf) \
hf.hfinfo.id = -1; \
hf.hfinfo.parent = 0; \
hf.hfinfo.ref_type = HF_REF_TYPE_NONE; \
hf.hfinfo.same_name_prev_id = -1; \
hf.hfinfo.same_name_next = NULL;
/** Used when registering many fields at once, using proto_register_field_array() */
typedef struct hf_register_info {
int *p_id; /**< written to by register() function */
header_field_info hfinfo; /**< the field info to be registered */
} hf_register_info;
/** string representation, if one of the proto_tree_add_..._format() functions used */
typedef struct _item_label_t {
char representation[ITEM_LABEL_LENGTH];
} item_label_t;
/** Contains the field information for the proto_item. */
typedef struct field_info {
header_field_info *hfinfo; /**< pointer to registered field information */
gint start; /**< current start of data in field_info.ds_tvb */
gint length; /**< current data length of item in field_info.ds_tvb */
gint appendix_start; /**< start of appendix data */
gint appendix_length; /**< length of appendix data */
gint tree_type; /**< one of ETT_ or -1 */
guint32 flags; /**< bitfield like FI_GENERATED, ... */
item_label_t *rep; /**< string for GUI tree */
tvbuff_t *ds_tvb; /**< data source tvbuff */
fvalue_t value;
} field_info;
/*
* This structure describes one segment of a split-bits item
* crumb_bit_offset is the bit offset in the input tvb of the first (most significant) bit of this crumb
* crumb_bit_length is the number of contiguous bits of this crumb.
* The first element of an array of bits_specs describes the most significant crumb of the output value.
* The second element of an array of bits_specs describes the next-most significant crumb of the output value, etc.
* The array is terminated by a sentinal entry with crumb_bit_length of 0.
*/
typedef struct
{
guint crumb_bit_offset;
guint8 crumb_bit_length;
}crumb_spec_t;
/*
* Flag fields. Do not assign values greater than 0x00000080 unless you
* shuffle the expert information upward; see below.
*/
/** The protocol field should not be shown in the tree (it's used for filtering only),
* used in field_info.flags. */
/** HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN!
A user cannot tell by looking at the packet detail that the field exists
and that they can filter on its value. */
#define FI_HIDDEN 0x00000001
/** The protocol field should be displayed as "generated by Wireshark",
* used in field_info.flags. */
#define FI_GENERATED 0x00000002
/** The protocol field is actually a URL */
#define FI_URL 0x00000004
/** The protocol field value is in little endian */
#define FI_LITTLE_ENDIAN 0x00000008
/** The protocol field value is in big endian */
#define FI_BIG_ENDIAN 0x00000010
/** Field value start from nth bit (values from 0x20 - 0x100) */
#define FI_BITS_OFFSET(n) (((n) & 7) << 5)
/** Field value takes n bits (values from 0x100 - 0x4000) */
/* if 0, it means that field takes fi->length * 8 */
#define FI_BITS_SIZE(n) (((n) & 63) << 8)
/** convenience macro to get field_info.flags */
#define FI_GET_FLAG(fi, flag) ((fi) ? ((fi)->flags & (flag)) : 0)
/** convenience macro to set field_info.flags */
#define FI_SET_FLAG(fi, flag) \
do { \
if (fi) \
(fi)->flags = (fi)->flags | (flag); \
} while(0)
/** convenience macro to reset field_info.flags */
#define FI_RESET_FLAG(fi, flag) \
do { \
if (fi) \
(fi)->flags = (fi)->flags & ~(flag); \
} while(0)
#define FI_GET_BITS_OFFSET(fi) (FI_GET_FLAG(fi, FI_BITS_OFFSET(7)) >> 5)
#define FI_GET_BITS_SIZE(fi) (FI_GET_FLAG(fi, FI_BITS_SIZE(63)) >> 8)
/** One of these exists for the entire protocol tree. Each proto_node
* in the protocol tree points to the same copy. */
typedef struct {
GHashTable *interesting_hfids;
gboolean visible;
gboolean fake_protocols;
gint count;
struct _packet_info *pinfo;
} tree_data_t;
/** Each proto_tree, proto_item is one of these. */
typedef struct _proto_node {
struct _proto_node *first_child;
struct _proto_node *last_child;
struct _proto_node *next;
struct _proto_node *parent;
field_info *finfo;
tree_data_t *tree_data;
} proto_node;
/** A protocol tree element. */
typedef proto_node proto_tree;
/** A protocol item element. */
typedef proto_node proto_item;
/*
* Expert information.
* This is in the flags field; we allocate this from the top down,
* so as not to collide with FI_ flags, which are allocated from
* the bottom up.
*/
/* do not modify the PI_SEVERITY_MASK name - it's used by make-init-lua.pl */
/* expert severities */
#define PI_SEVERITY_MASK 0x00F00000 /**< mask usually for internal use only! */
/** Packet comment */
#define PI_COMMENT 0x00100000
/** Usual workflow, e.g. TCP connection establishing */
#define PI_CHAT 0x00200000
/** Notable messages, e.g. an application returned an "unusual" error code like HTTP 404 */
#define PI_NOTE 0x00400000
/** Warning, e.g. application returned an "unusual" error code */
#define PI_WARN 0x00600000
/** Serious problems, e.g. a malformed packet */
#define PI_ERROR 0x00800000
/* do not modify the PI_GROUP_MASK name - it's used by make-init-lua.pl */
/* expert "event groups" */
#define PI_GROUP_MASK 0xFF000000 /**< mask usually for internal use only! */
/** The protocol field has a bad checksum, usually uses PI_WARN severity */
#define PI_CHECKSUM 0x01000000
/** The protocol field indicates a sequence problem (e.g. TCP window is zero) */
#define PI_SEQUENCE 0x02000000
/** The protocol field indicates a bad application response code (e.g. HTTP 404), usually PI_NOTE severity */
#define PI_RESPONSE_CODE 0x03000000
/** The protocol field indicates an application request (e.g. File Handle == xxxx), usually PI_CHAT severity */
#define PI_REQUEST_CODE 0x04000000
/** The data is undecoded, the protocol dissection is incomplete here, usually PI_WARN severity */
#define PI_UNDECODED 0x05000000
/** The protocol field indicates a reassemble (e.g. DCE/RPC defragmentation), usually PI_CHAT severity (or PI_ERROR) */
#define PI_REASSEMBLE 0x06000000
/** The packet data is malformed, the dissector has "given up", usually PI_ERROR severity */
#define PI_MALFORMED 0x07000000
/** A generic debugging message (shouldn't remain in production code!), usually PI_ERROR severity */
#define PI_DEBUG 0x08000000
/** The protocol field violates a protocol specification, usually PI_WARN severity */
#define PI_PROTOCOL 0x09000000
/** The protocol field indicates a security problem (e.g. insecure implementation) */
#define PI_SECURITY 0x0a000000
/** The protocol field indicates a packet comment */
#define PI_COMMENTS_GROUP 0x0b000000
/** The protocol field indicates a decryption problem */
#define PI_DECRYPTION 0x0c000000
/* add more, see https://wiki.wireshark.org/Development/ExpertInfo */
/** is this protocol field hidden from the protocol tree display (used for filtering only)? */
/* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
#define PROTO_ITEM_IS_HIDDEN(proto_item) \
((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN) : 0)
/** mark this protocol field to be hidden from the protocol tree display (used for filtering only) */
/* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
#define PROTO_ITEM_SET_HIDDEN(proto_item) \
do { \
if (proto_item) \
FI_SET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \
} while(0)
/** mark this protocol field to be visible from the protocol tree display */
#define PROTO_ITEM_SET_VISIBLE(proto_item) \
do { \
if (proto_item) \
FI_RESET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \
} while(0)
/** is this protocol field generated by Wireshark (and not read from the packet data)? */
#define PROTO_ITEM_IS_GENERATED(proto_item) \
((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED) : 0)
/** mark this protocol field as generated by Wireshark (and not read from the packet data) */
#define PROTO_ITEM_SET_GENERATED(proto_item) \
do { \
if (proto_item) \
FI_SET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED); \
} while(0)
/** is this protocol field actually a URL? */
#define PROTO_ITEM_IS_URL(proto_item) \
((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_URL) : 0)
/** mark this protocol field as a URL */
#define PROTO_ITEM_SET_URL(proto_item) \
do { \
if (proto_item) \
FI_SET_FLAG(PITEM_FINFO(proto_item), FI_URL); \
} while(0)
typedef void (*proto_tree_foreach_func)(proto_node *, gpointer);
typedef gboolean (*proto_tree_traverse_func)(proto_node *, gpointer);
extern gboolean proto_tree_traverse_post_order(proto_tree *tree,
proto_tree_traverse_func func, gpointer data);
WS_DLL_PUBLIC void proto_tree_children_foreach(proto_tree *tree,
proto_tree_foreach_func func, gpointer data);
/** Retrieve the field_info from a proto_node */
#define PNODE_FINFO(proto_node) ((proto_node)->finfo)
/** Retrieve the field_info from a proto_item */
#define PITEM_FINFO(proto_item) PNODE_FINFO(proto_item)
/** Retrieve the field_info from a proto_tree */
#define PTREE_FINFO(proto_tree) PNODE_FINFO(proto_tree)
/** Retrieve the tree_data_t from a proto_tree */
#define PTREE_DATA(proto_tree) ((proto_tree)->tree_data)
/** Retrieve the wmem_allocator_t from a proto_node */
#define PNODE_POOL(proto_node) ((proto_node)->tree_data->pinfo->pool)
#ifdef HAVE_PLUGINS
/** Register dissector plugin type with the plugin system.
Called by epan_register_plugin_types(); do not call it yourself. */
extern void register_dissector_plugin_type(void);
#endif
/** Sets up memory used by proto routines. Called at program startup */
void proto_init(void (register_all_protocols_func)(register_cb cb, gpointer client_data),
void (register_all_handoffs_func)(register_cb cb, gpointer client_data),
register_cb cb, void *client_data);
/** Frees memory used by proto routines. Called at program shutdown */
extern void proto_cleanup(void);
/** This function takes a tree and a protocol id as parameter and
will return TRUE/FALSE for whether the protocol or any of the filterable
fields in the protocol is referenced by any fitlers.
If this function returns FALSE then it is safe to skip any
proto_tree_add_...() calls and just treat the call as if the
dissector was called with tree==NULL.
If you reset the tree to NULL by this dissector returning FALSE,
you will still need to call any subdissector with the original value of
tree or filtering will break.
The purpose of this is to optimize wireshark for speed and make it
faster for when filters are being used.
*/
WS_DLL_PUBLIC gboolean proto_field_is_referenced(proto_tree *tree, int proto_id);
/** Create a subtree under an existing item.
@param ti the parent item of the new subtree
@param idx one of the ett_ array elements registered with proto_register_subtree_array()
@return the new subtree */
WS_DLL_PUBLIC proto_tree* proto_item_add_subtree(proto_item *ti, const gint idx) G_GNUC_WARN_UNUSED_RESULT;
/** Get an existing subtree under an item.
@param ti the parent item of the subtree
@return the subtree or NULL */
WS_DLL_PUBLIC proto_tree* proto_item_get_subtree(proto_item *ti);
/** Get the parent of a subtree item.
@param ti the child item in the subtree
@return parent item or NULL */
WS_DLL_PUBLIC proto_item* proto_item_get_parent(const proto_item *ti);
/** Get Nth generation parent item.
@param ti the child item in the subtree
@param gen the generation to get (using 1 here is the same as using proto_item_get_parent())
@return parent item */
WS_DLL_PUBLIC proto_item* proto_item_get_parent_nth(proto_item *ti, int gen);
/** Replace text of item after it already has been created.
@param ti the item to set the text
@param format printf like format string
@param ... printf like parameters */
WS_DLL_PUBLIC void proto_item_set_text(proto_item *ti, const char *format, ...)
G_GNUC_PRINTF(2,3);
/** Append to text of item after it has already been created.
@param ti the item to append the text to
@param format printf like format string
@param ... printf like parameters */
WS_DLL_PUBLIC void proto_item_append_text(proto_item *ti, const char *format, ...)
G_GNUC_PRINTF(2,3);
/** Prepend to text of item after it has already been created.
@param ti the item to prepend the text to
@param format printf like format string
@param ... printf like parameters */
WS_DLL_PUBLIC void proto_item_prepend_text(proto_item *ti, const char *format, ...)
G_GNUC_PRINTF(2,3);
/** Set proto_item's length inside tvb, after it has already been created.
@param ti the item to set the length
@param length the new length ot the item */
WS_DLL_PUBLIC void proto_item_set_len(proto_item *ti, const gint length);
/**
* Sets the length of the item based on its start and on the specified
* offset, which is the offset past the end of the item; as the start
* in the item is relative to the beginning of the data source tvbuff,
* we need to pass in a tvbuff.
@param ti the item to set the length
@param tvb end is relative to this tvbuff
@param end this end offset is relative to the beginning of tvb
@todo make usage clearer, I don't understand it!
*/
WS_DLL_PUBLIC void proto_item_set_end(proto_item *ti, tvbuff_t *tvb, gint end);
/** Get length of a proto_item. Useful after using proto_tree_add_item()
* to add a variable-length field (e.g., FT_NSTRING_UINT8).
@param ti the item to get the length from
@return the current length */
WS_DLL_PUBLIC int proto_item_get_len(const proto_item *ti);
/** Creates a new proto_tree root.
@return the new tree root */
extern proto_tree* proto_tree_create_root(struct _packet_info *pinfo);
void proto_tree_reset(proto_tree *tree);
/** Clear memory for entry proto_tree. Clears proto_tree struct also.
@param tree the tree to free */
WS_DLL_PUBLIC void proto_tree_free(proto_tree *tree);
/** Set the tree visible or invisible.
Is the parsing being done for a visible proto_tree or an invisible one?
By setting this correctly, the proto_tree creation is sped up by not
having to call g_vsnprintf and copy strings around.
@param tree the tree to be set
@param visible ... or not
@return the old value */
WS_DLL_PUBLIC gboolean
proto_tree_set_visible(proto_tree *tree, gboolean visible);
/** Indicate whether we should fake protocols during dissection (default = TRUE)
@param tree the tree to be set
@param fake_protocols TRUE if we should fake protocols */
extern void
proto_tree_set_fake_protocols(proto_tree *tree, gboolean fake_protocols);
/** Mark a field/protocol ID as "interesting".
@param tree the tree to be set (currently ignored)
@param hfid the interesting field id
@todo what *does* interesting mean? */
extern void
proto_tree_prime_hfid(proto_tree *tree, const int hfid);
/** Get a parent item of a subtree.
@param tree the tree to get the parent from
@return parent item */
WS_DLL_PUBLIC proto_item* proto_tree_get_parent(proto_tree *tree);
/** Get the parent tree of a subtree.
@param tree the tree to get the parent from
@return parent tree */
WS_DLL_PUBLIC proto_tree *proto_tree_get_parent_tree(proto_tree *tree);
/** Get the root tree from any subtree.
@param tree the tree to get the root from
@return root tree */
WS_DLL_PUBLIC proto_tree* proto_tree_get_root(proto_tree *tree);
/** Move an existing item behind another existing item.
@param tree the tree to which both items belong
@param fixed_item the item which keeps its position
@param item_to_move the item which will be moved */
WS_DLL_PUBLIC void proto_tree_move_item(proto_tree *tree, proto_item *fixed_item, proto_item *item_to_move);
/** Set start and length of an appendix for a proto_tree.
@param tree the tree to set the appendix start and length
@param tvb the tv buffer of the current data
@param start the start offset of the appendix
@param length the length of the appendix */
WS_DLL_PUBLIC void proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint start, const gint length);
/** Add an item to a proto_tree, using the text label registered to that item.
The item is extracted from the tvbuff handed to it.
@param tree the tree to append this item to
@param hfinfo field
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param encoding data encoding
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_item_new(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
const gint start, gint length, const guint encoding);
WS_DLL_PUBLIC proto_item *
proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
const gint start, gint length, const guint encoding);
/** Add an item to a proto_tree, using the text label registered to that item.
The item is extracted from the tvbuff handed to it, and the retrieved
value is also set to *retval so the caller gets it back for other uses.
This function retrieves the value even if the passed-in tree param is NULL,
so that it can be used by dissectors at all times to both get the value
and set the tree item to it.
Like other proto_tree_add functions, if there is a tree and the value cannot
be decoded from the tvbuff, then an expert info error is reported.
This function accepts ENC_LITTLE_ENDIAN and ENC_BIG_ENDIAN for native number
encoding in the tvbuff
The length argument must
be set to the appropriate size of the native type as in other proto_add routines.
Integers of 8, 16, 24 and 32 bits can be retreived with these functions.
@param tree the tree to append this item to
@param hfindex field
@param tvb the tv buffer of the current data
@param start start of data in tvb (cannot be negative)
@param length length of data in tvb (for strings can be -1 for remaining)
@param encoding data encoding (e.g, ENC_LITTLE_ENDIAN, ENC_BIG_ENDIAN, ENC_ASCII|ENC_STRING, etc.)
@param[out] retval points to a gint/guint 8/16/32/64 or gfloat/gdouble which will be set
@return the newly created item, and value is set to the decoded value
*/
WS_DLL_PUBLIC proto_item *
proto_tree_add_item_ret_int(proto_tree *tree, int hfindex, tvbuff_t *tvb,
const gint start, gint length, const guint encoding, gint32 *retval);
WS_DLL_PUBLIC proto_item *
proto_tree_add_item_ret_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb,
const gint start, gint length, const guint encoding, guint32 *retval);
/** (INTERNAL USE ONLY) Add a text-only node to a proto_tree.
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
proto_item *
proto_tree_add_text_internal(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, const char *format,
...) G_GNUC_PRINTF(5,6);
/** (INTERNAL USE ONLY) Add a text-only node to a proto_tree using a variable argument list.
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param format printf like format string
@param ap variable argument list
@return the newly created item */
proto_item *
proto_tree_add_text_valist_internal(proto_tree *tree, tvbuff_t *tvb, gint start,
gint length, const char *format, va_list ap)
G_GNUC_PRINTF(5, 0);
/** Add a text-only node that creates a subtree underneath.
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param idx one of the ett_ array elements registered with proto_register_subtree_array()
@param tree_item item returned with tree creation. Can be NULL if going to be unused
@param text label for the tree
@return the newly created tree */
WS_DLL_PUBLIC proto_tree *
proto_tree_add_subtree(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, gint idx, proto_item **tree_item, const char *text);
/** Add a text-only node that creates a subtree underneath.
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param idx one of the ett_ array elements registered with proto_register_subtree_array()
@param tree_item item returned with tree creation. Can be NULL if going to be unused
@param format printf like format string
@param ... printf like parameters
@return the newly created tree */
WS_DLL_PUBLIC proto_tree *
proto_tree_add_subtree_format(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, gint idx, proto_item **tree_item, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a text-only node to a proto_tree with tvb_format_text() string. */
proto_item *
proto_tree_add_format_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length);
/** Add a text-only node to a proto_tree with tvb_format_text_wsp() string. */
proto_item *
proto_tree_add_format_wsp_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length);
/** Add a FT_NONE field to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_none_format(proto_tree *tree, const int hfindex, tvbuff_t *tvb, const gint start,
gint length, const char *format, ...) G_GNUC_PRINTF(6,7);
/** Add a FT_PROTOCOL to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_protocol_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const char *format, ...) G_GNUC_PRINTF(6,7);
/** Add a FT_BYTES to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param start_ptr pointer to the data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bytes(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* start_ptr);
/** Add a FT_BYTES to a proto_tree like proto_tree_add_bytes,
but used when the tvb data length does not match the bytes length.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param start_ptr pointer to the data to display
@param ptr_length length of data in start_ptr
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bytes_with_length(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8 *start_ptr, gint ptr_length);
/** Get and add a byte-array-based FT_* to a proto_tree.
Supported: FT_BYTES, FT_UINT_BYTES, FT_OID, FT_REL_OID, and FT_SYSTEM_ID.
The item is extracted from the tvbuff handed to it, based on the ENC_* passed
in for the encoding, and the retrieved byte array is also set to *retval so the
caller gets it back for other uses.
This function retrieves the value even if the passed-in tree param is NULL,
so that it can be used by dissectors at all times to both get the value
and set the tree item to it.
Like other proto_tree_add functions, if there is a tree and the value cannot
be decoded from the tvbuff, then an expert info error is reported. For string
encoding, this means that a failure to decode the hex value from the string
results in an expert info error being added to the tree.
If encoding is string-based, it will convert using tvb_get_string_bytes(); see
that function's comments for details.
@note The GByteArray retval must be pre-constructed using g_byte_array_new().
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param encoding data encoding (e.g, ENC_LITTLE_ENDIAN, or ENC_UTF_8|ENC_STR_HEX)
@param[in,out] retval points to a GByteArray which will be set to the bytes from the Tvb.
@param[in,out] endoff if not NULL, gets set to the character after those consumed.
@param[in,out] err if not NULL, gets set to 0 if no failure, else the errno code (e.g., EDOM, ERANGE).
@return the newly created item, and retval is set to the decoded value
*/
WS_DLL_PUBLIC proto_item *
proto_tree_add_bytes_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
const gint start, gint length, const guint encoding,
GByteArray *retval, gint *endoff, gint *err);
/** Add a formatted FT_BYTES to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param start_ptr pointer to the data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bytes_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, const guint8* start_ptr, const char *format,
...) G_GNUC_PRINTF(7,8);
/** Add a formatted FT_BYTES to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param start_ptr pointer to the data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bytes_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* start_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr pointer to the data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const nstime_t* value_ptr);
/** Get and add a FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree.
The item is extracted from the tvbuff handed to it, based on the ENC_* passed
in for the encoding, and the retrieved value is also set to *retval so the
caller gets it back for other uses.
This function retrieves the value even if the passed-in tree param is NULL,
so that it can be used by dissectors at all times to both get the value
and set the tree item to it.
Like other proto_tree_add functions, if there is a tree and the value cannot
be decoded from the tvbuff, then an expert info error is reported. For string
encoding, this means that a failure to decode the time value from the string
results in an expert info error being added to the tree.
If encoding is string-based, it will convert using tvb_get_string_time(); see
that function's comments for details.
@note The nstime_t *retval must be pre-allocated as a nstime_t.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param encoding data encoding (e.g, ENC_LITTLE_ENDIAN, ENC_UTF_8|ENC_ISO_8601_DATE_TIME, etc.)
@param[in,out] retval points to a nstime_t which will be set to the value
@param[in,out] endoff if not NULL, gets set to the character after those consumed.
@param[in,out] err if not NULL, gets set to 0 if no failure, else the errno code (e.g., EDOM, ERANGE).
@return the newly created item, and retval is set to the decoded value
*/
WS_DLL_PUBLIC proto_item *
proto_tree_add_time_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
const gint start, gint length, const guint encoding,
nstime_t *retval, gint *endoff, gint *err);
/** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
the format generating the string for the value and with the field name
being included automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr pointer to the data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_time_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, nstime_t* value_ptr, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
the format generating the entire string for the entry, including any field
name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr pointer to the data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, nstime_t* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_IPXNET to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipxnet(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
/** Add a formatted FT_IPXNET to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipxnet_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, guint32 value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_IPXNET to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_IPv4 to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipv4(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
/** Add a formatted FT_IPv4 to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipv4_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, guint32 value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_IPv4 to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_IPv6 to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipv6(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const struct e_in6_addr *value_ptr);
/** Add a formatted FT_IPv6 to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipv6_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, const struct e_in6_addr *value_ptr, const char *format,
...) G_GNUC_PRINTF(7,8);
/** Add a formatted FT_IPv6 to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const struct e_in6_addr *value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_ETHER to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ether(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* value);
/** Add a formatted FT_ETHER to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ether_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, const guint8* value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_ETHER to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ether_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_GUID to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_guid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const e_guid_t *value_ptr);
/** Add a formatted FT_GUID to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_guid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, const e_guid_t *value_ptr, const char *format,
...) G_GNUC_PRINTF(7,8);
/** Add a formatted FT_GUID to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_guid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const e_guid_t *value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_OID to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@return the newly created item */
extern proto_item *
proto_tree_add_oid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* value_ptr);
/** Add a formatted FT_OID to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
extern proto_item *
proto_tree_add_oid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, const guint8* value_ptr, const char *format,
...) G_GNUC_PRINTF(7,8);
/** Add a formatted FT_OID to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value_ptr data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
extern proto_item *
proto_tree_add_oid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint8* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_STRING or FT_STRINGZPAD to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_string(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const char* value);
/** Add a formatted FT_STRING or FT_STRINGZPAD to a proto_tree, with the
format generating the string for the value and with the field name
being included automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_string_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, const char* value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_STRING or FT_STRINGZPAD to a proto_tree, with the
format generating the entire string for the entry, including any field
name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_string_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const char* value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_BOOLEAN to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_boolean(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
/** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_boolean_format_value(proto_tree *tree, int hfindex,
tvbuff_t *tvb, gint start, gint length, guint32 value,
const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_boolean_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_FLOAT to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_float(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, float value);
/** Add a formatted FT_FLOAT to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_float_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, float value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_FLOAT to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_float_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, float value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_DOUBLE to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_double(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, double value);
/** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_double_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, double value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_double_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, double value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add one of FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value);
/** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
with the format generating the string for the value and with the field
name being included automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_uint_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, guint32 value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
with the format generating the entire string for the entry, including any
field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_uint_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add an FT_UINT64 to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_uint64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint64 value);
/** Add a formatted FT_UINT64 to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_uint64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, guint64 value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_UINT64 to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_uint64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add one of FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, gint32 value);
/** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
with the format generating the string for the value and with the field
name being included automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_int_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, gint32 value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
with the format generating the entire string for the entry, including
any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_int_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, gint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add an FT_INT64 to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_int64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, gint64 value);
/** Add a formatted FT_INT64 to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_int64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, gint64 value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_INT64 to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, gint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_EUI64 to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint64 value);
/** Add a formatted FT_EUI64 to a proto_tree, with the format generating
the string for the value and with the field name being included
automatically.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_eui64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
gint start, gint length, const guint64 value, const char *format, ...)
G_GNUC_PRINTF(7,8);
/** Add a formatted FT_EUI64 to a proto_tree, with the format generating
the entire string for the entry, including any field name.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param start start of data in tvb
@param length length of data in tvb
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_eui64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
gint length, const guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Useful for quick debugging. Also sends string to STDOUT, so don't
leave call to this function in production code.
@param tree the tree to append the text to
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_debug_text(proto_tree *tree, const char *format,
...) G_GNUC_PRINTF(2,3);
/** Append a string to a protocol item.<br>
NOTE: this function will break with the TRY_TO_FAKE_THIS_ITEM()
speed optimization.
Currently only WSP use this function so it is not that bad but try to
avoid using this one if possible.
IF you must use this function you MUST also disable the
TRY_TO_FAKE_THIS_ITEM() optimization for your dissector/function
using proto_item_append_string().
Do that by faking that the tree is visible by calling
proto_tree_set_visible(tree, TRUE) (see packet-wsp.c)
BEFORE you create the item you are later going to use
proto_item_append_string() on.
@param pi the item to append the string to
@param str the string to append */
WS_DLL_PUBLIC void
proto_item_append_string(proto_item *pi, const char *str);
/** Fill given label_str with string representation of field
@param fi the item to get the info from
@param label_str the string to fill
@todo think about changing the parameter profile */
WS_DLL_PUBLIC void
proto_item_fill_label(field_info *fi, gchar *label_str);
/** Register a new protocol.
@param name the full name of the new protocol
@param short_name abbreviated name of the new protocol
@param filter_name protocol name used for a display filter string
@return the new protocol handle */
WS_DLL_PUBLIC int
proto_register_protocol(const char *name, const char *short_name, const char *filter_name);
/** Deregister a protocol.
@param short_name abbreviated name of the protocol
@return TRUE if protocol is removed */
WS_DLL_PUBLIC gboolean
proto_deregister_protocol(const char *short_name);
/** This type of function can be registered to get called whenever
a given field was not found but a its prefix is matched;
It can be used to procrastinate the hf array registration.
@param match what's being matched */
typedef void (*prefix_initializer_t)(const char* match);
/** Register a new prefix for delayed initialization of field arrays
@param prefix the prefix for the new protocol
@param initializer function that will initialize the field array for the given prefix */
WS_DLL_PUBLIC void
proto_register_prefix(const char *prefix, prefix_initializer_t initializer);
/** Initialize every remaining uninitialized prefix. */
WS_DLL_PUBLIC void proto_initialize_all_prefixes(void);
WS_DLL_PUBLIC void proto_register_fields_manual(const int parent, header_field_info **hfi, const int num_records);
WS_DLL_PUBLIC void proto_register_fields_section(const int parent, header_field_info *hfi, const int num_records);
/** Register a header_field array.
@param parent the protocol handle from proto_register_protocol()
@param hf the hf_register_info array
@param num_records the number of records in hf */
WS_DLL_PUBLIC void
proto_register_field_array(const int parent, hf_register_info *hf, const int num_records);
/** Deregister an already registered field.
@param parent the protocol handle from proto_register_protocol()
@param hf_id the field to deregister */
WS_DLL_PUBLIC void
proto_deregister_field (const int parent, gint hf_id);
/** Add data to be freed when deregistered fields are freed.
@param data a pointer to data to free */
WS_DLL_PUBLIC void
proto_add_deregistered_data (void *data);
/** Free fields deregistered in proto_deregister_field(). */
WS_DLL_PUBLIC void
proto_free_deregistered_fields (void);
/** Register a protocol subtree (ett) array.
@param indices array of ett indices
@param num_indices the number of records in indices */
WS_DLL_PUBLIC void
proto_register_subtree_array(gint *const *indices, const int num_indices);
/** Get name of registered header_field number n.
@param n item # n (0-indexed)
@return the name of this registered item */
WS_DLL_PUBLIC const char* proto_registrar_get_name(const int n);
/** Get abbreviation of registered header_field number n.
@param n item # n (0-indexed)
@return the abbreviation of this registered item */
WS_DLL_PUBLIC const char* proto_registrar_get_abbrev(const int n);
/** Get the header_field information based upon a field or protocol id.
@param hfindex item # n (0-indexed)
@return the registered item */
WS_DLL_PUBLIC header_field_info* proto_registrar_get_nth(guint hfindex);
/** Get the header_field information based upon a field name.
@param field_name the field name to search for
@return the registered item */
WS_DLL_PUBLIC header_field_info* proto_registrar_get_byname(const char *field_name);
/** Get the header_field id based upon a field name.
@param field_name the field name to search for
@return the field id for the registered item */
extern int proto_registrar_get_id_byname(const char *field_name);
/** Get enum ftenum FT_ of registered header_field number n.
@param n item # n (0-indexed)
@return the registered item */
WS_DLL_PUBLIC enum ftenum proto_registrar_get_ftype(const int n);
/** Get parent protocol of registered header_field number n.
@param n item # n (0-indexed)
@return -1 if item _is_ a protocol */
WS_DLL_PUBLIC int proto_registrar_get_parent(const int n);
/** Is item # n a protocol?
@param n item # n (0-indexed)
@return TRUE if it's a protocol, FALSE if it's not */
WS_DLL_PUBLIC gboolean proto_registrar_is_protocol(const int n);
/** Get length of registered field according to field type.
@param n item # n (0-indexed)
@return 0 means undeterminable at registration time, -1 means unknown field */
extern gint proto_registrar_get_length(const int n);
/** Routines to use to iterate over the protocols and their fields;
* they return the item number of the protocol in question or the
* appropriate hfinfo pointer, and keep state in "*cookie". */
WS_DLL_PUBLIC int proto_get_first_protocol(void **cookie);
WS_DLL_PUBLIC int proto_get_data_protocol(void *cookie);
WS_DLL_PUBLIC int proto_get_next_protocol(void **cookie);
WS_DLL_PUBLIC header_field_info *proto_get_first_protocol_field(const int proto_id, void **cookie);
WS_DLL_PUBLIC header_field_info *proto_get_next_protocol_field(const int proto_id, void **cookie);
/** Check if a protocol name is already registered.
@param name the name to search for
@return proto_id */
WS_DLL_PUBLIC int proto_name_already_registered(const gchar *name);
/** Given a protocol's filter_name.
@param filter_name the filter name to search for
@return proto_id */
WS_DLL_PUBLIC int proto_get_id_by_filter_name(const gchar* filter_name);
/** Given a protocol's short name.
@param short_name the protocol short name to search for
@return proto_id */
WS_DLL_PUBLIC int proto_get_id_by_short_name(const gchar* short_name);
/** Can item # n decoding be disabled?
@param proto_id protocol id (0-indexed)
@return TRUE if it's a protocol, FALSE if it's not */
WS_DLL_PUBLIC gboolean proto_can_toggle_protocol(const int proto_id);
/** Get the "protocol_t" structure for the given protocol's item number.
@param proto_id protocol id (0-indexed) */
WS_DLL_PUBLIC protocol_t *find_protocol_by_id(const int proto_id);
/** Get the protocol's name for the given protocol's item number.
@param proto_id protocol id (0-indexed)
@return its name */
WS_DLL_PUBLIC const char *proto_get_protocol_name(const int proto_id);
/** Get the protocol's item number, for the given protocol's "protocol_t".
@return its proto_id */
WS_DLL_PUBLIC int proto_get_id(const protocol_t *protocol);
/** Get the protocol's short name, for the given protocol's "protocol_t".
@return its short name. */
WS_DLL_PUBLIC const char *proto_get_protocol_short_name(const protocol_t *protocol);
/** Get the protocol's long name, for the given protocol's "protocol_t".
@return its long name. */
WS_DLL_PUBLIC const char *proto_get_protocol_long_name(const protocol_t *protocol);
/** Is protocol's decoding enabled ?
@return TRUE if decoding is enabled, FALSE if not */
WS_DLL_PUBLIC gboolean proto_is_protocol_enabled(const protocol_t *protocol);
/** Get a protocol's filter name by its item number.
@param proto_id protocol id (0-indexed)
@return its filter name. */
WS_DLL_PUBLIC const char *proto_get_protocol_filter_name(const int proto_id);
/** Associate a heuristic dissector with a protocol
* INTERNAL USE ONLY!!!
* @param protocol to associate the heuristic with
* @param short_name heuristic dissector's short name
*/
extern void proto_add_heuristic_dissector(protocol_t *protocol, const char *short_name);
/** Apply func to all heuristic dissectors of a protocol
* @param protocol to iterate over heuristics
* @param func function to execute on heuristics
* @param user_data user-specific data for function
*/
WS_DLL_PUBLIC void proto_heuristic_dissector_foreach(const protocol_t *protocol, GFunc func, gpointer user_data);
/** Find commonly-used protocols in a layer list.
* @param layers Protocol layer list
* @param is_ip Set to TRUE if the layer list contains IPv4 or IPv6, otherwise
* unchanged. May be NULL.
* @param is_tcp Set to TRUE if the layer list contains TCP, otherwise
* unchanged. May be NULL.
* @param is_udp Set to TRUE if the layer list contains UDP, otherwise
* unchanged. May be NULL.
* @param is_sctp Set to TRUE if the layer list contains SCTP, otherwise
* unchanged. May be NULL.
* @param is_ssl Set to TRUE if the layer list contains SSL/TLS, otherwise
* unchanged. May be NULL.
* @param is_rtp Set to TRUE if the layer list contains RTP, otherwise
* unchanged. May be NULL.
*/
WS_DLL_PUBLIC void proto_get_frame_protocols(const wmem_list_t *layers,
gboolean *is_ip, gboolean *is_tcp, gboolean *is_udp, gboolean *is_sctp,
gboolean *is_ssl, gboolean *is_rtp);
/** Find a protocol by name in a layer list.
* @param layers Protocol layer list
* @param proto_name Name of protocol to find
*/
WS_DLL_PUBLIC gboolean proto_is_frame_protocol(const wmem_list_t *layers, const char* proto_name);
/** Enable / Disable protocol of the given item number.
@param proto_id protocol id (0-indexed)
@param enabled enable / disable the protocol */
WS_DLL_PUBLIC void proto_set_decoding(const int proto_id, const gboolean enabled);
/** Enable all protocols */
WS_DLL_PUBLIC void proto_enable_all(void);
/** Disable disabling/enabling of protocol of the given item number.
@param proto_id protocol id (0-indexed) */
WS_DLL_PUBLIC void proto_set_cant_toggle(const int proto_id);
/** Checks for existence any protocol or field within a tree.
@param tree "Protocols" are assumed to be a child of the [empty] root node.
@param id hfindex of protocol or field
@return TRUE = found, FALSE = not found
@todo add explanation of id parameter */
extern gboolean proto_check_for_protocol_or_field(const proto_tree* tree, const int id);
/** Return GPtrArray* of field_info pointers for all hfindex that appear in
tree. Only works with primed trees, and is fast.
@param tree tree of interest
@param hfindex primed hfindex
@return GPtrArry pointer */
WS_DLL_PUBLIC GPtrArray* proto_get_finfo_ptr_array(const proto_tree *tree, const int hfindex);
/** Return whether we're tracking any interesting fields.
Only works with primed trees, and is fast.
@param tree tree of interest
@return TRUE if we're tracking interesting fields */
WS_DLL_PUBLIC gboolean proto_tracking_interesting_fields(const proto_tree *tree);
/** Return GPtrArray* of field_info pointers for all hfindex that appear in
tree. Works with any tree, primed or unprimed, and is slower than
WS_DLL_PUBLIC
proto_get_finfo_ptr_array because it has to search through the tree.
@param tree tree of interest
@param hfindex index of field info of interest
@return GPtrArry pointer */
WS_DLL_PUBLIC GPtrArray* proto_find_finfo(proto_tree *tree, const int hfindex);
/** Return GPtrArray* of field_info pointers containg all hfindexes that appear
in tree.
@param tree tree of interest
@return GPtrArry pointer */
WS_DLL_PUBLIC GPtrArray* proto_all_finfos(proto_tree *tree);
/** Dumps a glossary of the protocol registrations to STDOUT */
WS_DLL_PUBLIC void proto_registrar_dump_protocols(void);
/** Dumps a glossary of the field value strings or true/false strings to STDOUT */
WS_DLL_PUBLIC void proto_registrar_dump_values(void);
/** Dumps the number of protocol and field registrations to STDOUT.
@return FALSE if we pre-allocated enough fields, TRUE otherwise. */
WS_DLL_PUBLIC gboolean proto_registrar_dump_fieldcount(void);
/** Dumps a glossary of the protocol and field registrations to STDOUT. */
WS_DLL_PUBLIC void proto_registrar_dump_fields(void);
/** Dumps a glossary field types and descriptive names to STDOUT */
WS_DLL_PUBLIC void proto_registrar_dump_ftypes(void);
/** Number of elements in the tree_is_expanded array. With MSVC and a
* libwireshark.dll, we need a special declaration. */
WS_DLL_PUBLIC int num_tree_types;
/** Returns TRUE if subtrees of that type are to be expanded. */
WS_DLL_PUBLIC gboolean tree_expanded(int tree_type);
/** Sets if subtrees of that type are to be expanded. */
WS_DLL_PUBLIC void tree_expanded_set(int tree_type, gboolean value);
/** glib doesn't have g_ptr_array_len of all things!*/
#ifndef g_ptr_array_len
#define g_ptr_array_len(a) ((a)?(a)->len:0)
#endif
/** Get number of bits of a header_field.
@param hfinfo header_field
@return the bitwidth */
extern int
hfinfo_bitwidth(const header_field_info *hfinfo);
WS_DLL_PUBLIC int
hfinfo_bitshift(const header_field_info *hfinfo);
struct epan_dissect;
/** Can we do a "match selected" on this field.
@param finfo field_info
@param edt epan dissecting
@return TRUE if we can do a "match selected" on the field, FALSE otherwise. */
WS_DLL_PUBLIC gboolean
proto_can_match_selected(field_info *finfo, struct epan_dissect *edt);
/** Construct a "match selected" display filter string.
@param finfo field_info
@param edt epan dissecting
@return the wmem NULL alloced display filter string. Needs to be freed with wmem_free(NULL, ...) */
WS_DLL_PUBLIC char*
proto_construct_match_selected_string(field_info *finfo, struct epan_dissect *edt);
/** Find field from offset in tvb.
@param tree tree of interest
@param offset offset in the tvb
@param tvb the tv buffer
@return the corresponding field_info */
WS_DLL_PUBLIC field_info*
proto_find_field_from_offset(proto_tree *tree, guint offset, tvbuff_t *tvb);
/** Find undecoded bytes in a tree
@param tree tree of interest
@param length the length of the frame
@return an array to be used as bitmap of decoded bytes */
WS_DLL_PUBLIC gchar*
proto_find_undecoded_data(proto_tree *tree, guint length);
/** This function will dissect a sequence of bytes that describe a bitmask.
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param offset start of data in tvb
@param hf_hdr an 8/16/24/32 bit integer that describes the bitmask to be dissected.
This field will form an expansion under which the individual fields of the
bitmask is dissected and displayed.
This field must be of the type FT_[U]INT{8|16|24|32}.
@param ett subtree index
@param fields an array of pointers to int that lists all the fields of the
bitmask. These fields can be either of the type FT_BOOLEAN for flags
or another integer of the same type/size as hf_hdr with a mask specified.
This array is terminated by a NULL entry.
FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
FT_integer fields that have a value_string attached will have the
matched string displayed on the expansion line.
@param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bitmask(proto_tree *tree, tvbuff_t *tvb, const guint offset,
const int hf_hdr, const gint ett, const int **fields, const guint encoding);
/** This function will dissect a sequence of bytes that describe a bitmask.
* This has "filterable" bitmask header functionality of proto_tree_add_bitmask
* with the ability to control what data is appended to the header like
* proto_tree_add_bitmask_text
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param offset start of data in tvb
@param hf_hdr an 8/16/24/32 bit integer that describes the bitmask to be dissected.
This field will form an expansion under which the individual fields of the
bitmask is dissected and displayed.
This field must be of the type FT_[U]INT{8|16|24|32}.
@param ett subtree index
@param fields an array of pointers to int that lists all the fields of the
bitmask. These fields can be either of the type FT_BOOLEAN for flags
or another integer of the same type/size as hf_hdr with a mask specified.
This array is terminated by a NULL entry.
FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
FT_integer fields that have a value_string attached will have the
matched string displayed on the expansion line.
@param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
@param flags bitmask field using BMT_NO_* flags to determine behavior
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bitmask_with_flags(proto_tree *tree, tvbuff_t *tvb, const guint offset,
const int hf_hdr, const gint ett, const int **fields, const guint encoding, const int flags);
/** This function will dissect a value that describe a bitmask. Similar to proto_tree_add_bitmask(),
but with a passed in value (presumably because it can't be retrieved directly from tvb)
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param offset start of data in tvb
@param hf_hdr an 8/16/24/32/64 bit integer that describes the bitmask to be dissected.
This field will form an expansion under which the individual fields of the
bitmask is dissected and displayed.
This field must be of the type FT_[U]INT{8|16|24|32|64}.
@param ett subtree index
@param fields an array of pointers to int that lists all the fields of the
bitmask. These fields can be either of the type FT_BOOLEAN for flags
or another integer of the same type/size as hf_hdr with a mask specified.
This array is terminated by a NULL entry.
FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
FT_integer fields that have a value_string attached will have the
matched string displayed on the expansion line.
@param value bitmask value
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bitmask_value(proto_tree *tree, tvbuff_t *tvb, const guint offset,
const int hf_hdr, const gint ett, const int **fields, const guint64 value);
/** This function will dissect a value that describe a bitmask. Similar to proto_tree_add_bitmask(),
but with a passed in value (presumably because it can't be retrieved directly from tvb)
This has "filterable" bitmask header functionality of proto_tree_add_bitmask_value
with the ability to control what data is appended to the header like
proto_tree_add_bitmask_text
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param offset start of data in tvb
@param hf_hdr an 8/16/24/32/64 bit integer that describes the bitmask to be dissected.
This field will form an expansion under which the individual fields of the
bitmask is dissected and displayed.
This field must be of the type FT_[U]INT{8|16|24|32|64}.
@param ett subtree index
@param fields an array of pointers to int that lists all the fields of the
bitmask. These fields can be either of the type FT_BOOLEAN for flags
or another integer of the same type/size as hf_hdr with a mask specified.
This array is terminated by a NULL entry.
FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
FT_integer fields that have a value_string attached will have the
matched string displayed on the expansion line.
@param value bitmask value
@param flags bitmask field using BMT_NO_* flags to determine behavior
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bitmask_value_with_flags(proto_tree *tree, tvbuff_t *tvb, const guint offset,
const int hf_hdr, const gint ett, const int **fields, const guint64 value, const int flags);
/** This function will dissect a sequence of bytes that describe a bitmask. Similar
to proto_tree_add_bitmask(), but with no "header" item to group all of the fields
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param offset start of data in tvb
@param len number of bytes of data
@param fields an array of pointers to int that lists all the fields of the
bitmask. These fields can be either of the type FT_BOOLEAN for flags
or another integer of the same type/size as hf_hdr with a mask specified.
This array is terminated by a NULL entry.
FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
FT_integer fields that have a value_string attached will have the
matched string displayed on the expansion line.
@param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
*/
WS_DLL_PUBLIC void
proto_tree_add_bitmask_list(proto_tree *tree, tvbuff_t *tvb, const guint offset,
const int len, const int **fields, const guint encoding);
/** This function will dissect a sequence of bytes that describe a bitmask.
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param offset start of data in tvb
@param len number of bytes of data
@param hf_hdr an 8/16/24/32 bit integer that describes the bitmask to be dissected.
This field will form an expansion under which the individual fields of the
bitmask are dissected and displayed.
This field must be of the type FT_[U]INT{8|16|24|32}.
@param ett subtree index
@param fields an array of pointers to int that lists all the fields of the
bitmask. These fields can be either of the type FT_BOOLEAN for flags
or another integer with a mask specified.
This array is terminated by a NULL entry.
FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
FT_integer fields that have a value_string attached will have the
matched string displayed on the expansion line.
@param exp expert info field used when decodable_len < len. This also means this function
should be called even when tree == NULL
@param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bitmask_len(proto_tree *tree, tvbuff_t *tvb, const guint offset, const guint len,
const int hf_hdr, const gint ett, const int **fields, struct expert_field* exp, const guint encoding);
/** Add a text with a subtree of bitfields.
@param tree the tree to append this item to
@param tvb the tv buffer of the current data
@param offset start of data in tvb
@param len length of the field name
@param name field name (NULL if bitfield contents should be used)
@param fallback field name if none of bitfields were usable
@param ett subtree index
@param fields NULL-terminated array of bitfield indexes
@param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
@param flags bitmask field
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bitmask_text(proto_tree *tree, tvbuff_t *tvb, const guint offset, const guint len,
const char *name, const char *fallback,
const gint ett, const int **fields, const guint encoding, const int flags);
#define BMT_NO_APPEND 0x01 /**< Don't change the title at all */
#define BMT_NO_INT 0x02 /**< Don't add integral (non-boolean) fields to title */
#define BMT_NO_FALSE 0x04 /**< Don't add booleans unless they're TRUE */
#define BMT_NO_TFS 0x08 /**< Don't use true_false_string while formatting booleans */
/** Add bits to a proto_tree, using the text label registered to that item.
The item is extracted from the tvbuff handed to it.
@param tree the tree to append this item to
@param hf_index field index. Fields for use with this function should have bitmask==0.
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bits
@param encoding data encoding
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bits_item(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits, const guint encoding);
/** Add bits to a proto_tree, using the text label registered to that item.
* The item is extracted from the tvbuff handed to it as a set
* of crumbs (segments) of contiguous bits, specified by an
* array of crumb_spec elements. The crumbs are assembled to
* create the value. There may be any number of crumbs
* specifying up to a total of 64 bits which may occur anywhere
* within the tvb. If the span of the crumbs within the tvb is 4
* octets or less, a bitmap of the crumbs is produced.
@param tree the tree to append this item to
@param hf_index field index. Fields for use with this function should have bitmask==0.
@param tvb the tv buffer of the current data
@param bit_offset of the first crumb in tvb expressed in bits
@param crumb_spec pointer to crumb_spec array
@param return_value if a pointer is passed here the value is returned.
@return the newly created item */
extern proto_item *
proto_tree_add_split_bits_item_ret_val(proto_tree *tree, const int hf_index, tvbuff_t *tvb,
const guint bit_offset, const crumb_spec_t *crumb_spec,
guint64 *return_value);
/** Add bitmap text for a split-bits crumb to a proto_tree,
* using the text label registered to an item. The bitmap is
* extracted from the tvbuff handed to it as a crumb (segment)
* of contiguous bits, specified by one of an array of
* crumb_spec elements. This function is normally called once
* per crumb, after the call to
proto_tree_add_split_bits_item_ret_val
@param tree the tree to append this item to
@param hf_index field index. Fields for use with this function should have bitmask==0.
@param tvb the tv buffer of the current data
@param bit_offset of the first crumb in tvb expressed in bits
@param crumb_spec pointer to crumb_spec array
@param crumb_index into the crumb_spec array for this crumb */
void
proto_tree_add_split_bits_crumb(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset,
const crumb_spec_t *crumb_spec, guint16 crumb_index);
/** Add bits to a proto_tree, using the text label registered to that item.
The item is extracted from the tvbuff handed to it.
@param tree the tree to append this item to
@param hf_index field index. Fields for use with this function should have bitmask==0.
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bits
@param return_value if a pointer is passed here the value is returned.
@param encoding data encoding
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_bits_ret_val(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits, guint64 *return_value, const guint encoding);
/** Add bits for a FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32
header field to a proto_tree, with the format generating the
string for the value and with the field name being included automatically.
@param tree the tree to append this item to
@param hf_index field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bit
@param value data to display
@param format printf like format string
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_uint_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32
header field to a proto_tree, with the format generating the
string for the value and with the field name being included automatically.
@param tree the tree to append this item to
@param hf_index field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bit
@param value data to display
@param format printf like format string
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_uint64_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_BOOLEAN header field to a proto_tree, with
the format generating the string for the value and with the field
name being included automatically.
@param tree the tree to append this item to
@param hf_index field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bit
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
proto_item *
proto_tree_add_boolean_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_BOOLEAN header field to a proto_tree, with
the format generating the string for the value and with the field
name being included automatically.
@param tree the tree to append this item to
@param hf_index field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bit
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
proto_item *
proto_tree_add_boolean_bits_format_value64(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_INT8, FT_INT16, FT_INT24 or FT_INT32
header field to a proto_tree, with the format generating the
string for the value and with the field name being included automatically.
@param tree the tree to append this item to
@param hf_index field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bit
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
proto_item *
proto_tree_add_int_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
gint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_INT8, FT_INT16, FT_INT24 or FT_INT32
header field to a proto_tree, with the format generating the
string for the value and with the field name being included automatically.
@param tree the tree to append this item to
@param hf_index field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bit
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
proto_item *
proto_tree_add_int64_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
gint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add bits for a FT_FLOAT header field to a proto_tree, with
the format generating the string for the value and with the field
name being included automatically.
@param tree the tree to append this item to
@param hf_index field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_bits length of data in tvb expressed in bit
@param value data to display
@param format printf like format string
@param ... printf like parameters
@return the newly created item */
proto_item *
proto_tree_add_float_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
float value, const char *format, ...) G_GNUC_PRINTF(7,8);
/** Add a FT_STRING with ENC_3GPP_TS_23_038_7BITS encoding to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_chars number of 7bits characters to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ts_23_038_7bits_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
const guint bit_offset, const gint no_of_chars);
/** Add a FT_STRING with ENC_ASCII_7BITS encoding to a proto_tree.
@param tree the tree to append this item to
@param hfindex field index
@param tvb the tv buffer of the current data
@param bit_offset start of data in tvb expressed in bits
@param no_of_chars number of 7bits characters to display
@return the newly created item */
WS_DLL_PUBLIC proto_item *
proto_tree_add_ascii_7bits_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
const guint bit_offset, const gint no_of_chars);
/** Check if given string is a valid field name
@param field_name the field name to check
@return 0 if valid, else first illegal character */
WS_DLL_PUBLIC guchar
proto_check_field_name(const gchar *field_name);
/** Check if given string is a valid field name
@param tree the tree to append this item to
@param field_id the field id used for custom column
@param occurrence the occurrence of the field used for custom column
@param result the buffer to fill with the field string
@param expr the filter expression
@param size the size of the string buffer */
const gchar *
proto_custom_set(proto_tree* tree, GSList *field_id,
gint occurrence,
gchar *result,
gchar *expr, const int size );
/* #define HAVE_HFI_SECTION_INIT */
#ifdef HAVE_HFI_SECTION_INIT
#define HFI_INIT(proto) __attribute__((section( "_data_" G_STRINGIFY(proto)))) __attribute__((aligned(sizeof(void *))))
#define proto_register_fields(proto, hfi, count) \
do { \
extern header_field_info __start__data_ ##proto[]; \
extern header_field_info __stop__data_ ##proto[]; \
\
proto_register_fields_section(proto, __start__data_ ##proto, (int) (__stop__data_ ##proto - __start__data_ ##proto)); \
} while(0)
#else
#define HFI_INIT(proto)
#define proto_register_fields(proto, hfi, count) \
proto_register_fields_manual(proto, hfi, count)
#endif
#ifdef NEW_PROTO_TREE_API
#define proto_tree_add_item(tree, hfinfo, tvb, start, length, encoding) \
proto_tree_add_item_new(tree, hfinfo, tvb, start, length, encoding)
#define proto_tree_add_boolean(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_boolean(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_string(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_string(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_time(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_time(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_int(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_int(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_uint(tree, hfinfo, tvb, start, length, value) \
proto_tree_add_uint(tree, (hfinfo)->id, tvb, start, length, value)
#define proto_tree_add_float_format_value(tree, hfinfo, \
tvb, start, length, value, format, ...) \
proto_tree_add_float_format_value(tree, (hfinfo)->id, \
tvb, start, length, value, format, __VA_ARGS__)
#endif
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* proto.h */
|