home *** CD-ROM | disk | FTP | other *** search
/ Handbook of Infosec Terms 2.0 / Handbook_of_Infosec_Terms_Version_2.0_ISSO.iso / text / rfcs / rfc1002.txt < prev    next >
Text File  |  1996-05-07  |  169KB  |  2,276 lines

  1.    Network Working Group Request for Comments: 1002                         March, 1987 
  2.  
  3.  
  4.  
  5.               PROTOCOL STANDARD FOR A NetBIOS SERVICE                      ON A TCP/UDP TRANSPORT:                      DETAILED SPECIFICATIONS 
  6.  
  7.  
  8.  
  9.                              ABSTRACT 
  10.  
  11. This RFC defines a proposed standard protocol to support NetBIOS services in a TCP/IP environment.  Both local network and internet operation are supported.  Various node types are defined to accommodate local and internet topologies and to allow operation with or without the use of IP broadcast. 
  12.  
  13. This RFC gives the detailed specifications of the NetBIOS-over-TCP packets, protocols, and defined constants and variables.  A more general overview is found in a companion RFC, "Protocol Standard For a NetBIOS Service on a TCP/UDP Transport: Concepts and Methods". 
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. NetBIOS Working Group                                           [Page 1] 
  44.  RFC 1002                                                      March 1987 
  45.  
  46.                          TABLE OF CONTENTS 
  47.  
  48.  1.  STATUS OF THIS MEMO                                              4 
  49.  
  50. 2.  ACKNOWLEDGEMENTS                                                 4 
  51.  
  52. 3.  INTRODUCTION                                                     5 
  53.  
  54. 4.  PACKET DESCRIPTIONS                                              5   4.1  NAME FORMAT                                                   5   4.2  NAME SERVICE PACKETS                                          7      4.2.1  GENERAL FORMAT OF NAME SERVICE PACKETS                   7        4.2.1.1  HEADER                                               8        4.2.1.2  QUESTION SECTION                                    10        4.2.1.3  RESOURCE RECORD                                     11      4.2.2  NAME REGISTRATION REQUEST                               13      4.2.3  NAME OVERWRITE REQUEST & DEMAND                         14      4.2.4  NAME REFRESH REQUEST                                    15      4.2.5  POSITIVE NAME REGISTRATION RESPONSE                     16      4.2.6  NEGATIVE NAME REGISTRATION RESPONSE                     16      4.2.7  END-NODE CHALLENGE REGISTRATION RESPONSE                17      4.2.8  NAME CONFLICT DEMAND                                    18      4.2.9  NAME RELEASE REQUEST & DEMAND                           19      4.2.10  POSITIVE NAME RELEASE RESPONSE                         20      4.2.11  NEGATIVE NAME RELEASE RESPONSE                         20      4.2.12  NAME QUERY REQUEST                                     21      4.2.13  POSITIVE NAME QUERY RESPONSE                           22      4.2.14  NEGATIVE NAME QUERY RESPONSE                           23      4.2.15  REDIRECT NAME QUERY RESPONSE                           24      4.2.16  WAIT FOR ACKNOWLEDGEMENT (WACK) RESPONSE               25      4.2.17  NODE STATUS REQUEST                                    26      4.2.18  NODE STATUS RESPONSE                                   27   4.3  SESSION SERVICE PACKETS                                      29      4.3.1  GENERAL FORMAT OF SESSION PACKETS                       29      4.3.2  SESSION REQUEST PACKET                                  30      4.3.3  POSITIVE SESSION RESPONSE PACKET                        31      4.3.4  NEGATIVE SESSION RESPONSE PACKET                        31      4.3.5  SESSION RETARGET RESPONSE PACKET                        31      4.3.6  SESSION MESSAGE PACKET                                  32      4.3.7  SESSION KEEP ALIVE PACKET                               32   4.4  DATAGRAM SERVICE PACKETS                                     32      4.4.1  NetBIOS DATAGRAM HEADER                                 32      4.4.2  DIRECT_UNIQUE, DIRECT_GROUP, & BROADCAST DATAGRAM       33      4.4.3  DATAGRAM ERROR PACKET                                   34      4.4.4  DATAGRAM QUERY REQUEST                                  34      4.4.5  DATAGRAM POSITIVE AND NEGATIVE QUERY RESPONSE           34 
  55.  
  56. 5.  PROTOCOL DESCRIPTIONS                                           35   5.1  NAME SERVICE PROTOCOLS                                       35      5.1.1  B-NODE ACTIVITY                                         35 
  57.  
  58.  
  59.  
  60. NetBIOS Working Group                                           [Page 2] 
  61.  RFC 1002                                                      March 1987 
  62.  
  63.         5.1.1.1  B-NODE ADD NAME                                     35        5.1.1.2  B-NODE ADD_GROUP NAME                               37        5.1.1.3  B-NODE FIND_NAME                                    37        5.1.1.4  B NODE NAME RELEASE                                 38        5.1.1.5  B-NODE INCOMING PACKET PROCESSING                   39      5.1.2  P-NODE ACTIVITY                                         42        5.1.2.1  P-NODE ADD_NAME                                     42        5.1.2.2  P-NODE ADD GROUP NAME                               45        5.1.2.3  P-NODE FIND NAME                                    45        5.1.2.4  P-NODE DELETE_NAME                                  46        5.1.2.5  P-NODE INCOMING PACKET PROCESSING                   47        5.1.2.6  P-NODE TIMER INITIATED PROCESSING                   49      5.1.3  M-NODE ACTIVITY                                         50        5.1.3.1  M-NODE ADD NAME                                     50        5.1.3.2  M-NODE ADD GROUP NAME                               54        5.1.3.3  M-NODE FIND NAME                                    55        5.1.3.4  M-NODE DELETE NAME                                  56        5.1.3.5  M-NODE INCOMING PACKET PROCESSING                   58        5.1.3.6  M-NODE TIMER INITIATED PROCESSING                   60      5.1.4  NBNS ACTIVITY                                           60        5.1.4.1  NBNS INCOMING PACKET PROCESSING                     61        5.1.4.2  NBNS TIMER INITIATED PROCESSING                     66   5.2  SESSION SERVICE PROTOCOLS                                    67      5.2.1  SESSION ESTABLISHMENT PROTOCOLS                         67        5.2.1.1  USER REQUEST PROCESSING                             67        5.2.1.2  RECEIVED PACKET PROCESSING                          71      5.2.2  SESSION DATA TRANSFER PROTOCOLS                         72        5.2.2.1  USER REQUEST PROCESSING                             72        5.2.2.2  RECEIVED PACKET PROCESSING                          72        5.2.2.3  PROCESSING INITIATED BY TIMER                       73      5.2.3  SESSION TERMINATION PROTOCOLS                           73        5.2.3.1  USER REQUEST PROCESSING                             73        5.2.3.2  RECEPTION INDICATION PROCESSING                     73   5.3  NetBIOS DATAGRAM SERVICE PROTOCOLS                           74      5.3.1  B NODE TRANSMISSION OF NetBIOS DATAGRAMS                74      5.3.2  P AND M NODE TRANSMISSION OF NetBIOS DATAGRAMS          76      5.3.3  RECEPTION OF NetBIOS DATAGRAMS BY ALL NODES             78      5.3.4  PROTOCOLS FOR THE NBDD                                  80 
  64.  
  65. 6.  DEFINED CONSTANTS AND VARIABLES                                 83 
  66.  
  67. REFERENCES                                                          85 
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  NetBIOS Working Group                                           [Page 3] 
  80.  RFC 1002                                                      March 1987 
  81.  
  82.               PROTOCOL STANDARD FOR A NetBIOS SERVICE                      ON A TCP/UDP TRANSPORT:                      DETAILED SPECIFICATIONS 
  83.  
  84.  1.  STATUS OF THIS MEMO 
  85.  
  86.    This RFC specifies a proposed standard for the DARPA Internet    community.  Since this topic is new to the Internet community,    discussions and suggestions are specifically requested. 
  87.  
  88.    Please send written comments to: 
  89.  
  90.            Karl Auerbach            Epilogue Technology Corporation            P.O. Box 5432            Redwood City, CA   94063 
  91.  
  92.    Please send online comments to: 
  93.  
  94.            Avnish Aggarwal                    Internet: mtxinu!excelan!avnish@ucbvax.berkeley.edu                    Usenet:   ucbvax!mtxinu!excelan!avnish 
  95.  
  96.    Distribution of this memorandum is unlimited. 
  97.  
  98. 2.  ACKNOWLEDGEMENTS 
  99.  
  100.    This RFC has been developed under the auspices of the Internet    Activities Board. 
  101.  
  102.    The following individuals have contributed to the development of    this RFC: 
  103.  
  104.    Avnish Aggarwal       Arvind Agrawal        Lorenzo Aguilar    Geoffrey Arnold       Karl Auerbach         K. Ramesh Babu    Keith Ball            Amatzia Ben-Artzi     Vint Cerf    Richard Cherry        David Crocker         Steve Deering    Greg Ennis            Steve Holmgren        Jay Israel    David Kaufman         Lee LaBarre           James Lau    Dan Lynch             Gaylord Miyata        David Stevens    Steve Thomas          Ishan Wu 
  105.  
  106.    The system proposed by this RFC does not reflect any existing    Netbios-over-TCP implementation.  However, the design    incorporates considerable knowledge obtained from prior    implementations.  Special thanks goes to the following    organizations which have provided this invaluable information: 
  107.  
  108.    CMC/Syros      Excelan        Sytek          Ungermann-Bass 
  109.  
  110.  
  111.  
  112.  NetBIOS Working Group                                           [Page 4] 
  113.  RFC 1002                                                      March 1987 
  114.  
  115.  3.  INTRODUCTION 
  116.  
  117.    This RFC contains the detailed packet formats and protocol    specifications for NetBIOS-over-TCP.  This RFC is a companion to    RFC 1001, "Protocol Standard For a NetBIOS Service on a TCP/UDP    Transport: Concepts and Methods" [1]. 
  118.  
  119. 4.  PACKET DESCRIPTIONS 
  120.  
  121.    Bit and byte ordering are defined by the most recent version of    "Assigned Numbers" [2]. 
  122.  
  123. 4.1.  NAME FORMAT 
  124.  
  125.    The NetBIOS name representation in all NetBIOS packets (for NAME,    SESSION, and DATAGRAM services) is defined in the Domain Name    Service RFC 883[3] as "compressed" name messages.  This format is    called "second-level encoding" in the section entitled    "Representation of NetBIOS Names" in the Concepts and Methods    document. 
  126.  
  127.    For ease of description, the first two paragraphs from page 31,    the section titled "Domain name representation and compression",    of RFC 883 are replicated here: 
  128.  
  129.         Domain names messages are expressed in terms of a sequence         of labels.  Each label is represented as a one octet length         field followed by that number of octets.  Since every domain         name ends with the null label of the root, a compressed         domain name is terminated by a length byte of zero.  The         high order two bits of the length field must be zero, and         the remaining six bits of the length field limit the label         to 63 octets or less. 
  130.  
  131.         To simplify implementations, the total length of label         octets and label length octets that make up a domain name is         restricted to 255 octets or less. 
  132.  
  133.    The following is the uncompressed representation of the NetBIOS name    "FRED ", which is the 4 ASCII characters, F, R, E, D, followed by 12    space characters (0x20).  This name has the SCOPE_ID: "NETBIOS.COM" 
  134.  
  135.            EGFCEFEECACACACACACACACACACACACA.NETBIOS.COM 
  136.  
  137.    This uncompressed representation of names is called "first-level    encoding" in the section entitled "Representation of NetBIOS Names"    in the Concepts and Methods document. 
  138.  
  139.    The following is a pictographic representation of the compressed    representation of the previous uncompressed Domain Name    representation. 
  140.  
  141.  
  142.  
  143. NetBIOS Working Group                                           [Page 5] 
  144.  RFC 1002                                                      March 1987 
  145.  
  146.                          1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |      0x20     |    E (0x45)   |    G (0x47)   |    F (0x46)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    C (0x43)   |    E (0x45)   |    F (0x46)   |    E (0x45)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    E (0x45)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    A (0x41)   |    C (0x43)   |    A (0x41)   |    C (0x43)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    A (0X41)   |      0x07     |    N (0x4E)   |    E (0x45)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    T (0x54)   |    B (0x42)   |    I (0x49)   |    O (0x4F)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    S (0x53)   |      0x03     |    C (0x43)   |    O (0x4F)   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |    M (0x4D)   |      0x00     |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  147.  
  148.    Each section of a domain name is called a label [7 (page 31)].  A    label can be a maximum of 63 bytes.  The first byte of a label in    compressed representation is the number of bytes in the label.  For    the above example, the first 0x20 is the number of bytes in the    left-most label, EGFCEFEECACACACACACACACACACACACA, of the domain    name.  The bytes following the label length count are the characters    of the label.  The following labels are in sequence after the first    label, which is the encoded NetBIOS name, until a zero (0x00) length    count.  The zero length count represents the root label, which is    always null. 
  149.  
  150.    A label length count is actually a 6-bit field in the label length    field.  The most significant 2 bits of the field, bits 7 and 6, are    flags allowing an escape from the above compressed representation.    If bits 7 and 6 are both set (11), the following 14 bits are an    offset pointer into the full message to the actual label string from    another domain name that belongs in this name.  This label pointer    allows for a further compression of a domain name in a packet. 
  151.  
  152.    NetBIOS implementations can only use label string pointers in Name    Service packets.  They cannot be used in Session or Datagram Service    packets. 
  153.  
  154.  
  155.  
  156.  NetBIOS Working Group                                           [Page 6] 
  157.  RFC 1002                                                      March 1987 
  158.  
  159.     The other two possible values for bits 7 and 6 (01 and 10) of a label    length field are reserved for future use by RFC 883[2 (page 32)].     Note that the first octet of a compressed name must contain one of    the following bit patterns.  (An "x" indicates a bit whose value may    be either 0 or 1.): 
  160.  
  161.            00100000 -  Netbios name, length must be 32 (decimal)            11xxxxxx -  Label string pointer            10xxxxxx -  Reserved            01xxxxxx -  Reserved 
  162.  
  163. 4.2.  NAME SERVICE PACKETS 
  164.  
  165. 4.2.1.  GENERAL FORMAT OF NAME SERVICE PACKETS 
  166.  
  167.    The NetBIOS Name Service packets follow the packet structure defined    in the Domain Name Service (DNS) RFC 883 [7 (pg 26-31)].  The    structures are compatible with the existing DNS packet formats,    however, additional types and codes have been added to work with    NetBIOS. 
  168.  
  169.    If Name Service packets are sent over a TCP connection they are    preceded by a 16 bit unsigned integer representing the length of the    Name Service packet. 
  170.  
  171.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    + ------                                                ------- +    |                            HEADER                             |    + ------                                                ------- +    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                       QUESTION ENTRIES                        /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                    ANSWER RESOURCE RECORDS                    /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                  AUTHORITY RESOURCE RECORDS                   /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                  ADDITIONAL RESOURCE RECORDS                  /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  172.  
  173.  
  174.  
  175. NetBIOS Working Group                                           [Page 7] 
  176.  RFC 1002                                                      March 1987 
  177.  
  178.  4.2.1.1.  HEADER 
  179.  
  180.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           | OPCODE  |   NM_FLAGS  | RCODE |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          QDCOUNT              |           ANCOUNT             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          NSCOUNT              |           ARCOUNT             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  181.  
  182.    Field     Description 
  183.  
  184.    NAME_TRN_ID      Transaction ID for Name Service Transaction.                     Requestor places a unique value for each active                     transaction.  Responder puts NAME_TRN_ID value                     from request packet in response packet. 
  185.  
  186.    OPCODE           Packet type code, see table below. 
  187.  
  188.    NM_FLAGS         Flags for operation, see table below. 
  189.  
  190.    RCODE            Result codes of request.  Table of RCODE values                     for each response packet below. 
  191.  
  192.    QDCOUNT          Unsigned 16 bit integer specifying the number of                     entries in the question section of a Name 
  193.  
  194.                     Service packet.  Always zero (0) for responses.                     Must be non-zero for all NetBIOS Name requests. 
  195.  
  196.    ANCOUNT          Unsigned 16 bit integer specifying the number of                     resource records in the answer section of a Name                     Service packet. 
  197.  
  198.    NSCOUNT          Unsigned 16 bit integer specifying the number of                     resource records in the authority section of a                     Name Service packet. 
  199.  
  200.    ARCOUNT          Unsigned 16 bit integer specifying the number of                     resource records in the additional records                     section of a Name Service packet. 
  201.  
  202.    The OPCODE field is defined as: 
  203.  
  204.      0   1   2   3   4    +---+---+---+---+---+    | R |    OPCODE     |    +---+---+---+---+---+ 
  205.  
  206.  
  207.  
  208.  NetBIOS Working Group                                           [Page 8] 
  209.  RFC 1002                                                      March 1987 
  210.  
  211.     Symbol     Bit(s)   Description 
  212.  
  213.    OPCODE        1-4   Operation specifier:                          0 = query                          5 = registration                          6 = release                          7 = WACK                          8 = refresh 
  214.  
  215.    R               0   RESPONSE flag:                          if bit == 0 then request packet                          if bit == 1 then response packet. 
  216.  
  217.    The NM_FLAGS field is defined as: 
  218.  
  219.       0   1   2   3   4   5   6    +---+---+---+---+---+---+---+    |AA |TC |RD |RA | 0 | 0 | B |    +---+---+---+---+---+---+---+ 
  220.  
  221.    Symbol     Bit(s)   Description 
  222.  
  223.    B               6   Broadcast Flag.                          = 1: packet was broadcast or multicast                          = 0: unicast 
  224.  
  225.    RA              3   Recursion Available Flag. 
  226.  
  227.                        Only valid in responses from a NetBIOS Name                        Server -- must be zero in all other                        responses. 
  228.  
  229.                        If one (1) then the NBNS supports recursive                        query, registration, and release. 
  230.  
  231.                        If zero (0) then the end-node must iterate                        for query and challenge for registration. 
  232.  
  233.    RD              2   Recursion Desired Flag. 
  234.  
  235.                        May only be set on a request to a NetBIOS                        Name Server. 
  236.  
  237.                        The NBNS will copy its state into the                        response packet. 
  238.  
  239.                        If one (1) the NBNS will iterate on the                        query, registration, or release. 
  240.  
  241.    TC              1   Truncation Flag. 
  242.  
  243.  
  244.  
  245. NetBIOS Working Group                                           [Page 9] 
  246.  RFC 1002                                                      March 1987 
  247.  
  248.                         Set if this message was truncated because the                        datagram carrying it would be greater than                        576 bytes in length.  Use TCP to get the                        information from the NetBIOS Name Server. 
  249.  
  250.    AA              0   Authoritative Answer flag. 
  251.  
  252.                        Must be zero (0) if R flag of OPCODE is zero                        (0). 
  253.  
  254.                        If R flag is one (1) then if AA is one (1)                        then the node responding is an authority for                        the domain name. 
  255.  
  256.                        End nodes responding to queries always set                        this bit in responses. 
  257.  
  258. 4.2.1.2.  QUESTION SECTION 
  259.  
  260.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                         QUESTION_NAME                         /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         QUESTION_TYPE         |        QUESTION_CLASS         |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  261.  
  262.    Field            Description 
  263.  
  264.    QUESTION_NAME    The compressed name representation of the                     NetBIOS name for the request. 
  265.  
  266.    QUESTION_TYPE    The type of request.  The values for this field                     are specified for each request. 
  267.  
  268.    QUESTION_CLASS   The class of the request.  The values for this                     field are specified for each request. 
  269.  
  270.    QUESTION_TYPE is defined as: 
  271.  
  272.    Symbol      Value   Description: 
  273.  
  274.    NB         0x0020   NetBIOS general Name Service Resource Record    NBSTAT     0x0021   NetBIOS NODE STATUS Resource Record (See NODE                        STATUS REQUEST) 
  275.  
  276.    QUESTION_CLASS is defined as: 
  277.  
  278.  
  279.  
  280.  NetBIOS Working Group                                          [Page 10] 
  281.  RFC 1002                                                      March 1987 
  282.  
  283.     Symbol      Value   Description: 
  284.  
  285.    IN         0x0001   Internet class 
  286.  
  287. 4.2.1.3.  RESOURCE RECORD 
  288.  
  289.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           RR_TYPE             |          RR_CLASS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           RDLENGTH            |                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |    /                                                               /    /                             RDATA                             /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  290.  
  291.    Field            Description 
  292.  
  293.    RR_NAME          The compressed name representation of the                     NetBIOS name corresponding to this resource                     record. 
  294.  
  295.    RR_TYPE          Resource record type code 
  296.  
  297.    RR_CLASS         Resource record class code 
  298.  
  299.    TTL              The Time To Live of a the resource record's                     name. 
  300.  
  301.    RDLENGTH         Unsigned 16 bit integer that specifies the                     number of bytes in the RDATA field. 
  302.  
  303.    RDATA            RR_CLASS and RR_TYPE dependent field.  Contains                     the resource information for the NetBIOS name. 
  304.  
  305.    RESOURCE RECORD RR_TYPE field definitions: 
  306.  
  307.    Symbol      Value   Description: 
  308.  
  309.    A          0x0001   IP address Resource Record (See REDIRECT NAME                        QUERY RESPONSE)    NS         0x0002   Name Server Resource Record (See REDIRECT 
  310.  
  311.  
  312.  
  313. NetBIOS Working Group                                          [Page 11] 
  314.  RFC 1002                                                      March 1987 
  315.  
  316.                         NAME QUERY RESPONSE)    NULL       0x000A   NULL Resource Record (See WAIT FOR                        ACKNOWLEDGEMENT RESPONSE)    NB         0x0020   NetBIOS general Name Service Resource Record                        (See NB_FLAGS and NB_ADDRESS, below)    NBSTAT     0x0021   NetBIOS NODE STATUS Resource Record (See NODE                        STATUS RESPONSE) 
  317.  
  318.    RESOURCE RECORD RR_CLASS field definitions: 
  319.  
  320.    Symbol      Value   Description: 
  321.  
  322.    IN         0x0001   Internet class 
  323.  
  324.    NB_FLAGS field of the RESOURCE RECORD RDATA field for RR_TYPE of    "NB": 
  325.  
  326.                                              1   1   1   1   1   1      0   1   2   3   4   5   6   7   8   9   0   1   2   3   4   5    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+    | G |  ONT  |                RESERVED                           |    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 
  327.  
  328.    Symbol     Bit(s)   Description: 
  329.  
  330.    RESERVED     3-15   Reserved for future use.  Must be zero (0).    ONT           1,2   Owner Node Type:                           00 = B node                           01 = P node                           10 = M node                           11 = Reserved for future use                        For registration requests this is the                        claimant's type.                        For responses this is the actual owner's                        type. 
  331.  
  332.    G               0   Group Name Flag.                        If one (1) then the RR_NAME is a GROUP                        NetBIOS name.                        If zero (0) then the RR_NAME is a UNIQUE                        NetBIOS name. 
  333.  
  334.    The NB_ADDRESS field of the RESOURCE RECORD RDATA field for    RR_TYPE of "NB" is the IP address of the name's owner. 
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  NetBIOS Working Group                                          [Page 12] 
  345.  RFC 1002                                                      March 1987 
  346.  
  347.  4.2.2.  NAME REGISTRATION REQUEST 
  348.  
  349.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |0|  0x5  |0|0|1|0|0 0|B|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0001               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                         QUESTION_NAME                         /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |        IN (0x0001)            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  350.  
  351.    Since the RR_NAME is the same name as the QUESTION_NAME, the    RR_NAME representation must use pointers to the QUESTION_NAME    name's labels to guarantee the length of the datagram is less    than the maximum 576 bytes.  See section above on name formats    and also page 31 and 32 of RFC 883, Domain Names - Implementation    and Specification, for a complete description of compressed name    label pointers. 
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367. NetBIOS Working Group                                          [Page 13] 
  368.  RFC 1002                                                      March 1987 
  369.  
  370.  4.2.3.  NAME OVERWRITE REQUEST & DEMAND 
  371.  
  372.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |0|  0x5  |0|0|0|0|0 0|B|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0001               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                         QUESTION_NAME                         /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |        IN (0x0001)            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396. NetBIOS Working Group                                          [Page 14] 
  397.  RFC 1002                                                      March 1987 
  398.  
  399.  4.2.4.  NAME REFRESH REQUEST 
  400.  
  401.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |0|  0x9  |0|0|0|0|0 0|B|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0001               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                         QUESTION_NAME                         /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |        IN (0x0001)            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425. NetBIOS Working Group                                          [Page 15] 
  426.  RFC 1002                                                      March 1987 
  427.  
  428.  4.2.5.  POSITIVE NAME REGISTRATION RESPONSE 
  429.  
  430.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x5  |1|0|1|1|0 0|0|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  431.  
  432. 4.2.6.  NEGATIVE NAME REGISTRATION RESPONSE 
  433.  
  434.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x5  |1|0|1|1|0 0|0| RCODE |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  435.  
  436.  
  437.  
  438.  
  439.  
  440. NetBIOS Working Group                                          [Page 16] 
  441.  RFC 1002                                                      March 1987 
  442.  
  443.     RCODE field values: 
  444.  
  445.    Symbol      Value   Description: 
  446.  
  447.    FMT_ERR       0x1   Format Error.  Request was invalidly                        formatted.    SRV_ERR       0x2   Server failure.  Problem with NBNS, cannot                        process name.    IMP_ERR       0x4   Unsupported request error.  Allowable only                        for challenging NBNS when gets an Update type                        registration request.    RFS_ERR       0x5   Refused error.  For policy reasons server                        will not register this name from this host.    ACT_ERR       0x6   Active error.  Name is owned by another node.    CFT_ERR       0x7   Name in conflict error.  A UNIQUE name is                        owned by more than one node. 
  448.  
  449. 4.2.7.  END-NODE CHALLENGE REGISTRATION RESPONSE 
  450.  
  451.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x5  |1|0|1|0|0 0|0|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465. NetBIOS Working Group                                          [Page 17] 
  466.  RFC 1002                                                      March 1987 
  467.  
  468.  4.2.8.  NAME CONFLICT DEMAND 
  469.  
  470.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x5  |1|0|1|1|0 0|0|  0x7  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          0x00000000                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |0|ONT|0|     0x000             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          0x00000000                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  471.  
  472.    This packet is identical to a NEGATIVE NAME REGISTRATION RESPONSE    with RCODE = CFT_ERR. 
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500. NetBIOS Working Group                                          [Page 18] 
  501.  RFC 1002                                                      March 1987 
  502.  
  503.  4.2.9.  NAME RELEASE REQUEST & DEMAND 
  504.  
  505.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |0|  0x6  |0|0|0|0|0 0|B|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0001               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                         QUESTION_NAME                         /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |        IN (0x0001)            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          0x00000000                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  506.  
  507.    Since the RR_NAME is the same name as the QUESTION_NAME, the    RR_NAME representation must use label string pointers to the    QUESTION_NAME labels to guarantee the length of the datagram is    less than the maximum 576 bytes.  This is the same condition as    with the NAME REGISTRATION REQUEST. 
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525. NetBIOS Working Group                                          [Page 19] 
  526.  RFC 1002                                                      March 1987 
  527.  
  528.  4.2.10.  POSITIVE NAME RELEASE RESPONSE 
  529.  
  530.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x6  |1|0|0|0|0 0|0|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  531.  
  532. 4.2.11.  NEGATIVE NAME RELEASE RESPONSE 
  533.  
  534.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x6  |1|0|0|0|0 0|0| RCODE |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0006              |          NB_FLAGS             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          NB_ADDRESS                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  535.  
  536.  
  537.  
  538.  
  539.  
  540. NetBIOS Working Group                                          [Page 20] 
  541.  RFC 1002                                                      March 1987 
  542.  
  543.     RCODE field values: 
  544.  
  545.    Symbol      Value   Description: 
  546.  
  547.    FMT_ERR       0x1   Format Error.  Request was invalidly                        formatted. 
  548.  
  549.    SRV_ERR       0x2   Server failure.  Problem with NBNS, cannot                        process name. 
  550.  
  551.    RFS_ERR       0x5   Refused error.  For policy reasons server                        will not release this name from this host. 
  552.  
  553.    ACT_ERR       0x6   Active error.  Name is owned by another node.                        Only that node may release it.  A NetBIOS                        Name Server can optionally allow a node to                        release a name it does not own.  This would                        facilitate detection of inactive names for                        nodes that went down silently. 
  554.  
  555. 4.2.12.  NAME QUERY REQUEST 
  556.  
  557.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |0|  0x0  |0|0|1|0|0 0|B|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0001               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                         QUESTION_NAME                         /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |        IN (0x0001)            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  NetBIOS Working Group                                          [Page 21] 
  574.  RFC 1002                                                      March 1987 
  575.  
  576.  4.2.13.  POSITIVE NAME QUERY RESPONSE 
  577.  
  578.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x0  |1|T|1|?|0 0|0|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NB (0x0020)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           RDLENGTH            |                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |    |                                                               |    /                       ADDR_ENTRY ARRAY                        /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  579.  
  580.    The ADDR_ENTRY ARRAY a sequence of zero or more ADDR_ENTRY    records.  Each ADDR_ENTRY record represents an owner of a name.    For group names there may be multiple entries.  However, the list    may be incomplete due to packet size limitations.  Bit 22, "T",    will be set to indicate truncated data. 
  581.  
  582.    Each ADDR_ENTRY has the following format: 
  583.  
  584.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          NB_FLAGS             |          NB_ADDRESS           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |   NB_ADDRESS (continued)      |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. NetBIOS Working Group                                          [Page 22] 
  599.  RFC 1002                                                      March 1987 
  600.  
  601.  4.2.14.  NEGATIVE NAME QUERY RESPONSE 
  602.  
  603.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x0  |1|0|1|?|0 0|0| RCODE |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NULL (0x000A)       |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          0x00000000                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  604.  
  605.    RCODE field values: 
  606.  
  607.    Symbol      Value   Description 
  608.  
  609.    FMT_ERR       0x1   Format Error.  Request was invalidly                        formatted.    SRV_ERR       0x2   Server failure.  Problem with NBNS, cannot                        process name.    NAM_ERR       0x3   Name Error.  The name requested does not                        exist.    IMP_ERR       0x4   Unsupported request error.  Allowable only                        for challenging NBNS when gets an Update type                        registration request.    RFS_ERR       0x5   Refused error.  For policy reasons server                        will not register this name from this host. 
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  NetBIOS Working Group                                          [Page 23] 
  626.  RFC 1002                                                      March 1987 
  627.  
  628.  4.2.15.  REDIRECT NAME QUERY RESPONSE 
  629.  
  630.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x0  |0|0|1|0|0 0|0|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0001               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           NS (0x0002)         |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           RDLENGTH            |                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +    |                                                               |    /                            NSD_NAME                           /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           A (0x0001)          |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |             0x0004            |           NSD_IP_ADDR         |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |     NSD_IP_ADDR, continued    |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  631.  
  632.    An end node responding to a NAME QUERY REQUEST always responds    with the AA and RA bits set for both the NEGATIVE and POSITIVE    NAME QUERY RESPONSE packets.  An end node never sends a REDIRECT    NAME QUERY RESPONSE packet. 
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642. NetBIOS Working Group                                          [Page 24] 
  643.  RFC 1002                                                      March 1987 
  644.  
  645.     When the requestor receives the REDIRECT NAME QUERY RESPONSE it    must reiterate the NAME QUERY REQUEST to the NBNS specified by    the NSD_IP_ADDR field of the A type RESOURCE RECORD in the    ADDITIONAL section of the response packet.  This is an optional    packet for the NBNS. 
  646.  
  647.    The NSD_NAME and the RR_NAME in the ADDITIONAL section of the    response packet are the same name.  Space can be optimized if    label string pointers are used in the RR_NAME which point to the    labels in the NSD_NAME. 
  648.  
  649.    The RR_NAME in the AUTHORITY section is the name of the domain    the NBNS called by NSD_NAME has authority over. 
  650.  
  651. 4.2.16.  WAIT FOR ACKNOWLEDGEMENT (WACK) RESPONSE 
  652.  
  653.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x7  |1|0|0|0|0 0|0|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          NULL (0x0020)        |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                              TTL                              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           0x0002              | OPCODE  |   NM_FLAGS  |  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  NetBIOS Working Group                                          [Page 25] 
  672.  RFC 1002                                                      March 1987 
  673.  
  674.     The NAME_TRN_ID of the WACK RESPONSE packet is the same    NAME_TRN_ID of the request that the NBNS is telling the requestor    to wait longer to complete.  The RR_NAME is the name from the    request, if any.  If no name is available from the request then    it is a null name, single byte of zero. 
  675.  
  676.    The TTL field of the ResourceRecord is the new time to wait, in    seconds, for the request to complete.  The RDATA field contains    the OPCODE and NM_FLAGS of the request. 
  677.  
  678.    A TTL value of 0 means that the NBNS can not estimate the time it    may take to complete a response. 
  679.  
  680. 4.2.17.  NODE STATUS REQUEST 
  681.  
  682.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |0|  0x0  |0|0|0|0|0 0|B|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0001               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                         QUESTION_NAME                         /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NBSTAT (0x0021)       |        IN (0x0001)            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.   
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706. NetBIOS Working Group                                          [Page 26] 
  707.  RFC 1002                                                      March 1987 
  708.  
  709.  4.2.18.  NODE STATUS RESPONSE 
  710.  
  711.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_TRN_ID           |1|  0x0  |1|0|0|0|0 0|0|  0x0  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0001              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          0x0000               |           0x0000              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                            RR_NAME                            /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |        NBSTAT (0x0021)        |         IN (0x0001)           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                          0x00000000                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          RDLENGTH             |   NUM_NAMES   |               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+               +    |                                                               |    +                                                               +    /                         NODE_NAME ARRAY                       /    +                                                               +    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    +                                                               +    /                           STATISTICS                          /    +                                                               +    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  712.  
  713.    The NODE_NAME ARRAY is an array of zero or more NUM_NAMES entries    of NODE_NAME records.  Each NODE_NAME entry represents an active    name in the same NetBIOS scope as the requesting name in the    local name table of the responder.  RR_NAME is the requesting    name. 
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729. NetBIOS Working Group                                          [Page 27] 
  730.  RFC 1002                                                      March 1987 
  731.  
  732.     NODE_NAME Entry: 
  733.  
  734.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    +---                                                         ---+    |                                                               |    +---                    NETBIOS FORMAT NAME                  ---+    |                                                               |    +---                                                         ---+    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         NAME_FLAGS            |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  735.  
  736.    The NAME_FLAGS field: 
  737.  
  738.                                              1   1   1   1   1   1      0   1   2   3   4   5   6   7   8   9   0   1   2   3   4   5    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+    | G |  ONT  |DRG|CNF|ACT|PRM|          RESERVED                 |    +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 
  739.  
  740.    The NAME_FLAGS field is defined as: 
  741.  
  742.    Symbol     Bit(s)   Description: 
  743.  
  744.    RESERVED     7-15   Reserved for future use.  Must be zero (0).    PRM             6   Permanent Name Flag.  If one (1) then entry                        is for the permanent node name.  Flag is zero                        (0) for all other names.    ACT             5   Active Name Flag.  All entries have this flag                        set to one (1).    CNF             4   Conflict Flag.  If one (1) then name on this                        node is in conflict.    DRG             3   Deregister Flag.  If one (1) then this name                        is in the process of being deleted.    ONT           1,2   Owner Node Type:                           00 = B node                           01 = P node                           10 = M node                           11 = Reserved for future use    G               0   Group Name Flag.                        If one (1) then the name is a GROUP NetBIOS                        name.                        If zero (0) then it is a UNIQUE NetBIOS name. 
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752. NetBIOS Working Group                                          [Page 28] 
  753.  RFC 1002                                                      March 1987 
  754.  
  755.     STATISTICS Field of the NODE STATUS RESPONSE: 
  756.  
  757.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |               UNIT_ID (Unique unit ID)                        |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |       UNIT_ID,continued       |    JUMPERS    |  TEST_RESULT  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |       VERSION_NUMBER          |      PERIOD_OF_STATISTICS     |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |       NUMBER_OF_CRCs          |     NUMBER_ALIGNMENT_ERRORS   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |       NUMBER_OF_COLLISIONS    |        NUMBER_SEND_ABORTS     |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                       NUMBER_GOOD_SENDS                       |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                      NUMBER_GOOD_RECEIVES                     |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |       NUMBER_RETRANSMITS      | NUMBER_NO_RESOURCE_CONDITIONS |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |  NUMBER_FREE_COMMAND_BLOCKS   |  TOTAL_NUMBER_COMMAND_BLOCKS  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |MAX_TOTAL_NUMBER_COMMAND_BLOCKS|    NUMBER_PENDING_SESSIONS    |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |  MAX_NUMBER_PENDING_SESSIONS  |  MAX_TOTAL_SESSIONS_POSSIBLE  |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |   SESSION_DATA_PACKET_SIZE    |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  758.  
  759. 4.3.  SESSION SERVICE PACKETS 
  760.  
  761. 4.3.1.  GENERAL FORMAT OF SESSION PACKETS 
  762.  
  763.    All session service messages are sent over a TCP connection. 
  764.  
  765.    All session packets are of the following general structure: 
  766.  
  767.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |      TYPE     |     FLAGS     |            LENGTH             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /               TRAILER (Packet Type Dependent)                 /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  768.  
  769.    The TYPE, FLAGS, and LENGTH fields are present in every session    packet. 
  770.  
  771.  
  772.  
  773.  NetBIOS Working Group                                          [Page 29] 
  774.  RFC 1002                                                      March 1987 
  775.  
  776.     The LENGTH field is the number of bytes following the LENGTH    field.  In other words, LENGTH is the combined size of the    TRAILER field(s).  For example, the POSITIVE SESSION RESPONSE    packet always has a LENGTH field value of zero (0000) while the    RETARGET SESSION RESPONSE always has a LENGTH field value of six    (0006). 
  777.  
  778.    One of the bits of the FLAGS field acts as an additional, high-    order bit for the LENGTH field.  Thus the cumulative size of the    trailer field(s) may range from 0 to 128K bytes. 
  779.  
  780.    Session Packet Types (in hexidecimal): 
  781.  
  782.            00 -  SESSION MESSAGE            81 -  SESSION REQUEST            82 -  POSITIVE SESSION RESPONSE            83 -  NEGATIVE SESSION RESPONSE            84 -  RETARGET SESSION RESPONSE            85 -  SESSION KEEP ALIVE 
  783.  
  784.    Bit definitions of the FLAGS field: 
  785.  
  786.      0   1   2   3   4   5   6   7    +---+---+---+---+---+---+---+---+    | 0 | 0 | 0 | 0 | 0 | 0 | 0 | E |    +---+---+---+---+---+---+---+---+ 
  787.  
  788.    Symbol     Bit(s)   Description 
  789.  
  790.    E               7   Length extension, used as an additional,                        high-order bit on the LENGTH field. 
  791.  
  792.    RESERVED      0-6   Reserved, must be zero (0) 
  793.  
  794. 4.3.2.  SESSION REQUEST PACKET 
  795.  
  796.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |      TYPE     |     FLAGS     |            LENGTH             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                          CALLED NAME                          /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                          CALLING NAME                         /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  797.  
  798.  
  799.  
  800.  
  801.  
  802. NetBIOS Working Group                                          [Page 30] 
  803.  RFC 1002                                                      March 1987 
  804.  
  805.  4.3.3.  POSITIVE SESSION RESPONSE PACKET 
  806.  
  807.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |      TYPE     |     FLAGS     |            LENGTH             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  808.  
  809. 4.3.4.  NEGATIVE SESSION RESPONSE PACKET 
  810.  
  811.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |      TYPE     |     FLAGS     |            LENGTH             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |   ERROR_CODE  |    +-+-+-+-+-+-+-+-+ 
  812.  
  813.    NEGATIVE SESSION RESPONSE packet error code values (in    hexidecimal): 
  814.  
  815.            80 -  Not listening on called name            81 -  Not listening for calling name            82 -  Called name not present            83 -  Called name present, but insufficient resources            8F -  Unspecified error 
  816.  
  817. 4.3.5.  SESSION RETARGET RESPONSE PACKET 
  818.  
  819.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |      TYPE     |     FLAGS     |            LENGTH             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                      RETARGET_IP_ADDRESS                      |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |           PORT                |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  NetBIOS Working Group                                          [Page 31] 
  836.  RFC 1002                                                      March 1987 
  837.  
  838.  4.3.6.  SESSION MESSAGE PACKET 
  839.  
  840.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |      TYPE     |     FLAGS     |            LENGTH             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                                                               /    /                           USER_DATA                           /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  841.  
  842. 4.3.7.  SESSION KEEP ALIVE PACKET 
  843.  
  844.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |      TYPE     |     FLAGS     |            LENGTH             |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  845.  
  846. 4.4.  DATAGRAM SERVICE PACKETS 
  847.  
  848. 4.4.1.  NetBIOS DATAGRAM HEADER 
  849.  
  850.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                           SOURCE_IP                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          SOURCE_PORT          |          DGM_LENGTH           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         PACKET_OFFSET         |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  851.  
  852.    MSG_TYPE values (in hexidecimal): 
  853.  
  854.            10 -  DIRECT_UNIQUE DATAGRAM            11 -  DIRECT_GROUP DATAGRAM            12 -  BROADCAST DATAGRAM            13 -  DATAGRAM ERROR            14 -  DATAGRAM QUERY REQUEST            15 -  DATAGRAM POSITIVE QUERY RESPONSE            16 -  DATAGRAM NEGATIVE QUERY RESPONSE 
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. NetBIOS Working Group                                          [Page 32] 
  863.  RFC 1002                                                      March 1987 
  864.  
  865.     Bit definitions of the FLAGS field: 
  866.  
  867.      0   1   2   3   4   5   6   7    +---+---+---+---+---+---+---+---+    | 0 | 0 | 0 | 0 |  SNT  | F | M |    +---+---+---+---+---+---+---+---+ 
  868.  
  869.    Symbol     Bit(s)   Description 
  870.  
  871.    M               7   MORE flag, If set then more NetBIOS datagram                        fragments follow. 
  872.  
  873.    F               6   FIRST packet flag,  If set then this is first                        (and possibly only) fragment of NetBIOS                        datagram 
  874.  
  875.    SNT           4,5   Source End-Node type:                           00 = B node                           01 = P node                           10 = M node                           11 = NBDD    RESERVED      0-3   Reserved, must be zero (0) 
  876.  
  877. 4.4.2.  DIRECT_UNIQUE, DIRECT_GROUP, & BROADCAST DATAGRAM 
  878.  
  879.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                           SOURCE_IP                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          SOURCE_PORT          |          DGM_LENGTH           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |         PACKET_OFFSET         |                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |    |                                                               |    /                          SOURCE_NAME                          /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                       DESTINATION_NAME                        /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                                                               |    /                           USER_DATA                           /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  880.  
  881.  
  882.  
  883. NetBIOS Working Group                                          [Page 33] 
  884.  RFC 1002                                                      March 1987 
  885.  
  886.     4.4.3.  DATAGRAM ERROR PACKET 
  887.  
  888.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                           SOURCE_IP                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          SOURCE_PORT          |  ERROR_CODE   |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  889.  
  890.    ERROR_CODE values (in hexidecimal): 
  891.  
  892.            82 -  DESTINATION NAME NOT PRESENT            83 -  INVALID SOURCE NAME FORMAT            84 -  INVALID DESTINATION NAME FORMAT 
  893.  
  894. 4.4.4.  DATAGRAM QUERY REQUEST 
  895.  
  896.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                           SOURCE_IP                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          SOURCE_PORT          |                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +    |                                                               |    /                       DESTINATION_NAME                        /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  897.  
  898. 4.4.5.  DATAGRAM POSITIVE AND NEGATIVE QUERY RESPONSE 
  899.  
  900.                         1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |   MSG_TYPE    |     FLAGS     |           DGM_ID              |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |                           SOURCE_IP                           |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+    |          SOURCE_PORT          |                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +    |                                                               |    /                       DESTINATION_NAME                        /    /                                                               /    |                                                               |    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
  901.  
  902.  
  903.  
  904. NetBIOS Working Group                                          [Page 34] 
  905.  RFC 1002                                                      March 1987 
  906.  
  907.  5.  PROTOCOL DESCRIPTIONS 
  908.  
  909. 5.1.  NAME SERVICE PROTOCOLS 
  910.  
  911.    A REQUEST packet is always sent to the well known UDP port -    NAME_SERVICE_UDP_PORT.  The destination address is normally    either the IP broadcast address or the address of the NBNS - the    address of the NBNS server it set up at initialization time.  In    rare cases, a request packet will be sent to an end node, e.g.  a    NAME QUERY REQUEST sent to "challenge" a node. 
  912.  
  913.    A RESPONSE packet is always sent to the source UDP port and    source IP address of the request packet. 
  914.  
  915.    A DEMAND packet must always be sent to the well known UDP port -    NAME_SERVICE_UDP_PORT.  There is no restriction on the target IP    address. 
  916.  
  917.    Terms used in this section: 
  918.  
  919.    tid -            Transaction ID.  This is a value composed from                     the requestor's IP address and a unique 16 bit                     value generated by the originator of the                     transaction. 
  920.  
  921. 5.1.1.  B-NODE ACTIVITY 
  922.  
  923. 5.1.1.1.  B-NODE ADD NAME 
  924.  
  925.    PROCEDURE add_name(newname) 
  926.  
  927.    /*     * Host initiated processing for a B node     */    BEGIN 
  928.  
  929.         REPEAT 
  930.  
  931.              /* build name service packet */ 
  932.  
  933.              ONT = B_NODE; /* broadcast node */              G = UNIQUE;   /* unique name */              TTL = 0; 
  934.  
  935.              broadcast NAME REGISTRATION REQUEST packet; 
  936.  
  937.              /*               * remote node(s) will send response packet               * if applicable               */ 
  938.  
  939.  
  940.  
  941.  NetBIOS Working Group                                          [Page 35] 
  942.  RFC 1002                                                      March 1987 
  943.  
  944.               pause(BCAST_REQ_RETRY_TIMEOUT); 
  945.  
  946.         UNTIL response packet is received or              retransmit count has been exceeded 
  947.  
  948.         IF no response packet was received THEN         BEGIN /* no response */              /*               * build packet               */ 
  949.  
  950.              ONT = B_NODE; /* broadcast node */              G = UNIQUE;   /* unique name */              TTL = 0; 
  951.  
  952.              /*               * Let other nodes known you have the name               */ 
  953.  
  954.              broadcast NAME UPDATE REQUEST packet;              /* name can be added to local name table */              return success;         END /* no response */         ELSE         BEGIN /* got response */ 
  955.  
  956.              /*               * Match return transaction id               * against tid sent in request               */ 
  957.  
  958.             IF NOT response tid = request tid THEN             BEGIN              ignore response packet;             END             ELSE             CASE packet type OF 
  959.  
  960.             NEGATIVE NAME REGISTRATION RESPONSE: 
  961.  
  962.                  return failure; /* name cannot be added */ 
  963.  
  964.             POSITIVE NAME REGISTRATION RESPONSE:             END-NODE CHALLENGE NAME REGISTRATION RESPONSE: 
  965.  
  966.                  /*                   * B nodes should normally not get this                   * response.                   */ 
  967.  
  968.                   ignore packet; 
  969.  
  970.  
  971.  
  972. NetBIOS Working Group                                          [Page 36] 
  973.  RFC 1002                                                      March 1987 
  974.  
  975.              END /* case */;         END /* got response */    END /* procedure */ 
  976.  
  977. 5.1.1.2.  B-NODE ADD_GROUP NAME 
  978.  
  979.    PROCEDURE add_group_name(newname) 
  980.  
  981.    /*     * Host initiated processing for a B node     */ 
  982.  
  983.    BEGIN         /*          * same as for a unique name with the          * exception that the group bit (G) must          * be set in the request packets.          */ 
  984.  
  985.         ...         G = GROUP;         ...         ... 
  986.  
  987.         /*          * broadcast request ...          */ 
  988.  
  989.     END 
  990.  
  991. 5.1.1.3.  B-NODE FIND_NAME 
  992.  
  993.    PROCEDURE find_name(name) 
  994.  
  995.    /*     * Host initiated processing for a B node     */ 
  996.  
  997.    BEGIN 
  998.  
  999.         REPEAT              /*               * build packet               */              ONT = B;              TTL = 0;              G = DONT CARE; 
  1000.  
  1001.              broadcast NAME QUERY REQUEST packet; 
  1002.  
  1003.   
  1004.  
  1005. NetBIOS Working Group                                          [Page 37] 
  1006.  RFC 1002                                                      March 1987 
  1007.  
  1008.               /*               * a node might send response packet               */ 
  1009.  
  1010.              pause(BCAST_REQ_RETRY_TIMEOUT);         UNTIL response packet received OR              max transmit threshold exceeded 
  1011.  
  1012.         IF no response packet received THEN              return failure;         ELSE         IF NOT response tid = request tid THEN              ignore packet;         ELSE         CASE packet type OF         POSITIVE NAME QUERY RESPONSE:              /*               * Start a timer to detect conflict.               *               * Be prepared to detect conflict if               * any more response packets are received.               *               */ 
  1013.  
  1014.              save response as authoritative response;              start_timer(CONFLICT_TIMER);              return success; 
  1015.  
  1016.         NEGATIVE NAME QUERY RESPONSE:         REDIRECT NAME QUERY RESPONSE: 
  1017.  
  1018.              /*               * B Node should normally not get either               * response.               */ 
  1019.  
  1020.               ignore response packet; 
  1021.  
  1022.         END /* case */    END /* procedure */ 
  1023.  
  1024. 5.1.1.4.  B NODE NAME RELEASE 
  1025.  
  1026.    PROCEDURE delete_name (name)    BEGIN 
  1027.  
  1028.         REPEAT 
  1029.  
  1030.              /*               * build packet               */ 
  1031.  
  1032.  
  1033.  
  1034. NetBIOS Working Group                                          [Page 38] 
  1035.  RFC 1002                                                      March 1987 
  1036.  
  1037.               ... 
  1038.  
  1039.              /*               * send request               */ 
  1040.  
  1041.              broadcast NAME RELEASE REQUEST packet; 
  1042.  
  1043.              /*               * no response packet expected               */ 
  1044.  
  1045.              pause(BCAST_REQ_RETRY_TIMEOUT); 
  1046.  
  1047.         UNTIL retransmit count has been exceeded    END /* procedure */ 
  1048.  
  1049. 5.1.1.5.  B-NODE INCOMING PACKET PROCESSING 
  1050.  
  1051.    Following processing is done when broadcast or unicast packets    are received at the NAME_SERVICE_UDP_PORT. 
  1052.  
  1053.    PROCEDURE process_incoming_packet(packet) 
  1054.  
  1055.    /*     * Processing initiated by incoming packets for a B node     */ 
  1056.  
  1057.    BEGIN         /*          * Note: response packets are always sent          * to:          * source IP address of request packet          * source UDP port of request packet          */ 
  1058.  
  1059.         CASE packet type OF 
  1060.  
  1061.         NAME REGISTRATION REQUEST (UNIQUE):              IF name exists in local name table THEN                   send NEGATIVE NAME REGISTRATION RESPONSE ;         NAME REGISTRATION REQUEST (GROUP):              IF name exists in local name table THEN              BEGIN                   IF local entry is a unique name THEN                       send NEGATIVE NAME REGISTRATION RESPONSE ;              END         NAME QUERY REQUEST:              IF name exists in local name table THEN              BEGIN                   build response packet; 
  1062.  
  1063.  
  1064.  
  1065. NetBIOS Working Group                                          [Page 39] 
  1066.  RFC 1002                                                      March 1987 
  1067.  
  1068.                    send POSITIVE NAME QUERY RESPONSE;         POSITIVE NAME QUERY RESPONSE:              IF name conflict timer is not active THEN              BEGIN                   /*                    * timer has expired already...  ignore this                    * packet                    */ 
  1069.  
  1070.                   return;              END              ELSE /* timer is active */              IF a response for this name has previously been                   received THEN              BEGIN /* existing entry */ 
  1071.  
  1072.                   /*                    * we sent out a request packet, and                    * have already received (at least)                    * one response                    *                    * Check if conflict exists.                    * If so, send out a conflict packet.                    *                    * Note: detecting conflict does NOT                    * affect any existing sessions.                    *                    */ 
  1073.  
  1074.                   /*                    * Check for name conflict.                    * See "Name Conflict" in Concepts and Methods                    */                   check saved authoritative response against                        information in this response packet;                   IF conflict detected THEN                   BEGIN                        unicast NAME CONFLICT DEMAND packet;                        IF entry exists in cache THEN                        BEGIN                             remove entry from cache;                        END                   END              END /* existing entry */              ELSE              BEGIN                   /*                    * Note: If this was the first response                    * to a name query, it would have been                    * handled in the                    * find_name() procedure. 
  1075.  
  1076.  
  1077.  
  1078. NetBIOS Working Group                                          [Page 40] 
  1079.  RFC 1002                                                      March 1987 
  1080.  
  1081.                     */ 
  1082.  
  1083.                   ignore packet;              END         NAME CONFLICT DEMAND:              IF name exists in local name table THEN              BEGIN                   mark name as conflict detected; 
  1084.  
  1085.                   /*                    * a name in the state "conflict detected"                    * does not "logically" exist on that node.                    * No further session will be accepted on                    * that name.                    * No datagrams can be sent against that name.                    * Such an entry will not be used for                    * purposes of processing incoming request                    * packets.                    * The only valid user NetBIOS operation                    * against such a name is DELETE NAME.                    */              END         NAME RELEASE REQUEST:              IF caching is being done THEN              BEGIN                   remove entry from cache;              END         NAME UPDATE REQUEST:              IF caching is being done THEN              BEGIN                   IF entry exists in cache already,                        update cache;                   ELSE IF name is "interesting" THEN                   BEGIN                        add entry to cache;                   END              END 
  1086.  
  1087.         NODE STATUS REQUEST:              IF name exists in local name table THEN              BEGIN                   /*                    * send only those names that are                    * in the same scope as the scope                    * field in the request packet                    */ 
  1088.  
  1089.                   send NODE STATUS RESPONSE;              END    END 
  1090.  
  1091.  
  1092.  
  1093.  NetBIOS Working Group                                          [Page 41] 
  1094.  RFC 1002                                                      March 1987 
  1095.  
  1096.  5.1.2.  P-NODE ACTIVITY 
  1097.  
  1098.    All packets sent or received by P nodes are unicast UDP packets.    A P node sends name service requests to the NBNS node that is    specified in the P-node configuration. 
  1099.  
  1100. 5.1.2.1.  P-NODE ADD_NAME 
  1101.  
  1102.    PROCEDURE add_name(newname) 
  1103.  
  1104.    /*     * Host initiated processing for a P node     */ 
  1105.  
  1106.    BEGIN 
  1107.  
  1108.         REPEAT              /*               * build packet               */ 
  1109.  
  1110.              ONT = P;              G = UNIQUE;              ... 
  1111.  
  1112.              /*               * send request               */ 
  1113.  
  1114.              unicast NAME REGISTRATION REQUEST packet; 
  1115.  
  1116.              /*               * NBNS will send response packet               */ 
  1117.  
  1118.              IF receive a WACK RESPONSE THEN                   pause(time from TTL field of response);              ELSE                   pause(UCAST_REQ_RETRY_TIMEOUT);         UNTIL response packet is received OR              retransmit count has been exceeded 
  1119.  
  1120.         IF no response packet was received THEN         BEGIN /* no response */              /*               * NBNS is down.  Cannot claim name.               */ 
  1121.  
  1122.              return failure; /* name cannot be claimed */         END /* no response */         ELSE 
  1123.  
  1124.  
  1125.  
  1126. NetBIOS Working Group                                          [Page 42] 
  1127.  RFC 1002                                                      March 1987 
  1128.  
  1129.          BEGIN /* response */             IF NOT response tid = request tid THEN             BEGIN              /*  Packet may belong to another transaction  */              ignore response packet;             END             ELSE             CASE packet type OF 
  1130.  
  1131.             POSITIVE NAME REGISTRATION RESPONSE: 
  1132.  
  1133.                  /*                   * name can be added                   */ 
  1134.  
  1135.                  adjust refresh timeout value, TTL, for this name;                  return success;      /* name can be added */ 
  1136.  
  1137.             NEGATIVE NAME REGISTRATION RESPONSE:                  return failure; /* name cannot be added */ 
  1138.  
  1139.             END-NODE CHALLENGE REGISTRATION REQUEST:             BEGIN /* end node challenge */ 
  1140.  
  1141.                  /*                   * The response packet has in it the                   * address of the presumed owner of the                   * name.  Challenge that owner.                   * If owner either does not                   * respond or indicates that he no longer                   * owns the name, claim the name.                   * Otherwise, the name cannot be claimed.                   *                   */ 
  1142.  
  1143.                  REPEAT                   /*                    * build packet                    */                   ... 
  1144.  
  1145.                   unicast NAME QUERY REQUEST packet to the                        address contained in the END NODE                        CHALLENGE RESPONSE packet; 
  1146.  
  1147.                   /*                    * remote node may send response packet                    */ 
  1148.  
  1149.                   pause(UCAST_REQ_RETRY_TIMEOUT); 
  1150.  
  1151.  
  1152.  
  1153.  NetBIOS Working Group                                          [Page 43] 
  1154.  RFC 1002                                                      March 1987 
  1155.  
  1156.                   UNTIL response packet is received or                      retransmit count has been exceeded                  IF no response packet is received OR                        NEGATIVE NAME QUERY RESPONSE packet                        received THEN                  BEGIN /* update */ 
  1157.  
  1158.                   /*                    * name can be claimed                    */ 
  1159.  
  1160.                   REPEAT 
  1161.  
  1162.                       /*                        * build packet                        */                        ... 
  1163.  
  1164.                       unicast NAME UPDATE REQUEST to NBNS; 
  1165.  
  1166.                       /*                        * NBNS node will send response packet                        */ 
  1167.  
  1168.                       IF receive a WACK RESPONSE THEN                             pause(time from TTL field of response);                       ELSE                             pause(UCAST_REQ_RETRY_TIMEOUT);                   UNTIL response packet is received or                       retransmit count has been exceeded                   IF no response packet received THEN                   BEGIN /* no response */ 
  1169.  
  1170.                        /*                         * name could not be claimed                         */ 
  1171.  
  1172.                        return failure;                   END /* no response */                   ELSE                   CASE packet type OF                        POSITIVE NAME REGISTRATION RESPONSE:                             /*                              * add name                              */                             return success;                        NEGATIVE NAME REGISTRATION RESPONSE: 
  1173.  
  1174.                             /*                              * you lose  ...                              */ 
  1175.  
  1176.  
  1177.  
  1178. NetBIOS Working Group                                          [Page 44] 
  1179.  RFC 1002                                                      March 1987 
  1180.  
  1181.                              return failure;                        END /* case */                  END /* update */                  ELSE 
  1182.  
  1183.                  /*                   * received a positive response to the "challenge"                   * Remote node still has name                   */ 
  1184.  
  1185.                   return failure;             END /* end node challenge */         END /* response */    END /* procedure */ 
  1186.  
  1187. 5.1.2.2.  P-NODE ADD GROUP NAME 
  1188.  
  1189.    PROCEDURE add_group_name(newname) 
  1190.  
  1191.    /*     * Host initiated processing for a P node     */ 
  1192.  
  1193.    BEGIN         /*          * same as for a unique name, except that the          * request packet must indicate that a          * group name claim is being made.          */ 
  1194.  
  1195.         ...         G = GROUP;         ... 
  1196.  
  1197.         /*          * send packet          */          ... 
  1198.  
  1199.     END 
  1200.  
  1201.    5.1.2.3.  P-NODE FIND NAME 
  1202.  
  1203.    PROCEDURE find_name(name) 
  1204.  
  1205.    /*     * Host initiated processing for a P node     */ 
  1206.  
  1207.    BEGIN 
  1208.  
  1209.  
  1210.  
  1211. NetBIOS Working Group                                          [Page 45] 
  1212.  RFC 1002                                                      March 1987 
  1213.  
  1214.          REPEAT              /*               * build packet               */ 
  1215.  
  1216.              ONT = P;              G = DONT CARE; 
  1217.  
  1218.              unicast NAME QUERY REQUEST packet; 
  1219.  
  1220.              /*               * a NBNS node might send response packet               */ 
  1221.  
  1222.              IF receive a WACK RESPONSE THEN                   pause(time from TTL field of response);              ELSE                   pause(UCAST_REQ_RETRY_TIMEOUT);         UNTIL response packet received OR              max transmit threshold exceeded 
  1223.  
  1224.         IF no response packet received THEN              return failure;         ELSE         IF NOT response tid = request tid THEN              ignore packet;         ELSE         CASE packet type OF         POSITIVE NAME QUERY RESPONSE:              return success; 
  1225.  
  1226.         REDIRECT NAME QUERY RESPONSE: 
  1227.  
  1228.              /*               * NBNS node wants this end node               * to use some other NBNS node               * to resolve the query.               */ 
  1229.  
  1230.               repeat query with NBNS address                   in the response packet;         NEGATIVE NAME QUERY RESPONSE:              return failure; 
  1231.  
  1232.         END /* case */    END /* procedure */ 
  1233.  
  1234. 5.1.2.4.  P-NODE DELETE_NAME 
  1235.  
  1236.    PROCEDURE delete_name (name) 
  1237.  
  1238.  
  1239.  
  1240.  NetBIOS Working Group                                          [Page 46] 
  1241.  RFC 1002                                                      March 1987 
  1242.  
  1243.     /*     * Host initiated processing for a P node     */ 
  1244.  
  1245.    BEGIN 
  1246.  
  1247.         REPEAT 
  1248.  
  1249.              /*               * build packet               */              ... 
  1250.  
  1251.              /*               * send request               */ 
  1252.  
  1253.              unicast NAME RELEASE REQUEST packet;              IF receive a WACK RESPONSE THEN                   pause(time from TTL field of response);              ELSE                   pause(UCAST_REQ_RETRY_TIMEOUT);         UNTIL retransmit count has been exceeded              or response been received 
  1254.  
  1255.         IF response has been received THEN         CASE packet type OF         POSITIVE NAME RELEASE RESPONSE:              return success;         NEGATIVE NAME RELEASE RESPONSE: 
  1256.  
  1257.              /*               * NBNS does want node to delete this               * name !!!               */ 
  1258.  
  1259.              return failure;         END /* case */    END /* procedure */ 
  1260.  
  1261. 5.1.2.5.  P-NODE INCOMING PACKET PROCESSING 
  1262.  
  1263.    Processing initiated by reception of packets at a P node 
  1264.  
  1265.    PROCEDURE process_incoming_packet(packet) 
  1266.  
  1267.    /*     * Processing initiated by incoming packets at a P node     */ 
  1268.  
  1269.    BEGIN 
  1270.  
  1271.  
  1272.  
  1273. NetBIOS Working Group                                          [Page 47] 
  1274.  RFC 1002                                                      March 1987 
  1275.  
  1276.          /*          * always ignore UDP broadcast packets          */ 
  1277.  
  1278.         IF packet was sent as a broadcast THEN         BEGIN              ignore packet;              return;         END         CASE packet type of 
  1279.  
  1280.         NAME CONFLICT DEMAND:              IF name exists in local name table THEN                   mark name as in conflict;              return; 
  1281.  
  1282.         NAME QUERY REQUEST:              IF name exists in local name table THEN              BEGIN /* name exists */ 
  1283.  
  1284.                   /*                    * build packet                    */                   ... 
  1285.  
  1286.                   /*                    * send response to the IP address and port                    * number from which the request was received.                    */ 
  1287.  
  1288.                   send POSITIVE NAME QUERY RESPONSE ;                   return;              END /* exists */              ELSE              BEGIN /* does not exist */ 
  1289.  
  1290.                   /*                    * send response to the requestor                    */ 
  1291.  
  1292.                   send NEGATIVE NAME QUERY RESPONSE ;                   return;              END /* does not exist */         NODE STATUS REQUEST:              /*               * Name of "*" may be used for force node to               * divulge status for administrative purposes               */              IF name in local name table OR name = "*" THEN              BEGIN                   /* 
  1293.  
  1294.  
  1295.  
  1296. NetBIOS Working Group                                          [Page 48] 
  1297.  RFC 1002                                                      March 1987 
  1298.  
  1299.                     * Build response packet and                    * send to requestor node                    * Send only those names that are                    * in the same scope as the scope                    * in the request packet.                    */ 
  1300.  
  1301.                   send NODE STATUS RESPONSE;              END 
  1302.  
  1303.         NAME RELEASE REQUEST:              /*               * This will be received if the NBNS wants to flush the               * name from the local name table, or from the local               * cache.               */ 
  1304.  
  1305.              IF name exists in the local name table THEN              BEGIN                   delete name from local name table;                   inform user that name has been deleted;              END              ELSE                   IF name has been cached locally THEN                   BEGIN                        remove entry from cache:                   END 
  1306.  
  1307.         END /* case */    END /* procedure */ 
  1308.  
  1309. 5.1.2.6.  P-NODE TIMER INITIATED PROCESSING 
  1310.  
  1311.    Processing initiated by timer expiration. 
  1312.  
  1313.    PROCEDURE timer_expired()    /*     * Processing initiated by the expiration of a timer on a P node     */    BEGIN         /*          * Send a NAME REFRESH REQUEST for each name which the          * TTL which has expired.          */         REPEAT              build NAME REFRESH REQUEST packet;              REPEAT                   send packet to NBNS; 
  1314.  
  1315.                   IF receive a WACK RESPONSE THEN                        pause(time from TTL field of response); 
  1316.  
  1317.  
  1318.  
  1319. NetBIOS Working Group                                          [Page 49] 
  1320.  RFC 1002                                                      March 1987 
  1321.  
  1322.                    ELSE                        pause(UCAST_REQ_RETRY_TIMEOUT);              UNTIL response packet is received or                   retransmit count has been exceeded 
  1323.  
  1324.              CASE packet type OF                POSITIVE NAME REGISTRATION RESPONSE:                   /* successfully refreshed */                   reset TTL timer for this name; 
  1325.  
  1326.                NEGATIVE NAME REGISTRATION RESPONSE:                   /*                    * refused, can't keep name                    * assume in conflict                    */                   mark name as in conflict;              END /* case */ 
  1327.  
  1328.         UNTIL request sent for all names for which TTL              has expired    END /* procedure */ 
  1329.  
  1330. 5.1.3.  M-NODE ACTIVITY 
  1331.  
  1332.    M nodes behavior is similar to that of P nodes with the addition    of some B node-like broadcast actions.  M node name service    proceeds in two steps: 
  1333.  
  1334.    1.Use broadcast UDP based name service.  Depending on the      operation, goto step 2. 
  1335.  
  1336.    2.Use directed UDP name service. 
  1337.  
  1338.    The following code for M nodes is exactly the same as for a P    node, with the exception that broadcast operations are done    before P type operation is attempted. 
  1339.  
  1340.    5.1.3.1.  M-NODE ADD NAME 
  1341.  
  1342.    PROCEDURE add_name(newname) 
  1343.  
  1344.    /*     * Host initiated processing for a M node     */ 
  1345.  
  1346.    BEGIN 
  1347.  
  1348.         /*          * check if name exists on the          * broadcast area          */ 
  1349.  
  1350.  
  1351.  
  1352. NetBIOS Working Group                                          [Page 50] 
  1353.  RFC 1002                                                      March 1987 
  1354.  
  1355.          REPEAT             /* build packet */ 
  1356.  
  1357.             ....             broadcast NAME REGISTRATION REQUEST packet;             pause(BCAST_REQ_RETRY_TIMEOUT); 
  1358.  
  1359.         UNTIL response packet is received or              retransmit count has been  exceeded 
  1360.  
  1361.         IF valid response received THEN         BEGIN              /* cannot claim name */ 
  1362.  
  1363.              return failure;         END 
  1364.  
  1365.         /*          * No objections received within the          * broadcast area.          * Send request to name server.          */ 
  1366.  
  1367.         REPEAT              /*               * build packet               */ 
  1368.  
  1369.              ONT = M;              ... 
  1370.  
  1371.              unicast NAME REGISTRATION REQUEST packet; 
  1372.  
  1373.              /*               * remote NBNS will send response packet               */ 
  1374.  
  1375.              IF receive a WACK RESPONSE THEN                   pause(time from TTL field of response);              ELSE                   pause(UCAST_REQ_RETRY_TIMEOUT); 
  1376.  
  1377.         UNTIL response packet is received or              retransmit count has been exceeded 
  1378.  
  1379.         IF no response packet was received THEN         BEGIN /* no response */              /*               * NBNS is down.  Cannot claim name.               */ 
  1380.  
  1381.  
  1382.  
  1383.  NetBIOS Working Group                                          [Page 51] 
  1384.  RFC 1002                                                      March 1987 
  1385.  
  1386.               return failure; /* name cannot be claimed */         END /* no response */         ELSE         BEGIN /* response */             IF NOT response tid = request tid THEN             BEGIN              ignore response packet;             END             ELSE             CASE packet type OF             POSITIVE NAME REGISTRATION RESPONSE: 
  1387.  
  1388.                  /*                   * name can be added                   */ 
  1389.  
  1390.                  adjust refresh timeout value, TTL;                  return success;      /* name can be added */ 
  1391.  
  1392.             NEGATIVE NAME REGISTRATION RESPONSE:                  return failure; /* name cannot be added */ 
  1393.  
  1394.             END-NODE CHALLENGE REGISTRATION REQUEST:             BEGIN /* end node challenge */ 
  1395.  
  1396.                  /*                   * The response packet has in it the                   * address of the presumed owner of the                   * name.  Challenge that owner.                   * If owner either does not                   * respond or indicates that he no longer                   * owns the name, claim the name.                   * Otherwise, the name cannot be claimed.                   *                   */ 
  1397.  
  1398.                  REPEAT                   /*                    * build packet                    */                   ... 
  1399.  
  1400.                   /*                    * send packet to address contained in the                    * response packet                    */ 
  1401.  
  1402.                   unicast NAME QUERY REQUEST packet; 
  1403.  
  1404.                   /*                    * remote node may send response packet 
  1405.  
  1406.  
  1407.  
  1408. NetBIOS Working Group                                          [Page 52] 
  1409.  RFC 1002                                                      March 1987 
  1410.  
  1411.                     */ 
  1412.  
  1413.                   pause(UCAST_REQ_RETRY_TIMEOUT); 
  1414.  
  1415.                  UNTIL response packet is received or                      retransmit count has been exceeded                  IF no response packet is received THEN                  BEGIN /* no response */ 
  1416.  
  1417.                   /*                    * name can be claimed                    */                   REPEAT 
  1418.  
  1419.                       /*                        * build packet                        */                        ... 
  1420.  
  1421.                       unicast NAME UPDATE REQUEST to NBNS; 
  1422.  
  1423.                       /*                        * NBNS node will send response packet                        */ 
  1424.  
  1425.                       IF receive a WACK RESPONSE THEN                             pause(time from TTL field of response);                   ELSE                        pause(UCAST_REQ_RETRY_TIMEOUT); 
  1426.  
  1427.                   UNTIL response packet is received or                       retransmit count has been exceeded                   IF no response packet received THEN                   BEGIN /* no response */ 
  1428.  
  1429.                        /*                         * name could not be claimed                         */ 
  1430.  
  1431.                        return failure;                   END /* no response */                   ELSE                   CASE packet type OF                   POSITIVE NAME REGISTRATION RESPONSE:                        /*                         * add name                         */ 
  1432.  
  1433.                        return success;                   NEGATIVE NAME REGISTRATION RESPONSE: 
  1434.  
  1435.  
  1436.  
  1437.  NetBIOS Working Group                                          [Page 53] 
  1438.  RFC 1002                                                      March 1987 
  1439.  
  1440.                         /*                         * you lose  ...                         */ 
  1441.  
  1442.                        return failure;                   END /* case */                  END /* no response */                  ELSE                  IF NOT response tid = request tid THEN                  BEGIN                   ignore response packet;                  END 
  1443.  
  1444.                  /*                   * received a response to the "challenge"                   * packet                   */ 
  1445.  
  1446.                  CASE packet type OF                  POSITIVE NAME QUERY: 
  1447.  
  1448.                   /*                    * remote node still has name.                    */ 
  1449.  
  1450.                   return failure;                  NEGATIVE NAME QUERY: 
  1451.  
  1452.                   /*                    * remote node no longer has name                    */ 
  1453.  
  1454.                   return success;                  END /* case */             END /* end node challenge */             END /* case */         END /* response */    END /* procedure */ 
  1455.  
  1456. 5.1.3.2.  M-NODE ADD GROUP NAME 
  1457.  
  1458.    PROCEDURE add_group_name(newname) 
  1459.  
  1460.    /*     * Host initiated processing for a P node     */ 
  1461.  
  1462.    BEGIN         /*          * same as for a unique name, except that the          * request packet must indicate that a 
  1463.  
  1464.  
  1465.  
  1466. NetBIOS Working Group                                          [Page 54] 
  1467.  RFC 1002                                                      March 1987 
  1468.  
  1469.           * group name claim is being made.          */ 
  1470.  
  1471.         ...         G = GROUP;         ... 
  1472.  
  1473.         /*          * send packet          */          ... 
  1474.  
  1475.     END 
  1476.  
  1477. 5.1.3.3.  M-NODE FIND NAME 
  1478.  
  1479.    PROCEDURE find_name(name) 
  1480.  
  1481.    /*     * Host initiated processing for a M node     */ 
  1482.  
  1483.    BEGIN         /*          * check if any node on the broadcast          * area has the name          */ 
  1484.  
  1485.         REPEAT              /* build packet */              ... 
  1486.  
  1487.              broadcast NAME QUERY REQUEST packet;              pause(BCAST_REQ_RETRY_TIMEOUT);         UNTIL response packet received OR              max transmit threshold exceeded 
  1488.  
  1489.         IF valid response received THEN         BEGIN              save response as authoritative response;              start_timer(CONFLICT_TIMER);              return success;         END 
  1490.  
  1491.         /*          * no valid response on the b'cast segment.          * Try the name server.          */ 
  1492.  
  1493.         REPEAT 
  1494.  
  1495.  
  1496.  
  1497. NetBIOS Working Group                                          [Page 55] 
  1498.  RFC 1002                                                      March 1987 
  1499.  
  1500.               /*               * build packet               */ 
  1501.  
  1502.              ONT = M;              G = DONT CARE; 
  1503.  
  1504.              unicast NAME QUERY REQUEST packet to NBNS; 
  1505.  
  1506.              /*               * a NBNS node might send response packet               */ 
  1507.  
  1508.              IF receive a WACK RESPONSE THEN                   pause(time from TTL field of response);              ELSE                   pause(UCAST_REQ_RETRY_TIMEOUT);         UNTIL response packet received OR              max transmit threshold exceeded 
  1509.  
  1510.         IF no response packet received THEN              return failure;         ELSE         IF NOT response tid = request tid THEN              ignore packet;         ELSE         CASE packet type OF         POSITIVE NAME QUERY RESPONSE:              return success; 
  1511.  
  1512.         REDIRECT NAME QUERY RESPONSE: 
  1513.  
  1514.              /*               * NBNS node wants this end node               * to use some other NBNS node               * to resolve the query.               */ 
  1515.  
  1516.               repeat query with NBNS address                   in the response packet;         NEGATIVE NAME QUERY RESPONSE:              return failure; 
  1517.  
  1518.         END /* case */    END /* procedure */ 
  1519.  
  1520. 5.1.3.4.  M-NODE DELETE NAME 
  1521.  
  1522.    PROCEDURE delete_name (name) 
  1523.  
  1524.    /* 
  1525.  
  1526.  
  1527.  
  1528. NetBIOS Working Group                                          [Page 56] 
  1529.  RFC 1002                                                      March 1987 
  1530.  
  1531.      * Host initiated processing for a P node     */ 
  1532.  
  1533.    BEGIN         /*          * First, delete name on NBNS          */ 
  1534.  
  1535.         REPEAT 
  1536.  
  1537.              /*               * build packet               */              ... 
  1538.  
  1539.              /*               * send request               */ 
  1540.  
  1541.              unicast NAME RELEASE REQUEST packet to NBNS; 
  1542.  
  1543.              IF receive a WACK RESPONSE THEN                   pause(time from TTL field of response);              ELSE                   pause(UCAST_REQ_RETRY_TIMEOUT);         UNTIL retransmit count has been exceeded              or response been received 
  1544.  
  1545.         IF response has been received THEN         CASE packet type OF         POSITIVE NAME RELEASE RESPONSE:              /*               * Deletion of name on b'cast segment is deferred               * until after NBNS has deleted the name               */ 
  1546.  
  1547.              REPEAT                   /* build packet */ 
  1548.  
  1549.                   ...                   broadcast NAME RELEASE REQUEST;                   pause(BCAST_REQ_RETRY_TIMEOUT);              UNTIL rexmt threshold exceeded 
  1550.  
  1551.              return success;         NEGATIVE NAME RELEASE RESPONSE: 
  1552.  
  1553.              /*               * NBNS does want node to delete this               * name               */ 
  1554.  
  1555.  
  1556.  
  1557. NetBIOS Working Group                                          [Page 57] 
  1558.  RFC 1002                                                      March 1987 
  1559.  
  1560.               return failure;         END /* case */    END /* procedure */ 
  1561.  
  1562. 5.1.3.5.  M-NODE INCOMING PACKET PROCESSING 
  1563.  
  1564.    Processing initiated by reception of packets at a M node 
  1565.  
  1566.    PROCEDURE process_incoming_packet(packet) 
  1567.  
  1568.    /*     * Processing initiated by incoming packets at a M node     */ 
  1569.  
  1570.    BEGIN         CASE packet type of 
  1571.  
  1572.         NAME CONFLICT DEMAND:              IF name exists in local name table THEN                   mark name as in conflict;              return; 
  1573.  
  1574.         NAME QUERY REQUEST:              IF name exists in local name table THEN              BEGIN /* name exists */ 
  1575.  
  1576.                   /*                    * build packet                    */                   ... 
  1577.  
  1578.                   /*                    * send response to the IP address and port                    * number from which the request was received.                    */ 
  1579.  
  1580.                   send POSITIVE NAME QUERY RESPONSE ;                   return;              END /* exists */              ELSE              BEGIN /* does not exist */ 
  1581.  
  1582.                   /*                    * send response to the requestor                    */ 
  1583.  
  1584.                   IF request NOT broadcast THEN                        /*                         * Don't send negative responses to                         * queries sent by B nodes                         */ 
  1585.  
  1586.  
  1587.  
  1588. NetBIOS Working Group                                          [Page 58] 
  1589.  RFC 1002                                                      March 1987 
  1590.  
  1591.                         send NEGATIVE NAME QUERY RESPONSE ;                   return;              END /* does not exist */         NODE STATUS REQUEST:              BEGIN              /*               * Name of "*" may be used for force node to               * divulge status for administrative purposes               */              IF name in local name table OR name = "*" THEN                   /*                    * Build response packet and                    * send to requestor node                    * Send only those names that are                    * in the same scope as the scope                    * in the request packet.                    */ 
  1592.  
  1593.                   send NODE STATUS RESPONSE;              END 
  1594.  
  1595.         NAME RELEASE REQUEST:              /*               * This will be received if the NBNS wants to flush the               * name from the local name table, or from the local               * cache.               */ 
  1596.  
  1597.              IF name exists in the local name table THEN              BEGIN                   delete name from local name table;                   inform user that name has been deleted;              END              ELSE                   IF name has been cached locally THEN                   BEGIN                        remove entry from cache:                   END 
  1598.  
  1599.         NAME REGISTRATION REQUEST (UNIQUE):              IF name exists in local name table THEN                   send NEGATIVE NAME REGISTRATION RESPONSE ;         NAME REGISTRATION REQUEST (GROUP):              IF name exists in local name table THEN              BEGIN                   IF local entry is a unique name THEN                       send NEGATIVE NAME REGISTRATION RESPONSE ;              END         END /* case */    END /* procedure */ 
  1600.  
  1601.  
  1602.  
  1603.  NetBIOS Working Group                                          [Page 59] 
  1604.  RFC 1002                                                      March 1987 
  1605.  
  1606.  5.1.3.6.  M-NODE TIMER INITIATED PROCESSING 
  1607.  
  1608.    Processing initiated by timer expiration: 
  1609.  
  1610.    PROCEDURE timer_expired()    /*     * Processing initiated by the expiration of a timer on a M node     */    BEGIN         /*          * Send a NAME REFRESH REQUEST for each name which the          * TTL which has expired.          */         REPEAT              build NAME REFRESH REQUEST packet;              REPEAT                   send packet to NBNS; 
  1611.  
  1612.                   IF receive a WACK RESPONSE THEN                        pause(time from TTL field of response);                   ELSE                        pause(UCAST_REQ_RETRY_TIMEOUT);              UNTIL response packet is received or                   retransmit count has been exceeded 
  1613.  
  1614.              CASE packet type OF                POSITIVE NAME REGISTRATION RESPONSE:                   /* successfully refreshed */                   reset TTL timer for this name; 
  1615.  
  1616.                NEGATIVE NAME REGISTRATION RESPONSE:                   /*                    * refused, can't keep name                    * assume in conflict                    */                   mark name as in conflict;              END /* case */ 
  1617.  
  1618.         UNTIL request sent for all names for which TTL              has expired    END /* procedure */ 
  1619.  
  1620. 5.1.4.  NBNS ACTIVITY 
  1621.  
  1622.    A NBNS node will receive directed packets from P and M nodes.    Reply packets are always sent as directed packets to the source    IP address and UDP port number.  Received broadcast packets must    be ignored. 
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  NetBIOS Working Group                                          [Page 60] 
  1629.  RFC 1002                                                      March 1987 
  1630.  
  1631.  5.1.4.1.  NBNS INCOMING PACKET PROCESSING 
  1632.  
  1633.    PROCEDURE process_incoming_packet(packet) 
  1634.  
  1635.    /*     * Incoming packet processing on a NS node     */ 
  1636.  
  1637.    BEGIN         IF packet was sent as a broadcast THEN         BEGIN              discard packet;              return;         END         CASE packet type of 
  1638.  
  1639.         NAME REGISTRATION REQUEST (UNIQUE):              IF unique name exists in data base THEN              BEGIN /* unique name exists */                   /*                    * NBNS node may be a "passive"                    * server in that it expects the                    * end node to do the challenge                    * server.  Such a NBNS node is                    * called a "non-secure" server.                    * A "secure" server will do the                    * challenging before it sends                    * back a response packet.                    */ 
  1640.  
  1641.                   IF non-secure THEN                   BEGIN                        /*                         * build response packet                         */                        ... 
  1642.  
  1643.                         /*                         * let end node do the challenge                         */ 
  1644.  
  1645.                        send END-NODE CHALLENGE NAME REGISTRATION                             RESPONSE;                        return;                   END                   ELSE                   /*                    * secure server - do the name                    * challenge operation                    */ 
  1646.  
  1647.  
  1648.  
  1649. NetBIOS Working Group                                          [Page 61] 
  1650.  RFC 1002                                                      March 1987 
  1651.  
  1652.                    REPEAT                       send NAME QUERY REQUEST;                       pause(UCAST_REQ_RETRY_TIMEOUT);                   UNTIL response has been received or                        retransmit count has been exceeded                   IF no response was received THEN                   BEGIN 
  1653.  
  1654.                        /* node down */ 
  1655.  
  1656.                        update data base - remove entry;                        update data base - add new entry;                        send POSITIVE NAME REGISTRATION RESPONSE;                        return;                   END                   ELSE                   BEGIN /* challenged node replied */                       /*                        * challenged node replied with                        * a response packet                        */ 
  1657.  
  1658.                       CASE packet type 
  1659.  
  1660.                       POSITIVE NAME QUERY RESPONSE: 
  1661.  
  1662.                        /*                         * name still owned by the                         * challenged node                         *                         * build packet and send response                         */                         ... 
  1663.  
  1664.                         /*                         * Note: The NBNS will need to                         * keep track (based on transaction id) of                         * the IP address and port number                         * of the original requestor.                         */ 
  1665.  
  1666.                        send NEGATIVE NAME REGISTRATION RESPONSE;                        return;                       NEGATIVE NAME QUERY RESPONSE: 
  1667.  
  1668.                        update data base - remove entry;                        update data base - add new  entry; 
  1669.  
  1670.                        /*                         * build response packet and send 
  1671.  
  1672.  
  1673.  
  1674. NetBIOS Working Group                                          [Page 62] 
  1675.  RFC 1002                                                      March 1987 
  1676.  
  1677.                          * response                         */                        send POSITIVE NAME REGISTRATION RESPONSE;                        return;                       END /* case */                   END /* challenged node replied */              END /* unique name exists in data base */              ELSE              IF group name exists in data base THEN              BEGIN /* group names exists */ 
  1678.  
  1679.                   /*                    * Members of a group name are NOT                    * challenged.                    * Make the assumption that                    * at least some of the group members                    * are still alive.                    * Refresh mechanism will                    * allow the NBNS to detect when all                    * members of a group no longer use that                    * name                    */ 
  1680.  
  1681.                    send NEGATIVE NAME REGISTRATION RESPONSE;              END /* group name exists */              ELSE              BEGIN /* name does not exist */ 
  1682.  
  1683.                   /*                    * Name does not exist in data base                    *                    * This code applies to both non-secure                    * and secure server.                    */ 
  1684.  
  1685.                   update data base - add new entry;                   send POSITIVE NAME REGISTRATION RESPONSE;                   return;              END 
  1686.  
  1687.         NAME QUERY REQUEST:              IF name exists in data base THEN              BEGIN                   /*                    * build response packet and send to                    * requestor                    */                    ... 
  1688.  
  1689.                   send POSITIVE NAME QUERY RESPONSE;                   return; 
  1690.  
  1691.  
  1692.  
  1693. NetBIOS Working Group                                          [Page 63] 
  1694.  RFC 1002                                                      March 1987 
  1695.  
  1696.               ELSE              BEGIN                   /*                    * build response packet and send to                    * requestor                    */                    ... 
  1697.  
  1698.                   send NEGATIVE NAME QUERY RESPONSE;                   return;              END 
  1699.  
  1700.         NAME REGISTRATION REQUEST (GROUP):              IF name exists in data base THEN              BEGIN                   IF local entry is a unique name THEN                   BEGIN /* local is unique */ 
  1701.  
  1702.                       IF non-secure THEN                       BEGIN                        send  END-NODE CHALLENGE NAME                             REGISTRATION RESPONSE;                        return;                       END 
  1703.  
  1704.                       REPEAT                        send NAME QUERY REQUEST;                        pause(UCAST_REQ_RETRY_TIMEOUT);                       UNTIL response received or                            retransmit count exceeded                       IF no response received or                            NEGATIVE NAME QUERY RESPONSE                             received THEN                       BEGIN                        update data base - remove entry;                        update data base - add new entry;                        send POSITIVE NAME REGISTRATION RESPONSE;                        return;                       END                       ELSE                       BEGIN                        /*                         * name still being held                         * by challenged node                         */ 
  1705.  
  1706.                         send NEGATIVE NAME REGISTRATION RESPONSE;                       END                   END /* local is unique */                   ELSE                   BEGIN /* local is group  */ 
  1707.  
  1708.  
  1709.  
  1710. NetBIOS Working Group                                          [Page 64] 
  1711.  RFC 1002                                                      March 1987 
  1712.  
  1713.                         /*                         * existing entry is a group name                         */ 
  1714.  
  1715.                        update data base - remove entry;                        update data base - add new entry;                        send POSITIVE NAME REGISTRATION RESPONSE;                        return;                   END /* local is group */              END /* names exists */              ELSE              BEGIN /* does not exist */ 
  1716.  
  1717.                   /* name does not exist in data base */ 
  1718.  
  1719.                   update data base - add new entry;                   send POSITIVE NAME REGISTRATION RESPONSE;                   return;              END /* does not exist */ 
  1720.  
  1721.         NAME RELEASE REQUEST: 
  1722.  
  1723.              /*               * secure server may choose to disallow               * a node from deleting a name               */ 
  1724.  
  1725.              update data base - remove entry;              send POSITIVE NAME RELEASE RESPONSE;              return; 
  1726.  
  1727.         NAME UPDATE REQUEST: 
  1728.  
  1729.              /*               * End-node completed a successful challenge,               * no update database               */ 
  1730.  
  1731.              IF secure server THEN                   send NEGATIVE NAME REGISTRATION RESPONSE;              ELSE              BEGIN /* new entry */                   IF entry already exists THEN                        update data base - remove entry;                   update data base - add new entry;                   send POSITIVE NAME REGISTRATION RESPONSE;                   start_timer(TTL);              END 
  1732.  
  1733.         NAME REFRESH REQUEST:              check for consistency; 
  1734.  
  1735.  
  1736.  
  1737. NetBIOS Working Group                                          [Page 65] 
  1738.  RFC 1002                                                      March 1987 
  1739.  
  1740.               IF node not allowed to have name THEN              BEGIN 
  1741.  
  1742.                   /*                    * tell end node that it can't have name                    */                   send NEGATIVE NAME REGISTRATION RESPONSE;              END              ELSE              BEGIN 
  1743.  
  1744.                   /*                    * send confirmation response to the                    * end node.                    */                   send POSITIVE NAME REGISTRATION;                   start_timer(TTL);              END              return;         END /* case */    END /* procedure */ 
  1745.  
  1746. 5.1.4.2.  NBNS TIMER INITIATED PROCESSING 
  1747.  
  1748.    A NS node uses timers to flush out entries from the data base.    Each entry in the data base is removed when its timer expires.    This time value is a multiple of the refresh TTL established when    the name was registered. 
  1749.  
  1750.    PROCEDURE timer_expired() 
  1751.  
  1752.    /*     * processing initiated by expiration of TTL for a given name     */ 
  1753.  
  1754.    BEGIN         /*          * NBNS can (optionally) ensure          * that the node is actually down          * by sending a NODE STATUS REQUEST.          * If such a request is sent, and          * no response is received, it can          * be assumed that the node is down.          */         remove entry from data base;    END 
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  NetBIOS Working Group                                          [Page 66] 
  1763.  RFC 1002                                                      March 1987 
  1764.  
  1765.  5.2.  SESSION SERVICE PROTOCOLS 
  1766.  
  1767.    The following are variables and should be configurable by the    NetBIOS user.  The default values of these variables is found in    "Defined Constants and Variables" in the Detailed    Specification.): 
  1768.  
  1769.    - SSN_RETRY_COUNT - The maximum number TCP connection attempts      allowable per a single NetBIOS call request. 
  1770.  
  1771.    - SSN_CLOSE_TIMEOUT is the time period to wait when closing the      NetBIOS session before killing the TCP connection if session      sends are outstanding. 
  1772.  
  1773.    The following are Defined Constants for the NetBIOS Session    Service.  (See "Defined Constants and Variables" in the Detailed    Specification for the value of these constants): 
  1774.  
  1775.    - SSN_SRVC_TCP_PORT - is the globally well-known TCP port      allocated for the NetBIOS Session Service.  The service accepts      TCP connections on this port to establish NetBIOS Sessions.      The TCP connection established to this port by the caller is      initially used for the exchange of NetBIOS control information.      The actual NetBIOS data connection may also pass through this      port or, through the retargetting facility, through another      port. 
  1776.  
  1777. 5.2.1.  SESSION ESTABLISHMENT PROTOCOLS 
  1778.  
  1779. 5.2.1.1.  USER REQUEST PROCESSING 
  1780.  
  1781.    PROCEDURE listen(listening name, caller name)    /*     * User initiated processing for B, P and M nodes     *     * This procedure assumes that an incoming session will be     * retargetted here by a session server.     */    BEGIN         Do TCP listen; /* Returns TCP port used */         Register listen with Session Service, give names and              TCP port; 
  1782.  
  1783.         Wait for TCP connection to open;   /* Incoming call */ 
  1784.  
  1785.         Read SESSION REQUEST packet from connection 
  1786.  
  1787.         Process session request (see section on              processing initiated by the reception of session              service packets); 
  1788.  
  1789.  
  1790.  
  1791.  NetBIOS Working Group                                          [Page 67] 
  1792.  RFC 1002                                                      March 1987 
  1793.  
  1794.          Inform Session Service that NetBIOS listen is complete; 
  1795.  
  1796.         IF session established THEN              return success and session information to user;         ELSE              return failure;    END /* procedure */ 
  1797.  
  1798.    PROCEDURE call(calling name, called name)    /*     * user initiated processing for B, P and M nodes     */ 
  1799.  
  1800.    /*     * This algorithm assumes that the called name is a unique name.     * If the called name is a group name, the call() procedure     * needs to cycle through the members of the group     * until either (retry_count == SSN_RETRY_COUNT) or     * the list has been exhausted.     */    BEGIN         retry_count = 0;         retarget = FALSE;   /* TRUE: caller is being retargetted */         name_query = TRUE;  /* TRUE: caller must begin again with */                             /*       name query. */ 
  1801.  
  1802.         REPEAT              IF name_query THEN              BEGIN                   do name discovery, returns IP address;                   TCP port = SSN_SRVC_TCP_PORT; 
  1803.  
  1804.                   IF name discovery fails THEN                        return failure;                   ELSE                        name_query = FALSE;              END 
  1805.  
  1806.              /*               * now have IP address and TCP port of               * remote party.               */ 
  1807.  
  1808.              establish TCP connection with remote party, use an                   ephemeral port as source TCP port;              IF connection refused THEN              BEGIN                   IF retarget THEN                   BEGIN                        /* retry */                        retarget = FALSE; 
  1809.  
  1810.  
  1811.  
  1812. NetBIOS Working Group                                          [Page 68] 
  1813.  RFC 1002                                                      March 1987 
  1814.  
  1815.                         use original IP address and TCP port;                        goto LOOP;                   END 
  1816.  
  1817.                   /* retry for just missed TCP listen */ 
  1818.  
  1819.                   pause(SESSION_RETRY_TIMER);                   establish TCP connection, again use ephemeral                        port as source TCP port; 
  1820.  
  1821.                   IF connection refused OR                      connection timed out THEN                        return failure;              END              ELSE              IF connection timed out THEN              BEGIN                   IF retarget THEN                   BEGIN                        /* retry */                        retarget = FALSE;                        use original IP address and TCP port;                        goto LOOP;                   END                   ELSE                   BEGIN                        /*                         * incorrect name discovery was done,                         * try again                         */ 
  1822.  
  1823.                        inform name discovery process of                             possible error;                        name_query = TRUE;                        goto LOOP;                   END              END 
  1824.  
  1825.              /*               * TCP connection has been established               */ 
  1826.  
  1827.              wait for session response packet;              CASE packet type OF 
  1828.  
  1829.                 POSITIVE SESSION RESPONSE:                   return success and session established                        information; 
  1830.  
  1831.                 NEGATIVE SESSION RESPONSE:                 BEGIN 
  1832.  
  1833.  
  1834.  
  1835. NetBIOS Working Group                                          [Page 69] 
  1836.  RFC 1002                                                      March 1987 
  1837.  
  1838.                    CASE error OF                      NOT LISTENING ON CALLED NAME:                      NOT LISTENING FOR CALLING NAME:                      BEGIN                        kill TCP connection;                        return failure;                      END 
  1839.  
  1840.                      CALLED NAME NOT PRESENT:                      BEGIN                        /*                         * called name does not exist on                         * remote node                         */ 
  1841.  
  1842.                        inform name discovery procedure                             of possible error; 
  1843.  
  1844.                        IF this is a P or M node THEN                        BEGIN                             /*                              * Inform NetBIOS Name Server                              * it has returned incorrect                              * information.                              */                             send NAME RELEASE REQUEST for called                               name and IP address to                               NetBIOS Name Server;                        END                        /* retry from beginning */                        retarget = FALSE;                        name_query = TRUE;                        goto LOOP;                      END /* called name not present */                   END /* case */                 END /* negative response */ 
  1845.  
  1846.                 RETARGET SESSION RESPONSE:                 BEGIN                   close TCP connection;                   extract IP address and TCP port from                        response;                   retarget = TRUE;                 END /* retarget response */              END /* case */ 
  1847.  
  1848.    LOOP:          retry_count = retry_count + 1; 
  1849.  
  1850.         UNTIL (retry_count > SSN_RETRY_COUNT);         return failure;    END /* procedure */ 
  1851.  
  1852.  
  1853.  
  1854. NetBIOS Working Group                                          [Page 70] 
  1855.  RFC 1002                                                      March 1987 
  1856.  
  1857.  5.2.1.2.  RECEIVED PACKET PROCESSING 
  1858.  
  1859.    These are packets received on a TCP connection before a session    has been established.  The listen routines attached to a NetBIOS    user process need not implement the RETARGET response section.    The user process version, separate from a shared Session Service,    need only accept (POSITIVE SESSION RESPONSE) or reject (NEGATIVE    SESSION RESPONSE) a session request. 
  1860.  
  1861.    PROCEDURE session_packet(packet)    /*     * processing initiated by receipt of a session service     * packet for a session in the session establishment phase.     * Assumes the TCP connection has been accepted.     */    BEGIN         CASE packet type 
  1862.  
  1863.            SESSION REQUEST:            BEGIN              IF called name does not exist on node THEN              BEGIN                   send NEGATIVE SESSION RESPONSE with CALLED                        NAME NOT PRESENT error code;                   close TCP connection;              END 
  1864.  
  1865.              Search for a listen with CALLING NAME for CALLED                   NAME;              IF matching listen is found THEN              BEGIN                   IF port of listener process is port TCP                      connection is on THEN                   BEGIN                        send POSITIVE SESSION RESPONSE; 
  1866.  
  1867.                        Hand off connection to client process                             and/or inform user session is                             established;                   END                   ELSE                   BEGIN                        send RETARGET SESSION RESPONSE with                             listener's IP address and                             TCP port;                        close TCP connection;                   END              END              ELSE              BEGIN                   /* no matching listen pending */ 
  1868.  
  1869.  
  1870.  
  1871. NetBIOS Working Group                                          [Page 71] 
  1872.  RFC 1002                                                      March 1987 
  1873.  
  1874.                    send NEGATIVE SESSION RESPONSE with either                        NOT LISTENING ON CALLED NAME or NOT                        LISTENING FOR CALLING NAME error                        code;                   close TCP connection;              END            END /* session request */         END /* case */    END /* procedure */ 
  1875.  
  1876. 5.2.2.  SESSION DATA TRANSFER PROTOCOLS 
  1877.  
  1878. 5.2.2.1.  USER REQUEST PROCESSING 
  1879.  
  1880.    PROCEDURE send_message(user_message)    BEGIN         build SESSION MESSAGE header;         send SESSION MESSAGE header;         send user_message;         reset and restart keep-alive timer;         IF send fails THEN         BEGIN              /*               * TCP connection has failed */               */              close NetBIOS session;              inform user that session is lost;              return failure;         END         ELSE              return success;    END 
  1881.  
  1882.    5.2.2.2.  RECEIVED PACKET PROCESSING 
  1883.  
  1884.    These are packets received after a session has been established. 
  1885.  
  1886.    PROCEDURE session_packet(packet)    /*     * processing initiated by receipt of a session service     * packet for a session in the data transfer phase.     */    BEGIN         CASE packet type OF 
  1887.  
  1888.            SESSION  MESSAGE:            BEGIN              process message header;              read in user data;              reset and restart keep-alive timer;              deliver data to user; 
  1889.  
  1890.  
  1891.  
  1892. NetBIOS Working Group                                          [Page 72] 
  1893.  RFC 1002                                                      March 1987 
  1894.  
  1895.             END /* session message */ 
  1896.  
  1897.            SESSION KEEP ALIVE:              discard packet; 
  1898.  
  1899.         END /* case */    END /* procedure */ 
  1900.  
  1901. 5.2.2.3.  PROCESSING INITIATED BY TIMER 
  1902.  
  1903.    PROCEDURE session_ka_timer()    /*     * processing initiated when session keep alive timer expires     */    BEGIN             send SESSION KEEP ALIVE, if configured;             IF send fails THEN             BEGIN              /* remote node, or path to it, is down */ 
  1904.  
  1905.              abort TCP connection;              close NetBIOS session;              inform user that session is lost;              return;             END    END /* procedure */ 
  1906.  
  1907. 5.2.3.  SESSION TERMINATION PROTOCOLS 
  1908.  
  1909. 5.2.3.1.  USER REQUEST PROCESSING 
  1910.  
  1911.    PROCEDURE close_session() 
  1912.  
  1913.    /* initiated by a user request to close a session */ 
  1914.  
  1915.    BEGIN         close gracefully the TCP connection; 
  1916.  
  1917.         WAIT for the connection to close or SSN_CLOSE_TIMEOUT              to expire; 
  1918.  
  1919.         IF time out expired THEN              abort TCP connection;    END /* procedure */ 
  1920.  
  1921. 5.2.3.2.  RECEPTION INDICATION PROCESSING 
  1922.  
  1923.    PROCEDURE close_indication()    /*     * initiated by a TCP indication of a close request from     * the remote connection partner. 
  1924.  
  1925.  
  1926.  
  1927. NetBIOS Working Group                                          [Page 73] 
  1928.  RFC 1002                                                      March 1987 
  1929.  
  1930.      */    BEGIN         close gracefully TCP connection; 
  1931.  
  1932.         close NetBIOS session; 
  1933.  
  1934.         inform user session closed by remote partner;    END /* procedure */ 
  1935.  
  1936. 5.3.  NetBIOS DATAGRAM SERVICE PROTOCOLS 
  1937.  
  1938.    The following are GLOBAL variables and should be NetBIOS user    configurable: 
  1939.  
  1940.    - SCOPE_ID: the non-leaf section of the domain name preceded by a      '.'  which represents the domain of the NetBIOS scope for the      NetBIOS name.  The following protocol description only supports      single scope operation. 
  1941.  
  1942.    - MAX_DATAGRAM_LENGTH: the maximum length of an IP datagram.  The      minimal maximum length defined in for IP is 576 bytes.  This      value is used when determining whether to fragment a NetBIOS      datagram.  Implementations are expected to be capable of      receiving unfragmented NetBIOS datagrams up to their maximum      size. 
  1943.  
  1944.    - BROADCAST_ADDRESS: the IP address B-nodes use to send datagrams      with group name destinations and broadcast datagrams.  The      default is the IP broadcast address for a single IP network. 
  1945.  
  1946.     The following are Defined Constants for the NetBIOS Datagram    Service: 
  1947.  
  1948.    - DGM_SRVC_UDP_PORT: the globally well-known UDP port allocated      where the NetBIOS Datagram Service receives UDP packets.  See      section 6, "Defined Constants", for its value. 
  1949.  
  1950. 5.3.1.  B NODE TRANSMISSION OF NetBIOS DATAGRAMS 
  1951.  
  1952.    PROCEDURE send_datagram(data, source, destination, broadcast) 
  1953.  
  1954.    /*     * user initiated processing on B node     */ 
  1955.  
  1956.    BEGIN         group = FALSE; 
  1957.  
  1958.         do name discovery on destination name, returns name type and              IP address; 
  1959.  
  1960.  
  1961.  
  1962. NetBIOS Working Group                                          [Page 74] 
  1963.  RFC 1002                                                      March 1987 
  1964.  
  1965.          IF name type is group name THEN         BEGIN              group = TRUE;         END 
  1966.  
  1967.         /*          * build datagram service UDP packet;          */         convert source and destination NetBIOS names into              half-ASCII, biased encoded name;         SOURCE_NAME = cat(source, SCOPE_ID);         SOURCE_IP = this nodes IP address;         SOURCE_PORT =  DGM_SRVC_UDP_PORT; 
  1968.  
  1969.         IF NetBIOS broadcast THEN         BEGIN              DESTINATION_NAME = cat("*", SCOPE_ID)         END         ELSE         BEGIN              DESTINATION_NAME = cat(destination, SCOPE_ID)         END 
  1970.  
  1971.         MSG_TYPE = select_one_from_set              {BROADCAST, DIRECT_UNIQUE, DIRECT_GROUP}         DGM_ID = next transaction id for Datagrams;         DGM_LENGTH = length of data + length of second level encoded              source and destination names; 
  1972.  
  1973.         IF (length of the NetBIOS Datagram, including UDP and             IP headers, > MAX_DATAGRAM_LENGTH) THEN         BEGIN              /*               * fragment NetBIOS datagram into 2 UDP packets               */              Put names into 1st UDP packet and any data that fits                   after names;              Set MORE and FIRST bits in 1st UDP packet's FLAGS;              OFFSET in 1st UDP = 0; 
  1974.  
  1975.              Replicate NetBIOS Datagram header from 1st UDP packet                   into 2nd UDP packet;              Put rest of data in 2nd UDP packet;              Clear MORE and FIRST bits in 2nd UDP packet's FLAGS;              OFFSET in 2nd UDP = DGM_LENGTH - number of name and                   data bytes in 1st UDP;         END         BEGIN              /*               * Only need one UDP packet               */ 
  1976.  
  1977.  
  1978.  
  1979. NetBIOS Working Group                                          [Page 75] 
  1980.  RFC 1002                                                      March 1987 
  1981.  
  1982.               USER_DATA = data;              Clear MORE bit and set FIRST bit in FLAGS;              OFFSET = 0;         END 
  1983.  
  1984.         IF (group == TRUE) OR (NetBIOS broadcast) THEN         BEGIN              send UDP packet(s) to BROADCAST_ADDRESS;         END         ELSE         BEGIN              send UDP packet(s) to IP address returned by name                 discovery;         END    END /* procedure */ 
  1985.  
  1986. 5.3.2.  P AND M NODE TRANSMISSION OF NetBIOS DATAGRAMS 
  1987.  
  1988.    PROCEDURE send_datagram(data, source, destination, broadcast) 
  1989.  
  1990.    /*     * User initiated processing on P and M node.     *     * This processing is the same as for B nodes except for     * sending broadcast and multicast NetBIOS datagrams.     */ 
  1991.  
  1992.    BEGIN         group = FALSE; 
  1993.  
  1994.         do name discovery on destination name, returns name type              and IP address;         IF name type is group name THEN         BEGIN              group = TRUE;         END 
  1995.  
  1996.         /*          * build datagram service UDP packet;          */         convert source and destination NetBIOS names into              half-ASCII, biased encoded name;         SOURCE_NAME = cat(source, SCOPE_ID);         SOURCE_IP = this nodes IP address;         SOURCE_PORT =  DGM_SRVC_UDP_PORT; 
  1997.  
  1998.         IF NetBIOS broadcast THEN         BEGIN              DESTINATION_NAME = cat("*", SCOPE_ID)         END         ELSE 
  1999.  
  2000.  
  2001.  
  2002. NetBIOS Working Group                                          [Page 76] 
  2003.  RFC 1002                                                      March 1987 
  2004.  
  2005.          BEGIN              DESTINATION_NAME = cat(destination, SCOPE_ID)         END 
  2006.  
  2007.         MSG_TYPE = select_one_from_set              {BROADCAST, DIRECT_UNIQUE, DIRECT_GROUP}         DGM_ID = next transaction id for Datagrams;         DGM_LENGTH = length of data + length of second level encoded              source and destination names; 
  2008.  
  2009.         IF (length of the NetBIOS Datagram, including UDP and             IP headers, > MAX_DATAGRAM_LENGTH) THEN         BEGIN              /*               * fragment NetBIOS datagram into 2 UDP packets               */              Put names into 1st UDP packet and any data that fits                   after names;              Set MORE and FIRST bits in 1st UDP packet's FLAGS; 
  2010.  
  2011.              OFFSET in 1st UDP = 0; 
  2012.  
  2013.              Replicate NetBIOS Datagram header from 1st UDP packet                   into 2nd UDP packet;              Put rest of data in 2nd UDP packet;              Clear MORE and FIRST bits in 2nd UDP packet's FLAGS;              OFFSET in 2nd UDP = DGM_LENGTH - number of name and                   data bytes in 1st UDP;         END         BEGIN              /*               * Only need one UDP packet               */              USER_DATA = data;              Clear MORE bit and set FIRST bit in FLAGS;              OFFSET = 0;         END 
  2014.  
  2015.         IF (group == TRUE) OR (NetBIOS broadcast) THEN         BEGIN              /*               * Sending of following query is optional.               * Node may send datagram to NBDD immediately               * but NBDD may discard the datagram.               */              send DATAGRAM QUERY REQUEST to NBDD;              IF response is POSITIVE QUERY RESPONSE THEN                   send UDP packet(s) to NBDD Server IP address;              ELSE              BEGIN                   get list of destination nodes from NBNS; 
  2016.  
  2017.  
  2018.  
  2019. NetBIOS Working Group                                          [Page 77] 
  2020.  RFC 1002                                                      March 1987 
  2021.  
  2022.                    FOR EACH node in list                   BEGIN                        send UDP packet(s) to this node's                             IP address;                   END              END         END         ELSE         BEGIN              send UDP packet(s) to IP address returned by name                 discovery;    END /* procedure */ 
  2023.  
  2024. 5.3.3.  RECEPTION OF NetBIOS DATAGRAMS BY ALL NODES 
  2025.  
  2026.    The following algorithm discards out of order NetBIOS Datagram    fragments.  An implementation which reassembles out of order    NetBIOS Datagram fragments conforms to this specification.  The    fragment discard timer is initialized to the value FRAGMENT_TO.    This value should be user configurable.  The default value is    given in Section 6, "Defined Constants and Variables". 
  2027.  
  2028.    PROCEDURE datagram_packet(packet) 
  2029.  
  2030.    /*     * processing initiated by datagram packet reception     * on B, P and M nodes     */    BEGIN         /*          * if this node is a P node, ignore          * broadcast packets.          */ 
  2031.  
  2032.         IF this is a P node AND incoming packet is              a broadcast packet THEN         BEGIN              discard packet;         END 
  2033.  
  2034.         CASE packet type OF 
  2035.  
  2036.            DATAGRAM SERVICE:            BEGIN              IF FIRST bit in FLAGS is set THEN              BEGIN                   IF MORE bit in FLAGS is set THEN                   BEGIN                        Save 1st UDP packet of the Datagram;                        Set this Datagram's fragment discard                          timer to FRAGMENT_TO; 
  2037.  
  2038.  
  2039.  
  2040. NetBIOS Working Group                                          [Page 78] 
  2041.  RFC 1002                                                      March 1987 
  2042.  
  2043.                         return;                   END                   ELSE                        Datagram is composed of a single                          UDP packet;              END              ELSE              BEGIN                   /* Have the second fragment of a Datagram */ 
  2044.  
  2045.                   Search for 1st fragment by source IP address                      and DGM_ID;                   IF found 1st fragment THEN                        Process both UDP packets;                   ELSE                   BEGIN                        discard 2nd fragment UDP packet;                        return;                   END              END 
  2046.  
  2047.              IF DESTINATION_NAME is '*' THEN              BEGIN                   /* NetBIOS broadcast */ 
  2048.  
  2049.                   deliver USER_DATA from UDP packet(s) to all                        outstanding receive broadcast                        datagram requests;                   return;              END              ELSE              BEGIN /* non-broadcast */                   /* Datagram for Unique or Group Name */ 
  2050.  
  2051.                   IF DESTINATION_NAME is not present in the                      local name table THEN                   BEGIN                        /* destination not present */                        build DATAGRAM ERROR packet, clear                             FIRST and MORE bit, put in                             this nodes IP and PORT, set                             ERROR_CODE;                        send DATAGRAM ERROR packet to                             source IP address and port                             of UDP;                        discard UDP packet(s);                        return;                   END                   ELSE                   BEGIN /* good */                        /* 
  2052.  
  2053.  
  2054.  
  2055. NetBIOS Working Group                                          [Page 79] 
  2056.  RFC 1002                                                      March 1987 
  2057.  
  2058.                          * Replicate received NetBIOS datagram for                         * each recipient                         */                        FOR EACH pending NetBIOS user's receive                             datagram operation                        BEGIN                             IF source name of operation                                matches destination name                                of packet THEN                             BEGIN                                deliver USER_DATA from UDP                                  packet(s);                             END                        END /* for each */                        return;                   END /* good */              END /* non-broadcast */             END /* datagram service */ 
  2059.  
  2060.            DATAGRAM ERROR:            BEGIN                 /*                  * name service returned incorrect information                  */ 
  2061.  
  2062.                 inform local name service that incorrect                   information was provided; 
  2063.  
  2064.                 IF this is a P or M node THEN                 BEGIN                      /*                       * tell NetBIOS Name Server that it may                       * have given incorrect information                       */ 
  2065.  
  2066.                      send NAME RELEASE REQUEST with name                        and incorrect IP address to NetBIOS                        Name Server;                 END            END /* datagram error */ 
  2067.  
  2068.         END /* case */    END 
  2069.  
  2070. 5.3.4.  PROTOCOLS FOR THE NBDD 
  2071.  
  2072.    The key to NetBIOS Datagram forwarding service is the packet    delivered to the destination end node must have the same NetBIOS    header as if the source end node sent the packet directly to the    destination end node.  Consequently, the NBDD does not reassemble    NetBIOS Datagrams.  It forwards the UDP packet as is. 
  2073.  
  2074.  
  2075.  
  2076. NetBIOS Working Group                                          [Page 80] 
  2077.  RFC 1002                                                      March 1987 
  2078.  
  2079.     PROCEDURE  datagram_packet(packet) 
  2080.  
  2081.    /*     * processing initiated by a incoming datagram service     * packet on a NBDD node.     */ 
  2082.  
  2083.    BEGIN         CASE packet type OF 
  2084.  
  2085.            DATAGRAM SERVICE:            BEGIN                 IF packet was sent as a directed                    NetBIOS datagram THEN                 BEGIN                   /*                    * provide group forwarding service                    *                    * Forward datagram to each member of the                    * group.  Can forward via:                    *   1) get list of group members and send                    *   the DATAGRAM SERVICE packet unicast                    *   to each                    *   2) use Group Multicast, if available                    *   3) combination of 1) and 2)                    */ 
  2086.  
  2087.                   ... 
  2088.  
  2089.                 END 
  2090.  
  2091.                 ELSE                 BEGIN                   /*                    * provide broadcast forwarding service                    *                    * Forward datagram to every node in the                    * NetBIOS scope.  Can forward via:                    *   1) get list of group members and send                    *   the DATAGRAM SERVICE packet unicast                    *   to each                    *   2) use Group Multicast, if available                    *   3) combination of 1) and 2)                    */ 
  2092.  
  2093.                   ... 
  2094.  
  2095.                 END            END /* datagram service */ 
  2096.  
  2097.            DATAGRAM ERROR: 
  2098.  
  2099.  
  2100.  
  2101. NetBIOS Working Group                                          [Page 81] 
  2102.  RFC 1002                                                      March 1987 
  2103.  
  2104.             BEGIN              /*               * Should never receive these because Datagrams               * forwarded have source end node IP address and               * port in NetBIOS header.               */ 
  2105.  
  2106.              send DELETE NAME REQUEST with incorrect name and                   IP address to NetBIOS Name Server; 
  2107.  
  2108.            END /* datagram error */ 
  2109.  
  2110.            DATAGRAM QUERY REQUEST:            BEGIN              IF can send packet to DESTINATION_NAME THEN              BEGIN                   /*                    * NBDD is able to relay Datagrams for                    * this name                    */ 
  2111.  
  2112.                   send POSITIVE DATAGRAM QUERY RESPONSE to                     REQUEST source IP address and UDP port                     with request's DGM_ID;              END              ELSE              BEGIN                   /*                    * NBDD is NOT able to relay Datagrams for                    * this name                    */ 
  2113.  
  2114.                   send NEGATIVE DATAGRAM QUERY RESPONSE to                     REQUEST source IP address and UDP port 
  2115.  
  2116.                     with request's DGM_ID;              END            END /* datagram query request */ 
  2117.  
  2118.         END /* case */    END /* procedure */ 
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132. NetBIOS Working Group                                          [Page 82] 
  2133.  RFC 1002                                                      March 1987 
  2134.  
  2135.  6.  DEFINED CONSTANTS AND VARIABLES 
  2136.  
  2137.    GENERAL: 
  2138.  
  2139.       SCOPE_ID                   The name of the NetBIOS scope. 
  2140.  
  2141.                                  This is expressed as a character                                  string meeting the requirements of                                  the domain name system and without                                  a leading or trailing "dot". 
  2142.  
  2143.                                  An implementation may elect to make                                  this a single global value for the                                  node or allow it to be specified                                  with each separate NetBIOS name                                  (thus permitting cross-scope                                  references.) 
  2144.  
  2145.       BROADCAST_ADDRESS          An IP address composed of the                                  nodes's network and subnetwork                                  numbers with all remaining bits set                                  to one. 
  2146.  
  2147.                                  I.e. "Specific subnet" broadcast                                  addressing according to section 2.3                                  of RFC 950. 
  2148.  
  2149.       BCAST_REQ_RETRY_TIMEOUT    250 milliseconds.                                  An adaptive timer may be used. 
  2150.  
  2151.       BCAST_REQ_RETRY_COUNT      3 
  2152.  
  2153.       UCAST_REQ_RETRY_TIMEOUT    5 seconds                                  An adaptive timer may be used. 
  2154.  
  2155.       UCAST_REQ_RETRY_COUNT      3 
  2156.  
  2157.       MAX_DATAGRAM_LENGTH        576 bytes (default) 
  2158.  
  2159.  
  2160.  
  2161.    NAME SERVICE: 
  2162.  
  2163.       REFRESH_TIMER              Negotiated with NBNS for each name. 
  2164.  
  2165.       CONFLICT_TIMER             1 second                                  Implementations may chose a longer                                  value. 
  2166.  
  2167.        NAME_SERVICE_TCP_PORT      137 (decimal) 
  2168.  
  2169.  
  2170.  
  2171. NetBIOS Working Group                                          [Page 83] 
  2172.  RFC 1002                                                      March 1987 
  2173.  
  2174.        NAME_SERVICE_UDP_PORT      137 (decimal) 
  2175.  
  2176.       INFINITE_TTL               0 
  2177.  
  2178.     SESSION SERVICE: 
  2179.  
  2180.       SSN_SRVC_TCP_PORT          139 (decimal) 
  2181.  
  2182.       SSN_RETRY_COUNT            4 (default)                                  Re-configurable by user. 
  2183.  
  2184.       SSN_CLOSE_TIMEOUT          30 seconds (default)                                  Re-configurable by user. 
  2185.  
  2186.       SSN_KEEP_ALIVE_TIMEOUT     60 seconds, recommended, may be set to                                  a higher value.                                  (Session keep-alives are used only                                  if configured.) 
  2187.  
  2188.    DATAGRAM SERVICE: 
  2189.  
  2190.       DGM_SRVC_UDP_PORT          138 (decimal) 
  2191.  
  2192.       FRAGMENT_TO                2 seconds (default) 
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222. NetBIOS Working Group                                          [Page 84] 
  2223.  RFC 1002                                                      March 1987 
  2224.  
  2225.  REFERENCES 
  2226.  
  2227.  
  2228.  
  2229.    [1]  "Protocol Standard For a NetBIOS Service on a TCP/UDP         Transport: Concepts and Methods", RFC 1001, March 1987. 
  2230.  
  2231.    [2]  J. Reynolds, J. Postel, "Assigned Numbers", RFC 990, November         1986. 
  2232.  
  2233.    [3]  P. Mockapetris, "Domain Names - Implementation and         Specification", RFC 883, November 1983. 
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  NetBIOS Working Group                                          [Page 85] 
  2276.