home *** CD-ROM | disk | FTP | other *** search
/ A Beginner's Guide to the Internet / INTERNET.ISO / text / std / std0019.txt < prev    next >
Encoding:
Text File  |  1995-04-05  |  312.3 KB  |  9,024 lines

  1.  
  2. Network Working Group
  3. Request for Comments: 1001                                March, 1987
  4.  
  5.  
  6.  
  7.  
  8.              PROTOCOL STANDARD FOR A NetBIOS SERVICE
  9.                      ON A TCP/UDP TRANSPORT:
  10.                       CONCEPTS AND METHODS
  11.  
  12.  
  13.  
  14.  
  15.                             ABSTRACT
  16.  
  17. This RFC defines a proposed standard protocol to support NetBIOS
  18. services in a TCP/IP environment.  Both local network and internet
  19. operation are supported.  Various node types are defined to accommodate
  20. local and internet topologies and to allow operation with or without the
  21. use of IP broadcast.
  22.  
  23. This RFC describes the NetBIOS-over-TCP protocols in a general manner,
  24. emphasizing the underlying ideas and techniques.  Detailed
  25. specifications are found in a companion RFC, "Protocol Standard For a
  26. NetBIOS Service on a TCP/UDP Transport: Detailed Specifications".
  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. NetBIOS Working Group                                           [Page 1]
  57.  
  58. RFC 1001                                                      March 1987
  59.  
  60.  
  61.                        SUMMARY OF CONTENTS
  62.  
  63.  
  64. 1.  STATUS OF THIS MEMO                                             6
  65. 2.  ACKNOWLEDGEMENTS                                                6
  66. 3.  INTRODUCTION                                                    7
  67. 4.  DESIGN PRINCIPLES                                               7
  68. 5.  OVERVIEW OF NetBIOS                                            10
  69. 6.  NetBIOS FACILITIES SUPPORTED BY THIS STANDARD                  15
  70. 7.  REQUIRED SUPPORTING SERVICE INTERFACES AND DEFINITIONS         15
  71. 8.  RELATED PROTOCOLS AND SERVICES                                 16
  72. 9.  NetBIOS SCOPE                                                  16
  73. 10.  NetBIOS END-NODES                                             16
  74. 11.  NetBIOS SUPPORT SERVERS                                       18
  75. 12.  TOPOLOGIES                                                    20
  76. 13.  GENERAL METHODS                                               23
  77. 14.  REPRESENTATION OF NETBIOS NAMES                               25
  78. 15.  NetBIOS NAME SERVICE                                          27
  79. 16.  NetBIOS SESSION SERVICE                                       48
  80. 17.  NETBIOS DATAGRAM SERVICE                                      55
  81. 18.  NODE CONFIGURATION PARAMETERS                                 58
  82. 19.  MINIMAL CONFORMANCE                                           59
  83. REFERENCES                                                         60
  84. APPENDIX A - INTEGRATION WITH INTERNET GROUP MULTICASTING          61
  85. APPENDIX B - IMPLEMENTATION CONSIDERATIONS                         62
  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. NetBIOS Working Group                                           [Page 2]
  116.  
  117. RFC 1001                                                      March 1987
  118.  
  119.  
  120.                         TABLE OF CONTENTS
  121.  
  122.  
  123. 1.  STATUS OF THIS MEMO                                             6
  124.  
  125. 2.  ACKNOWLEDGEMENTS                                                6
  126.  
  127. 3.  INTRODUCTION                                                    7
  128.  
  129. 4.  DESIGN PRINCIPLES                                               8
  130.   4.1  PRESERVE NetBIOS SERVICES                                    8
  131.   4.2  USE EXISTING STANDARDS                                       8
  132.   4.3  MINIMIZE OPTIONS                                             8
  133.   4.4  TOLERATE ERRORS AND DISRUPTIONS                              8
  134.   4.5  DO NOT REQUIRE CENTRAL MANAGEMENT                            9
  135.   4.6  ALLOW INTERNET OPERATION                                     9
  136.   4.7  MINIMIZE BROADCAST ACTIVITY                                  9
  137.   4.8  PERMIT IMPLEMENTATION ON EXISTING SYSTEMS                    9
  138.   4.9  REQUIRE ONLY THE MINIMUM NECESSARY TO OPERATE                9
  139.   4.10  MAXIMIZE EFFICIENCY                                        10
  140.   4.11  MINIMIZE NEW INVENTIONS                                    10
  141.  
  142. 5.  OVERVIEW OF NetBIOS                                            10
  143.   5.1  INTERFACE TO APPLICATION PROGRAMS                           10
  144.   5.2  NAME SERVICE                                                11
  145.   5.3  SESSION SERVICE                                             12
  146.   5.4  DATAGRAM SERVICE                                            13
  147.   5.5  MISCELLANEOUS FUNCTIONS                                     14
  148.   5.6  NON-STANDARD EXTENSIONS                                     15
  149.  
  150. 6.  NetBIOS FACILITIES SUPPORTED BY THIS STANDARD                  15
  151.  
  152. 7.  REQUIRED SUPPORTING SERVICE INTERFACES AND DEFINITIONS         15
  153.  
  154. 8.  RELATED PROTOCOLS AND SERVICES                                 16
  155.  
  156. 9.  NetBIOS SCOPE                                                  16
  157.  
  158. 10.  NetBIOS END-NODES                                             16
  159.   10.1  BROADCAST (B) NODES                                        16
  160.   10.2  POINT-TO-POINT (P) NODES                                   16
  161.   10.3  MIXED MODE (M) NODES                                       16
  162.  
  163. 11.  NetBIOS SUPPORT SERVERS                                       18
  164.   11.1  NetBIOS NAME SERVER (NBNS) NODES                           18
  165.      11.1.1  RELATIONSHIP OF THE NBNS TO THE DOMAIN NAME SYSTEM    19
  166.   11.2  NetBIOS DATAGRAM DISTRIBUTION SERVER (NBDD) NODES          19
  167.   11.3  RELATIONSHIP OF NBNS AND NBDD NODES                        20
  168.   11.4  RELATIONSHIP OF NetBIOS SUPPORT SERVERS AND B NODES        20
  169. 12.  TOPOLOGIES                                                    20
  170.   12.1  LOCAL                                                      20
  171.  
  172.  
  173.  
  174. NetBIOS Working Group                                           [Page 3]
  175.  
  176. RFC 1001                                                      March 1987
  177.  
  178.  
  179.      12.1.1  B NODES ONLY                                          21
  180.      12.1.2  P NODES ONLY                                          21
  181.      12.1.3  MIXED B AND P NODES                                   21
  182.   12.2  INTERNET                                                   22
  183.      12.2.1  P NODES ONLY                                          22
  184.      12.2.2  MIXED M AND P NODES                                   23
  185.  
  186. 13.  GENERAL METHODS                                               23
  187.   13.1  REQUEST/RESPONSE INTERACTION STYLE                         23
  188.      13.1.1  RETRANSMISSION OF REQUESTS                            24
  189.      13.1.2  REQUESTS WITHOUT RESPONSES: DEMANDS                   24
  190.   13.2  TRANSACTIONS                                               25
  191.      13.2.1  TRANSACTION ID                                        25
  192.   13.3  TCP AND UDP FOUNDATIONS                                    25
  193.  
  194. 14.  REPRESENTATION OF NETBIOS NAMES                               25
  195.   14.1  FIRST LEVEL ENCODING                                       26
  196.   14.2  SECOND LEVEL ENCODING                                      27
  197.  
  198. 15.  NetBIOS NAME SERVICE                                          27
  199.   15.1  OVERVIEW OF NetBIOS NAME SERVICE                           27
  200.      15.1.1  NAME REGISTRATION (CLAIM)                             27
  201.      15.1.2  NAME QUERY (DISCOVERY)                                28
  202.      15.1.3  NAME RELEASE                                          28
  203.        15.1.3.1  EXPLICIT RELEASE                                  28
  204.        15.1.3.2  NAME LIFETIME AND REFRESH                         29
  205.        15.1.3.3  NAME CHALLENGE                                    29
  206.        15.1.3.4  GROUP NAME FADE-OUT                               29
  207.      15.1.3.5  NAME CONFLICT                                       30
  208.      15.1.4  ADAPTER STATUS                                        31
  209.      15.1.5  END-NODE NBNS INTERACTION                             31
  210.        15.1.5.1  UDP, TCP, AND TRUNCATION                          31
  211.        15.1.5.2  NBNS WACK                                         32
  212.        15.1.5.3  NBNS REDIRECTION                                  32
  213.      15.1.6  SECURED VERSUS NON-SECURED NBNS                       32
  214.      15.1.7  CONSISTENCY OF THE NBNS DATA BASE                     32
  215.      15.1.8  NAME CACHING                                          34
  216.   15.2  NAME REGISTRATION TRANSACTIONS                             34
  217.      15.2.1  NAME REGISTRATION BY B NODES                          34
  218.      15.2.2  NAME REGISTRATION BY P NODES                          35
  219.        15.2.2.1  NEW NAME, OR NEW GROUP MEMBER                     35
  220.        15.2.2.2  EXISTING NAME AND OWNER IS STILL ACTIVE           36
  221.        15.2.2.3  EXISTING NAME AND OWNER IS INACTIVE               37
  222.      15.2.3  NAME REGISTRATION BY M NODES                          38
  223.   15.3  NAME QUERY TRANSACTIONS                                    39
  224.      15.3.1  QUERY BY B NODES                                      39
  225.      15.3.2  QUERY BY P NODES                                      40
  226.      15.3.3  QUERY BY M NODES                                      43
  227.      15.3.4  ACQUIRE GROUP MEMBERSHIP LIST                         43
  228.   15.4  NAME RELEASE TRANSACTIONS                                  44
  229.      15.4.1  RELEASE BY B NODES                                    44
  230.  
  231.  
  232.  
  233. NetBIOS Working Group                                           [Page 4]
  234.  
  235. RFC 1001                                                      March 1987
  236.  
  237.  
  238.      15.4.2  RELEASE BY P NODES                                    44
  239.      15.4.3  RELEASE BY M NODES                                    44
  240.   15.5  NAME MAINTENANCE TRANSACTIONS                              45
  241.      15.5.1  NAME REFRESH                                          45
  242.      15.5.2  NAME CHALLENGE                                        46
  243.      15.5.3  CLEAR NAME CONFLICT                                   47
  244.   15.6  ADAPTER STATUS TRANSACTIONS                                47
  245.  
  246. 16.  NetBIOS SESSION SERVICE                                       48
  247.   16.1  OVERVIEW OF NetBIOS SESSION SERVICE                        49
  248.      16.1.1  SESSION ESTABLISHMENT PHASE OVERVIEW                  49
  249.        16.1.1.1  RETRYING AFTER BEING RETARGETTED                  50
  250.        16.1.1.2  SESSION ESTABLISHMENT TO A GROUP NAME             51
  251.      16.1.2  STEADY STATE PHASE OVERVIEW                           51
  252.      16.1.3  SESSION TERMINATION PHASE OVERVIEW                    51
  253.   16.2  SESSION ESTABLISHMENT PHASE                                52
  254.   16.3  SESSION DATA TRANSFER PHASE                                54
  255.      16.3.1  DATA ENCAPSULATION                                    54
  256.      16.3.2  SESSION KEEP-ALIVES                                   54
  257.  
  258. 17.  NETBIOS DATAGRAM SERVICE                                      55
  259.   17.1  OVERVIEW OF NetBIOS DATAGRAM SERVICE                       55
  260.      17.1.1  UNICAST, MULTICAST, AND BROADCAST                     55
  261.      17.1.2  FRAGMENTATION OF NetBIOS DATAGRAMS                    55
  262.   17.2  NetBIOS DATAGRAMS BY B NODES                               57
  263.   17.3  NetBIOS DATAGRAMS BY P AND M NODES                         58
  264.  
  265. 18.  NODE CONFIGURATION PARAMETERS                                 58
  266.  
  267. 19.  MINIMAL CONFORMANCE                                           59
  268.  
  269. REFERENCES                                                         60
  270.  
  271. APPENDIX A                                                         61
  272.  
  273. INTEGRATION WITH INTERNET GROUP MULTICASTING                       61
  274.   A-1.  ADDITIONAL PROTOCOL REQUIRED IN B AND M NODES              61
  275.   A-2.  CONSTRAINTS                                                61
  276.  
  277. APPENDIX B                                                         62
  278.  
  279. IMPLEMENTATION CONSIDERATIONS                                      62
  280.   B-1.  IMPLEMENTATION MODELS                                      62
  281.      B-1.1  MODEL INDEPENDENT CONSIDERATIONS                       63
  282.      B-1.2  SERVICE OPERATION FOR EACH MODEL                       63
  283.   B-2.  CASUAL AND RESTRICTED NetBIOS APPLICATIONS                 64
  284.   B-3.  TCP VERSUS SESSION KEEP-ALIVES                             66
  285.   B-4.  RETARGET ALGORITHMS                                        67
  286.   B-5.  NBDD SERVICE                                               68
  287.   B-6.  APPLICATION CONSIDERATIONS                                 68
  288.      B-6.1  USE OF NetBIOS DATAGRAMS                               68
  289.  
  290.  
  291.  
  292. NetBIOS Working Group                                           [Page 5]
  293.  
  294. RFC 1001                                                      March 1987
  295.  
  296.  
  297.              PROTOCOL STANDARD FOR A NetBIOS SERVICE
  298.                      ON A TCP/UDP TRANSPORT:
  299.                       CONCEPTS AND METHODS
  300.  
  301.  
  302. 1.  STATUS OF THIS MEMO
  303.  
  304.    This RFC specifies a proposed standard for the Internet
  305.    community.  Since this topic is new to the Internet community,
  306.    discussions and suggestions are specifically requested.
  307.  
  308.    Please send written comments to:
  309.  
  310.            Karl Auerbach
  311.            Epilogue Technology Corporation
  312.            P.O. Box 5432
  313.            Redwood City, CA   94063
  314.  
  315.    Please send online comments to:
  316.  
  317.            Avnish Aggarwal
  318.                    Internet: mtxinu!excelan!avnish@ucbvax.berkeley.edu
  319.                    Usenet:   ucbvax!mtxinu!excelan!avnish
  320.  
  321.    Distribution of this document is unlimited.
  322.  
  323. 2.  ACKNOWLEDGEMENTS
  324.  
  325.    This RFC has been developed under the auspices of the Internet
  326.    Activities Board, especially the End-to-End Services Task Force.
  327.  
  328.    The following individuals have contributed to the development of
  329.    this RFC:
  330.  
  331.    Avnish Aggarwal       Arvind Agrawal        Lorenzo Aguilar
  332.    Geoffrey Arnold       Karl Auerbach         K. Ramesh Babu
  333.    Keith Ball            Amatzia Ben-Artzi     Vint Cerf
  334.    Richard Cherry        David Crocker         Steve Deering
  335.    Greg Ennis            Steve Holmgren        Jay Israel
  336.    David Kaufman         Lee LaBarre           James Lau
  337.    Dan Lynch             Gaylord Miyata        David Stevens
  338.    Steve Thomas          Ishan Wu
  339.  
  340.    The system proposed by this RFC does not reflect any existing
  341.    Netbios-over-TCP implementation.  However, the design
  342.    incorporates considerable knowledge obtained from prior
  343.    implementations.  Special thanks goes to the following
  344.    organizations which have provided this invaluable information:
  345.  
  346.    CMC/Syros      Excelan        Sytek          Ungermann-Bass
  347.  
  348.  
  349.  
  350.  
  351. NetBIOS Working Group                                           [Page 6]
  352.  
  353. RFC 1001                                                      March 1987
  354.  
  355.  
  356. 3.  INTRODUCTION
  357.  
  358.    This RFC describes the ideas and general methods used to provide
  359.    NetBIOS on a TCP and UDP foundation.  A companion RFC, "Protocol
  360.    Standard For a NetBIOS Service on a TCP/UDP Transport: Detailed
  361.    Specifications"[1] contains detailed descriptions of packet
  362.    formats, protocols, and defined constants and variables.
  363.  
  364.    The NetBIOS service has become the dominant mechanism for
  365.    personal computer networking.  NetBIOS provides a vendor
  366.    independent interface for the IBM Personal Computer (PC) and
  367.    compatible systems.
  368.  
  369.    NetBIOS defines a software interface not a protocol.  There is no
  370.    "official" NetBIOS service standard.  In practice, however, the
  371.    IBM PC-Network version is used as a reference.  That version is
  372.    described in the IBM document 6322916, "Technical Reference PC
  373.    Network"[2].
  374.  
  375.    Protocols supporting NetBIOS services have been constructed on
  376.    diverse protocol and hardware foundations.  Even when the same
  377.    foundation is used, different implementations may not be able to
  378.    interoperate unless they use a common protocol.  To allow NetBIOS
  379.    interoperation in the Internet, this RFC defines a standard
  380.    protocol to support NetBIOS services using TCP and UDP.
  381.  
  382.    NetBIOS has generally been confined to personal computers to
  383.    date.  However, since larger computers are often well suited to
  384.    run certain NetBIOS applications, such as file servers, this
  385.    specification has been designed to allow an implementation to be
  386.    built on virtually any type of system where the TCP/IP protocol
  387.    suite is available.
  388.  
  389.    This standard defines a set of protocols to support NetBIOS
  390.    services.
  391.  
  392.    These protocols are more than a simple communications service
  393.    involving two entities.  Rather, this note describes a
  394.    distributed system in which many entities play a part even if
  395.    they are not involved as an end-point of a particular NetBIOS
  396.    connection.
  397.  
  398.    This standard neither constrains nor determines how those
  399.    services are presented to application programs.
  400.  
  401.    Nevertheless, it is expected that on computers operating under
  402.    the PC-DOS and MS-DOS operating systems that the existing NetBIOS
  403.    interface will be preserved by implementors.
  404.  
  405.    NOTE: Various symbolic values are used in this document.  For
  406.          their definitions, refer to the Detailed Specifications[1].
  407.  
  408.  
  409.  
  410. NetBIOS Working Group                                           [Page 7]
  411.  
  412. RFC 1001                                                      March 1987
  413.  
  414.  
  415. 4.  DESIGN PRINCIPLES
  416.  
  417.    In order to develop the specification the following design principles
  418.    were adopted to guide the effort.  Most are typical to any protocol
  419.    standardization effort; however, some have been assigned priorities
  420.    that may be considered unusual.
  421.  
  422. 4.1.  PRESERVE NetBIOS SERVICES
  423.  
  424.    In the absence of an "official" standard for NetBIOS services, the
  425.    version found in the IBM PC Network Technical Reference[2] is used.
  426.  
  427.    NetBIOS is the foundation of a large body of existing applications.
  428.    It is desirable to operate these applications on TCP networks and to
  429.    extend them beyond personal computers into larger hosts.  To support
  430.    these applications, NetBIOS on TCP must closely conform to the
  431.    services offered by existing NetBIOS systems.
  432.  
  433.    IBM PC-Network NetBIOS contains some implementation specific
  434.    characteristics.  This standard does not attempt to completely
  435.    preserve these.  It is certain that some existing software requires
  436.    these characteristics and will fail to operate correctly on a NetBIOS
  437.    service based on this RFC.
  438.  
  439. 4.2.  USE EXISTING STANDARDS
  440.  
  441.    Protocol development, especially with standardization, is a demanding
  442.    process.  The development of new protocols must be minimized.
  443.  
  444.    It is considered essential that an existing standard which provides
  445.    the necessary functionality with reasonable performance always be
  446.    chosen in preference to developing a new protocol.
  447.  
  448.    When a standard protocol is used, it must be unmodified.
  449.  
  450. 4.3.  MINIMIZE OPTIONS
  451.  
  452.    The standard for NetBIOS on TCP should contain few, if any, options.
  453.  
  454.    Where options are included, the options should be designed so that
  455.    devices with different option selections should interoperate.
  456.  
  457. 4.4.  TOLERATE ERRORS AND DISRUPTIONS
  458.  
  459.    NetBIOS networks typically operate in an uncontrolled environment.
  460.    Computers come on-line at arbitrary times.  Computers usually go
  461.    off-line without any notice to their peers.  The software is often
  462.    operated by users who are unfamiliar with networks and who may
  463.    randomly perturb configuration settings.
  464.  
  465.    Despite this chaos, NetBIOS networks work.  NetBIOS on TCP must also
  466.  
  467.  
  468.  
  469. NetBIOS Working Group                                           [Page 8]
  470.  
  471. RFC 1001                                                      March 1987
  472.  
  473.  
  474.    be able to operate well in this environment.
  475.  
  476.    Robust operation does not necessarily mean that the network is proof
  477.    against all disruptions.  A typical NetBIOS network may be disrupted
  478.    by certain types of behavior, whether inadvertent or malicious.
  479.  
  480. 4.5.  DO NOT REQUIRE CENTRAL MANAGEMENT
  481.  
  482.    NetBIOS on TCP should be able to operate, if desired, without
  483.    centralized management beyond that typically required by a TCP based
  484.    network.
  485.  
  486. 4.6.  ALLOW INTERNET OPERATION
  487.  
  488.    The proposed standard recognizes the need for NetBIOS operation
  489.    across a set of networks interconnected by network (IP) level relays
  490.    (gateways.)
  491.  
  492.    However, the standard assumes that this form of operation will be
  493.    less frequent than on the local MAC bridged-LAN.
  494.  
  495. 4.7.  MINIMIZE BROADCAST ACTIVITY
  496.  
  497.    The standard pre-supposes that the only broadcast services are those
  498.    supported by UDP.  Multicast capabilities are not assumed to be
  499.    available in any form.
  500.  
  501.    Despite the availability of broadcast capabilities, the standard
  502.    recognizes that some administrations may wish to avoid heavy
  503.    broadcast activity.  For example, an administration may wish to avoid
  504.    isolated non-participating hosts from the burden of receiving and
  505.    discarding NetBIOS broadcasts.
  506.  
  507. 4.8.  PERMIT IMPLEMENTATION ON EXISTING SYSTEMS
  508.  
  509.    The NetBIOS on TCP protocol should be implementable on common
  510.    operating systems, such as Unix(tm) and VAX/VMS(tm), without massive
  511.    effort.
  512.  
  513.    The NetBIOS protocols should not require services typically
  514.    unavailable on presently existing TCP/UDP/IP implementations.
  515.  
  516. 4.9.  REQUIRE ONLY THE MINIMUM NECESSARY TO OPERATE
  517.  
  518.    The protocol definition should specify only the minimal set of
  519.    protocols required for interoperation.  However, additional protocol
  520.    elements may be defined to enhance efficiency.  These latter elements
  521.    may be generated at the option of the sender, although they must be
  522.    accepted by all receivers.
  523.  
  524.  
  525.  
  526.  
  527.  
  528. NetBIOS Working Group                                           [Page 9]
  529.  
  530. RFC 1001                                                      March 1987
  531.  
  532.  
  533. 4.10.  MAXIMIZE EFFICIENCY
  534.  
  535.    To be useful, a protocol must conduct its business quickly.
  536.  
  537. 4.11.  MINIMIZE NEW INVENTIONS
  538.  
  539.    When an existing protocol is not quite able to support a necessary
  540.    function, but with a small amount of change, it could, that protocol
  541.    should be used.  This is felt to be easier to achieve than
  542.    development of new protocols; further, it is likely to have more
  543.    general utility for the Internet.
  544.  
  545. 5.  OVERVIEW OF NetBIOS
  546.  
  547.    This section describes the NetBIOS services.  It is for background
  548.    information only.  The reader may chose to skip to the next section.
  549.  
  550.    NetBIOS was designed for use by groups of PCs, sharing a broadcast
  551.    medium.  Both connection (Session) and connectionless (Datagram)
  552.    services are provided, and broadcast and multicast are supported.
  553.    Participants are identified by name.  Assignment of names is
  554.    distributed and highly dynamic.
  555.  
  556.    NetBIOS applications employ NetBIOS mechanisms to locate resources,
  557.    establish connections, send and receive data with an application
  558.    peer, and terminate connections.  For purposes of discussion, these
  559.    mechanisms will collectively be called the NetBIOS Service.
  560.  
  561.    This service can be implemented in many different ways.  One of the
  562.    first implementations was for personal computers running the PC-DOS
  563.    and MS-DOS operating systems.  It is possible to implement NetBIOS
  564.    within other operating systems, or as processes which are,
  565.    themselves, simply application programs as far as the host operating
  566.    system is concerned.
  567.  
  568.    The NetBIOS specification, published by IBM as "Technical Reference
  569.    PC Network"[2] defines the interface and services available to the
  570.    NetBIOS user.  The protocols outlined by that document pertain only
  571.    to the IBM PC Network and are not generally applicable to other
  572.    networks.
  573.  
  574. 5.1.  INTERFACE TO APPLICATION PROGRAMS
  575.  
  576.    NetBIOS on personal computers includes both a set of services and an
  577.    exact program interface to those services.  NetBIOS on other computer
  578.    systems may present the NetBIOS services to programs using other
  579.    interfaces.  Except on personal computers, no clear standard for a
  580.    NetBIOS software interface has emerged.
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587. NetBIOS Working Group                                          [Page 10]
  588.  
  589. RFC 1001                                                      March 1987
  590.  
  591.  
  592. 5.2.  NAME SERVICE
  593.  
  594.    NetBIOS resources are referenced by name.  Lower-level address
  595.    information is not available to NetBIOS applications.  An
  596.    application, representing a resource, registers one or more names
  597.    that it wishes to use.
  598.  
  599.    The name space is flat and uses sixteen alphanumeric characters.
  600.    Names may not start with an asterisk (*).
  601.  
  602.    Registration is a bid for use of a name.  The bid may be for
  603.    exclusive (unique) or shared (group) ownership.  Each application
  604.    contends with the other applications in real time.  Implicit
  605.    permission is granted to a station when it receives no objections.
  606.    That is, a bid is made and the application waits for a period of
  607.    time.  If no objections are received, the station assumes that it has
  608.    permission.
  609.  
  610.    A unique name should be held by only one station at a time.  However,
  611.    duplicates ("name conflicts") may arise due to errors.
  612.  
  613.    All instances of a group name are equivalent.
  614.  
  615.    An application referencing a name generally does not know (or care)
  616.    whether the name is registered as a unique or a group name.
  617.  
  618.    An explicit name deletion function is specified, so that applications
  619.    may remove a name.  Implicit name deletion occurs when a station
  620.    ceases operation.  In the case of personal computers, implicit name
  621.    deletion is a frequent occurrence.
  622.  
  623.    The Name Service primitives are:
  624.  
  625.       1)   Add Name
  626.  
  627.            The requesting application wants exclusive use of the name.
  628.  
  629.       2)   Add Group Name
  630.  
  631.            The requesting application is willing to share use of the
  632.            name with other applications.
  633.  
  634.       3)   Delete Name
  635.  
  636.            The application no longer requires use of the name.  It is
  637.            important to note that typical use of NetBIOS is among
  638.            independently-operated personal computers.  A common way to
  639.            stop using a PC is to turn it off; in this case, the
  640.            graceful give-back mechanism, provided by the Delete Name
  641.            function, is not used.  Because this occurs frequently, the
  642.            network service must support this behavior.
  643.  
  644.  
  645.  
  646. NetBIOS Working Group                                          [Page 11]
  647.  
  648. RFC 1001                                                      March 1987
  649.  
  650.  
  651. 5.3.  SESSION SERVICE
  652.  
  653.    A session is a reliable message exchange, conducted between a pair of
  654.    NetBIOS applications.  Sessions are full-duplex, sequenced, and
  655.    reliable.  Data is organized into messages.  Each message may range
  656.    in size from 0 to 131,071 bytes.  No expedited or urgent data
  657.    capabilities are present.
  658.  
  659.    Multiple sessions may exist between any pair of calling and called
  660.    names.
  661.  
  662.    The parties to a connection have access to the calling and called
  663.    names.
  664.  
  665.    The NetBIOS specification does not define how a connection request to
  666.    a shared (group) name resolves into a session.  The usual assumption
  667.    is that a session may be established with any one owner of the called
  668.    group name.
  669.  
  670.    An important service provided to NetBIOS applications is the
  671.    detection of sessions failure.  The loss of a session is reported to
  672.    an application via all of the outstanding service requests for that
  673.    session.  For example, if the application has only a NetBIOS receive
  674.    primitive pending and the session terminates, the pending receive
  675.    will abort with a termination indication.
  676.  
  677.    Session Service primitives are:
  678.  
  679.       1)   Call
  680.  
  681.            Initiate a session with a process that is listening under
  682.            the specified name.  The calling entity must indicate both a
  683.            calling name (properly registered to the caller) and a
  684.            called name.
  685.  
  686.       2)   Listen
  687.  
  688.            Accept a session from a caller.  The listen primitive may be
  689.            constrained to accept an incoming call from a named caller.
  690.            Alternatively, a call may be accepted from any caller.
  691.  
  692.       3)   Hang Up
  693.  
  694.            Gracefully terminate a session.  All pending data is
  695.            transferred before the session is terminated.
  696.  
  697.       4)   Send
  698.  
  699.            Transmit one message.  A time-out can occur.  A time-out of
  700.            any session send forces the non-graceful termination of the
  701.            session.
  702.  
  703.  
  704.  
  705. NetBIOS Working Group                                          [Page 12]
  706.  
  707. RFC 1001                                                      March 1987
  708.  
  709.  
  710.            A "chain send" primitive is required by the PC NetBIOS
  711.            software interface to allow a single message to be gathered
  712.            from pieces in various buffers.  Chain Send is an interface
  713.            detail and does not effect the protocol.
  714.  
  715.       5)   Receive
  716.  
  717.            Receive data.  A time-out can occur.  A time-out on a
  718.            session receive only terminates the receive, not the
  719.            session, although the data is lost.
  720.  
  721.            The receive primitive may be implemented with variants, such
  722.            as "Receive Any", which is required by the PC NetBIOS
  723.            software interface.  Receive Any is an interface detail and
  724.            does not effect the protocol.
  725.  
  726.       6)   Session Status
  727.  
  728.            Obtain information about all of the requestor's sessions,
  729.            under the specified name.  No network activity is involved.
  730.  
  731. 5.4.  DATAGRAM SERVICE
  732.  
  733.    The Datagram service is an unreliable, non-sequenced, connectionless
  734.    service.  Datagrams are sent under cover of a name properly
  735.    registered to the sender.
  736.  
  737.    Datagrams may be sent to a specific name or may be explicitly
  738.    broadcast.
  739.  
  740.    Datagrams sent to an exclusive name are received, if at all, by the
  741.    holder of that name.  Datagrams sent to a group name are multicast to
  742.    all holders of that name.  The sending application program cannot
  743.    distinguish between group and unique names and thus must act as if
  744.    all non-broadcast datagrams are multicast.
  745.  
  746.    As with the Session Service, the receiver of the datagram is told the
  747.    sending and receiving names.
  748.  
  749.    Datagram Service primitives are:
  750.  
  751.       1)   Send Datagram
  752.  
  753.            Send an unreliable datagram to an application that is
  754.            associated with the specified name.  The name may be unique
  755.            or group; the sender is not aware of the difference.  If the
  756.            name belongs to a group, then each member is to receive the
  757.            datagram.
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764. NetBIOS Working Group                                          [Page 13]
  765.  
  766. RFC 1001                                                      March 1987
  767.  
  768.  
  769.       2)   Send Broadcast Datagram
  770.  
  771.            Send an unreliable datagram to any application with a
  772.            Receive Broadcast Datagram posted.
  773.  
  774.       3)   Receive Datagram
  775.  
  776.            Receive a datagram sent by a specified originating name to
  777.            the specified name.  If the originating name is an asterisk,
  778.            then the datagram may have been originated under any name.
  779.  
  780.            Note: An arriving datagram will be delivered to all pending
  781.            Receiving Datagrams that have source and destination
  782.            specifications matching those of the datagram.  In other
  783.            words, if a program (or group of programs) issue a series of
  784.            identical Receive Datagrams, one datagram will cause the
  785.            entire series to complete.
  786.  
  787.       4)   Receive Broadcast Datagram
  788.  
  789.            Receive a datagram sent as a broadcast.
  790.  
  791.            If there are multiple pending Receive Broadcast Datagram
  792.            operations pending, all will be satisfied by the same
  793.            received datagram.
  794.  
  795. 5.5.  MISCELLANEOUS FUNCTIONS
  796.  
  797.    The following functions are present to control the operation of the
  798.    hardware interface to the network.  These functions are generally
  799.    implementation dependent.
  800.  
  801.       1)   Reset
  802.  
  803.            Initialize the local network adapter.
  804.  
  805.       2)   Cancel
  806.  
  807.            Abort a pending NetBIOS request.  The successful cancel of a
  808.            Send (or Chain Send) operation will terminate the associated
  809.            session.
  810.  
  811.       3)   Adapter Status
  812.  
  813.            Obtain information about the local network adapter or of a
  814.            remote adapter.
  815.  
  816.       4)   Unlink
  817.  
  818.            For use with Remote Program Load (RPL).  Unlink redirects
  819.            the PC boot disk device back to the local disk.  See the
  820.  
  821.  
  822.  
  823. NetBIOS Working Group                                          [Page 14]
  824.  
  825. RFC 1001                                                      March 1987
  826.  
  827.  
  828.            NetBIOS specification for further details concerning RPL and
  829.            the Unlink operation (see page 2-35 in [2]).
  830.  
  831.       5)   Remote Program Load
  832.  
  833.            Remote Program Load (RPL) is not a NetBIOS function.  It is
  834.            a NetBIOS application defined by IBM in their NetBIOS
  835.            specification (see pages 2-80 through 2-82 in [2]).
  836.  
  837. 5.6.  NON-STANDARD EXTENSIONS
  838.  
  839.    The IBM Token Ring implementation of NetBIOS has added at least one
  840.    new user capability:
  841.  
  842.       1)    Find Name
  843.  
  844.            This function determines whether a given name has been
  845.            registered on the network.
  846.  
  847. 6.  NetBIOS FACILITIES SUPPORTED BY THIS STANDARD
  848.  
  849.    The protocol specified by this standard permits an implementer to
  850.    provide all of the NetBIOS services as described in the IBM
  851.    "Technical Reference PC Network"[2].
  852.  
  853.    The following NetBIOS facilities are outside the scope of this
  854.    specification.  These are local implementation matters and do not
  855.    impact interoperability:
  856.  
  857.      -  RESET
  858.      -  SESSION STATUS
  859.      -  UNLINK
  860.      -  RPL (Remote Program Load)
  861.  
  862. 7.  REQUIRED SUPPORTING SERVICE INTERFACES AND DEFINITIONS
  863.  
  864.    The protocols described in this RFC require service interfaces to the
  865.    following:
  866.  
  867.      -  TCP[3,4]
  868.      -  UDP[5]
  869.  
  870.    Byte ordering, addressing conventions (including addresses to be
  871.    used for broadcasts and multicasts) are defined by the most
  872.    recent version of:
  873.  
  874.      -  Assigned Numbers[6]
  875.  
  876.  
  877.    Additional definitions and constraints are in:
  878.  
  879.  
  880.  
  881.  
  882. NetBIOS Working Group                                          [Page 15]
  883.  
  884. RFC 1001                                                      March 1987
  885.  
  886.  
  887.      -  IP[7]
  888.      -  Internet Subnets[8,9,10]
  889.  
  890.  
  891. 8.  RELATED PROTOCOLS AND SERVICES
  892.  
  893.    The design of the protocols described in this RFC allow for the
  894.    future incorporation of the following protocols and services.
  895.    However, before this may occur, certain extensions may be required to
  896.    the protocols defined in this RFC or to those listed below.
  897.  
  898.      -  Domain Name Service[11,12,13,14]
  899.      -  Internet Group Multicast[15,16]
  900.  
  901. 9.  NetBIOS SCOPE
  902.  
  903.    A "NetBIOS Scope" is the population of computers across which a
  904.    registered NetBIOS name is known.  NetBIOS broadcast and multicast
  905.    datagram operations must reach the entire extent of the NetBIOS
  906.    scope.
  907.  
  908.    An internet may support multiple, non-intersecting NetBIOS Scopes.
  909.  
  910.    Each NetBIOS scope has a "scope identifier".  This identifier is a
  911.    character string meeting the requirements of the domain name system
  912.    for domain names.
  913.  
  914.    NOTE: Each implementation of NetBIOS-over-TCP must provide
  915.          mechanisms to manage the scope identifier(s) to be used.
  916.  
  917.    Control of scope identifiers implies a requirement for additional
  918.    NetBIOS interface capabilities.  These may be provided through
  919.    extensions of the user service interface or other means (such as node
  920.    configuration parameters.)  The nature of these extensions is not
  921.    part of this specification.
  922.  
  923. 10.  NetBIOS END-NODES
  924.  
  925.    End-nodes support NetBIOS service interfaces and contain
  926.    applications.
  927.  
  928.    Three types of end-nodes are part of this standard:
  929.  
  930.      -  Broadcast ("B") nodes
  931.      -  Point-to-point ("P") nodes
  932.      -  Mixed mode ("M") nodes
  933.  
  934.    An IP address may be associated with only one instance of one of the
  935.    above types.
  936.  
  937.    Without having preloaded name-to-address tables, NetBIOS participants
  938.  
  939.  
  940.  
  941. NetBIOS Working Group                                          [Page 16]
  942.  
  943. RFC 1001                                                      March 1987
  944.  
  945.  
  946.    are faced with the task of dynamically resolving references to one
  947.    another.  This can be accomplished with broadcast or mediated point-
  948.    to-point communications.
  949.  
  950.    B nodes use local network broadcasting to effect a rendezvous with
  951.    one or more recipients.  P and M nodes use the NetBIOS Name Server
  952.    (NBNS) and the NetBIOS Datagram Distribution Server (NBDD) for this
  953.    same purpose.
  954.  
  955.    End-nodes may be combined in various topologies.  No matter how
  956.    combined, the operation of the B, P, and M nodes is not altered.
  957.  
  958.    NOTE: It is recommended that the administration of a NetBIOS
  959.          scope avoid using both M and B nodes within the same scope.
  960.          A NetBIOS scope should contain only B nodes or only P and M
  961.          nodes.
  962.  
  963. 10.1.  BROADCAST (B) NODES
  964.  
  965.    Broadcast (or "B") nodes communicate using a mix of UDP datagrams
  966.    (both broadcast and directed) and TCP connections.  B nodes may
  967.    freely interoperate with one another within a broadcast area.  A
  968.    broadcast area is a single MAC-bridged "B-LAN".  (See Appendix A for
  969.    a discussion of using Internet Group Multicasting as a means to
  970.    extend a broadcast area beyond a single B-LAN.)
  971.  
  972. 10.2.  POINT-TO-POINT (P) NODES
  973.  
  974.    Point-to-point (or "P") nodes communicate using only directed UDP
  975.    datagrams and TCP sessions.  P nodes neither generate nor listen for
  976.    broadcast UDP packets.  P nodes do, however, offer NetBIOS level
  977.    broadcast and multicast services using capabilities provided by the
  978.    NBNS and NBDD.
  979.  
  980.    P nodes rely on NetBIOS name and datagram distribution servers.
  981.    These servers may be local or remote; P nodes operate the same in
  982.    either case.
  983.  
  984. 10.3.  MIXED MODE (M) NODES
  985.  
  986.    Mixed mode nodes (or "M") nodes are P nodes which have been given
  987.    certain B node characteristics.  M nodes use both broadcast and
  988.    unicast.  Broadcast is used to improve response time using the
  989.    assumption that most resources reside on the local broadcast medium
  990.    rather than somewhere in an internet.
  991.  
  992.    M nodes rely upon NBNS and NBDD servers.  However, M nodes may
  993.    continue limited operation should these servers be temporarily
  994.    unavailable.
  995.  
  996.  
  997.  
  998.  
  999.  
  1000. NetBIOS Working Group                                          [Page 17]
  1001.  
  1002. RFC 1001                                                      March 1987
  1003.  
  1004.  
  1005. 11.  NetBIOS SUPPORT SERVERS
  1006.  
  1007.    Two types of support servers are part of this standard:
  1008.  
  1009.      -  NetBIOS name server ("NBNS") nodes
  1010.      -  Netbios datagram distribution ("NBDD") nodes
  1011.  
  1012.    NBNS and NBDD nodes are invisible to NetBIOS applications and are
  1013.    part of the underlying NetBIOS mechanism.
  1014.  
  1015.    NetBIOS name and datagram distribution servers are the focus of name
  1016.    and datagram activity for P and M nodes.
  1017.  
  1018.    Both the name (NBNS) and datagram distribution (NBDD) servers are
  1019.    permitted to shift part of their operation to the P or M end-node
  1020.    which is requesting a service.
  1021.  
  1022.    Since the assignment of responsibility is dynamic, and since P and M
  1023.    nodes must be prepared to operate should the NetBIOS server delegate
  1024.    control to the maximum extent, the system naturally accommodates
  1025.    improvements in NetBIOS server function.  For example, as Internet
  1026.    Group Multicasting becomes more widespread, new NBDD implementations
  1027.    may elect to assume full responsibility for NetBIOS datagram
  1028.    distribution.
  1029.  
  1030.    Interoperability between different implementations is assured by
  1031.    imposing requirements on end-node implementations that they be able
  1032.    to accept the full range of legal responses from the NBNS or NBDD.
  1033.  
  1034. 11.1.  NetBIOS NAME SERVER (NBNS) NODES
  1035.  
  1036.    The NBNS is designed to allow considerable flexibility with its
  1037.    degree of responsibility for the accuracy and management of NetBIOS
  1038.    names.  On one hand, the NBNS may elect not to accept full
  1039.    responsibility, leaving the NBNS essentially a "bulletin board" on
  1040.    which name/address information is freely posted (and removed) by P
  1041.    and M nodes without validation by the NBNS.  Alternatively, the NBNS
  1042.    may elect to completely manage and validate names.  The degree of
  1043.    responsibility that the NBNS assumes is asserted by the NBNS each
  1044.    time a name is claimed through a simple mechanism.  Should the NBNS
  1045.    not assert full control, the NBNS returns enough information to the
  1046.    requesting node so that the node may challenge any putative holder of
  1047.    the name.
  1048.  
  1049.    This ability to shift responsibility for NetBIOS name management
  1050.    between the NBNS and the P and M nodes allows a network administrator
  1051.    (or vendor) to make a tradeoff between NBNS simplicity, security, and
  1052.    delay characteristics.
  1053.  
  1054.    A single NBNS may be implemented as a distributed entity, such as the
  1055.    Domain Name Service.  However, this RFC does not attempt to define
  1056.  
  1057.  
  1058.  
  1059. NetBIOS Working Group                                          [Page 18]
  1060.  
  1061. RFC 1001                                                      March 1987
  1062.  
  1063.  
  1064.    the internal communications which would be used.
  1065.  
  1066. 11.1.1.  RELATIONSHIP OF THE NBNS TO THE DOMAIN NAME SYSTEM
  1067.  
  1068.    The NBNS design attempts to align itself with the Domain Name System
  1069.    in a number of ways.
  1070.  
  1071.    First, the NetBIOS names are encoded in a form acceptable to the
  1072.    domain name system.
  1073.  
  1074.    Second, a scope identifier is appended to each NetBIOS name.  This
  1075.    identifier meets the restricted character set of the domain system
  1076.    and has a leading period.  This makes the NetBIOS name, in
  1077.    conjunction with its scope identifier, a valid domain system name.
  1078.  
  1079.    Third, the negotiated responsibility mechanisms permit the NBNS to be
  1080.    used as a simple bulletin board on which are posted (name,address)
  1081.    pairs.  This parallels the existing domain sytem query service.
  1082.  
  1083.    This RFC, however, requires the NBNS to provide services beyond those
  1084.    provided by the current domain name system.  An attempt has been made
  1085.    to coalesce all the additional services which are required into a set
  1086.    of transactions which follow domain name system styles of interaction
  1087.    and packet formats.
  1088.  
  1089.    Among the areas in which the domain name service must be extended
  1090.    before it may be used as an NBNS are:
  1091.  
  1092.      -  Dynamic addition of entries
  1093.      -  Dynamic update of entry data
  1094.      -  Support for multiple instance (group) entries
  1095.      -  Support for entry time-to-live values and ability to accept
  1096.         refresh messages to restart the time-to-live period
  1097.      -  New entry attributes
  1098.  
  1099. 11.2.  NetBIOS DATAGRAM DISTRIBUTION SERVER (NBDD) NODES
  1100.  
  1101.    The internet does not yet support broadcasting or multicasting.  The
  1102.    NBDD extends NetBIOS datagram distribution service to this
  1103.    environment.
  1104.  
  1105.    The NBDD may elect to complete, partially complete, or totally refuse
  1106.    to service a node's request to distribute a NetBIOS datagram.  An
  1107.    end-node may query an NBDD to determine whether the NBDD will deliver
  1108.    a datagram to a specific NetBIOS name.
  1109.  
  1110.    The design of NetBIOS-over-TCP lends itself to the use of Internet
  1111.    Group Multicast.  For details see Appendix A.
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118. NetBIOS Working Group                                          [Page 19]
  1119.  
  1120. RFC 1001                                                      March 1987
  1121.  
  1122.  
  1123. 11.3.  RELATIONSHIP OF NBNS AND NBDD NODES
  1124.  
  1125.    This RFC defines the NBNS and NBDD as distinct, separate entities.
  1126.  
  1127.    In the absence of NetBIOS name information, a NetBIOS datagram
  1128.    distribution server must send a copy to each end-node within a
  1129.    NetBIOS scope.
  1130.  
  1131.    An implementer may elect to construct NBNS and NBDD nodes which have
  1132.    a private protocol for the exchange of NetBIOS name information.
  1133.    Alternatively, an NBNS and NBDD may be implemented within the same
  1134.    device.
  1135.  
  1136.    NOTE: Implementations containing private NBNS-NBDD protocols or
  1137.          combined NBNS-NBDD functions must be clearly identified.
  1138.  
  1139. 11.4.  RELATIONSHIP OF NetBIOS SUPPORT SERVERS AND B NODES
  1140.  
  1141.    As defined in this RFC, neither NBNS nor NBDD nodes interact with B
  1142.    nodes.  NetBIOS servers do not listen to broadcast traffic on any
  1143.    broadcast area to which they may be attached.  Nor are the NetBIOS
  1144.    support servers even aware of B node activities or names claimed or
  1145.    used by B nodes.
  1146.  
  1147.    It may be possible to extend both the NBNS and NBDD so that they
  1148.    participate in B node activities and act as a bridge to P and M
  1149.    nodes.  However, such extensions are beyond the scope of this
  1150.    specification.
  1151.  
  1152. 12.  TOPOLOGIES
  1153.  
  1154.    B, P, M, NBNS, and NBDD nodes may be combined in various ways to form
  1155.    useful NetBIOS environments.  This section describes some of these
  1156.    combinations.
  1157.  
  1158.    There are three classes of operation:
  1159.  
  1160.      -  Class 0:  B nodes only.
  1161.      -  Class 1:  P nodes only.
  1162.      -  Class 2:  P and M nodes together.
  1163.  
  1164.    In the drawings which follow, any P node may be replaced by an M
  1165.    node.  The effects of such replacement will be mentioned in
  1166.    conjunction with each example below.
  1167.  
  1168. 12.1.  LOCAL
  1169.  
  1170.    A NetBIOS scope is operating locally when all entities are within the
  1171.    same broadcast area.
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177. NetBIOS Working Group                                          [Page 20]
  1178.  
  1179. RFC 1001                                                      March 1987
  1180.  
  1181.  
  1182. 12.1.1.  B NODES ONLY
  1183.  
  1184.    Local operation with only B nodes is the most basic mode of
  1185.    operation.  Name registration and discovery procedures use broadcast
  1186.    mechanisms.  The NetBIOS scope is limited by the extent of the
  1187.    broadcast area.  This configuration does not require NetBIOS support
  1188.    servers.
  1189.  
  1190.    ====+=========+=====BROADCAST AREA=====+==========+=========+====
  1191.        |         |                        |          |         |
  1192.        |         |                        |          |         |
  1193.     +--+--+   +--+--+                  +--+--+    +--+--+   +--+--+
  1194.     |  B  |   |  B  |                  |  B  |    |  B  |   |  B  |
  1195.     +-----+   +-----+                  +-----+    +-----+   +-----+
  1196.  
  1197. 12.1.2.  P NODES ONLY
  1198.  
  1199.    This configuration would typically be used when the network
  1200.    administrator desires to eliminate NetBIOS as a source of broadcast
  1201.    activity.
  1202.  
  1203.  
  1204.    ====+=========+==========+=B'CAST AREA=+==========+=========+====
  1205.        |         |          |             |          |         |
  1206.        |         |          |             |          |         |
  1207.     +--+--+   +--+--+    +--+--+       +--+--+    +--+--+   +--+--+
  1208.     |  P  |   |  P  |    |NBNS |       |  P  |    |NBDD |   |  P  |
  1209.     +-----+   +-----+    +-----+       +-----+    +-----+   +-----+
  1210.  
  1211.  
  1212.    This configuration operates the same as if it were in an internet and
  1213.    is cited here only due to its convenience as a means to reduce the
  1214.    use of broadcast.
  1215.  
  1216.    Replacement of one or more of the P nodes with M nodes will not
  1217.    affect the operation of the other P and M nodes.  P and M nodes will
  1218.    be able to interact with one another.  Because M nodes use broadcast,
  1219.    overall broadcast activity will increase.
  1220.  
  1221. 12.1.3.  MIXED B AND P NODES
  1222.  
  1223.    B and P nodes do not interact with one another.  Replacement of P
  1224.    nodes with M nodes will allow B's and M's to interact.
  1225.  
  1226.    NOTE: B nodes and M nodes may be intermixed only on a local
  1227.          broadcast area.  B and M nodes should not be intermixed in
  1228.          an internet environment.
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236. NetBIOS Working Group                                          [Page 21]
  1237.  
  1238. RFC 1001                                                      March 1987
  1239.  
  1240.  
  1241. 12.2.  INTERNET
  1242.  
  1243. 12.2.1.  P NODES ONLY
  1244.  
  1245.    P nodes may be scattered at various locations in an internetwork.
  1246.    They require both an NBNS and an NBDD for NetBIOS name and datagram
  1247.    support, respectively.
  1248.  
  1249.    The NetBIOS scope is determined by the NetBIOS scope identifier
  1250.    (domain name) used by the various P (and M) nodes.  An internet may
  1251.    contain numerous NetBIOS scopes.
  1252.  
  1253.                    +-----+
  1254.                    |  P  |
  1255.                    +--+--+              |    +-----+
  1256.                       |                 |----+  P  |
  1257.                       |                 |    +-----+
  1258.                 /-----+-----\           |
  1259.    +-----+      |           |  +------+ |    +-----+
  1260.    |  P  +------+  INTERNET +--+G'WAY |-+----+  P  |
  1261.    +-----+      |           |  +------+ |    +-----+
  1262.                 /-----+-----/           |
  1263.               /       |                 |    +-----+
  1264.             /         |                 |----+  P  |
  1265.      +-----+       +--+--+              |    +-----+
  1266.      |NBNS +       |NBDD |
  1267.      +-----+       +--+--+
  1268.  
  1269.    Any P node may be replaced by an M node with no loss of function to
  1270.    any node.  However, broadcast activity will be increased in the
  1271.    broadcast area to which the M node is attached.
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295. NetBIOS Working Group                                          [Page 22]
  1296.  
  1297. RFC 1001                                                      March 1987
  1298.  
  1299.  
  1300. 12.2.2.  MIXED M AND P NODES
  1301.  
  1302.    M and P nodes may be mixed.  When locating NetBIOS names, M nodes
  1303.    will tend to find names held by other M nodes on the same common
  1304.    broadcast area in preference to names held by P nodes or M nodes
  1305.    elsewhere in the network.
  1306.  
  1307.                          +-----+
  1308.                          |  P  |
  1309.                          +--+--+
  1310.                             |
  1311.                             |
  1312.                       /-----+-----\
  1313.          +-----+      |           |      +-----+
  1314.          |  P  +------+  INTERNET +------+NBDD |
  1315.          +-----+      |           |      +-----+
  1316.                       /-----+-----/
  1317.                     /       |
  1318.                   /         |
  1319.            +-----+       +--+--+
  1320.            |NBNS +       |G'WAY|
  1321.            +-----+       +--+--+
  1322.                             |
  1323.                             |
  1324.    ====+=========+==========+=B'CAST AREA=+==========+=========+====
  1325.        |         |          |             |          |         |
  1326.        |         |          |             |          |         |
  1327.     +--+--+   +--+--+    +--+--+       +--+--+    +--+--+   +--+--+
  1328.     |  M  |   |  P  |    |  M  |       |  P  |    |  M  |   |  P  |
  1329.     +-----+   +-----+    +--+--+       +-----+    +-----+   +-----+
  1330.  
  1331.  
  1332.    NOTE: B and M nodes should not be intermixed in an internet
  1333.          environment.  Doing so would allow undetected NetBIOS name
  1334.          conflicts to arise and cause unpredictable behavior.
  1335.  
  1336. 13.  GENERAL METHODS
  1337.  
  1338.    Overlying the specific protocols, described later, are a few general
  1339.    methods of interaction between entities.
  1340.  
  1341. 13.1.  REQUEST/RESPONSE INTERACTION STYLE
  1342.  
  1343.    Most interactions between entities consist of a request flowing in
  1344.    one direction and a subsequent response flowing in the opposite
  1345.    direction.
  1346.  
  1347.    In those situations where interactions occur on unreliable transports
  1348.    (i.e. UDP) or when a request is broadcast, there may not be a strict
  1349.    interlocking or one-to-one relationship between requests and
  1350.    responses.
  1351.  
  1352.  
  1353.  
  1354. NetBIOS Working Group                                          [Page 23]
  1355.  
  1356. RFC 1001                                                      March 1987
  1357.  
  1358.  
  1359.    In no case, however, is more than one response generated for a
  1360.    received request.  While a response is pending the responding entity
  1361.    may send one or more wait acknowledgements.
  1362.  
  1363. 13.1.1.  RETRANSMISSION OF REQUESTS
  1364.  
  1365.    UDP is an unreliable delivery mechanism where packets can be lost,
  1366.    received out of transmit sequence, duplicated and delivery can be
  1367.    significantly delayed.  Since the NetBIOS protocols make heavy use of
  1368.    UDP, they have compensated for its unreliability with extra
  1369.    mechanisms.
  1370.  
  1371.    Each NetBIOS packet contains all the necessary information to process
  1372.    it.  None of the protocols use multiple UDP packets to convey a
  1373.    single request or response.  If more information is required than
  1374.    will fit in a single UDP packet, for example, when a P-type node
  1375.    wants all the owners of a group name from a NetBIOS server, a TCP
  1376.    connection is used.  Consequently, the NetBIOS protocols will not
  1377.    fail because of out of sequence delivery of UDP packets.
  1378.  
  1379.    To overcome the loss of a request or response packet, each request
  1380.    operation will retransmit the request if a response is not received
  1381.    within a specified time limit.
  1382.  
  1383.    Protocol operations sensitive to successive response packets, such as
  1384.    name conflict detection, are protected from duplicated packets
  1385.    because they ignore successive packets with the same NetBIOS
  1386.    information.  Since no state on the responder's node is associated
  1387.    with a request, the responder just sends the appropriate response
  1388.    whenever a request packet arrives.  Consequently, duplicate or
  1389.    delayed request packets have no impact.
  1390.  
  1391.    For all requests, if a response packet is delayed too long another
  1392.    request packet will be transmitted.  A second response packet being
  1393.    sent in response to the second request packet is equivalent to a
  1394.    duplicate packet.  Therefore, the protocols will ignore the second
  1395.    packet received.  If the delivery of a response is delayed until
  1396.    after the request operation has been completed, successfully or not,
  1397.    the response packet is ignored.
  1398.  
  1399. 13.1.2.  REQUESTS WITHOUT RESPONSES: DEMANDS
  1400.  
  1401.    Some request types do not have matching responses.  These requests
  1402.    are known as "demands".  In general a "demand" is an imperative
  1403.    request; the receiving node is expected to obey.  However, because
  1404.    demands are unconfirmed, they are used only in situations where, at
  1405.    most, limited damage would occur if the demand packet should be lost.
  1406.  
  1407.    Demand packets are not retransmitted.
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413. NetBIOS Working Group                                          [Page 24]
  1414.  
  1415. RFC 1001                                                      March 1987
  1416.  
  1417.  
  1418. 13.2.  TRANSACTIONS
  1419.  
  1420.    Interactions between a pair of entities are grouped into
  1421.    "transactions".  These transactions comprise one or more
  1422.    request/response pairs.
  1423.  
  1424. 13.2.1.  TRANSACTION ID
  1425.  
  1426.    Since multiple simultaneous transactions may be in progress between a
  1427.    pair of entities a "transaction id" is used.
  1428.  
  1429.    The originator of a transaction selects an ID unique to the
  1430.    originator.  The transaction id is reflected back and forth in each
  1431.    interaction within the transaction.  The transaction partners must
  1432.    match responses and requests by comparison of the transaction ID and
  1433.    the IP address of the transaction partner.  If no matching request
  1434.    can be found the response must be discarded.
  1435.  
  1436.    A new transaction ID should be used for each transaction.  A simple
  1437.    16 bit transaction counter ought to be an adequate id generator.  It
  1438.    is probably not necessary to search the space of outstanding
  1439.    transaction ID to filter duplicates: it is extremely unlikely that
  1440.    any transaction will have a lifetime that is more than a small
  1441.    fraction of the typical counter cycle period.  Use of the IP
  1442.    addresses in conjunction with the transaction ID further reduces the
  1443.    possibility of damage should transaction IDs be prematurely re-used.
  1444.  
  1445. 13.3.  TCP AND UDP FOUNDATIONS
  1446.  
  1447.    This version of the NetBIOS-over-TCP protocols uses UDP for many
  1448.    interactions.  In the future this RFC may be extended to permit such
  1449.    interactions to occur over TCP connections (perhaps to increase
  1450.    efficiency when multiple interactions occur within a short time or
  1451.    when NetBIOS datagram traffic reveals that an application is using
  1452.    NetBIOS datagrams to support connection- oriented service.)
  1453.  
  1454. 14.  REPRESENTATION OF NETBIOS NAMES
  1455.  
  1456.    NetBIOS names as seen across the client interface to NetBIOS are
  1457.    exactly 16 bytes long.  Within the NetBIOS-over-TCP protocols, a
  1458.    longer representation is used.
  1459.  
  1460.    There are two levels of encoding.  The first level maps a NetBIOS
  1461.    name into a domain system name.  The second level maps the domain
  1462.    system name into the "compressed" representation required for
  1463.    interaction with the domain name system.
  1464.  
  1465.    Except in one packet, the second level representation is the only
  1466.    NetBIOS name representation used in NetBIOS-over-TCP packet formats.
  1467.    The exception is the RDATA field of a NODE STATUS RESPONSE packet.
  1468.  
  1469.  
  1470.  
  1471.  
  1472. NetBIOS Working Group                                          [Page 25]
  1473.  
  1474. RFC 1001                                                      March 1987
  1475.  
  1476.  
  1477. 14.1.  FIRST LEVEL ENCODING
  1478.  
  1479.    The first level representation consists of two parts:
  1480.  
  1481.      -  NetBIOS name
  1482.      -  NetBIOS scope identifier
  1483.  
  1484.    The 16 byte NetBIOS name is mapped into a 32 byte wide field using a
  1485.    reversible, half-ASCII, biased encoding.  Each half-octet of the
  1486.    NetBIOS name is encoded into one byte of the 32 byte field.  The
  1487.    first half octet is encoded into the first byte, the second half-
  1488.    octet into the second byte, etc.
  1489.  
  1490.    Each 4-bit, half-octet of the NetBIOS name is treated as an 8-bit,
  1491.    right-adjusted, zero-filled binary number.  This number is added to
  1492.    value of the ASCII character 'A' (hexidecimal 41).  The resulting 8-
  1493.    bit number is stored in the appropriate byte.  The following diagram
  1494.    demonstrates this procedure:
  1495.  
  1496.  
  1497.                          0 1 2 3 4 5 6 7
  1498.                         +-+-+-+-+-+-+-+-+
  1499.                         |a b c d|w x y z|          ORIGINAL BYTE
  1500.                         +-+-+-+-+-+-+-+-+
  1501.                             |       |
  1502.                    +--------+       +--------+
  1503.                    |                         |     SPLIT THE NIBBLES
  1504.                    v                         v
  1505.             0 1 2 3 4 5 6 7           0 1 2 3 4 5 6 7
  1506.            +-+-+-+-+-+-+-+-+         +-+-+-+-+-+-+-+-+
  1507.            |0 0 0 0 a b c d|         |0 0 0 0 w x y z|
  1508.            +-+-+-+-+-+-+-+-+         +-+-+-+-+-+-+-+-+
  1509.                    |                         |
  1510.                    +                         +     ADD 'A'
  1511.                    |                         |
  1512.             0 1 2 3 4 5 6 7           0 1 2 3 4 5 6 7
  1513.            +-+-+-+-+-+-+-+-+         +-+-+-+-+-+-+-+-+
  1514.            |0 1 0 0 0 0 0 1|         |0 1 0 0 0 0 0 1|
  1515.            +-+-+-+-+-+-+-+-+         +-+-+-+-+-+-+-+-+
  1516.  
  1517.    This encoding results in a NetBIOS name being represented as a
  1518.    sequence of 32 ASCII, upper-case characters from the set
  1519.    {A,B,C...N,O,P}.
  1520.  
  1521.    The NetBIOS scope identifier is a valid domain name (without a
  1522.    leading dot).
  1523.  
  1524.    An ASCII dot (2E hexidecimal) and the scope identifier are appended
  1525.    to the encoded form of the NetBIOS name, the result forming a valid
  1526.    domain name.
  1527.  
  1528.  
  1529.  
  1530.  
  1531. NetBIOS Working Group                                          [Page 26]
  1532.  
  1533. RFC 1001                                                      March 1987
  1534.  
  1535.  
  1536.    For example, the NetBIOS name "The NetBIOS name" in the NetBIOS scope
  1537.    "SCOPE.ID.COM" would be represented at level one by the ASCII
  1538.    character string:
  1539.  
  1540.         FEGHGFCAEOGFHEECEJEPFDCAHEGBGNGF.SCOPE.ID.COM
  1541.  
  1542. 14.2.  SECOND LEVEL ENCODING
  1543.  
  1544.    The first level encoding must be reduced to second level encoding.
  1545.    This is performed according to the rules defined in on page 31 of RFC
  1546.    883[12] in the section on "Domain name representation and
  1547.    compression".  Also see the section titled "Name Formats" in the
  1548.    Detailed Specifications[1].
  1549.  
  1550. 15.  NetBIOS NAME SERVICE
  1551.  
  1552.    Before a name may be used, the name must be registered by a node.
  1553.    Once acquired, the name must be defended against inconsistent
  1554.    registration by other nodes.  Before building a NetBIOS session or
  1555.    sending a NetBIOS datagram, the one or more holders of the name must
  1556.    be located.
  1557.  
  1558.    The NetBIOS name service is the collection of procedures through
  1559.    which nodes acquire, defend, and locate the holders of NetBIOS names.
  1560.  
  1561.    The name service procedures are different depending whether the end-
  1562.    node is of type B, P, or M.
  1563.  
  1564. 15.1.  OVERVIEW OF NetBIOS NAME SERVICE
  1565.  
  1566. 15.1.1.  NAME REGISTRATION (CLAIM)
  1567.  
  1568.    Each NetBIOS node can own more than one name.  Names are acquired
  1569.    dynamically through the registration (name claim) procedures.
  1570.  
  1571.    Every node has a permanent unique name.  This name, like any other
  1572.    name, must be explicitly registered by all end-node types.
  1573.  
  1574.    A name can be unique (exclusive) or group (non-exclusive).  A unique
  1575.    name may be owned by a single node; a group name may be owned by any
  1576.    number of nodes.  A name ceases to exist when it is not owned by at
  1577.    least one node.  There is no intrinsic quality of a name which
  1578.    determines its characteristics: these are established at the time of
  1579.    registration.
  1580.  
  1581.    Each node maintains state information for each name it has
  1582.    registered.  This information includes:
  1583.  
  1584.      -  Whether the name is a group or unique name
  1585.      -  Whether the name is "in conflict"
  1586.      -  Whether the name is in the process of being deleted
  1587.  
  1588.  
  1589.  
  1590. NetBIOS Working Group                                          [Page 27]
  1591.  
  1592. RFC 1001                                                      March 1987
  1593.  
  1594.  
  1595.    B nodes perform name registration by broadcasting claim requests,
  1596.    soliciting a defense from any node already holding the name.
  1597.  
  1598.    P nodes perform name registration through the agency of the NBNS.
  1599.  
  1600.    M nodes register names through an initial broadcast, like B nodes,
  1601.    then, in the absence of an objection, by following the same
  1602.    procedures as a P node.  In other words, the broadcast action may
  1603.    terminate the attempt, but is not sufficient to confirm the
  1604.    registration.
  1605.  
  1606. 15.1.2.  NAME QUERY (DISCOVERY)
  1607.  
  1608.    Name query (also known as "resolution" or "discovery") is the
  1609.    procedure by which the IP address(es) associated with a NetBIOS name
  1610.    are discovered.  Name query is required during the following
  1611.    operations:
  1612.  
  1613.    During session establishment, calling and called names must be
  1614.    specified.  The calling name must exist on the node that posts the
  1615.    CALL.  The called name must exist on a node that has previously
  1616.    posted a LISTEN.  Either name may be a unique or group name.
  1617.  
  1618.    When a directed datagram is sent, a source and destination name must
  1619.    be specified.  If the destination name is a group name, a datagram is
  1620.    sent to all the members of that group.
  1621.  
  1622.    Different end-node types perform name resolution using different
  1623.    techniques, but using the same packet formats:
  1624.  
  1625.      -  B nodes solicit name information by broadcasting a request.
  1626.  
  1627.      -  P nodes ask the NBNS.
  1628.  
  1629.      -  M nodes broadcast a request.  If that does not provide the
  1630.         desired information, an inquiry is sent to the NBNS.
  1631.  
  1632. 15.1.3.  NAME RELEASE
  1633.  
  1634.    NetBIOS names may be released explicitly or silently by an end- node.
  1635.    Silent release typically occurs when an end-node fails or is turned-
  1636.    off.  Most of the mechanisms described below are present to detect
  1637.    silent name release.
  1638.  
  1639. 15.1.3.1.  EXPLICIT RELEASE
  1640.  
  1641.    B nodes explicitly release a name by broadcasting a notice.
  1642.  
  1643.    P nodes send a notification to their NBNS.
  1644.  
  1645.    M nodes both broadcast a notice and inform their supporting NBNS.
  1646.  
  1647.  
  1648.  
  1649. NetBIOS Working Group                                          [Page 28]
  1650.  
  1651. RFC 1001                                                      March 1987
  1652.  
  1653.  
  1654. 15.1.3.2.  NAME LIFETIME AND REFRESH
  1655.  
  1656.    Names held by an NBNS are given a lifetime during name registration.
  1657.    The NBNS will consider a name to have been silently released if the
  1658.    end-node fails to send a name refresh message to the NBNS before the
  1659.    lifetime expires.  A refresh restarts the lifetime clock.
  1660.  
  1661.    NOTE: The implementor should be aware of the tradeoff between
  1662.          accuracy of the database and the internet overhead that the
  1663.          refresh mechanism introduces.  The lifetime period should
  1664.          be tuned accordingly.
  1665.  
  1666.  
  1667.    For group names, each end-node must send refresh messages.  A node
  1668.    that fails to do so will be considered to have silently released the
  1669.    name and dropped from the group.
  1670.  
  1671.    The lifetime period is established through a simple negotiation
  1672.    mechanism during name registration:  In the name registration
  1673.    request, the end-node proposes a lifetime value or requests an
  1674.    infinite lifetime.  The NBNS places an actual lifetime value into the
  1675.    name registration response.  The NBNS is always allowed to respond
  1676.    with an infinite actual period.  If the end node proposed an infinite
  1677.    lifetime, the NBNS may respond with any definite period.  If the end
  1678.    node proposed a definite period, the NBNS may respond with any
  1679.    definite period greater than or equal to that proposed.
  1680.  
  1681.    This negotiation of refresh times gives the NBNS means to disable or
  1682.    enable refresh activity.  The end-nodes may set a minimum refresh
  1683.    cycle period.
  1684.  
  1685.    NBNS implementations which are completely reliable may disable
  1686.    refresh.
  1687.  
  1688. 15.1.3.3.  NAME CHALLENGE
  1689.  
  1690.    To detect whether a node has silently released its claim to a name,
  1691.    it is necessary on occasion to challenge that node's current
  1692.    ownership.  If the node defends the name then the node is allowed to
  1693.    continue possession.  Otherwise it is assumed that the node has
  1694.    released the name.
  1695.  
  1696.    A name challenge may be issued by an NBNS or by a P or M node.  A
  1697.    challenge may be directed towards any end-node type: B, P, or M.
  1698.  
  1699. 15.1.3.4.  GROUP NAME FADE-OUT
  1700.  
  1701.    NetBIOS groups may contain an arbitrarily large number of members.
  1702.    The time to challenge all members could be quite large.
  1703.  
  1704.    To avoid long delays when names are claimed through an NBNS, an
  1705.  
  1706.  
  1707.  
  1708. NetBIOS Working Group                                          [Page 29]
  1709.  
  1710. RFC 1001                                                      March 1987
  1711.  
  1712.  
  1713.    optimistic heuristic has been adopted.  It is assumed that there will
  1714.    always be some node which will defend a group name.  Consequently, it
  1715.    is recommended that the NBNS will immediately reject a claim request
  1716.    for a unique name when there already exists a group with the same
  1717.    name.  The NBNS will never return an IP address (in response to a
  1718.    NAME REGISTRATION REQUEST) when a group name exists.
  1719.  
  1720.    An NBNS will consider a group to have faded out of existence when the
  1721.    last remaining member fails to send a timely refresh message or
  1722.    explicitly releases the name.
  1723.  
  1724. 15.1.3.5.  NAME CONFLICT
  1725.  
  1726.    Name conflict exists when a unique name has been claimed by more than
  1727.    one node on a NetBIOS network.  B, M, and NBNS nodes may detect a
  1728.    name conflict.  The detection mechanism used by B and M nodes is
  1729.    active only during name discovery.  The NBNS may detect conflict at
  1730.    any time it verifies the consistency of its name database.
  1731.  
  1732.    B and M nodes detect conflict by examining the responses received in
  1733.    answer to a broadcast name query request.  The first response is
  1734.    taken as authoritative.  Any subsequent, inconsistent responses
  1735.    represent conflicts.
  1736.  
  1737.    Subsequent responses are inconsistent with the authoritative response
  1738.    when:
  1739.  
  1740.         The subsequent response has the same transaction ID as the
  1741.         NAME QUERY REQUEST.
  1742.      AND
  1743.         The subsequent response is not a duplicate of the
  1744.         authoritative response.
  1745.      AND EITHER:
  1746.              The group/unique characteristic of the authoritative
  1747.              response is "unique".
  1748.           OR
  1749.              The group/unique characteristic of the subsequent
  1750.              response is "unique".
  1751.  
  1752.    The period in which B and M nodes examine responses is limited by a
  1753.    conflict timer, CONFLICT_TIMER.  The accuracy or duration of this
  1754.    timer is not crucial: the NetBIOS system will continue to operate
  1755.    even with persistent name conflicts.
  1756.  
  1757.    Conflict conditions are signaled by sending a NAME CONFLICT DEMAND to
  1758.    the node owning the offending name.  Nothing is sent to the node
  1759.    which originated the authoritative response.
  1760.  
  1761.    Any end-node that receives NAME CONFLICT DEMAND is required to update
  1762.    its "local name table" to reflect that the name is in conflict.  (The
  1763.    "local name table" on each node contains names that have been
  1764.  
  1765.  
  1766.  
  1767. NetBIOS Working Group                                          [Page 30]
  1768.  
  1769. RFC 1001                                                      March 1987
  1770.  
  1771.  
  1772.    successfully registered by that node.)
  1773.  
  1774.    Notice that only those nodes that receive the name conflict message
  1775.    place a conflict mark next to a name.
  1776.  
  1777.    Logically, a marked name does not exist on that node.  This means
  1778.    that the node should not defend the name (for name claim purposes),
  1779.    should not respond to a name discovery requests for that name, nor
  1780.    should the node send name refresh messages for that name.
  1781.    Furthermore, it can no longer be used by that node for any session
  1782.    establishment or sending or receiving datagrams.  Existing sessions
  1783.    are not affected at the time a name is marked as being in conflict.
  1784.  
  1785.    The only valid user function against a marked name is DELETE NAME.
  1786.    Any other user NetBIOS function returns immediately with an error
  1787.    code of "NAME CONFLICT".
  1788.  
  1789. 15.1.4.  ADAPTER STATUS
  1790.  
  1791.    An end-node or the NBNS may ask any other end-node for a collection
  1792.    of information about the NetBIOS status of that node.  This status
  1793.    consists of, among other things, a list of the names which the node
  1794.    believes it owns.  The returned status is filtered to contain only
  1795.    those names which have the same NetBIOS scope identifier as the
  1796.    requestor's name.
  1797.  
  1798.    When requesting node status, the requestor identifies the target node
  1799.    by NetBIOS name  A name query transaction may be necessary to acquire
  1800.    the IP address for the name.  Locally cached name information may be
  1801.    used in lieu of a query transaction.  The requesting node sends a
  1802.    NODE STATUS REQUEST.  In response, the receiving node sends a NODE
  1803.    STATUS RESPONSE containing its local name table and various
  1804.    statistics.
  1805.  
  1806.    The amount of status which may be returned is limited by the size of
  1807.    a UDP packet.  However, this is sufficient for the typical NODE
  1808.    STATUS RESPONSE packet.
  1809.  
  1810. 15.1.5.  END-NODE NBNS INTERACTION
  1811.  
  1812.    There are certain characteristics of end-node to NBNS interactions
  1813.    which are in common and are independent of any particular transaction
  1814.    type.
  1815.  
  1816. 15.1.5.1.  UDP, TCP, AND TRUNCATION
  1817.  
  1818.    For all transactions between an end-node and an NBNS, either UDP or
  1819.    TCP may be used as a transport.  If the NBNS receives a UDP based
  1820.    request, it will respond using UDP.  If the amount of information
  1821.    exceeds what fits into a UDP packet, the response will contain a
  1822.    "truncation flag".  In this situation, the end- node may open a TCP
  1823.  
  1824.  
  1825.  
  1826. NetBIOS Working Group                                          [Page 31]
  1827.  
  1828. RFC 1001                                                      March 1987
  1829.  
  1830.  
  1831.    connection to the NBNS, repeat the request, and receive a complete,
  1832.    untruncated response.
  1833.  
  1834. 15.1.5.2.  NBNS WACK
  1835.  
  1836.    While a name service request is in progress, the NBNS may issue a
  1837.    WAIT FOR ACKNOWLEDGEMENT RESPONSE (WACK) to assure the client end-
  1838.    node that the NBNS is still operational and is working on the
  1839.    request.
  1840.  
  1841. 15.1.5.3.  NBNS REDIRECTION
  1842.  
  1843.    The NBNS, because it follows Domain Name system styles of
  1844.    interaction, is permitted to redirect a client to another NBNS.
  1845.  
  1846. 15.1.6.  SECURED VERSUS NON-SECURED NBNS
  1847.  
  1848.    An NBNS may be implemented in either of two general ways:  The NBNS
  1849.    may monitor, and participate in, name activity to ensure consistency.
  1850.    This would be a "secured" style NBNS.  Alternatively, an NBNS may be
  1851.    implemented to be essentially a "bulletin board" on which name
  1852.    information is posted and responsibility for consistency is delegated
  1853.    to the end-nodes.  This would be a "non-secured" style NBNS.
  1854.  
  1855. 15.1.7.  CONSISTENCY OF THE NBNS DATA BASE
  1856.  
  1857.    Even in a properly running NetBIOS scope the NBNS and its community
  1858.    of end-nodes may occasionally lose synchronization with respect to
  1859.    the true state of name registrations.
  1860.  
  1861.    This may occur should the NBNS fail and lose all or part of its
  1862.    database.
  1863.  
  1864.    More commonly, a P or M node may be turned-off (thus forgetting the
  1865.    names it has registered) and then be subsequently turned back on.
  1866.  
  1867.    Finally, errors may occur or an implementation may be incorrect.
  1868.  
  1869.    Various approaches have been incorporated into the NetBIOS-over- TCP
  1870.    protocols to minimize the impact of these problems.
  1871.  
  1872.       1.   The NBNS (or any other node) may "challenge" (using a NAME
  1873.            QUERY REQUEST) an end-node to verify that it actually owns a
  1874.            name.
  1875.  
  1876.            Such a challenge may occur at any time.  Every end-node must
  1877.            be prepared to make a timely response.
  1878.  
  1879.            Failure to respond causes the NBNS to consider that the
  1880.            end-node has released the name in question.
  1881.  
  1882.  
  1883.  
  1884.  
  1885. NetBIOS Working Group                                          [Page 32]
  1886.  
  1887. RFC 1001                                                      March 1987
  1888.  
  1889.  
  1890.            (If UDP is being used as the underlying transport, the
  1891.            challenge, like all other requests, must be retransmitted
  1892.            some number of times in the absence of a response.)
  1893.  
  1894.       2.   The NBNS (or any other node) may request (using the NODE
  1895.            STATUS REQUEST) that an end-node deliver its entire name
  1896.            table.
  1897.  
  1898.            This may occur at any time.  Every end-node must be prepared
  1899.            to make a timely response.
  1900.  
  1901.            Failure to respond permits (but does not require) the NBNS
  1902.            to consider that the end-node has failed and released all
  1903.            names to which it had claims.  (Like the challenge, on a UDP
  1904.            transport, the request must be retransmitted in the absence
  1905.            of a response.)
  1906.  
  1907.       3.   The NBNS may revoke a P or M node's use of a name by sending
  1908.            either a NAME CONFLICT DEMAND or a NAME RELEASE REQUEST to
  1909.            the node.
  1910.  
  1911.            The receiving end-node may continue existing sessions which
  1912.            use that name, but must otherwise cease using that name.  If
  1913.            the NBNS placed the name in conflict, the name may be re-
  1914.            acquired only by deletion and subsequent reclamation.  If
  1915.            the NBNS requested that the name be released, the node may
  1916.            attempt to re-acquire the name without first performing a
  1917.            name release transaction.
  1918.  
  1919.       4.   The NBNS may impose a "time-to-live" on each name it
  1920.            registers.  The registering node is made aware of this time
  1921.            value during the name registration procedure.
  1922.  
  1923.            Simple or reliable NBNS's may impose an infinite time-to-
  1924.            live.
  1925.  
  1926.       5.   If an end-node holds any names that have finite time-to-
  1927.            live values, then that node must periodically send a status
  1928.            report to the NBNS.  Each name is reported using the NAME
  1929.            REFRESH REQUEST packet.
  1930.  
  1931.            These status reports restart the timers of both the NBNS and
  1932.            the reporting node.  However, the only timers which are
  1933.            restarted are those associated with the name found in the
  1934.            status report.  Timers on other names are not affected.
  1935.  
  1936.            The NBNS may consider that a node has released any name
  1937.            which has not been refreshed within some multiple of name's
  1938.            time-to-live.
  1939.  
  1940.            A well-behaved NBNS, would, however, issue a challenge to-,
  1941.  
  1942.  
  1943.  
  1944. NetBIOS Working Group                                          [Page 33]
  1945.  
  1946. RFC 1001                                                      March 1987
  1947.  
  1948.  
  1949.            or request a list of names from-, the non-reporting end-
  1950.            node before deleting its name(s).  The absence of a
  1951.            response, or of the name in a response, will confirm the
  1952.            NBNS decision to delete a name.
  1953.  
  1954.       6.   The absence of reports may cause the NBNS to infer that the
  1955.            end-node has failed.  Similarly, receipt of information
  1956.            widely divergent from what the NBNS believes about the node,
  1957.            may cause the NBNS to consider that the end-node has been
  1958.            restarted.
  1959.  
  1960.            The NBNS may analyze the situation through challenges or
  1961.            requests for a list of names.
  1962.  
  1963.       7.   A very cautious NBNS is free to poll nodes (by sending NAME
  1964.            QUERY REQUEST or NODE STATUS REQUEST packets) to verify that
  1965.            their name status is the same as that registered in the
  1966.            NBNS.
  1967.  
  1968.            NOTE:  Such polling activity, if used at all by an
  1969.            implementation, should be kept at a very low level or
  1970.            enabled only during periods when the NBNS has some reason to
  1971.            suspect that its information base is inaccurate.
  1972.  
  1973.       8.   P and M nodes can detect incorrect name information at
  1974.            session establishment.
  1975.  
  1976.            If incorrect information is found, NBNS is informed via a
  1977.            NAME RELEASE REQUEST originated by the end-node which
  1978.            detects the error.
  1979.  
  1980. 15.1.8.  NAME CACHING
  1981.  
  1982.    An end-node may keep a local cache of NetBIOS name-to-IP address
  1983.    translation entries.
  1984.  
  1985.    All cache entries should be flushed on a periodic basis.
  1986.  
  1987.    In addition, a node ought to flush any cache information associated
  1988.    with an IP address if the node receives any information indicating
  1989.    that there may be any possibility of trouble with the node at that IP
  1990.    address.  For example, if a NAME CONFLICT DEMAND is sent to a node,
  1991.    all cached information about that node should be cleared within the
  1992.    sending node.
  1993.  
  1994. 15.2.  NAME REGISTRATION TRANSACTIONS
  1995.  
  1996. 15.2.1.  NAME REGISTRATION BY B NODES
  1997.  
  1998.    A name claim transaction initiated by a B node is broadcast
  1999.    throughout the broadcast area.  The NAME REGISTRATION REQUEST will be
  2000.  
  2001.  
  2002.  
  2003. NetBIOS Working Group                                          [Page 34]
  2004.  
  2005. RFC 1001                                                      March 1987
  2006.  
  2007.  
  2008.    heard by all B and M nodes in the area.  Each node examines the claim
  2009.    to see whether it it is consistent with the names it owns.  If an
  2010.    inconsistency exists, a NEGATIVE NAME REGISTRATION RESPONSE is
  2011.    unicast to the requestor.  The requesting node obtains ownership of
  2012.    the name (or membership in the group) if, and only if, no NEGATIVE
  2013.    NAME REGISTRATION RESPONSEs are received within the name claim
  2014.    timeout, CONFLICT_TIMER.  (See "Defined Constants and Variables" in
  2015.    the Detailed Specification for the value of this timer.)
  2016.  
  2017.    A B node proclaims its new ownership by broadcasting a NAME OVERWRITE
  2018.    DEMAND.
  2019.  
  2020.                        B-NODE REGISTRATION PROCESS
  2021.    <-----NAME NOT ON NETWORK------>   <----NAME ALREADY EXISTS---->
  2022.  
  2023.    REQ. NODE                      NODE                     REQ.NODE
  2024.                                  HOLDING
  2025.                                   NAME
  2026.  
  2027.    (BROADCAST) REGISTER                        (BROADCAST) REGISTER
  2028.    ------------------->                        <-------------------
  2029.  
  2030.         REGISTER                                     REGISTER
  2031.    ------------------->                        <-------------------
  2032.  
  2033.         REGISTER                         NEGATIVE RESPONSE
  2034.    ------------------->             ------------------------------>
  2035.  
  2036.           OVERWRITE
  2037.    ------------------->               (NODE DOES NOT HAVE THE NAME)
  2038.  
  2039.    (NODE HAS THE NAME)
  2040.  
  2041.    The NAME REGISTRATION REQUEST, like any request, must be repeated if
  2042.    no response is received within BCAST_REQ_RETRY_TIMEOUT.  Transmission
  2043.    of the request is attempted BCAST_REQ_RETRY_COUNT times.
  2044.  
  2045. 15.2.2.  NAME REGISTRATION BY P NODES
  2046.  
  2047.    A name registration may proceed in various  ways depending whether
  2048.    the name being registered is new to the NBNS.  If the name is known
  2049.    to the NBNS, then challenges may be sent to the prior holder(s).
  2050.  
  2051. 15.2.2.1.  NEW NAME, OR NEW GROUP MEMBER
  2052.  
  2053.    The diagram, below, shows the sequence of events when an end-node
  2054.    registers a name which is new to the NBNS.  (The diagram omits WACKs,
  2055.    NBNS redirections, and retransmission of requests.)
  2056.  
  2057.    This same interaction will occur if the name being registered is a
  2058.    group name and the group already exists.  The NBNS will add the
  2059.  
  2060.  
  2061.  
  2062. NetBIOS Working Group                                          [Page 35]
  2063.  
  2064. RFC 1001                                                      March 1987
  2065.  
  2066.  
  2067.    registrant to the set of group members.
  2068.  
  2069.                        P-NODE REGISTRATION PROCESS
  2070.             (server has no previous information about the name)
  2071.  
  2072.               P-NODE                            NBNS
  2073.                           REGISTER
  2074.                 --------------------------------->
  2075.  
  2076.                         POSITIVE RESPONSE
  2077.                 <---------------------------------
  2078.  
  2079.    The interaction is rather simple: the end-node sends a NAME
  2080.    REGISTRATION REQUEST, the NBNS responds with a POSITIVE NAME
  2081.    REGISTRATION RESPONSE.
  2082.  
  2083. 15.2.2.2.  EXISTING NAME AND OWNER IS STILL ACTIVE
  2084.  
  2085.    The following diagram shows interactions when an attempt is made to
  2086.    register a unique name, the NBNS is aware of an existing owner, and
  2087.    that existing owner is still active.
  2088.  
  2089.    There are two sides to the diagram.  The left side shows how a non-
  2090.    secured NBNS would handle the matter.  Secured NBNS activity is shown
  2091.    on the right.
  2092.  
  2093.                        P-NODE REGISTRATION PROCESS
  2094.                (server HAS a previous owner that IS active)
  2095.  
  2096.  
  2097.    <------NON-SECURED STYLE------->  <---------SECURED STYLE------->
  2098.  
  2099.    REQ. NODE           NBNS       NODE         NBNS         REQ.NODE
  2100.                                  HOLDING
  2101.                                   NAME
  2102.  
  2103.          REGISTER                                      REGISTER
  2104.    ------------------->                         <-------------------
  2105.                                        QUERY
  2106.     END-NODE CHALLENGE              <------------
  2107.    <-------------------                QUERY
  2108.                                     <------------
  2109.              QUERY
  2110.    ----------------------------->
  2111.                                      POSITIVE RESP
  2112.              QUERY                   ------------>
  2113.    ----------------------------->                 NEGATIVE RESPONSE
  2114.                                                   ----------------->
  2115.  
  2116.          POSITIVE RESPONSE
  2117.    <----------------------------
  2118.  
  2119.  
  2120.  
  2121. NetBIOS Working Group                                          [Page 36]
  2122.  
  2123. RFC 1001                                                      March 1987
  2124.  
  2125.  
  2126.    A non-secured NBNS will answer the NAME REGISTRATION REQUEST with a
  2127.    END-NODE CHALLENGE REGISTRATION RESPONSE.  This response asks the
  2128.    end-node to issue a challenge transaction against the node indicated
  2129.    in the response.  In this case, the prior node will defend against
  2130.    the challenge and the registering end-node will simply drop the
  2131.    registration attempt without further interaction with the NBNS.
  2132.  
  2133.    A secured NBNS will refrain from answering the NAME REGISTRATION
  2134.    REQUEST until the NBNS has itself challenged the prior holder(s) of
  2135.    the name.  In this case, the NBNS finds that that the name is still
  2136.    being defended and consequently returns a NEGATIVE NAME REGISTRATION
  2137.    RESPONSE to the registrant.
  2138.  
  2139.    Due to the potential time for the secured NBNS to make the
  2140.    challenge(s), it is likely that a WACK will be sent by the NBNS to
  2141.    the registrant.
  2142.  
  2143.    Although not shown in the diagram, a non-secured NBNS will send a
  2144.    NEGATIVE NAME REGISTRATION RESPONSE to a request to register a unique
  2145.    name when there already exists a group of the same name.  A secured
  2146.    NBNS may elect to poll (or challenge) the group members to determine
  2147.    whether any active members remain.  This may impose a heavy load on
  2148.    the network.  It is recommended that group names be allowed to fade-
  2149.    out through the name refresh mechanism.
  2150.  
  2151. 15.2.2.3.  EXISTING NAME AND OWNER IS INACTIVE
  2152.  
  2153.    The following diagram shows interactions when an attempt is made to
  2154.    register a unique name, the NBNS is aware of an existing owner, and
  2155.    that existing owner is no longer active.
  2156.  
  2157.    A non-secured NBNS will answer the NAME REGISTRATION REQUEST with a
  2158.    END-NODE CHALLENGE REGISTRATION RESPONSE.  This response asks the
  2159.    end-node to issue a challenge transaction against the node indicated
  2160.    in the response.  In this case, the prior node will not defend
  2161.    against the challenge.  The registrant will inform the NBNS through a
  2162.    NAME OVERWRITE REQUEST.  The NBNS will replace the prior name
  2163.    information in its database with the information in the overwrite
  2164.    request.
  2165.  
  2166.    A secured NBNS will refrain from answering the NAME REGISTRATION
  2167.    REQUEST until the NBNS has itself challenged the prior holder(s) of
  2168.    the name.  In this case, the NBNS finds that that the name is not
  2169.    being defended and consequently returns a POSITIVE NAME REGISTRATION
  2170.    RESPONSE to the registrant.
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180. NetBIOS Working Group                                          [Page 37]
  2181.  
  2182. RFC 1001                                                      March 1987
  2183.  
  2184.  
  2185.                        P-NODE REGISTRATION PROCESS
  2186.              (server HAS a previous owner that is NOT active)
  2187.  
  2188.  
  2189.    <------NON-SECURED STYLE----->  <----------SECURED STYLE-------->
  2190.  
  2191.    REQ. NODE           NBNS     NODE           NBNS         REQ.NODE
  2192.                                HOLDING
  2193.                                 NAME
  2194.  
  2195.          REGISTER                                    REGISTER
  2196.    ------------------->                         <-------------------
  2197.                                        QUERY
  2198.     END-NODE CHALLENGE             <------------
  2199.    <-------------------                QUERY
  2200.                                    <------------
  2201.          NAME QUERY REQUEST                        POSITIVE RESPONSE
  2202.    ---------------------------->                 ------------------>
  2203.               QUERY
  2204.    ---------------------------->
  2205.  
  2206.        OVERWRITE
  2207.    ------------------->
  2208.  
  2209.     POSITIVE RESPONSE
  2210.    <------------------
  2211.  
  2212.    Due to the potential time for the secured NBNS to make the
  2213.    challenge(s), it is likely that a WACK will be sent by the NBNS to
  2214.    the registrant.
  2215.  
  2216.    A secured NBNS will immediately send a NEGATIVE NAME REGISTRATION
  2217.    RESPONSE in answer to any NAME OVERWRITE REQUESTS it may receive.
  2218.  
  2219. 15.2.3.  NAME REGISTRATION BY M NODES
  2220.  
  2221.    An M node begin a name claim operation as if the node were a B node:
  2222.    it broadcasts a NAME REGISTRATION REQUEST and listens for NEGATIVE
  2223.    NAME REGISTRATION RESPONSEs.  Any NEGATIVE NAME REGISTRATION RESPONSE
  2224.    prevents the M node from obtaining the name and terminates the claim
  2225.    operation.
  2226.  
  2227.    If, however, the M node does not receive any NEGATIVE NAME
  2228.    REGISTRATION RESPONSE, the M node must continue the claim procedure
  2229.    as if the M node were a P node.
  2230.  
  2231.    Only if both name claims were successful does the M node acquire the
  2232.    name.
  2233.  
  2234.    The following diagram illustrates M node name registration:
  2235.  
  2236.  
  2237.  
  2238.  
  2239. NetBIOS Working Group                                          [Page 38]
  2240.  
  2241. RFC 1001                                                      March 1987
  2242.  
  2243.  
  2244.                        M-NODE REGISTRATION PROCESS
  2245.  
  2246.    <---NAME NOT IN BROADCAST AREA--> <--NAME IS IN BROADCAST AREA-->
  2247.  
  2248.    REQ. NODE                       NODE                     REQ.NODE
  2249.                                   HOLDING
  2250.                                    NAME
  2251.  
  2252.    (BROADCAST) REGISTER                         (BROADCAST) REGISTER
  2253.    ------------------->                         <-------------------
  2254.  
  2255.         REGISTER                                     REGISTER
  2256.    ------------------->                         <-------------------
  2257.  
  2258.         REGISTER                        NEGATIVE RESPONSE
  2259.    ------------------->             ------------------------------->
  2260.  
  2261.  
  2262.                  !                     (NODE DOES NOT HAVE THE NAME)
  2263.     INITIATE     !
  2264.     A P-NODE     !
  2265.     REGISTRATION !
  2266.                  V
  2267.  
  2268. 15.3.  NAME QUERY TRANSACTIONS
  2269.  
  2270.    Name query transactions are initiated by end-nodes to obtain the IP
  2271.    address(es) and other attributes associated with a NetBIOS name.
  2272.  
  2273. 15.3.1.  QUERY BY B NODES
  2274.  
  2275.    The following diagram shows how B nodes go about discovering who owns
  2276.    a name.
  2277.  
  2278.    The left half of the diagram illustrates what happens if there are no
  2279.    holders of the name.  In that case no responses are received in
  2280.    answer to the broadcast NAME QUERY REQUEST(s).
  2281.  
  2282.    The right half shows a POSITIVE NAME QUERY RESPONSE unicast by a name
  2283.    holder in answer to the broadcast request.  A name holder will make
  2284.    this response to every NAME QUERY REQUEST that it hears.  And each
  2285.    holder acts this way.  Thus, the node sending the request may receive
  2286.    many responses, some duplicates, and from many nodes.
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298. NetBIOS Working Group                                          [Page 39]
  2299.  
  2300. RFC 1001                                                      March 1987
  2301.  
  2302.  
  2303.                          B-NODE DISCOVERY PROCESS
  2304.  
  2305.  
  2306.    <------NAME NOT ON NETWORK------>  <---NAME PRESENT ON NETWORK-->
  2307.  
  2308.       REQ. NODE                    NODE                     REQ.NODE
  2309.                                   HOLDING
  2310.                                    NAME
  2311.  
  2312.        (BROADCAST) QUERY                           (BROADCAST) QUERY
  2313.    ---------------------->                    <---------------------
  2314.  
  2315.       NAME QUERY REQUEST                          NAME QUERY REQUEST
  2316.    ---------------------->                    <---------------------
  2317.  
  2318.            QUERY                        POSITIVE RESPONSE
  2319.    ---------------------->           ------------------------------>
  2320.  
  2321.    Name query is generally, but not necessarily, a prelude to NetBIOS
  2322.    session establishment or NetBIOS datagram transmission.  However,
  2323.    name query may be used for other purposes.
  2324.  
  2325.    A B node may elect to build a group membership list for subsequent
  2326.    use (e.g. for session establishment) by collecting and saving the
  2327.    responses.
  2328.  
  2329. 15.3.2.  QUERY BY P NODES
  2330.  
  2331.    An NBNS answers queries from a P node with a list of IP address and
  2332.    other information for each owner of the name.  If there are multiple
  2333.    owners (i.e. if the name is a group name), the NBNS loads as many
  2334.    answers into the response as will fit into a UDP packet.  A
  2335.    truncation flag indicates whether any additional owner information
  2336.    remains.  All the information may be obtained by repeating the query
  2337.    over a TCP connection.
  2338.  
  2339.    The NBNS is not required to impose any order on its answer list.
  2340.  
  2341.    The following diagram shows what happens if the NBNS has no
  2342.    information about the name:
  2343.  
  2344.                       P-NODE DISCOVERY PROCESS
  2345.             (server has no information about the name)
  2346.  
  2347.               P-NODE                            NBNS
  2348.                         NAME QUERY REQUEST
  2349.                 --------------------------------->
  2350.  
  2351.                         NEGATIVE RESPONSE
  2352.                 <---------------------------------
  2353.  
  2354.  
  2355.  
  2356.  
  2357. NetBIOS Working Group                                          [Page 40]
  2358.  
  2359. RFC 1001                                                      March 1987
  2360.  
  2361.  
  2362.    The next diagram illustrates interaction between the end-node and the
  2363.    NBNS when the NBNS does have information about the name.  This
  2364.    diagram shows, in addition, the retransmission of the request by the
  2365.    end-node in the absence of a timely response.  Also shown are WACKs
  2366.    (or temporary, intermediate responses) sent by the NBNS to the end-
  2367.    node:
  2368.  
  2369.                      P-NODE QUERY PROCESS
  2370.            (server HAS information about the name)
  2371.  
  2372.         P-NODE                                 NBNS
  2373.                        NAME QUERY REQUEST
  2374.         /---------------------------------------->
  2375.        /
  2376.        !          (OPTIONAL)   WACK
  2377.        !  <- - - - - - - - - - - - - - - - - - - -
  2378.        !         !
  2379.        !timer    !
  2380.        !         ! (optional timer restart)
  2381.        !         !
  2382.         \        V           QUERY
  2383.          \--------------------------------------->
  2384.                               .
  2385.                               .
  2386.                               .
  2387.                             QUERY
  2388.         /---------------------------------------->
  2389.        /
  2390.        !          (OPTIONAL)   WACK
  2391.        !  <- - - - - - - - - - - - - - - - - - - -
  2392.        !         !
  2393.        !timer    !
  2394.        !         ! (optional timer restart)
  2395.        !         !
  2396.         \        V           QUERY
  2397.          \--------------------------------------->
  2398.                               .
  2399.                               .
  2400.  
  2401.                     POSITIVE RESPONSE
  2402.          <-----------------------------------------
  2403.  
  2404.  
  2405.    The following diagram illustrates NBNS redirection.  Upon receipt of
  2406.    a NAME QUERY REQUEST, the NBNS redirects the client to another NBNS.
  2407.    The client repeats the request to the new NBNS and obtains a
  2408.    response.  The diagram shows that response as a POSITIVE NAME QUERY
  2409.    RESPONSE.  However any legal NBNS response may occur in actual
  2410.    operation.
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416. NetBIOS Working Group                                          [Page 41]
  2417.  
  2418. RFC 1001                                                      March 1987
  2419.  
  2420.  
  2421.                            NBNS REDIRECTION
  2422.  
  2423.               P-NODE                            NBNS
  2424.                          NAME QUERY REQUEST
  2425.                 --------------------------------->
  2426.  
  2427.                     REDIRECT NAME QUERY RESPONSE
  2428.                 <---------------------------------
  2429.  
  2430.        (START FROM THE
  2431.         VERY BEGINNING
  2432.         USING THE ADDRESS
  2433.         OF THE NEWLY
  2434.         SUPPLIED NBNS.)
  2435.                                                 NEW
  2436.               P-NODE                            NBNS
  2437.                          NAME QUERY REQUEST
  2438.                 --------------------------------->
  2439.  
  2440.                    POSITIVE NAME QUERY RESPONSE
  2441.                 <---------------------------------
  2442.  
  2443.    The next diagram shows how a P or M node tells the NBNS that the NBNS
  2444.    has provided incorrect information.  This procedure may begin after a
  2445.    DATAGRAM ERROR packet has been received or a session set-up attempt
  2446.    has discovered that the NetBIOS name does not exist at the
  2447.    destination, the IP address of which was obtained from the NBNS
  2448.    during a prior name query transaction.  The NBNS, in this case a
  2449.    secure NBNS, issues queries to verify whether the information is, in
  2450.    fact, incorrect.  The NBNS closes the transaction by sending either a
  2451.    POSITIVE or NEGATIVE NAME RELEASE RESPONSE, depending on the results
  2452.    of the verification.
  2453.  
  2454.                  CORRECTING NBNS INFORMATION BASE
  2455.  
  2456.               P-NODE                            NBNS
  2457.                        NAME RELEASE REQUEST
  2458.                 --------------------------------->
  2459.                                                         QUERY
  2460.                                                   ---------------->
  2461.  
  2462.                                                         QUERY
  2463.                                                   ---------------->
  2464.  
  2465.                                       (NAME TAKEN OFF THE DATABASE
  2466.                                        IF NBNS FINDS IT TO BE
  2467.                                        INCORRECT)
  2468.  
  2469.                     POSITIVE/NEGATIVE RESPONSE
  2470.                 <---------------------------------
  2471.  
  2472.  
  2473.  
  2474.  
  2475. NetBIOS Working Group                                          [Page 42]
  2476.  
  2477. RFC 1001                                                      March 1987
  2478.  
  2479.  
  2480. 15.3.3.  QUERY BY M NODES
  2481.  
  2482.    M node name query follows the B node pattern.  In the absence of
  2483.    adequate results, the M node then continues by performing a P node
  2484.    type query.  This is shown in the following diagram:
  2485.  
  2486.                        M-NODE DISCOVERY PROCESS
  2487.  
  2488.  
  2489.    <---NAME NOT ON BROADCAST AREA-->  <--NAME IS ON BROADCAST AREA->
  2490.  
  2491.    REQ. NODE                       NODE                     REQ.NODE
  2492.                                   HOLDING
  2493.                                    NAME
  2494.  
  2495.        (BROADCAST) QUERY                           (BROADCAST) QUERY
  2496.    --------------------->                    <----------------------
  2497.  
  2498.      NAME QUERY REQUEST                           NAME QUERY REQUEST
  2499.    --------------------->                    <----------------------
  2500.  
  2501.            QUERY                           POSITIVE RESPONSE
  2502.    --------------------->           ------------------------------->
  2503.  
  2504.                    !
  2505.        INITIATE    !
  2506.        A P-NODE    !
  2507.        DISCOVERY   !
  2508.        PROCESS     !
  2509.                    V
  2510.  
  2511.  
  2512.  
  2513. 15.3.4.  ACQUIRE GROUP MEMBERSHIP LIST
  2514.  
  2515.    The entire membership of a group may be acquired by sending a NAME
  2516.    QUERY REQUEST to the NBNS.  The NBNS will respond with a POSITIVE
  2517.    NAME QUERY RESPONSE or a NEGATIVE NAME QUERY RESPONSE.  A negative
  2518.    response completes the procedure and indicates that there are no
  2519.    members in the group.
  2520.  
  2521.    If the positive response has the truncation bit clear, then the
  2522.    response contains the entire list of group members.  If the
  2523.    truncation bit is set, then this entire procedure must be repeated,
  2524.    but using TCP as a foundation rather than UDP.
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534. NetBIOS Working Group                                          [Page 43]
  2535.  
  2536. RFC 1001                                                      March 1987
  2537.  
  2538.  
  2539. 15.4.  NAME RELEASE TRANSACTIONS
  2540.  
  2541. 15.4.1.  RELEASE BY B NODES
  2542.  
  2543.    A NAME RELEASE DEMAND contains the following information:
  2544.  
  2545.      -  NetBIOS name
  2546.      -  The scope of the NetBIOS name
  2547.      -  Name type: unique or group
  2548.      -  IP address of the releasing node
  2549.      -  Transaction ID
  2550.  
  2551.    REQUESTING                                     OTHER
  2552.    B-NODE                                         B-NODES
  2553.                      NAME RELEASE DEMAND
  2554.               ---------------------------------->
  2555.  
  2556. 15.4.2.  RELEASE BY P NODES
  2557.  
  2558.    A NAME RELEASE REQUEST contains the following information:
  2559.  
  2560.      -  NetBIOS name
  2561.      -  The scope of the NetBIOS name
  2562.      -  Name type: unique or group
  2563.      -  IP address of the releasing node
  2564.      -  Transaction ID
  2565.  
  2566.  
  2567.    A NAME RELEASE RESPONSE contains the following information:
  2568.  
  2569.      -  NetBIOS name
  2570.      -  The scope of the NetBIOS name
  2571.      -  Name type: unique or group
  2572.      -  IP address of the releasing node
  2573.      -  Transaction ID
  2574.      -  Result:
  2575.           -  Yes: name was released
  2576.           -  No: name was not released, a reason code is provided
  2577.  
  2578.    REQUESTING
  2579.    P-NODE                                         NBNS
  2580.                      NAME RELEASE REQUEST
  2581.               ---------------------------------->
  2582.  
  2583.                      NAME RELEASE RESPONSE
  2584.               <---------------------------------
  2585.  
  2586. 15.4.3.  RELEASE BY M NODES
  2587.  
  2588.    The name release procedure of the M node is a combination of the P
  2589.    and B node name release procedures.  The M node first performs the P
  2590.  
  2591.  
  2592.  
  2593. NetBIOS Working Group                                          [Page 44]
  2594.  
  2595. RFC 1001                                                      March 1987
  2596.  
  2597.  
  2598.    release procedure.  If the P procedure fails then the release
  2599.    procedure does not continue, it fails.  If and only if the P
  2600.    procedure succeeds then the M node broadcasts the NAME RELEASE DEMAND
  2601.    to the broadcast area, the B procedure.
  2602.  
  2603.    NOTE: An M node typically performs a B-style operation and then a
  2604.          P-style operation.  In this case, however, the P-style
  2605.          operation comes first.
  2606.  
  2607.    The following diagram illustrates the M node name release procedure:
  2608.  
  2609.    <-----P procedure fails-------> <-------P procedure succeeds--->
  2610.  
  2611.    REQUESTING               NBNS    REQUESTING             NBNS
  2612.    M-NODE                           M-NODE
  2613.  
  2614.        NAME RELEASE REQUEST               NAME RELEASE REQUEST
  2615.      -------------------------->       ------------------------>
  2616.  
  2617.        NEGATIVE RELEASE RESPONSE        POSITIVE RELEASE RESPONSE
  2618.      <--------------------------       <-------------------------
  2619.  
  2620.                                                            OTHER
  2621.                                                            M-NODES
  2622.  
  2623.                                            NAME RELEASE DEMAND
  2624.                                         ------------------------>
  2625.  
  2626. 15.5.  NAME MAINTENANCE TRANSACTIONS
  2627.  
  2628. 15.5.1.  NAME REFRESH
  2629.  
  2630.    Name refresh transactions are used to handle the following
  2631.    situations:
  2632.  
  2633.       a)   An NBNS node needs to detect if a P or M node has "silently"
  2634.            gone down, so that names held by that node can be purged
  2635.            from the data base.
  2636.  
  2637.  
  2638.       b)   If the NBNS goes down, it needs to be able to reconstruct
  2639.            the data base when it comes back up.
  2640.  
  2641.  
  2642.       c)   If the network should be partitioned, the NBNS needs to be
  2643.            able to able to update its data base when the network
  2644.            reconnects.
  2645.  
  2646.    Each P or M node is responsible for sending periodic NAME REFRESH
  2647.    REQUESTs for each name that it has registered.  Each refresh packet
  2648.    contains a single name that has been successfully registered by that
  2649.  
  2650.  
  2651.  
  2652. NetBIOS Working Group                                          [Page 45]
  2653.  
  2654. RFC 1001                                                      March 1987
  2655.  
  2656.  
  2657.    node.  The interval between such packets is negotiated between the
  2658.    end node and the NBNS server at the time that the name is initially
  2659.    claimed.  At name claim time, an end node will suggest a refresh
  2660.    timeout value.  The NBNS node can modify this value in the reply
  2661.    packet.  A NBNS node can also choose to tell the end node to not send
  2662.    any refresh packet by using the "infinite" timeout value in the
  2663.    response packet.  The timeout value returned by the NBNS is the
  2664.    actual refresh timeout that the end node must use.
  2665.  
  2666.    When a node sends a NAME REFRESH REQUEST, it must be prepared to
  2667.    receive a negative response.  This would happen, for example, if the
  2668.    the NBNS discovers that the the name had already been assigned to
  2669.    some other node.  If such a response is received, the end node should
  2670.    mark the name as being in conflict.  Such an entry should be treated
  2671.    in the same way as if name conflict had been detected against the
  2672.    name.  The following diagram illustrates name refresh:
  2673.  
  2674.    <-----Successful Refresh-----> <-----Unsuccessful Refresh---->
  2675.  
  2676.    REFRESHING               NBNS   REFRESHING               NBNS
  2677.    NODE                            NODE
  2678.  
  2679.        NAME REFRESH REQUEST             NAME REFRESH REQUEST
  2680.      ------------------------>        ----------------------->
  2681.  
  2682.          POSITIVE RESPONSE                NEGATIVE RESPONSE
  2683.      <------------------------        <-----------------------
  2684.                                     !
  2685.                                     !
  2686.                                     V
  2687.                               MARK NAME IN
  2688.                                 CONFLICT
  2689.  
  2690. 15.5.2.  NAME CHALLENGE
  2691.  
  2692.    Name challenge is done by sending a NAME QUERY REQUEST to an end node
  2693.    of any type.  If a POSITIVE NAME QUERY RESPONSE is returned, then
  2694.    that node still owns the name.  If a NEGATIVE NAME QUERY RESPONSE is
  2695.    received or if no response is received, it can be assumed that the
  2696.    end node no longer owns the name.
  2697.  
  2698.    Name challenge can be performed either by the NBNS node, or by an end
  2699.    node.  When an end-node sends a name claim packet, the NBNS node may
  2700.    do the challenge operation.  The NBNS node can choose, however, to
  2701.    require the end node do the challenge.  In that case, the NBNS will
  2702.    send an END-NODE CHALLENGE RESPONSE packet to the end node, which
  2703.    should then proceed to challenge the putative owner.
  2704.  
  2705.    Note that the name challenge procedure sends a normal NAME QUERY
  2706.    REQUEST packet to the end node.  It does not require a special
  2707.    packet.  The only new packet introduced is the END-NODE CHALLENGE
  2708.  
  2709.  
  2710.  
  2711. NetBIOS Working Group                                          [Page 46]
  2712.  
  2713. RFC 1001                                                      March 1987
  2714.  
  2715.  
  2716.    RESPONSE which is sent by an NBNS node when the NBNS wants the end-
  2717.    node to perform the challenge operation.
  2718.  
  2719. 15.5.3.  CLEAR NAME CONFLICT
  2720.  
  2721.    It is possible during a refresh request from a M or P node for a NBNS
  2722.    to detects a name in conflict.  The response to the NAME REFRESH
  2723.    REQUEST must be a NEGATIVE NAME REGISTRATION RESPONSE.  Optionally,
  2724.    in addition, the NBNS may send a NAME CONFLICT DEMAND or a NAME
  2725.    RELEASE REQUEST to the refreshing node.  The NAME CONFLICT DEMAND
  2726.    forces the node to place the name in the conflict state.  The node
  2727.    will eventually inform it's user of the conflict.  The NAME RELEASE
  2728.    REQUEST will force the node to flush the name from its local name
  2729.    table completely.  This forces the node to flush the name in
  2730.    conflict.  This does not cause termination of existing sessions using
  2731.    this name.
  2732.  
  2733.    The following diagram shows an NBNS detecting and correcting a
  2734.    conflict:
  2735.  
  2736.    REFRESHING NODE                                 NBNS
  2737.  
  2738.                      NAME REFRESH REQUEST
  2739.            ----------------------------------------->
  2740.  
  2741.                NEGATIVE NAME REGISTRATION RESPONSE
  2742.            <-----------------------------------------
  2743.  
  2744.                      NAME CONFLICT DEMAND
  2745.            <-----------------------------------------
  2746.  
  2747.                              OR
  2748.  
  2749.                      NAME RELEASE REQUEST
  2750.            <-----------------------------------------
  2751.  
  2752.                POSITIVE/NEGATIVE RELEASE REQUEST
  2753.            ----------------------------------------->
  2754.  
  2755. 15.6.  ADAPTER STATUS TRANSACTIONS
  2756.  
  2757.    Adapter status is obtained from a node as follows:
  2758.  
  2759.       1.   Perform a name discovery operation to obtain the IP
  2760.            addresses of a set of end-nodes.
  2761.  
  2762.       2.   Repeat until all end-nodes from the set have been used:
  2763.  
  2764.            a.   Select one end-node from the set.
  2765.  
  2766.            b.   Send a NODE STATUS REQUEST to that end-node using UDP.
  2767.  
  2768.  
  2769.  
  2770. NetBIOS Working Group                                          [Page 47]
  2771.  
  2772. RFC 1001                                                      March 1987
  2773.  
  2774.  
  2775.            c.   Await a NODE STATUS RESPONSE.  (If a timely response is
  2776.                 not forthcoming, repeat step "b" UCAST_REQ_RETRY_COUNT
  2777.                 times.  After the last retry, go to step "a".)
  2778.  
  2779.            d.   If the truncation bit is not set in the response, the
  2780.                 response contains the entire node status.  Return the
  2781.                 status to the user and terminate this procedure.
  2782.  
  2783.            e.   If the truncation bit is set in the response, then not
  2784.                 all status was returned because it would not fit into
  2785.                 the response packet.  The responder will set the
  2786.                 truncation bit if the IP datagram length would exceed
  2787.                 MAX_DATAGRAM_LENGTH.  Return the status to the user and
  2788.                 terminate this procedure.
  2789.  
  2790.  
  2791. 3.   Return error to user, no status obtained.
  2792.  
  2793.    The repetition of step 2, above, through all nodes of the set, is
  2794.    optional.
  2795.  
  2796.    Following is an example transaction of a successful Adapter Status
  2797.    operation:
  2798.  
  2799.    REQUESTING NODE                                 NAME OWNER
  2800.  
  2801.                        NAME QUERY REQUEST
  2802.            ----------------------------------------->
  2803.  
  2804.                    POSITIVE NAME QUERY RESPONSE
  2805.            <-----------------------------------------
  2806.  
  2807.                        NODE STATUS REQUEST
  2808.            ----------------------------------------->
  2809.  
  2810.                       NODE STATUS RESPONSE
  2811.            <-----------------------------------------
  2812.  
  2813. 16.  NetBIOS SESSION SERVICE
  2814.  
  2815.    The NetBIOS session service begins after one or more IP addresses
  2816.    have been found for the target name.  These addresses may have been
  2817.    acquired using the NetBIOS name query transactions or by other means,
  2818.    such as a local name table or cache.
  2819.  
  2820.    NetBIOS session service transactions, packets, and protocols are
  2821.    identical for all end-node types.  They involve only directed
  2822.    (point-to-point) communications.
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829. NetBIOS Working Group                                          [Page 48]
  2830.  
  2831. RFC 1001                                                      March 1987
  2832.  
  2833.  
  2834. 16.1.  OVERVIEW OF NetBIOS SESSION SERVICE
  2835.  
  2836.    Session service has three phases:
  2837.  
  2838.      Session establishment - it is during this phase that the IP
  2839.         address and TCP port of the called name is determined, and a
  2840.         TCP connection is established with the remote party.
  2841.  
  2842.      Steady state - it is during this phase that NetBIOS data
  2843.         messages are exchanged over the session.  Keep-alive packets
  2844.         may also be exchanged if the participating nodes are so
  2845.         configured.
  2846.  
  2847.      Session close - a session is closed whenever either a party (in
  2848.         the session) closes the session or it is determined that one
  2849.         of the parties has gone down.
  2850.  
  2851. 16.1.1.  SESSION ESTABLISHMENT PHASE OVERVIEW
  2852.  
  2853.    An end-node begins establishment of a session to another node by
  2854.    somehow acquiring (perhaps using the name query transactions or a
  2855.    local cache) the IP address of the node or nodes purported to own the
  2856.    destination name.
  2857.  
  2858.    Every end-node awaits incoming NetBIOS session requests by listening
  2859.    for TCP calls to a well-known service port, SSN_SRVC_TCP_PORT.  Each
  2860.    incoming TCP connection represents the start of a separate NetBIOS
  2861.    session initiation attempt.  The NetBIOS session server, not the
  2862.    ultimate application, accepts the incoming TCP connection(s).
  2863.  
  2864.    Once the TCP connection is open, the calling node sends session
  2865.    service request packet.  This packet contains the following
  2866.    information:
  2867.  
  2868.      -  Calling IP address (see note)
  2869.      -  Calling NetBIOS name
  2870.      -  Called IP address (see note)
  2871.      -  Called NetBIOS name
  2872.  
  2873.    NOTE: The IP addresses are obtained from the TCP service
  2874.          interface.
  2875.  
  2876.    When the session service request packet arrives at the NetBIOS
  2877.    server, one of the the following situations will exist:
  2878.  
  2879.    -    There exists a NetBIOS LISTEN compatible with the incoming
  2880.         call and there are adequate resources to permit session
  2881.         establishment to proceed.
  2882.  
  2883.    -    There exists a NetBIOS LISTEN compatible with the incoming
  2884.         call, but there are inadequate resources to permit
  2885.  
  2886.  
  2887.  
  2888. NetBIOS Working Group                                          [Page 49]
  2889.  
  2890. RFC 1001                                                      March 1987
  2891.  
  2892.  
  2893.         establishment of a session.
  2894.  
  2895.    -    The called name does, in fact, exist on the called node, but
  2896.         there is no pending NetBIOS LISTEN compatible with the
  2897.         incoming call.
  2898.  
  2899.    -    The called name does not exist on the called node.
  2900.  
  2901.    In all but the first case, a rejection response is sent back over the
  2902.    TCP connection to the caller.  The TCP connection is then closed and
  2903.    the session phase terminates.  Any retry is the responsibility of the
  2904.    caller.  For retries in the case of a group name, the caller may use
  2905.    the next member of the group rather than immediately retrying the
  2906.    instant address.  In the case of a unique name, the caller may
  2907.    attempt an immediate retry using the same target IP address unless
  2908.    the called name did not exist on the called node.  In that one case,
  2909.    the NetBIOS name should be re-resolved.
  2910.  
  2911.    If a compatible LISTEN exists, and there are adequate resources, then
  2912.    the session server may transform the existing TCP connection into the
  2913.    NetBIOS data session.  Alternatively, the session server may
  2914.    redirect, or "retarget" the caller to another TCP port (and IP
  2915.    address).
  2916.  
  2917.    If the caller is redirected, the caller begins the session
  2918.    establishment anew, but using the new IP address and TCP port given
  2919.    in the retarget response.  Again a TCP connection is created, and
  2920.    again the calling and called node exchange credentials.  The called
  2921.    party may accept the call, reject the call, or make a further
  2922.    redirection.
  2923.  
  2924.    This mechanism is based on the presumption that, on hosts where it is
  2925.    not possible to transfer open TCP connections between processes, the
  2926.    host will have a central session server.  Applications willing to
  2927.    receive NetBIOS calls will obtain an ephemeral TCP port number, post
  2928.    a TCP unspecified passive open on that port, and then pass that port
  2929.    number and NetBIOS name information to the NetBIOS session server
  2930.    using a NetBIOS LISTEN operation.  When the call is placed, the
  2931.    session server will "retarget" the caller to the application's TCP
  2932.    socket.  The caller will then place a new call, directly to the
  2933.    application.  The application has the responsibility to mimic the
  2934.    session server at least to the extent of receiving the calling
  2935.    credentials and then accepting or rejecting the call.
  2936.  
  2937. 16.1.1.1.  RETRYING AFTER BEING RETARGETTED
  2938.  
  2939.    A calling node may find that it can not establish a session with a
  2940.    node to which it was directed by the retargetting procedure.  Since
  2941.    retargetting may be nested, there is an issue whether the caller
  2942.    should begin a retry at the initial starting point or back-up to an
  2943.    intermediate retargetting point.  The caller may use any method.  A
  2944.  
  2945.  
  2946.  
  2947. NetBIOS Working Group                                          [Page 50]
  2948.  
  2949. RFC 1001                                                      March 1987
  2950.  
  2951.  
  2952.    discussion of two such methods is in Appendix B, "Retarget
  2953.    Algorithms".
  2954.  
  2955. 16.1.1.2.  SESSION ESTABLISHMENT TO A GROUP NAME
  2956.  
  2957.    Session establishment with a group name requires special
  2958.    consideration.  When a NetBIOS CALL attempt is made to a group name,
  2959.    name discovery will result in a list (possibly incomplete) of the
  2960.    members of that group.  The calling node selects one member from the
  2961.    list and attempts to build a session.  If that fails, the calling
  2962.    node may select another member and make another attempt.
  2963.  
  2964.    When the session service attempts to make a connection with one of
  2965.    the members of the group, there is no guarantee that that member has
  2966.    a LISTEN pending against that group name, that the called node even
  2967.    owns, or even that the called node is operating.
  2968.  
  2969. 16.1.2.  STEADY STATE PHASE OVERVIEW
  2970.  
  2971.    NetBIOS data messages are exchanged in the steady state.  NetBIOS
  2972.    messages are sent by prepending the user data with a message header
  2973.    and sending the header and the user data over the TCP connection.
  2974.    The receiver removes the header and passes the data to the NetBIOS
  2975.    user.
  2976.  
  2977.    In order to detect failure of one of the nodes or of the intervening
  2978.    network, "session keep alive" packets may be periodically sent in the
  2979.    steady state.
  2980.  
  2981.    Any failure of the underlying TCP connection, whether a reset, a
  2982.    timeout, or other failure, implies failure of the NetBIOS session.
  2983.  
  2984. 16.1.3.  SESSION TERMINATION PHASE OVERVIEW
  2985.  
  2986.    A NetBIOS session is terminated normally when the user requests the
  2987.    session to be closed or when the session service detects the remote
  2988.    partner of the session has gracefully terminated the TCP connection.
  2989.    A NetBIOS session is abnormally terminated when the session service
  2990.    detects a loss of the connection.  Connection loss can be detected
  2991.    with the keep-alive function of the session service or TCP, or on the
  2992.    failure of a SESSION MESSAGE send operation.
  2993.  
  2994.    When a user requests to close a session, the service first attempts a
  2995.    graceful in-band close of the TCP connection.  If the connection does
  2996.    not close within the SSN_CLOSE_TIMEOUT the TCP connection is aborted.
  2997.    No matter how the TCP connection is terminated, the NetBIOS session
  2998.    service always closes the NetBIOS session.
  2999.  
  3000.    When the session service receives an indication from TCP that a
  3001.    connection close request has been received, the TCP connection and
  3002.    the NetBIOS session are immediately closed and the user is informed
  3003.  
  3004.  
  3005.  
  3006. NetBIOS Working Group                                          [Page 51]
  3007.  
  3008. RFC 1001                                                      March 1987
  3009.  
  3010.  
  3011.    of the loss of the session.  All data received up to the close
  3012.    indication should be delivered, if possible, to the session's user.
  3013.  
  3014. 16.2.  SESSION ESTABLISHMENT PHASE
  3015.  
  3016.    All the following diagrams assume a name query operation was
  3017.    successfully completed by the caller node for the listener's name.
  3018.  
  3019.    This first diagram shows the sequence of network events used to
  3020.    successfully establish a session without retargetting by the
  3021.    listener.  The TCP connection is first established with the well-
  3022.    known NetBIOS session service TCP port, SSN_SRVC_TCP_PORT.  The
  3023.    caller then sends a SESSION REQUEST packet over the TCP connection
  3024.    requesting a session with the listener.  The SESSION REQUEST contains
  3025.    the caller's name and the listener's name.  The listener responds
  3026.    with a POSITIVE SESSION RESPONSE informing the caller this TCP
  3027.    connection is accepted as the connection for the data transfer phase
  3028.    of the session.
  3029.  
  3030.            CALLER                          LISTENER
  3031.  
  3032.                        TCP CONNECT
  3033.            ====================================>
  3034.                         TCP ACCEPT
  3035.            <===================================
  3036.                      SESSION REQUEST
  3037.            ------------------------------------>
  3038.                     POSITIVE RESPONSE
  3039.            <-----------------------------------
  3040.  
  3041.    The second diagram shows the sequence of network events used to
  3042.    successfully establish a session when the listener does retargetting.
  3043.    The session establishment procedure is the same as with the first
  3044.    diagram up to the listener's response to the SESSION REQUEST.  The
  3045.    listener, divided into two sections, the listen processor and the
  3046.    actual listener, sends a SESSION RETARGET RESPONSE to the caller.
  3047.    This response states the call is acceptable, but the data transfer
  3048.    TCP connection must be at the new IP address and TCP port.  The
  3049.    caller then re-iterates the session establishment process anew with
  3050.    the new IP address and TCP port after the initial TCP connection is
  3051.    closed.  The new listener then accepts this connection for the data
  3052.    transfer phase with a POSITIVE SESSION RESPONSE.
  3053.  
  3054.            CALLER                  LISTEN PROCESSOR        LISTENER
  3055.  
  3056.                    TCP CONNECT
  3057.            =============================>
  3058.                    TCP ACCEPT
  3059.            <=============================
  3060.                    SESSION REQUEST
  3061.            ----------------------------->
  3062.  
  3063.  
  3064.  
  3065. NetBIOS Working Group                                          [Page 52]
  3066.  
  3067. RFC 1001                                                      March 1987
  3068.  
  3069.  
  3070.               SESSION RETARGET RESPONSE
  3071.            <-----------------------------
  3072.                    TCP CLOSE
  3073.            <=============================
  3074.                    TCP CLOSE
  3075.            =============================>
  3076.  
  3077.                        TCP CONNECT
  3078.            ====================================================>
  3079.                         TCP ACCEPT
  3080.            <====================================================
  3081.                      SESSION REQUEST
  3082.            ---------------------------------------------------->
  3083.                     POSITIVE RESPONSE
  3084.            <----------------------------------------------------
  3085.  
  3086.    The third diagram is the sequence of network events for a rejected
  3087.    session request with the listener.  This type of rejection could
  3088.    occur with either a non-retargetting listener or a retargetting
  3089.    listener.  After the TCP connection is established at
  3090.    SSN_SRVC_TCP_PORT, the caller sends the SESSION REQUEST over the TCP
  3091.    connection.  The listener does not have either a listen pending for
  3092.    the listener's name or the pending NetBIOS listen is specific to
  3093.    another caller's name.  Consequently, the listener sends a NEGATIVE
  3094.    SESSION RESPONSE and closes the TCP connection.
  3095.  
  3096.            CALLER                          LISTENER
  3097.  
  3098.                         TCP CONNECT
  3099.            ====================================>
  3100.                         TCP ACCEPT
  3101.            <===================================
  3102.                      SESSION REQUEST
  3103.            ------------------------------------>
  3104.                     NEGATIVE RESPONSE
  3105.            <-----------------------------------
  3106.                         TCP CLOSE
  3107.            <===================================
  3108.                         TCP CLOSE
  3109.            ====================================>
  3110.  
  3111.    The fourth diagram is the sequence of network events when session
  3112.    establishment fails with a retargetting listener.  After being
  3113.    redirected, and after the initial TCP connection is closed the caller
  3114.    tries to establish a TCP connection with the new IP address and TCP
  3115.    port.  The connection fails because either the port is unavailable or
  3116.    the target node is not active.  The port unavailable race condition
  3117.    occurs if another caller has already acquired the TCP connection with
  3118.    the listener.  For additional implementation suggestions, see
  3119.    Appendix B, "Retarget Algorithms".
  3120.  
  3121.  
  3122.  
  3123.  
  3124. NetBIOS Working Group                                          [Page 53]
  3125.  
  3126. RFC 1001                                                      March 1987
  3127.  
  3128.  
  3129.            CALLER                  LISTEN PROCESSOR        LISTENER
  3130.  
  3131.                    TCP CONNECT
  3132.            =============================>
  3133.                    TCP ACCEPT
  3134.            <=============================
  3135.                    SESSION REQUEST
  3136.            ----------------------------->
  3137.                    REDIRECT RESPONSE
  3138.            <-----------------------------
  3139.                    TCP CLOSE
  3140.            <=============================
  3141.                    TCP CLOSE
  3142.            =============================>
  3143.  
  3144.                        TCP CONNECT
  3145.            ====================================================>
  3146.  
  3147.                      CONNECTION REFUSED OR TIMED OUT
  3148.            <===================================================
  3149.  
  3150.  
  3151. 16.3.  SESSION DATA TRANSFER PHASE
  3152.  
  3153. 16.3.1.  DATA ENCAPSULATION
  3154.  
  3155.    NetBIOS messages are exchanged in the steady state.  Messages are
  3156.    sent by prepending user data with message header and sending the
  3157.    header and the user data over the TCP connection.  The receiver
  3158.    removes the header and delivers the NetBIOS data to the user.
  3159.  
  3160. 16.3.2.  SESSION KEEP-ALIVES
  3161.  
  3162.    In order to detect node failure or network partitioning, "session
  3163.    keep alive" packets are periodically sent in the steady state.  A
  3164.    session keep alive packet is discarded by a peer node.
  3165.  
  3166.    A session keep alive timer is maintained for each session.  This
  3167.    timer is reset whenever any data is sent to, or received from, the
  3168.    session peer.  When the timer expires, a NetBIOS session keep-alive
  3169.    packet is sent on the TCP connection.  Sending the keep-alive packet
  3170.    forces data to flow on the TCP connection, thus indirectly causing
  3171.    TCP to detect whether the connection is still active.
  3172.  
  3173.    Since many TCP implementations provide a parallel TCP "keep- alive"
  3174.    mechanism, the NetBIOS session keep-alive is made a configurable
  3175.    option.  It is recommended that the NetBIOS keep- alive mechanism be
  3176.    used only in the absence of TCP keep-alive.
  3177.  
  3178.    Note that unlike TCP keep alives, NetBIOS session keep alives do not
  3179.    require a response from the NetBIOS peer -- the fact that it was
  3180.  
  3181.  
  3182.  
  3183. NetBIOS Working Group                                          [Page 54]
  3184.  
  3185. RFC 1001                                                      March 1987
  3186.  
  3187.  
  3188.    possible to send the NetBIOS session keep alive is sufficient
  3189.    indication that the peer, and the connection to it, are still active.
  3190.  
  3191.    The only requirement for interoperability is that when a session keep
  3192.    alive packet is received, it should be discarded.
  3193.  
  3194. 17.  NETBIOS DATAGRAM SERVICE
  3195.  
  3196. 17.1.  OVERVIEW OF NetBIOS DATAGRAM SERVICE
  3197.  
  3198.    Every NetBIOS datagram has a named destination and source.  To
  3199.    transmit a NetBIOS datagram, the datagram service must perform a name
  3200.    query operation to learn the IP address and the attributes of the
  3201.    destination NetBIOS name.  (This information may be cached to avoid
  3202.    the overhead of name query on subsequent NetBIOS datagrams.)
  3203.  
  3204.    NetBIOS datagrams are carried within UDP packets.  If a NetBIOS
  3205.    datagram is larger than a single UDP packet, it may be fragmented
  3206.    into several UDP packets.
  3207.  
  3208.    End-nodes may receive NetBIOS datagrams addressed to names not held
  3209.    by the receiving node.  Such datagrams should be discarded.  If the
  3210.    name is unique then a DATAGRAM ERROR packet is sent to the source of
  3211.    that NetBIOS datagram.
  3212.  
  3213. 17.1.1.  UNICAST, MULTICAST, AND BROADCAST
  3214.  
  3215.    NetBIOS datagrams may be unicast, multicast, or broadcast.  A NetBIOS
  3216.    datagram addressed to a unique NetBIOS name is unicast.  A NetBIOS
  3217.    datatgram addressed to a group NetBIOS name, whether there are zero,
  3218.    one, or more actual members, is multicast.  A NetBIOS datagram sent
  3219.    using the NetBIOS "Send Broadcast Datagram" primitive is broadcast.
  3220.  
  3221. 17.1.2.  FRAGMENTATION OF NetBIOS DATAGRAMS
  3222.  
  3223.    When the header and data of a NetBIOS datagram exceeds the maximum
  3224.    amount of data allowed in a UDP packet, the NetBIOS datagram must be
  3225.    fragmented before transmission and reassembled upon receipt.
  3226.  
  3227.    A NetBIOS Datagram is composed of the following protocol elements:
  3228.  
  3229.      -  IP header of 20 bytes (minimum)
  3230.      -  UDP header of 8 bytes
  3231.      -  NetBIOS Datagram Header of 14 bytes
  3232.      -  The NetBIOS Datagram data.
  3233.  
  3234.    The NetBIOS Datagram data section is composed of 3 parts:
  3235.  
  3236.      -  Source NetBIOS name (255 bytes maximum)
  3237.      -  Destination NetBIOS name (255 bytes maximum)
  3238.      -  The NetBIOS user's data (maximum of 512 bytes)
  3239.  
  3240.  
  3241.  
  3242. NetBIOS Working Group                                          [Page 55]
  3243.  
  3244. RFC 1001                                                      March 1987
  3245.  
  3246.  
  3247.    The two name fields are in second level encoded format (see section
  3248.    14.)
  3249.  
  3250.    A maximum size NetBIOS datagram is 1064 bytes.  The minimal maximum
  3251.    IP datagram size is 576 bytes.  Consequently, a NetBIOS Datagram may
  3252.    not fit into a single IP datagram.  This makes it necessary to permit
  3253.    the fragmentation of NetBIOS Datagrams.
  3254.  
  3255.    On networks meeting or exceeding the minimum IP datagram length
  3256.    requirement of 576 octets, at most two NetBIOS datagram fragments
  3257.    will be generated.  The protocols and packet formats accommodate
  3258.    fragmentation into three or more parts.
  3259.  
  3260.    When a NetBIOS datagram is fragmented, the IP, UDP and NetBIOS
  3261.    Datagram headers are present in each fragment.  The NetBIOS Datagram
  3262.    data section is split among resulting UDP datagrams.  The data
  3263.    sections of NetBIOS datagram fragments do not overlap. The only
  3264.    fields of the NetBIOS Datagram header that would vary are the FLAGS
  3265.    and OFFSET fields.
  3266.  
  3267.    The FIRST bit in the FLAGS field indicate whether the fragment is the
  3268.    first in a sequence of fragments.  The MORE bit in the FLAGS field
  3269.    indicates whether other fragments follow.
  3270.  
  3271.    The OFFSET field is the byte offset from the beginning of the NetBIOS
  3272.    datagram data section to the first byte of the data section in a
  3273.    fragment.  It is 0 for the first fragment.  For each subsequent
  3274.    fragment, OFFSET is the sum of the bytes in the NetBIOS data sections
  3275.    of all preceding fragments.
  3276.  
  3277.    If the NetBIOS datagram was not fragmented:
  3278.  
  3279.      -  FIRST = TRUE
  3280.      -  MORE = FALSE
  3281.      -  OFFSET = 0
  3282.  
  3283.    If the NetBIOS datagram was fragmented:
  3284.  
  3285.      -  First fragment:
  3286.           -  FIRST = TRUE
  3287.           -  MORE = TRUE
  3288.           -  OFFSET = 0
  3289.  
  3290.      -  Intermediate fragments:
  3291.           -  FIRST = FALSE
  3292.           -  MORE = TRUE
  3293.           -  OFFSET = sum(NetBIOS data in prior fragments)
  3294.  
  3295.      -  Last fragment:
  3296.           -  FIRST = FALSE
  3297.           -  MORE = FALSE
  3298.  
  3299.  
  3300.  
  3301. NetBIOS Working Group                                          [Page 56]
  3302.  
  3303. RFC 1001                                                      March 1987
  3304.  
  3305.  
  3306.           -  OFFSET = sum(NetBIOS data in prior fragments)
  3307.  
  3308.    The relative position of intermediate fragments may be ascertained
  3309.    from OFFSET.
  3310.  
  3311.    An NBDD must remember the destination name of the first fragment in
  3312.    order to relay the subsequent fragments of a single NetBIOS datagram.
  3313.    The name information can be associated with the subsequent fragments
  3314.    through the transaction ID, DGM_ID, and the SOURCE_IP, fields of the
  3315.    packet.  This information can be purged by the NBDD after the last
  3316.    fragment has been processed or FRAGMENT_TO time has expired since the
  3317.    first fragment was received.
  3318.  
  3319. 17.2.  NetBIOS DATAGRAMS BY B NODES
  3320.  
  3321.    For NetBIOS datagrams with a named destination (i.e. non- broadcast),
  3322.    a B node performs a name discovery for the destination name before
  3323.    sending the datagram.  (Name discovery may be bypassed if information
  3324.    from a previous discovery is held in a cache.)  If the name type
  3325.    returned by name discovery is UNIQUE, the datagram is unicast to the
  3326.    sole owner of the name.  If the name type is GROUP, the datagram is
  3327.    broadcast to the entire broadcast area using the destination IP
  3328.    address BROADCAST_ADDRESS.
  3329.  
  3330.    A receiving node always filters datagrams based on the destination
  3331.    name.  If the destination name is not owned by the node or if no
  3332.    RECEIVE DATAGRAM user operations are pending for the name, then the
  3333.    datagram is discarded.  For datagrams with a UNIQUE name destination,
  3334.    if the name is not owned by the node then the receiving node sends a
  3335.    DATAGRAM ERROR packet.  The error packet originates from the
  3336.    DGM_SRVC_UDP_PORT and is addressed to the SOURCE_IP and SOURCE_PORT
  3337.    from the bad datagram.  The receiving node quietly discards datagrams
  3338.    with a GROUP name destination if the name is not owned by the node.
  3339.  
  3340.    Since broadcast NetBIOS datagrams do not have a named destination,
  3341.    the B node sends the DATAGRAM SERVICE packet(s) to the entire
  3342.    broadcast area using the destination IP address BROADCAST_ADDRESS.
  3343.    In order for the receiving nodes to distinguish this datagram as a
  3344.    broadcast NetBIOS datagram, the NetBIOS name used as the destination
  3345.    name is '*' (hexadecimal 2A) followed by 15 bytes of hexidecimal 00.
  3346.    The NetBIOS scope identifier is appended to the name before it is
  3347.    converted into second-level encoding.  For example, if the scope
  3348.    identifier is "NETBIOS.SCOPE" then the first-level encoded name would
  3349.    be:
  3350.  
  3351.         CKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.NETBIOS.SCOPE
  3352.  
  3353.    According to [2], a user may not provide a NetBIOS name beginning
  3354.    with "*".
  3355.  
  3356.    For each node in the broadcast area that receives the NetBIOS
  3357.  
  3358.  
  3359.  
  3360. NetBIOS Working Group                                          [Page 57]
  3361.  
  3362. RFC 1001                                                      March 1987
  3363.  
  3364.  
  3365.    broadcast datagram, if any RECEIVE BROADCAST DATAGRAM user operations
  3366.    are pending then the data from the NetBIOS datagram is replicated and
  3367.    delivered to each.  If no such operations are pending then the node
  3368.    silently discards the datagram.
  3369.  
  3370. 17.3.  NetBIOS DATAGRAMS BY P AND M NODES
  3371.  
  3372.    P and M nodes do not use IP broadcast to distribute NetBIOS
  3373.    datagrams.
  3374.  
  3375.    Like B nodes, P and M nodes must perform a name discovery or use
  3376.    cached information to learn whether a destination name is a group or
  3377.    a unique name.
  3378.  
  3379.    Datagrams to unique names are unicast directly to the destination by
  3380.    P and M nodes, exactly as they are by B nodes.
  3381.  
  3382.    Datagrams to group names and NetBIOS broadcast datagrams are unicast
  3383.    to the NBDD.  The NBDD then relays the datagrams to each of the nodes
  3384.    specified by the destination name.
  3385.  
  3386.    An NBDD may not be capable of sending a NetBIOS datagram to a
  3387.    particular NetBIOS name, including the broadcast NetBIOS name ("*")
  3388.    defined above.  A query mechanism is available to the end- node to
  3389.    determine if a NBDD will be able to relay a datagram to a given name.
  3390.    Before a datagram, or its fragments, are sent to the NBDD the P or M
  3391.    node may send a DATAGRAM QUERY REQUEST packet to the NBDD with the
  3392.    DESTINATION_NAME from the DATAGRAM SERVICE packet(s).  The NBDD will
  3393.    respond with a DATAGRAM POSITIVE QUERY RESPONSE if it will relay
  3394.    datagrams to the specified destination name.  After a positive
  3395.    response the end-node unicasts the datagram to the NBDD.  If the NBDD
  3396.    will not be able to relay a datagram to the destination name
  3397.    specified in the query, a DATAGRAM NEGATIVE QUERY RESPONSE packet is
  3398.    returned.  If the NBDD can not distribute a datagram, the end-node
  3399.    then has the option of getting the name's owner list from the NBNS
  3400.    and sending the datagram directly to each of the owners.
  3401.  
  3402.    An NBDD must be able to respond to DATAGRAM QUERY REQUEST packets.
  3403.    The response may always be positive.  However, the usage or
  3404.    implementation of the query mechanism by a P or M node is optional.
  3405.    An implementation may always unicast the NetBIOS datagram to the NBDD
  3406.    without asking if it will be relayed.  Except for the datagram query
  3407.    facility described above, an NBDD provides no feedback to indicate
  3408.    whether it forwarded a datagram.
  3409.  
  3410. 18.  NODE CONFIGURATION PARAMETERS
  3411.  
  3412.      -  B NODES:
  3413.           -  Node's permanent unique name
  3414.           -  Whether IGMP is in use
  3415.           -  Broadcast IP address to use
  3416.  
  3417.  
  3418.  
  3419. NetBIOS Working Group                                          [Page 58]
  3420.  
  3421. RFC 1001                                                      March 1987
  3422.  
  3423.  
  3424.           -  Whether NetBIOS session keep-alives are needed
  3425.           -  Usable UDP data field length (to control fragmentation)
  3426.      -  P NODES:
  3427.           -  Node's permanent unique name
  3428.           -  IP address of NBNS
  3429.           -  IP address of NBDD
  3430.           -  Whether NetBIOS session keep-alives are needed
  3431.           -  Usable UDP data field length (to control fragmentation)
  3432.      -  M NODES:
  3433.           -  Node's permanent unique name
  3434.           -  Whether IGMP is in use
  3435.           -  Broadcast IP address to use
  3436.           -  IP address of NBNS
  3437.           -  IP address of NBDD
  3438.           -  Whether NetBIOS session keep-alives are needed
  3439.           -  Usable UDP data field length (to control fragmentation)
  3440.  
  3441.  
  3442. 19.  MINIMAL CONFORMANCE
  3443.  
  3444.    To ensure multi-vendor interoperability, a minimally conforming
  3445.    implementation based on this specification must observe the following
  3446.    rules:
  3447.  
  3448.    a)   A node designed to work only in a broadcast area must
  3449.         conform to the B node specification.
  3450.  
  3451.    b)   A node designed to work only in an internet must conform to
  3452.         the P node specification.
  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. NetBIOS Working Group                                          [Page 59]
  3479.  
  3480. RFC 1001                                                      March 1987
  3481.  
  3482.  
  3483.  
  3484. REFERENCES
  3485.  
  3486.  
  3487.       [1]  "Protocol Standard For a NetBIOS Service on a TCP/UDP
  3488.            Transport: Detailed Specifications", RFC 1002, March 1987.
  3489.  
  3490.       [2]  IBM Corp., "IBM PC Network Technical Reference Manual", No.
  3491.            6322916, First Edition, September 1984.
  3492.  
  3493.       [3]  J. Postel (Ed.), "Transmission Control Protocol", RFC 793,
  3494.            September 1981.
  3495.  
  3496.       [4]  MIL-STD-1778
  3497.  
  3498.       [5]  J. Postel, "User Datagram Protocol", RFC 768, 28 August
  3499.            1980.
  3500.  
  3501.       [6]  J. Reynolds, J. Postel, "Assigned Numbers", RFC 990,
  3502.            November 1986.
  3503.  
  3504.       [7]  J.  Postel, "Internet Protocol", RFC 791, September 1981.
  3505.  
  3506.       [8]  J. Mogul, "Internet Subnets", RFC 950, October 1984
  3507.  
  3508.       [9]  J.  Mogul, "Broadcasting Internet Datagrams in the Presence
  3509.            of Subnets", RFC 922, October 1984.
  3510.  
  3511.       [10] J.  Mogul, "Broadcasting Internet Datagrams", RFC 919,
  3512.            October 1984.
  3513.  
  3514.       [11] P. Mockapetris, "Domain Names - Concepts and Facilities",
  3515.            RFC 882, November 1983.
  3516.  
  3517.       [12] P. Mockapetris, "Domain Names - Implementation and
  3518.            Specification", RFC 883, November 1983.
  3519.  
  3520.       [13] P. Mockapetris, "Domain System Changes and Observations",
  3521.            RFC 973, January 1986.
  3522.  
  3523.       [14] C. Partridge, "Mail Routing and the Domain System", RFC 974,
  3524.            January 1986.
  3525.  
  3526.       [15] S. Deering, D. Cheriton, "Host Groups: A Multicast Extension
  3527.            to the Internet Protocol", RFC 966, December 1985.
  3528.  
  3529.       [16] S. Deering, "Host Extensions for IP Multicasting", RFC 988,
  3530.            July 1986.
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537. NetBIOS Working Group                                          [Page 60]
  3538.  
  3539. RFC 1001                                                      March 1987
  3540.  
  3541.  
  3542. APPENDIX A
  3543.  
  3544.  
  3545.    This appendix contains supporting technical discussions.  It is not
  3546.    an integral part of the NetBIOS-over-TCP specification.
  3547.  
  3548.    INTEGRATION WITH INTERNET GROUP MULTICASTING
  3549.  
  3550.    The Netbios-over-TCP system described in this RFC may be easily
  3551.    integrated with the Internet Group Multicast system now being
  3552.    developed for the internet.
  3553.  
  3554.    In the main body of the RFC, the notion of a broadcast area was
  3555.    considered to be a single MAC-bridged "B-LAN".  However, the
  3556.    protocols defined will operate over an extended broadcast area
  3557.    resulting from the creation of a permanent Internet Multicast Group.
  3558.  
  3559.    Each separate broadcast area would be based on a separate permanent
  3560.    Internet Multicast Group.  This multicast group address would be used
  3561.    by B and M nodes as their BROADCAST_ADDRESS.
  3562.  
  3563.    In order to base the broadcast area on a multicast group certain
  3564.    additional procedures are required and certain constraints must be
  3565.    met.
  3566.  
  3567. A-1.  ADDITIONAL PROTOCOL REQUIRED IN B AND M NODES
  3568.  
  3569.    All B or M nodes operating on an IGMP based broadcast area must have
  3570.    IGMP support in their IP layer software.  These nodes must perform an
  3571.    IGMP join operation to enter the IGMP group before engaging in
  3572.    NetBIOS activity.
  3573.  
  3574. A-2.  CONSTRAINTS
  3575.  
  3576.    Broadcast Areas may overlap.  For this reason, end-nodes must be
  3577.    careful to examine the NetBIOS scope identifiers in all received
  3578.    broadcast packets.
  3579.  
  3580.    The NetBIOS broadcast protocols were designed for a network that
  3581.    exhibits a low average transit time and low rate of packet loss.  An
  3582.    IGMP based broadcast area must exhibit these characteristics.  In
  3583.    practice this will tend to constrain IGMP broadcast areas to a campus
  3584.    of networks interconnected by high-speed routers and inter-router
  3585.    links.  It is unlikely that transcontinental broadcast areas would
  3586.    exhibit the required characteristics.
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596. NetBIOS Working Group                                          [Page 61]
  3597.  
  3598. RFC 1001                                                      March 1987
  3599.  
  3600.  
  3601. APPENDIX B
  3602.  
  3603.  
  3604.    This appendix contains supporting technical discussions.  It is not
  3605.    an integral part of the NetBIOS-over-TCP specification.
  3606.  
  3607. IMPLEMENTATION CONSIDERATIONS
  3608.  
  3609. B-1.  IMPLEMENTATION MODELS
  3610.  
  3611.    On any participating system, there must be some sort of NetBIOS
  3612.    Service to coordinate access by NetBIOS applications on that system.
  3613.  
  3614.    To analyze the impact of the NetBIOS-over-TCP architecture, we use
  3615.    the following three models of how a NetBIOS service might be
  3616.    implemented:
  3617.  
  3618.    1.   Combined Service and Application Model
  3619.  
  3620.         The NetBIOS service and application are both contained
  3621.         within a single process.  No interprocess communication is
  3622.         assumed within the system; all communication is over the
  3623.         network.  If multiple applications require concurrent access
  3624.         to the NetBIOS service, they must be folded into this
  3625.         monolithic process.
  3626.  
  3627.  
  3628.    2.   Common Kernel Element Model
  3629.  
  3630.         The NetBIOS Service is part of the operating system (perhaps
  3631.         as a device driver or a front-end processor).  The NetBIOS
  3632.         applications are normal operating system application
  3633.         processes.  The common element NetBIOS service contains all
  3634.         the information, such as the name and listen tables,
  3635.         required to co-ordinate the activities of the applications.
  3636.  
  3637.  
  3638.    3.   Non-Kernel Common Element Model
  3639.  
  3640.         The NetBIOS Service is implemented as an operating system
  3641.         application process.  The NetBIOS applications are other
  3642.         operating system application processes.  The service and the
  3643.         applications exchange data via operating system interprocess
  3644.         communication.  In a multi-processor (e.g.  network)
  3645.         operating system, each module may reside on a different cpu.
  3646.         The NetBIOS service process contains all the shared
  3647.         information required to coordinate the activities of the
  3648.         NetBIOS applications.  The applications may still require a
  3649.         subroutine library to facilitate access to the NetBIOS
  3650.         service.
  3651.  
  3652.  
  3653.  
  3654.  
  3655. NetBIOS Working Group                                          [Page 62]
  3656.  
  3657. RFC 1001                                                      March 1987
  3658.  
  3659.  
  3660.    For any of the implementation models, the TCP/IP service can be
  3661.    located in the operating system or split among the NetBIOS
  3662.    applications and the NetBIOS service processes.
  3663.  
  3664. B-1.1  MODEL INDEPENDENT CONSIDERATIONS
  3665.  
  3666.    The NetBIOS name service associates a NetBIOS name with a host.  The
  3667.    NetBIOS session service further binds the name to a specific TCP port
  3668.    for the duration of the session.
  3669.  
  3670.    The name service does not need to be informed of every Listen
  3671.    initiation and completion.  Since the names are not bound to any TCP
  3672.    port in the name service, the session service may use a different tcp
  3673.    port for each session established with the same local name.
  3674.  
  3675.    The TCP port used for the data transfer phase of a NetBIOS session
  3676.    can be globally well-known, locally well-known, or ephemeral.  The
  3677.    choice is a local implementation issue.  The RETARGET mechanism
  3678.    allows the binding of the NetBIOS session to a TCP connection to any
  3679.    TCP port, even to another IP node.
  3680.  
  3681.    An implementation may use the session service's globally well- known
  3682.    TCP port for the data transfer phase of the session by not using the
  3683.    RETARGET mechanism and, rather, accepting the session on the initial
  3684.    TCP connection.  This is permissible because the caller always uses
  3685.    an ephemeral TCP port.
  3686.  
  3687.    The complexity of the called end RETARGET mechanism is only required
  3688.    if a particular implementation needs it.  For many real system
  3689.    environments, such as an in-kernel NetBIOS service implementation, it
  3690.    will not be necessary to retarget incoming calls.  Rather, all
  3691.    NetBIOS sessions may be multiplexed through the single, well-known,
  3692.    NetBIOS session service port.  These implementations will not be
  3693.    burdened by the complexity of the RETARGET mechanism, nor will their
  3694.    callers be required to jump through the retargetting hoops.
  3695.  
  3696.    Nevertheless, all callers must be ready to process all possible
  3697.    SESSION RETARGET RESPONSEs.
  3698.  
  3699. B-1.2  SERVICE OPERATION FOR EACH MODEL
  3700.  
  3701.    It is possible to construct a NetBIOS service based on this
  3702.    specification for each of the above defined implementation models.
  3703.  
  3704.    For the common kernel element model, all the NetBIOS services, name,
  3705.    datagram, and session, are simple.  All the information is contained
  3706.    within a single entity and can therefore be accessed or modified
  3707.    easily.  A single port or multiple ports for the NetBIOS sessions can
  3708.    be used without adding any significant complexity to the session
  3709.    establishment procedure.  The only penalty is the amount of overhead
  3710.    incurred to get the NetBIOS messages and operation requests/responses
  3711.  
  3712.  
  3713.  
  3714. NetBIOS Working Group                                          [Page 63]
  3715.  
  3716. RFC 1001                                                      March 1987
  3717.  
  3718.  
  3719.    through the user and operating system boundary.
  3720.  
  3721.    The combined service and application model is very similar to the
  3722.    common kernel element model in terms of its requirements on the
  3723.    NetBIOS service.  The major difficulty is the internal coordination
  3724.    of the multiple NetBIOS service and application processes existing in
  3725.    a system of this type.
  3726.  
  3727.    The NetBIOS name, datagram and session protocols assume that the
  3728.    entities at the end-points have full control of the various well-
  3729.    known TCP and UDP ports.  If an implementation has multiple NetBIOS
  3730.    service entities, as would be the case with, for example, multiple
  3731.    applications each linked into a NetBIOS library, then that
  3732.    implementation must impose some internal coordination.
  3733.    Alternatively, use of the NetBIOS ports could be periodically
  3734.    assigned to one application or another.
  3735.  
  3736.    For the typical non-kernel common element mode implementation, three
  3737.    permanent system-wide NetBIOS service processes would exist:
  3738.  
  3739.      -  The name server
  3740.      -  the datagram server
  3741.      -  and session server
  3742.  
  3743.    Each server would listen for requests from the network on a UDP or
  3744.    TCP well-known port.  Each application would have a small piece of
  3745.    the NetBIOS service built-in, possibly a library.  Each application's
  3746.    NetBIOS support library would need to send a message to the
  3747.    particular server to request an operation, such as add name or send a
  3748.    datagram or set-up a listen.
  3749.  
  3750.    The non-kernel common element model does not require a TCP connection
  3751.    be passed between the two processes, session server and application.
  3752.    The RETARGET operation for an active NetBIOS Listen could be used by
  3753.    the session server to redirect the session to another TCP connection
  3754.    on a port allocated and owned by the application's NetBIOS support
  3755.    library.  The application with either a built-in or a kernel-based
  3756.    TCP/IP service could then accept the RETARGETed connection request
  3757.    and process it independently of the session server.
  3758.  
  3759.    On Unix(tm) or POSIX(tm), the NetBIOS session server could create
  3760.    sub-processes for incoming connections.  The open sessions would be
  3761.    passed through "fork" and "exec" to the child as an open file
  3762.    descriptor.  This approach is very limited, however.  A pre- existing
  3763.    process could not receive an incoming call.  And all call-ed
  3764.    processes would have to be sub-processes of the session server.
  3765.  
  3766. B-2.  CASUAL AND RESTRICTED NetBIOS APPLICATIONS
  3767.  
  3768.    Because NetBIOS was designed to operate in the open system
  3769.    environment of the typical personal computer, it does not have the
  3770.  
  3771.  
  3772.  
  3773. NetBIOS Working Group                                          [Page 64]
  3774.  
  3775. RFC 1001                                                      March 1987
  3776.  
  3777.  
  3778.    concept of privileged or unprivileged applications.  In many multi-
  3779.    user or multi-tasking operating systems applications are assigned
  3780.    privilege capabilities.  These capabilities limit the applications
  3781.    ability to acquire and use system resources.  For these systems it is
  3782.    important to allow casual applications, those with limited system
  3783.    privileges, and privileged applications, those with 'super-user'
  3784.    capabilities but access to them and their required resources is
  3785.    restricted, to access NetBIOS services.  It is also important to
  3786.    allow a systems administrator to restrict certain NetBIOS resources
  3787.    to a particular NetBIOS application.  For example, a file server
  3788.    based on the NetBIOS services should be able to have names and TCP
  3789.    ports for sessions only it can use.
  3790.  
  3791.    A NetBIOS application needs at least two local resources to
  3792.    communicate with another NetBIOS application, a NetBIOS name for
  3793.    itself and, typically, a session.  A NetBIOS service cannot require
  3794.    that NetBIOS applications directly use privileged system resources.
  3795.    For example, many systems require privilege to use TCP and UDP ports
  3796.    with numbers less than 1024.  This RFC requires reserved ports for
  3797.    the name and session servers of a NetBIOS service implementation.  It
  3798.    does not require the application to have direct access these reserved
  3799.    ports.
  3800.  
  3801.    For the name service, the manager of the local name table must have
  3802.    access to the NetBIOS name service's reserved UDP port.  It needs to
  3803.    listen for name service UDP packets to defend and define its local
  3804.    names to the network.  However, this manager need not be a part of a
  3805.    user application in a system environment which has privilege
  3806.    restrictions on reserved ports.
  3807.  
  3808.    The internal name server can require certain privileges to add,
  3809.    delete, or use a certain name, if an implementer wants the
  3810.    restriction.  This restriction is independent of the operation of the
  3811.    NetBIOS service protocols and would not necessarily prevent the
  3812.    interoperation of that implementation with another implementation.
  3813.  
  3814.    The session server is required to own a reserved TCP port for session
  3815.    establishment.  However, the ultimate TCP connection used to transmit
  3816.    and receive data does not have to be through that reserved port.  The
  3817.    RETARGET procedure the NetBIOS session to be shifted to another TCP
  3818.    connection, possibly through a different port at the called end.
  3819.    This port can be an unprivileged resource, with a value greater than
  3820.    1023.  This facilitates casual applications.
  3821.  
  3822.    Alternately, the RETARGET mechanism allows the TCP port used for data
  3823.    transmission and reception to be a reserved port.  Consequently, an
  3824.    application wishing to have access to its ports maintained by the
  3825.    system administrator can use these restricted TCP ports.  This
  3826.    facilitates privileged applications.
  3827.  
  3828.    A particular implementation may wish to require further special
  3829.  
  3830.  
  3831.  
  3832. NetBIOS Working Group                                          [Page 65]
  3833.  
  3834. RFC 1001                                                      March 1987
  3835.  
  3836.  
  3837.    privileges for session establishment, these could be associated with
  3838.    internal information.  It does not have to be based solely on TCP
  3839.    port allocation.  For example, a given NetBIOS name may only be used
  3840.    for sessions by applications with a certain system privilege level.
  3841.  
  3842.    The decision to use reserved or unreserved ports or add any
  3843.    additional name registration and usage authorization is a purely
  3844.    local implementation decision.  It is not required by the NetBIOS
  3845.    protocols specified in the RFC.
  3846.  
  3847. B-3.  TCP VERSUS SESSION KEEP-ALIVES
  3848.  
  3849.    The KEEP-ALIVE is a protocol element used to validate the existence
  3850.    of a connection.  A packet is sent to the remote connection partner
  3851.    to solicit a response which shows the connection is still
  3852.    functioning.  TCP KEEP-ALIVES are used at the TCP level on TCP
  3853.    connections while session KEEP-ALIVES are used on NetBIOS sessions.
  3854.    These protocol operations are always transparent to the connection
  3855.    user.  The user will only find out about a KEEP-ALIVE operation if it
  3856.    fails, therefore, if the connection is lost.
  3857.  
  3858.    The NetBIOS specification[2] requires the NetBIOS service to inform
  3859.    the session user if a session is lost when it is in a passive or
  3860.    active state.  Therefore,if the session user is only waiting for a
  3861.    receive operation and the session is dropped the NetBIOS service must
  3862.    inform the session user.  It cannot wait for a session send operation
  3863.    before it informs the user of the loss of the connection.
  3864.  
  3865.    This requirement stems from the management of scarce or volatile
  3866.    resources by a NetBIOS application.  If a particular user terminates
  3867.    a session with a server application by destroying the client
  3868.    application or the NetBIOS service without a NetBIOS Hang Up, the
  3869.    server application will want to clean-up or free allocated resources.
  3870.    This server application if it only receives and then sends a response
  3871.    requires the notification of the session abort in the passive state.
  3872.  
  3873.    The standard definition of a TCP service cannot detect loss of a
  3874.    connection when it is in a passive state, waiting for a packet to
  3875.    arrive.  Some TCP implementations have added a KEEP-ALIVE operation
  3876.    which is interoperable with implementations without this feature.
  3877.    These implementations send a packet with an invalid sequence number
  3878.    to the connection partner.  The partner, by specification, must
  3879.    respond with a packet showing the correct sequence number of the
  3880.    connection.  If no response is received from the remote partner
  3881.    within a certain time interval then the TCP service assumes the
  3882.    connection is lost.
  3883.  
  3884.    Since many TCP implementations do not have this KEEP-ALIVE function
  3885.    an optional NetBIOS KEEP-ALIVE operation has been added to the
  3886.    NetBIOS session protocols.  The NetBIOS KEEP-ALIVE uses the
  3887.    properties of TCP to solicit a response from the remote connection
  3888.  
  3889.  
  3890.  
  3891. NetBIOS Working Group                                          [Page 66]
  3892.  
  3893. RFC 1001                                                      March 1987
  3894.  
  3895.  
  3896.    partner.  A NetBIOS session message called KEEP-ALIVE is sent to the
  3897.    remote partner.  Since this results in TCP sending an IP packet to
  3898.    the remote partner, the TCP connection is active.  TCP will discover
  3899.    if the TCP connection is lost if the remote TCP partner does not
  3900.    acknowledge the IP packet.  Therefore, the NetBIOS session service
  3901.    does not send a response to a session KEEP ALIVE message.  It just
  3902.    throws it away.  The NetBIOS session service that transmits the KEEP
  3903.    ALIVE is informed only of the failure of the TCP connection.  It does
  3904.    not wait for a specific response message.
  3905.  
  3906.    A particular NetBIOS implementation should use KEEP-ALIVES if it is
  3907.    concerned with maintaining compatibility with the NetBIOS interface
  3908.    specification[2].  Compatibility is especially important if the
  3909.    implementation wishes to support existing NetBIOS applications, which
  3910.    typically require the session loss detection on their servers, or
  3911.    future applications which were developed for implementations with
  3912.    session loss detection.
  3913.  
  3914. B-4.  RETARGET ALGORITHMS
  3915.  
  3916.    This section contains 2 suggestions for RETARGET algorithms.  They
  3917.    are called the "straight" and "stack" methods.  The algorithm in the
  3918.    body of the RFC uses the straight method.  Implementation of either
  3919.    algorithm must take into account the Session establishment maximum
  3920.    retry count.  The retry count is the maximum number of TCP connect
  3921.    operations allowed before a failure is reported.
  3922.  
  3923.    The straight method forces the session establishment procedure to
  3924.    begin a retry after a retargetting failure with the initial node
  3925.    returned from the name discovery procedure.  A retargetting failure
  3926.    is when a TCP connection attempt fails because of a time- out or a
  3927.    NEGATIVE SESSION RESPONSE is received with an error code specifying
  3928.    NOT LISTENING ON CALLED NAME.  If any other failure occurs the
  3929.    session establishment procedure should retry from the call to the
  3930.    name discovery procedure.
  3931.  
  3932.    A minimum of 2 retries, either from a retargetting or a name
  3933.    discovery failure.  This will give the session service a chance to
  3934.    re-establish a NetBIOS Listen or, more importantly, allow the NetBIOS
  3935.    scope, local name service or the NBNS, to re-learn the correct IP
  3936.    address of a NetBIOS name.
  3937.  
  3938.    The stack method operates similarly to the straight method.  However,
  3939.    instead of retrying at the initial node returned by the name
  3940.    discovery procedure, it restarts with the IP address of the last node
  3941.    which sent a SESSION RETARGET RESPONSE prior to the retargetting
  3942.    failure.  To limit the stack method, any one host can only be tried a
  3943.    maximum of 2 times.
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950. NetBIOS Working Group                                          [Page 67]
  3951.  
  3952. RFC 1001                                                      March 1987
  3953.  
  3954.  
  3955. B-5.  NBDD SERVICE
  3956.  
  3957.    If the NBDD does not forward datagrams then don't provide Group and
  3958.    Broadcast NetBIOS datagram services to the NetBIOS user.  Therefore,
  3959.    ignore the implementation of the query request and, when get a
  3960.    negative response, acquiring the membership list of IP addresses and
  3961.    sending the datagram as a unicast to each member.
  3962.  
  3963. B-6.  APPLICATION CONSIDERATIONS
  3964.  
  3965. B-6.1  USE OF NetBIOS DATAGRAMS
  3966.  
  3967.    Certain existing NetBIOS applications use NetBIOS datagrams as a
  3968.    foundation for their own connection-oriented protocols.  This can
  3969.    cause excessive NetBIOS name query activity and place a substantial
  3970.    burden on the network, server nodes, and other end- nodes.  It is
  3971.    recommended that this practice be avoided in new applications.
  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. NetBIOS Working Group                                          [Page 68]
  4010.  
  4011. ========================================================================
  4012.   
  4013. Network Working Group
  4014. Request for Comments: 1002                         March, 1987
  4015.  
  4016.  
  4017.  
  4018.  
  4019.              PROTOCOL STANDARD FOR A NetBIOS SERVICE
  4020.                      ON A TCP/UDP TRANSPORT:
  4021.                      DETAILED SPECIFICATIONS
  4022.  
  4023.  
  4024.  
  4025.  
  4026.                             ABSTRACT
  4027.  
  4028. This RFC defines a proposed standard protocol to support NetBIOS
  4029. services in a TCP/IP environment.  Both local network and internet
  4030. operation are supported.  Various node types are defined to accommodate
  4031. local and internet topologies and to allow operation with or without the
  4032. use of IP broadcast.
  4033.  
  4034. This RFC gives the detailed specifications of the NetBIOS-over-TCP
  4035. packets, protocols, and defined constants and variables.  A more general
  4036. overview is found in a companion RFC, "Protocol Standard For a NetBIOS
  4037. Service on a TCP/UDP Transport: Concepts and Methods".
  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. NetBIOS Working Group                                           [Page 1]
  4068.  
  4069. RFC 1002                                                      March 1987
  4070.  
  4071.  
  4072.                         TABLE OF CONTENTS
  4073.  
  4074.  
  4075. 1.  STATUS OF THIS MEMO                                              4
  4076.  
  4077. 2.  ACKNOWLEDGEMENTS                                                 4
  4078.  
  4079. 3.  INTRODUCTION                                                     5
  4080.  
  4081. 4.  PACKET DESCRIPTIONS                                              5
  4082.   4.1  NAME FORMAT                                                   5
  4083.   4.2  NAME SERVICE PACKETS                                          7
  4084.      4.2.1  GENERAL FORMAT OF NAME SERVICE PACKETS                   7
  4085.        4.2.1.1  HEADER                                               8
  4086.        4.2.1.2  QUESTION SECTION                                    10
  4087.        4.2.1.3  RESOURCE RECORD                                     11
  4088.      4.2.2  NAME REGISTRATION REQUEST                               13
  4089.      4.2.3  NAME OVERWRITE REQUEST & DEMAND                         14
  4090.      4.2.4  NAME REFRESH REQUEST                                    15
  4091.      4.2.5  POSITIVE NAME REGISTRATION RESPONSE                     16
  4092.      4.2.6  NEGATIVE NAME REGISTRATION RESPONSE                     16
  4093.      4.2.7  END-NODE CHALLENGE REGISTRATION RESPONSE                17
  4094.      4.2.8  NAME CONFLICT DEMAND                                    18
  4095.      4.2.9  NAME RELEASE REQUEST & DEMAND                           19
  4096.      4.2.10  POSITIVE NAME RELEASE RESPONSE                         20
  4097.      4.2.11  NEGATIVE NAME RELEASE RESPONSE                         20
  4098.      4.2.12  NAME QUERY REQUEST                                     21
  4099.      4.2.13  POSITIVE NAME QUERY RESPONSE                           22
  4100.      4.2.14  NEGATIVE NAME QUERY RESPONSE                           23
  4101.      4.2.15  REDIRECT NAME QUERY RESPONSE                           24
  4102.      4.2.16  WAIT FOR ACKNOWLEDGEMENT (WACK) RESPONSE               25
  4103.      4.2.17  NODE STATUS REQUEST                                    26
  4104.      4.2.18  NODE STATUS RESPONSE                                   27
  4105.   4.3  SESSION SERVICE PACKETS                                      29
  4106.      4.3.1  GENERAL FORMAT OF SESSION PACKETS                       29
  4107.      4.3.2  SESSION REQUEST PACKET                                  30
  4108.      4.3.3  POSITIVE SESSION RESPONSE PACKET                        31
  4109.      4.3.4  NEGATIVE SESSION RESPONSE PACKET                        31
  4110.      4.3.5  SESSION RETARGET RESPONSE PACKET                        31
  4111.      4.3.6  SESSION MESSAGE PACKET                                  32
  4112.      4.3.7  SESSION KEEP ALIVE PACKET                               32
  4113.   4.4  DATAGRAM SERVICE PACKETS                                     32
  4114.      4.4.1  NetBIOS DATAGRAM HEADER                                 32
  4115.      4.4.2  DIRECT_UNIQUE, DIRECT_GROUP, & BROADCAST DATAGRAM       33
  4116.      4.4.3  DATAGRAM ERROR PACKET                                   34
  4117.      4.4.4  DATAGRAM QUERY REQUEST                                  34
  4118.      4.4.5  DATAGRAM POSITIVE AND NEGATIVE QUERY RESPONSE           34
  4119.  
  4120. 5.  PROTOCOL DESCRIPTIONS                                           35
  4121.   5.1  NAME SERVICE PROTOCOLS                                       35
  4122.      5.1.1  B-NODE ACTIVITY                                         35
  4123.  
  4124.  
  4125.  
  4126. NetBIOS Working Group                                           [Page 2]
  4127.  
  4128. RFC 1002                                                      March 1987
  4129.  
  4130.  
  4131.        5.1.1.1  B-NODE ADD NAME                                     35
  4132.        5.1.1.2  B-NODE ADD_GROUP NAME                               37
  4133.        5.1.1.3  B-NODE FIND_NAME                                    37
  4134.        5.1.1.4  B NODE NAME RELEASE                                 38
  4135.        5.1.1.5  B-NODE INCOMING PACKET PROCESSING                   39
  4136.      5.1.2  P-NODE ACTIVITY                                         42
  4137.        5.1.2.1  P-NODE ADD_NAME                                     42
  4138.        5.1.2.2  P-NODE ADD GROUP NAME                               45
  4139.        5.1.2.3  P-NODE FIND NAME                                    45
  4140.        5.1.2.4  P-NODE DELETE_NAME                                  46
  4141.        5.1.2.5  P-NODE INCOMING PACKET PROCESSING                   47
  4142.        5.1.2.6  P-NODE TIMER INITIATED PROCESSING                   49
  4143.      5.1.3  M-NODE ACTIVITY                                         50
  4144.        5.1.3.1  M-NODE ADD NAME                                     50
  4145.        5.1.3.2  M-NODE ADD GROUP NAME                               54
  4146.        5.1.3.3  M-NODE FIND NAME                                    55
  4147.        5.1.3.4  M-NODE DELETE NAME                                  56
  4148.        5.1.3.5  M-NODE INCOMING PACKET PROCESSING                   58
  4149.        5.1.3.6  M-NODE TIMER INITIATED PROCESSING                   60
  4150.      5.1.4  NBNS ACTIVITY                                           60
  4151.        5.1.4.1  NBNS INCOMING PACKET PROCESSING                     61
  4152.        5.1.4.2  NBNS TIMER INITIATED PROCESSING                     66
  4153.   5.2  SESSION SERVICE PROTOCOLS                                    67
  4154.      5.2.1  SESSION ESTABLISHMENT PROTOCOLS                         67
  4155.        5.2.1.1  USER REQUEST PROCESSING                             67
  4156.        5.2.1.2  RECEIVED PACKET PROCESSING                          71
  4157.      5.2.2  SESSION DATA TRANSFER PROTOCOLS                         72
  4158.        5.2.2.1  USER REQUEST PROCESSING                             72
  4159.        5.2.2.2  RECEIVED PACKET PROCESSING                          72
  4160.        5.2.2.3  PROCESSING INITIATED BY TIMER                       73
  4161.      5.2.3  SESSION TERMINATION PROTOCOLS                           73
  4162.        5.2.3.1  USER REQUEST PROCESSING                             73
  4163.        5.2.3.2  RECEPTION INDICATION PROCESSING                     73
  4164.   5.3  NetBIOS DATAGRAM SERVICE PROTOCOLS                           74
  4165.      5.3.1  B NODE TRANSMISSION OF NetBIOS DATAGRAMS                74
  4166.      5.3.2  P AND M NODE TRANSMISSION OF NetBIOS DATAGRAMS          76
  4167.      5.3.3  RECEPTION OF NetBIOS DATAGRAMS BY ALL NODES             78
  4168.      5.3.4  PROTOCOLS FOR THE NBDD                                  80
  4169.  
  4170. 6.  DEFINED CONSTANTS AND VARIABLES                                 83
  4171.  
  4172. REFERENCES                                                          85
  4173.  
  4174.  
  4175.  
  4176.  
  4177.  
  4178.  
  4179.  
  4180.  
  4181.  
  4182.  
  4183.  
  4184.  
  4185. NetBIOS Working Group                                           [Page 3]
  4186.  
  4187. RFC 1002                                                      March 1987
  4188.  
  4189.  
  4190.              PROTOCOL STANDARD FOR A NetBIOS SERVICE
  4191.                      ON A TCP/UDP TRANSPORT:
  4192.                      DETAILED SPECIFICATIONS
  4193.  
  4194.  
  4195. 1.  STATUS OF THIS MEMO
  4196.  
  4197.    This RFC specifies a proposed standard for the DARPA Internet
  4198.    community.  Since this topic is new to the Internet community,
  4199.    discussions and suggestions are specifically requested.
  4200.  
  4201.    Please send written comments to:
  4202.  
  4203.            Karl Auerbach
  4204.            Epilogue Technology Corporation
  4205.            P.O. Box 5432
  4206.            Redwood City, CA   94063
  4207.  
  4208.    Please send online comments to:
  4209.  
  4210.            Avnish Aggarwal
  4211.                    Internet: mtxinu!excelan!avnish@ucbvax.berkeley.edu
  4212.                    Usenet:   ucbvax!mtxinu!excelan!avnish
  4213.  
  4214.    Distribution of this memorandum is unlimited.
  4215.  
  4216. 2.  ACKNOWLEDGEMENTS
  4217.  
  4218.    This RFC has been developed under the auspices of the Internet
  4219.    Activities Board.
  4220.  
  4221.    The following individuals have contributed to the development of
  4222.    this RFC:
  4223.  
  4224.    Avnish Aggarwal       Arvind Agrawal        Lorenzo Aguilar
  4225.    Geoffrey Arnold       Karl Auerbach         K. Ramesh Babu
  4226.    Keith Ball            Amatzia Ben-Artzi     Vint Cerf
  4227.    Richard Cherry        David Crocker         Steve Deering
  4228.    Greg Ennis            Steve Holmgren        Jay Israel
  4229.    David Kaufman         Lee LaBarre           James Lau
  4230.    Dan Lynch             Gaylord Miyata        David Stevens
  4231.    Steve Thomas          Ishan Wu
  4232.  
  4233.    The system proposed by this RFC does not reflect any existing
  4234.    Netbios-over-TCP implementation.  However, the design
  4235.    incorporates considerable knowledge obtained from prior
  4236.    implementations.  Special thanks goes to the following
  4237.    organizations which have provided this invaluable information:
  4238.  
  4239.    CMC/Syros      Excelan        Sytek          Ungermann-Bass
  4240.  
  4241.  
  4242.  
  4243.  
  4244. NetBIOS Working Group                                           [Page 4]
  4245.  
  4246. RFC 1002                                                      March 1987
  4247.  
  4248.  
  4249. 3.  INTRODUCTION
  4250.  
  4251.    This RFC contains the detailed packet formats and protocol
  4252.    specifications for NetBIOS-over-TCP.  This RFC is a companion to
  4253.    RFC 1001, "Protocol Standard For a NetBIOS Service on a TCP/UDP
  4254.    Transport: Concepts and Methods" [1].
  4255.  
  4256. 4.  PACKET DESCRIPTIONS
  4257.  
  4258.    Bit and byte ordering are defined by the most recent version of
  4259.    "Assigned Numbers" [2].
  4260.  
  4261. 4.1.  NAME FORMAT
  4262.  
  4263.    The NetBIOS name representation in all NetBIOS packets (for NAME,
  4264.    SESSION, and DATAGRAM services) is defined in the Domain Name
  4265.    Service RFC 883[3] as "compressed" name messages.  This format is
  4266.    called "second-level encoding" in the section entitled
  4267.    "Representation of NetBIOS Names" in the Concepts and Methods
  4268.    document.
  4269.  
  4270.    For ease of description, the first two paragraphs from page 31,
  4271.    the section titled "Domain name representation and compression",
  4272.    of RFC 883 are replicated here:
  4273.  
  4274.         Domain names messages are expressed in terms of a sequence
  4275.         of labels.  Each label is represented as a one octet length
  4276.         field followed by that number of octets.  Since every domain
  4277.         name ends with the null label of the root, a compressed
  4278.         domain name is terminated by a length byte of zero.  The
  4279.         high order two bits of the length field must be zero, and
  4280.         the remaining six bits of the length field limit the label
  4281.         to 63 octets or less.
  4282.  
  4283.         To simplify implementations, the total length of label
  4284.         octets and label length octets that make up a domain name is
  4285.         restricted to 255 octets or less.
  4286.  
  4287.    The following is the uncompressed representation of the NetBIOS name
  4288.    "FRED ", which is the 4 ASCII characters, F, R, E, D, followed by 12
  4289.    space characters (0x20).  This name has the SCOPE_ID: "NETBIOS.COM"
  4290.  
  4291.            EGFCEFEECACACACACACACACACACACACA.NETBIOS.COM
  4292.  
  4293.    This uncompressed representation of names is called "first-level
  4294.    encoding" in the section entitled "Representation of NetBIOS Names"
  4295.    in the Concepts and Methods document.
  4296.  
  4297.    The following is a pictographic representation of the compressed
  4298.    representation of the previous uncompressed Domain Name
  4299.    representation.
  4300.  
  4301.  
  4302.  
  4303. NetBIOS Working Group                                           [Page 5]
  4304.  
  4305. RFC 1002                                                      March 1987
  4306.  
  4307.  
  4308.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4309.     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
  4310.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4311.    |      0x20     |    E (0x45)   |    G (0x47)   |    F (0x46)   |
  4312.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4313.    |    C (0x43)   |    E (0x45)   |    F (0x46)   |    E (0x45)   |
  4314.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4315.    |    E (0x45)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |
  4316.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4317.    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |
  4318.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4319.    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |
  4320.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4321.    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |
  4322.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4323.    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |
  4324.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4325.    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |
  4326.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4327.    |    A (0X41)   |      0x07     |    N (0x4E)   |    E (0x45)   |
  4328.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4329.    |    T (0x54)   |    B (0x42)   |    I (0x49)   |    O (0x4F)   |
  4330.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4331.    |    S (0x53)   |      0x03     |    C (0x43)   |    O (0x4F)   |
  4332.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4333.    |    M (0x4D)   |      0x00     |
  4334.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4335.  
  4336.    Each section of a domain name is called a label [7 (page 31)].  A
  4337.    label can be a maximum of 63 bytes.  The first byte of a label in
  4338.    compressed representation is the number of bytes in the label.  For
  4339.    the above example, the first 0x20 is the number of bytes in the
  4340.    left-most label, EGFCEFEECACACACACACACACACACACACA, of the domain
  4341.    name.  The bytes following the label length count are the characters
  4342.    of the label.  The following labels are in sequence after the first
  4343.    label, which is the encoded NetBIOS name, until a zero (0x00) length
  4344.    count.  The zero length count represents the root label, which is
  4345.    always null.
  4346.  
  4347.    A label length count is actually a 6-bit field in the label length
  4348.    field.  The most significant 2 bits of the field, bits 7 and 6, are
  4349.    flags allowing an escape from the above compressed representation.
  4350.    If bits 7 and 6 are both set (11), the following 14 bits are an
  4351.    offset pointer into the full message to the actual label string from
  4352.    another domain name that belongs in this name.  This label pointer
  4353.    allows for a further compression of a domain name in a packet.
  4354.  
  4355.    NetBIOS implementations can only use label string pointers in Name
  4356.    Service packets.  They cannot be used in Session or Datagram Service
  4357.    packets.
  4358.  
  4359.  
  4360.  
  4361.  
  4362. NetBIOS Working Group                                           [Page 6]
  4363.  
  4364. RFC 1002                                                      March 1987
  4365.  
  4366.  
  4367.    The other two possible values for bits 7 and 6 (01 and 10) of a label
  4368.    length field are reserved for future use by RFC 883[2 (page 32)].
  4369.  
  4370.    Note that the first octet of a compressed name must contain one of
  4371.    the following bit patterns.  (An "x" indicates a bit whose value may
  4372.    be either 0 or 1.):
  4373.  
  4374.            00100000 -  Netbios name, length must be 32 (decimal)
  4375.            11xxxxxx -  Label string pointer
  4376.            10xxxxxx -  Reserved
  4377.            01xxxxxx -  Reserved
  4378.  
  4379. 4.2.  NAME SERVICE PACKETS
  4380.  
  4381. 4.2.1.  GENERAL FORMAT OF NAME SERVICE PACKETS
  4382.  
  4383.    The NetBIOS Name Service packets follow the packet structure defined
  4384.    in the Domain Name Service (DNS) RFC 883 [7 (pg 26-31)].  The
  4385.    structures are compatible with the existing DNS packet formats,
  4386.    however, additional types and codes have been added to work with
  4387.    NetBIOS.
  4388.  
  4389.    If Name Service packets are sent over a TCP connection they are
  4390.    preceded by a 16 bit unsigned integer representing the length of the
  4391.    Name Service packet.
  4392.  
  4393.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4394.     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
  4395.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4396.    |                                                               |
  4397.    + ------                                                ------- +
  4398.    |                            HEADER                             |
  4399.    + ------                                                ------- +
  4400.    |                                                               |
  4401.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4402.    |                                                               |
  4403.    /                       QUESTION ENTRIES                        /
  4404.    |                                                               |
  4405.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4406.    |                                                               |
  4407.    /                    ANSWER RESOURCE RECORDS                    /
  4408.    |                                                               |
  4409.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4410.    |                                                               |
  4411.    /                  AUTHORITY RESOURCE RECORDS                   /
  4412.    |                                                               |
  4413.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4414.    |                                                               |
  4415.    /                  ADDITIONAL RESOURCE RECORDS                  /
  4416.    |                                                               |
  4417.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4418.  
  4419.  
  4420.  
  4421. NetBIOS Working Group                                           [Page 7]
  4422.  
  4423. RFC 1002                                                      March 1987
  4424.  
  4425.  
  4426. 4.2.1.1.  HEADER
  4427.  
  4428.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4429.     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
  4430.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4431.    |         NAME_TRN_ID           | OPCODE  |   NM_FLAGS  | RCODE |
  4432.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4433.    |          QDCOUNT              |           ANCOUNT             |
  4434.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4435.    |          NSCOUNT              |           ARCOUNT             |
  4436.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4437.  
  4438.    Field     Description
  4439.  
  4440.    NAME_TRN_ID      Transaction ID for Name Service Transaction.
  4441.                     Requestor places a unique value for each active
  4442.                     transaction.  Responder puts NAME_TRN_ID value
  4443.                     from request packet in response packet.
  4444.  
  4445.    OPCODE           Packet type code, see table below.
  4446.  
  4447.    NM_FLAGS         Flags for operation, see table below.
  4448.  
  4449.    RCODE            Result codes of request.  Table of RCODE values
  4450.                     for each response packet below.
  4451.  
  4452.    QDCOUNT          Unsigned 16 bit integer specifying the number of
  4453.                     entries in the question section of a Name
  4454.  
  4455.                     Service packet.  Always zero (0) for responses.
  4456.                     Must be non-zero for all NetBIOS Name requests.
  4457.  
  4458.    ANCOUNT          Unsigned 16 bit integer specifying the number of
  4459.                     resource records in the answer section of a Name
  4460.                     Service packet.
  4461.  
  4462.    NSCOUNT          Unsigned 16 bit integer specifying the number of
  4463.                     resource records in the authority section of a
  4464.                     Name Service packet.
  4465.  
  4466.    ARCOUNT          Unsigned 16 bit integer specifying the number of
  4467.                     resource records in the additional records
  4468.                     section of a Name Service packet.
  4469.  
  4470.    The OPCODE field is defined as:
  4471.  
  4472.      0   1   2   3   4
  4473.    +---+---+---+---+---+
  4474.    | R |    OPCODE     |
  4475.    +---+---+---+---+---+
  4476.  
  4477.  
  4478.  
  4479.  
  4480. NetBIOS Working Group                                           [Page 8]
  4481.  
  4482. RFC 1002                                                      March 1987
  4483.  
  4484.  
  4485.    Symbol     Bit(s)   Description
  4486.  
  4487.    OPCODE        1-4   Operation specifier:
  4488.                          0 = query
  4489.                          5 = registration
  4490.                          6 = release
  4491.                          7 = WACK
  4492.                          8 = refresh
  4493.  
  4494.    R               0   RESPONSE flag:
  4495.                          if bit == 0 then request packet
  4496.                          if bit == 1 then response packet.
  4497.  
  4498.    The NM_FLAGS field is defined as:
  4499.  
  4500.  
  4501.      0   1   2   3   4   5   6
  4502.    +---+---+---+---+---+---+---+
  4503.    |AA |TC |RD |RA | 0 | 0 | B |
  4504.    +---+---+---+---+---+---+---+
  4505.  
  4506.    Symbol     Bit(s)   Description
  4507.  
  4508.    B               6   Broadcast Flag.
  4509.                          = 1: packet was broadcast or multicast
  4510.                          = 0: unicast
  4511.  
  4512.    RA              3   Recursion Available Flag.
  4513.  
  4514.                        Only valid in responses from a NetBIOS Name
  4515.                        Server -- must be zero in all other
  4516.                        responses.
  4517.  
  4518.                        If one (1) then the NBNS supports recursive
  4519.                        query, registration, and release.
  4520.  
  4521.                        If zero (0) then the end-node must iterate
  4522.                        for query and challenge for registration.
  4523.  
  4524.    RD              2   Recursion Desired Flag.
  4525.  
  4526.                        May only be set on a request to a NetBIOS
  4527.                        Name Server.
  4528.  
  4529.                        The NBNS will copy its state into the
  4530.                        response packet.
  4531.  
  4532.                        If one (1) the NBNS will iterate on the
  4533.                        query, registration, or release.
  4534.  
  4535.    TC              1   Truncation Flag.
  4536.  
  4537.  
  4538.  
  4539. NetBIOS Working Group                                           [Page 9]
  4540.  
  4541. RFC 1002                                                      March 1987
  4542.  
  4543.  
  4544.                        Set if this message was truncated because the
  4545.                        datagram carrying it would be greater than
  4546.                        576 bytes in length.  Use TCP to get the
  4547.                        information from the NetBIOS Name Server.
  4548.  
  4549.    AA              0   Authoritative Answer flag.
  4550.  
  4551.                        Must be zero (0) if R flag of OPCODE is zero
  4552.                        (0).
  4553.  
  4554.                        If R flag is one (1) then if AA is one (1)
  4555.                        then the node responding is an authority for
  4556.                        the domain name.
  4557.  
  4558.                        End nodes responding to queries always set
  4559.                        this bit in responses.
  4560.  
  4561. 4.2.1.2.  QUESTION SECTION
  4562.  
  4563.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4564.     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
  4565.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4566.    |                                                               |
  4567.    /                         QUESTION_NAME                         /
  4568.    /                                                               /
  4569.    |                                                               |
  4570.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4571.    |         QUESTION_TYPE         |        QUESTION_CLASS         |
  4572.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4573.  
  4574.    Field            Description
  4575.  
  4576.    QUESTION_NAME    The compressed name representation of the
  4577.                     NetBIOS name for the request.
  4578.  
  4579.    QUESTION_TYPE    The type of request.  The values for this field
  4580.                     are specified for each request.
  4581.  
  4582.    QUESTION_CLASS   The class of the request.  The values for this
  4583.                     field are specified for each request.
  4584.  
  4585.    QUESTION_TYPE is defined as:
  4586.  
  4587.    Symbol      Value   Description:
  4588.  
  4589.    NB         0x0020   NetBIOS general Name Service Resource Record
  4590.    NBSTAT     0x0021   NetBIOS NODE STATUS Resource Record (See NODE
  4591.                        STATUS REQUEST)
  4592.  
  4593.    QUESTION_CLASS is defined as:
  4594.  
  4595.  
  4596.  
  4597.  
  4598. NetBIOS Working Group                                          [Page 10]
  4599.  
  4600. RFC 1002                                                      March 1987
  4601.  
  4602.  
  4603.    Symbol      Value   Description:
  4604.  
  4605.    IN         0x0001   Internet class
  4606.  
  4607. 4.2.1.3.  RESOURCE RECORD
  4608.  
  4609.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4610.     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
  4611.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4612.    |                                                               |
  4613.    /                            RR_NAME                            /
  4614.    /                                                               /
  4615.    |                                                               |
  4616.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4617.    |           RR_TYPE             |          RR_CLASS             |
  4618.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4619.    |                              TTL                              |
  4620.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4621.    |           RDLENGTH            |                               |
  4622.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
  4623.    /                                                               /
  4624.    /                             RDATA                             /
  4625.    |                                                               |
  4626.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4627.  
  4628.    Field            Description
  4629.  
  4630.    RR_NAME          The compressed name representation of the
  4631.                     NetBIOS name corresponding to this resource
  4632.                     record.
  4633.  
  4634.    RR_TYPE          Resource record type code
  4635.  
  4636.    RR_CLASS         Resource record class code
  4637.  
  4638.    TTL              The Time To Live of a the resource record's
  4639.                     name.
  4640.  
  4641.    RDLENGTH         Unsigned 16 bit integer that specifies the
  4642.                     number of bytes in the RDATA field.
  4643.  
  4644.    RDATA            RR_CLASS and RR_TYPE dependent field.  Contains
  4645.                     the resource information for the NetBIOS name.
  4646.  
  4647.    RESOURCE RECORD RR_TYPE field definitions:
  4648.  
  4649.    Symbol      Value   Description:
  4650.  
  4651.    A          0x0001   IP address Resource Record (See REDIRECT NAME
  4652.                        QUERY RESPONSE)
  4653.    NS         0x0002   Name Server Resource Record (See REDIRECT
  4654.  
  4655.  
  4656.  
  4657. NetBIOS Working Group                                          [Page 11]
  4658.  
  4659. RFC 1002                                                      March 1987
  4660.  
  4661.  
  4662.                        NAME QUERY RESPONSE)
  4663.    NULL       0x000A   NULL Resource Record (See WAIT FOR
  4664.                        ACKNOWLEDGEMENT RESPONSE)
  4665.    NB         0x0020   NetBIOS general Name Service Resource Record
  4666.                        (See NB_FLAGS and NB_ADDRESS, below)
  4667.    NBSTAT     0x0021   NetBIOS NODE STATUS Resource Record (See NODE
  4668.                        STATUS RESPONSE)
  4669.  
  4670.    RESOURCE RECORD RR_CLASS field definitions:
  4671.  
  4672.    Symbol      Value   Description:
  4673.  
  4674.    IN         0x0001   Internet class
  4675.  
  4676.    NB_FLAGS field of the RESOURCE RECORD RDATA field for RR_TYPE of
  4677.    "NB":
  4678.  
  4679.                                              1   1   1   1   1   1
  4680.      0   1   2   3   4   5   6   7   8   9   0   1   2   3   4   5
  4681.    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  4682.    | G |  ONT  |                RESERVED                           |
  4683.    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  4684.  
  4685.    Symbol     Bit(s)   Description:
  4686.  
  4687.    RESERVED     3-15   Reserved for future use.  Must be zero (0).
  4688.    ONT           1,2   Owner Node Type:
  4689.                           00 = B node
  4690.                           01 = P node
  4691.                           10 = M node
  4692.                           11 = Reserved for future use
  4693.                        For registration requests this is the
  4694.                        claimant's type.
  4695.                        For responses this is the actual owner's
  4696.                        type.
  4697.  
  4698.    G               0   Group Name Flag.
  4699.                        If one (1) then the RR_NAME is a GROUP
  4700.                        NetBIOS name.
  4701.                        If zero (0) then the RR_NAME is a UNIQUE
  4702.                        NetBIOS name.
  4703.  
  4704.    The NB_ADDRESS field of the RESOURCE RECORD RDATA field for
  4705.    RR_TYPE of "NB" is the IP address of the name's owner.
  4706.  
  4707.  
  4708.  
  4709.  
  4710.  
  4711.  
  4712.  
  4713.  
  4714.  
  4715.  
  4716. NetBIOS Working Group                                          [Page 12]
  4717.  
  4718. RFC 1002                                                      March 1987
  4719.  
  4720.  
  4721. 4.2.2.  NAME REGISTRATION REQUEST
  4722.  
  4723.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4724.     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
  4725.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4726.    |         NAME_TRN_ID           |0|  0x5  |0|0|1|0|0 0|B|  0x0  |
  4727.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4728.    |          0x0001               |           0x0000              |
  4729.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4730.    |          0x0000               |           0x0001              |
  4731.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4732.    |                                                               |
  4733.    /                         QUESTION_NAME                         /
  4734.    /                                                               /
  4735.    |                                                               |
  4736.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4737.    |           NB (0x0020)         |        IN (0x0001)            |
  4738.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4739.    |                                                               |
  4740.    /                            RR_NAME                            /
  4741.    /                                                               /
  4742.    |                                                               |
  4743.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4744.    |           NB (0x0020)         |         IN (0x0001)           |
  4745.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4746.    |                              TTL                              |
  4747.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4748.    |           0x0006              |          NB_FLAGS             |
  4749.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4750.    |                          NB_ADDRESS                           |
  4751.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4752.  
  4753.    Since the RR_NAME is the same name as the QUESTION_NAME, the
  4754.    RR_NAME representation must use pointers to the QUESTION_NAME
  4755.    name's labels to guarantee the length of the datagram is less
  4756.    than the maximum 576 bytes.  See section above on name formats
  4757.    and also page 31 and 32 of RFC 883, Domain Names - Implementation
  4758.    and Specification, for a complete description of compressed name
  4759.    label pointers.
  4760.  
  4761.  
  4762.  
  4763.  
  4764.  
  4765.  
  4766.  
  4767.  
  4768.  
  4769.  
  4770.  
  4771.  
  4772.  
  4773.  
  4774.  
  4775. NetBIOS Working Group                                          [Page 13]
  4776.  
  4777. RFC 1002                                                      March 1987
  4778.  
  4779.  
  4780. 4.2.3.  NAME OVERWRITE REQUEST & DEMAND
  4781.  
  4782.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4783.     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
  4784.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4785.    |         NAME_TRN_ID           |0|  0x5  |0|0|0|0|0 0|B|  0x0  |
  4786.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4787.    |          0x0001               |           0x0000              |
  4788.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4789.    |          0x0000               |           0x0001              |
  4790.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4791.    |                                                               |
  4792.    /                         QUESTION_NAME                         /
  4793.    /                                                               /
  4794.    |                                                               |
  4795.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4796.    |           NB (0x0020)         |        IN (0x0001)            |
  4797.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4798.    |                                                               |
  4799.    /                            RR_NAME                            /
  4800.    /                                                               /
  4801.    |                                                               |
  4802.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4803.    |           NB (0x0020)         |         IN (0x0001)           |
  4804.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4805.    |                              TTL                              |
  4806.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4807.    |           0x0006              |          NB_FLAGS             |
  4808.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4809.    |                          NB_ADDRESS                           |
  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. NetBIOS Working Group                                          [Page 14]
  4835.  
  4836. RFC 1002                                                      March 1987
  4837.  
  4838.  
  4839. 4.2.4.  NAME REFRESH REQUEST
  4840.  
  4841.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4842.     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
  4843.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4844.    |         NAME_TRN_ID           |0|  0x9  |0|0|0|0|0 0|B|  0x0  |
  4845.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4846.    |          0x0001               |           0x0000              |
  4847.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4848.    |          0x0000               |           0x0001              |
  4849.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4850.    |                                                               |
  4851.    /                         QUESTION_NAME                         /
  4852.    /                                                               /
  4853.    |                                                               |
  4854.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4855.    |           NB (0x0020)         |        IN (0x0001)            |
  4856.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4857.    |                                                               |
  4858.    /                            RR_NAME                            /
  4859.    /                                                               /
  4860.    |                                                               |
  4861.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4862.    |           NB (0x0020)         |         IN (0x0001)           |
  4863.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4864.    |                              TTL                              |
  4865.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4866.    |           0x0006              |          NB_FLAGS             |
  4867.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4868.    |                          NB_ADDRESS                           |
  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. NetBIOS Working Group                                          [Page 15]
  4894.  
  4895. RFC 1002                                                      March 1987
  4896.  
  4897.  
  4898. 4.2.5.  POSITIVE NAME REGISTRATION RESPONSE
  4899.  
  4900.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4901.     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
  4902.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4903.    |         NAME_TRN_ID           |1|  0x5  |1|0|1|1|0 0|0|  0x0  |
  4904.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4905.    |          0x0000               |           0x0001              |
  4906.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4907.    |          0x0000               |           0x0000              |
  4908.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4909.    |                                                               |
  4910.    /                            RR_NAME                            /
  4911.    /                                                               /
  4912.    |                                                               |
  4913.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4914.    |           NB (0x0020)         |         IN (0x0001)           |
  4915.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4916.    |                              TTL                              |
  4917.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4918.    |           0x0006              |          NB_FLAGS             |
  4919.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4920.    |                          NB_ADDRESS                           |
  4921.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4922.  
  4923. 4.2.6.  NEGATIVE NAME REGISTRATION RESPONSE
  4924.  
  4925.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4926.     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
  4927.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4928.    |         NAME_TRN_ID           |1|  0x5  |1|0|1|1|0 0|0| RCODE |
  4929.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4930.    |          0x0000               |           0x0001              |
  4931.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4932.    |          0x0000               |           0x0000              |
  4933.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4934.    |                                                               |
  4935.    /                            RR_NAME                            /
  4936.    /                                                               /
  4937.    |                                                               |
  4938.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4939.    |           NB (0x0020)         |         IN (0x0001)           |
  4940.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4941.    |                              TTL                              |
  4942.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4943.    |           0x0006              |          NB_FLAGS             |
  4944.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4945.    |                          NB_ADDRESS                           |
  4946.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952. NetBIOS Working Group                                          [Page 16]
  4953.  
  4954. RFC 1002                                                      March 1987
  4955.  
  4956.  
  4957.    RCODE field values:
  4958.  
  4959.    Symbol      Value   Description:
  4960.  
  4961.    FMT_ERR       0x1   Format Error.  Request was invalidly
  4962.                        formatted.
  4963.    SRV_ERR       0x2   Server failure.  Problem with NBNS, cannot
  4964.                        process name.
  4965.    IMP_ERR       0x4   Unsupported request error.  Allowable only
  4966.                        for challenging NBNS when gets an Update type
  4967.                        registration request.
  4968.    RFS_ERR       0x5   Refused error.  For policy reasons server
  4969.                        will not register this name from this host.
  4970.    ACT_ERR       0x6   Active error.  Name is owned by another node.
  4971.    CFT_ERR       0x7   Name in conflict error.  A UNIQUE name is
  4972.                        owned by more than one node.
  4973.  
  4974. 4.2.7.  END-NODE CHALLENGE REGISTRATION RESPONSE
  4975.  
  4976.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  4977.     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
  4978.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4979.    |         NAME_TRN_ID           |1|  0x5  |1|0|1|0|0 0|0|  0x0  |
  4980.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4981.    |          0x0000               |           0x0001              |
  4982.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4983.    |          0x0000               |           0x0000              |
  4984.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4985.    |                                                               |
  4986.    /                            RR_NAME                            /
  4987.    /                                                               /
  4988.    |                                                               |
  4989.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4990.    |           NB (0x0020)         |         IN (0x0001)           |
  4991.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4992.    |                              TTL                              |
  4993.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4994.    |           0x0006              |          NB_FLAGS             |
  4995.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4996.    |                          NB_ADDRESS                           |
  4997.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011. NetBIOS Working Group                                          [Page 17]
  5012.  
  5013. RFC 1002                                                      March 1987
  5014.  
  5015.  
  5016. 4.2.8.  NAME CONFLICT DEMAND
  5017.  
  5018.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5019.     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
  5020.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5021.    |         NAME_TRN_ID           |1|  0x5  |1|0|1|1|0 0|0|  0x7  |
  5022.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5023.    |          0x0000               |           0x0001              |
  5024.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5025.    |          0x0000               |           0x0000              |
  5026.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5027.    |                                                               |
  5028.    /                            RR_NAME                            /
  5029.    /                                                               /
  5030.    |                                                               |
  5031.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5032.    |           NB (0x0020)         |         IN (0x0001)           |
  5033.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5034.    |                          0x00000000                           |
  5035.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5036.    |           0x0006              |0|ONT|0|     0x000             |
  5037.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5038.    |                          0x00000000                           |
  5039.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5040.  
  5041.    This packet is identical to a NEGATIVE NAME REGISTRATION RESPONSE
  5042.    with RCODE = CFT_ERR.
  5043.  
  5044.  
  5045.  
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.  
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070. NetBIOS Working Group                                          [Page 18]
  5071.  
  5072. RFC 1002                                                      March 1987
  5073.  
  5074.  
  5075. 4.2.9.  NAME RELEASE REQUEST & DEMAND
  5076.  
  5077.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5078.     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
  5079.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5080.    |         NAME_TRN_ID           |0|  0x6  |0|0|0|0|0 0|B|  0x0  |
  5081.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5082.    |          0x0001               |           0x0000              |
  5083.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5084.    |          0x0000               |           0x0001              |
  5085.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5086.    |                                                               |
  5087.    /                         QUESTION_NAME                         /
  5088.    /                                                               /
  5089.    |                                                               |
  5090.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5091.    |           NB (0x0020)         |        IN (0x0001)            |
  5092.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5093.    |                                                               |
  5094.    /                            RR_NAME                            /
  5095.    /                                                               /
  5096.    |                                                               |
  5097.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5098.    |           NB (0x0020)         |         IN (0x0001)           |
  5099.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5100.    |                          0x00000000                           |
  5101.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5102.    |           0x0006              |          NB_FLAGS             |
  5103.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5104.    |                          NB_ADDRESS                           |
  5105.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5106.  
  5107.    Since the RR_NAME is the same name as the QUESTION_NAME, the
  5108.    RR_NAME representation must use label string pointers to the
  5109.    QUESTION_NAME labels to guarantee the length of the datagram is
  5110.    less than the maximum 576 bytes.  This is the same condition as
  5111.    with the NAME REGISTRATION REQUEST.
  5112.  
  5113.  
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129. NetBIOS Working Group                                          [Page 19]
  5130.  
  5131. RFC 1002                                                      March 1987
  5132.  
  5133.  
  5134. 4.2.10.  POSITIVE NAME RELEASE RESPONSE
  5135.  
  5136.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5137.     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
  5138.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5139.    |         NAME_TRN_ID           |1|  0x6  |1|0|0|0|0 0|0|  0x0  |
  5140.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5141.    |          0x0000               |           0x0001              |
  5142.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5143.    |          0x0000               |           0x0000              |
  5144.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5145.    |                                                               |
  5146.    /                            RR_NAME                            /
  5147.    /                                                               /
  5148.    |                                                               |
  5149.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5150.    |           NB (0x0020)         |         IN (0x0001)           |
  5151.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5152.    |                              TTL                              |
  5153.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5154.    |           0x0006              |          NB_FLAGS             |
  5155.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5156.    |                          NB_ADDRESS                           |
  5157.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5158.  
  5159. 4.2.11.  NEGATIVE NAME RELEASE RESPONSE
  5160.  
  5161.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5162.     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
  5163.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5164.    |         NAME_TRN_ID           |1|  0x6  |1|0|0|0|0 0|0| RCODE |
  5165.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5166.    |          0x0000               |           0x0001              |
  5167.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5168.    |          0x0000               |           0x0000              |
  5169.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5170.    |                                                               |
  5171.    /                            RR_NAME                            /
  5172.    /                                                               /
  5173.    |                                                               |
  5174.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5175.    |           NB (0x0020)         |         IN (0x0001)           |
  5176.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5177.    |                              TTL                              |
  5178.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5179.    |           0x0006              |          NB_FLAGS             |
  5180.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5181.    |                          NB_ADDRESS                           |
  5182.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188. NetBIOS Working Group                                          [Page 20]
  5189.  
  5190. RFC 1002                                                      March 1987
  5191.  
  5192.  
  5193.    RCODE field values:
  5194.  
  5195.    Symbol      Value   Description:
  5196.  
  5197.    FMT_ERR       0x1   Format Error.  Request was invalidly
  5198.                        formatted.
  5199.  
  5200.    SRV_ERR       0x2   Server failure.  Problem with NBNS, cannot
  5201.                        process name.
  5202.  
  5203.    RFS_ERR       0x5   Refused error.  For policy reasons server
  5204.                        will not release this name from this host.
  5205.  
  5206.    ACT_ERR       0x6   Active error.  Name is owned by another node.
  5207.                        Only that node may release it.  A NetBIOS
  5208.                        Name Server can optionally allow a node to
  5209.                        release a name it does not own.  This would
  5210.                        facilitate detection of inactive names for
  5211.                        nodes that went down silently.
  5212.  
  5213. 4.2.12.  NAME QUERY REQUEST
  5214.  
  5215.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5216.     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
  5217.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5218.    |         NAME_TRN_ID           |0|  0x0  |0|0|1|0|0 0|B|  0x0  |
  5219.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5220.    |          0x0001               |           0x0000              |
  5221.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5222.    |          0x0000               |           0x0000              |
  5223.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5224.    |                                                               |
  5225.    /                         QUESTION_NAME                         /
  5226.    /                                                               /
  5227.    |                                                               |
  5228.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5229.    |           NB (0x0020)         |        IN (0x0001)            |
  5230.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5231.  
  5232.  
  5233.  
  5234.  
  5235.  
  5236.  
  5237.  
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.  
  5244.  
  5245.  
  5246.  
  5247. NetBIOS Working Group                                          [Page 21]
  5248.  
  5249. RFC 1002                                                      March 1987
  5250.  
  5251.  
  5252. 4.2.13.  POSITIVE NAME QUERY RESPONSE
  5253.  
  5254.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5255.     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
  5256.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5257.    |         NAME_TRN_ID           |1|  0x0  |1|T|1|?|0 0|0|  0x0  |
  5258.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5259.    |          0x0000               |           0x0001              |
  5260.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5261.    |          0x0000               |           0x0000              |
  5262.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5263.    |                                                               |
  5264.    /                            RR_NAME                            /
  5265.    /                                                               /
  5266.    |                                                               |
  5267.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5268.    |           NB (0x0020)         |         IN (0x0001)           |
  5269.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5270.    |                              TTL                              |
  5271.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5272.    |           RDLENGTH            |                               |
  5273.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
  5274.    |                                                               |
  5275.    /                       ADDR_ENTRY ARRAY                        /
  5276.    /                                                               /
  5277.    |                                                               |
  5278.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5279.  
  5280.    The ADDR_ENTRY ARRAY a sequence of zero or more ADDR_ENTRY
  5281.    records.  Each ADDR_ENTRY record represents an owner of a name.
  5282.    For group names there may be multiple entries.  However, the list
  5283.    may be incomplete due to packet size limitations.  Bit 22, "T",
  5284.    will be set to indicate truncated data.
  5285.  
  5286.    Each ADDR_ENTRY has the following format:
  5287.  
  5288.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5289.    |          NB_FLAGS             |          NB_ADDRESS           |
  5290.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5291.    |   NB_ADDRESS (continued)      |
  5292.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306. NetBIOS Working Group                                          [Page 22]
  5307.  
  5308. RFC 1002                                                      March 1987
  5309.  
  5310.  
  5311. 4.2.14.  NEGATIVE NAME QUERY RESPONSE
  5312.  
  5313.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5314.     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
  5315.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5316.    |         NAME_TRN_ID           |1|  0x0  |1|0|1|?|0 0|0| RCODE |
  5317.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5318.    |          0x0000               |           0x0000              |
  5319.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5320.    |          0x0000               |           0x0000              |
  5321.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5322.    |                                                               |
  5323.    /                            RR_NAME                            /
  5324.    /                                                               /
  5325.    |                                                               |
  5326.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5327.    |           NULL (0x000A)       |         IN (0x0001)           |
  5328.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5329.    |                          0x00000000                           |
  5330.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5331.    |           0x0000              |
  5332.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5333.  
  5334.    RCODE field values:
  5335.  
  5336.    Symbol      Value   Description
  5337.  
  5338.    FMT_ERR       0x1   Format Error.  Request was invalidly
  5339.                        formatted.
  5340.    SRV_ERR       0x2   Server failure.  Problem with NBNS, cannot
  5341.                        process name.
  5342.    NAM_ERR       0x3   Name Error.  The name requested does not
  5343.                        exist.
  5344.    IMP_ERR       0x4   Unsupported request error.  Allowable only
  5345.                        for challenging NBNS when gets an Update type
  5346.                        registration request.
  5347.    RFS_ERR       0x5   Refused error.  For policy reasons server
  5348.                        will not register this name from this host.
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.  
  5356.  
  5357.  
  5358.  
  5359.  
  5360.  
  5361.  
  5362.  
  5363.  
  5364.  
  5365. NetBIOS Working Group                                          [Page 23]
  5366.  
  5367. RFC 1002                                                      March 1987
  5368.  
  5369.  
  5370. 4.2.15.  REDIRECT NAME QUERY RESPONSE
  5371.  
  5372.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5373.     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
  5374.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5375.    |         NAME_TRN_ID           |1|  0x0  |0|0|1|0|0 0|0|  0x0  |
  5376.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5377.    |          0x0000               |           0x0000              |
  5378.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5379.    |          0x0001               |           0x0001              |
  5380.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5381.    |                                                               |
  5382.    /                            RR_NAME                            /
  5383.    /                                                               /
  5384.    |                                                               |
  5385.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5386.    |           NS (0x0002)         |         IN (0x0001)           |
  5387.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5388.    |                              TTL                              |
  5389.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5390.    |           RDLENGTH            |                               |
  5391.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
  5392.    |                                                               |
  5393.    /                            NSD_NAME                           /
  5394.    /                                                               /
  5395.    |                                                               |
  5396.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5397.    |                                                               |
  5398.    /                            RR_NAME                            /
  5399.    /                                                               /
  5400.    |                                                               |
  5401.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5402.    |           A (0x0001)          |         IN (0x0001)           |
  5403.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5404.    |                              TTL                              |
  5405.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5406.    |             0x0004            |           NSD_IP_ADDR         |
  5407.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5408.    |     NSD_IP_ADDR, continued    |
  5409.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5410.  
  5411.    An end node responding to a NAME QUERY REQUEST always responds
  5412.    with the AA and RA bits set for both the NEGATIVE and POSITIVE
  5413.    NAME QUERY RESPONSE packets.  An end node never sends a REDIRECT
  5414.    NAME QUERY RESPONSE packet.
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.  
  5424. NetBIOS Working Group                                          [Page 24]
  5425.  
  5426. RFC 1002                                                      March 1987
  5427.  
  5428.  
  5429.    When the requestor receives the REDIRECT NAME QUERY RESPONSE it
  5430.    must reiterate the NAME QUERY REQUEST to the NBNS specified by
  5431.    the NSD_IP_ADDR field of the A type RESOURCE RECORD in the
  5432.    ADDITIONAL section of the response packet.  This is an optional
  5433.    packet for the NBNS.
  5434.  
  5435.    The NSD_NAME and the RR_NAME in the ADDITIONAL section of the
  5436.    response packet are the same name.  Space can be optimized if
  5437.    label string pointers are used in the RR_NAME which point to the
  5438.    labels in the NSD_NAME.
  5439.  
  5440.    The RR_NAME in the AUTHORITY section is the name of the domain
  5441.    the NBNS called by NSD_NAME has authority over.
  5442.  
  5443. 4.2.16.  WAIT FOR ACKNOWLEDGEMENT (WACK) RESPONSE
  5444.  
  5445.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5446.     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
  5447.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5448.    |         NAME_TRN_ID           |1|  0x7  |1|0|0|0|0 0|0|  0x0  |
  5449.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5450.    |          0x0000               |           0x0001              |
  5451.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5452.    |          0x0000               |           0x0000              |
  5453.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5454.    |                                                               |
  5455.    /                            RR_NAME                            /
  5456.    /                                                               /
  5457.    |                                                               |
  5458.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5459.    |          NULL (0x0020)        |         IN (0x0001)           |
  5460.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5461.    |                              TTL                              |
  5462.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5463.    |           0x0002              | OPCODE  |   NM_FLAGS  |  0x0  |
  5464.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483. NetBIOS Working Group                                          [Page 25]
  5484.  
  5485. RFC 1002                                                      March 1987
  5486.  
  5487.  
  5488.    The NAME_TRN_ID of the WACK RESPONSE packet is the same
  5489.    NAME_TRN_ID of the request that the NBNS is telling the requestor
  5490.    to wait longer to complete.  The RR_NAME is the name from the
  5491.    request, if any.  If no name is available from the request then
  5492.    it is a null name, single byte of zero.
  5493.  
  5494.    The TTL field of the ResourceRecord is the new time to wait, in
  5495.    seconds, for the request to complete.  The RDATA field contains
  5496.    the OPCODE and NM_FLAGS of the request.
  5497.  
  5498.    A TTL value of 0 means that the NBNS can not estimate the time it
  5499.    may take to complete a response.
  5500.  
  5501. 4.2.17.  NODE STATUS REQUEST
  5502.  
  5503.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5504.     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
  5505.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5506.    |         NAME_TRN_ID           |0|  0x0  |0|0|0|0|0 0|B|  0x0  |
  5507.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5508.    |          0x0001               |           0x0000              |
  5509.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5510.    |          0x0000               |           0x0000              |
  5511.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5512.    |                                                               |
  5513.    /                         QUESTION_NAME                         /
  5514.    |                                                               |
  5515.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5516.    |         NBSTAT (0x0021)       |        IN (0x0001)            |
  5517.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.  
  5542. NetBIOS Working Group                                          [Page 26]
  5543.  
  5544. RFC 1002                                                      March 1987
  5545.  
  5546.  
  5547. 4.2.18.  NODE STATUS RESPONSE
  5548.  
  5549.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5550.     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
  5551.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5552.    |         NAME_TRN_ID           |1|  0x0  |1|0|0|0|0 0|0|  0x0  |
  5553.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5554.    |          0x0000               |           0x0001              |
  5555.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5556.    |          0x0000               |           0x0000              |
  5557.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5558.    |                                                               |
  5559.    /                            RR_NAME                            /
  5560.    |                                                               |
  5561.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5562.    |        NBSTAT (0x0021)        |         IN (0x0001)           |
  5563.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5564.    |                          0x00000000                           |
  5565.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5566.    |          RDLENGTH             |   NUM_NAMES   |               |
  5567.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +
  5568.    |                                                               |
  5569.    +                                                               +
  5570.    /                         NODE_NAME ARRAY                       /
  5571.    +                                                               +
  5572.    |                                                               |
  5573.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5574.    |                                                               |
  5575.    +                                                               +
  5576.    /                           STATISTICS                          /
  5577.    +                                                               +
  5578.    |                                                               |
  5579.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5580.  
  5581.    The NODE_NAME ARRAY is an array of zero or more NUM_NAMES entries
  5582.    of NODE_NAME records.  Each NODE_NAME entry represents an active
  5583.    name in the same NetBIOS scope as the requesting name in the
  5584.    local name table of the responder.  RR_NAME is the requesting
  5585.    name.
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601. NetBIOS Working Group                                          [Page 27]
  5602.  
  5603. RFC 1002                                                      March 1987
  5604.  
  5605.  
  5606.    NODE_NAME Entry:
  5607.  
  5608.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5609.     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
  5610.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5611.    |                                                               |
  5612.    +---                                                         ---+
  5613.    |                                                               |
  5614.    +---                    NETBIOS FORMAT NAME                  ---+
  5615.    |                                                               |
  5616.    +---                                                         ---+
  5617.    |                                                               |
  5618.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5619.    |         NAME_FLAGS            |
  5620.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5621.  
  5622.    The NAME_FLAGS field:
  5623.  
  5624.                                              1   1   1   1   1   1
  5625.      0   1   2   3   4   5   6   7   8   9   0   1   2   3   4   5
  5626.    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  5627.    | G |  ONT  |DRG|CNF|ACT|PRM|          RESERVED                 |
  5628.    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  5629.  
  5630.    The NAME_FLAGS field is defined as:
  5631.  
  5632.    Symbol     Bit(s)   Description:
  5633.  
  5634.    RESERVED     7-15   Reserved for future use.  Must be zero (0).
  5635.    PRM             6   Permanent Name Flag.  If one (1) then entry
  5636.                        is for the permanent node name.  Flag is zero
  5637.                        (0) for all other names.
  5638.    ACT             5   Active Name Flag.  All entries have this flag
  5639.                        set to one (1).
  5640.    CNF             4   Conflict Flag.  If one (1) then name on this
  5641.                        node is in conflict.
  5642.    DRG             3   Deregister Flag.  If one (1) then this name
  5643.                        is in the process of being deleted.
  5644.    ONT           1,2   Owner Node Type:
  5645.                           00 = B node
  5646.                           01 = P node
  5647.                           10 = M node
  5648.                           11 = Reserved for future use
  5649.    G               0   Group Name Flag.
  5650.                        If one (1) then the name is a GROUP NetBIOS
  5651.                        name.
  5652.                        If zero (0) then it is a UNIQUE NetBIOS name.
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660. NetBIOS Working Group                                          [Page 28]
  5661.  
  5662. RFC 1002                                                      March 1987
  5663.  
  5664.  
  5665.    STATISTICS Field of the NODE STATUS RESPONSE:
  5666.  
  5667.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5668.     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
  5669.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5670.    |               UNIT_ID (Unique unit ID)                        |
  5671.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5672.    |       UNIT_ID,continued       |    JUMPERS    |  TEST_RESULT  |
  5673.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5674.    |       VERSION_NUMBER          |      PERIOD_OF_STATISTICS     |
  5675.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5676.    |       NUMBER_OF_CRCs          |     NUMBER_ALIGNMENT_ERRORS   |
  5677.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5678.    |       NUMBER_OF_COLLISIONS    |        NUMBER_SEND_ABORTS     |
  5679.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5680.    |                       NUMBER_GOOD_SENDS                       |
  5681.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5682.    |                      NUMBER_GOOD_RECEIVES                     |
  5683.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5684.    |       NUMBER_RETRANSMITS      | NUMBER_NO_RESOURCE_CONDITIONS |
  5685.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5686.    |  NUMBER_FREE_COMMAND_BLOCKS   |  TOTAL_NUMBER_COMMAND_BLOCKS  |
  5687.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5688.    |MAX_TOTAL_NUMBER_COMMAND_BLOCKS|    NUMBER_PENDING_SESSIONS    |
  5689.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5690.    |  MAX_NUMBER_PENDING_SESSIONS  |  MAX_TOTAL_SESSIONS_POSSIBLE  |
  5691.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5692.    |   SESSION_DATA_PACKET_SIZE    |
  5693.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5694.  
  5695. 4.3.  SESSION SERVICE PACKETS
  5696.  
  5697. 4.3.1.  GENERAL FORMAT OF SESSION PACKETS
  5698.  
  5699.    All session service messages are sent over a TCP connection.
  5700.  
  5701.    All session packets are of the following general structure:
  5702.  
  5703.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5704.     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
  5705.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5706.    |      TYPE     |     FLAGS     |            LENGTH             |
  5707.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5708.    |                                                               |
  5709.    /               TRAILER (Packet Type Dependent)                 /
  5710.    |                                                               |
  5711.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5712.  
  5713.    The TYPE, FLAGS, and LENGTH fields are present in every session
  5714.    packet.
  5715.  
  5716.  
  5717.  
  5718.  
  5719. NetBIOS Working Group                                          [Page 29]
  5720.  
  5721. RFC 1002                                                      March 1987
  5722.  
  5723.  
  5724.    The LENGTH field is the number of bytes following the LENGTH
  5725.    field.  In other words, LENGTH is the combined size of the
  5726.    TRAILER field(s).  For example, the POSITIVE SESSION RESPONSE
  5727.    packet always has a LENGTH field value of zero (0000) while the
  5728.    RETARGET SESSION RESPONSE always has a LENGTH field value of six
  5729.    (0006).
  5730.  
  5731.    One of the bits of the FLAGS field acts as an additional, high-
  5732.    order bit for the LENGTH field.  Thus the cumulative size of the
  5733.    trailer field(s) may range from 0 to 128K bytes.
  5734.  
  5735.    Session Packet Types (in hexidecimal):
  5736.  
  5737.            00 -  SESSION MESSAGE
  5738.            81 -  SESSION REQUEST
  5739.            82 -  POSITIVE SESSION RESPONSE
  5740.            83 -  NEGATIVE SESSION RESPONSE
  5741.            84 -  RETARGET SESSION RESPONSE
  5742.            85 -  SESSION KEEP ALIVE
  5743.  
  5744.    Bit definitions of the FLAGS field:
  5745.  
  5746.      0   1   2   3   4   5   6   7
  5747.    +---+---+---+---+---+---+---+---+
  5748.    | 0 | 0 | 0 | 0 | 0 | 0 | 0 | E |
  5749.    +---+---+---+---+---+---+---+---+
  5750.  
  5751.    Symbol     Bit(s)   Description
  5752.  
  5753.    E               7   Length extension, used as an additional,
  5754.                        high-order bit on the LENGTH field.
  5755.  
  5756.    RESERVED      0-6   Reserved, must be zero (0)
  5757.  
  5758. 4.3.2.  SESSION REQUEST PACKET
  5759.  
  5760.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5761.     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
  5762.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5763.    |      TYPE     |     FLAGS     |            LENGTH             |
  5764.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5765.    |                                                               |
  5766.    /                          CALLED NAME                          /
  5767.    |                                                               |
  5768.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5769.    |                                                               |
  5770.    /                          CALLING NAME                         /
  5771.    |                                                               |
  5772.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778. NetBIOS Working Group                                          [Page 30]
  5779.  
  5780. RFC 1002                                                      March 1987
  5781.  
  5782.  
  5783. 4.3.3.  POSITIVE SESSION RESPONSE PACKET
  5784.  
  5785.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5786.     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
  5787.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5788.    |      TYPE     |     FLAGS     |            LENGTH             |
  5789.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5790.  
  5791. 4.3.4.  NEGATIVE SESSION RESPONSE PACKET
  5792.  
  5793.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5794.     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
  5795.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5796.    |      TYPE     |     FLAGS     |            LENGTH             |
  5797.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5798.    |   ERROR_CODE  |
  5799.    +-+-+-+-+-+-+-+-+
  5800.  
  5801.    NEGATIVE SESSION RESPONSE packet error code values (in
  5802.    hexidecimal):
  5803.  
  5804.            80 -  Not listening on called name
  5805.            81 -  Not listening for calling name
  5806.            82 -  Called name not present
  5807.            83 -  Called name present, but insufficient resources
  5808.            8F -  Unspecified error
  5809.  
  5810. 4.3.5.  SESSION RETARGET RESPONSE PACKET
  5811.  
  5812.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5813.     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
  5814.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5815.    |      TYPE     |     FLAGS     |            LENGTH             |
  5816.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5817.    |                      RETARGET_IP_ADDRESS                      |
  5818.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5819.    |           PORT                |
  5820.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5821.  
  5822.  
  5823.  
  5824.  
  5825.  
  5826.  
  5827.  
  5828.  
  5829.  
  5830.  
  5831.  
  5832.  
  5833.  
  5834.  
  5835.  
  5836.  
  5837. NetBIOS Working Group                                          [Page 31]
  5838.  
  5839. RFC 1002                                                      March 1987
  5840.  
  5841.  
  5842. 4.3.6.  SESSION MESSAGE PACKET
  5843.  
  5844.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5845.     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
  5846.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5847.    |      TYPE     |     FLAGS     |            LENGTH             |
  5848.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5849.    |                                                               |
  5850.    /                                                               /
  5851.    /                           USER_DATA                           /
  5852.    /                                                               /
  5853.    |                                                               |
  5854.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5855.  
  5856. 4.3.7.  SESSION KEEP ALIVE PACKET
  5857.  
  5858.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5859.     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
  5860.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5861.    |      TYPE     |     FLAGS     |            LENGTH             |
  5862.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5863.  
  5864. 4.4.  DATAGRAM SERVICE PACKETS
  5865.  
  5866. 4.4.1.  NetBIOS DATAGRAM HEADER
  5867.  
  5868.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5869.     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
  5870.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5871.    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |
  5872.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5873.    |                           SOURCE_IP                           |
  5874.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5875.    |          SOURCE_PORT          |          DGM_LENGTH           |
  5876.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5877.    |         PACKET_OFFSET         |
  5878.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5879.  
  5880.    MSG_TYPE values (in hexidecimal):
  5881.  
  5882.            10 -  DIRECT_UNIQUE DATAGRAM
  5883.            11 -  DIRECT_GROUP DATAGRAM
  5884.            12 -  BROADCAST DATAGRAM
  5885.            13 -  DATAGRAM ERROR
  5886.            14 -  DATAGRAM QUERY REQUEST
  5887.            15 -  DATAGRAM POSITIVE QUERY RESPONSE
  5888.            16 -  DATAGRAM NEGATIVE QUERY RESPONSE
  5889.  
  5890.  
  5891.  
  5892.  
  5893.  
  5894.  
  5895.  
  5896. NetBIOS Working Group                                          [Page 32]
  5897.  
  5898. RFC 1002                                                      March 1987
  5899.  
  5900.  
  5901.    Bit definitions of the FLAGS field:
  5902.  
  5903.      0   1   2   3   4   5   6   7
  5904.    +---+---+---+---+---+---+---+---+
  5905.    | 0 | 0 | 0 | 0 |  SNT  | F | M |
  5906.    +---+---+---+---+---+---+---+---+
  5907.  
  5908.    Symbol     Bit(s)   Description
  5909.  
  5910.    M               7   MORE flag, If set then more NetBIOS datagram
  5911.                        fragments follow.
  5912.  
  5913.    F               6   FIRST packet flag,  If set then this is first
  5914.                        (and possibly only) fragment of NetBIOS
  5915.                        datagram
  5916.  
  5917.    SNT           4,5   Source End-Node type:
  5918.                           00 = B node
  5919.                           01 = P node
  5920.                           10 = M node
  5921.                           11 = NBDD
  5922.    RESERVED      0-3   Reserved, must be zero (0)
  5923.  
  5924. 4.4.2.  DIRECT_UNIQUE, DIRECT_GROUP, & BROADCAST DATAGRAM
  5925.  
  5926.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5927.     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
  5928.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5929.    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |
  5930.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5931.    |                           SOURCE_IP                           |
  5932.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5933.    |          SOURCE_PORT          |          DGM_LENGTH           |
  5934.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5935.    |         PACKET_OFFSET         |                               |
  5936.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
  5937.    |                                                               |
  5938.    /                          SOURCE_NAME                          /
  5939.    /                                                               /
  5940.    |                                                               |
  5941.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5942.    |                                                               |
  5943.    /                       DESTINATION_NAME                        /
  5944.    /                                                               /
  5945.    |                                                               |
  5946.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5947.    |                                                               |
  5948.    /                           USER_DATA                           /
  5949.    /                                                               /
  5950.    |                                                               |
  5951.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5952.  
  5953.  
  5954.  
  5955. NetBIOS Working Group                                          [Page 33]
  5956.  
  5957. RFC 1002                                                      March 1987
  5958.  
  5959.  
  5960.    4.4.3.  DATAGRAM ERROR PACKET
  5961.  
  5962.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5963.     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
  5964.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5965.    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |
  5966.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5967.    |                           SOURCE_IP                           |
  5968.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5969.    |          SOURCE_PORT          |  ERROR_CODE   |
  5970.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5971.  
  5972.    ERROR_CODE values (in hexidecimal):
  5973.  
  5974.            82 -  DESTINATION NAME NOT PRESENT
  5975.            83 -  INVALID SOURCE NAME FORMAT
  5976.            84 -  INVALID DESTINATION NAME FORMAT
  5977.  
  5978. 4.4.4.  DATAGRAM QUERY REQUEST
  5979.  
  5980.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5981.     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
  5982.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5983.    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |
  5984.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5985.    |                           SOURCE_IP                           |
  5986.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5987.    |          SOURCE_PORT          |                               |
  5988.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
  5989.    |                                                               |
  5990.    /                       DESTINATION_NAME                        /
  5991.    /                                                               /
  5992.    |                                                               |
  5993.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  5994.  
  5995. 4.4.5.  DATAGRAM POSITIVE AND NEGATIVE QUERY RESPONSE
  5996.  
  5997.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
  5998.     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
  5999.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  6000.    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |
  6001.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  6002.    |                           SOURCE_IP                           |
  6003.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  6004.    |          SOURCE_PORT          |                               |
  6005.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
  6006.    |                                                               |
  6007.    /                       DESTINATION_NAME                        /
  6008.    /                                                               /
  6009.    |                                                               |
  6010.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  6011.  
  6012.  
  6013.  
  6014. NetBIOS Working Group                                          [Page 34]
  6015.  
  6016. RFC 1002                                                      March 1987
  6017.  
  6018.  
  6019. 5.  PROTOCOL DESCRIPTIONS
  6020.  
  6021. 5.1.  NAME SERVICE PROTOCOLS
  6022.  
  6023.    A REQUEST packet is always sent to the well known UDP port -
  6024.    NAME_SERVICE_UDP_PORT.  The destination address is normally
  6025.    either the IP broadcast address or the address of the NBNS - the
  6026.    address of the NBNS server it set up at initialization time.  In
  6027.    rare cases, a request packet will be sent to an end node, e.g.  a
  6028.    NAME QUERY REQUEST sent to "challenge" a node.
  6029.  
  6030.    A RESPONSE packet is always sent to the source UDP port and
  6031.    source IP address of the request packet.
  6032.  
  6033.    A DEMAND packet must always be sent to the well known UDP port -
  6034.    NAME_SERVICE_UDP_PORT.  There is no restriction on the target IP
  6035.    address.
  6036.  
  6037.    Terms used in this section:
  6038.  
  6039.    tid -            Transaction ID.  This is a value composed from
  6040.                     the requestor's IP address and a unique 16 bit
  6041.                     value generated by the originator of the
  6042.                     transaction.
  6043.  
  6044. 5.1.1.  B-NODE ACTIVITY
  6045.  
  6046. 5.1.1.1.  B-NODE ADD NAME
  6047.  
  6048.    PROCEDURE add_name(newname)
  6049.  
  6050.    /*
  6051.     * Host initiated processing for a B node
  6052.     */
  6053.    BEGIN
  6054.  
  6055.         REPEAT
  6056.  
  6057.              /* build name service packet */
  6058.  
  6059.              ONT = B_NODE; /* broadcast node */
  6060.              G = UNIQUE;   /* unique name */
  6061.              TTL = 0;
  6062.  
  6063.              broadcast NAME REGISTRATION REQUEST packet;
  6064.  
  6065.              /*
  6066.               * remote node(s) will send response packet
  6067.               * if applicable
  6068.               */
  6069.  
  6070.  
  6071.  
  6072.  
  6073. NetBIOS Working Group                                          [Page 35]
  6074.  
  6075. RFC 1002                                                      March 1987
  6076.  
  6077.  
  6078.              pause(BCAST_REQ_RETRY_TIMEOUT);
  6079.  
  6080.         UNTIL response packet is received or
  6081.              retransmit count has been exceeded
  6082.  
  6083.         IF no response packet was received THEN
  6084.         BEGIN /* no response */
  6085.              /*
  6086.               * build packet
  6087.               */
  6088.  
  6089.              ONT = B_NODE; /* broadcast node */
  6090.              G = UNIQUE;   /* unique name */
  6091.              TTL = 0;
  6092.  
  6093.              /*
  6094.               * Let other nodes known you have the name
  6095.               */
  6096.  
  6097.              broadcast NAME UPDATE REQUEST packet;
  6098.              /* name can be added to local name table */
  6099.              return success;
  6100.         END /* no response */
  6101.         ELSE
  6102.         BEGIN /* got response */
  6103.  
  6104.              /*
  6105.               * Match return transaction id
  6106.               * against tid sent in request
  6107.               */
  6108.  
  6109.             IF NOT response tid = request tid THEN
  6110.             BEGIN
  6111.              ignore response packet;
  6112.             END
  6113.             ELSE
  6114.             CASE packet type OF
  6115.  
  6116.             NEGATIVE NAME REGISTRATION RESPONSE:
  6117.  
  6118.                  return failure; /* name cannot be added */
  6119.  
  6120.             POSITIVE NAME REGISTRATION RESPONSE:
  6121.             END-NODE CHALLENGE NAME REGISTRATION RESPONSE:
  6122.  
  6123.                  /*
  6124.                   * B nodes should normally not get this
  6125.                   * response.
  6126.                   */
  6127.  
  6128.                   ignore packet;
  6129.  
  6130.  
  6131.  
  6132. NetBIOS Working Group                                          [Page 36]
  6133.  
  6134. RFC 1002                                                      March 1987
  6135.  
  6136.  
  6137.             END /* case */;
  6138.         END /* got response */
  6139.    END /* procedure */
  6140.  
  6141. 5.1.1.2.  B-NODE ADD_GROUP NAME
  6142.  
  6143.    PROCEDURE add_group_name(newname)
  6144.  
  6145.    /*
  6146.     * Host initiated processing for a B node
  6147.     */
  6148.  
  6149.    BEGIN
  6150.         /*
  6151.          * same as for a unique name with the
  6152.          * exception that the group bit (G) must
  6153.          * be set in the request packets.
  6154.          */
  6155.  
  6156.         ...
  6157.         G = GROUP;
  6158.         ...
  6159.         ...
  6160.  
  6161.         /*
  6162.          * broadcast request ...
  6163.          */
  6164.  
  6165.  
  6166.    END
  6167.  
  6168. 5.1.1.3.  B-NODE FIND_NAME
  6169.  
  6170.    PROCEDURE find_name(name)
  6171.  
  6172.    /*
  6173.     * Host initiated processing for a B node
  6174.     */
  6175.  
  6176.    BEGIN
  6177.  
  6178.         REPEAT
  6179.              /*
  6180.               * build packet
  6181.               */
  6182.              ONT = B;
  6183.              TTL = 0;
  6184.              G = DONT CARE;
  6185.  
  6186.              broadcast NAME QUERY REQUEST packet;
  6187.  
  6188.  
  6189.  
  6190.  
  6191. NetBIOS Working Group                                          [Page 37]
  6192.  
  6193. RFC 1002                                                      March 1987
  6194.  
  6195.  
  6196.              /*
  6197.               * a node might send response packet
  6198.               */
  6199.  
  6200.              pause(BCAST_REQ_RETRY_TIMEOUT);
  6201.         UNTIL response packet received OR
  6202.              max transmit threshold exceeded
  6203.  
  6204.         IF no response packet received THEN
  6205.              return failure;
  6206.         ELSE
  6207.         IF NOT response tid = request tid THEN
  6208.              ignore packet;
  6209.         ELSE
  6210.         CASE packet type OF
  6211.         POSITIVE NAME QUERY RESPONSE:
  6212.              /*
  6213.               * Start a timer to detect conflict.
  6214.               *
  6215.               * Be prepared to detect conflict if
  6216.               * any more response packets are received.
  6217.               *
  6218.               */
  6219.  
  6220.              save response as authoritative response;
  6221.              start_timer(CONFLICT_TIMER);
  6222.              return success;
  6223.  
  6224.         NEGATIVE NAME QUERY RESPONSE:
  6225.         REDIRECT NAME QUERY RESPONSE:
  6226.  
  6227.              /*
  6228.               * B Node should normally not get either
  6229.               * response.
  6230.               */
  6231.  
  6232.               ignore response packet;
  6233.  
  6234.         END /* case */
  6235.    END /* procedure */
  6236.  
  6237. 5.1.1.4.  B NODE NAME RELEASE
  6238.  
  6239.    PROCEDURE delete_name (name)
  6240.    BEGIN
  6241.  
  6242.         REPEAT
  6243.  
  6244.              /*
  6245.               * build packet
  6246.               */
  6247.  
  6248.  
  6249.  
  6250. NetBIOS Working Group                                          [Page 38]
  6251.  
  6252. RFC 1002                                                      March 1987
  6253.  
  6254.  
  6255.              ...
  6256.  
  6257.              /*
  6258.               * send request
  6259.               */
  6260.  
  6261.              broadcast NAME RELEASE REQUEST packet;
  6262.  
  6263.              /*
  6264.               * no response packet expected
  6265.               */
  6266.  
  6267.              pause(BCAST_REQ_RETRY_TIMEOUT);
  6268.  
  6269.         UNTIL retransmit count has been exceeded
  6270.    END /* procedure */
  6271.  
  6272. 5.1.1.5.  B-NODE INCOMING PACKET PROCESSING
  6273.  
  6274.    Following processing is done when broadcast or unicast packets
  6275.    are received at the NAME_SERVICE_UDP_PORT.
  6276.  
  6277.    PROCEDURE process_incoming_packet(packet)
  6278.  
  6279.    /*
  6280.     * Processing initiated by incoming packets for a B node
  6281.     */
  6282.  
  6283.    BEGIN
  6284.         /*
  6285.          * Note: response packets are always sent
  6286.          * to:
  6287.          * source IP address of request packet
  6288.          * source UDP port of request packet
  6289.          */
  6290.  
  6291.         CASE packet type OF
  6292.  
  6293.         NAME REGISTRATION REQUEST (UNIQUE):
  6294.              IF name exists in local name table THEN
  6295.                   send NEGATIVE NAME REGISTRATION RESPONSE ;
  6296.         NAME REGISTRATION REQUEST (GROUP):
  6297.              IF name exists in local name table THEN
  6298.              BEGIN
  6299.                   IF local entry is a unique name THEN
  6300.                       send NEGATIVE NAME REGISTRATION RESPONSE ;
  6301.              END
  6302.         NAME QUERY REQUEST:
  6303.              IF name exists in local name table THEN
  6304.              BEGIN
  6305.                   build response packet;
  6306.  
  6307.  
  6308.  
  6309. NetBIOS Working Group                                          [Page 39]
  6310.  
  6311. RFC 1002                                                      March 1987
  6312.  
  6313.  
  6314.                   send POSITIVE NAME QUERY RESPONSE;
  6315.         POSITIVE NAME QUERY RESPONSE:
  6316.              IF name conflict timer is not active THEN
  6317.              BEGIN
  6318.                   /*
  6319.                    * timer has expired already...  ignore this
  6320.                    * packet
  6321.                    */
  6322.  
  6323.                   return;
  6324.              END
  6325.              ELSE /* timer is active */
  6326.              IF a response for this name has previously been
  6327.                   received THEN
  6328.              BEGIN /* existing entry */
  6329.  
  6330.                   /*
  6331.                    * we sent out a request packet, and
  6332.                    * have already received (at least)
  6333.                    * one response
  6334.                    *
  6335.                    * Check if conflict exists.
  6336.                    * If so, send out a conflict packet.
  6337.                    *
  6338.                    * Note: detecting conflict does NOT
  6339.                    * affect any existing sessions.
  6340.                    *
  6341.                    */
  6342.  
  6343.                   /*
  6344.                    * Check for name conflict.
  6345.                    * See "Name Conflict" in Concepts and Methods
  6346.                    */
  6347.                   check saved authoritative response against
  6348.                        information in this response packet;
  6349.                   IF conflict detected THEN
  6350.                   BEGIN
  6351.                        unicast NAME CONFLICT DEMAND packet;
  6352.                        IF entry exists in cache THEN
  6353.                        BEGIN
  6354.                             remove entry from cache;
  6355.                        END
  6356.                   END
  6357.              END /* existing entry */
  6358.              ELSE
  6359.              BEGIN
  6360.                   /*
  6361.                    * Note: If this was the first response
  6362.                    * to a name query, it would have been
  6363.                    * handled in the
  6364.                    * find_name() procedure.
  6365.  
  6366.  
  6367.  
  6368. NetBIOS Working Group                                          [Page 40]
  6369.  
  6370. RFC 1002                                                      March 1987
  6371.  
  6372.  
  6373.                    */
  6374.  
  6375.                   ignore packet;
  6376.              END
  6377.         NAME CONFLICT DEMAND:
  6378.              IF name exists in local name table THEN
  6379.              BEGIN
  6380.                   mark name as conflict detected;
  6381.  
  6382.                   /*
  6383.                    * a name in the state "conflict detected"
  6384.                    * does not "logically" exist on that node.
  6385.                    * No further session will be accepted on
  6386.                    * that name.
  6387.                    * No datagrams can be sent against that name.
  6388.                    * Such an entry will not be used for
  6389.                    * purposes of processing incoming request
  6390.                    * packets.
  6391.                    * The only valid user NetBIOS operation
  6392.                    * against such a name is DELETE NAME.
  6393.                    */
  6394.              END
  6395.         NAME RELEASE REQUEST:
  6396.              IF caching is being done THEN
  6397.              BEGIN
  6398.                   remove entry from cache;
  6399.              END
  6400.         NAME UPDATE REQUEST:
  6401.              IF caching is being done THEN
  6402.              BEGIN
  6403.                   IF entry exists in cache already,
  6404.                        update cache;
  6405.                   ELSE IF name is "interesting" THEN
  6406.                   BEGIN
  6407.                        add entry to cache;
  6408.                   END
  6409.              END
  6410.  
  6411.         NODE STATUS REQUEST:
  6412.              IF name exists in local name table THEN
  6413.              BEGIN
  6414.                   /*
  6415.                    * send only those names that are
  6416.                    * in the same scope as the scope
  6417.                    * field in the request packet
  6418.                    */
  6419.  
  6420.                   send NODE STATUS RESPONSE;
  6421.              END
  6422.    END
  6423.  
  6424.  
  6425.  
  6426.  
  6427. NetBIOS Working Group                                          [Page 41]
  6428.  
  6429. RFC 1002                                                      March 1987
  6430.  
  6431.  
  6432. 5.1.2.  P-NODE ACTIVITY
  6433.  
  6434.    All packets sent or received by P nodes are unicast UDP packets.
  6435.    A P node sends name service requests to the NBNS node that is
  6436.    specified in the P-node configuration.
  6437.  
  6438. 5.1.2.1.  P-NODE ADD_NAME
  6439.  
  6440.    PROCEDURE add_name(newname)
  6441.  
  6442.    /*
  6443.     * Host initiated processing for a P node
  6444.     */
  6445.  
  6446.    BEGIN
  6447.  
  6448.         REPEAT
  6449.              /*
  6450.               * build packet
  6451.               */
  6452.  
  6453.              ONT = P;
  6454.              G = UNIQUE;
  6455.              ...
  6456.  
  6457.              /*
  6458.               * send request
  6459.               */
  6460.  
  6461.              unicast NAME REGISTRATION REQUEST packet;
  6462.  
  6463.              /*
  6464.               * NBNS will send response packet
  6465.               */
  6466.  
  6467.              IF receive a WACK RESPONSE THEN
  6468.                   pause(time from TTL field of response);
  6469.              ELSE
  6470.                   pause(UCAST_REQ_RETRY_TIMEOUT);
  6471.         UNTIL response packet is received OR
  6472.              retransmit count has been exceeded
  6473.  
  6474.         IF no response packet was received THEN
  6475.         BEGIN /* no response */
  6476.              /*
  6477.               * NBNS is down.  Cannot claim name.
  6478.               */
  6479.  
  6480.              return failure; /* name cannot be claimed */
  6481.         END /* no response */
  6482.         ELSE
  6483.  
  6484.  
  6485.  
  6486. NetBIOS Working Group                                          [Page 42]
  6487.  
  6488. RFC 1002                                                      March 1987
  6489.  
  6490.  
  6491.         BEGIN /* response */
  6492.             IF NOT response tid = request tid THEN
  6493.             BEGIN
  6494.              /*  Packet may belong to another transaction  */
  6495.              ignore response packet;
  6496.             END
  6497.             ELSE
  6498.             CASE packet type OF
  6499.  
  6500.             POSITIVE NAME REGISTRATION RESPONSE:
  6501.  
  6502.                  /*
  6503.                   * name can be added
  6504.                   */
  6505.  
  6506.                  adjust refresh timeout value, TTL, for this name;
  6507.                  return success;      /* name can be added */
  6508.  
  6509.             NEGATIVE NAME REGISTRATION RESPONSE:
  6510.                  return failure; /* name cannot be added */
  6511.  
  6512.             END-NODE CHALLENGE REGISTRATION REQUEST:
  6513.             BEGIN /* end node challenge */
  6514.  
  6515.                  /*
  6516.                   * The response packet has in it the
  6517.                   * address of the presumed owner of the
  6518.                   * name.  Challenge that owner.
  6519.                   * If owner either does not
  6520.                   * respond or indicates that he no longer
  6521.                   * owns the name, claim the name.
  6522.                   * Otherwise, the name cannot be claimed.
  6523.                   *
  6524.                   */
  6525.  
  6526.                  REPEAT
  6527.                   /*
  6528.                    * build packet
  6529.                    */
  6530.                   ...
  6531.  
  6532.                   unicast NAME QUERY REQUEST packet to the
  6533.                        address contained in the END NODE
  6534.                        CHALLENGE RESPONSE packet;
  6535.  
  6536.                   /*
  6537.                    * remote node may send response packet
  6538.                    */
  6539.  
  6540.                   pause(UCAST_REQ_RETRY_TIMEOUT);
  6541.  
  6542.  
  6543.  
  6544.  
  6545. NetBIOS Working Group                                          [Page 43]
  6546.  
  6547. RFC 1002                                                      March 1987
  6548.  
  6549.  
  6550.                  UNTIL response packet is received or
  6551.                      retransmit count has been exceeded
  6552.                  IF no response packet is received OR
  6553.                        NEGATIVE NAME QUERY RESPONSE packet
  6554.                        received THEN
  6555.                  BEGIN /* update */
  6556.  
  6557.                   /*
  6558.                    * name can be claimed
  6559.                    */
  6560.  
  6561.                   REPEAT
  6562.  
  6563.                       /*
  6564.                        * build packet
  6565.                        */
  6566.                        ...
  6567.  
  6568.                       unicast NAME UPDATE REQUEST to NBNS;
  6569.  
  6570.                       /*
  6571.                        * NBNS node will send response packet
  6572.                        */
  6573.  
  6574.                       IF receive a WACK RESPONSE THEN
  6575.                             pause(time from TTL field of response);
  6576.                       ELSE
  6577.                             pause(UCAST_REQ_RETRY_TIMEOUT);
  6578.                   UNTIL response packet is received or
  6579.                       retransmit count has been exceeded
  6580.                   IF no response packet received THEN
  6581.                   BEGIN /* no response */
  6582.  
  6583.                        /*
  6584.                         * name could not be claimed
  6585.                         */
  6586.  
  6587.                        return failure;
  6588.                   END /* no response */
  6589.                   ELSE
  6590.                   CASE packet type OF
  6591.                        POSITIVE NAME REGISTRATION RESPONSE:
  6592.                             /*
  6593.                              * add name
  6594.                              */
  6595.                             return success;
  6596.                        NEGATIVE NAME REGISTRATION RESPONSE:
  6597.  
  6598.                             /*
  6599.                              * you lose  ...
  6600.                              */
  6601.  
  6602.  
  6603.  
  6604. NetBIOS Working Group                                          [Page 44]
  6605.  
  6606. RFC 1002                                                      March 1987
  6607.  
  6608.  
  6609.                             return failure;
  6610.                        END /* case */
  6611.                  END /* update */
  6612.                  ELSE
  6613.  
  6614.                  /*
  6615.                   * received a positive response to the "challenge"
  6616.                   * Remote node still has name
  6617.                   */
  6618.  
  6619.                   return failure;
  6620.             END /* end node challenge */
  6621.         END /* response */
  6622.    END /* procedure */
  6623.  
  6624. 5.1.2.2.  P-NODE ADD GROUP NAME
  6625.  
  6626.    PROCEDURE add_group_name(newname)
  6627.  
  6628.    /*
  6629.     * Host initiated processing for a P node
  6630.     */
  6631.  
  6632.    BEGIN
  6633.         /*
  6634.          * same as for a unique name, except that the
  6635.          * request packet must indicate that a
  6636.          * group name claim is being made.
  6637.          */
  6638.  
  6639.         ...
  6640.         G = GROUP;
  6641.         ...
  6642.  
  6643.         /*
  6644.          * send packet
  6645.          */
  6646.          ...
  6647.  
  6648.  
  6649.    END
  6650.  
  6651.    5.1.2.3.  P-NODE FIND NAME
  6652.  
  6653.    PROCEDURE find_name(name)
  6654.  
  6655.    /*
  6656.     * Host initiated processing for a P node
  6657.     */
  6658.  
  6659.    BEGIN
  6660.  
  6661.  
  6662.  
  6663. NetBIOS Working Group                                          [Page 45]
  6664.  
  6665. RFC 1002                                                      March 1987
  6666.  
  6667.  
  6668.         REPEAT
  6669.              /*
  6670.               * build packet
  6671.               */
  6672.  
  6673.              ONT = P;
  6674.              G = DONT CARE;
  6675.  
  6676.              unicast NAME QUERY REQUEST packet;
  6677.  
  6678.              /*
  6679.               * a NBNS node might send response packet
  6680.               */
  6681.  
  6682.              IF receive a WACK RESPONSE THEN
  6683.                   pause(time from TTL field of response);
  6684.              ELSE
  6685.                   pause(UCAST_REQ_RETRY_TIMEOUT);
  6686.         UNTIL response packet received OR
  6687.              max transmit threshold exceeded
  6688.  
  6689.         IF no response packet received THEN
  6690.              return failure;
  6691.         ELSE
  6692.         IF NOT response tid = request tid THEN
  6693.              ignore packet;
  6694.         ELSE
  6695.         CASE packet type OF
  6696.         POSITIVE NAME QUERY RESPONSE:
  6697.              return success;
  6698.  
  6699.         REDIRECT NAME QUERY RESPONSE:
  6700.  
  6701.              /*
  6702.               * NBNS node wants this end node
  6703.               * to use some other NBNS node
  6704.               * to resolve the query.
  6705.               */
  6706.  
  6707.               repeat query with NBNS address
  6708.                   in the response packet;
  6709.         NEGATIVE NAME QUERY RESPONSE:
  6710.              return failure;
  6711.  
  6712.         END /* case */
  6713.    END /* procedure */
  6714.  
  6715. 5.1.2.4.  P-NODE DELETE_NAME
  6716.  
  6717.    PROCEDURE delete_name (name)
  6718.  
  6719.  
  6720.  
  6721.  
  6722. NetBIOS Working Group                                          [Page 46]
  6723.  
  6724. RFC 1002                                                      March 1987
  6725.  
  6726.  
  6727.    /*
  6728.     * Host initiated processing for a P node
  6729.     */
  6730.  
  6731.    BEGIN
  6732.  
  6733.         REPEAT
  6734.  
  6735.              /*
  6736.               * build packet
  6737.               */
  6738.              ...
  6739.  
  6740.              /*
  6741.               * send request
  6742.               */
  6743.  
  6744.              unicast NAME RELEASE REQUEST packet;
  6745.              IF receive a WACK RESPONSE THEN
  6746.                   pause(time from TTL field of response);
  6747.              ELSE
  6748.                   pause(UCAST_REQ_RETRY_TIMEOUT);
  6749.         UNTIL retransmit count has been exceeded
  6750.              or response been received
  6751.  
  6752.         IF response has been received THEN
  6753.         CASE packet type OF
  6754.         POSITIVE NAME RELEASE RESPONSE:
  6755.              return success;
  6756.         NEGATIVE NAME RELEASE RESPONSE:
  6757.  
  6758.              /*
  6759.               * NBNS does want node to delete this
  6760.               * name !!!
  6761.               */
  6762.  
  6763.              return failure;
  6764.         END /* case */
  6765.    END /* procedure */
  6766.  
  6767. 5.1.2.5.  P-NODE INCOMING PACKET PROCESSING
  6768.  
  6769.    Processing initiated by reception of packets at a P node
  6770.  
  6771.    PROCEDURE process_incoming_packet(packet)
  6772.  
  6773.    /*
  6774.     * Processing initiated by incoming packets at a P node
  6775.     */
  6776.  
  6777.    BEGIN
  6778.  
  6779.  
  6780.  
  6781. NetBIOS Working Group                                          [Page 47]
  6782.  
  6783. RFC 1002                                                      March 1987
  6784.  
  6785.  
  6786.         /*
  6787.          * always ignore UDP broadcast packets
  6788.          */
  6789.  
  6790.         IF packet was sent as a broadcast THEN
  6791.         BEGIN
  6792.              ignore packet;
  6793.              return;
  6794.         END
  6795.         CASE packet type of
  6796.  
  6797.         NAME CONFLICT DEMAND:
  6798.              IF name exists in local name table THEN
  6799.                   mark name as in conflict;
  6800.              return;
  6801.  
  6802.         NAME QUERY REQUEST:
  6803.              IF name exists in local name table THEN
  6804.              BEGIN /* name exists */
  6805.  
  6806.                   /*
  6807.                    * build packet
  6808.                    */
  6809.                   ...
  6810.  
  6811.                   /*
  6812.                    * send response to the IP address and port
  6813.                    * number from which the request was received.
  6814.                    */
  6815.  
  6816.                   send POSITIVE NAME QUERY RESPONSE ;
  6817.                   return;
  6818.              END /* exists */
  6819.              ELSE
  6820.              BEGIN /* does not exist */
  6821.  
  6822.                   /*
  6823.                    * send response to the requestor
  6824.                    */
  6825.  
  6826.                   send NEGATIVE NAME QUERY RESPONSE ;
  6827.                   return;
  6828.              END /* does not exist */
  6829.         NODE STATUS REQUEST:
  6830.              /*
  6831.               * Name of "*" may be used for force node to
  6832.               * divulge status for administrative purposes
  6833.               */
  6834.              IF name in local name table OR name = "*" THEN
  6835.              BEGIN
  6836.                   /*
  6837.  
  6838.  
  6839.  
  6840. NetBIOS Working Group                                          [Page 48]
  6841.  
  6842. RFC 1002                                                      March 1987
  6843.  
  6844.  
  6845.                    * Build response packet and
  6846.                    * send to requestor node
  6847.                    * Send only those names that are
  6848.                    * in the same scope as the scope
  6849.                    * in the request packet.
  6850.                    */
  6851.  
  6852.                   send NODE STATUS RESPONSE;
  6853.              END
  6854.  
  6855.         NAME RELEASE REQUEST:
  6856.              /*
  6857.               * This will be received if the NBNS wants to flush the
  6858.               * name from the local name table, or from the local
  6859.               * cache.
  6860.               */
  6861.  
  6862.              IF name exists in the local name table THEN
  6863.              BEGIN
  6864.                   delete name from local name table;
  6865.                   inform user that name has been deleted;
  6866.              END
  6867.              ELSE
  6868.                   IF name has been cached locally THEN
  6869.                   BEGIN
  6870.                        remove entry from cache:
  6871.                   END
  6872.  
  6873.         END /* case */
  6874.    END /* procedure */
  6875.  
  6876. 5.1.2.6.  P-NODE TIMER INITIATED PROCESSING
  6877.  
  6878.    Processing initiated by timer expiration.
  6879.  
  6880.    PROCEDURE timer_expired()
  6881.    /*
  6882.     * Processing initiated by the expiration of a timer on a P node
  6883.     */
  6884.    BEGIN
  6885.         /*
  6886.          * Send a NAME REFRESH REQUEST for each name which the
  6887.          * TTL which has expired.
  6888.          */
  6889.         REPEAT
  6890.              build NAME REFRESH REQUEST packet;
  6891.              REPEAT
  6892.                   send packet to NBNS;
  6893.  
  6894.                   IF receive a WACK RESPONSE THEN
  6895.                        pause(time from TTL field of response);
  6896.  
  6897.  
  6898.  
  6899. NetBIOS Working Group                                          [Page 49]
  6900.  
  6901. RFC 1002                                                      March 1987
  6902.  
  6903.  
  6904.                   ELSE
  6905.                        pause(UCAST_REQ_RETRY_TIMEOUT);
  6906.              UNTIL response packet is received or
  6907.                   retransmit count has been exceeded
  6908.  
  6909.              CASE packet type OF
  6910.                POSITIVE NAME REGISTRATION RESPONSE:
  6911.                   /* successfully refreshed */
  6912.                   reset TTL timer for this name;
  6913.  
  6914.                NEGATIVE NAME REGISTRATION RESPONSE:
  6915.                   /*
  6916.                    * refused, can't keep name
  6917.                    * assume in conflict
  6918.                    */
  6919.                   mark name as in conflict;
  6920.              END /* case */
  6921.  
  6922.         UNTIL request sent for all names for which TTL
  6923.              has expired
  6924.    END /* procedure */
  6925.  
  6926. 5.1.3.  M-NODE ACTIVITY
  6927.  
  6928.    M nodes behavior is similar to that of P nodes with the addition
  6929.    of some B node-like broadcast actions.  M node name service
  6930.    proceeds in two steps:
  6931.  
  6932.    1.Use broadcast UDP based name service.  Depending on the
  6933.      operation, goto step 2.
  6934.  
  6935.    2.Use directed UDP name service.
  6936.  
  6937.    The following code for M nodes is exactly the same as for a P
  6938.    node, with the exception that broadcast operations are done
  6939.    before P type operation is attempted.
  6940.  
  6941.    5.1.3.1.  M-NODE ADD NAME
  6942.  
  6943.    PROCEDURE add_name(newname)
  6944.  
  6945.    /*
  6946.     * Host initiated processing for a M node
  6947.     */
  6948.  
  6949.    BEGIN
  6950.  
  6951.         /*
  6952.          * check if name exists on the
  6953.          * broadcast area
  6954.          */
  6955.  
  6956.  
  6957.  
  6958. NetBIOS Working Group                                          [Page 50]
  6959.  
  6960. RFC 1002                                                      March 1987
  6961.  
  6962.  
  6963.         REPEAT
  6964.             /* build packet */
  6965.  
  6966.             ....
  6967.             broadcast NAME REGISTRATION REQUEST packet;
  6968.             pause(BCAST_REQ_RETRY_TIMEOUT);
  6969.  
  6970.         UNTIL response packet is received or
  6971.              retransmit count has been  exceeded
  6972.  
  6973.         IF valid response received THEN
  6974.         BEGIN
  6975.              /* cannot claim name */
  6976.  
  6977.              return failure;
  6978.         END
  6979.  
  6980.         /*
  6981.          * No objections received within the
  6982.          * broadcast area.
  6983.          * Send request to name server.
  6984.          */
  6985.  
  6986.         REPEAT
  6987.              /*
  6988.               * build packet
  6989.               */
  6990.  
  6991.              ONT = M;
  6992.              ...
  6993.  
  6994.              unicast NAME REGISTRATION REQUEST packet;
  6995.  
  6996.              /*
  6997.               * remote NBNS will send response packet
  6998.               */
  6999.  
  7000.              IF receive a WACK RESPONSE THEN
  7001.                   pause(time from TTL field of response);
  7002.              ELSE
  7003.                   pause(UCAST_REQ_RETRY_TIMEOUT);
  7004.  
  7005.         UNTIL response packet is received or
  7006.              retransmit count has been exceeded
  7007.  
  7008.         IF no response packet was received THEN
  7009.         BEGIN /* no response */
  7010.              /*
  7011.               * NBNS is down.  Cannot claim name.
  7012.               */
  7013.  
  7014.  
  7015.  
  7016.  
  7017. NetBIOS Working Group                                          [Page 51]
  7018.  
  7019. RFC 1002                                                      March 1987
  7020.  
  7021.  
  7022.              return failure; /* name cannot be claimed */
  7023.         END /* no response */
  7024.         ELSE
  7025.         BEGIN /* response */
  7026.             IF NOT response tid = request tid THEN
  7027.             BEGIN
  7028.              ignore response packet;
  7029.             END
  7030.             ELSE
  7031.             CASE packet type OF
  7032.             POSITIVE NAME REGISTRATION RESPONSE:
  7033.  
  7034.                  /*
  7035.                   * name can be added
  7036.                   */
  7037.  
  7038.                  adjust refresh timeout value, TTL;
  7039.                  return success;      /* name can be added */
  7040.  
  7041.             NEGATIVE NAME REGISTRATION RESPONSE:
  7042.                  return failure; /* name cannot be added */
  7043.  
  7044.             END-NODE CHALLENGE REGISTRATION REQUEST:
  7045.             BEGIN /* end node challenge */
  7046.  
  7047.                  /*
  7048.                   * The response packet has in it the
  7049.                   * address of the presumed owner of the
  7050.                   * name.  Challenge that owner.
  7051.                   * If owner either does not
  7052.                   * respond or indicates that he no longer
  7053.                   * owns the name, claim the name.
  7054.                   * Otherwise, the name cannot be claimed.
  7055.                   *
  7056.                   */
  7057.  
  7058.                  REPEAT
  7059.                   /*
  7060.                    * build packet
  7061.                    */
  7062.                   ...
  7063.  
  7064.                   /*
  7065.                    * send packet to address contained in the
  7066.                    * response packet
  7067.                    */
  7068.  
  7069.                   unicast NAME QUERY REQUEST packet;
  7070.  
  7071.                   /*
  7072.                    * remote node may send response packet
  7073.  
  7074.  
  7075.  
  7076. NetBIOS Working Group                                          [Page 52]
  7077.  
  7078. RFC 1002                                                      March 1987
  7079.  
  7080.  
  7081.                    */
  7082.  
  7083.                   pause(UCAST_REQ_RETRY_TIMEOUT);
  7084.  
  7085.                  UNTIL response packet is received or
  7086.                      retransmit count has been exceeded
  7087.                  IF no response packet is received THEN
  7088.                  BEGIN /* no response */
  7089.  
  7090.                   /*
  7091.                    * name can be claimed
  7092.                    */
  7093.                   REPEAT
  7094.  
  7095.                       /*
  7096.                        * build packet
  7097.                        */
  7098.                        ...
  7099.  
  7100.                       unicast NAME UPDATE REQUEST to NBNS;
  7101.  
  7102.                       /*
  7103.                        * NBNS node will send response packet
  7104.                        */
  7105.  
  7106.                       IF receive a WACK RESPONSE THEN
  7107.                             pause(time from TTL field of response);
  7108.                   ELSE
  7109.                        pause(UCAST_REQ_RETRY_TIMEOUT);
  7110.  
  7111.                   UNTIL response packet is received or
  7112.                       retransmit count has been exceeded
  7113.                   IF no response packet received THEN
  7114.                   BEGIN /* no response */
  7115.  
  7116.                        /*
  7117.                         * name could not be claimed
  7118.                         */
  7119.  
  7120.                        return failure;
  7121.                   END /* no response */
  7122.                   ELSE
  7123.                   CASE packet type OF
  7124.                   POSITIVE NAME REGISTRATION RESPONSE:
  7125.                        /*
  7126.                         * add name
  7127.                         */
  7128.  
  7129.                        return success;
  7130.                   NEGATIVE NAME REGISTRATION RESPONSE:
  7131.  
  7132.  
  7133.  
  7134.  
  7135. NetBIOS Working Group                                          [Page 53]
  7136.  
  7137. RFC 1002                                                      March 1987
  7138.  
  7139.  
  7140.                        /*
  7141.                         * you lose  ...
  7142.                         */
  7143.  
  7144.                        return failure;
  7145.                   END /* case */
  7146.                  END /* no response */
  7147.                  ELSE
  7148.                  IF NOT response tid = request tid THEN
  7149.                  BEGIN
  7150.                   ignore response packet;
  7151.                  END
  7152.  
  7153.                  /*
  7154.                   * received a response to the "challenge"
  7155.                   * packet
  7156.                   */
  7157.  
  7158.                  CASE packet type OF
  7159.                  POSITIVE NAME QUERY:
  7160.  
  7161.                   /*
  7162.                    * remote node still has name.
  7163.                    */
  7164.  
  7165.                   return failure;
  7166.                  NEGATIVE NAME QUERY:
  7167.  
  7168.                   /*
  7169.                    * remote node no longer has name
  7170.                    */
  7171.  
  7172.                   return success;
  7173.                  END /* case */
  7174.             END /* end node challenge */
  7175.             END /* case */
  7176.         END /* response */
  7177.    END /* procedure */
  7178.  
  7179. 5.1.3.2.  M-NODE ADD GROUP NAME
  7180.  
  7181.    PROCEDURE add_group_name(newname)
  7182.  
  7183.    /*
  7184.     * Host initiated processing for a P node
  7185.     */
  7186.  
  7187.    BEGIN
  7188.         /*
  7189.          * same as for a unique name, except that the
  7190.          * request packet must indicate that a
  7191.  
  7192.  
  7193.  
  7194. NetBIOS Working Group                                          [Page 54]
  7195.  
  7196. RFC 1002                                                      March 1987
  7197.  
  7198.  
  7199.          * group name claim is being made.
  7200.          */
  7201.  
  7202.         ...
  7203.         G = GROUP;
  7204.         ...
  7205.  
  7206.         /*
  7207.          * send packet
  7208.          */
  7209.          ...
  7210.  
  7211.  
  7212.    END
  7213.  
  7214. 5.1.3.3.  M-NODE FIND NAME
  7215.  
  7216.    PROCEDURE find_name(name)
  7217.  
  7218.    /*
  7219.     * Host initiated processing for a M node
  7220.     */
  7221.  
  7222.    BEGIN
  7223.         /*
  7224.          * check if any node on the broadcast
  7225.          * area has the name
  7226.          */
  7227.  
  7228.         REPEAT
  7229.              /* build packet */
  7230.              ...
  7231.  
  7232.              broadcast NAME QUERY REQUEST packet;
  7233.              pause(BCAST_REQ_RETRY_TIMEOUT);
  7234.         UNTIL response packet received OR
  7235.              max transmit threshold exceeded
  7236.  
  7237.         IF valid response received THEN
  7238.         BEGIN
  7239.              save response as authoritative response;
  7240.              start_timer(CONFLICT_TIMER);
  7241.              return success;
  7242.         END
  7243.  
  7244.         /*
  7245.          * no valid response on the b'cast segment.
  7246.          * Try the name server.
  7247.          */
  7248.  
  7249.         REPEAT
  7250.  
  7251.  
  7252.  
  7253. NetBIOS Working Group                                          [Page 55]
  7254.  
  7255. RFC 1002                                                      March 1987
  7256.  
  7257.  
  7258.              /*
  7259.               * build packet
  7260.               */
  7261.  
  7262.              ONT = M;
  7263.              G = DONT CARE;
  7264.  
  7265.              unicast NAME QUERY REQUEST packet to NBNS;
  7266.  
  7267.              /*
  7268.               * a NBNS node might send response packet
  7269.               */
  7270.  
  7271.              IF receive a WACK RESPONSE THEN
  7272.                   pause(time from TTL field of response);
  7273.              ELSE
  7274.                   pause(UCAST_REQ_RETRY_TIMEOUT);
  7275.         UNTIL response packet received OR
  7276.              max transmit threshold exceeded
  7277.  
  7278.         IF no response packet received THEN
  7279.              return failure;
  7280.         ELSE
  7281.         IF NOT response tid = request tid THEN
  7282.              ignore packet;
  7283.         ELSE
  7284.         CASE packet type OF
  7285.         POSITIVE NAME QUERY RESPONSE:
  7286.              return success;
  7287.  
  7288.         REDIRECT NAME QUERY RESPONSE:
  7289.  
  7290.              /*
  7291.               * NBNS node wants this end node
  7292.               * to use some other NBNS node
  7293.               * to resolve the query.
  7294.               */
  7295.  
  7296.               repeat query with NBNS address
  7297.                   in the response packet;
  7298.         NEGATIVE NAME QUERY RESPONSE:
  7299.              return failure;
  7300.  
  7301.         END /* case */
  7302.    END /* procedure */
  7303.  
  7304. 5.1.3.4.  M-NODE DELETE NAME
  7305.  
  7306.    PROCEDURE delete_name (name)
  7307.  
  7308.    /*
  7309.  
  7310.  
  7311.  
  7312. NetBIOS Working Group                                          [Page 56]
  7313.  
  7314. RFC 1002                                                      March 1987
  7315.  
  7316.  
  7317.     * Host initiated processing for a P node
  7318.     */
  7319.  
  7320.    BEGIN
  7321.         /*
  7322.          * First, delete name on NBNS
  7323.          */
  7324.  
  7325.         REPEAT
  7326.  
  7327.              /*
  7328.               * build packet
  7329.               */
  7330.              ...
  7331.  
  7332.              /*
  7333.               * send request
  7334.               */
  7335.  
  7336.              unicast NAME RELEASE REQUEST packet to NBNS;
  7337.  
  7338.              IF receive a WACK RESPONSE THEN
  7339.                   pause(time from TTL field of response);
  7340.              ELSE
  7341.                   pause(UCAST_REQ_RETRY_TIMEOUT);
  7342.         UNTIL retransmit count has been exceeded
  7343.              or response been received
  7344.  
  7345.         IF response has been received THEN
  7346.         CASE packet type OF
  7347.         POSITIVE NAME RELEASE RESPONSE:
  7348.              /*
  7349.               * Deletion of name on b'cast segment is deferred
  7350.               * until after NBNS has deleted the name
  7351.               */
  7352.  
  7353.              REPEAT
  7354.                   /* build packet */
  7355.  
  7356.                   ...
  7357.                   broadcast NAME RELEASE REQUEST;
  7358.                   pause(BCAST_REQ_RETRY_TIMEOUT);
  7359.              UNTIL rexmt threshold exceeded
  7360.  
  7361.              return success;
  7362.         NEGATIVE NAME RELEASE RESPONSE:
  7363.  
  7364.              /*
  7365.               * NBNS does want node to delete this
  7366.               * name
  7367.               */
  7368.  
  7369.  
  7370.  
  7371. NetBIOS Working Group                                          [Page 57]
  7372.  
  7373. RFC 1002                                                      March 1987
  7374.  
  7375.  
  7376.              return failure;
  7377.         END /* case */
  7378.    END /* procedure */
  7379.  
  7380. 5.1.3.5.  M-NODE INCOMING PACKET PROCESSING
  7381.  
  7382.    Processing initiated by reception of packets at a M node
  7383.  
  7384.    PROCEDURE process_incoming_packet(packet)
  7385.  
  7386.    /*
  7387.     * Processing initiated by incoming packets at a M node
  7388.     */
  7389.  
  7390.    BEGIN
  7391.         CASE packet type of
  7392.  
  7393.         NAME CONFLICT DEMAND:
  7394.              IF name exists in local name table THEN
  7395.                   mark name as in conflict;
  7396.              return;
  7397.  
  7398.         NAME QUERY REQUEST:
  7399.              IF name exists in local name table THEN
  7400.              BEGIN /* name exists */
  7401.  
  7402.                   /*
  7403.                    * build packet
  7404.                    */
  7405.                   ...
  7406.  
  7407.                   /*
  7408.                    * send response to the IP address and port
  7409.                    * number from which the request was received.
  7410.                    */
  7411.  
  7412.                   send POSITIVE NAME QUERY RESPONSE ;
  7413.                   return;
  7414.              END /* exists */
  7415.              ELSE
  7416.              BEGIN /* does not exist */
  7417.  
  7418.                   /*
  7419.                    * send response to the requestor
  7420.                    */
  7421.  
  7422.                   IF request NOT broadcast THEN
  7423.                        /*
  7424.                         * Don't send negative responses to
  7425.                         * queries sent by B nodes
  7426.                         */
  7427.  
  7428.  
  7429.  
  7430. NetBIOS Working Group                                          [Page 58]
  7431.  
  7432. RFC 1002                                                      March 1987
  7433.  
  7434.  
  7435.                        send NEGATIVE NAME QUERY RESPONSE ;
  7436.                   return;
  7437.              END /* does not exist */
  7438.         NODE STATUS REQUEST:
  7439.              BEGIN
  7440.              /*
  7441.               * Name of "*" may be used for force node to
  7442.               * divulge status for administrative purposes
  7443.               */
  7444.              IF name in local name table OR name = "*" THEN
  7445.                   /*
  7446.                    * Build response packet and
  7447.                    * send to requestor node
  7448.                    * Send only those names that are
  7449.                    * in the same scope as the scope
  7450.                    * in the request packet.
  7451.                    */
  7452.  
  7453.                   send NODE STATUS RESPONSE;
  7454.              END
  7455.  
  7456.         NAME RELEASE REQUEST:
  7457.              /*
  7458.               * This will be received if the NBNS wants to flush the
  7459.               * name from the local name table, or from the local
  7460.               * cache.
  7461.               */
  7462.  
  7463.              IF name exists in the local name table THEN
  7464.              BEGIN
  7465.                   delete name from local name table;
  7466.                   inform user that name has been deleted;
  7467.              END
  7468.              ELSE
  7469.                   IF name has been cached locally THEN
  7470.                   BEGIN
  7471.                        remove entry from cache:
  7472.                   END
  7473.  
  7474.         NAME REGISTRATION REQUEST (UNIQUE):
  7475.              IF name exists in local name table THEN
  7476.                   send NEGATIVE NAME REGISTRATION RESPONSE ;
  7477.         NAME REGISTRATION REQUEST (GROUP):
  7478.              IF name exists in local name table THEN
  7479.              BEGIN
  7480.                   IF local entry is a unique name THEN
  7481.                       send NEGATIVE NAME REGISTRATION RESPONSE ;
  7482.              END
  7483.         END /* case */
  7484.    END /* procedure */
  7485.  
  7486.  
  7487.  
  7488.  
  7489. NetBIOS Working Group                                          [Page 59]
  7490.  
  7491. RFC 1002                                                      March 1987
  7492.  
  7493.  
  7494. 5.1.3.6.  M-NODE TIMER INITIATED PROCESSING
  7495.  
  7496.    Processing initiated by timer expiration:
  7497.  
  7498.    PROCEDURE timer_expired()
  7499.    /*
  7500.     * Processing initiated by the expiration of a timer on a M node
  7501.     */
  7502.    BEGIN
  7503.         /*
  7504.          * Send a NAME REFRESH REQUEST for each name which the
  7505.          * TTL which has expired.
  7506.          */
  7507.         REPEAT
  7508.              build NAME REFRESH REQUEST packet;
  7509.              REPEAT
  7510.                   send packet to NBNS;
  7511.  
  7512.                   IF receive a WACK RESPONSE THEN
  7513.                        pause(time from TTL field of response);
  7514.                   ELSE
  7515.                        pause(UCAST_REQ_RETRY_TIMEOUT);
  7516.              UNTIL response packet is received or
  7517.                   retransmit count has been exceeded
  7518.  
  7519.              CASE packet type OF
  7520.                POSITIVE NAME REGISTRATION RESPONSE:
  7521.                   /* successfully refreshed */
  7522.                   reset TTL timer for this name;
  7523.  
  7524.                NEGATIVE NAME REGISTRATION RESPONSE:
  7525.                   /*
  7526.                    * refused, can't keep name
  7527.                    * assume in conflict
  7528.                    */
  7529.                   mark name as in conflict;
  7530.              END /* case */
  7531.  
  7532.         UNTIL request sent for all names for which TTL
  7533.              has expired
  7534.    END /* procedure */
  7535.  
  7536. 5.1.4.  NBNS ACTIVITY
  7537.  
  7538.    A NBNS node will receive directed packets from P and M nodes.
  7539.    Reply packets are always sent as directed packets to the source
  7540.    IP address and UDP port number.  Received broadcast packets must
  7541.    be ignored.
  7542.  
  7543.  
  7544.  
  7545.  
  7546.  
  7547.  
  7548. NetBIOS Working Group                                          [Page 60]
  7549.  
  7550. RFC 1002                                                      March 1987
  7551.  
  7552.  
  7553. 5.1.4.1.  NBNS INCOMING PACKET PROCESSING
  7554.  
  7555.    PROCEDURE process_incoming_packet(packet)
  7556.  
  7557.    /*
  7558.     * Incoming packet processing on a NS node
  7559.     */
  7560.  
  7561.    BEGIN
  7562.         IF packet was sent as a broadcast THEN
  7563.         BEGIN
  7564.              discard packet;
  7565.              return;
  7566.         END
  7567.         CASE packet type of
  7568.  
  7569.         NAME REGISTRATION REQUEST (UNIQUE):
  7570.              IF unique name exists in data base THEN
  7571.              BEGIN /* unique name exists */
  7572.                   /*
  7573.                    * NBNS node may be a "passive"
  7574.                    * server in that it expects the
  7575.                    * end node to do the challenge
  7576.                    * server.  Such a NBNS node is
  7577.                    * called a "non-secure" server.
  7578.                    * A "secure" server will do the
  7579.                    * challenging before it sends
  7580.                    * back a response packet.
  7581.                    */
  7582.  
  7583.                   IF non-secure THEN
  7584.                   BEGIN
  7585.                        /*
  7586.                         * build response packet
  7587.                         */
  7588.                        ...
  7589.  
  7590.  
  7591.                        /*
  7592.                         * let end node do the challenge
  7593.                         */
  7594.  
  7595.                        send END-NODE CHALLENGE NAME REGISTRATION
  7596.                             RESPONSE;
  7597.                        return;
  7598.                   END
  7599.                   ELSE
  7600.                   /*
  7601.                    * secure server - do the name
  7602.                    * challenge operation
  7603.                    */
  7604.  
  7605.  
  7606.  
  7607. NetBIOS Working Group                                          [Page 61]
  7608.  
  7609. RFC 1002                                                      March 1987
  7610.  
  7611.  
  7612.                   REPEAT
  7613.                       send NAME QUERY REQUEST;
  7614.                       pause(UCAST_REQ_RETRY_TIMEOUT);
  7615.                   UNTIL response has been received or
  7616.                        retransmit count has been exceeded
  7617.                   IF no response was received THEN
  7618.                   BEGIN
  7619.  
  7620.                        /* node down */
  7621.  
  7622.                        update data base - remove entry;
  7623.                        update data base - add new entry;
  7624.                        send POSITIVE NAME REGISTRATION RESPONSE;
  7625.                        return;
  7626.                   END
  7627.                   ELSE
  7628.                   BEGIN /* challenged node replied */
  7629.                       /*
  7630.                        * challenged node replied with
  7631.                        * a response packet
  7632.                        */
  7633.  
  7634.                       CASE packet type
  7635.  
  7636.                       POSITIVE NAME QUERY RESPONSE:
  7637.  
  7638.                        /*
  7639.                         * name still owned by the
  7640.                         * challenged node
  7641.                         *
  7642.                         * build packet and send response
  7643.                         */
  7644.                         ...
  7645.  
  7646.  
  7647.                        /*
  7648.                         * Note: The NBNS will need to
  7649.                         * keep track (based on transaction id) of
  7650.                         * the IP address and port number
  7651.                         * of the original requestor.
  7652.                         */
  7653.  
  7654.                        send NEGATIVE NAME REGISTRATION RESPONSE;
  7655.                        return;
  7656.                       NEGATIVE NAME QUERY RESPONSE:
  7657.  
  7658.                        update data base - remove entry;
  7659.                        update data base - add new  entry;
  7660.  
  7661.                        /*
  7662.                         * build response packet and send
  7663.  
  7664.  
  7665.  
  7666. NetBIOS Working Group                                          [Page 62]
  7667.  
  7668. RFC 1002                                                      March 1987
  7669.  
  7670.  
  7671.                         * response
  7672.                         */
  7673.                        send POSITIVE NAME REGISTRATION RESPONSE;
  7674.                        return;
  7675.                       END /* case */
  7676.                   END /* challenged node replied */
  7677.              END /* unique name exists in data base */
  7678.              ELSE
  7679.              IF group name exists in data base THEN
  7680.              BEGIN /* group names exists */
  7681.  
  7682.                   /*
  7683.                    * Members of a group name are NOT
  7684.                    * challenged.
  7685.                    * Make the assumption that
  7686.                    * at least some of the group members
  7687.                    * are still alive.
  7688.                    * Refresh mechanism will
  7689.                    * allow the NBNS to detect when all
  7690.                    * members of a group no longer use that
  7691.                    * name
  7692.                    */
  7693.  
  7694.                    send NEGATIVE NAME REGISTRATION RESPONSE;
  7695.              END /* group name exists */
  7696.              ELSE
  7697.              BEGIN /* name does not exist */
  7698.  
  7699.                   /*
  7700.                    * Name does not exist in data base
  7701.                    *
  7702.                    * This code applies to both non-secure
  7703.                    * and secure server.
  7704.                    */
  7705.  
  7706.                   update data base - add new entry;
  7707.                   send POSITIVE NAME REGISTRATION RESPONSE;
  7708.                   return;
  7709.              END
  7710.  
  7711.         NAME QUERY REQUEST:
  7712.              IF name exists in data base THEN
  7713.              BEGIN
  7714.                   /*
  7715.                    * build response packet and send to
  7716.                    * requestor
  7717.                    */
  7718.                    ...
  7719.  
  7720.                   send POSITIVE NAME QUERY RESPONSE;
  7721.                   return;
  7722.  
  7723.  
  7724.  
  7725. NetBIOS Working Group                                          [Page 63]
  7726.  
  7727. RFC 1002                                                      March 1987
  7728.  
  7729.  
  7730.              ELSE
  7731.              BEGIN
  7732.                   /*
  7733.                    * build response packet and send to
  7734.                    * requestor
  7735.                    */
  7736.                    ...
  7737.  
  7738.                   send NEGATIVE NAME QUERY RESPONSE;
  7739.                   return;
  7740.              END
  7741.  
  7742.         NAME REGISTRATION REQUEST (GROUP):
  7743.              IF name exists in data base THEN
  7744.              BEGIN
  7745.                   IF local entry is a unique name THEN
  7746.                   BEGIN /* local is unique */
  7747.  
  7748.                       IF non-secure THEN
  7749.                       BEGIN
  7750.                        send  END-NODE CHALLENGE NAME
  7751.                             REGISTRATION RESPONSE;
  7752.                        return;
  7753.                       END
  7754.  
  7755.                       REPEAT
  7756.                        send NAME QUERY REQUEST;
  7757.                        pause(UCAST_REQ_RETRY_TIMEOUT);
  7758.                       UNTIL response received or
  7759.                            retransmit count exceeded
  7760.                       IF no response received or
  7761.                            NEGATIVE NAME QUERY RESPONSE
  7762.                             received THEN
  7763.                       BEGIN
  7764.                        update data base - remove entry;
  7765.                        update data base - add new entry;
  7766.                        send POSITIVE NAME REGISTRATION RESPONSE;
  7767.                        return;
  7768.                       END
  7769.                       ELSE
  7770.                       BEGIN
  7771.                        /*
  7772.                         * name still being held
  7773.                         * by challenged node
  7774.                         */
  7775.  
  7776.                         send NEGATIVE NAME REGISTRATION RESPONSE;
  7777.                       END
  7778.                   END /* local is unique */
  7779.                   ELSE
  7780.                   BEGIN /* local is group  */
  7781.  
  7782.  
  7783.  
  7784. NetBIOS Working Group                                          [Page 64]
  7785.  
  7786. RFC 1002                                                      March 1987
  7787.  
  7788.  
  7789.                        /*
  7790.                         * existing entry is a group name
  7791.                         */
  7792.  
  7793.                        update data base - remove entry;
  7794.                        update data base - add new entry;
  7795.                        send POSITIVE NAME REGISTRATION RESPONSE;
  7796.                        return;
  7797.                   END /* local is group */
  7798.              END /* names exists */
  7799.              ELSE
  7800.              BEGIN /* does not exist */
  7801.  
  7802.                   /* name does not exist in data base */
  7803.  
  7804.                   update data base - add new entry;
  7805.                   send POSITIVE NAME REGISTRATION RESPONSE;
  7806.                   return;
  7807.              END /* does not exist */
  7808.  
  7809.         NAME RELEASE REQUEST:
  7810.  
  7811.              /*
  7812.               * secure server may choose to disallow
  7813.               * a node from deleting a name
  7814.               */
  7815.  
  7816.              update data base - remove entry;
  7817.              send POSITIVE NAME RELEASE RESPONSE;
  7818.              return;
  7819.  
  7820.         NAME UPDATE REQUEST:
  7821.  
  7822.              /*
  7823.               * End-node completed a successful challenge,
  7824.               * no update database
  7825.               */
  7826.  
  7827.              IF secure server THEN
  7828.                   send NEGATIVE NAME REGISTRATION RESPONSE;
  7829.              ELSE
  7830.              BEGIN /* new entry */
  7831.                   IF entry already exists THEN
  7832.                        update data base - remove entry;
  7833.                   update data base - add new entry;
  7834.                   send POSITIVE NAME REGISTRATION RESPONSE;
  7835.                   start_timer(TTL);
  7836.              END
  7837.  
  7838.         NAME REFRESH REQUEST:
  7839.              check for consistency;
  7840.  
  7841.  
  7842.  
  7843. NetBIOS Working Group                                          [Page 65]
  7844.  
  7845. RFC 1002                                                      March 1987
  7846.  
  7847.  
  7848.              IF node not allowed to have name THEN
  7849.              BEGIN
  7850.  
  7851.                   /*
  7852.                    * tell end node that it can't have name
  7853.                    */
  7854.                   send NEGATIVE NAME REGISTRATION RESPONSE;
  7855.              END
  7856.              ELSE
  7857.              BEGIN
  7858.  
  7859.                   /*
  7860.                    * send confirmation response to the
  7861.                    * end node.
  7862.                    */
  7863.                   send POSITIVE NAME REGISTRATION;
  7864.                   start_timer(TTL);
  7865.              END
  7866.              return;
  7867.         END /* case */
  7868.    END /* procedure */
  7869.  
  7870. 5.1.4.2.  NBNS TIMER INITIATED PROCESSING
  7871.  
  7872.    A NS node uses timers to flush out entries from the data base.
  7873.    Each entry in the data base is removed when its timer expires.
  7874.    This time value is a multiple of the refresh TTL established when
  7875.    the name was registered.
  7876.  
  7877.    PROCEDURE timer_expired()
  7878.  
  7879.    /*
  7880.     * processing initiated by expiration of TTL for a given name
  7881.     */
  7882.  
  7883.    BEGIN
  7884.         /*
  7885.          * NBNS can (optionally) ensure
  7886.          * that the node is actually down
  7887.          * by sending a NODE STATUS REQUEST.
  7888.          * If such a request is sent, and
  7889.          * no response is received, it can
  7890.          * be assumed that the node is down.
  7891.          */
  7892.         remove entry from data base;
  7893.    END
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.  
  7900.  
  7901.  
  7902. NetBIOS Working Group                                          [Page 66]
  7903.  
  7904. RFC 1002                                                      March 1987
  7905.  
  7906.  
  7907. 5.2.  SESSION SERVICE PROTOCOLS
  7908.  
  7909.    The following are variables and should be configurable by the
  7910.    NetBIOS user.  The default values of these variables is found in
  7911.    "Defined Constants and Variables" in the Detailed
  7912.    Specification.):
  7913.  
  7914.    - SSN_RETRY_COUNT - The maximum number TCP connection attempts
  7915.      allowable per a single NetBIOS call request.
  7916.  
  7917.    - SSN_CLOSE_TIMEOUT is the time period to wait when closing the
  7918.      NetBIOS session before killing the TCP connection if session
  7919.      sends are outstanding.
  7920.  
  7921.    The following are Defined Constants for the NetBIOS Session
  7922.    Service.  (See "Defined Constants and Variables" in the Detailed
  7923.    Specification for the value of these constants):
  7924.  
  7925.    - SSN_SRVC_TCP_PORT - is the globally well-known TCP port
  7926.      allocated for the NetBIOS Session Service.  The service accepts
  7927.      TCP connections on this port to establish NetBIOS Sessions.
  7928.      The TCP connection established to this port by the caller is
  7929.      initially used for the exchange of NetBIOS control information.
  7930.      The actual NetBIOS data connection may also pass through this
  7931.      port or, through the retargetting facility, through another
  7932.      port.
  7933.  
  7934. 5.2.1.  SESSION ESTABLISHMENT PROTOCOLS
  7935.  
  7936. 5.2.1.1.  USER REQUEST PROCESSING
  7937.  
  7938.    PROCEDURE listen(listening name, caller name)
  7939.    /*
  7940.     * User initiated processing for B, P and M nodes
  7941.     *
  7942.     * This procedure assumes that an incoming session will be
  7943.     * retargetted here by a session server.
  7944.     */
  7945.    BEGIN
  7946.         Do TCP listen; /* Returns TCP port used */
  7947.         Register listen with Session Service, give names and
  7948.              TCP port;
  7949.  
  7950.         Wait for TCP connection to open;   /* Incoming call */
  7951.  
  7952.         Read SESSION REQUEST packet from connection
  7953.  
  7954.         Process session request (see section on
  7955.              processing initiated by the reception of session
  7956.              service packets);
  7957.  
  7958.  
  7959.  
  7960.  
  7961. NetBIOS Working Group                                          [Page 67]
  7962.  
  7963. RFC 1002                                                      March 1987
  7964.  
  7965.  
  7966.         Inform Session Service that NetBIOS listen is complete;
  7967.  
  7968.         IF session established THEN
  7969.              return success and session information to user;
  7970.         ELSE
  7971.              return failure;
  7972.    END /* procedure */
  7973.  
  7974.    PROCEDURE call(calling name, called name)
  7975.    /*
  7976.     * user initiated processing for B, P and M nodes
  7977.     */
  7978.  
  7979.    /*
  7980.     * This algorithm assumes that the called name is a unique name.
  7981.     * If the called name is a group name, the call() procedure
  7982.     * needs to cycle through the members of the group
  7983.     * until either (retry_count == SSN_RETRY_COUNT) or
  7984.     * the list has been exhausted.
  7985.     */
  7986.    BEGIN
  7987.         retry_count = 0;
  7988.         retarget = FALSE;   /* TRUE: caller is being retargetted */
  7989.         name_query = TRUE;  /* TRUE: caller must begin again with */
  7990.                             /*       name query. */
  7991.  
  7992.         REPEAT
  7993.              IF name_query THEN
  7994.              BEGIN
  7995.                   do name discovery, returns IP address;
  7996.                   TCP port = SSN_SRVC_TCP_PORT;
  7997.  
  7998.                   IF name discovery fails THEN
  7999.                        return failure;
  8000.                   ELSE
  8001.                        name_query = FALSE;
  8002.              END
  8003.  
  8004.              /*
  8005.               * now have IP address and TCP port of
  8006.               * remote party.
  8007.               */
  8008.  
  8009.              establish TCP connection with remote party, use an
  8010.                   ephemeral port as source TCP port;
  8011.              IF connection refused THEN
  8012.              BEGIN
  8013.                   IF retarget THEN
  8014.                   BEGIN
  8015.                        /* retry */
  8016.                        retarget = FALSE;
  8017.  
  8018.  
  8019.  
  8020. NetBIOS Working Group                                          [Page 68]
  8021.  
  8022. RFC 1002                                                      March 1987
  8023.  
  8024.  
  8025.                        use original IP address and TCP port;
  8026.                        goto LOOP;
  8027.                   END
  8028.  
  8029.                   /* retry for just missed TCP listen */
  8030.  
  8031.                   pause(SESSION_RETRY_TIMER);
  8032.                   establish TCP connection, again use ephemeral
  8033.                        port as source TCP port;
  8034.  
  8035.                   IF connection refused OR
  8036.                      connection timed out THEN
  8037.                        return failure;
  8038.              END
  8039.              ELSE
  8040.              IF connection timed out THEN
  8041.              BEGIN
  8042.                   IF retarget THEN
  8043.                   BEGIN
  8044.                        /* retry */
  8045.                        retarget = FALSE;
  8046.                        use original IP address and TCP port;
  8047.                        goto LOOP;
  8048.                   END
  8049.                   ELSE
  8050.                   BEGIN
  8051.                        /*
  8052.                         * incorrect name discovery was done,
  8053.                         * try again
  8054.                         */
  8055.  
  8056.                        inform name discovery process of
  8057.                             possible error;
  8058.                        name_query = TRUE;
  8059.                        goto LOOP;
  8060.                   END
  8061.              END
  8062.  
  8063.              /*
  8064.               * TCP connection has been established
  8065.               */
  8066.  
  8067.              wait for session response packet;
  8068.              CASE packet type OF
  8069.  
  8070.                 POSITIVE SESSION RESPONSE:
  8071.                   return success and session established
  8072.                        information;
  8073.  
  8074.                 NEGATIVE SESSION RESPONSE:
  8075.                 BEGIN
  8076.  
  8077.  
  8078.  
  8079. NetBIOS Working Group                                          [Page 69]
  8080.  
  8081. RFC 1002                                                      March 1987
  8082.  
  8083.  
  8084.                   CASE error OF
  8085.                      NOT LISTENING ON CALLED NAME:
  8086.                      NOT LISTENING FOR CALLING NAME:
  8087.                      BEGIN
  8088.                        kill TCP connection;
  8089.                        return failure;
  8090.                      END
  8091.  
  8092.                      CALLED NAME NOT PRESENT:
  8093.                      BEGIN
  8094.                        /*
  8095.                         * called name does not exist on
  8096.                         * remote node
  8097.                         */
  8098.  
  8099.                        inform name discovery procedure
  8100.                             of possible error;
  8101.  
  8102.                        IF this is a P or M node THEN
  8103.                        BEGIN
  8104.                             /*
  8105.                              * Inform NetBIOS Name Server
  8106.                              * it has returned incorrect
  8107.                              * information.
  8108.                              */
  8109.                             send NAME RELEASE REQUEST for called
  8110.                               name and IP address to
  8111.                               NetBIOS Name Server;
  8112.                        END
  8113.                        /* retry from beginning */
  8114.                        retarget = FALSE;
  8115.                        name_query = TRUE;
  8116.                        goto LOOP;
  8117.                      END /* called name not present */
  8118.                   END /* case */
  8119.                 END /* negative response */
  8120.  
  8121.                 RETARGET SESSION RESPONSE:
  8122.                 BEGIN
  8123.                   close TCP connection;
  8124.                   extract IP address and TCP port from
  8125.                        response;
  8126.                   retarget = TRUE;
  8127.                 END /* retarget response */
  8128.              END /* case */
  8129.  
  8130.    LOOP:          retry_count = retry_count + 1;
  8131.  
  8132.         UNTIL (retry_count > SSN_RETRY_COUNT);
  8133.         return failure;
  8134.    END /* procedure */
  8135.  
  8136.  
  8137.  
  8138. NetBIOS Working Group                                          [Page 70]
  8139.  
  8140. RFC 1002                                                      March 1987
  8141.  
  8142.  
  8143. 5.2.1.2.  RECEIVED PACKET PROCESSING
  8144.  
  8145.    These are packets received on a TCP connection before a session
  8146.    has been established.  The listen routines attached to a NetBIOS
  8147.    user process need not implement the RETARGET response section.
  8148.    The user process version, separate from a shared Session Service,
  8149.    need only accept (POSITIVE SESSION RESPONSE) or reject (NEGATIVE
  8150.    SESSION RESPONSE) a session request.
  8151.  
  8152.    PROCEDURE session_packet(packet)
  8153.    /*
  8154.     * processing initiated by receipt of a session service
  8155.     * packet for a session in the session establishment phase.
  8156.     * Assumes the TCP connection has been accepted.
  8157.     */
  8158.    BEGIN
  8159.         CASE packet type
  8160.  
  8161.            SESSION REQUEST:
  8162.            BEGIN
  8163.              IF called name does not exist on node THEN
  8164.              BEGIN
  8165.                   send NEGATIVE SESSION RESPONSE with CALLED
  8166.                        NAME NOT PRESENT error code;
  8167.                   close TCP connection;
  8168.              END
  8169.  
  8170.              Search for a listen with CALLING NAME for CALLED
  8171.                   NAME;
  8172.              IF matching listen is found THEN
  8173.              BEGIN
  8174.                   IF port of listener process is port TCP
  8175.                      connection is on THEN
  8176.                   BEGIN
  8177.                        send POSITIVE SESSION RESPONSE;
  8178.  
  8179.                        Hand off connection to client process
  8180.                             and/or inform user session is
  8181.                             established;
  8182.                   END
  8183.                   ELSE
  8184.                   BEGIN
  8185.                        send RETARGET SESSION RESPONSE with
  8186.                             listener's IP address and
  8187.                             TCP port;
  8188.                        close TCP connection;
  8189.                   END
  8190.              END
  8191.              ELSE
  8192.              BEGIN
  8193.                   /* no matching listen pending */
  8194.  
  8195.  
  8196.  
  8197. NetBIOS Working Group                                          [Page 71]
  8198.  
  8199. RFC 1002                                                      March 1987
  8200.  
  8201.  
  8202.                   send NEGATIVE SESSION RESPONSE with either
  8203.                        NOT LISTENING ON CALLED NAME or NOT
  8204.                        LISTENING FOR CALLING NAME error
  8205.                        code;
  8206.                   close TCP connection;
  8207.              END
  8208.            END /* session request */
  8209.         END /* case */
  8210.    END /* procedure */
  8211.  
  8212. 5.2.2.  SESSION DATA TRANSFER PROTOCOLS
  8213.  
  8214. 5.2.2.1.  USER REQUEST PROCESSING
  8215.  
  8216.    PROCEDURE send_message(user_message)
  8217.    BEGIN
  8218.         build SESSION MESSAGE header;
  8219.         send SESSION MESSAGE header;
  8220.         send user_message;
  8221.         reset and restart keep-alive timer;
  8222.         IF send fails THEN
  8223.         BEGIN
  8224.              /*
  8225.               * TCP connection has failed */
  8226.               */
  8227.              close NetBIOS session;
  8228.              inform user that session is lost;
  8229.              return failure;
  8230.         END
  8231.         ELSE
  8232.              return success;
  8233.    END
  8234.  
  8235.    5.2.2.2.  RECEIVED PACKET PROCESSING
  8236.  
  8237.    These are packets received after a session has been established.
  8238.  
  8239.    PROCEDURE session_packet(packet)
  8240.    /*
  8241.     * processing initiated by receipt of a session service
  8242.     * packet for a session in the data transfer phase.
  8243.     */
  8244.    BEGIN
  8245.         CASE packet type OF
  8246.  
  8247.            SESSION  MESSAGE:
  8248.            BEGIN
  8249.              process message header;
  8250.              read in user data;
  8251.              reset and restart keep-alive timer;
  8252.              deliver data to user;
  8253.  
  8254.  
  8255.  
  8256. NetBIOS Working Group                                          [Page 72]
  8257.  
  8258. RFC 1002                                                      March 1987
  8259.  
  8260.  
  8261.            END /* session message */
  8262.  
  8263.            SESSION KEEP ALIVE:
  8264.              discard packet;
  8265.  
  8266.         END /* case */
  8267.    END /* procedure */
  8268.  
  8269. 5.2.2.3.  PROCESSING INITIATED BY TIMER
  8270.  
  8271.    PROCEDURE session_ka_timer()
  8272.    /*
  8273.     * processing initiated when session keep alive timer expires
  8274.     */
  8275.    BEGIN
  8276.             send SESSION KEEP ALIVE, if configured;
  8277.             IF send fails THEN
  8278.             BEGIN
  8279.              /* remote node, or path to it, is down */
  8280.  
  8281.              abort TCP connection;
  8282.              close NetBIOS session;
  8283.              inform user that session is lost;
  8284.              return;
  8285.             END
  8286.    END /* procedure */
  8287.  
  8288. 5.2.3.  SESSION TERMINATION PROTOCOLS
  8289.  
  8290. 5.2.3.1.  USER REQUEST PROCESSING
  8291.  
  8292.    PROCEDURE close_session()
  8293.  
  8294.    /* initiated by a user request to close a session */
  8295.  
  8296.    BEGIN
  8297.         close gracefully the TCP connection;
  8298.  
  8299.         WAIT for the connection to close or SSN_CLOSE_TIMEOUT
  8300.              to expire;
  8301.  
  8302.         IF time out expired THEN
  8303.              abort TCP connection;
  8304.    END /* procedure */
  8305.  
  8306. 5.2.3.2.  RECEPTION INDICATION PROCESSING
  8307.  
  8308.    PROCEDURE close_indication()
  8309.    /*
  8310.     * initiated by a TCP indication of a close request from
  8311.     * the remote connection partner.
  8312.  
  8313.  
  8314.  
  8315. NetBIOS Working Group                                          [Page 73]
  8316.  
  8317. RFC 1002                                                      March 1987
  8318.  
  8319.  
  8320.     */
  8321.    BEGIN
  8322.         close gracefully TCP connection;
  8323.  
  8324.         close NetBIOS session;
  8325.  
  8326.         inform user session closed by remote partner;
  8327.    END /* procedure */
  8328.  
  8329. 5.3.  NetBIOS DATAGRAM SERVICE PROTOCOLS
  8330.  
  8331.    The following are GLOBAL variables and should be NetBIOS user
  8332.    configurable:
  8333.  
  8334.    - SCOPE_ID: the non-leaf section of the domain name preceded by a
  8335.      '.'  which represents the domain of the NetBIOS scope for the
  8336.      NetBIOS name.  The following protocol description only supports
  8337.      single scope operation.
  8338.  
  8339.    - MAX_DATAGRAM_LENGTH: the maximum length of an IP datagram.  The
  8340.      minimal maximum length defined in for IP is 576 bytes.  This
  8341.      value is used when determining whether to fragment a NetBIOS
  8342.      datagram.  Implementations are expected to be capable of
  8343.      receiving unfragmented NetBIOS datagrams up to their maximum
  8344.      size.
  8345.  
  8346.    - BROADCAST_ADDRESS: the IP address B-nodes use to send datagrams
  8347.      with group name destinations and broadcast datagrams.  The
  8348.      default is the IP broadcast address for a single IP network.
  8349.  
  8350.  
  8351.    The following are Defined Constants for the NetBIOS Datagram
  8352.    Service:
  8353.  
  8354.    - DGM_SRVC_UDP_PORT: the globally well-known UDP port allocated
  8355.      where the NetBIOS Datagram Service receives UDP packets.  See
  8356.      section 6, "Defined Constants", for its value.
  8357.  
  8358. 5.3.1.  B NODE TRANSMISSION OF NetBIOS DATAGRAMS
  8359.  
  8360.    PROCEDURE send_datagram(data, source, destination, broadcast)
  8361.  
  8362.    /*
  8363.     * user initiated processing on B node
  8364.     */
  8365.  
  8366.    BEGIN
  8367.         group = FALSE;
  8368.  
  8369.         do name discovery on destination name, returns name type and
  8370.              IP address;
  8371.  
  8372.  
  8373.  
  8374. NetBIOS Working Group                                          [Page 74]
  8375.  
  8376. RFC 1002                                                      March 1987
  8377.  
  8378.  
  8379.         IF name type is group name THEN
  8380.         BEGIN
  8381.              group = TRUE;
  8382.         END
  8383.  
  8384.         /*
  8385.          * build datagram service UDP packet;
  8386.          */
  8387.         convert source and destination NetBIOS names into
  8388.              half-ASCII, biased encoded name;
  8389.         SOURCE_NAME = cat(source, SCOPE_ID);
  8390.         SOURCE_IP = this nodes IP address;
  8391.         SOURCE_PORT =  DGM_SRVC_UDP_PORT;
  8392.  
  8393.         IF NetBIOS broadcast THEN
  8394.         BEGIN
  8395.              DESTINATION_NAME = cat("*", SCOPE_ID)
  8396.         END
  8397.         ELSE
  8398.         BEGIN
  8399.              DESTINATION_NAME = cat(destination, SCOPE_ID)
  8400.         END
  8401.  
  8402.         MSG_TYPE = select_one_from_set
  8403.              {BROADCAST, DIRECT_UNIQUE, DIRECT_GROUP}
  8404.         DGM_ID = next transaction id for Datagrams;
  8405.         DGM_LENGTH = length of data + length of second level encoded
  8406.              source and destination names;
  8407.  
  8408.         IF (length of the NetBIOS Datagram, including UDP and
  8409.             IP headers, > MAX_DATAGRAM_LENGTH) THEN
  8410.         BEGIN
  8411.              /*
  8412.               * fragment NetBIOS datagram into 2 UDP packets
  8413.               */
  8414.              Put names into 1st UDP packet and any data that fits
  8415.                   after names;
  8416.              Set MORE and FIRST bits in 1st UDP packet's FLAGS;
  8417.              OFFSET in 1st UDP = 0;
  8418.  
  8419.              Replicate NetBIOS Datagram header from 1st UDP packet
  8420.                   into 2nd UDP packet;
  8421.              Put rest of data in 2nd UDP packet;
  8422.              Clear MORE and FIRST bits in 2nd UDP packet's FLAGS;
  8423.              OFFSET in 2nd UDP = DGM_LENGTH - number of name and
  8424.                   data bytes in 1st UDP;
  8425.         END
  8426.         BEGIN
  8427.              /*
  8428.               * Only need one UDP packet
  8429.               */
  8430.  
  8431.  
  8432.  
  8433. NetBIOS Working Group                                          [Page 75]
  8434.  
  8435. RFC 1002                                                      March 1987
  8436.  
  8437.  
  8438.              USER_DATA = data;
  8439.              Clear MORE bit and set FIRST bit in FLAGS;
  8440.              OFFSET = 0;
  8441.         END
  8442.  
  8443.         IF (group == TRUE) OR (NetBIOS broadcast) THEN
  8444.         BEGIN
  8445.              send UDP packet(s) to BROADCAST_ADDRESS;
  8446.         END
  8447.         ELSE
  8448.         BEGIN
  8449.              send UDP packet(s) to IP address returned by name
  8450.                 discovery;
  8451.         END
  8452.    END /* procedure */
  8453.  
  8454. 5.3.2.  P AND M NODE TRANSMISSION OF NetBIOS DATAGRAMS
  8455.  
  8456.    PROCEDURE send_datagram(data, source, destination, broadcast)
  8457.  
  8458.    /*
  8459.     * User initiated processing on P and M node.
  8460.     *
  8461.     * This processing is the same as for B nodes except for
  8462.     * sending broadcast and multicast NetBIOS datagrams.
  8463.     */
  8464.  
  8465.    BEGIN
  8466.         group = FALSE;
  8467.  
  8468.         do name discovery on destination name, returns name type
  8469.              and IP address;
  8470.         IF name type is group name THEN
  8471.         BEGIN
  8472.              group = TRUE;
  8473.         END
  8474.  
  8475.         /*
  8476.          * build datagram service UDP packet;
  8477.          */
  8478.         convert source and destination NetBIOS names into
  8479.              half-ASCII, biased encoded name;
  8480.         SOURCE_NAME = cat(source, SCOPE_ID);
  8481.         SOURCE_IP = this nodes IP address;
  8482.         SOURCE_PORT =  DGM_SRVC_UDP_PORT;
  8483.  
  8484.         IF NetBIOS broadcast THEN
  8485.         BEGIN
  8486.              DESTINATION_NAME = cat("*", SCOPE_ID)
  8487.         END
  8488.         ELSE
  8489.  
  8490.  
  8491.  
  8492. NetBIOS Working Group                                          [Page 76]
  8493.  
  8494. RFC 1002                                                      March 1987
  8495.  
  8496.  
  8497.         BEGIN
  8498.              DESTINATION_NAME = cat(destination, SCOPE_ID)
  8499.         END
  8500.  
  8501.         MSG_TYPE = select_one_from_set
  8502.              {BROADCAST, DIRECT_UNIQUE, DIRECT_GROUP}
  8503.         DGM_ID = next transaction id for Datagrams;
  8504.         DGM_LENGTH = length of data + length of second level encoded
  8505.              source and destination names;
  8506.  
  8507.         IF (length of the NetBIOS Datagram, including UDP and
  8508.             IP headers, > MAX_DATAGRAM_LENGTH) THEN
  8509.         BEGIN
  8510.              /*
  8511.               * fragment NetBIOS datagram into 2 UDP packets
  8512.               */
  8513.              Put names into 1st UDP packet and any data that fits
  8514.                   after names;
  8515.              Set MORE and FIRST bits in 1st UDP packet's FLAGS;
  8516.  
  8517.              OFFSET in 1st UDP = 0;
  8518.  
  8519.              Replicate NetBIOS Datagram header from 1st UDP packet
  8520.                   into 2nd UDP packet;
  8521.              Put rest of data in 2nd UDP packet;
  8522.              Clear MORE and FIRST bits in 2nd UDP packet's FLAGS;
  8523.              OFFSET in 2nd UDP = DGM_LENGTH - number of name and
  8524.                   data bytes in 1st UDP;
  8525.         END
  8526.         BEGIN
  8527.              /*
  8528.               * Only need one UDP packet
  8529.               */
  8530.              USER_DATA = data;
  8531.              Clear MORE bit and set FIRST bit in FLAGS;
  8532.              OFFSET = 0;
  8533.         END
  8534.  
  8535.         IF (group == TRUE) OR (NetBIOS broadcast) THEN
  8536.         BEGIN
  8537.              /*
  8538.               * Sending of following query is optional.
  8539.               * Node may send datagram to NBDD immediately
  8540.               * but NBDD may discard the datagram.
  8541.               */
  8542.              send DATAGRAM QUERY REQUEST to NBDD;
  8543.              IF response is POSITIVE QUERY RESPONSE THEN
  8544.                   send UDP packet(s) to NBDD Server IP address;
  8545.              ELSE
  8546.              BEGIN
  8547.                   get list of destination nodes from NBNS;
  8548.  
  8549.  
  8550.  
  8551. NetBIOS Working Group                                          [Page 77]
  8552.  
  8553. RFC 1002                                                      March 1987
  8554.  
  8555.  
  8556.                   FOR EACH node in list
  8557.                   BEGIN
  8558.                        send UDP packet(s) to this node's
  8559.                             IP address;
  8560.                   END
  8561.              END
  8562.         END
  8563.         ELSE
  8564.         BEGIN
  8565.              send UDP packet(s) to IP address returned by name
  8566.                 discovery;
  8567.    END /* procedure */
  8568.  
  8569. 5.3.3.  RECEPTION OF NetBIOS DATAGRAMS BY ALL NODES
  8570.  
  8571.    The following algorithm discards out of order NetBIOS Datagram
  8572.    fragments.  An implementation which reassembles out of order
  8573.    NetBIOS Datagram fragments conforms to this specification.  The
  8574.    fragment discard timer is initialized to the value FRAGMENT_TO.
  8575.    This value should be user configurable.  The default value is
  8576.    given in Section 6, "Defined Constants and Variables".
  8577.  
  8578.    PROCEDURE datagram_packet(packet)
  8579.  
  8580.    /*
  8581.     * processing initiated by datagram packet reception
  8582.     * on B, P and M nodes
  8583.     */
  8584.    BEGIN
  8585.         /*
  8586.          * if this node is a P node, ignore
  8587.          * broadcast packets.
  8588.          */
  8589.  
  8590.         IF this is a P node AND incoming packet is
  8591.              a broadcast packet THEN
  8592.         BEGIN
  8593.              discard packet;
  8594.         END
  8595.  
  8596.         CASE packet type OF
  8597.  
  8598.            DATAGRAM SERVICE:
  8599.            BEGIN
  8600.              IF FIRST bit in FLAGS is set THEN
  8601.              BEGIN
  8602.                   IF MORE bit in FLAGS is set THEN
  8603.                   BEGIN
  8604.                        Save 1st UDP packet of the Datagram;
  8605.                        Set this Datagram's fragment discard
  8606.                          timer to FRAGMENT_TO;
  8607.  
  8608.  
  8609.  
  8610. NetBIOS Working Group                                          [Page 78]
  8611.  
  8612. RFC 1002                                                      March 1987
  8613.  
  8614.  
  8615.                        return;
  8616.                   END
  8617.                   ELSE
  8618.                        Datagram is composed of a single
  8619.                          UDP packet;
  8620.              END
  8621.              ELSE
  8622.              BEGIN
  8623.                   /* Have the second fragment of a Datagram */
  8624.  
  8625.                   Search for 1st fragment by source IP address
  8626.                      and DGM_ID;
  8627.                   IF found 1st fragment THEN
  8628.                        Process both UDP packets;
  8629.                   ELSE
  8630.                   BEGIN
  8631.                        discard 2nd fragment UDP packet;
  8632.                        return;
  8633.                   END
  8634.              END
  8635.  
  8636.              IF DESTINATION_NAME is '*' THEN
  8637.              BEGIN
  8638.                   /* NetBIOS broadcast */
  8639.  
  8640.                   deliver USER_DATA from UDP packet(s) to all
  8641.                        outstanding receive broadcast
  8642.                        datagram requests;
  8643.                   return;
  8644.              END
  8645.              ELSE
  8646.              BEGIN /* non-broadcast */
  8647.                   /* Datagram for Unique or Group Name */
  8648.  
  8649.                   IF DESTINATION_NAME is not present in the
  8650.                      local name table THEN
  8651.                   BEGIN
  8652.                        /* destination not present */
  8653.                        build DATAGRAM ERROR packet, clear
  8654.                             FIRST and MORE bit, put in
  8655.                             this nodes IP and PORT, set
  8656.                             ERROR_CODE;
  8657.                        send DATAGRAM ERROR packet to
  8658.                             source IP address and port
  8659.                             of UDP;
  8660.                        discard UDP packet(s);
  8661.                        return;
  8662.                   END
  8663.                   ELSE
  8664.                   BEGIN /* good */
  8665.                        /*
  8666.  
  8667.  
  8668.  
  8669. NetBIOS Working Group                                          [Page 79]
  8670.  
  8671. RFC 1002                                                      March 1987
  8672.  
  8673.  
  8674.                         * Replicate received NetBIOS datagram for
  8675.                         * each recipient
  8676.                         */
  8677.                        FOR EACH pending NetBIOS user's receive
  8678.                             datagram operation
  8679.                        BEGIN
  8680.                             IF source name of operation
  8681.                                matches destination name
  8682.                                of packet THEN
  8683.                             BEGIN
  8684.                                deliver USER_DATA from UDP
  8685.                                  packet(s);
  8686.                             END
  8687.                        END /* for each */
  8688.                        return;
  8689.                   END /* good */
  8690.              END /* non-broadcast */
  8691.             END /* datagram service */
  8692.  
  8693.            DATAGRAM ERROR:
  8694.            BEGIN
  8695.                 /*
  8696.                  * name service returned incorrect information
  8697.                  */
  8698.  
  8699.                 inform local name service that incorrect
  8700.                   information was provided;
  8701.  
  8702.                 IF this is a P or M node THEN
  8703.                 BEGIN
  8704.                      /*
  8705.                       * tell NetBIOS Name Server that it may
  8706.                       * have given incorrect information
  8707.                       */
  8708.  
  8709.                      send NAME RELEASE REQUEST with name
  8710.                        and incorrect IP address to NetBIOS
  8711.                        Name Server;
  8712.                 END
  8713.            END /* datagram error */
  8714.  
  8715.         END /* case */
  8716.    END
  8717.  
  8718. 5.3.4.  PROTOCOLS FOR THE NBDD
  8719.  
  8720.    The key to NetBIOS Datagram forwarding service is the packet
  8721.    delivered to the destination end node must have the same NetBIOS
  8722.    header as if the source end node sent the packet directly to the
  8723.    destination end node.  Consequently, the NBDD does not reassemble
  8724.    NetBIOS Datagrams.  It forwards the UDP packet as is.
  8725.  
  8726.  
  8727.  
  8728. NetBIOS Working Group                                          [Page 80]
  8729.  
  8730. RFC 1002                                                      March 1987
  8731.  
  8732.  
  8733.    PROCEDURE  datagram_packet(packet)
  8734.  
  8735.    /*
  8736.     * processing initiated by a incoming datagram service
  8737.     * packet on a NBDD node.
  8738.     */
  8739.  
  8740.    BEGIN
  8741.         CASE packet type OF
  8742.  
  8743.            DATAGRAM SERVICE:
  8744.            BEGIN
  8745.                 IF packet was sent as a directed
  8746.                    NetBIOS datagram THEN
  8747.                 BEGIN
  8748.                   /*
  8749.                    * provide group forwarding service
  8750.                    *
  8751.                    * Forward datagram to each member of the
  8752.                    * group.  Can forward via:
  8753.                    *   1) get list of group members and send
  8754.                    *   the DATAGRAM SERVICE packet unicast
  8755.                    *   to each
  8756.                    *   2) use Group Multicast, if available
  8757.                    *   3) combination of 1) and 2)
  8758.                    */
  8759.  
  8760.                   ...
  8761.  
  8762.                 END
  8763.  
  8764.                 ELSE
  8765.                 BEGIN
  8766.                   /*
  8767.                    * provide broadcast forwarding service
  8768.                    *
  8769.                    * Forward datagram to every node in the
  8770.                    * NetBIOS scope.  Can forward via:
  8771.                    *   1) get list of group members and send
  8772.                    *   the DATAGRAM SERVICE packet unicast
  8773.                    *   to each
  8774.                    *   2) use Group Multicast, if available
  8775.                    *   3) combination of 1) and 2)
  8776.                    */
  8777.  
  8778.                   ...
  8779.  
  8780.                 END
  8781.            END /* datagram service */
  8782.  
  8783.            DATAGRAM ERROR:
  8784.  
  8785.  
  8786.  
  8787. NetBIOS Working Group                                          [Page 81]
  8788.  
  8789. RFC 1002                                                      March 1987
  8790.  
  8791.  
  8792.            BEGIN
  8793.              /*
  8794.               * Should never receive these because Datagrams
  8795.               * forwarded have source end node IP address and
  8796.               * port in NetBIOS header.
  8797.               */
  8798.  
  8799.              send DELETE NAME REQUEST with incorrect name and
  8800.                   IP address to NetBIOS Name Server;
  8801.  
  8802.            END /* datagram error */
  8803.  
  8804.            DATAGRAM QUERY REQUEST:
  8805.            BEGIN
  8806.              IF can send packet to DESTINATION_NAME THEN
  8807.              BEGIN
  8808.                   /*
  8809.                    * NBDD is able to relay Datagrams for
  8810.                    * this name
  8811.                    */
  8812.  
  8813.                   send POSITIVE DATAGRAM QUERY RESPONSE to
  8814.                     REQUEST source IP address and UDP port
  8815.                     with request's DGM_ID;
  8816.              END
  8817.              ELSE
  8818.              BEGIN
  8819.                   /*
  8820.                    * NBDD is NOT able to relay Datagrams for
  8821.                    * this name
  8822.                    */
  8823.  
  8824.                   send NEGATIVE DATAGRAM QUERY RESPONSE to
  8825.                     REQUEST source IP address and UDP port
  8826.  
  8827.                     with request's DGM_ID;
  8828.              END
  8829.            END /* datagram query request */
  8830.  
  8831.         END /* case */
  8832.    END /* procedure */
  8833.  
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  
  8843.  
  8844.  
  8845.  
  8846. NetBIOS Working Group                                          [Page 82]
  8847.  
  8848. RFC 1002                                                      March 1987
  8849.  
  8850.  
  8851. 6.  DEFINED CONSTANTS AND VARIABLES
  8852.  
  8853.    GENERAL:
  8854.  
  8855.       SCOPE_ID                   The name of the NetBIOS scope.
  8856.  
  8857.                                  This is expressed as a character
  8858.                                  string meeting the requirements of
  8859.                                  the domain name system and without
  8860.                                  a leading or trailing "dot".
  8861.  
  8862.                                  An implementation may elect to make
  8863.                                  this a single global value for the
  8864.                                  node or allow it to be specified
  8865.                                  with each separate NetBIOS name
  8866.                                  (thus permitting cross-scope
  8867.                                  references.)
  8868.  
  8869.       BROADCAST_ADDRESS          An IP address composed of the
  8870.                                  nodes's network and subnetwork
  8871.                                  numbers with all remaining bits set
  8872.                                  to one.
  8873.  
  8874.                                  I.e. "Specific subnet" broadcast
  8875.                                  addressing according to section 2.3
  8876.                                  of RFC 950.
  8877.  
  8878.       BCAST_REQ_RETRY_TIMEOUT    250 milliseconds.
  8879.                                  An adaptive timer may be used.
  8880.  
  8881.       BCAST_REQ_RETRY_COUNT      3
  8882.  
  8883.       UCAST_REQ_RETRY_TIMEOUT    5 seconds
  8884.                                  An adaptive timer may be used.
  8885.  
  8886.       UCAST_REQ_RETRY_COUNT      3
  8887.  
  8888.       MAX_DATAGRAM_LENGTH        576 bytes (default)
  8889.  
  8890.  
  8891.  
  8892.    NAME SERVICE:
  8893.  
  8894.       REFRESH_TIMER              Negotiated with NBNS for each name.
  8895.  
  8896.       CONFLICT_TIMER             1 second
  8897.                                  Implementations may chose a longer
  8898.                                  value.
  8899.  
  8900.  
  8901.       NAME_SERVICE_TCP_PORT      137 (decimal)
  8902.  
  8903.  
  8904.  
  8905. NetBIOS Working Group                                          [Page 83]
  8906.  
  8907. RFC 1002                                                      March 1987
  8908.  
  8909.  
  8910.       NAME_SERVICE_UDP_PORT      137 (decimal)
  8911.  
  8912.       INFINITE_TTL               0
  8913.  
  8914.  
  8915.    SESSION SERVICE:
  8916.  
  8917.       SSN_SRVC_TCP_PORT          139 (decimal)
  8918.  
  8919.       SSN_RETRY_COUNT            4 (default)
  8920.                                  Re-configurable by user.
  8921.  
  8922.       SSN_CLOSE_TIMEOUT          30 seconds (default)
  8923.                                  Re-configurable by user.
  8924.  
  8925.       SSN_KEEP_ALIVE_TIMEOUT     60 seconds, recommended, may be set to
  8926.                                  a higher value.
  8927.                                  (Session keep-alives are used only
  8928.                                  if configured.)
  8929.  
  8930.    DATAGRAM SERVICE:
  8931.  
  8932.       DGM_SRVC_UDP_PORT          138 (decimal)
  8933.  
  8934.       FRAGMENT_TO                2 seconds (default)
  8935.  
  8936.  
  8937.  
  8938.  
  8939.  
  8940.  
  8941.  
  8942.  
  8943.  
  8944.  
  8945.  
  8946.  
  8947.  
  8948.  
  8949.  
  8950.  
  8951.  
  8952.  
  8953.  
  8954.  
  8955.  
  8956.  
  8957.  
  8958.  
  8959.  
  8960.  
  8961.  
  8962.  
  8963.  
  8964. NetBIOS Working Group                                          [Page 84]
  8965.  
  8966. RFC 1002                                                      March 1987
  8967.  
  8968.  
  8969. REFERENCES
  8970.  
  8971.  
  8972.  
  8973.    [1]  "Protocol Standard For a NetBIOS Service on a TCP/UDP
  8974.         Transport: Concepts and Methods", RFC 1001, March 1987.
  8975.  
  8976.    [2]  J. Reynolds, J. Postel, "Assigned Numbers", RFC 990, November
  8977.         1986.
  8978.  
  8979.    [3]  P. Mockapetris, "Domain Names - Implementation and
  8980.         Specification", RFC 883, November 1983.
  8981.  
  8982.  
  8983.  
  8984.  
  8985.  
  8986.  
  8987.  
  8988.  
  8989.  
  8990.  
  8991.  
  8992.  
  8993.  
  8994.  
  8995.  
  8996.  
  8997.  
  8998.  
  8999.  
  9000.  
  9001.  
  9002.  
  9003.  
  9004.  
  9005.  
  9006.  
  9007.  
  9008.  
  9009.  
  9010.  
  9011.  
  9012.  
  9013.  
  9014.  
  9015.  
  9016.  
  9017.  
  9018.  
  9019.  
  9020.  
  9021.  
  9022.  
  9023. NetBIOS Working Group                                          [Page 85]
  9024.