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 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012
|
<pre>Network Working Group
Request for Comments: 1002 March, 1987
<span class="h1">PROTOCOL STANDARD FOR A NetBIOS SERVICE</span>
<span class="h1">ON A TCP/UDP TRANSPORT:</span>
<span class="h1">DETAILED SPECIFICATIONS</span>
ABSTRACT
This RFC defines a proposed standard protocol to support NetBIOS
services in a TCP/IP environment. Both local network and internet
operation are supported. Various node types are defined to accommodate
local and internet topologies and to allow operation with or without the
use of IP broadcast.
This RFC gives the detailed specifications of the NetBIOS-over-TCP
packets, protocols, and defined constants and variables. A more general
overview is found in a companion RFC, "Protocol Standard For a NetBIOS
Service on a TCP/UDP Transport: Concepts and Methods".
<span class="grey">NetBIOS Working Group [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
TABLE OF CONTENTS
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. STATUS OF THIS MEMO </span> 4
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. ACKNOWLEDGEMENTS </span> 4
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. INTRODUCTION </span> 5
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. PACKET DESCRIPTIONS </span> 5
4.1 NAME FORMAT 5
4.2 NAME SERVICE PACKETS 7
4.2.1 GENERAL FORMAT OF NAME SERVICE PACKETS 7
4.2.1.1 HEADER 8
4.2.1.2 QUESTION SECTION 10
4.2.1.3 RESOURCE RECORD 11
4.2.2 NAME REGISTRATION REQUEST 13
4.2.3 NAME OVERWRITE REQUEST & DEMAND 14
4.2.4 NAME REFRESH REQUEST 15
4.2.5 POSITIVE NAME REGISTRATION RESPONSE 16
4.2.6 NEGATIVE NAME REGISTRATION RESPONSE 16
4.2.7 END-NODE CHALLENGE REGISTRATION RESPONSE 17
4.2.8 NAME CONFLICT DEMAND 18
4.2.9 NAME RELEASE REQUEST & DEMAND 19
4.2.10 POSITIVE NAME RELEASE RESPONSE 20
4.2.11 NEGATIVE NAME RELEASE RESPONSE 20
4.2.12 NAME QUERY REQUEST 21
4.2.13 POSITIVE NAME QUERY RESPONSE 22
4.2.14 NEGATIVE NAME QUERY RESPONSE 23
4.2.15 REDIRECT NAME QUERY RESPONSE 24
4.2.16 WAIT FOR ACKNOWLEDGEMENT (WACK) RESPONSE 25
4.2.17 NODE STATUS REQUEST 26
4.2.18 NODE STATUS RESPONSE 27
4.3 SESSION SERVICE PACKETS 29
4.3.1 GENERAL FORMAT OF SESSION PACKETS 29
4.3.2 SESSION REQUEST PACKET 30
4.3.3 POSITIVE SESSION RESPONSE PACKET 31
4.3.4 NEGATIVE SESSION RESPONSE PACKET 31
4.3.5 SESSION RETARGET RESPONSE PACKET 31
4.3.6 SESSION MESSAGE PACKET 32
4.3.7 SESSION KEEP ALIVE PACKET 32
4.4 DATAGRAM SERVICE PACKETS 32
4.4.1 NetBIOS DATAGRAM HEADER 32
4.4.2 DIRECT_UNIQUE, DIRECT_GROUP, & BROADCAST DATAGRAM 33
4.4.3 DATAGRAM ERROR PACKET 34
4.4.4 DATAGRAM QUERY REQUEST 34
4.4.5 DATAGRAM POSITIVE AND NEGATIVE QUERY RESPONSE 34
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. PROTOCOL DESCRIPTIONS </span> 35
5.1 NAME SERVICE PROTOCOLS 35
5.1.1 B-NODE ACTIVITY 35
<span class="grey">NetBIOS Working Group [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
5.1.1.1 B-NODE ADD NAME 35
5.1.1.2 B-NODE ADD_GROUP NAME 37
5.1.1.3 B-NODE FIND_NAME 37
5.1.1.4 B NODE NAME RELEASE 38
5.1.1.5 B-NODE INCOMING PACKET PROCESSING 39
5.1.2 P-NODE ACTIVITY 42
5.1.2.1 P-NODE ADD_NAME 42
5.1.2.2 P-NODE ADD GROUP NAME 45
5.1.2.3 P-NODE FIND NAME 45
5.1.2.4 P-NODE DELETE_NAME 46
5.1.2.5 P-NODE INCOMING PACKET PROCESSING 47
5.1.2.6 P-NODE TIMER INITIATED PROCESSING 49
5.1.3 M-NODE ACTIVITY 50
5.1.3.1 M-NODE ADD NAME 50
5.1.3.2 M-NODE ADD GROUP NAME 54
5.1.3.3 M-NODE FIND NAME 55
5.1.3.4 M-NODE DELETE NAME 56
5.1.3.5 M-NODE INCOMING PACKET PROCESSING 58
5.1.3.6 M-NODE TIMER INITIATED PROCESSING 60
5.1.4 NBNS ACTIVITY 60
5.1.4.1 NBNS INCOMING PACKET PROCESSING 61
5.1.4.2 NBNS TIMER INITIATED PROCESSING 66
5.2 SESSION SERVICE PROTOCOLS 67
5.2.1 SESSION ESTABLISHMENT PROTOCOLS 67
5.2.1.1 USER REQUEST PROCESSING 67
5.2.1.2 RECEIVED PACKET PROCESSING 71
5.2.2 SESSION DATA TRANSFER PROTOCOLS 72
5.2.2.1 USER REQUEST PROCESSING 72
5.2.2.2 RECEIVED PACKET PROCESSING 72
5.2.2.3 PROCESSING INITIATED BY TIMER 73
5.2.3 SESSION TERMINATION PROTOCOLS 73
5.2.3.1 USER REQUEST PROCESSING 73
5.2.3.2 RECEPTION INDICATION PROCESSING 73
5.3 NetBIOS DATAGRAM SERVICE PROTOCOLS 74
5.3.1 B NODE TRANSMISSION OF NetBIOS DATAGRAMS 74
5.3.2 P AND M NODE TRANSMISSION OF NetBIOS DATAGRAMS 76
5.3.3 RECEPTION OF NetBIOS DATAGRAMS BY ALL NODES 78
5.3.4 PROTOCOLS FOR THE NBDD 80
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. DEFINED CONSTANTS AND VARIABLES </span> 83
REFERENCES 85
<span class="grey">NetBIOS Working Group [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
PROTOCOL STANDARD FOR A NetBIOS SERVICE
ON A TCP/UDP TRANSPORT:
DETAILED SPECIFICATIONS
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. STATUS OF THIS MEMO</span>
This RFC specifies a proposed standard for the DARPA Internet
community. Since this topic is new to the Internet community,
discussions and suggestions are specifically requested.
Please send written comments to:
Karl Auerbach
Epilogue Technology Corporation
P.O. Box 5432
Redwood City, CA 94063
Please send online comments to:
Avnish Aggarwal
Internet: mtxinu!excelan!avnish@ucbvax.berkeley.edu
Usenet: ucbvax!mtxinu!excelan!avnish
Distribution of this memorandum is unlimited.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. ACKNOWLEDGEMENTS</span>
This RFC has been developed under the auspices of the Internet
Activities Board.
The following individuals have contributed to the development of
this RFC:
Avnish Aggarwal Arvind Agrawal Lorenzo Aguilar
Geoffrey Arnold Karl Auerbach K. Ramesh Babu
Keith Ball Amatzia Ben-Artzi Vint Cerf
Richard Cherry David Crocker Steve Deering
Greg Ennis Steve Holmgren Jay Israel
David Kaufman Lee LaBarre James Lau
Dan Lynch Gaylord Miyata David Stevens
Steve Thomas Ishan Wu
The system proposed by this RFC does not reflect any existing
Netbios-over-TCP implementation. However, the design
incorporates considerable knowledge obtained from prior
implementations. Special thanks goes to the following
organizations which have provided this invaluable information:
CMC/Syros Excelan Sytek Ungermann-Bass
<span class="grey">NetBIOS Working Group [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. INTRODUCTION</span>
This RFC contains the detailed packet formats and protocol
specifications for NetBIOS-over-TCP. This RFC is a companion to
<a href="./rfc1001">RFC 1001</a>, "Protocol Standard For a NetBIOS Service on a TCP/UDP
Transport: Concepts and Methods" [<a href="#ref-1" title=""Protocol Standard For a NetBIOS Service on a TCP/UDP Transport: Concepts and Methods"">1</a>].
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. PACKET DESCRIPTIONS</span>
Bit and byte ordering are defined by the most recent version of
"Assigned Numbers" [<a href="#ref-2" title=""Assigned Numbers"">2</a>].
<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>. NAME FORMAT</span>
The NetBIOS name representation in all NetBIOS packets (for NAME,
SESSION, and DATAGRAM services) is defined in the Domain Name
Service <a href="./rfc883">RFC 883</a>[<a href="#ref-3" title=""Domain Names - Implementation and Specification"">3</a>] as "compressed" name messages. This format is
called "second-level encoding" in the section entitled
"Representation of NetBIOS Names" in the Concepts and Methods
document.
For ease of description, the first two paragraphs from page 31,
the section titled "Domain name representation and compression",
of <a href="./rfc883">RFC 883</a> are replicated here:
Domain names messages are expressed in terms of a sequence
of labels. Each label is represented as a one octet length
field followed by that number of octets. Since every domain
name ends with the null label of the root, a compressed
domain name is terminated by a length byte of zero. The
high order two bits of the length field must be zero, and
the remaining six bits of the length field limit the label
to 63 octets or less.
To simplify implementations, the total length of label
octets and label length octets that make up a domain name is
restricted to 255 octets or less.
The following is the uncompressed representation of the NetBIOS name
"FRED ", which is the 4 ASCII characters, F, R, E, D, followed by 12
space characters (0x20). This name has the SCOPE_ID: "NETBIOS.COM"
EGFCEFEECACACACACACACACACACACACA.NETBIOS.COM
This uncompressed representation of names is called "first-level
encoding" in the section entitled "Representation of NetBIOS Names"
in the Concepts and Methods document.
The following is a pictographic representation of the compressed
representation of the previous uncompressed Domain Name
representation.
<span class="grey">NetBIOS Working Group [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x20 | E (0x45) | G (0x47) | F (0x46) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| C (0x43) | E (0x45) | F (0x46) | E (0x45) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| E (0x45) | C (0x43) | A (0x41) | C (0x43) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| A (0x41) | C (0x43) | A (0x41) | C (0x43) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| A (0x41) | C (0x43) | A (0x41) | C (0x43) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| A (0x41) | C (0x43) | A (0x41) | C (0x43) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| A (0x41) | C (0x43) | A (0x41) | C (0x43) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| A (0x41) | C (0x43) | A (0x41) | C (0x43) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| A (0X41) | 0x07 | N (0x4E) | E (0x45) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| T (0x54) | B (0x42) | I (0x49) | O (0x4F) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| S (0x53) | 0x03 | C (0x43) | O (0x4F) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| M (0x4D) | 0x00 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Each section of a domain name is called a label [7 (page 31)]. A
label can be a maximum of 63 bytes. The first byte of a label in
compressed representation is the number of bytes in the label. For
the above example, the first 0x20 is the number of bytes in the
left-most label, EGFCEFEECACACACACACACACACACACACA, of the domain
name. The bytes following the label length count are the characters
of the label. The following labels are in sequence after the first
label, which is the encoded NetBIOS name, until a zero (0x00) length
count. The zero length count represents the root label, which is
always null.
A label length count is actually a 6-bit field in the label length
field. The most significant 2 bits of the field, bits 7 and 6, are
flags allowing an escape from the above compressed representation.
If bits 7 and 6 are both set (11), the following 14 bits are an
offset pointer into the full message to the actual label string from
another domain name that belongs in this name. This label pointer
allows for a further compression of a domain name in a packet.
NetBIOS implementations can only use label string pointers in Name
Service packets. They cannot be used in Session or Datagram Service
packets.
<span class="grey">NetBIOS Working Group [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
The other two possible values for bits 7 and 6 (01 and 10) of a label
length field are reserved for future use by <a href="./rfc883">RFC 883</a>[2 (page 32)].
Note that the first octet of a compressed name must contain one of
the following bit patterns. (An "x" indicates a bit whose value may
be either 0 or 1.):
00100000 - Netbios name, length must be 32 (decimal)
11xxxxxx - Label string pointer
10xxxxxx - Reserved
01xxxxxx - Reserved
<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>. NAME SERVICE PACKETS</span>
<span class="h4"><a class="selflink" id="section-4.2.1" href="#section-4.2.1">4.2.1</a>. GENERAL FORMAT OF NAME SERVICE PACKETS</span>
The NetBIOS Name Service packets follow the packet structure defined
in the Domain Name Service (DNS) <a href="./rfc883">RFC 883</a> [7 (pg 26-31)]. The
structures are compatible with the existing DNS packet formats,
however, additional types and codes have been added to work with
NetBIOS.
If Name Service packets are sent over a TCP connection they are
preceded by a 16 bit unsigned integer representing the length of the
Name Service packet.
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ ------ ------- +
| HEADER |
+ ------ ------- +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ QUESTION ENTRIES /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ ANSWER RESOURCE RECORDS /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ AUTHORITY RESOURCE RECORDS /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ ADDITIONAL RESOURCE RECORDS /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h5"><a class="selflink" id="section-4.2.1.1" href="#section-4.2.1.1">4.2.1.1</a>. HEADER</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID | OPCODE | NM_FLAGS | RCODE |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| QDCOUNT | ANCOUNT |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NSCOUNT | ARCOUNT |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Field Description
NAME_TRN_ID Transaction ID for Name Service Transaction.
Requestor places a unique value for each active
transaction. Responder puts NAME_TRN_ID value
from request packet in response packet.
OPCODE Packet type code, see table below.
NM_FLAGS Flags for operation, see table below.
RCODE Result codes of request. Table of RCODE values
for each response packet below.
QDCOUNT Unsigned 16 bit integer specifying the number of
entries in the question section of a Name
Service packet. Always zero (0) for responses.
Must be non-zero for all NetBIOS Name requests.
ANCOUNT Unsigned 16 bit integer specifying the number of
resource records in the answer section of a Name
Service packet.
NSCOUNT Unsigned 16 bit integer specifying the number of
resource records in the authority section of a
Name Service packet.
ARCOUNT Unsigned 16 bit integer specifying the number of
resource records in the additional records
section of a Name Service packet.
The OPCODE field is defined as:
0 1 2 3 4
+---+---+---+---+---+
| R | OPCODE |
+---+---+---+---+---+
<span class="grey">NetBIOS Working Group [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
Symbol Bit(s) Description
OPCODE 1-4 Operation specifier:
0 = query
5 = registration
6 = release
7 = WACK
8 = refresh
R 0 RESPONSE flag:
if bit == 0 then request packet
if bit == 1 then response packet.
The NM_FLAGS field is defined as:
0 1 2 3 4 5 6
+---+---+---+---+---+---+---+
|AA |TC |RD |RA | 0 | 0 | B |
+---+---+---+---+---+---+---+
Symbol Bit(s) Description
B 6 Broadcast Flag.
= 1: packet was broadcast or multicast
= 0: unicast
RA 3 Recursion Available Flag.
Only valid in responses from a NetBIOS Name
Server -- must be zero in all other
responses.
If one (1) then the NBNS supports recursive
query, registration, and release.
If zero (0) then the end-node must iterate
for query and challenge for registration.
RD 2 Recursion Desired Flag.
May only be set on a request to a NetBIOS
Name Server.
The NBNS will copy its state into the
response packet.
If one (1) the NBNS will iterate on the
query, registration, or release.
TC 1 Truncation Flag.
<span class="grey">NetBIOS Working Group [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
Set if this message was truncated because the
datagram carrying it would be greater than
576 bytes in length. Use TCP to get the
information from the NetBIOS Name Server.
AA 0 Authoritative Answer flag.
Must be zero (0) if R flag of OPCODE is zero
(0).
If R flag is one (1) then if AA is one (1)
then the node responding is an authority for
the domain name.
End nodes responding to queries always set
this bit in responses.
<span class="h5"><a class="selflink" id="section-4.2.1.2" href="#section-4.2.1.2">4.2.1.2</a>. QUESTION SECTION</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ QUESTION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| QUESTION_TYPE | QUESTION_CLASS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Field Description
QUESTION_NAME The compressed name representation of the
NetBIOS name for the request.
QUESTION_TYPE The type of request. The values for this field
are specified for each request.
QUESTION_CLASS The class of the request. The values for this
field are specified for each request.
QUESTION_TYPE is defined as:
Symbol Value Description:
NB 0x0020 NetBIOS general Name Service Resource Record
NBSTAT 0x0021 NetBIOS NODE STATUS Resource Record (See NODE
STATUS REQUEST)
QUESTION_CLASS is defined as:
<span class="grey">NetBIOS Working Group [Page 10]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
Symbol Value Description:
IN 0x0001 Internet class
<span class="h5"><a class="selflink" id="section-4.2.1.3" href="#section-4.2.1.3">4.2.1.3</a>. RESOURCE RECORD</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RR_TYPE | RR_CLASS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RDLENGTH | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
/ /
/ RDATA /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Field Description
RR_NAME The compressed name representation of the
NetBIOS name corresponding to this resource
record.
RR_TYPE Resource record type code
RR_CLASS Resource record class code
TTL The Time To Live of a the resource record's
name.
RDLENGTH Unsigned 16 bit integer that specifies the
number of bytes in the RDATA field.
RDATA RR_CLASS and RR_TYPE dependent field. Contains
the resource information for the NetBIOS name.
RESOURCE RECORD RR_TYPE field definitions:
Symbol Value Description:
A 0x0001 IP address Resource Record (See REDIRECT NAME
QUERY RESPONSE)
NS 0x0002 Name Server Resource Record (See REDIRECT
<span class="grey">NetBIOS Working Group [Page 11]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
NAME QUERY RESPONSE)
NULL 0x000A NULL Resource Record (See WAIT FOR
ACKNOWLEDGEMENT RESPONSE)
NB 0x0020 NetBIOS general Name Service Resource Record
(See NB_FLAGS and NB_ADDRESS, below)
NBSTAT 0x0021 NetBIOS NODE STATUS Resource Record (See NODE
STATUS RESPONSE)
RESOURCE RECORD RR_CLASS field definitions:
Symbol Value Description:
IN 0x0001 Internet class
NB_FLAGS field of the RESOURCE RECORD RDATA field for RR_TYPE of
"NB":
1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| G | ONT | RESERVED |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Symbol Bit(s) Description:
RESERVED 3-15 Reserved for future use. Must be zero (0).
ONT 1,2 Owner Node Type:
00 = B node
01 = P node
10 = M node
11 = Reserved for future use
For registration requests this is the
claimant's type.
For responses this is the actual owner's
type.
G 0 Group Name Flag.
If one (1) then the RR_NAME is a GROUP
NetBIOS name.
If zero (0) then the RR_NAME is a UNIQUE
NetBIOS name.
The NB_ADDRESS field of the RESOURCE RECORD RDATA field for
RR_TYPE of "NB" is the IP address of the name's owner.
<span class="grey">NetBIOS Working Group [Page 12]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.2" href="#section-4.2.2">4.2.2</a>. NAME REGISTRATION REQUEST</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |0| 0x5 |0|0|1|0|0 0|B| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0001 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ QUESTION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Since the RR_NAME is the same name as the QUESTION_NAME, the
RR_NAME representation must use pointers to the QUESTION_NAME
name's labels to guarantee the length of the datagram is less
than the maximum 576 bytes. See section above on name formats
and also page 31 and 32 of <a href="./rfc883">RFC 883</a>, Domain Names - Implementation
and Specification, for a complete description of compressed name
label pointers.
<span class="grey">NetBIOS Working Group [Page 13]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.3" href="#section-4.2.3">4.2.3</a>. NAME OVERWRITE REQUEST & DEMAND</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |0| 0x5 |0|0|0|0|0 0|B| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0001 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ QUESTION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 14]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.4" href="#section-4.2.4">4.2.4</a>. NAME REFRESH REQUEST</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |0| 0x9 |0|0|0|0|0 0|B| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0001 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ QUESTION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 15]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.5" href="#section-4.2.5">4.2.5</a>. POSITIVE NAME REGISTRATION RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x5 |1|0|1|1|0 0|0| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="h4"><a class="selflink" id="section-4.2.6" href="#section-4.2.6">4.2.6</a>. NEGATIVE NAME REGISTRATION RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x5 |1|0|1|1|0 0|0| RCODE |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 16]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-17" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
RCODE field values:
Symbol Value Description:
FMT_ERR 0x1 Format Error. Request was invalidly
formatted.
SRV_ERR 0x2 Server failure. Problem with NBNS, cannot
process name.
IMP_ERR 0x4 Unsupported request error. Allowable only
for challenging NBNS when gets an Update type
registration request.
RFS_ERR 0x5 Refused error. For policy reasons server
will not register this name from this host.
ACT_ERR 0x6 Active error. Name is owned by another node.
CFT_ERR 0x7 Name in conflict error. A UNIQUE name is
owned by more than one node.
<span class="h4"><a class="selflink" id="section-4.2.7" href="#section-4.2.7">4.2.7</a>. END-NODE CHALLENGE REGISTRATION RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x5 |1|0|1|0|0 0|0| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 17]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-18" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.8" href="#section-4.2.8">4.2.8</a>. NAME CONFLICT DEMAND</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x5 |1|0|1|1|0 0|0| 0x7 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x00000000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 |0|ONT|0| 0x000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x00000000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This packet is identical to a NEGATIVE NAME REGISTRATION RESPONSE
with RCODE = CFT_ERR.
<span class="grey">NetBIOS Working Group [Page 18]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-19" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.9" href="#section-4.2.9">4.2.9</a>. NAME RELEASE REQUEST & DEMAND</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |0| 0x6 |0|0|0|0|0 0|B| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0001 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ QUESTION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x00000000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Since the RR_NAME is the same name as the QUESTION_NAME, the
RR_NAME representation must use label string pointers to the
QUESTION_NAME labels to guarantee the length of the datagram is
less than the maximum 576 bytes. This is the same condition as
with the NAME REGISTRATION REQUEST.
<span class="grey">NetBIOS Working Group [Page 19]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-20" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.10" href="#section-4.2.10">4.2.10</a>. POSITIVE NAME RELEASE RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x6 |1|0|0|0|0 0|0| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="h4"><a class="selflink" id="section-4.2.11" href="#section-4.2.11">4.2.11</a>. NEGATIVE NAME RELEASE RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x6 |1|0|0|0|0 0|0| RCODE |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0006 | NB_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 20]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-21" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
RCODE field values:
Symbol Value Description:
FMT_ERR 0x1 Format Error. Request was invalidly
formatted.
SRV_ERR 0x2 Server failure. Problem with NBNS, cannot
process name.
RFS_ERR 0x5 Refused error. For policy reasons server
will not release this name from this host.
ACT_ERR 0x6 Active error. Name is owned by another node.
Only that node may release it. A NetBIOS
Name Server can optionally allow a node to
release a name it does not own. This would
facilitate detection of inactive names for
nodes that went down silently.
<span class="h4"><a class="selflink" id="section-4.2.12" href="#section-4.2.12">4.2.12</a>. NAME QUERY REQUEST</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |0| 0x0 |0|0|1|0|0 0|B| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0001 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ QUESTION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 21]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-22" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.13" href="#section-4.2.13">4.2.13</a>. POSITIVE NAME QUERY RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x0 |1|T|1|?|0 0|0| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RDLENGTH | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| |
/ ADDR_ENTRY ARRAY /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The ADDR_ENTRY ARRAY a sequence of zero or more ADDR_ENTRY
records. Each ADDR_ENTRY record represents an owner of a name.
For group names there may be multiple entries. However, the list
may be incomplete due to packet size limitations. Bit 22, "T",
will be set to indicate truncated data.
Each ADDR_ENTRY has the following format:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_FLAGS | NB_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NB_ADDRESS (continued) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 22]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-23" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.14" href="#section-4.2.14">4.2.14</a>. NEGATIVE NAME QUERY RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x0 |1|0|1|?|0 0|0| RCODE |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NULL (0x000A) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x00000000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
RCODE field values:
Symbol Value Description
FMT_ERR 0x1 Format Error. Request was invalidly
formatted.
SRV_ERR 0x2 Server failure. Problem with NBNS, cannot
process name.
NAM_ERR 0x3 Name Error. The name requested does not
exist.
IMP_ERR 0x4 Unsupported request error. Allowable only
for challenging NBNS when gets an Update type
registration request.
RFS_ERR 0x5 Refused error. For policy reasons server
will not register this name from this host.
<span class="grey">NetBIOS Working Group [Page 23]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-24" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.15" href="#section-4.2.15">4.2.15</a>. REDIRECT NAME QUERY RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x0 |0|0|1|0|0 0|0| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0001 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NS (0x0002) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RDLENGTH | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
/ NSD_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| A (0x0001) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0004 | NSD_IP_ADDR |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NSD_IP_ADDR, continued |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
An end node responding to a NAME QUERY REQUEST always responds
with the AA and RA bits set for both the NEGATIVE and POSITIVE
NAME QUERY RESPONSE packets. An end node never sends a REDIRECT
NAME QUERY RESPONSE packet.
<span class="grey">NetBIOS Working Group [Page 24]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-25" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
When the requestor receives the REDIRECT NAME QUERY RESPONSE it
must reiterate the NAME QUERY REQUEST to the NBNS specified by
the NSD_IP_ADDR field of the A type RESOURCE RECORD in the
ADDITIONAL section of the response packet. This is an optional
packet for the NBNS.
The NSD_NAME and the RR_NAME in the ADDITIONAL section of the
response packet are the same name. Space can be optimized if
label string pointers are used in the RR_NAME which point to the
labels in the NSD_NAME.
The RR_NAME in the AUTHORITY section is the name of the domain
the NBNS called by NSD_NAME has authority over.
<span class="h4"><a class="selflink" id="section-4.2.16" href="#section-4.2.16">4.2.16</a>. WAIT FOR ACKNOWLEDGEMENT (WACK) RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x7 |1|0|0|0|0 0|0| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NULL (0x0020) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TTL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0002 | OPCODE | NM_FLAGS | 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 25]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-26" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
The NAME_TRN_ID of the WACK RESPONSE packet is the same
NAME_TRN_ID of the request that the NBNS is telling the requestor
to wait longer to complete. The RR_NAME is the name from the
request, if any. If no name is available from the request then
it is a null name, single byte of zero.
The TTL field of the ResourceRecord is the new time to wait, in
seconds, for the request to complete. The RDATA field contains
the OPCODE and NM_FLAGS of the request.
A TTL value of 0 means that the NBNS can not estimate the time it
may take to complete a response.
<span class="h4"><a class="selflink" id="section-4.2.17" href="#section-4.2.17">4.2.17</a>. NODE STATUS REQUEST</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |0| 0x0 |0|0|0|0|0 0|B| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0001 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ QUESTION_NAME /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NBSTAT (0x0021) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 26]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-27" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.2.18" href="#section-4.2.18">4.2.18</a>. NODE STATUS RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_TRN_ID |1| 0x0 |1|0|0|0|0 0|0| 0x0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0001 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x0000 | 0x0000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ RR_NAME /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NBSTAT (0x0021) | IN (0x0001) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x00000000 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RDLENGTH | NUM_NAMES | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
+ +
/ NODE_NAME ARRAY /
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
/ STATISTICS /
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The NODE_NAME ARRAY is an array of zero or more NUM_NAMES entries
of NODE_NAME records. Each NODE_NAME entry represents an active
name in the same NetBIOS scope as the requesting name in the
local name table of the responder. RR_NAME is the requesting
name.
<span class="grey">NetBIOS Working Group [Page 27]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-28" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
NODE_NAME Entry:
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+--- ---+
| |
+--- NETBIOS FORMAT NAME ---+
| |
+--- ---+
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAME_FLAGS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The NAME_FLAGS field:
1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| G | ONT |DRG|CNF|ACT|PRM| RESERVED |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
The NAME_FLAGS field is defined as:
Symbol Bit(s) Description:
RESERVED 7-15 Reserved for future use. Must be zero (0).
PRM 6 Permanent Name Flag. If one (1) then entry
is for the permanent node name. Flag is zero
(0) for all other names.
ACT 5 Active Name Flag. All entries have this flag
set to one (1).
CNF 4 Conflict Flag. If one (1) then name on this
node is in conflict.
DRG 3 Deregister Flag. If one (1) then this name
is in the process of being deleted.
ONT 1,2 Owner Node Type:
00 = B node
01 = P node
10 = M node
11 = Reserved for future use
G 0 Group Name Flag.
If one (1) then the name is a GROUP NetBIOS
name.
If zero (0) then it is a UNIQUE NetBIOS name.
<span class="grey">NetBIOS Working Group [Page 28]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-29" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
STATISTICS Field of the NODE STATUS RESPONSE:
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| UNIT_ID (Unique unit ID) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| UNIT_ID,continued | JUMPERS | TEST_RESULT |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| VERSION_NUMBER | PERIOD_OF_STATISTICS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NUMBER_OF_CRCs | NUMBER_ALIGNMENT_ERRORS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NUMBER_OF_COLLISIONS | NUMBER_SEND_ABORTS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NUMBER_GOOD_SENDS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NUMBER_GOOD_RECEIVES |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NUMBER_RETRANSMITS | NUMBER_NO_RESOURCE_CONDITIONS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NUMBER_FREE_COMMAND_BLOCKS | TOTAL_NUMBER_COMMAND_BLOCKS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|MAX_TOTAL_NUMBER_COMMAND_BLOCKS| NUMBER_PENDING_SESSIONS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MAX_NUMBER_PENDING_SESSIONS | MAX_TOTAL_SESSIONS_POSSIBLE |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SESSION_DATA_PACKET_SIZE |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>. SESSION SERVICE PACKETS</span>
<span class="h4"><a class="selflink" id="section-4.3.1" href="#section-4.3.1">4.3.1</a>. GENERAL FORMAT OF SESSION PACKETS</span>
All session service messages are sent over a TCP connection.
All session packets are of the following general structure:
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TYPE | FLAGS | LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ TRAILER (Packet Type Dependent) /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The TYPE, FLAGS, and LENGTH fields are present in every session
packet.
<span class="grey">NetBIOS Working Group [Page 29]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-30" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
The LENGTH field is the number of bytes following the LENGTH
field. In other words, LENGTH is the combined size of the
TRAILER field(s). For example, the POSITIVE SESSION RESPONSE
packet always has a LENGTH field value of zero (0000) while the
RETARGET SESSION RESPONSE always has a LENGTH field value of six
(0006).
One of the bits of the FLAGS field acts as an additional, high-
order bit for the LENGTH field. Thus the cumulative size of the
trailer field(s) may range from 0 to 128K bytes.
Session Packet Types (in hexidecimal):
00 - SESSION MESSAGE
81 - SESSION REQUEST
82 - POSITIVE SESSION RESPONSE
83 - NEGATIVE SESSION RESPONSE
84 - RETARGET SESSION RESPONSE
85 - SESSION KEEP ALIVE
Bit definitions of the FLAGS field:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | E |
+---+---+---+---+---+---+---+---+
Symbol Bit(s) Description
E 7 Length extension, used as an additional,
high-order bit on the LENGTH field.
RESERVED 0-6 Reserved, must be zero (0)
<span class="h4"><a class="selflink" id="section-4.3.2" href="#section-4.3.2">4.3.2</a>. SESSION REQUEST PACKET</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TYPE | FLAGS | LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ CALLED NAME /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ CALLING NAME /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 30]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-31" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.3.3" href="#section-4.3.3">4.3.3</a>. POSITIVE SESSION RESPONSE PACKET</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TYPE | FLAGS | LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="h4"><a class="selflink" id="section-4.3.4" href="#section-4.3.4">4.3.4</a>. NEGATIVE SESSION RESPONSE PACKET</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TYPE | FLAGS | LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ERROR_CODE |
+-+-+-+-+-+-+-+-+
NEGATIVE SESSION RESPONSE packet error code values (in
hexidecimal):
80 - Not listening on called name
81 - Not listening for calling name
82 - Called name not present
83 - Called name present, but insufficient resources
8F - Unspecified error
<span class="h4"><a class="selflink" id="section-4.3.5" href="#section-4.3.5">4.3.5</a>. SESSION RETARGET RESPONSE PACKET</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TYPE | FLAGS | LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RETARGET_IP_ADDRESS |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PORT |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 31]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-32" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-4.3.6" href="#section-4.3.6">4.3.6</a>. SESSION MESSAGE PACKET</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TYPE | FLAGS | LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ /
/ USER_DATA /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="h4"><a class="selflink" id="section-4.3.7" href="#section-4.3.7">4.3.7</a>. SESSION KEEP ALIVE PACKET</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TYPE | FLAGS | LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="h3"><a class="selflink" id="section-4.4" href="#section-4.4">4.4</a>. DATAGRAM SERVICE PACKETS</span>
<span class="h4"><a class="selflink" id="section-4.4.1" href="#section-4.4.1">4.4.1</a>. NetBIOS DATAGRAM HEADER</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MSG_TYPE | FLAGS | DGM_ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_IP |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_PORT | DGM_LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PACKET_OFFSET |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
MSG_TYPE values (in hexidecimal):
10 - DIRECT_UNIQUE DATAGRAM
11 - DIRECT_GROUP DATAGRAM
12 - BROADCAST DATAGRAM
13 - DATAGRAM ERROR
14 - DATAGRAM QUERY REQUEST
15 - DATAGRAM POSITIVE QUERY RESPONSE
16 - DATAGRAM NEGATIVE QUERY RESPONSE
<span class="grey">NetBIOS Working Group [Page 32]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-33" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
Bit definitions of the FLAGS field:
0 1 2 3 4 5 6 7
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 | SNT | F | M |
+---+---+---+---+---+---+---+---+
Symbol Bit(s) Description
M 7 MORE flag, If set then more NetBIOS datagram
fragments follow.
F 6 FIRST packet flag, If set then this is first
(and possibly only) fragment of NetBIOS
datagram
SNT 4,5 Source End-Node type:
00 = B node
01 = P node
10 = M node
11 = NBDD
RESERVED 0-3 Reserved, must be zero (0)
<span class="h4"><a class="selflink" id="section-4.4.2" href="#section-4.4.2">4.4.2</a>. DIRECT_UNIQUE, DIRECT_GROUP, & BROADCAST DATAGRAM</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MSG_TYPE | FLAGS | DGM_ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_IP |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_PORT | DGM_LENGTH |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| PACKET_OFFSET | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| |
/ SOURCE_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ DESTINATION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
/ USER_DATA /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 33]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-34" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
4.4.3. DATAGRAM ERROR PACKET
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MSG_TYPE | FLAGS | DGM_ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_IP |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_PORT | ERROR_CODE |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
ERROR_CODE values (in hexidecimal):
82 - DESTINATION NAME NOT PRESENT
83 - INVALID SOURCE NAME FORMAT
84 - INVALID DESTINATION NAME FORMAT
<span class="h4"><a class="selflink" id="section-4.4.4" href="#section-4.4.4">4.4.4</a>. DATAGRAM QUERY REQUEST</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MSG_TYPE | FLAGS | DGM_ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_IP |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_PORT | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
/ DESTINATION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="h4"><a class="selflink" id="section-4.4.5" href="#section-4.4.5">4.4.5</a>. DATAGRAM POSITIVE AND NEGATIVE QUERY RESPONSE</span>
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MSG_TYPE | FLAGS | DGM_ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_IP |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| SOURCE_PORT | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
/ DESTINATION_NAME /
/ /
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
<span class="grey">NetBIOS Working Group [Page 34]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-35" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. PROTOCOL DESCRIPTIONS</span>
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. NAME SERVICE PROTOCOLS</span>
A REQUEST packet is always sent to the well known UDP port -
NAME_SERVICE_UDP_PORT. The destination address is normally
either the IP broadcast address or the address of the NBNS - the
address of the NBNS server it set up at initialization time. In
rare cases, a request packet will be sent to an end node, e.g. a
NAME QUERY REQUEST sent to "challenge" a node.
A RESPONSE packet is always sent to the source UDP port and
source IP address of the request packet.
A DEMAND packet must always be sent to the well known UDP port -
NAME_SERVICE_UDP_PORT. There is no restriction on the target IP
address.
Terms used in this section:
tid - Transaction ID. This is a value composed from
the requestor's IP address and a unique 16 bit
value generated by the originator of the
transaction.
<span class="h4"><a class="selflink" id="section-5.1.1" href="#section-5.1.1">5.1.1</a>. B-NODE ACTIVITY</span>
<span class="h5"><a class="selflink" id="section-5.1.1.1" href="#section-5.1.1.1">5.1.1.1</a>. B-NODE ADD NAME</span>
PROCEDURE add_name(newname)
/*
* Host initiated processing for a B node
*/
BEGIN
REPEAT
/* build name service packet */
ONT = B_NODE; /* broadcast node */
G = UNIQUE; /* unique name */
TTL = 0;
broadcast NAME REGISTRATION REQUEST packet;
/*
* remote node(s) will send response packet
* if applicable
*/
<span class="grey">NetBIOS Working Group [Page 35]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-36" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
pause(BCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received or
retransmit count has been exceeded
IF no response packet was received THEN
BEGIN /* no response */
/*
* build packet
*/
ONT = B_NODE; /* broadcast node */
G = UNIQUE; /* unique name */
TTL = 0;
/*
* Let other nodes known you have the name
*/
broadcast NAME UPDATE REQUEST packet;
/* name can be added to local name table */
return success;
END /* no response */
ELSE
BEGIN /* got response */
/*
* Match return transaction id
* against tid sent in request
*/
IF NOT response tid = request tid THEN
BEGIN
ignore response packet;
END
ELSE
CASE packet type OF
NEGATIVE NAME REGISTRATION RESPONSE:
return failure; /* name cannot be added */
POSITIVE NAME REGISTRATION RESPONSE:
END-NODE CHALLENGE NAME REGISTRATION RESPONSE:
/*
* B nodes should normally not get this
* response.
*/
ignore packet;
<span class="grey">NetBIOS Working Group [Page 36]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-37" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
END /* case */;
END /* got response */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.1.2" href="#section-5.1.1.2">5.1.1.2</a>. B-NODE ADD_GROUP NAME</span>
PROCEDURE add_group_name(newname)
/*
* Host initiated processing for a B node
*/
BEGIN
/*
* same as for a unique name with the
* exception that the group bit (G) must
* be set in the request packets.
*/
...
G = GROUP;
...
...
/*
* broadcast request ...
*/
END
<span class="h5"><a class="selflink" id="section-5.1.1.3" href="#section-5.1.1.3">5.1.1.3</a>. B-NODE FIND_NAME</span>
PROCEDURE find_name(name)
/*
* Host initiated processing for a B node
*/
BEGIN
REPEAT
/*
* build packet
*/
ONT = B;
TTL = 0;
G = DONT CARE;
broadcast NAME QUERY REQUEST packet;
<span class="grey">NetBIOS Working Group [Page 37]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-38" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
/*
* a node might send response packet
*/
pause(BCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet received OR
max transmit threshold exceeded
IF no response packet received THEN
return failure;
ELSE
IF NOT response tid = request tid THEN
ignore packet;
ELSE
CASE packet type OF
POSITIVE NAME QUERY RESPONSE:
/*
* Start a timer to detect conflict.
*
* Be prepared to detect conflict if
* any more response packets are received.
*
*/
save response as authoritative response;
start_timer(CONFLICT_TIMER);
return success;
NEGATIVE NAME QUERY RESPONSE:
REDIRECT NAME QUERY RESPONSE:
/*
* B Node should normally not get either
* response.
*/
ignore response packet;
END /* case */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.1.4" href="#section-5.1.1.4">5.1.1.4</a>. B NODE NAME RELEASE</span>
PROCEDURE delete_name (name)
BEGIN
REPEAT
/*
* build packet
*/
<span class="grey">NetBIOS Working Group [Page 38]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-39" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
...
/*
* send request
*/
broadcast NAME RELEASE REQUEST packet;
/*
* no response packet expected
*/
pause(BCAST_REQ_RETRY_TIMEOUT);
UNTIL retransmit count has been exceeded
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.1.5" href="#section-5.1.1.5">5.1.1.5</a>. B-NODE INCOMING PACKET PROCESSING</span>
Following processing is done when broadcast or unicast packets
are received at the NAME_SERVICE_UDP_PORT.
PROCEDURE process_incoming_packet(packet)
/*
* Processing initiated by incoming packets for a B node
*/
BEGIN
/*
* Note: response packets are always sent
* to:
* source IP address of request packet
* source UDP port of request packet
*/
CASE packet type OF
NAME REGISTRATION REQUEST (UNIQUE):
IF name exists in local name table THEN
send NEGATIVE NAME REGISTRATION RESPONSE ;
NAME REGISTRATION REQUEST (GROUP):
IF name exists in local name table THEN
BEGIN
IF local entry is a unique name THEN
send NEGATIVE NAME REGISTRATION RESPONSE ;
END
NAME QUERY REQUEST:
IF name exists in local name table THEN
BEGIN
build response packet;
<span class="grey">NetBIOS Working Group [Page 39]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-40" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
send POSITIVE NAME QUERY RESPONSE;
POSITIVE NAME QUERY RESPONSE:
IF name conflict timer is not active THEN
BEGIN
/*
* timer has expired already... ignore this
* packet
*/
return;
END
ELSE /* timer is active */
IF a response for this name has previously been
received THEN
BEGIN /* existing entry */
/*
* we sent out a request packet, and
* have already received (at least)
* one response
*
* Check if conflict exists.
* If so, send out a conflict packet.
*
* Note: detecting conflict does NOT
* affect any existing sessions.
*
*/
/*
* Check for name conflict.
* See "Name Conflict" in Concepts and Methods
*/
check saved authoritative response against
information in this response packet;
IF conflict detected THEN
BEGIN
unicast NAME CONFLICT DEMAND packet;
IF entry exists in cache THEN
BEGIN
remove entry from cache;
END
END
END /* existing entry */
ELSE
BEGIN
/*
* Note: If this was the first response
* to a name query, it would have been
* handled in the
* find_name() procedure.
<span class="grey">NetBIOS Working Group [Page 40]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-41" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
*/
ignore packet;
END
NAME CONFLICT DEMAND:
IF name exists in local name table THEN
BEGIN
mark name as conflict detected;
/*
* a name in the state "conflict detected"
* does not "logically" exist on that node.
* No further session will be accepted on
* that name.
* No datagrams can be sent against that name.
* Such an entry will not be used for
* purposes of processing incoming request
* packets.
* The only valid user NetBIOS operation
* against such a name is DELETE NAME.
*/
END
NAME RELEASE REQUEST:
IF caching is being done THEN
BEGIN
remove entry from cache;
END
NAME UPDATE REQUEST:
IF caching is being done THEN
BEGIN
IF entry exists in cache already,
update cache;
ELSE IF name is "interesting" THEN
BEGIN
add entry to cache;
END
END
NODE STATUS REQUEST:
IF name exists in local name table THEN
BEGIN
/*
* send only those names that are
* in the same scope as the scope
* field in the request packet
*/
send NODE STATUS RESPONSE;
END
END
<span class="grey">NetBIOS Working Group [Page 41]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-42" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h4"><a class="selflink" id="section-5.1.2" href="#section-5.1.2">5.1.2</a>. P-NODE ACTIVITY</span>
All packets sent or received by P nodes are unicast UDP packets.
A P node sends name service requests to the NBNS node that is
specified in the P-node configuration.
<span class="h5"><a class="selflink" id="section-5.1.2.1" href="#section-5.1.2.1">5.1.2.1</a>. P-NODE ADD_NAME</span>
PROCEDURE add_name(newname)
/*
* Host initiated processing for a P node
*/
BEGIN
REPEAT
/*
* build packet
*/
ONT = P;
G = UNIQUE;
...
/*
* send request
*/
unicast NAME REGISTRATION REQUEST packet;
/*
* NBNS will send response packet
*/
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received OR
retransmit count has been exceeded
IF no response packet was received THEN
BEGIN /* no response */
/*
* NBNS is down. Cannot claim name.
*/
return failure; /* name cannot be claimed */
END /* no response */
ELSE
<span class="grey">NetBIOS Working Group [Page 42]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-43" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
BEGIN /* response */
IF NOT response tid = request tid THEN
BEGIN
/* Packet may belong to another transaction */
ignore response packet;
END
ELSE
CASE packet type OF
POSITIVE NAME REGISTRATION RESPONSE:
/*
* name can be added
*/
adjust refresh timeout value, TTL, for this name;
return success; /* name can be added */
NEGATIVE NAME REGISTRATION RESPONSE:
return failure; /* name cannot be added */
END-NODE CHALLENGE REGISTRATION REQUEST:
BEGIN /* end node challenge */
/*
* The response packet has in it the
* address of the presumed owner of the
* name. Challenge that owner.
* If owner either does not
* respond or indicates that he no longer
* owns the name, claim the name.
* Otherwise, the name cannot be claimed.
*
*/
REPEAT
/*
* build packet
*/
...
unicast NAME QUERY REQUEST packet to the
address contained in the END NODE
CHALLENGE RESPONSE packet;
/*
* remote node may send response packet
*/
pause(UCAST_REQ_RETRY_TIMEOUT);
<span class="grey">NetBIOS Working Group [Page 43]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-44" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
UNTIL response packet is received or
retransmit count has been exceeded
IF no response packet is received OR
NEGATIVE NAME QUERY RESPONSE packet
received THEN
BEGIN /* update */
/*
* name can be claimed
*/
REPEAT
/*
* build packet
*/
...
unicast NAME UPDATE REQUEST to NBNS;
/*
* NBNS node will send response packet
*/
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received or
retransmit count has been exceeded
IF no response packet received THEN
BEGIN /* no response */
/*
* name could not be claimed
*/
return failure;
END /* no response */
ELSE
CASE packet type OF
POSITIVE NAME REGISTRATION RESPONSE:
/*
* add name
*/
return success;
NEGATIVE NAME REGISTRATION RESPONSE:
/*
* you lose ...
*/
<span class="grey">NetBIOS Working Group [Page 44]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-45" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
return failure;
END /* case */
END /* update */
ELSE
/*
* received a positive response to the "challenge"
* Remote node still has name
*/
return failure;
END /* end node challenge */
END /* response */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.2.2" href="#section-5.1.2.2">5.1.2.2</a>. P-NODE ADD GROUP NAME</span>
PROCEDURE add_group_name(newname)
/*
* Host initiated processing for a P node
*/
BEGIN
/*
* same as for a unique name, except that the
* request packet must indicate that a
* group name claim is being made.
*/
...
G = GROUP;
...
/*
* send packet
*/
...
END
5.1.2.3. P-NODE FIND NAME
PROCEDURE find_name(name)
/*
* Host initiated processing for a P node
*/
BEGIN
<span class="grey">NetBIOS Working Group [Page 45]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-46" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
REPEAT
/*
* build packet
*/
ONT = P;
G = DONT CARE;
unicast NAME QUERY REQUEST packet;
/*
* a NBNS node might send response packet
*/
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet received OR
max transmit threshold exceeded
IF no response packet received THEN
return failure;
ELSE
IF NOT response tid = request tid THEN
ignore packet;
ELSE
CASE packet type OF
POSITIVE NAME QUERY RESPONSE:
return success;
REDIRECT NAME QUERY RESPONSE:
/*
* NBNS node wants this end node
* to use some other NBNS node
* to resolve the query.
*/
repeat query with NBNS address
in the response packet;
NEGATIVE NAME QUERY RESPONSE:
return failure;
END /* case */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.2.4" href="#section-5.1.2.4">5.1.2.4</a>. P-NODE DELETE_NAME</span>
PROCEDURE delete_name (name)
<span class="grey">NetBIOS Working Group [Page 46]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-47" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
/*
* Host initiated processing for a P node
*/
BEGIN
REPEAT
/*
* build packet
*/
...
/*
* send request
*/
unicast NAME RELEASE REQUEST packet;
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL retransmit count has been exceeded
or response been received
IF response has been received THEN
CASE packet type OF
POSITIVE NAME RELEASE RESPONSE:
return success;
NEGATIVE NAME RELEASE RESPONSE:
/*
* NBNS does want node to delete this
* name !!!
*/
return failure;
END /* case */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.2.5" href="#section-5.1.2.5">5.1.2.5</a>. P-NODE INCOMING PACKET PROCESSING</span>
Processing initiated by reception of packets at a P node
PROCEDURE process_incoming_packet(packet)
/*
* Processing initiated by incoming packets at a P node
*/
BEGIN
<span class="grey">NetBIOS Working Group [Page 47]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-48" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
/*
* always ignore UDP broadcast packets
*/
IF packet was sent as a broadcast THEN
BEGIN
ignore packet;
return;
END
CASE packet type of
NAME CONFLICT DEMAND:
IF name exists in local name table THEN
mark name as in conflict;
return;
NAME QUERY REQUEST:
IF name exists in local name table THEN
BEGIN /* name exists */
/*
* build packet
*/
...
/*
* send response to the IP address and port
* number from which the request was received.
*/
send POSITIVE NAME QUERY RESPONSE ;
return;
END /* exists */
ELSE
BEGIN /* does not exist */
/*
* send response to the requestor
*/
send NEGATIVE NAME QUERY RESPONSE ;
return;
END /* does not exist */
NODE STATUS REQUEST:
/*
* Name of "*" may be used for force node to
* divulge status for administrative purposes
*/
IF name in local name table OR name = "*" THEN
BEGIN
/*
<span class="grey">NetBIOS Working Group [Page 48]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-49" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
* Build response packet and
* send to requestor node
* Send only those names that are
* in the same scope as the scope
* in the request packet.
*/
send NODE STATUS RESPONSE;
END
NAME RELEASE REQUEST:
/*
* This will be received if the NBNS wants to flush the
* name from the local name table, or from the local
* cache.
*/
IF name exists in the local name table THEN
BEGIN
delete name from local name table;
inform user that name has been deleted;
END
ELSE
IF name has been cached locally THEN
BEGIN
remove entry from cache:
END
END /* case */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.2.6" href="#section-5.1.2.6">5.1.2.6</a>. P-NODE TIMER INITIATED PROCESSING</span>
Processing initiated by timer expiration.
PROCEDURE timer_expired()
/*
* Processing initiated by the expiration of a timer on a P node
*/
BEGIN
/*
* Send a NAME REFRESH REQUEST for each name which the
* TTL which has expired.
*/
REPEAT
build NAME REFRESH REQUEST packet;
REPEAT
send packet to NBNS;
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
<span class="grey">NetBIOS Working Group [Page 49]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-50" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received or
retransmit count has been exceeded
CASE packet type OF
POSITIVE NAME REGISTRATION RESPONSE:
/* successfully refreshed */
reset TTL timer for this name;
NEGATIVE NAME REGISTRATION RESPONSE:
/*
* refused, can't keep name
* assume in conflict
*/
mark name as in conflict;
END /* case */
UNTIL request sent for all names for which TTL
has expired
END /* procedure */
<span class="h4"><a class="selflink" id="section-5.1.3" href="#section-5.1.3">5.1.3</a>. M-NODE ACTIVITY</span>
M nodes behavior is similar to that of P nodes with the addition
of some B node-like broadcast actions. M node name service
proceeds in two steps:
1.Use broadcast UDP based name service. Depending on the
operation, goto step 2.
2.Use directed UDP name service.
The following code for M nodes is exactly the same as for a P
node, with the exception that broadcast operations are done
before P type operation is attempted.
5.1.3.1. M-NODE ADD NAME
PROCEDURE add_name(newname)
/*
* Host initiated processing for a M node
*/
BEGIN
/*
* check if name exists on the
* broadcast area
*/
<span class="grey">NetBIOS Working Group [Page 50]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-51" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
REPEAT
/* build packet */
....
broadcast NAME REGISTRATION REQUEST packet;
pause(BCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received or
retransmit count has been exceeded
IF valid response received THEN
BEGIN
/* cannot claim name */
return failure;
END
/*
* No objections received within the
* broadcast area.
* Send request to name server.
*/
REPEAT
/*
* build packet
*/
ONT = M;
...
unicast NAME REGISTRATION REQUEST packet;
/*
* remote NBNS will send response packet
*/
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received or
retransmit count has been exceeded
IF no response packet was received THEN
BEGIN /* no response */
/*
* NBNS is down. Cannot claim name.
*/
<span class="grey">NetBIOS Working Group [Page 51]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-52" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
return failure; /* name cannot be claimed */
END /* no response */
ELSE
BEGIN /* response */
IF NOT response tid = request tid THEN
BEGIN
ignore response packet;
END
ELSE
CASE packet type OF
POSITIVE NAME REGISTRATION RESPONSE:
/*
* name can be added
*/
adjust refresh timeout value, TTL;
return success; /* name can be added */
NEGATIVE NAME REGISTRATION RESPONSE:
return failure; /* name cannot be added */
END-NODE CHALLENGE REGISTRATION REQUEST:
BEGIN /* end node challenge */
/*
* The response packet has in it the
* address of the presumed owner of the
* name. Challenge that owner.
* If owner either does not
* respond or indicates that he no longer
* owns the name, claim the name.
* Otherwise, the name cannot be claimed.
*
*/
REPEAT
/*
* build packet
*/
...
/*
* send packet to address contained in the
* response packet
*/
unicast NAME QUERY REQUEST packet;
/*
* remote node may send response packet
<span class="grey">NetBIOS Working Group [Page 52]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-53" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
*/
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received or
retransmit count has been exceeded
IF no response packet is received THEN
BEGIN /* no response */
/*
* name can be claimed
*/
REPEAT
/*
* build packet
*/
...
unicast NAME UPDATE REQUEST to NBNS;
/*
* NBNS node will send response packet
*/
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received or
retransmit count has been exceeded
IF no response packet received THEN
BEGIN /* no response */
/*
* name could not be claimed
*/
return failure;
END /* no response */
ELSE
CASE packet type OF
POSITIVE NAME REGISTRATION RESPONSE:
/*
* add name
*/
return success;
NEGATIVE NAME REGISTRATION RESPONSE:
<span class="grey">NetBIOS Working Group [Page 53]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-54" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
/*
* you lose ...
*/
return failure;
END /* case */
END /* no response */
ELSE
IF NOT response tid = request tid THEN
BEGIN
ignore response packet;
END
/*
* received a response to the "challenge"
* packet
*/
CASE packet type OF
POSITIVE NAME QUERY:
/*
* remote node still has name.
*/
return failure;
NEGATIVE NAME QUERY:
/*
* remote node no longer has name
*/
return success;
END /* case */
END /* end node challenge */
END /* case */
END /* response */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.3.2" href="#section-5.1.3.2">5.1.3.2</a>. M-NODE ADD GROUP NAME</span>
PROCEDURE add_group_name(newname)
/*
* Host initiated processing for a P node
*/
BEGIN
/*
* same as for a unique name, except that the
* request packet must indicate that a
<span class="grey">NetBIOS Working Group [Page 54]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-55" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
* group name claim is being made.
*/
...
G = GROUP;
...
/*
* send packet
*/
...
END
<span class="h5"><a class="selflink" id="section-5.1.3.3" href="#section-5.1.3.3">5.1.3.3</a>. M-NODE FIND NAME</span>
PROCEDURE find_name(name)
/*
* Host initiated processing for a M node
*/
BEGIN
/*
* check if any node on the broadcast
* area has the name
*/
REPEAT
/* build packet */
...
broadcast NAME QUERY REQUEST packet;
pause(BCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet received OR
max transmit threshold exceeded
IF valid response received THEN
BEGIN
save response as authoritative response;
start_timer(CONFLICT_TIMER);
return success;
END
/*
* no valid response on the b'cast segment.
* Try the name server.
*/
REPEAT
<span class="grey">NetBIOS Working Group [Page 55]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-56" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
/*
* build packet
*/
ONT = M;
G = DONT CARE;
unicast NAME QUERY REQUEST packet to NBNS;
/*
* a NBNS node might send response packet
*/
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet received OR
max transmit threshold exceeded
IF no response packet received THEN
return failure;
ELSE
IF NOT response tid = request tid THEN
ignore packet;
ELSE
CASE packet type OF
POSITIVE NAME QUERY RESPONSE:
return success;
REDIRECT NAME QUERY RESPONSE:
/*
* NBNS node wants this end node
* to use some other NBNS node
* to resolve the query.
*/
repeat query with NBNS address
in the response packet;
NEGATIVE NAME QUERY RESPONSE:
return failure;
END /* case */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.3.4" href="#section-5.1.3.4">5.1.3.4</a>. M-NODE DELETE NAME</span>
PROCEDURE delete_name (name)
/*
<span class="grey">NetBIOS Working Group [Page 56]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-57" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
* Host initiated processing for a P node
*/
BEGIN
/*
* First, delete name on NBNS
*/
REPEAT
/*
* build packet
*/
...
/*
* send request
*/
unicast NAME RELEASE REQUEST packet to NBNS;
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL retransmit count has been exceeded
or response been received
IF response has been received THEN
CASE packet type OF
POSITIVE NAME RELEASE RESPONSE:
/*
* Deletion of name on b'cast segment is deferred
* until after NBNS has deleted the name
*/
REPEAT
/* build packet */
...
broadcast NAME RELEASE REQUEST;
pause(BCAST_REQ_RETRY_TIMEOUT);
UNTIL rexmt threshold exceeded
return success;
NEGATIVE NAME RELEASE RESPONSE:
/*
* NBNS does want node to delete this
* name
*/
<span class="grey">NetBIOS Working Group [Page 57]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-58" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
return failure;
END /* case */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.3.5" href="#section-5.1.3.5">5.1.3.5</a>. M-NODE INCOMING PACKET PROCESSING</span>
Processing initiated by reception of packets at a M node
PROCEDURE process_incoming_packet(packet)
/*
* Processing initiated by incoming packets at a M node
*/
BEGIN
CASE packet type of
NAME CONFLICT DEMAND:
IF name exists in local name table THEN
mark name as in conflict;
return;
NAME QUERY REQUEST:
IF name exists in local name table THEN
BEGIN /* name exists */
/*
* build packet
*/
...
/*
* send response to the IP address and port
* number from which the request was received.
*/
send POSITIVE NAME QUERY RESPONSE ;
return;
END /* exists */
ELSE
BEGIN /* does not exist */
/*
* send response to the requestor
*/
IF request NOT broadcast THEN
/*
* Don't send negative responses to
* queries sent by B nodes
*/
<span class="grey">NetBIOS Working Group [Page 58]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-59" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
send NEGATIVE NAME QUERY RESPONSE ;
return;
END /* does not exist */
NODE STATUS REQUEST:
BEGIN
/*
* Name of "*" may be used for force node to
* divulge status for administrative purposes
*/
IF name in local name table OR name = "*" THEN
/*
* Build response packet and
* send to requestor node
* Send only those names that are
* in the same scope as the scope
* in the request packet.
*/
send NODE STATUS RESPONSE;
END
NAME RELEASE REQUEST:
/*
* This will be received if the NBNS wants to flush the
* name from the local name table, or from the local
* cache.
*/
IF name exists in the local name table THEN
BEGIN
delete name from local name table;
inform user that name has been deleted;
END
ELSE
IF name has been cached locally THEN
BEGIN
remove entry from cache:
END
NAME REGISTRATION REQUEST (UNIQUE):
IF name exists in local name table THEN
send NEGATIVE NAME REGISTRATION RESPONSE ;
NAME REGISTRATION REQUEST (GROUP):
IF name exists in local name table THEN
BEGIN
IF local entry is a unique name THEN
send NEGATIVE NAME REGISTRATION RESPONSE ;
END
END /* case */
END /* procedure */
<span class="grey">NetBIOS Working Group [Page 59]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-60" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h5"><a class="selflink" id="section-5.1.3.6" href="#section-5.1.3.6">5.1.3.6</a>. M-NODE TIMER INITIATED PROCESSING</span>
Processing initiated by timer expiration:
PROCEDURE timer_expired()
/*
* Processing initiated by the expiration of a timer on a M node
*/
BEGIN
/*
* Send a NAME REFRESH REQUEST for each name which the
* TTL which has expired.
*/
REPEAT
build NAME REFRESH REQUEST packet;
REPEAT
send packet to NBNS;
IF receive a WACK RESPONSE THEN
pause(time from TTL field of response);
ELSE
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response packet is received or
retransmit count has been exceeded
CASE packet type OF
POSITIVE NAME REGISTRATION RESPONSE:
/* successfully refreshed */
reset TTL timer for this name;
NEGATIVE NAME REGISTRATION RESPONSE:
/*
* refused, can't keep name
* assume in conflict
*/
mark name as in conflict;
END /* case */
UNTIL request sent for all names for which TTL
has expired
END /* procedure */
<span class="h4"><a class="selflink" id="section-5.1.4" href="#section-5.1.4">5.1.4</a>. NBNS ACTIVITY</span>
A NBNS node will receive directed packets from P and M nodes.
Reply packets are always sent as directed packets to the source
IP address and UDP port number. Received broadcast packets must
be ignored.
<span class="grey">NetBIOS Working Group [Page 60]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-61" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h5"><a class="selflink" id="section-5.1.4.1" href="#section-5.1.4.1">5.1.4.1</a>. NBNS INCOMING PACKET PROCESSING</span>
PROCEDURE process_incoming_packet(packet)
/*
* Incoming packet processing on a NS node
*/
BEGIN
IF packet was sent as a broadcast THEN
BEGIN
discard packet;
return;
END
CASE packet type of
NAME REGISTRATION REQUEST (UNIQUE):
IF unique name exists in data base THEN
BEGIN /* unique name exists */
/*
* NBNS node may be a "passive"
* server in that it expects the
* end node to do the challenge
* server. Such a NBNS node is
* called a "non-secure" server.
* A "secure" server will do the
* challenging before it sends
* back a response packet.
*/
IF non-secure THEN
BEGIN
/*
* build response packet
*/
...
/*
* let end node do the challenge
*/
send END-NODE CHALLENGE NAME REGISTRATION
RESPONSE;
return;
END
ELSE
/*
* secure server - do the name
* challenge operation
*/
<span class="grey">NetBIOS Working Group [Page 61]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-62" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
REPEAT
send NAME QUERY REQUEST;
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response has been received or
retransmit count has been exceeded
IF no response was received THEN
BEGIN
/* node down */
update data base - remove entry;
update data base - add new entry;
send POSITIVE NAME REGISTRATION RESPONSE;
return;
END
ELSE
BEGIN /* challenged node replied */
/*
* challenged node replied with
* a response packet
*/
CASE packet type
POSITIVE NAME QUERY RESPONSE:
/*
* name still owned by the
* challenged node
*
* build packet and send response
*/
...
/*
* Note: The NBNS will need to
* keep track (based on transaction id) of
* the IP address and port number
* of the original requestor.
*/
send NEGATIVE NAME REGISTRATION RESPONSE;
return;
NEGATIVE NAME QUERY RESPONSE:
update data base - remove entry;
update data base - add new entry;
/*
* build response packet and send
<span class="grey">NetBIOS Working Group [Page 62]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-63" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
* response
*/
send POSITIVE NAME REGISTRATION RESPONSE;
return;
END /* case */
END /* challenged node replied */
END /* unique name exists in data base */
ELSE
IF group name exists in data base THEN
BEGIN /* group names exists */
/*
* Members of a group name are NOT
* challenged.
* Make the assumption that
* at least some of the group members
* are still alive.
* Refresh mechanism will
* allow the NBNS to detect when all
* members of a group no longer use that
* name
*/
send NEGATIVE NAME REGISTRATION RESPONSE;
END /* group name exists */
ELSE
BEGIN /* name does not exist */
/*
* Name does not exist in data base
*
* This code applies to both non-secure
* and secure server.
*/
update data base - add new entry;
send POSITIVE NAME REGISTRATION RESPONSE;
return;
END
NAME QUERY REQUEST:
IF name exists in data base THEN
BEGIN
/*
* build response packet and send to
* requestor
*/
...
send POSITIVE NAME QUERY RESPONSE;
return;
<span class="grey">NetBIOS Working Group [Page 63]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-64" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
ELSE
BEGIN
/*
* build response packet and send to
* requestor
*/
...
send NEGATIVE NAME QUERY RESPONSE;
return;
END
NAME REGISTRATION REQUEST (GROUP):
IF name exists in data base THEN
BEGIN
IF local entry is a unique name THEN
BEGIN /* local is unique */
IF non-secure THEN
BEGIN
send END-NODE CHALLENGE NAME
REGISTRATION RESPONSE;
return;
END
REPEAT
send NAME QUERY REQUEST;
pause(UCAST_REQ_RETRY_TIMEOUT);
UNTIL response received or
retransmit count exceeded
IF no response received or
NEGATIVE NAME QUERY RESPONSE
received THEN
BEGIN
update data base - remove entry;
update data base - add new entry;
send POSITIVE NAME REGISTRATION RESPONSE;
return;
END
ELSE
BEGIN
/*
* name still being held
* by challenged node
*/
send NEGATIVE NAME REGISTRATION RESPONSE;
END
END /* local is unique */
ELSE
BEGIN /* local is group */
<span class="grey">NetBIOS Working Group [Page 64]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-65" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
/*
* existing entry is a group name
*/
update data base - remove entry;
update data base - add new entry;
send POSITIVE NAME REGISTRATION RESPONSE;
return;
END /* local is group */
END /* names exists */
ELSE
BEGIN /* does not exist */
/* name does not exist in data base */
update data base - add new entry;
send POSITIVE NAME REGISTRATION RESPONSE;
return;
END /* does not exist */
NAME RELEASE REQUEST:
/*
* secure server may choose to disallow
* a node from deleting a name
*/
update data base - remove entry;
send POSITIVE NAME RELEASE RESPONSE;
return;
NAME UPDATE REQUEST:
/*
* End-node completed a successful challenge,
* no update database
*/
IF secure server THEN
send NEGATIVE NAME REGISTRATION RESPONSE;
ELSE
BEGIN /* new entry */
IF entry already exists THEN
update data base - remove entry;
update data base - add new entry;
send POSITIVE NAME REGISTRATION RESPONSE;
start_timer(TTL);
END
NAME REFRESH REQUEST:
check for consistency;
<span class="grey">NetBIOS Working Group [Page 65]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-66" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
IF node not allowed to have name THEN
BEGIN
/*
* tell end node that it can't have name
*/
send NEGATIVE NAME REGISTRATION RESPONSE;
END
ELSE
BEGIN
/*
* send confirmation response to the
* end node.
*/
send POSITIVE NAME REGISTRATION;
start_timer(TTL);
END
return;
END /* case */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.1.4.2" href="#section-5.1.4.2">5.1.4.2</a>. NBNS TIMER INITIATED PROCESSING</span>
A NS node uses timers to flush out entries from the data base.
Each entry in the data base is removed when its timer expires.
This time value is a multiple of the refresh TTL established when
the name was registered.
PROCEDURE timer_expired()
/*
* processing initiated by expiration of TTL for a given name
*/
BEGIN
/*
* NBNS can (optionally) ensure
* that the node is actually down
* by sending a NODE STATUS REQUEST.
* If such a request is sent, and
* no response is received, it can
* be assumed that the node is down.
*/
remove entry from data base;
END
<span class="grey">NetBIOS Working Group [Page 66]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-67" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. SESSION SERVICE PROTOCOLS</span>
The following are variables and should be configurable by the
NetBIOS user. The default values of these variables is found in
"Defined Constants and Variables" in the Detailed
Specification.):
- SSN_RETRY_COUNT - The maximum number TCP connection attempts
allowable per a single NetBIOS call request.
- SSN_CLOSE_TIMEOUT is the time period to wait when closing the
NetBIOS session before killing the TCP connection if session
sends are outstanding.
The following are Defined Constants for the NetBIOS Session
Service. (See "Defined Constants and Variables" in the Detailed
Specification for the value of these constants):
- SSN_SRVC_TCP_PORT - is the globally well-known TCP port
allocated for the NetBIOS Session Service. The service accepts
TCP connections on this port to establish NetBIOS Sessions.
The TCP connection established to this port by the caller is
initially used for the exchange of NetBIOS control information.
The actual NetBIOS data connection may also pass through this
port or, through the retargetting facility, through another
port.
<span class="h4"><a class="selflink" id="section-5.2.1" href="#section-5.2.1">5.2.1</a>. SESSION ESTABLISHMENT PROTOCOLS</span>
<span class="h5"><a class="selflink" id="section-5.2.1.1" href="#section-5.2.1.1">5.2.1.1</a>. USER REQUEST PROCESSING</span>
PROCEDURE listen(listening name, caller name)
/*
* User initiated processing for B, P and M nodes
*
* This procedure assumes that an incoming session will be
* retargetted here by a session server.
*/
BEGIN
Do TCP listen; /* Returns TCP port used */
Register listen with Session Service, give names and
TCP port;
Wait for TCP connection to open; /* Incoming call */
Read SESSION REQUEST packet from connection
Process session request (see section on
processing initiated by the reception of session
service packets);
<span class="grey">NetBIOS Working Group [Page 67]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-68" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
Inform Session Service that NetBIOS listen is complete;
IF session established THEN
return success and session information to user;
ELSE
return failure;
END /* procedure */
PROCEDURE call(calling name, called name)
/*
* user initiated processing for B, P and M nodes
*/
/*
* This algorithm assumes that the called name is a unique name.
* If the called name is a group name, the call() procedure
* needs to cycle through the members of the group
* until either (retry_count == SSN_RETRY_COUNT) or
* the list has been exhausted.
*/
BEGIN
retry_count = 0;
retarget = FALSE; /* TRUE: caller is being retargetted */
name_query = TRUE; /* TRUE: caller must begin again with */
/* name query. */
REPEAT
IF name_query THEN
BEGIN
do name discovery, returns IP address;
TCP port = SSN_SRVC_TCP_PORT;
IF name discovery fails THEN
return failure;
ELSE
name_query = FALSE;
END
/*
* now have IP address and TCP port of
* remote party.
*/
establish TCP connection with remote party, use an
ephemeral port as source TCP port;
IF connection refused THEN
BEGIN
IF retarget THEN
BEGIN
/* retry */
retarget = FALSE;
<span class="grey">NetBIOS Working Group [Page 68]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-69" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
use original IP address and TCP port;
goto LOOP;
END
/* retry for just missed TCP listen */
pause(SESSION_RETRY_TIMER);
establish TCP connection, again use ephemeral
port as source TCP port;
IF connection refused OR
connection timed out THEN
return failure;
END
ELSE
IF connection timed out THEN
BEGIN
IF retarget THEN
BEGIN
/* retry */
retarget = FALSE;
use original IP address and TCP port;
goto LOOP;
END
ELSE
BEGIN
/*
* incorrect name discovery was done,
* try again
*/
inform name discovery process of
possible error;
name_query = TRUE;
goto LOOP;
END
END
/*
* TCP connection has been established
*/
wait for session response packet;
CASE packet type OF
POSITIVE SESSION RESPONSE:
return success and session established
information;
NEGATIVE SESSION RESPONSE:
BEGIN
<span class="grey">NetBIOS Working Group [Page 69]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-70" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
CASE error OF
NOT LISTENING ON CALLED NAME:
NOT LISTENING FOR CALLING NAME:
BEGIN
kill TCP connection;
return failure;
END
CALLED NAME NOT PRESENT:
BEGIN
/*
* called name does not exist on
* remote node
*/
inform name discovery procedure
of possible error;
IF this is a P or M node THEN
BEGIN
/*
* Inform NetBIOS Name Server
* it has returned incorrect
* information.
*/
send NAME RELEASE REQUEST for called
name and IP address to
NetBIOS Name Server;
END
/* retry from beginning */
retarget = FALSE;
name_query = TRUE;
goto LOOP;
END /* called name not present */
END /* case */
END /* negative response */
RETARGET SESSION RESPONSE:
BEGIN
close TCP connection;
extract IP address and TCP port from
response;
retarget = TRUE;
END /* retarget response */
END /* case */
LOOP: retry_count = retry_count + 1;
UNTIL (retry_count > SSN_RETRY_COUNT);
return failure;
END /* procedure */
<span class="grey">NetBIOS Working Group [Page 70]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-71" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h5"><a class="selflink" id="section-5.2.1.2" href="#section-5.2.1.2">5.2.1.2</a>. RECEIVED PACKET PROCESSING</span>
These are packets received on a TCP connection before a session
has been established. The listen routines attached to a NetBIOS
user process need not implement the RETARGET response section.
The user process version, separate from a shared Session Service,
need only accept (POSITIVE SESSION RESPONSE) or reject (NEGATIVE
SESSION RESPONSE) a session request.
PROCEDURE session_packet(packet)
/*
* processing initiated by receipt of a session service
* packet for a session in the session establishment phase.
* Assumes the TCP connection has been accepted.
*/
BEGIN
CASE packet type
SESSION REQUEST:
BEGIN
IF called name does not exist on node THEN
BEGIN
send NEGATIVE SESSION RESPONSE with CALLED
NAME NOT PRESENT error code;
close TCP connection;
END
Search for a listen with CALLING NAME for CALLED
NAME;
IF matching listen is found THEN
BEGIN
IF port of listener process is port TCP
connection is on THEN
BEGIN
send POSITIVE SESSION RESPONSE;
Hand off connection to client process
and/or inform user session is
established;
END
ELSE
BEGIN
send RETARGET SESSION RESPONSE with
listener's IP address and
TCP port;
close TCP connection;
END
END
ELSE
BEGIN
/* no matching listen pending */
<span class="grey">NetBIOS Working Group [Page 71]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-72" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
send NEGATIVE SESSION RESPONSE with either
NOT LISTENING ON CALLED NAME or NOT
LISTENING FOR CALLING NAME error
code;
close TCP connection;
END
END /* session request */
END /* case */
END /* procedure */
<span class="h4"><a class="selflink" id="section-5.2.2" href="#section-5.2.2">5.2.2</a>. SESSION DATA TRANSFER PROTOCOLS</span>
<span class="h5"><a class="selflink" id="section-5.2.2.1" href="#section-5.2.2.1">5.2.2.1</a>. USER REQUEST PROCESSING</span>
PROCEDURE send_message(user_message)
BEGIN
build SESSION MESSAGE header;
send SESSION MESSAGE header;
send user_message;
reset and restart keep-alive timer;
IF send fails THEN
BEGIN
/*
* TCP connection has failed */
*/
close NetBIOS session;
inform user that session is lost;
return failure;
END
ELSE
return success;
END
5.2.2.2. RECEIVED PACKET PROCESSING
These are packets received after a session has been established.
PROCEDURE session_packet(packet)
/*
* processing initiated by receipt of a session service
* packet for a session in the data transfer phase.
*/
BEGIN
CASE packet type OF
SESSION MESSAGE:
BEGIN
process message header;
read in user data;
reset and restart keep-alive timer;
deliver data to user;
<span class="grey">NetBIOS Working Group [Page 72]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-73" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
END /* session message */
SESSION KEEP ALIVE:
discard packet;
END /* case */
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.2.2.3" href="#section-5.2.2.3">5.2.2.3</a>. PROCESSING INITIATED BY TIMER</span>
PROCEDURE session_ka_timer()
/*
* processing initiated when session keep alive timer expires
*/
BEGIN
send SESSION KEEP ALIVE, if configured;
IF send fails THEN
BEGIN
/* remote node, or path to it, is down */
abort TCP connection;
close NetBIOS session;
inform user that session is lost;
return;
END
END /* procedure */
<span class="h4"><a class="selflink" id="section-5.2.3" href="#section-5.2.3">5.2.3</a>. SESSION TERMINATION PROTOCOLS</span>
<span class="h5"><a class="selflink" id="section-5.2.3.1" href="#section-5.2.3.1">5.2.3.1</a>. USER REQUEST PROCESSING</span>
PROCEDURE close_session()
/* initiated by a user request to close a session */
BEGIN
close gracefully the TCP connection;
WAIT for the connection to close or SSN_CLOSE_TIMEOUT
to expire;
IF time out expired THEN
abort TCP connection;
END /* procedure */
<span class="h5"><a class="selflink" id="section-5.2.3.2" href="#section-5.2.3.2">5.2.3.2</a>. RECEPTION INDICATION PROCESSING</span>
PROCEDURE close_indication()
/*
* initiated by a TCP indication of a close request from
* the remote connection partner.
<span class="grey">NetBIOS Working Group [Page 73]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-74" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
*/
BEGIN
close gracefully TCP connection;
close NetBIOS session;
inform user session closed by remote partner;
END /* procedure */
<span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. NetBIOS DATAGRAM SERVICE PROTOCOLS</span>
The following are GLOBAL variables and should be NetBIOS user
configurable:
- SCOPE_ID: the non-leaf section of the domain name preceded by a
'.' which represents the domain of the NetBIOS scope for the
NetBIOS name. The following protocol description only supports
single scope operation.
- MAX_DATAGRAM_LENGTH: the maximum length of an IP datagram. The
minimal maximum length defined in for IP is 576 bytes. This
value is used when determining whether to fragment a NetBIOS
datagram. Implementations are expected to be capable of
receiving unfragmented NetBIOS datagrams up to their maximum
size.
- BROADCAST_ADDRESS: the IP address B-nodes use to send datagrams
with group name destinations and broadcast datagrams. The
default is the IP broadcast address for a single IP network.
The following are Defined Constants for the NetBIOS Datagram
Service:
- DGM_SRVC_UDP_PORT: the globally well-known UDP port allocated
where the NetBIOS Datagram Service receives UDP packets. See
<a href="#section-6">section 6</a>, "Defined Constants", for its value.
<span class="h4"><a class="selflink" id="section-5.3.1" href="#section-5.3.1">5.3.1</a>. B NODE TRANSMISSION OF NetBIOS DATAGRAMS</span>
PROCEDURE send_datagram(data, source, destination, broadcast)
/*
* user initiated processing on B node
*/
BEGIN
group = FALSE;
do name discovery on destination name, returns name type and
IP address;
<span class="grey">NetBIOS Working Group [Page 74]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-75" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
IF name type is group name THEN
BEGIN
group = TRUE;
END
/*
* build datagram service UDP packet;
*/
convert source and destination NetBIOS names into
half-ASCII, biased encoded name;
SOURCE_NAME = cat(source, SCOPE_ID);
SOURCE_IP = this nodes IP address;
SOURCE_PORT = DGM_SRVC_UDP_PORT;
IF NetBIOS broadcast THEN
BEGIN
DESTINATION_NAME = cat("*", SCOPE_ID)
END
ELSE
BEGIN
DESTINATION_NAME = cat(destination, SCOPE_ID)
END
MSG_TYPE = select_one_from_set
{BROADCAST, DIRECT_UNIQUE, DIRECT_GROUP}
DGM_ID = next transaction id for Datagrams;
DGM_LENGTH = length of data + length of second level encoded
source and destination names;
IF (length of the NetBIOS Datagram, including UDP and
IP headers, > MAX_DATAGRAM_LENGTH) THEN
BEGIN
/*
* fragment NetBIOS datagram into 2 UDP packets
*/
Put names into 1st UDP packet and any data that fits
after names;
Set MORE and FIRST bits in 1st UDP packet's FLAGS;
OFFSET in 1st UDP = 0;
Replicate NetBIOS Datagram header from 1st UDP packet
into 2nd UDP packet;
Put rest of data in 2nd UDP packet;
Clear MORE and FIRST bits in 2nd UDP packet's FLAGS;
OFFSET in 2nd UDP = DGM_LENGTH - number of name and
data bytes in 1st UDP;
END
BEGIN
/*
* Only need one UDP packet
*/
<span class="grey">NetBIOS Working Group [Page 75]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-76" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
USER_DATA = data;
Clear MORE bit and set FIRST bit in FLAGS;
OFFSET = 0;
END
IF (group == TRUE) OR (NetBIOS broadcast) THEN
BEGIN
send UDP packet(s) to BROADCAST_ADDRESS;
END
ELSE
BEGIN
send UDP packet(s) to IP address returned by name
discovery;
END
END /* procedure */
<span class="h4"><a class="selflink" id="section-5.3.2" href="#section-5.3.2">5.3.2</a>. P AND M NODE TRANSMISSION OF NetBIOS DATAGRAMS</span>
PROCEDURE send_datagram(data, source, destination, broadcast)
/*
* User initiated processing on P and M node.
*
* This processing is the same as for B nodes except for
* sending broadcast and multicast NetBIOS datagrams.
*/
BEGIN
group = FALSE;
do name discovery on destination name, returns name type
and IP address;
IF name type is group name THEN
BEGIN
group = TRUE;
END
/*
* build datagram service UDP packet;
*/
convert source and destination NetBIOS names into
half-ASCII, biased encoded name;
SOURCE_NAME = cat(source, SCOPE_ID);
SOURCE_IP = this nodes IP address;
SOURCE_PORT = DGM_SRVC_UDP_PORT;
IF NetBIOS broadcast THEN
BEGIN
DESTINATION_NAME = cat("*", SCOPE_ID)
END
ELSE
<span class="grey">NetBIOS Working Group [Page 76]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-77" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
BEGIN
DESTINATION_NAME = cat(destination, SCOPE_ID)
END
MSG_TYPE = select_one_from_set
{BROADCAST, DIRECT_UNIQUE, DIRECT_GROUP}
DGM_ID = next transaction id for Datagrams;
DGM_LENGTH = length of data + length of second level encoded
source and destination names;
IF (length of the NetBIOS Datagram, including UDP and
IP headers, > MAX_DATAGRAM_LENGTH) THEN
BEGIN
/*
* fragment NetBIOS datagram into 2 UDP packets
*/
Put names into 1st UDP packet and any data that fits
after names;
Set MORE and FIRST bits in 1st UDP packet's FLAGS;
OFFSET in 1st UDP = 0;
Replicate NetBIOS Datagram header from 1st UDP packet
into 2nd UDP packet;
Put rest of data in 2nd UDP packet;
Clear MORE and FIRST bits in 2nd UDP packet's FLAGS;
OFFSET in 2nd UDP = DGM_LENGTH - number of name and
data bytes in 1st UDP;
END
BEGIN
/*
* Only need one UDP packet
*/
USER_DATA = data;
Clear MORE bit and set FIRST bit in FLAGS;
OFFSET = 0;
END
IF (group == TRUE) OR (NetBIOS broadcast) THEN
BEGIN
/*
* Sending of following query is optional.
* Node may send datagram to NBDD immediately
* but NBDD may discard the datagram.
*/
send DATAGRAM QUERY REQUEST to NBDD;
IF response is POSITIVE QUERY RESPONSE THEN
send UDP packet(s) to NBDD Server IP address;
ELSE
BEGIN
get list of destination nodes from NBNS;
<span class="grey">NetBIOS Working Group [Page 77]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-78" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
FOR EACH node in list
BEGIN
send UDP packet(s) to this node's
IP address;
END
END
END
ELSE
BEGIN
send UDP packet(s) to IP address returned by name
discovery;
END /* procedure */
<span class="h4"><a class="selflink" id="section-5.3.3" href="#section-5.3.3">5.3.3</a>. RECEPTION OF NetBIOS DATAGRAMS BY ALL NODES</span>
The following algorithm discards out of order NetBIOS Datagram
fragments. An implementation which reassembles out of order
NetBIOS Datagram fragments conforms to this specification. The
fragment discard timer is initialized to the value FRAGMENT_TO.
This value should be user configurable. The default value is
given in <a href="#section-6">Section 6</a>, "Defined Constants and Variables".
PROCEDURE datagram_packet(packet)
/*
* processing initiated by datagram packet reception
* on B, P and M nodes
*/
BEGIN
/*
* if this node is a P node, ignore
* broadcast packets.
*/
IF this is a P node AND incoming packet is
a broadcast packet THEN
BEGIN
discard packet;
END
CASE packet type OF
DATAGRAM SERVICE:
BEGIN
IF FIRST bit in FLAGS is set THEN
BEGIN
IF MORE bit in FLAGS is set THEN
BEGIN
Save 1st UDP packet of the Datagram;
Set this Datagram's fragment discard
timer to FRAGMENT_TO;
<span class="grey">NetBIOS Working Group [Page 78]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-79" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
return;
END
ELSE
Datagram is composed of a single
UDP packet;
END
ELSE
BEGIN
/* Have the second fragment of a Datagram */
Search for 1st fragment by source IP address
and DGM_ID;
IF found 1st fragment THEN
Process both UDP packets;
ELSE
BEGIN
discard 2nd fragment UDP packet;
return;
END
END
IF DESTINATION_NAME is '*' THEN
BEGIN
/* NetBIOS broadcast */
deliver USER_DATA from UDP packet(s) to all
outstanding receive broadcast
datagram requests;
return;
END
ELSE
BEGIN /* non-broadcast */
/* Datagram for Unique or Group Name */
IF DESTINATION_NAME is not present in the
local name table THEN
BEGIN
/* destination not present */
build DATAGRAM ERROR packet, clear
FIRST and MORE bit, put in
this nodes IP and PORT, set
ERROR_CODE;
send DATAGRAM ERROR packet to
source IP address and port
of UDP;
discard UDP packet(s);
return;
END
ELSE
BEGIN /* good */
/*
<span class="grey">NetBIOS Working Group [Page 79]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-80" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
* Replicate received NetBIOS datagram for
* each recipient
*/
FOR EACH pending NetBIOS user's receive
datagram operation
BEGIN
IF source name of operation
matches destination name
of packet THEN
BEGIN
deliver USER_DATA from UDP
packet(s);
END
END /* for each */
return;
END /* good */
END /* non-broadcast */
END /* datagram service */
DATAGRAM ERROR:
BEGIN
/*
* name service returned incorrect information
*/
inform local name service that incorrect
information was provided;
IF this is a P or M node THEN
BEGIN
/*
* tell NetBIOS Name Server that it may
* have given incorrect information
*/
send NAME RELEASE REQUEST with name
and incorrect IP address to NetBIOS
Name Server;
END
END /* datagram error */
END /* case */
END
<span class="h4"><a class="selflink" id="section-5.3.4" href="#section-5.3.4">5.3.4</a>. PROTOCOLS FOR THE NBDD</span>
The key to NetBIOS Datagram forwarding service is the packet
delivered to the destination end node must have the same NetBIOS
header as if the source end node sent the packet directly to the
destination end node. Consequently, the NBDD does not reassemble
NetBIOS Datagrams. It forwards the UDP packet as is.
<span class="grey">NetBIOS Working Group [Page 80]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-81" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
PROCEDURE datagram_packet(packet)
/*
* processing initiated by a incoming datagram service
* packet on a NBDD node.
*/
BEGIN
CASE packet type OF
DATAGRAM SERVICE:
BEGIN
IF packet was sent as a directed
NetBIOS datagram THEN
BEGIN
/*
* provide group forwarding service
*
* Forward datagram to each member of the
* group. Can forward via:
* 1) get list of group members and send
* the DATAGRAM SERVICE packet unicast
* to each
* 2) use Group Multicast, if available
* 3) combination of 1) and 2)
*/
...
END
ELSE
BEGIN
/*
* provide broadcast forwarding service
*
* Forward datagram to every node in the
* NetBIOS scope. Can forward via:
* 1) get list of group members and send
* the DATAGRAM SERVICE packet unicast
* to each
* 2) use Group Multicast, if available
* 3) combination of 1) and 2)
*/
...
END
END /* datagram service */
DATAGRAM ERROR:
<span class="grey">NetBIOS Working Group [Page 81]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-82" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
BEGIN
/*
* Should never receive these because Datagrams
* forwarded have source end node IP address and
* port in NetBIOS header.
*/
send DELETE NAME REQUEST with incorrect name and
IP address to NetBIOS Name Server;
END /* datagram error */
DATAGRAM QUERY REQUEST:
BEGIN
IF can send packet to DESTINATION_NAME THEN
BEGIN
/*
* NBDD is able to relay Datagrams for
* this name
*/
send POSITIVE DATAGRAM QUERY RESPONSE to
REQUEST source IP address and UDP port
with request's DGM_ID;
END
ELSE
BEGIN
/*
* NBDD is NOT able to relay Datagrams for
* this name
*/
send NEGATIVE DATAGRAM QUERY RESPONSE to
REQUEST source IP address and UDP port
with request's DGM_ID;
END
END /* datagram query request */
END /* case */
END /* procedure */
<span class="grey">NetBIOS Working Group [Page 82]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-83" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. DEFINED CONSTANTS AND VARIABLES</span>
GENERAL:
SCOPE_ID The name of the NetBIOS scope.
This is expressed as a character
string meeting the requirements of
the domain name system and without
a leading or trailing "dot".
An implementation may elect to make
this a single global value for the
node or allow it to be specified
with each separate NetBIOS name
(thus permitting cross-scope
references.)
BROADCAST_ADDRESS An IP address composed of the
nodes's network and subnetwork
numbers with all remaining bits set
to one.
I.e. "Specific subnet" broadcast
addressing according to <a href="./rfc950#section-2.3">section 2.3
of RFC 950</a>.
BCAST_REQ_RETRY_TIMEOUT 250 milliseconds.
An adaptive timer may be used.
BCAST_REQ_RETRY_COUNT 3
UCAST_REQ_RETRY_TIMEOUT 5 seconds
An adaptive timer may be used.
UCAST_REQ_RETRY_COUNT 3
MAX_DATAGRAM_LENGTH 576 bytes (default)
NAME SERVICE:
REFRESH_TIMER Negotiated with NBNS for each name.
CONFLICT_TIMER 1 second
Implementations may chose a longer
value.
NAME_SERVICE_TCP_PORT 137 (decimal)
<span class="grey">NetBIOS Working Group [Page 83]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-84" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
NAME_SERVICE_UDP_PORT 137 (decimal)
INFINITE_TTL 0
SESSION SERVICE:
SSN_SRVC_TCP_PORT 139 (decimal)
SSN_RETRY_COUNT 4 (default)
Re-configurable by user.
SSN_CLOSE_TIMEOUT 30 seconds (default)
Re-configurable by user.
SSN_KEEP_ALIVE_TIMEOUT 60 seconds, recommended, may be set to
a higher value.
(Session keep-alives are used only
if configured.)
DATAGRAM SERVICE:
DGM_SRVC_UDP_PORT 138 (decimal)
FRAGMENT_TO 2 seconds (default)
<span class="grey">NetBIOS Working Group [Page 84]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-85" ></span>
<span class="grey"><a href="./rfc1002">RFC 1002</a> March 1987</span>
REFERENCES
[<a id="ref-1">1</a>] "Protocol Standard For a NetBIOS Service on a TCP/UDP
Transport: Concepts and Methods", <a href="./rfc1001">RFC 1001</a>, March 1987.
[<a id="ref-2">2</a>] J. Reynolds, J. Postel, "Assigned Numbers", <a href="./rfc990">RFC 990</a>, November
1986.
[<a id="ref-3">3</a>] P. Mockapetris, "Domain Names - Implementation and
Specification", <a href="./rfc883">RFC 883</a>, November 1983.
NetBIOS Working Group [Page 85]
</pre>
|