RFC 1001

Protocol standard for a NetBIOS service on a TCP/UDP transport: Concepts and methods

๐Ÿ“… published March 1987, from ietf

PROTOCOL STANDARD FOR A NetBIOS SERVICE ON A TCP/UDP TRANSPORT: CONCEPTS AND METHODS ๐ŸŽ€

Okay bestie, the header facts first ๐Ÿ’– This is from the Network Working Group, it's RFC 1001, and it's dated March 1987. The copy I'm working from doesn't list any authors, and it doesn't say what it obsoletes or updates, so I'm not going to invent anything there โœจ The category is in the Abstract: it's a proposed standard ๐Ÿ”ฅ

ABSTRACT ๐Ÿฆ‹

Okay so this RFC defines a proposed standard protocol that brings NetBIOS services to a TCP/IP environment ๐ŸŒˆ It works on a local network and across internetworks, which is so iconic ๐Ÿ‘‘ It also defines a bunch of different node types, so the design can fit both local and internet layouts, and it can work with or without IP broadcast. Lowkey genius ๐Ÿ’…

It explains the NetBIOS-over-TCP protocols in a general way, focusing on the big ideas and techniques behind them ๐Ÿงš The detailed specs live in a companion RFC called "Protocol Standard For a NetBIOS Service on a TCP/UDP Transport: Detailed Specifications" ๐Ÿ“š

SUMMARY OF CONTENTS โœจ

1.  STATUS OF THIS MEMO                                             6
2.  ACKNOWLEDGEMENTS                                                6
3.  INTRODUCTION                                                    7
4.  DESIGN PRINCIPLES                                               7
5.  OVERVIEW OF NetBIOS                                            10
6.  NetBIOS FACILITIES SUPPORTED BY THIS STANDARD                  15
7.  REQUIRED SUPPORTING SERVICE INTERFACES AND DEFINITIONS         15
8.  RELATED PROTOCOLS AND SERVICES                                 16
9.  NetBIOS SCOPE                                                  16
10.  NetBIOS END-NODES                                             16
11.  NetBIOS SUPPORT SERVERS                                       18
12.  TOPOLOGIES                                                    20
13.  GENERAL METHODS                                               23
14.  REPRESENTATION OF NETBIOS NAMES                               25
15.  NetBIOS NAME SERVICE                                          27
16.  NetBIOS SESSION SERVICE                                       48
17.  NETBIOS DATAGRAM SERVICE                                      55
18.  NODE CONFIGURATION PARAMETERS                                 58
19.  MINIMAL CONFORMANCE                                           59
REFERENCES                                                         60
APPENDIX A - INTEGRATION WITH INTERNET GROUP MULTICASTING          61
APPENDIX B - IMPLEMENTATION CONSIDERATIONS                         62

TABLE OF CONTENTS ๐Ÿ’œ

1.  STATUS OF THIS MEMO                                             6

2.  ACKNOWLEDGEMENTS                                                6

3.  INTRODUCTION                                                    7

4.  DESIGN PRINCIPLES                                               8
  4.1  PRESERVE NetBIOS SERVICES                                    8
  4.2  USE EXISTING STANDARDS                                       8
  4.3  MINIMIZE OPTIONS                                             8
  4.4  TOLERATE ERRORS AND DISRUPTIONS                              8
  4.5  DO NOT REQUIRE CENTRAL MANAGEMENT                            9
  4.6  ALLOW INTERNET OPERATION                                     9
  4.7  MINIMIZE BROADCAST ACTIVITY                                  9
  4.8  PERMIT IMPLEMENTATION ON EXISTING SYSTEMS                    9
  4.9  REQUIRE ONLY THE MINIMUM NECESSARY TO OPERATE                9
  4.10  MAXIMIZE EFFICIENCY                                        10
  4.11  MINIMIZE NEW INVENTIONS                                    10

5.  OVERVIEW OF NetBIOS                                            10
  5.1  INTERFACE TO APPLICATION PROGRAMS                           10
  5.2  NAME SERVICE                                                11
  5.3  SESSION SERVICE                                             12
  5.4  DATAGRAM SERVICE                                            13
  5.5  MISCELLANEOUS FUNCTIONS                                     14
  5.6  NON-STANDARD EXTENSIONS                                     15

6.  NetBIOS FACILITIES SUPPORTED BY THIS STANDARD                  15

7.  REQUIRED SUPPORTING SERVICE INTERFACES AND DEFINITIONS         15

8.  RELATED PROTOCOLS AND SERVICES                                 16

9.  NetBIOS SCOPE                                                  16

10.  NetBIOS END-NODES                                             16
  10.1  BROADCAST (B) NODES                                        16
  10.2  POINT-TO-POINT (P) NODES                                   16
  10.3  MIXED MODE (M) NODES                                       16

11.  NetBIOS SUPPORT SERVERS                                       18
  11.1  NetBIOS NAME SERVER (NBNS) NODES                           18
     11.1.1  RELATIONSHIP OF THE NBNS TO THE DOMAIN NAME SYSTEM    19
  11.2  NetBIOS DATAGRAM DISTRIBUTION SERVER (NBDD) NODES          19
  11.3  RELATIONSHIP OF NBNS AND NBDD NODES                        20
  11.4  RELATIONSHIP OF NetBIOS SUPPORT SERVERS AND B NODES        20
12.  TOPOLOGIES                                                    20
  12.1  LOCAL                                                      20

     12.1.1  B NODES ONLY                                          21
     12.1.2  P NODES ONLY                                          21
     12.1.3  MIXED B AND P NODES                                   21
  12.2  INTERNET                                                   22
     12.2.1  P NODES ONLY                                          22
     12.2.2  MIXED M AND P NODES                                   23

13.  GENERAL METHODS                                               23
  13.1  REQUEST/RESPONSE INTERACTION STYLE                         23
     13.1.1  RETRANSMISSION OF REQUESTS                            24
     13.1.2  REQUESTS WITHOUT RESPONSES: DEMANDS                   24
  13.2  TRANSACTIONS                                               25
     13.2.1  TRANSACTION ID                                        25
  13.3  TCP AND UDP FOUNDATIONS                                    25

14.  REPRESENTATION OF NETBIOS NAMES                               25
  14.1  FIRST LEVEL ENCODING                                       26
  14.2  SECOND LEVEL ENCODING                                      27

15.  NetBIOS NAME SERVICE                                          27
  15.1  OVERVIEW OF NetBIOS NAME SERVICE                           27
     15.1.1  NAME REGISTRATION (CLAIM)                             27
     15.1.2  NAME QUERY (DISCOVERY)                                28
     15.1.3  NAME RELEASE                                          28
       15.1.3.1  EXPLICIT RELEASE                                  28
       15.1.3.2  NAME LIFETIME AND REFRESH                         29
       15.1.3.3  NAME CHALLENGE                                    29
       15.1.3.4  GROUP NAME FADE-OUT                               29
     15.1.3.5  NAME CONFLICT                                       30
     15.1.4  ADAPTER STATUS                                        31
     15.1.5  END-NODE NBNS INTERACTION                             31
       15.1.5.1  UDP, TCP, AND TRUNCATION                          31
       15.1.5.2  NBNS WACK                                         32
       15.1.5.3  NBNS REDIRECTION                                  32
     15.1.6  SECURED VERSUS NON-SECURED NBNS                       32
     15.1.7  CONSISTENCY OF THE NBNS DATA BASE                     32
     15.1.8  NAME CACHING                                          34
  15.2  NAME REGISTRATION TRANSACTIONS                             34
     15.2.1  NAME REGISTRATION BY B NODES                          34
     15.2.2  NAME REGISTRATION BY P NODES                          35
       15.2.2.1  NEW NAME, OR NEW GROUP MEMBER                     35
       15.2.2.2  EXISTING NAME AND OWNER IS STILL ACTIVE           36
       15.2.2.3  EXISTING NAME AND OWNER IS INACTIVE               37
     15.2.3  NAME REGISTRATION BY M NODES                          38
  15.3  NAME QUERY TRANSACTIONS                                    39
     15.3.1  QUERY BY B NODES                                      39
     15.3.2  QUERY BY P NODES                                      40
     15.3.3  QUERY BY M NODES                                      43
     15.3.4  ACQUIRE GROUP MEMBERSHIP LIST                         43
  15.4  NAME RELEASE TRANSACTIONS                                  44
     15.4.1  RELEASE BY B NODES                                    44
     15.4.2  RELEASE BY P NODES                                    44
     15.4.3  RELEASE BY M NODES                                    44
  15.5  NAME MAINTENANCE TRANSACTIONS                              45
     15.5.1  NAME REFRESH                                          45
     15.5.2  NAME CHALLENGE                                        46
     15.5.3  CLEAR NAME CONFLICT                                   47
  15.6  ADAPTER STATUS TRANSACTIONS                                47

16.  NetBIOS SESSION SERVICE                                       48
  16.1  OVERVIEW OF NetBIOS SESSION SERVICE                        49
     16.1.1  SESSION ESTABLISHMENT PHASE OVERVIEW                  49
       16.1.1.1  RETRYING AFTER BEING RETARGETTED                  50
       16.1.1.2  SESSION ESTABLISHMENT TO A GROUP NAME             51
     16.1.2  STEADY STATE PHASE OVERVIEW                           51
     16.1.3  SESSION TERMINATION PHASE OVERVIEW                    51
  16.2  SESSION ESTABLISHMENT PHASE                                52
  16.3  SESSION DATA TRANSFER PHASE                                54
     16.3.1  DATA ENCAPSULATION                                    54
     16.3.2  SESSION KEEP-ALIVES                                   54

17.  NETBIOS DATAGRAM SERVICE                                      55
  17.1  OVERVIEW OF NetBIOS DATAGRAM SERVICE                       55
     17.1.1  UNICAST, MULTICAST, AND BROADCAST                     55
     17.1.2  FRAGMENTATION OF NetBIOS DATAGRAMS                    55
  17.2  NetBIOS DATAGRAMS BY B NODES                               57
  17.3  NetBIOS DATAGRAMS BY P AND M NODES                         58

18.  NODE CONFIGURATION PARAMETERS                                 58

19.  MINIMAL CONFORMANCE                                           59

REFERENCES                                                         60

APPENDIX A                                                         61

INTEGRATION WITH INTERNET GROUP MULTICASTING                       61
  A-1.  ADDITIONAL PROTOCOL REQUIRED IN B AND M NODES              61
  A-2.  CONSTRAINTS                                                61

APPENDIX B                                                         62

IMPLEMENTATION CONSIDERATIONS                                      62
  B-1.  IMPLEMENTATION MODELS                                      62
     B-1.1  MODEL INDEPENDENT CONSIDERATIONS                       63
     B-1.2  SERVICE OPERATION FOR EACH MODEL                       63
  B-2.  CASUAL AND RESTRICTED NetBIOS APPLICATIONS                 64
  B-3.  TCP VERSUS SESSION KEEP-ALIVES                             66
  B-4.  RETARGET ALGORITHMS                                        67
  B-5.  NBDD SERVICE                                               68
  B-6.  APPLICATION CONSIDERATIONS                                 68
     B-6.1  USE OF NetBIOS DATAGRAMS                               68

1. STATUS OF THIS MEMO ๐Ÿ’–

okay so this is a proposed standard for the whole Internet community ๐ŸŽ€ NetBIOS-over-TCP is brand new to everyone, so they're literally begging for feedback. Discussions and suggestions are specifically requested, bestie, so speak up! ๐Ÿ—ฃ๏ธ

Drop your written comments here:

Karl Auerbach
Epilogue Technology Corporation
P.O. Box 5432
Redwood City, CA   94063

Online comments go to:

Avnish Aggarwal
        Internet: mtxinu!excelan!avnish@ucbvax.berkeley.edu
        Usenet:   ucbvax!mtxinu!excelan!avnish

Distribution of this document is unlimited ๐ŸŒˆ share it with everyone who needs it.

2. ACKNOWLEDGEMENTS ๐Ÿซถ

This RFC was developed under the auspices of the Internet Activities Board ๐Ÿ‘‘, especially the End-to-End Services Task Force. The whole squad that made it happen:

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

Now the tea โ˜•: the system this RFC proposes does not reflect any existing Netbios-over-TCP implementation. BUT the design still soaks up a ton of knowledge from earlier implementations. Huge thanks to these organizations for sharing that invaluable info ๐Ÿ’œ:

CMC/Syros      Excelan        Sytek          Ungermann-Bass

3. INTRODUCTION ๐Ÿฆ‹

okay so this RFC walks you through the ideas and general methods for bringing NetBIOS onto a TCP and UDP foundation โœจ The detailed stuff (packet formats, protocols, and defined constants and variables) lives in a companion RFC, "Protocol Standard For a NetBIOS Service on a TCP/UDP Transport: Detailed Specifications"[1].

NetBIOS has become the dominant mechanism for personal computer networking ๐Ÿ’ป It gives you a vendor independent interface for the IBM Personal Computer (PC) and compatible systems.

Here's the lowkey tricky part ๐Ÿ™ˆ NetBIOS defines a software interface, not a protocol. There's no "official" NetBIOS service standard. In practice, people use the IBM PC-Network version as the reference. That version is described in the IBM document 6322916, "Technical Reference PC Network"[2].

Protocols supporting NetBIOS services have been built on all kinds of protocol and hardware foundations. Even when two systems share the same foundation, different implementations might not interoperate unless they use a common protocol. So to get NetBIOS talking across the Internet, this RFC defines a standard protocol that supports NetBIOS services using TCP and UDP ๐ŸŒธ

NetBIOS has mostly stayed on personal computers so far. But bigger computers are super well suited to run certain NetBIOS apps, like file servers, so this spec is designed to let an implementation be built on virtually any type of system where the TCP/IP protocol suite is available ๐Ÿงš

This standard defines a set of protocols to support NetBIOS services.

These protocols are way more than a simple two-entity communications service. This note describes a distributed system where many entities play a part, even if they aren't the end-point of a particular NetBIOS connection ๐Ÿ•ธ๏ธ

This standard neither constrains nor determines how those services are presented to application programs.

That said, it's expected that on computers running PC-DOS and MS-DOS, implementors will preserve the existing NetBIOS interface ๐Ÿ’…

NOTE: Various symbolic values are used in this document. For their definitions, refer to the Detailed Specifications[1].

4. DESIGN PRINCIPLES ๐Ÿ’…

The crew adopted a few design principles to guide the whole effort. Most are totally typical for any protocol standardization project, but a few got priorities that might seem a bit unusual ๐Ÿ‘€

4.1. PRESERVE NetBIOS SERVICES ๐Ÿ’–

Since there's no "official" standard for NetBIOS services, the version found in the IBM PC Network Technical Reference[2] is the one used.

NetBIOS is the foundation of a huge pile of existing apps ๐Ÿ“ฆ It's desirable to run these apps on TCP networks and extend them beyond personal computers into bigger hosts. So NetBIOS on TCP MUST closely conform to the services offered by existing NetBIOS systems.

IBM PC-Network NetBIOS has some implementation-specific quirks. This standard doesn't try to fully preserve those. Some existing software definitely depends on them, so it will fail to work correctly on a NetBIOS service based on this RFC. Not ideal, but that's the tea โ˜•

4.2. USE EXISTING STANDARDS ๐Ÿ”

Protocol development, especially with standardization, is a demanding process ๐Ÿ˜ฉ So developing new protocols MUST be minimized.

It's considered essential to always pick an existing standard that gives the needed functionality with reasonable performance, instead of inventing a new protocol ๐Ÿ™Œ

When a standard protocol is used, it MUST be unmodified.

4.3. MINIMIZE OPTIONS ๐ŸŽ€

NetBIOS on TCP SHOULD contain few, if any, options. Less is more, bestie.

Where options are included, they SHOULD be designed so that devices with different option selections SHOULD interoperate ๐Ÿซถ

4.4. TOLERATE ERRORS AND DISRUPTIONS ๐ŸŒช๏ธ

NetBIOS networks usually live in an uncontrolled environment ๐Ÿ˜ญ Computers come online at random times, they usually drop offline without telling their peers, and the software is often run by users who don't know much about networks and might randomly poke at config settings.

Despite all that chaos, NetBIOS networks work! So NetBIOS on TCP MUST also be able to operate well in this environment ๐Ÿ’ช

Robust operation doesn't mean the network is proof against every disruption. A typical NetBIOS network can still get knocked over by certain kinds of behavior, whether it's accidental or on purpose ๐Ÿ’€

4.5. DO NOT REQUIRE CENTRAL MANAGEMENT ๐Ÿ™…โ€โ™€๏ธ

NetBIOS on TCP SHOULD be able to operate, if desired, without centralized management beyond what a typical TCP-based network already needs ๐Ÿงš

4.6. ALLOW INTERNET OPERATION ๐ŸŒ

The proposed standard recognizes that NetBIOS needs to work across a set of networks connected by network (IP) level relays (gateways) โœจ

Still, the standard assumes this kind of operation will be less frequent than on the local MAC bridged-LAN ๐Ÿ 

4.7. MINIMIZE BROADCAST ACTIVITY ๐Ÿ“ข

The standard pre-supposes that the only broadcast services are the ones supported by UDP. Multicast capabilities aren't assumed to be available in any form ๐Ÿ™ˆ

Even with broadcast available, the standard knows some administrations may want to avoid heavy broadcast activity. For example, an administration might want to spare isolated non-participating hosts from the burden of receiving and discarding NetBIOS broadcasts ๐Ÿซ 

4.8. PERMIT IMPLEMENTATION ON EXISTING SYSTEMS ๐Ÿ–ฅ๏ธ

The NetBIOS on TCP protocol SHOULD be implementable on common operating systems, like Unix(tm) and VAX/VMS(tm), without massive effort ๐Ÿ’…

The NetBIOS protocols SHOULD NOT require services that are typically unavailable on presently existing TCP/UDP/IP implementations. No extra homework for anyone! ๐ŸŒท

4.9. REQUIRE ONLY THE MINIMUM NECESSARY TO OPERATE ๐ŸŽฏ

The protocol definition SHOULD specify only the minimal set of protocols needed for interoperation. Extra protocol elements MAY be defined to boost efficiency. These latter elements MAY be generated at the sender's option, although they MUST be accepted by all receivers ๐Ÿซถ

4.10. MAXIMIZE EFFICIENCY โšก

To be useful, a protocol MUST conduct its business quickly. No lag allowed, periodt ๐Ÿ’…

4.11. MINIMIZE NEW INVENTIONS ๐Ÿ’ก

When an existing protocol isn't quite able to support a needed function, but a small change could make it work, that protocol SHOULD be used. It's easier to achieve than building a brand new protocol, and it's likely to have more general use across the Internet ๐Ÿฆ‹

5. OVERVIEW OF NetBIOS ๐ŸŒˆ

This section explains the NetBIOS services. It's just background info, so the reader may choose to skip ahead to the next section ๐Ÿ™ƒ

NetBIOS was designed for groups of PCs sharing a broadcast medium ๐Ÿ–ง Both connection (Session) and connectionless (Datagram) services are provided, and broadcast and multicast are supported. Participants are identified by name, and name assignment is distributed and highly dynamic ๐ŸŽ€

NetBIOS apps use NetBIOS mechanisms to locate resources, set up connections, send and receive data with an application peer, and tear connections down. For discussion purposes, all of these mechanisms together get called the NetBIOS Service โœจ

This service can be implemented in lots of different ways. One of the first implementations was for personal computers running PC-DOS and MS-DOS. It's also possible to implement NetBIOS within other operating systems, or as processes that are simply application programs as far as the host OS is concerned ๐Ÿงš

The NetBIOS specification, published by IBM as "Technical Reference PC Network"[2], defines the interface and services available to the NetBIOS user. The protocols in that document only pertain to the IBM PC Network and aren't generally applicable to other networks ๐Ÿ™ˆ

5.1. INTERFACE TO APPLICATION PROGRAMS ๐Ÿ’ป

NetBIOS on personal computers includes both a set of services and an exact program interface to those services. NetBIOS on other computer systems may present the NetBIOS services to programs using other interfaces. Outside of personal computers, no clear standard for a NetBIOS software interface has emerged yet ๐ŸŒธ

5.2. NAME SERVICE โœจ

okay so NetBIOS resources are referenced by name ๐ŸŽ€. Lower-level address information is not available to NetBIOS applications, so you never see the address stuff. An application, representing a resource, registers one or more names that it wishes to use.

The name space is flat and uses sixteen alphanumeric characters. Names may not start with an asterisk (*). ๐Ÿ’…

Registration is a bid for use of a name. The bid may be for exclusive (unique) or shared (group) ownership. Each application contends with the other applications in real time. Implicit permission is granted to a station when it receives no objections. That is, a bid is made and the application waits for a period of time. If no objections are received, the station assumes that it has permission. ๐Ÿซถ

A unique name should be held by only one station at a time. However, duplicates ("name conflicts") may arise due to errors. ๐Ÿ˜ญ

All instances of a group name are equivalent. โœจ

An application referencing a name generally does not know (or care) whether the name is registered as a unique or a group name. honestly iconic, the app just doesn't care ๐Ÿ’œ

An explicit name deletion function is specified, so that applications may remove a name. Implicit name deletion occurs when a station ceases operation. In the case of personal computers, implicit name deletion is a frequent occurrence. ๐Ÿ’€

The Name Service primitives are:

  1. Add Name: The requesting application wants exclusive use of the name.
  2. Add Group Name: The requesting application is willing to share use of the name with other applications.
  3. Delete Name: The application no longer requires use of the name. It is important to note that typical use of NetBIOS is among independently-operated personal computers. A common way to stop using a PC is to turn it off; in this case, the graceful give-back mechanism, provided by the Delete Name function, is not used. Because this occurs frequently, the network service must support this behavior. ๐Ÿ“

5.3. SESSION SERVICE ๐Ÿฆ‹

A session is a reliable message exchange, conducted between a pair of NetBIOS applications. Sessions are full-duplex, sequenced, and reliable. Data is organized into messages. Each message may range in size from 0 to 131,071 bytes. No expedited or urgent data capabilities are present. no rush lanes here, bestie ๐Ÿšฆ

Multiple sessions may exist between any pair of calling and called names. ๐ŸŒธ

The parties to a connection have access to the calling and called names. ๐Ÿ‘€

The NetBIOS specification does not define how a connection request to a shared (group) name resolves into a session. The usual assumption is that a session may be established with any one owner of the called group name. ๐Ÿงš

An important service provided to NetBIOS applications is the detection of sessions failure. The loss of a session is reported to an application via all of the outstanding service requests for that session. For example, if the application has only a NetBIOS receive primitive pending and the session terminates, the pending receive will abort with a termination indication. ๐Ÿ˜ฑ

Session Service primitives are:

  1. Call: Initiate a session with a process that is listening under the specified name. The calling entity must indicate both a calling name (properly registered to the caller) and a called name.
  2. Listen: Accept a session from a caller. The listen primitive may be constrained to accept an incoming call from a named caller. Alternatively, a call may be accepted from any caller.
  3. Hang Up: Gracefully terminate a session. All pending data is transferred before the session is terminated.
  4. Send: Transmit one message. A time-out can occur. A time-out of any session send forces the non-graceful termination of the session.

A "chain send" primitive is required by the PC NetBIOS software interface to allow a single message to be gathered from pieces in various buffers. Chain Send is an interface detail and does not effect the protocol.

  1. Receive: Receive data. A time-out can occur. A time-out on a session receive only terminates the receive, not the session, although the data is lost.

The receive primitive may be implemented with variants, such as "Receive Any", which is required by the PC NetBIOS software interface. Receive Any is an interface detail and does not effect the protocol.

  1. Session Status: Obtain information about all of the requestor's sessions, under the specified name. No network activity is involved.

5.4. DATAGRAM SERVICE ๐Ÿ“ฌ

The Datagram service is an unreliable, non-sequenced, connectionless service. Datagrams are sent under cover of a name properly registered to the sender. ๐Ÿ•ถ๏ธ

Datagrams may be sent to a specific name or may be explicitly broadcast. ๐Ÿ“ฃ

Datagrams sent to an exclusive name are received, if at all, by the holder of that name. Datagrams sent to a group name are multicast to all holders of that name. The sending application program cannot distinguish between group and unique names and thus must act as if all non-broadcast datagrams are multicast. so yeah, always assume it's a group chat ๐Ÿ’ฌ

As with the Session Service, the receiver of the datagram is told the sending and receiving names. ๐Ÿซถ

Datagram Service primitives are:

  1. Send Datagram: Send an unreliable datagram to an application that is associated with the specified name. The name may be unique or group; the sender is not aware of the difference. If the name belongs to a group, then each member is to receive the datagram.
  2. Send Broadcast Datagram: Send an unreliable datagram to any application with a Receive Broadcast Datagram posted.
  3. Receive Datagram: Receive a datagram sent by a specified originating name to the specified name. If the originating name is an asterisk, then the datagram may have been originated under any name.

Note: An arriving datagram will be delivered to all pending Receiving Datagrams that have source and destination specifications matching those of the datagram. In other words, if a program (or group of programs) issue a series of identical Receive Datagrams, one datagram will cause the entire series to complete. ๐ŸŒ€

  1. Receive Broadcast Datagram: Receive a datagram sent as a broadcast.

If there are multiple pending Receive Broadcast Datagram operations pending, all will be satisfied by the same received datagram. ๐Ÿ“ก


5.5. MISCELLANEOUS FUNCTIONS ๐Ÿงฐ

The following functions are present to control the operation of the hardware interface to the network. These functions are generally implementation dependent. โš™๏ธ

  1. Reset: Initialize the local network adapter.
  2. Cancel: Abort a pending NetBIOS request. The successful cancel of a Send (or Chain Send) operation will terminate the associated session.
  3. Adapter Status: Obtain information about the local network adapter or of a remote adapter.
  4. Unlink: For use with Remote Program Load (RPL). Unlink redirects the PC boot disk device back to the local disk. See the NetBIOS specification for further details concerning RPL and the Unlink operation (see page 2-35 in [2]).
  5. Remote Program Load: Remote Program Load (RPL) is not a NetBIOS function. It is a NetBIOS application defined by IBM in their NetBIOS specification (see pages 2-80 through 2-82 in [2]). ๐Ÿงฉ

5.6. NON-STANDARD EXTENSIONS ๐ŸŒˆ

The IBM Token Ring implementation of NetBIOS has added at least one new user capability:

  1. Find Name: This function determines whether a given name has been registered on the network. ๐Ÿ”

6. NetBIOS FACILITIES SUPPORTED BY THIS STANDARD ๐Ÿ’–

The protocol specified by this standard permits an implementer to provide all of the NetBIOS services as described in the IBM "Technical Reference PC Network"[2]. ๐ŸŽ€

The following NetBIOS facilities are outside the scope of this specification. These are local implementation matters and do not impact interoperability:

  • RESET
  • SESSION STATUS
  • UNLINK
  • RPL (Remote Program Load)

7. REQUIRED SUPPORTING SERVICE INTERFACES AND DEFINITIONS ๐Ÿงฑ

The protocols described in this RFC require service interfaces to the following:

  • TCP[3,4]
  • UDP[5]

Byte ordering, addressing conventions (including addresses to be used for broadcasts and multicasts) are defined by the most recent version of:

  • Assigned Numbers[6]

Additional definitions and constraints are in:

  • IP[7]
  • Internet Subnets[8,9,10]

The design of the protocols described in this RFC allow for the future incorporation of the following protocols and services. However, before this may occur, certain extensions may be required to the protocols defined in this RFC or to those listed below.

  • Domain Name Service[11,12,13,14]
  • Internet Group Multicast[15,16]

9. NetBIOS SCOPE ๐Ÿ—บ๏ธ

A "NetBIOS Scope" is the population of computers across which a registered NetBIOS name is known. NetBIOS broadcast and multicast datagram operations must reach the entire extent of the NetBIOS scope. the whole squad has to get the message ๐Ÿ“ฃ

An internet may support multiple, non-intersecting NetBIOS Scopes. ๐Ÿง

Each NetBIOS scope has a "scope identifier". This identifier is a character string meeting the requirements of the domain name system for domain names. ๐Ÿท๏ธ

NOTE: Each implementation of NetBIOS-over-TCP must provide mechanisms to manage the scope identifier(s) to be used.

Control of scope identifiers implies a requirement for additional NetBIOS interface capabilities. These may be provided through extensions of the user service interface or other means (such as node configuration parameters.) The nature of these extensions is not part of this specification. ๐Ÿ› ๏ธ

10. NetBIOS END-NODES ๐Ÿ–ฅ๏ธ

End-nodes support NetBIOS service interfaces and contain applications. โœจ

Three types of end-nodes are part of this standard:

  • Broadcast ("B") nodes
  • Point-to-point ("P") nodes
  • Mixed mode ("M") nodes

An IP address may be associated with only one instance of one of the above types. ๐Ÿ”’

Without having preloaded name-to-address tables, NetBIOS participants are faced with the task of dynamically resolving references to one another. This can be accomplished with broadcast or mediated point-to-point communications. ๐Ÿค

B nodes use local network broadcasting to effect a rendezvous with one or more recipients. P and M nodes use the NetBIOS Name Server (NBNS) and the NetBIOS Datagram Distribution Server (NBDD) for this same purpose. ๐Ÿ“ฎ

End-nodes may be combined in various topologies. No matter how combined, the operation of the B, P, and M nodes is not altered. ๐Ÿงฉ

NOTE: It is recommended that the administration of a NetBIOS scope avoid using both M and B nodes within the same scope. A NetBIOS scope should contain only B nodes or only P and M nodes.

10.1. BROADCAST (B) NODES ๐Ÿ“ก

Okay so B ("broadcast") nodes talk using a mix of UDP datagrams (both broadcast AND directed) plus TCP connections ๐Ÿ’…. B nodes can freely interoperate with each other inside a broadcast area, and a broadcast area is a single MAC-bridged "B-LAN" ๐Ÿฆ‹. (If you want the tea on using Internet Group Multicasting to stretch a broadcast area past one B-LAN, check Appendix A ๐Ÿ‘€.)

10.2. POINT-TO-POINT (P) NODES ๐ŸŽ€

P nodes are giving "no broadcast for me" energy ๐Ÿ™…โ€โ™€๏ธ. They use only directed UDP datagrams and TCP sessions. They neither generate nor listen for broadcast UDP packets. BUT they still get NetBIOS-level broadcast and multicast services, thanks to the NBNS and NBDD (more on those in a sec ๐Ÿงš).

P nodes rely on NetBIOS name and datagram distribution servers. Those servers can be local or remote, and P nodes operate the same either way ๐Ÿซถ.

10.3. MIXED MODE (M) NODES ๐ŸŒˆ

Mixed mode nodes ("M") are basically P nodes that picked up some B node traits โœจ. M nodes use both broadcast and unicast. Broadcast is used to improve response time, because the assumption is that most resources live on the local broadcast medium instead of somewhere out in an internet ๐ŸŒธ.

M nodes rely upon NBNS and NBDD servers. However, they can keep up limited operation if those servers are temporarily unavailable ๐Ÿ’ช.


11. NetBIOS SUPPORT SERVERS ๐Ÿ›Ÿ

Two types of support servers are part of this standard:

  • NetBIOS name server ("NBNS") nodes
  • Netbios datagram distribution ("NBDD") nodes

NBNS and NBDD nodes are invisible to NetBIOS applications. They're part of the underlying NetBIOS mechanism, so the apps never see them ๐Ÿ™ˆ.

NetBIOS name and datagram distribution servers are the main focus of name and datagram activity for P and M nodes ๐ŸŽฏ.

Both the name (NBNS) and datagram distribution (NBDD) servers are permitted to shift part of their operation to the P or M end-node that's requesting a service ๐Ÿ”„.

Since the assignment of responsibility is dynamic, and since P and M nodes must be prepared to operate should the NetBIOS server delegate control to the maximum extent, the system naturally accommodates improvements in NetBIOS server function. For example, as Internet Group Multicasting becomes more widespread, new NBDD implementations may elect to assume full responsibility for NetBIOS datagram distribution ๐Ÿ”ฅ.

Interoperability between different implementations is assured by imposing requirements on end-node implementations that they be able to accept the full range of legal responses from the NBNS or NBDD ๐Ÿค.

11.1. NetBIOS NAME SERVER (NBNS) NODES ๐Ÿ“‹

The NBNS is designed to be super flexible about how much responsibility it takes for the accuracy and management of NetBIOS names ๐Ÿ’…. On one hand, the NBNS may elect not to accept full responsibility, which makes it basically a "bulletin board" where P and M nodes freely post (and remove) name/address info without any validation from the NBNS ๐Ÿ“Œ. On the other hand, the NBNS may elect to completely manage and validate names. The NBNS asserts how much responsibility it's taking each time a name is claimed, through a simple mechanism. If the NBNS doesn't assert full control, it returns enough info to the requesting node so that the node can challenge any putative holder of the name โš”๏ธ.

This ability to shift responsibility for NetBIOS name management between the NBNS and the P and M nodes lets a network administrator (or vendor) trade off between NBNS simplicity, security, and delay characteristics โš–๏ธ.

A single NBNS may be implemented as a distributed entity, such as the Domain Name Service. However, this RFC does not attempt to define the internal communications that would be used ๐Ÿคทโ€โ™€๏ธ.

11.1.1. RELATIONSHIP OF THE NBNS TO THE DOMAIN NAME SYSTEM ๐ŸŒ

The NBNS design tries to line itself up with the Domain Name System in a bunch of ways ๐Ÿ’–.

First, the NetBIOS names are encoded in a form that's acceptable to the domain name system.

Second, a scope identifier is appended to each NetBIOS name. This identifier meets the restricted character set of the domain system and has a leading period. So the NetBIOS name, together with its scope identifier, becomes a valid domain system name ๐ŸŽ€.

Third, the negotiated responsibility mechanisms let the NBNS be used as a simple bulletin board where (name,address) pairs get posted. This parallels the existing domain system query service ๐Ÿซง.

This RFC, however, requires the NBNS to provide services beyond what the current domain name system provides. The team tried to coalesce all the extra services into a set of transactions that follow domain name system styles of interaction and packet formats ๐Ÿงฉ.

Among the areas where the domain name service must be extended before it can be used as an NBNS are:

  • Dynamic addition of entries
  • Dynamic update of entry data
  • Support for multiple instance (group) entries
  • Support for entry time-to-live values and ability to accept refresh messages to restart the time-to-live period
  • New entry attributes

11.2. NetBIOS DATAGRAM DISTRIBUTION SERVER (NBDD) NODES ๐Ÿš€

The internet doesn't support broadcasting or multicasting yet ๐Ÿ˜ญ. The NBDD extends NetBIOS datagram distribution service into this environment.

The NBDD may elect to complete, partially complete, or totally refuse to service a node's request to distribute a NetBIOS datagram ๐Ÿ™…โ€โ™€๏ธ. An end-node may query an NBDD to find out whether the NBDD will deliver a datagram to a specific NetBIOS name ๐Ÿ”.

The design of NetBIOS-over-TCP lends itself to the use of Internet Group Multicast. For details see Appendix A ๐Ÿฆ‹.

11.3. RELATIONSHIP OF NBNS AND NBDD NODES ๐Ÿ’œ

This RFC defines the NBNS and NBDD as distinct, separate entities. They're two different girlies ๐Ÿ‘ฏโ€โ™€๏ธ.

In the absence of NetBIOS name information, a NetBIOS datagram distribution server must send a copy to each end-node within a NetBIOS scope ๐Ÿ“ฌ.

An implementer may elect to construct NBNS and NBDD nodes that have a private protocol for exchanging NetBIOS name information. Alternatively, an NBNS and NBDD may be implemented within the same device ๐Ÿงƒ.

NOTE: Implementations containing private NBNS-NBDD protocols or combined NBNS-NBDD functions must be clearly identified.

11.4. RELATIONSHIP OF NetBIOS SUPPORT SERVERS AND B NODES ๐Ÿ™ƒ

As defined in this RFC, neither NBNS nor NBDD nodes interact with B nodes. NetBIOS servers don't listen to broadcast traffic on any broadcast area they might be attached to. Nor are the NetBIOS support servers even aware of B node activities or of names claimed or used by B nodes ๐Ÿซฃ.

It may be possible to extend both the NBNS and NBDD so that they participate in B node activities and act as a bridge to P and M nodes. However, those extensions are beyond the scope of this specification ๐Ÿšง.


12. TOPOLOGIES ๐Ÿ—บ๏ธ

B, P, M, NBNS, and NBDD nodes can be combined in various ways to form useful NetBIOS environments โœจ. This section describes some of these combos.

There are three classes of operation:

  • Class 0: B nodes only.
  • Class 1: P nodes only.
  • Class 2: P and M nodes together.

In the drawings that follow, any P node may be replaced by an M node. The effects of that swap are mentioned with each example below ๐ŸŽจ.

12.1. LOCAL ๐Ÿ 

A NetBIOS scope is operating locally when all entities are within the same broadcast area ๐Ÿ’….

12.1.1. B NODES ONLY ๐Ÿ“ข

Local operation with only B nodes is the most basic mode of operation ๐ŸŒฑ. Name registration and discovery procedures use broadcast mechanisms. The NetBIOS scope is limited by the extent of the broadcast area. This configuration does not require NetBIOS support servers ๐Ÿ™Œ.

====+=========+=====BROADCAST AREA=====+==========+=========+====
    |         |                        |          |         |
    |         |                        |          |         |
 +--+--+   +--+--+                  +--+--+    +--+--+   +--+--+
 |  B  |   |  B  |                  |  B  |    |  B  |   |  B  |
 +-----+   +-----+                  +-----+    +-----+   +-----+

12.1.2. P NODES ONLY ๐Ÿ”‡

This configuration would typically be used when the network administrator wants to eliminate NetBIOS as a source of broadcast activity ๐Ÿคซ.

====+=========+==========+=B'CAST AREA=+==========+=========+====
    |         |          |             |          |         |
    |         |          |             |          |         |
 +--+--+   +--+--+    +--+--+       +--+--+    +--+--+   +--+--+
 |  P  |   |  P  |    |NBNS |       |  P  |    |NBDD |   |  P  |
 +-----+   +-----+    +-----+       +-----+    +-----+   +-----+

This configuration operates the same as if it were in an internet, and it's only mentioned here because it's a convenient way to reduce the use of broadcast ๐Ÿง˜โ€โ™€๏ธ.

Replacing one or more of the P nodes with M nodes won't affect the operation of the other P and M nodes. P and M nodes will be able to interact with one another. Because M nodes use broadcast, overall broadcast activity will increase ๐Ÿ“ˆ.

12.1.3. MIXED B AND P NODES ๐ŸฅŠ

B and P nodes do not interact with one another. Replacing P nodes with M nodes will allow B's and M's to interact ๐Ÿค.

NOTE: B nodes and M nodes may be intermixed only on a local broadcast area. B and M nodes should not be intermixed in an internet environment.

12.2. INTERNET ๐ŸŒ

12.2.1. P NODES ONLY ๐Ÿ›ฐ๏ธ

P nodes may be scattered at various locations in an internetwork. They require both an NBNS and an NBDD for NetBIOS name and datagram support, respectively ๐Ÿงญ.

The NetBIOS scope is determined by the NetBIOS scope identifier (domain name) used by the various P (and M) nodes. An internet may contain numerous NetBIOS scopes ๐ŸŒธ.

                   +-----+
                   |  P  |
                   +--+--+              |    +-----+
                      |                 |----+  P  |
                      |                 |    +-----+
                /-----+-----\           |
   +-----+      |           |  +------+ |    +-----+
   |  P  +------+  INTERNET +--+G'WAY |-+----+  P  |
   +-----+      |           |  +------+ |    +-----+
                /-----+-----/           |
              /       |                 |    +-----+
            /         |                 |----+  P  |
     +-----+       +--+--+              |    +-----+
     |NBNS +       |NBDD |
     +-----+       +--+--+

Any P node may be replaced by an M node with no loss of function to any node. However, broadcast activity will increase in the broadcast area to which the M node is attached ๐Ÿ“ฃ.

12.2.2. MIXED M AND P NODES ๐ŸŒˆ

okay so M and P nodes can totally hang out together in the same network ๐Ÿ’…. When M nodes go looking for names, they lowkey prefer names held by other M nodes on their own common broadcast area ๐Ÿ . They check those before they go hunting for names held by P nodes or by M nodes somewhere else in the network ๐Ÿงš.

                         +-----+
                         |  P  |
                         +--+--+
                            |
                            |
                      /-----+-----\
         +-----+      |           |      +-----+
         |  P  +------+  INTERNET +------+NBDD |
         +-----+      |           |      +-----+
                      /-----+-----/
                    /       |
                  /         |
           +-----+       +--+--+
           |NBNS +       |G'WAY|
           +-----+       +--+--+
                            |
                            |
   ====+=========+==========+=B'CAST AREA=+==========+=========+====
       |         |          |             |          |         |
       |         |          |             |          |         |
    +--+--+   +--+--+    +--+--+       +--+--+    +--+--+   +--+--+
    |  M  |   |  P  |    |  M  |       |  P  |    |  M  |   |  P  |
    +-----+   +-----+    +--+--+       +-----+    +-----+   +-----+
๐Ÿšจ NOTE: B and M nodes should not be intermixed in an internet environment. Doing so would allow undetected NetBIOS name conflicts to arise and cause unpredictable behavior. bestie this one is NOT it ๐Ÿ’€

13. GENERAL METHODS โœจ

so on top of the specific protocols we're getting to later, there are a few general ways entities interact with each other ๐Ÿฆ‹.

13.1. REQUEST/RESPONSE INTERACTION STYLE ๐Ÿ’Œ

most interactions go like this: a request flows one way, and then a response comes back the other way ๐Ÿ”.

when interactions happen over unreliable transports (aka UDP) or when a request gets broadcast, requests and responses may not have a strict interlocking or one-to-one relationship ๐Ÿคทโ€โ™€๏ธ.

but in no case is more than one response generated for a received request โŒ. and while a response is still pending, the responding entity may send one or more wait acknowledgements โณ.

13.1.1. RETRANSMISSION OF REQUESTS ๐Ÿ”„

UDP is an unreliable delivery mechanism ๐Ÿ˜ญ. packets can get lost, arrive out of transmit sequence, get duplicated, and delivery can be significantly delayed. since the NetBIOS protocols use UDP a LOT, they had to compensate for its unreliability with extra mechanisms ๐Ÿ› ๏ธ.

each NetBIOS packet has all the necessary information to process it on its own ๐ŸŽ€. none of the protocols use multiple UDP packets to convey a single request or response. if more information is required than will fit in a single UDP packet (for example, when a P-type node wants all the owners of a group name from a NetBIOS server), a TCP connection is used instead ๐Ÿงต. so the NetBIOS protocols won't fail just because UDP packets arrive out of sequence ๐Ÿ™Œ.

to overcome the loss of a request or response packet, each request operation will retransmit the request if a response isn't received within a specified time limit โฐ.

protocol operations that are sensitive to successive response packets, like name conflict detection, are protected from duplicated packets. they ignore successive packets with the same NetBIOS information ๐Ÿ›ก๏ธ. since no state on the responder's node is associated with a request, the responder just sends the appropriate response whenever a request packet arrives. so duplicate or delayed request packets have no impact ๐Ÿซถ.

for all requests, if a response packet is delayed too long, another request packet will be transmitted ๐Ÿ”. a second response packet sent in response to that second request packet is equivalent to a duplicate packet, so the protocols will ignore the second packet received ๐Ÿ™ˆ. and if the delivery of a response is delayed until after the request operation has already completed (successfully or not), that response packet gets ignored ๐Ÿ’€.

13.1.2. REQUESTS WITHOUT RESPONSES: DEMANDS ๐Ÿ“ฃ

some request types don't have matching responses. these are known as "demands" ๐Ÿ‘‘. in general a "demand" is an imperative request, meaning the receiving node is expected to obey ๐Ÿซก. but since demands are unconfirmed, they're only used in situations where, at most, limited damage would occur if the demand packet got lost ๐Ÿงฏ.

demand packets are not retransmitted ๐Ÿšซ.

13.2. TRANSACTIONS ๐Ÿงพ

interactions between a pair of entities are grouped into "transactions" ๐Ÿ“ฆ. a transaction is made up of one or more request/response pairs ๐Ÿ’•.

13.2.1. TRANSACTION ID ๐Ÿ†”

since multiple simultaneous transactions may be in progress between a pair of entities, a "transaction id" is used ๐ŸŽŸ๏ธ.

the originator of a transaction selects an ID that's unique to the originator ๐Ÿซต. the transaction id gets reflected back and forth in each interaction within the transaction. the transaction partners must match responses and requests by comparing the transaction ID and the IP address of the transaction partner ๐Ÿ”. if no matching request can be found, the response must be discarded ๐Ÿ—‘๏ธ.

a new transaction ID should be used for each transaction. a simple 16 bit transaction counter ought to be an adequate id generator โœจ. it's probably not necessary to search the space of outstanding transaction IDs to filter duplicates, since it's extremely unlikely that any transaction will live longer than a small fraction of the typical counter cycle period ๐Ÿ•ฐ๏ธ. using the IP addresses together with the transaction ID further reduces the possibility of damage should transaction IDs be prematurely re-used ๐Ÿ›ก๏ธ.

13.3. TCP AND UDP FOUNDATIONS ๐Ÿ—๏ธ

this version of the NetBIOS-over-TCP protocols uses UDP for many interactions. in the future, this RFC may be extended to let those interactions happen over TCP connections ๐Ÿงต. that could be useful to increase efficiency when multiple interactions happen within a short time, or when NetBIOS datagram traffic shows that an application is using NetBIOS datagrams to support connection-oriented service ๐Ÿ‘€.


14. REPRESENTATION OF NETBIOS NAMES ๐ŸŽ€

NetBIOS names as seen across the client interface to NetBIOS are exactly 16 bytes long ๐Ÿ“. inside the NetBIOS-over-TCP protocols, a longer representation is used ๐ŸŒธ.

there are two levels of encoding ๐Ÿง. the first level maps a NetBIOS name into a domain system name. the second level maps that domain system name into the "compressed" representation needed for interaction with the domain name system ๐ŸŒ.

except in one packet, the second level representation is the only NetBIOS name representation used in NetBIOS-over-TCP packet formats. the exception is the RDATA field of a NODE STATUS RESPONSE packet ๐ŸŽฏ.

14.1. FIRST LEVEL ENCODING ๐Ÿ”ค

the first level representation has two parts:

  • NetBIOS name
  • NetBIOS scope identifier

the 16 byte NetBIOS name gets mapped into a 32 byte wide field using a reversible, half-ASCII, biased encoding ๐Ÿช„. each half-octet of the NetBIOS name is encoded into one byte of the 32 byte field. the first half octet goes into the first byte, the second half-octet into the second byte, and so on ๐Ÿ”ข.

each 4-bit half-octet of the NetBIOS name is treated as an 8-bit, right-adjusted, zero-filled binary number ๐Ÿงฎ. that number gets added to the value of the ASCII character 'A' (hexidecimal 41). the resulting 8-bit number is stored in the appropriate byte โœจ. here's the diagram that shows how it works ๐Ÿ‘‡:

                         0 1 2 3 4 5 6 7
                        +-+-+-+-+-+-+-+-+
                        |a b c d|w x y z|          ORIGINAL BYTE
                        +-+-+-+-+-+-+-+-+
                            |       |
                   +--------+       +--------+
                   |                         |     SPLIT THE NIBBLES
                   v                         v
            0 1 2 3 4 5 6 7           0 1 2 3 4 5 6 7
           +-+-+-+-+-+-+-+-+         +-+-+-+-+-+-+-+-+
           |0 0 0 0 a b c d|         |0 0 0 0 w x y z|
           +-+-+-+-+-+-+-+-+         +-+-+-+-+-+-+-+-+
                   |                         |
                   +                         +     ADD 'A'
                   |                         |
            0 1 2 3 4 5 6 7           0 1 2 3 4 5 6 7
           +-+-+-+-+-+-+-+-+         +-+-+-+-+-+-+-+-+
           |0 1 0 0 0 0 0 1|         |0 1 0 0 0 0 0 1|
           +-+-+-+-+-+-+-+-+         +-+-+-+-+-+-+-+-+

this encoding means a NetBIOS name gets represented as a sequence of 32 ASCII, upper-case characters from the set {A,B,C...N,O,P} ๐Ÿ” .

the NetBIOS scope identifier is a valid domain name (without a leading dot) ๐ŸŒ.

an ASCII dot (2E in hex) and the scope identifier get appended to the encoded form of the NetBIOS name, and the result forms a valid domain name ๐Ÿ’œ.

for example, the NetBIOS name "The NetBIOS name" in the NetBIOS scope "SCOPE.ID.COM" would be represented at level one by this ASCII character string ๐ŸŽ€:

     FEGHGFCAEOGFHEECEJEPFDCAHEGBGNGF.SCOPE.ID.COM

14.2. SECOND LEVEL ENCODING ๐Ÿงฉ

the first level encoding has to be reduced to second level encoding ๐Ÿ“‰. this is done according to the rules defined on page 31 of RFC 883[12] in the section on "Domain name representation and compression". also see the section titled "Name Formats" in the Detailed Specifications[1] ๐Ÿ“š.


15. NetBIOS NAME SERVICE ๐Ÿ“ฎ

before a name can be used, it must be registered by a node ๐Ÿ“. once acquired, the name must be defended against inconsistent registration by other nodes ๐ŸฅŠ. and before building a NetBIOS session or sending a NetBIOS datagram, the one or more holders of the name must be located ๐Ÿ”Ž.

the NetBIOS name service is the collection of procedures through which nodes acquire, defend, and locate the holders of NetBIOS names ๐Ÿ’….

the name service procedures are different depending on whether the end-node is type B, P, or M ๐Ÿง .

15.1. OVERVIEW OF NetBIOS NAME SERVICE ๐ŸŒŸ

15.1.1. NAME REGISTRATION (CLAIM) ๐Ÿท๏ธ

each NetBIOS node can own more than one name. names get acquired dynamically through the registration (name claim) procedures ๐Ÿชช.

every node has a permanent unique name ๐Ÿซถ. this name, like any other name, must be explicitly registered by all end-node types ๐Ÿ“‹.

a name can be unique (exclusive) or group (non-exclusive). a unique name may be owned by a single node, while a group name may be owned by any number of nodes ๐Ÿ‘ฏ. a name ceases to exist when it's not owned by at least one node ๐Ÿ‘ป. there's no intrinsic quality of a name that determines its characteristics. those get established at the time of registration ๐Ÿ’ก.

each node keeps state information for each name it has registered. that information includes:

  • Whether the name is a group or unique name
  • Whether the name is "in conflict"
  • Whether the name is in the process of being deleted

B nodes register names by broadcasting claim requests, soliciting a defense from any node already holding the name ๐Ÿ“ข.

P nodes register names through the agency of the NBNS ๐Ÿข.

M nodes register names through an initial broadcast, like B nodes do. then, in the absence of an objection, they follow the same procedures as a P node. in other words, the broadcast action may end the attempt, but it isn't enough to confirm the registration ๐Ÿฅน.

15.1.2. NAME QUERY (DISCOVERY) ๐Ÿ”โœจ

Okay bestie, name query (also called "resolution" or "discovery") is how you find the IP address(es) tied to a NetBIOS name ๐Ÿ’… It is required during these operations:

During session establishment, the calling and called names must be specified. The calling name must exist on the node that posts the CALL. The called name must exist on a node that has previously posted a LISTEN. Either name may be a unique or group name ๐ŸŽ€

When a directed datagram is sent, a source and destination name must be specified. If the destination name is a group name, the datagram goes out to every member of that group ๐Ÿซถ

Different end-node types do name resolution in different ways, but they all use the same packet formats, which is so iconic:

  • B nodes solicit name information by broadcasting a request.
  • P nodes ask the NBNS.
  • M nodes broadcast a request. If that doesn't get them the info they want, an inquiry goes to the NBNS ๐Ÿ“ฃ

15.1.3. NAME RELEASE ๐Ÿ‘‹

NetBIOS names can be released explicitly or silently by an end-node. Silent release usually happens when an end-node fails or gets turned off ๐Ÿ’€ Most of the mechanisms below exist to detect silent name release, so pay attention, it's giving detective energy ๐Ÿ•ต๏ธโ€โ™€๏ธ

15.1.3.1. EXPLICIT RELEASE ๐Ÿ™‹โ€โ™€๏ธ

B nodes explicitly release a name by broadcasting a notice.

P nodes send a notification to their NBNS.

M nodes both broadcast a notice and inform their supporting NBNS. Double check, very responsible ๐Ÿ’œ

15.1.3.2. NAME LIFETIME AND REFRESH โณ

Names held by an NBNS get a lifetime when they're registered. The NBNS will consider a name silently released if the end-node doesn't send a name refresh message before the lifetime runs out. A refresh restarts the lifetime clock ๐Ÿ”„

NOTE: The implementor should be aware of the tradeoff between accuracy of the database and the internet overhead that the refresh mechanism introduces. The lifetime period should be tuned accordingly. ๐Ÿง 

For group names, every end-node has to send refresh messages. A node that fails to do so is considered to have silently released the name and gets dropped from the group ๐Ÿ‘‘

The lifetime is settled through a simple negotiation during name registration. In the name registration request, the end-node either proposes a lifetime value or asks for an infinite lifetime. The NBNS then puts the actual lifetime value into the name registration response. The NBNS is always allowed to answer with an infinite actual period. If the end-node asked for an infinite lifetime, the NBNS may respond with any definite period. If the end-node proposed a definite period, the NBNS may respond with any definite period greater than or equal to that one ๐Ÿฆ‹

This negotiation of refresh times gives the NBNS a way to turn refresh activity on or off. The end-nodes may set a minimum refresh cycle period ๐ŸŒธ

NBNS implementations that are completely reliable may disable refresh ๐Ÿงš

15.1.3.3. NAME CHALLENGE โš”๏ธ

To find out whether a node has silently let go of its claim to a name, it's sometimes necessary to challenge that node's current ownership. If the node defends the name, it's allowed to keep it. Otherwise, it's assumed the node has released the name ๐Ÿ™…โ€โ™€๏ธ

A name challenge may be issued by an NBNS or by a P or M node. A challenge may be aimed at any end-node type: B, P, or M ๐ŸŽฏ

15.1.3.4. GROUP NAME FADE-OUT ๐ŸŒซ๏ธ

NetBIOS groups can have an arbitrarily large number of members, and challenging all of them could take forever ๐Ÿ˜ญ

To avoid long delays when names are claimed through an NBNS, an optimistic heuristic has been adopted. It's assumed there will always be some node that defends a group name ๐Ÿ’– So the NBNS is recommended to immediately reject a claim request for a unique name when a group with the same name already exists. The NBNS will never return an IP address (in response to a NAME REGISTRATION REQUEST) when a group name exists.

An NBNS will consider a group to have faded out of existence when the last remaining member fails to send a timely refresh message or explicitly releases the name ๐Ÿ“

15.1.3.5. NAME CONFLICT โšก

Name conflict happens when a unique name has been claimed by more than one node on a NetBIOS network. B, M, and NBNS nodes may detect a name conflict. The detection mechanism used by B and M nodes is only active during name discovery. The NBNS may detect conflict at any time it checks the consistency of its name database ๐Ÿ”Ž

B and M nodes detect conflict by looking at the responses they get back from a broadcast name query request. The first response is taken as authoritative. Any later responses that don't match it are conflicts ๐Ÿ‘€

Subsequent responses are inconsistent with the authoritative response when all of this is true:

The subsequent response has the same transaction ID as the
NAME QUERY REQUEST.
AND
The subsequent response is not a duplicate of the
authoritative response.
AND EITHER:
        The group/unique characteristic of the authoritative
        response is "unique".
     OR
        The group/unique characteristic of the subsequent
        response is "unique".

The window in which B and M nodes examine responses is limited by a conflict timer, CONFLICT_TIMER. The exact accuracy or length of this timer isn't crucial, because the NetBIOS system will keep working even with persistent name conflicts ๐Ÿ™Œ

Conflict conditions get signaled by sending a NAME CONFLICT DEMAND to the node that owns the offending name. Nothing is sent to the node that sent the authoritative response ๐Ÿคซ

Any end-node that receives a NAME CONFLICT DEMAND is required to update its "local name table" to show that the name is in conflict. (The "local name table" on each node holds the names that node has successfully registered ๐Ÿ“’)

Only the nodes that receive the conflict message put a conflict mark next to a name, and that's the key part โœจ

Logically, a marked name doesn't exist on that node. That means the node should not defend the name (for name claim purposes), should not respond to name discovery requests for that name, and should not send name refresh messages for it. On top of that, the node can't use the name for any session establishment or for sending or receiving datagrams. Existing sessions aren't affected at the moment a name gets marked as in conflict ๐Ÿซง

The only valid user function against a marked name is DELETE NAME. Any other user NetBIOS function returns immediately with an error code of "NAME CONFLICT" ๐Ÿšซ

15.1.4. ADAPTER STATUS ๐Ÿ“Š

An end-node or the NBNS can ask any other end-node for a collection of info about that node's NetBIOS status. This status includes, among other things, a list of the names the node believes it owns. The returned status is filtered so it only contains names with the same NetBIOS scope identifier as the requestor's name ๐Ÿ’…

When requesting node status, the requestor identifies the target node by NetBIOS name. A name query transaction may be needed to get the IP address for that name. Locally cached name info can be used instead of a query transaction. The requesting node sends a NODE STATUS REQUEST. In response, the receiving node sends a NODE STATUS RESPONSE containing its local name table and various statistics ๐Ÿงพ

The amount of status that can come back is limited by the size of a UDP packet. Still, that's enough for a typical NODE STATUS RESPONSE packet, so no stress ๐Ÿซถ

15.1.5. END-NODE NBNS INTERACTION ๐Ÿค

There are certain characteristics of end-node to NBNS interactions that they all share, no matter which transaction type is involved ๐Ÿ’œ

15.1.5.1. UDP, TCP, AND TRUNCATION ๐Ÿ“ฆ

For all transactions between an end-node and an NBNS, either UDP or TCP can be used as the transport. If the NBNS gets a UDP-based request, it responds using UDP. If the info doesn't fit into a UDP packet, the response includes a "truncation flag". In that case, the end-node can open a TCP connection to the NBNS, repeat the request, and get a complete, untruncated response ๐Ÿช„

15.1.5.2. NBNS WACK ๐Ÿ™

While a name service request is in progress, the NBNS may send a WAIT FOR ACKNOWLEDGEMENT RESPONSE (WACK). This lets the client end-node know the NBNS is still alive and working on the request โฐ

15.1.5.3. NBNS REDIRECTION ๐Ÿงญ

The NBNS follows Domain Name System styles of interaction, so it's allowed to redirect a client to another NBNS ๐ŸŒˆ

15.1.6. SECURED VERSUS NON-SECURED NBNS ๐Ÿ”

An NBNS can be implemented in one of two general ways. It may monitor, and take part in, name activity to keep things consistent. This would be a "secured" style NBNS. Or, an NBNS may be basically a "bulletin board" where name info gets posted and responsibility for consistency is handed off to the end-nodes. This would be a "non-secured" style NBNS ๐Ÿฆ„

15.1.7. CONSISTENCY OF THE NBNS DATA BASE โœจ

okay so even in a perfectly healthy NetBIOS scope, the NBNS and its end-nodes can occasionally fall out of sync about who actually owns what name ๐Ÿ™ˆ the NBNS can lose all or part of its database if it fails (rip ๐Ÿ’€). more commonly, a P or M node gets turned off, forgets every name it registered, and then gets turned back on ๐Ÿ”Œ. and finally, errors can happen or an implementation can just be incorrect ๐Ÿ˜ญ. so the NetBIOS-over-TCP protocols have a bunch of tricks to limit the damage ๐Ÿงš

  1. Challenges ๐ŸŽ€ The NBNS (or any other node) can "challenge" an end-node with a NAME QUERY REQUEST to check that it actually owns a name.

A challenge can happen at any time. every end-node must be prepared to make a timely response ๐Ÿ’…

If the end-node doesn't respond, the NBNS considers that the end-node has released the name in question.

(if UDP is the underlying transport, the challenge, like all other requests, must be retransmitted some number of times when there's no response.)

  1. Full name table requests ๐Ÿ“ The NBNS (or any other node) can ask an end-node to deliver its entire name table using the NODE STATUS REQUEST.

This can happen at any time. Every end-node must be prepared to make a timely response.

If the end-node fails to respond, the NBNS is permitted (but not required) to consider that the end-node has failed and released all the names it had claims on. (Like the challenge, on a UDP transport, the request must be retransmitted when there's no response.)

  1. Revoking names ๐Ÿšซ The NBNS can revoke a P or M node's use of a name by sending either a NAME CONFLICT DEMAND or a NAME RELEASE REQUEST to the node.

The receiving end-node may keep going with existing sessions that use that name, but otherwise it must stop using that name ๐Ÿ›‘ If the NBNS placed the name in conflict, the name can only be re-acquired by deletion and then reclamation. If the NBNS requested that the name be released, the node may try to re-acquire the name without doing a name release transaction first.

  1. Time-to-live โณ The NBNS may put a "time-to-live" on each name it registers. The registering node finds out about this time value during the name registration procedure.

Simple or reliable NBNS's may impose an infinite time-to-live โ™พ๏ธ

  1. Refresh reports ๐Ÿ”„ If an end-node holds any names with finite time-to-live values, then that node must periodically send a status report to the NBNS. Each name gets reported using the NAME REFRESH REQUEST packet.

These status reports restart the timers of both the NBNS and the reporting node. However, only the timers tied to the name found in the status report get restarted. Timers on other names are not affected โœจ

The NBNS may consider that a node has released any name that hasn't been refreshed within some multiple of that name's time-to-live.

A well-behaved NBNS, though, would issue a challenge to, or request a list of names from, the non-reporting end-node before deleting its name(s). If there's no response, or the name isn't in the response, that confirms the NBNS's decision to delete a name ๐Ÿ‘€

  1. Reading the vibes ๐Ÿ” The absence of reports may cause the NBNS to infer that the end-node has failed. Similarly, getting info that's wildly different from what the NBNS believes about the node may cause the NBNS to consider that the end-node has restarted.

The NBNS may analyze the situation through challenges or requests for a list of names.

  1. Polling ๐Ÿ•ต๏ธ A very cautious NBNS is free to poll nodes (by sending NAME QUERY REQUEST or NODE STATUS REQUEST packets) to verify that their name status matches what's registered in the NBNS.

NOTE: Such polling activity, if an implementation uses it at all, should be kept at a very low level, or enabled only during periods when the NBNS has some reason to suspect that its information base is inaccurate.

  1. Catching mistakes at session setup ๐Ÿ™‹ P and M nodes can detect incorrect name information at session establishment.

If incorrect information is found, the NBNS is informed via a NAME RELEASE REQUEST originated by the end-node that detects the error.

15.1.8. NAME CACHING ๐Ÿ—‚๏ธ

an end-node may keep a local cache of NetBIOS name-to-IP address translation entries ๐Ÿ’œ

all cache entries should be flushed on a periodic basis โฐ

also, a node ought to flush any cache info tied to an IP address if it gets any info suggesting there might be trouble with the node at that IP address ๐Ÿšจ for example, if a NAME CONFLICT DEMAND is sent to a node, all cached info about that node should be cleared within the sending node ๐Ÿงน

15.2. NAME REGISTRATION TRANSACTIONS ๐ŸŽŸ๏ธ

15.2.1. NAME REGISTRATION BY B NODES ๐Ÿ“ฃ

a name claim transaction started by a B node gets broadcast throughout the broadcast area ๐Ÿ“ก the NAME REGISTRATION REQUEST will be heard by all B and M nodes in the area. each node checks the claim to see whether it's consistent with the names it owns. if there's an inconsistency, a NEGATIVE NAME REGISTRATION RESPONSE is unicast back to the requestor ๐Ÿ™…โ€โ™€๏ธ the requesting node gets ownership of the name (or membership in the group) if, and only if, no NEGATIVE NAME REGISTRATION RESPONSEs arrive within the name claim timeout, CONFLICT_TIMER. (check "Defined Constants and Variables" in the Detailed Specification for this timer's value ๐Ÿ”Ž)

a B node announces its new ownership by broadcasting a NAME OVERWRITE DEMAND ๐ŸŽ‰

                       B-NODE REGISTRATION PROCESS
   <-----NAME NOT ON NETWORK------>   <----NAME ALREADY EXISTS---->

   REQ. NODE                      NODE                     REQ.NODE
                                 HOLDING
                                  NAME

   (BROADCAST) REGISTER                        (BROADCAST) REGISTER
   ------------------->                        <-------------------

        REGISTER                                     REGISTER
   ------------------->                        <-------------------

        REGISTER                         NEGATIVE RESPONSE
   ------------------->             ------------------------------>

          OVERWRITE
   ------------------->               (NODE DOES NOT HAVE THE NAME)

   (NODE HAS THE NAME)

the NAME REGISTRATION REQUEST, like any request, must be repeated if no response comes back within BCAST_REQ_RETRY_TIMEOUT. sending the request is attempted BCAST_REQ_RETRY_COUNT times ๐Ÿ”

15.2.2. NAME REGISTRATION BY P NODES ๐Ÿง‘โ€๐Ÿ’ป

a name registration can go different ways depending on whether the name is new to the NBNS ๐Ÿค” if the NBNS already knows the name, challenges may be sent to the prior holder(s) ๐ŸฅŠ

15.2.2.1. NEW NAME, OR NEW GROUP MEMBER ๐ŸŒฑ

the diagram below shows what happens when an end-node registers a name that's new to the NBNS. (the diagram skips WACKs, NBNS redirections, and retransmission of requests ๐Ÿ™ˆ)

this same interaction happens if the name being registered is a group name and the group already exists. the NBNS just adds the registrant to the set of group members ๐Ÿซถ

                       P-NODE REGISTRATION PROCESS
            (server has no previous information about the name)

              P-NODE                            NBNS
                          REGISTER
                --------------------------------->

                        POSITIVE RESPONSE
                <---------------------------------

it's honestly so simple: the end-node sends a NAME REGISTRATION REQUEST, and the NBNS replies with a POSITIVE NAME REGISTRATION RESPONSE ๐Ÿ’–

15.2.2.2. EXISTING NAME AND OWNER IS STILL ACTIVE ๐ŸงŸ

this diagram shows what happens when someone tries to register a unique name, the NBNS knows about an existing owner, and that owner is still active ๐Ÿ‘€

there are two sides to the diagram. the left side shows how a non-secured NBNS handles it, and secured NBNS activity is on the right โš–๏ธ

                       P-NODE REGISTRATION PROCESS
               (server HAS a previous owner that IS active)


   <------NON-SECURED STYLE------->  <---------SECURED STYLE------->

   REQ. NODE           NBNS       NODE         NBNS         REQ.NODE
                                 HOLDING
                                  NAME

         REGISTER                                      REGISTER
   ------------------->                         <-------------------
                                       QUERY
    END-NODE CHALLENGE              <------------
   <-------------------                QUERY
                                    <------------
             QUERY
   ----------------------------->
                                     POSITIVE RESP
             QUERY                   ------------>
   ----------------------------->                 NEGATIVE RESPONSE
                                                  ----------------->

         POSITIVE RESPONSE
   <----------------------------

a non-secured NBNS answers the NAME REGISTRATION REQUEST with an END-NODE CHALLENGE REGISTRATION RESPONSE ๐Ÿ“จ this response asks the end-node to run a challenge transaction against the node named in the response. here, the prior node defends the name, and the registering end-node just drops the registration attempt without any more back-and-forth with the NBNS ๐Ÿ›ก๏ธ

a secured NBNS holds off on answering the NAME REGISTRATION REQUEST until it has challenged the prior holder(s) of the name itself ๐Ÿ•ต๏ธโ€โ™€๏ธ in this case, the NBNS finds that the name is still being defended, so it sends a NEGATIVE NAME REGISTRATION RESPONSE back to the registrant ๐Ÿ™…โ€โ™€๏ธ

since the secured NBNS might take a while to make those challenges, it's likely the NBNS will send a WACK to the registrant โณ

even though it's not in the diagram, a non-secured NBNS will send a NEGATIVE NAME REGISTRATION RESPONSE to a request to register a unique name when a group with the same name already exists ๐Ÿšซ a secured NBNS can choose to poll (or challenge) the group members to find out whether any active members remain. that can put a heavy load on the network ๐Ÿฅต so it's recommended that group names be allowed to fade-out through the name refresh mechanism ๐Ÿ‚ that's the move, bestie ๐Ÿ‘‘

โœจ๐ŸŒˆโœจ

15.2.2.3. EXISTING NAME AND OWNER IS INACTIVE ๐ŸŒธ

okay so this one's about when someone tries to register a unique name ๐ŸŽ€, the NBNS already knows who owns it, but that owner has gone quiet and isn't active anymore ๐Ÿ’€. here's the picture:

   The following diagram shows interactions when an attempt is made to
   register a unique name, the NBNS is aware of an existing owner, and
   that existing owner is no longer active.

the NBNS has two flavours here, and they handle it differently ๐Ÿ’…:

A non-secured NBNS answers the NAME REGISTRATION REQUEST with an END-NODE CHALLENGE REGISTRATION RESPONSE ๐Ÿฆ‹. that response tells the end-node to fire off a challenge transaction at the node named in the response. the old holder doesn't defend the name, so the registrant just tells the NBNS with a NAME OVERWRITE REQUEST, and the NBNS swaps the old name info in its database for the new info from the overwrite request โœจ.

a secured NBNS is way more careful ๐Ÿงš. it won't answer the NAME REGISTRATION REQUEST until it has challenged the prior holder(s) of the name itself. it finds out nobody's defending it, so it sends a POSITIVE NAME REGISTRATION RESPONSE back to the registrant ๐Ÿซถ.

                       P-NODE REGISTRATION PROCESS
             (server HAS a previous owner that is NOT active)


   <------NON-SECURED STYLE----->  <----------SECURED STYLE-------->

   REQ. NODE           NBNS     NODE           NBNS         REQ.NODE
                               HOLDING
                                NAME

         REGISTER                                    REGISTER
   ------------------->                         <-------------------
                                       QUERY
    END-NODE CHALLENGE             <------------
   <-------------------                QUERY
                                   <------------
         NAME QUERY REQUEST                        POSITIVE RESPONSE
   ---------------------->                 ------------------>
              QUERY
   ---------------------->

       OVERWRITE
   ------------------->

    POSITIVE RESPONSE
   <------------------

because the secured NBNS has to go off and do its own challenges first, it's pretty likely the NBNS will send a WACK to the registrant to say "hold on, still working on it" ๐Ÿ™ˆ. and a secured NBNS will immediately send a NEGATIVE NAME REGISTRATION RESPONSE to any NAME OVERWRITE REQUEST it gets, no exceptions ๐Ÿ’…๐Ÿ”ฅ.

15.2.3. NAME REGISTRATION BY M NODES ๐ŸŒˆ

okay M nodes are a little extra ๐Ÿ˜ญ. an M node starts its name claim the same way a B node does: it broadcasts a NAME REGISTRATION REQUEST and listens for any NEGATIVE NAME REGISTRATION RESPONSEs ๐Ÿ‘€. if even one negative response shows up, the M node can't get the name and the whole claim is over ๐Ÿ’”.

if no negative response comes back, though, the M node MUST keep going with the claim as if it were a P node ๐Ÿ’œ. and the name is only actually acquired if BOTH claims worked out ๐ŸŽ€. no shortcuts, bestie ๐Ÿ’….

here's how M node registration looks:

                       M-NODE REGISTRATION PROCESS

   <---NAME NOT IN BROADCAST AREA--> <--NAME IS IN BROADCAST AREA-->

   REQ. NODE                       NODE                     REQ.NODE
                                  HOLDING
                                   NAME

   (BROADCAST) REGISTER                         (BROADCAST) REGISTER
   ------------------->                         <-------------------

        REGISTER                                     REGISTER
   ------------------->                         <-------------------

        REGISTER                        NEGATIVE RESPONSE
   ------------------->             ------------------------------->


                 !                     (NODE DOES NOT HAVE THE NAME)
    INITIATE     !
    A P-NODE     !
    REGISTRATION !
                 V

15.3. NAME QUERY TRANSACTIONS ๐Ÿฆ‹

name query transactions are how end-nodes go hunting for the IP address(es) and other goodies attached to a NetBIOS name ๐Ÿ”โœจ.

15.3.1. QUERY BY B NODES ๐Ÿ’–

this diagram shows how B nodes figure out who owns a name ๐Ÿ‘‘.

the left half is what happens when nobody holds the name: no responses come back to the broadcast NAME QUERY REQUEST(s) ๐Ÿ™ˆ. the right half is the fun part ๐ŸŽ€. a name holder sends a POSITIVE NAME QUERY RESPONSE straight back (unicast) to the broadcast request, and it does that for every NAME QUERY REQUEST it hears. every holder does this too, so the requester can end up with a whole pile of responses, some of them duplicates, from lots of different nodes ๐ŸŒธ.

                         B-NODE DISCOVERY PROCESS


   <------NAME NOT ON NETWORK------>  <---NAME PRESENT ON NETWORK-->

      REQ. NODE                    NODE                     REQ.NODE
                                  HOLDING
                                   NAME

       (BROADCAST) QUERY                           (BROADCAST) QUERY
   ---------------------->                    <---------------------

      NAME QUERY REQUEST                          NAME QUERY REQUEST
   ---------------------->                    <---------------------

           QUERY                        POSITIVE RESPONSE
   ---------------------->           ------------------------------>

name query is usually, but not always, the warm-up before a NetBIOS session gets set up or a NetBIOS datagram gets sent ๐Ÿ’…. it can be used for other stuff too, though ๐Ÿงš.

also, a B node can choose to build a group membership list for later (say, for session setup) by collecting and saving those responses ๐Ÿ“โœจ.

15.3.2. QUERY BY P NODES ๐ŸŽ€

the NBNS answers a P node's queries with a list of IP addresses and other info for every owner of the name ๐Ÿ—‚๏ธ. if the name has more than one owner (so, a group name), the NBNS packs in as many answers as will fit into one UDP packet ๐Ÿ“ฆ. there's a truncation flag that tells you whether there's still more owner info left over ๐Ÿšฉ. and if you want all of it, you just repeat the query over a TCP connection ๐Ÿ’œ.

the NBNS is NOT REQUIRED to put its answer list in any particular order ๐Ÿ™ƒ โ€” no vibes-based sorting here.

when the NBNS has no info at all about the name, it's a quick "nope" ๐Ÿ’€:

                      P-NODE DISCOVERY PROCESS
            (server has no information about the name)

              P-NODE                            NBNS
                        NAME QUERY REQUEST
                --------------------------------->

                        NEGATIVE RESPONSE
                <---------------------------------

the next one is when the NBNS does know something about the name โœจ. it also shows the end-node re-sending its request if the answer takes too long, plus the WACKs (those temporary, in-between responses) the NBNS can send back in the meantime ๐Ÿฆ‹:

                     P-NODE QUERY PROCESS
           (server HAS information about the name)

        P-NODE                                 NBNS
                       NAME QUERY REQUEST
        /---------------------------------------->
       /
       !          (OPTIONAL)   WACK
       !  <- - - - - - - - - - - - - - - - - - - -
       !         !
       !timer    !
       !         ! (optional timer restart)
       !         !
        \        V           QUERY
         \--------------------------------------->
                              .
                              .
                              .
                            QUERY
        /---------------------------------------->
       /
       !          (OPTIONAL)   WACK
       !  <- - - - - - - - - - - - - - - - - - - -
       !         !
       !timer    !
       !         ! (optional timer restart)
       !         !
        \        V           QUERY
         \--------------------------------------->
                              .
                              .

                    POSITIVE RESPONSE
         <-----------------------------------------

and here's NBNS redirection ๐Ÿ”€. when a NAME QUERY REQUEST comes in, the NBNS can send the client off to a different NBNS ๐Ÿƒโ€โ™€๏ธ. the client then starts over from the very beginning, using the address of the newly supplied NBNS, and gets a response from there. the diagram shows a POSITIVE NAME QUERY RESPONSE for that last step, but honestly any legal NBNS response could happen in real life ๐Ÿคทโ€โ™€๏ธ:

                           NBNS REDIRECTION

              P-NODE                            NBNS
                         NAME QUERY REQUEST
                --------------------------------->

                    REDIRECT NAME QUERY RESPONSE
                <---------------------------------

       (START FROM THE
        VERY BEGINNING
        USING THE ADDRESS
        OF THE NEWLY
        SUPPLIED NBNS.)
                                                NEW
              P-NODE                            NBNS
                         NAME QUERY REQUEST
                --------------------------------->

                   POSITIVE NAME QUERY RESPONSE
                <---------------------------------

finally, this is how a P or M node tells the NBNS "hey, your info was wrong" ๐Ÿ™…โ€โ™€๏ธ๐Ÿ’…. it can kick off after a DATAGRAM ERROR packet shows up, or after a session set-up attempt finds that the NetBIOS name doesn't exist at the destination whose IP address came from the NBNS in an earlier name query ๐Ÿ˜ฌ. the NBNS (here a secure one) fires off its own queries to double-check whether the info really is wrong. then it closes out the transaction with either a POSITIVE or NEGATIVE NAME RELEASE RESPONSE, depending on what it found ๐ŸŽ€:

                 CORRECTING NBNS INFORMATION BASE

              P-NODE                            NBNS
                       NAME RELEASE REQUEST
                --------------------------------->
                                                        QUERY
                                                  ---------------->

                                                        QUERY
                                                  ---------------->

                                      (NAME TAKEN OFF THE DATABASE
                                       IF NBNS FINDS IT TO BE
                                       INCORRECT)

                    POSITIVE/NEGATIVE RESPONSE
                <---------------------------------

15.3.3. QUERY BY M NODES ๐ŸŒท

M node name queries follow the B node pattern first ๐Ÿงšโ€โ™€๏ธ. if that doesn't give enough results, the M node keeps going with a P node type query ๐Ÿ’–. here's the picture:

                       M-NODE DISCOVERY PROCESS


   <---NAME NOT ON BROADCAST AREA-->  <--NAME IS ON BROADCAST AREA->

   REQ. NODE                       NODE                     REQ.NODE
                                  HOLDING
                                   NAME

       (BROADCAST) QUERY                           (BROADCAST) QUERY
   --------------------->                    <----------------------

     NAME QUERY REQUEST                           NAME QUERY REQUEST
   --------------------->                    <----------------------

           QUERY                           POSITIVE RESPONSE
   --------------------->           ------------------------------->

                   !
       INITIATE    !
       A P-NODE    !
       DISCOVERY   !
       PROCESS     !
                   V

15.3.4. ACQUIRE GROUP MEMBERSHIP LIST โœจ

okay bestie, if you want the whole group roster ๐Ÿ“‹ you send a NAME QUERY REQUEST to the NBNS. it replies with either a POSITIVE NAME QUERY RESPONSE or a NEGATIVE NAME QUERY RESPONSE. a negative one ends the whole thing and just means the group has no members ๐Ÿ’€

if the positive response has the truncation bit clear, then the response has the entire list of group members ๐ŸŽ€ but if the truncation bit is set, you have to repeat this whole procedure, except you use TCP instead of UDP ๐Ÿซถ

15.4. NAME RELEASE TRANSACTIONS ๐Ÿฆ‹

15.4.1. RELEASE BY B NODES

so a NAME RELEASE DEMAND carries:

  • NetBIOS name
  • The scope of the NetBIOS name
  • Name type: unique or group
  • IP address of the releasing node
  • Transaction ID
REQUESTING                                     OTHER
B-NODE                                         B-NODES
                  NAME RELEASE DEMAND
           ---------------------------------->

15.4.2. RELEASE BY P NODES

a NAME RELEASE REQUEST carries:

  • NetBIOS name
  • The scope of the NetBIOS name
  • Name type: unique or group
  • IP address of the releasing node
  • Transaction ID

and a NAME RELEASE RESPONSE carries:

  • NetBIOS name
  • The scope of the NetBIOS name
  • Name type: unique or group
  • IP address of the releasing node
  • Transaction ID
  • Result:
    • Yes: name was released
    • No: name was not released, a reason code is provided
REQUESTING
P-NODE                                         NBNS
                  NAME RELEASE REQUEST
           ---------------------------------->

                  NAME RELEASE RESPONSE
           <---------------------------------

15.4.3. RELEASE BY M NODES

the M node release procedure is basically a mix of the P and B release procedures ๐Ÿ“ the M node does the P procedure first. if the P procedure fails, the release stops there and fails. only if the P procedure succeeds does the M node broadcast the NAME RELEASE DEMAND to the broadcast area, which is the B procedure.

NOTE: An M node typically performs a B-style operation and then a P-style operation. In this case, however, the P-style operation comes first.

here's how the M node release procedure looks ๐Ÿ‘€

<-----P procedure fails-------> <-------P procedure succeeds--->

REQUESTING               NBNS    REQUESTING             NBNS
M-NODE                           M-NODE

    NAME RELEASE REQUEST               NAME RELEASE REQUEST
  -------------------------->       ------------------------>

    NEGATIVE RELEASE RESPONSE        POSITIVE RELEASE RESPONSE
  <--------------------------       <-------------------------

                                                        OTHER
                                                        M-NODES

                                        NAME RELEASE DEMAND
                                     ------------------------>

15.5. NAME MAINTENANCE TRANSACTIONS ๐ŸŒธ

15.5.1. NAME REFRESH

name refresh transactions handle a few situations:

  • a) An NBNS node needs to detect if a P or M node has "silently" gone down, so that names held by that node can be purged from the data base.
  • b) If the NBNS goes down, it needs to be able to reconstruct the data base when it comes back up.
  • c) If the network should be partitioned, the NBNS needs to be able to update its data base when the network reconnects.

each P or M node is responsible for sending periodic NAME REFRESH REQUESTs for each name it has registered. each refresh packet contains one name that the node has successfully registered ๐Ÿ’… the interval between these packets is negotiated between the end node and the NBNS server when the name is first claimed. at name claim time, an end node suggests a refresh timeout value. the NBNS node can change that value in the reply packet. the NBNS can also tell the end node not to send any refresh packets at all, by using the "infinite" timeout value in the response packet. whatever timeout value the NBNS sends back is the actual refresh timeout the end node must use โฐ

when a node sends a NAME REFRESH REQUEST, it must be ready to get a negative response ๐Ÿ˜ฌ this could happen, for example, if the NBNS discovers that the name has already been assigned to some other node. if that happens, the end node should mark the name as being in conflict. that entry gets handled the same way as if a name conflict had been detected against the name. here's name refresh in action:

<-----Successful Refresh-----> <-----Unsuccessful Refresh---->

REFRESHING               NBNS   REFRESHING               NBNS
NODE                            NODE

    NAME REFRESH REQUEST             NAME REFRESH REQUEST
  ------------------------>        ----------------------->

      POSITIVE RESPONSE                NEGATIVE RESPONSE
  <------------------------        <-----------------------
                                 !
                                 !
                                 V
                           MARK NAME IN
                             CONFLICT

15.5.2. NAME CHALLENGE

name challenge is done by sending a NAME QUERY REQUEST to an end node of any type ๐Ÿ” if a POSITIVE NAME QUERY RESPONSE comes back, then that node still owns the name. if a NEGATIVE NAME QUERY RESPONSE comes back, or no response shows up at all, it can be assumed that the end node no longer owns the name.

the challenge can be done either by the NBNS node or by an end node. when an end node sends a name claim packet, the NBNS node may do the challenge. the NBNS can also choose to make the end node do the challenge instead. in that case, the NBNS sends an END-NODE CHALLENGE RESPONSE packet to the end node, and the end node should then go challenge the putative owner ๐Ÿซถ

note that the name challenge procedure sends a normal NAME QUERY REQUEST packet to the end node, so it doesn't need a special packet. the only new packet is the END-NODE CHALLENGE RESPONSE, which an NBNS node sends when it wants the end node to do the challenge operation.

15.5.3. CLEAR NAME CONFLICT

it's possible that, during a refresh request from an M or P node, the NBNS detects a name in conflict ๐Ÿšจ the response to the NAME REFRESH REQUEST must be a NEGATIVE NAME REGISTRATION RESPONSE. optionally, the NBNS may also send a NAME CONFLICT DEMAND or a NAME RELEASE REQUEST to the refreshing node. the NAME CONFLICT DEMAND forces the node to put the name into the conflict state, and the node will eventually tell its user about the conflict. the NAME RELEASE REQUEST forces the node to flush the name completely from its local name table, which means the conflicted name is flushed too. this does not end any existing sessions using this name โœจ

here's an NBNS spotting and fixing a conflict:

REFRESHING NODE                                 NBNS

                  NAME REFRESH REQUEST
        ----------------------------------------->

            NEGATIVE NAME REGISTRATION RESPONSE
        <-----------------------------------------

                  NAME CONFLICT DEMAND
        <-----------------------------------------

                          OR

                  NAME RELEASE REQUEST
        <-----------------------------------------

            POSITIVE/NEGATIVE RELEASE REQUEST
        ----------------------------------------->

15.6. ADAPTER STATUS TRANSACTIONS ๐Ÿงš

adapter status is pulled from a node like this:

  1. Perform a name discovery operation to get the IP addresses of a set of end nodes.
  2. Repeat until all end nodes from the set have been used:
    • a. Select one end node from the set.
    • b. Send a NODE STATUS REQUEST to that end node using UDP.
    • c. Await a NODE STATUS RESPONSE. (If a timely response is not coming, repeat step "b" UCAST_REQ_RETRY_COUNT times. After the last retry, go to step "a".)
    • d. If the truncation bit is not set in the response, the response contains the entire node status. Return the status to the user and end this procedure.
    • e. If the truncation bit is set in the response, then not all status was returned, because it wouldn't fit in the response packet. The responder sets the truncation bit if the IP datagram length would go over MAX_DATAGRAM_LENGTH. Return the status to the user and end this procedure.
  3. Return error to user, no status obtained.

repeating step 2 through all the nodes in the set is optional ๐Ÿซถ

here's an example of a successful Adapter Status operation ๐Ÿ’–

REQUESTING NODE                                 NAME OWNER

                    NAME QUERY REQUEST
        ----------------------------------------->

                POSITIVE NAME QUERY RESPONSE
        <-----------------------------------------

                    NODE STATUS REQUEST
        ----------------------------------------->

                   NODE STATUS RESPONSE
        <-----------------------------------------

16. NetBIOS SESSION SERVICE ๐ŸŒˆ

the NetBIOS session service starts after one or more IP addresses have been found for the target name ๐Ÿ’œ those addresses might have come from the NetBIOS name query transactions, or from somewhere else, like a local name table or cache.

NetBIOS session service transactions, packets, and protocols are identical for all end-node types. they only involve directed (point-to-point) communications.

16.1. OVERVIEW OF NetBIOS SESSION SERVICE

session service has three phases, bestie ๐ŸŽ€

  • Session establishment: this is the phase where the IP address and TCP port of the called name get figured out, and a TCP connection gets set up with the remote party.
  • Steady state: this is the phase where NetBIOS data messages get exchanged over the session. keep-alive packets may also be exchanged, if the participating nodes are configured that way.
  • Session close: a session closes whenever either party in the session closes it, or it's determined that one of the parties has gone down ๐Ÿ’€

16.1.1. SESSION ESTABLISHMENT PHASE OVERVIEW ๐Ÿ’–

Okay bestie, so when an end-node wants to start a session with another node, it first needs the IP address of the node (or nodes) that claims to own the destination name. ๐Ÿงš It can get that by using name query transactions or a local cache, whichever is handy.

Every end-node is always listening for incoming NetBIOS session requests by watching for TCP calls on the well-known service port, SSN_SRVC_TCP_PORT. ๐Ÿ‘‘ Each incoming TCP connection is its own separate NetBIOS session initiation attempt. The NetBIOS session server is the one that accepts those connections, not the ultimate application. ๐Ÿซถ

Once the TCP connection is open, the calling node sends a session service request packet. This packet carries the following info:

  • Calling IP address (see note)
  • Calling NetBIOS name
  • Called IP address (see note)
  • Called NetBIOS name
NOTE: The IP addresses are obtained from the TCP service interface.

When that request packet reaches the NetBIOS server, one of four situations will be true. ๐Ÿ’…

  • There exists a NetBIOS LISTEN compatible with the incoming call, and there are adequate resources to permit session establishment to proceed. โœจ
  • There exists a NetBIOS LISTEN compatible with the incoming call, but there are inadequate resources to permit establishment of a session. ๐Ÿ˜ญ
  • The called name does, in fact, exist on the called node, but there is no pending NetBIOS LISTEN compatible with the incoming call. ๐Ÿ™ˆ
  • The called name does not exist on the called node. ๐Ÿ’€

In every case except the first one, a rejection response gets sent back over the TCP connection to the caller. Then the TCP connection closes and the session phase is over. Any retry is up to the caller. ๐ŸŽ€ For a group name, the caller may go to the next member of the group instead of retrying the same address right away. For a unique name, the caller may retry immediately against the same target IP address, unless the called name did not exist on the called node. In that one case, the NetBIOS name should be re-resolved. ๐Ÿฆ‹

If a compatible LISTEN exists and there are adequate resources, the session server may turn the existing TCP connection into the NetBIOS data session. ๐ŸŒˆ Or, the session server may redirect (also called "retarget") the caller to another TCP port and IP address instead. ๐Ÿงš

If the caller gets redirected, it starts the session establishment all over again, but this time using the new IP address and TCP port from the retarget response. A TCP connection is created again, and the calling and called nodes exchange credentials again. The called party can accept the call, reject it, or make yet another redirection. ๐Ÿ”ฅ

Here's the reason this works, and it's giving very practical vibes. ๐Ÿ“ It's based on the idea that, on hosts where open TCP connections can't be transferred between processes, the host will have a central session server. Applications that want to receive NetBIOS calls get an ephemeral TCP port number, post a TCP unspecified passive open on that port, and then hand that port number and NetBIOS name information to the session server using a NetBIOS LISTEN operation. When a call is placed, the session server "retargets" the caller to the application's TCP socket. The caller then places a new call, directly to the application. The application is responsible for mimicking the session server, at least enough to receive the calling credentials and then accept or reject the call. ๐Ÿ‘‘

16.1.1.1. RETRYING AFTER BEING RETARGETTED

Sometimes a calling node finds that it can't establish a session with the node it was sent to by the retargetting procedure. ๐Ÿ˜ฌ Since retargetting can be nested, there's a question about whether the caller should start its retry back at the initial starting point, or back up to an intermediate retargetting point. The caller may use any method it likes. Appendix B, "Retarget Algorithms," talks about two such methods. ๐Ÿ“š

16.1.1.2. SESSION ESTABLISHMENT TO A GROUP NAME

Session establishment with a group name needs special consideration, bestie. ๐Ÿซถ When a NetBIOS CALL attempt is made to a group name, name discovery gives back a list of the members of that group. That list might be incomplete. The calling node picks one member from the list and tries to build a session with it. If that fails, the calling node may pick another member and try again. ๐Ÿ”„

When the session service tries to connect to one of the group's members, there's no guarantee that the member has a LISTEN pending against that group name. There's also no guarantee that the called node even owns that name, or even that the called node is operating at all. ๐Ÿ˜ตโ€๐Ÿ’ซ

16.1.2. STEADY STATE PHASE OVERVIEW

This is the part where the fun happens. ๐ŸŽ‰ NetBIOS data messages get exchanged in the steady state. Each NetBIOS message is sent by prepending the user data with a message header, and then the header and the user data go over the TCP connection together. On the other end, the receiver strips off the header and passes the data to the NetBIOS user. ๐Ÿ’œ

To detect failure of one of the nodes or of the network in between, "session keep alive" packets may be sent periodically during the steady state. ๐Ÿ’“

Any failure of the underlying TCP connection, whether that's a reset, a timeout, or some other failure, means the NetBIOS session has failed too. ๐Ÿ’”

16.1.3. SESSION TERMINATION PHASE OVERVIEW

A NetBIOS session ends normally when the user asks for it to be closed, or when the session service notices that the remote partner has gracefully terminated the TCP connection. ๐ŸŒธ A session ends abnormally when the session service detects a loss of the connection. Connection loss can be spotted with the keep-alive function of the session service or of TCP, or when a SESSION MESSAGE send operation fails. ๐Ÿšจ

When a user asks to close a session, the service first tries a graceful, in-band close of the TCP connection. If the connection doesn't close within the SSN_CLOSE_TIMEOUT, the TCP connection gets aborted. โฐ It doesn't matter how the TCP connection ends: the NetBIOS session service always closes the NetBIOS session. ๐Ÿซก

When the session service gets an indication from TCP that a connection close request has come in, the TCP connection and the NetBIOS session are immediately closed, and the user is told the session was lost. ๐Ÿ˜ฑ All data received up to the close indication should be delivered to the session's user, if possible. ๐ŸŽ€

16.2. SESSION ESTABLISHMENT PHASE โœจ

Okay bestie, all of these diagrams assume the caller already finished a name query for the listener's name ๐Ÿ’… (no cap, that comes first).

Diagram one is the clean version where the listener doesn't retarget ๐Ÿฆ‹. The caller opens a TCP connection to the well-known NetBIOS session service port, SSN_SRVC_TCP_PORT. Then it sends a SESSION REQUEST over that connection, and the request carries the caller's name and the listener's name. The listener replies with a POSITIVE SESSION RESPONSE, which basically means "yep, this TCP connection is the one we'll use for the data transfer phase" ๐ŸŽ€.

        CALLER                          LISTENER

                    TCP CONNECT
        ====================================>
                     TCP ACCEPT
        <===================================
                  SESSION REQUEST
        ------------------------------------>
                 POSITIVE RESPONSE
        <-----------------------------------

Diagram two is where it gets spicy ๐ŸŒถ๏ธ: the listener retargets. The start is the same as diagram one, right up until the listener answers the SESSION REQUEST. The listener is split into two pieces, the listen processor and the actual listener, and the listen processor sends a SESSION RETARGET RESPONSE back to the caller. That response says the call is fine, but the data transfer TCP connection has to happen at a new IP address and TCP port instead. So the caller closes the first TCP connection and starts the whole session establishment process over again with the new IP address and TCP port. The new listener accepts that connection for the data transfer phase with a POSITIVE SESSION RESPONSE ๐Ÿงš.

        CALLER                  LISTEN PROCESSOR        LISTENER

                TCP CONNECT
        =============================>
                TCP ACCEPT
        <=============================
                SESSION REQUEST
        ----------------------------->

           SESSION RETARGET RESPONSE
        <-----------------------------
                TCP CLOSE
        <=============================
                TCP CLOSE
        =============================>

                    TCP CONNECT
        ====================================================>
                     TCP ACCEPT
        <====================================================
                  SESSION REQUEST
        ---------------------------------------------------->
                 POSITIVE RESPONSE
        <----------------------------------------------------

Diagram three is the rejection ๐Ÿ™…โ€โ™€๏ธ. This can happen with either a non-retargetting listener or a retargetting one. After the TCP connection is made on SSN_SRVC_TCP_PORT, the caller sends its SESSION REQUEST. The problem is that the listener either doesn't have a listen pending for its name, or the pending NetBIOS listen is specific to some other caller's name. So the listener sends a NEGATIVE SESSION RESPONSE and closes the TCP connection. Rough, but clear.

        CALLER                          LISTENER

                     TCP CONNECT
        ====================================>
                     TCP ACCEPT
        <===================================
                  SESSION REQUEST
        ------------------------------------>
                 NEGATIVE RESPONSE
        <-----------------------------------
                     TCP CLOSE
        <===================================
                     TCP CLOSE
        ====================================>

Diagram four is the session establishment failing with a retargetting listener ๐Ÿ’€. After getting redirected and closing the first TCP connection, the caller tries to connect at the new IP address and TCP port. That connection fails because either the port is unavailable or the target node isn't active. The "port unavailable" race happens when another caller already grabbed the TCP connection with the listener first, rude ๐Ÿ™„. For more implementation ideas, check out Appendix B, "Retarget Algorithms" ๐ŸŒธ.

        CALLER                  LISTEN PROCESSOR        LISTENER

                TCP CONNECT
        =============================>
                TCP ACCEPT
        <=============================
                SESSION REQUEST
        ----------------------------->
                REDIRECT RESPONSE
        <-----------------------------
                TCP CLOSE
        <=============================
                TCP CLOSE
        =============================>

                    TCP CONNECT
        ====================================================>

                  CONNECTION REFUSED OR TIMED OUT
        <===================================================

16.3. SESSION DATA TRANSFER PHASE ๐ŸŒˆ

16.3.1. DATA ENCAPSULATION

Okay so once you're in the steady state, NetBIOS messages are just flowing back and forth ๐Ÿ’Œ. The sender puts a message header in front of the user data, then sends that header and data together over the TCP connection. The receiver peels off the header and hands the NetBIOS data to the user. Simple, iconic ๐Ÿซถ.

16.3.2. SESSION KEEP-ALIVES

Here's the thing: you need a way to notice when a node has died or the network has split ๐Ÿ™ˆ. So "session keep alive" packets get sent periodically during the steady state, and a peer node just throws them away when it gets one.

Each session has its own keep alive timer ๐Ÿ’œ. That timer gets reset every time any data is sent to or received from the session peer. When it runs out, a NetBIOS session keep-alive packet goes out on the TCP connection. Sending that packet forces some data onto the connection, which means TCP gets to figure out on its own whether the connection is still alive. Sneaky, but it works โœจ.

Lots of TCP implementations already have their own parallel "keep-alive" mechanism, so the NetBIOS session keep-alive is a configurable option. It is recommended that the NetBIOS keep-alive mechanism be used only in the absence of TCP keep-alive ๐Ÿ“.

Unlike TCP keep alives, NetBIOS session keep alives don't need a response from the NetBIOS peer. The fact that the keep alive could be sent at all is enough to show the peer, and the connection to it, are still active ๐Ÿฆ‹.

The only thing you need for interoperability is this: when a session keep alive packet arrives, it should be discarded ๐ŸŽ€.


17. NETBIOS DATAGRAM SERVICE ๐ŸŽˆ

17.1. OVERVIEW OF NetBIOS DATAGRAM SERVICE

Every NetBIOS datagram has a named destination and a named source ๐Ÿซถ. Before sending one, the datagram service has to do a name query to find out the IP address and attributes of the destination NetBIOS name. (That info can be cached so you don't have to redo the name query for every datagram after that, which is very efficient of you ๐Ÿ’….)

NetBIOS datagrams ride inside UDP packets. If a NetBIOS datagram is bigger than one UDP packet, it may be fragmented across several UDP packets ๐Ÿงฉ.

End-nodes can receive NetBIOS datagrams addressed to names they don't hold. Those datagrams should be discarded ๐Ÿ™…โ€โ™€๏ธ. If the name is unique, a DATAGRAM ERROR packet gets sent back to the source of that datagram. Bye, bye ๐Ÿ‘‹.

17.1.1. UNICAST, MULTICAST, AND BROADCAST

NetBIOS datagrams can be unicast, multicast, or broadcast ๐Ÿ“ก. A datagram addressed to a unique NetBIOS name is unicast. A datagram addressed to a group NetBIOS name is multicast, and that's true whether the group has zero, one, or lots of actual members. A datagram sent with the NetBIOS "Send Broadcast Datagram" primitive is broadcast ๐Ÿ“ข.

17.1.2. FRAGMENTATION OF NetBIOS DATAGRAMS

Okay, this is the part where things get a little chaotic ๐ŸŒช๏ธ. When the header and data of a NetBIOS datagram go over the maximum amount of data allowed in a UDP packet, the datagram must be fragmented before it's sent and reassembled when it's received ๐Ÿงท.

A NetBIOS Datagram is made of these protocol elements:

  • IP header of 20 bytes (minimum)
  • UDP header of 8 bytes
  • NetBIOS Datagram Header of 14 bytes
  • The NetBIOS Datagram data.

The NetBIOS Datagram data section has 3 parts:

  • Source NetBIOS name (255 bytes maximum)
  • Destination NetBIOS name (255 bytes maximum)
  • The NetBIOS user's data (maximum of 512 bytes)

The two name fields are in second level encoded format (see section 14.) ๐Ÿ”.

A maximum size NetBIOS datagram is 1064 bytes. The minimal maximum IP datagram size is 576 bytes. So a NetBIOS Datagram might not fit into a single IP datagram, and that's exactly why fragmentation has to be allowed ๐Ÿฅน.

On networks that meet or exceed the minimum IP datagram length requirement of 576 octets, at most two NetBIOS datagram fragments will be generated. The protocols and packet formats are built to handle fragmentation into three or more parts too, just in case ๐Ÿ’ช.

When a NetBIOS datagram gets fragmented, the IP, UDP and NetBIOS Datagram headers are present in every fragment. The NetBIOS Datagram data section is split up among the resulting UDP datagrams. The data sections of the fragments don't overlap. The only fields in the NetBIOS Datagram header that vary are the FLAGS and OFFSET fields ๐ŸŽฏ.

The FIRST bit in the FLAGS field tells you whether the fragment is the first one in the sequence. The MORE bit in the FLAGS field tells you whether more fragments follow ๐Ÿ‘€.

The OFFSET field is the byte offset, counted from the start of the NetBIOS datagram data section, to the first byte of the data section in this fragment. It's 0 for the first fragment. For each fragment after that, OFFSET is the sum of the bytes in the NetBIOS data sections of all the fragments before it โœจ.

If the NetBIOS datagram was not fragmented:

  • FIRST = TRUE
  • MORE = FALSE
  • OFFSET = 0

If the NetBIOS datagram was fragmented:

  • First fragment:
    • FIRST = TRUE
    • MORE = TRUE
    • OFFSET = 0
  • Intermediate fragments:
    • FIRST = FALSE
    • MORE = TRUE
    • OFFSET = sum(NetBIOS data in prior fragments)
  • Last fragment:
    • FIRST = FALSE
    • MORE = FALSE
    • OFFSET = sum(NetBIOS data in prior fragments)

You can figure out where the intermediate fragments belong just by looking at their OFFSET ๐Ÿง .

An NBDD has to remember the destination name from the first fragment so it can relay the rest of the fragments of that one NetBIOS datagram ๐Ÿšจ. The name info gets matched up with the later fragments using the transaction ID, the DGM_ID, and the SOURCE_IP fields of the packet. The NBDD can purge this info after it processes the last fragment, or once FRAGMENT_TO time has passed since the first fragment came in ๐Ÿงน.

17.2. NetBIOS DATAGRAMS BY B NODES ๐Ÿ’Œ

Okay so, for NetBIOS datagrams that have a named destination (so not broadcast), a B node does a name discovery for that destination name before it sends anything. ๐Ÿ” It can skip the discovery if it already has the info cached from an earlier one. If the name type that comes back is UNIQUE, the datagram gets unicast to the one and only owner of that name. If the name type is GROUP, the datagram gets broadcast to the whole broadcast area using the destination IP address BROADCAST_ADDRESS. ๐Ÿ“ก

A receiving node always filters datagrams by destination name, bestie. ๐Ÿซถ If the node doesn't own that name, or there are no RECEIVE DATAGRAM user operations pending for it, the datagram gets tossed. ๐Ÿ—‘๏ธ For datagrams aimed at a UNIQUE name, if the node doesn't own the name, the receiver sends back a DATAGRAM ERROR packet. That error packet comes from DGM_SRVC_UDP_PORT and is addressed to the SOURCE_IP and SOURCE_PORT of the bad datagram. ๐Ÿ’€ For a GROUP name the receiver is much chiller about it: if it doesn't own the name, it just quietly discards the datagram. ๐Ÿคซ

Now broadcast NetBIOS datagrams are a different vibe because they don't have a named destination. ๐ŸŒˆ So the B node sends the DATAGRAM SERVICE packet(s) to the entire broadcast area using the destination IP address BROADCAST_ADDRESS. To help the receivers recognise it as a broadcast NetBIOS datagram, the destination name is * (hexadecimal 2A) followed by 15 bytes of hexadecimal 00. โœจ The NetBIOS scope identifier gets tacked onto the end of that name before it's turned into second-level encoding. For example, if the scope identifier is "NETBIOS.SCOPE", the first-level encoded name would be:

CKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.NETBIOS.SCOPE

According to [2], a user is not allowed to give a NetBIOS name that starts with "*". ๐Ÿ™…โ€โ™€๏ธ

For each node in the broadcast area that gets the NetBIOS broadcast datagram, if it has any RECEIVE BROADCAST DATAGRAM user operations pending, the data from the datagram gets copied and delivered to each one. ๐ŸŽ€ If nothing is pending, the node silently discards it. ๐Ÿฆ‹

17.3. NetBIOS DATAGRAMS BY P AND M NODES ๐Ÿงš

P and M nodes don't use IP broadcast to spread NetBIOS datagrams around. ๐Ÿ™…โ€โ™€๏ธ๐Ÿ“ข

Like B nodes, P and M nodes MUST perform a name discovery or use cached info to figure out whether a destination name is a group or a unique name. ๐Ÿ”Ž

Datagrams to unique names get unicast straight to the destination by P and M nodes, exactly the same way B nodes do it. ๐Ÿ’–

Datagrams to group names and NetBIOS broadcast datagrams get unicast to the NBDD instead. Then the NBDD relays them to each of the nodes that the destination name points to. ๐Ÿš€

Here's the tea: an NBDD might not be able to send a NetBIOS datagram to a particular NetBIOS name, including the broadcast NetBIOS name ("*") we defined above. ๐Ÿซ  So there's a query mechanism the end-node can use to check whether the NBDD will be able to relay a datagram to a given name. Before a datagram (or its fragments) goes to the NBDD, the P or M node MAY send a DATAGRAM QUERY REQUEST packet to the NBDD, using the DESTINATION_NAME from the DATAGRAM SERVICE packet(s). If the NBDD will relay datagrams to that destination name, it responds with a DATAGRAM POSITIVE QUERY RESPONSE. After a positive response, the end-node unicasts the datagram to the NBDD. โœ… If the NBDD won't be able to relay to the destination name in the query, it sends back a DATAGRAM NEGATIVE QUERY RESPONSE packet. โŒ And if the NBDD can not distribute a datagram, the end-node then gets to choose: it can grab the name's owner list from the NBNS and send the datagram directly to each owner. ๐Ÿ‘‘

An NBDD MUST be able to respond to DATAGRAM QUERY REQUEST packets. โœจ The response MAY always be positive. Still, using the query mechanism is OPTIONAL for a P or M node. An implementation MAY always unicast the NetBIOS datagram to the NBDD without asking whether it'll get relayed. ๐ŸŒธ Apart from the datagram query facility described above, an NBDD gives no feedback about whether it forwarded a datagram. ๐Ÿคทโ€โ™€๏ธ


18. NODE CONFIGURATION PARAMETERS โš™๏ธ

Here's what each node type needs to have configured, bestie. ๐Ÿ’…

  • B NODES:
    • Node's permanent unique name
    • Whether IGMP is in use
    • Broadcast IP address to use
    • Whether NetBIOS session keep-alives are needed
    • Usable UDP data field length (to control fragmentation)
  • P NODES:
    • Node's permanent unique name
    • IP address of NBNS
    • IP address of NBDD
    • Whether NetBIOS session keep-alives are needed
    • Usable UDP data field length (to control fragmentation)
  • M NODES:
    • Node's permanent unique name
    • Whether IGMP is in use
    • Broadcast IP address to use
    • IP address of NBNS
    • IP address of NBDD
    • Whether NetBIOS session keep-alives are needed
    • Usable UDP data field length (to control fragmentation)

19. MINIMAL CONFORMANCE ๐ŸŽ€

To make sure different vendors' stuff actually works together, a minimally conforming implementation based on this spec MUST observe the following rules. ๐Ÿซถ

a) A node designed to work only in a broadcast area MUST conform to the B node specification.

b) A node designed to work only in an internet MUST conform to the P node specification.

REFERENCES ๐Ÿ“š

  • [1] "Protocol Standard For a NetBIOS Service on a TCP/UDP Transport: Detailed Specifications", RFC 1002, March 1987.
  • [2] IBM Corp., "IBM PC Network Technical Reference Manual", No. 6322916, First Edition, September 1984.
  • [3] J. Postel (Ed.), "Transmission Control Protocol", RFC 793, September 1981.
  • [4] MIL-STD-1778
  • [5] J. Postel, "User Datagram Protocol", RFC 768, 28 August 1980.
  • [6] J. Reynolds, J. Postel, "Assigned Numbers", RFC 990, November 1986.
  • [7] J. Postel, "Internet Protocol", RFC 791, September 1981.
  • [8] J. Mogul, "Internet Subnets", RFC 950, October 1984
  • [9] J. Mogul, "Broadcasting Internet Datagrams in the Presence of Subnets", RFC 922, October 1984.
  • [10] J. Mogul, "Broadcasting Internet Datagrams", RFC 919, October 1984.
  • [11] P. Mockapetris, "Domain Names - Concepts and Facilities", RFC 882, November 1983.
  • [12] P. Mockapetris, "Domain Names - Implementation and Specification", RFC 883, November 1983.
  • [13] P. Mockapetris, "Domain System Changes and Observations", RFC 973, January 1986.
  • [14] C. Partridge, "Mail Routing and the Domain System", RFC 974, January 1986.
  • [15] S. Deering, D. Cheriton, "Host Groups: A Multicast Extension to the Internet Protocol", RFC 966, December 1985.
  • [16] S. Deering, "Host Extensions for IP Multicasting", RFC 988, July 1986.

APPENDIX A ๐Ÿฆ‹

This appendix has supporting technical discussions. It is not an integral part of the NetBIOS-over-TCP specification, so don't panic if it feels extra. ๐Ÿ’œ

INTEGRATION WITH INTERNET GROUP MULTICASTING ๐ŸŒ

The NetBIOS-over-TCP system described in this RFC MAY be easily integrated with the Internet Group Multicast system that was being developed for the internet. โœจ

In the main body of the RFC, a broadcast area was treated as a single MAC-bridged "B-LAN". The protocols defined here will still work over an extended broadcast area, though, which comes from setting up a permanent Internet Multicast Group. ๐ŸŒˆ

Each separate broadcast area would be based on its own permanent Internet Multicast Group. B and M nodes would use this multicast group address as their BROADCAST_ADDRESS. ๐Ÿ“ก

To base the broadcast area on a multicast group, some extra procedures are needed and certain constraints have to be met. ๐Ÿงฉ

A-1. ADDITIONAL PROTOCOL REQUIRED IN B AND M NODES ๐Ÿ› ๏ธ

All B or M nodes operating on an IGMP based broadcast area MUST have IGMP support in their IP layer software. ๐Ÿ’ป These nodes MUST perform an IGMP join operation to enter the IGMP group before they start any NetBIOS activity. ๐Ÿšช

A-2. CONSTRAINTS ๐Ÿšง

Broadcast Areas MAY overlap. Because of that, end-nodes MUST be careful to examine the NetBIOS scope identifiers in all received broadcast packets. ๐Ÿ‘€

The NetBIOS broadcast protocols were designed for a network with low average transit time and a low rate of packet loss. An IGMP based broadcast area MUST exhibit these characteristics. ๐Ÿซ  In practice, this will tend to limit IGMP broadcast areas to a campus of networks linked together by high-speed routers and inter-router links. It's unlikely that transcontinental broadcast areas would have the required characteristics. ๐ŸŒ

APPENDIX B ๐ŸŒธ

This appendix has supporting technical discussions. It is not an integral part of the NetBIOS-over-TCP specification. ๐Ÿงš

IMPLEMENTATION CONSIDERATIONS ๐Ÿ’ป

B-1. IMPLEMENTATION MODELS ๐Ÿง 

On any participating system, there MUST be some sort of NetBIOS Service to coordinate access by NetBIOS applications on that system. ๐ŸŽฏ

To analyze the impact of the NetBIOS-over-TCP architecture, we use the following three models of how a NetBIOS service might be implemented:

  1. Combined Service and Application Model

The NetBIOS service and application are both contained within a single process. โœจ No interprocess communication is assumed within the system, so all communication happens over the network. If multiple applications need concurrent access to the NetBIOS service, they MUST be folded into this monolithic process. ๐Ÿซ 

  1. Common Kernel Element Model

The NetBIOS Service is part of the operating system (perhaps as a device driver or a front-end processor). The NetBIOS applications are normal operating system application processes. ๐Ÿ’… The common element NetBIOS service holds all the information, such as the name and listen tables, needed to coordinate what the applications are doing.

  1. Non-Kernel Common Element Model

The NetBIOS Service is implemented as an operating system application process. The NetBIOS applications are other operating system application processes. ๐ŸŒˆ The service and the applications swap data through operating system interprocess communication. In a multi-processor (e.g. network) operating system, each module MAY reside on a different CPU. The NetBIOS service process holds all the shared info needed to coordinate the NetBIOS applications. The applications MAY still require a subroutine library to make it easier to access the NetBIOS service. ๐Ÿ“š

For any of these implementation models, the TCP/IP service can live in the operating system, or it can be split between the NetBIOS applications and the NetBIOS service processes. ๐Ÿฆ‹

B-1.1. MODEL INDEPENDENT CONSIDERATIONS โœจ

Okay so the NetBIOS name service links a NetBIOS name to a host ๐Ÿ’–. Then the session service goes a step further and ties that name to a specific TCP port for the whole length of the session ๐Ÿ”—.

The name service doesn't need to be told about every single Listen start and completion ๐Ÿ™ˆ. Names aren't bound to any TCP port in the name service, so the session service can use a different tcp port for each session made with the same local name ๐Ÿฆ‹.

The TCP port for the data transfer phase of a NetBIOS session can be globally well-known, locally well-known, or ephemeral ๐ŸŒธ. Picking one is a local implementation issue, so it's totally your call ๐Ÿ’…. The RETARGET mechanism lets the NetBIOS session bind to a TCP connection on any TCP port, even one on another IP node ๐Ÿงš. It's giving flexibility, bestie.

An implementation can use the session service's globally well-known TCP port for the data transfer phase by skipping the RETARGET mechanism and just accepting the session on the initial TCP connection ๐ŸŽ€. This is fine because the caller always uses an ephemeral TCP port โœจ.

The called end RETARGET mechanism is only required if a particular implementation needs it ๐Ÿค“. For a lot of real system environments, like an in-kernel NetBIOS service implementation, there's no need to retarget incoming calls ๐ŸŒˆ. Instead, all NetBIOS sessions can be multiplexed through the single, well-known, NetBIOS session service port ๐Ÿ‘‘. Those implementations skip the complexity of the RETARGET mechanism, and their callers don't have to jump through the retargetting hoops either ๐Ÿ’€.

Still, all callers must be ready to process all possible SESSION RETARGET RESPONSEs ๐Ÿซถ. No skipping this part, periodt ๐Ÿ˜ญ.

B-1.2. SERVICE OPERATION FOR EACH MODEL

It's possible to build a NetBIOS service based on this specification for each of the implementation models above ๐Ÿ“.

For the common kernel element model, the name, datagram, and session services are all simple ๐Ÿ’…. All the information lives in a single entity, so it's easy to access or modify โœจ. A single port or multiple ports for NetBIOS sessions can be used without adding much complexity to session establishment ๐Ÿฆ‹. The only real cost is the overhead of getting NetBIOS messages and operation requests and responses across the user and operating system boundary ๐Ÿ™ƒ.

The combined service and application model is very similar to the common kernel element model when it comes to what it needs from the NetBIOS service ๐Ÿซง. The big difficulty is coordinating the multiple NetBIOS service and application processes that exist in a system like this ๐Ÿ˜ตโ€๐Ÿ’ซ.

The NetBIOS name, datagram, and session protocols assume the end-point entities have full control of the various well-known TCP and UDP ports ๐Ÿ‘‘. If an implementation has multiple NetBIOS service entities, like multiple applications each linked into a NetBIOS library, then that implementation must impose some internal coordination ๐Ÿค. Another option is to periodically assign use of the NetBIOS ports to one application or another ๐Ÿ”.

For the typical non-kernel common element model implementation, three permanent system-wide NetBIOS service processes exist ๐Ÿงšโ€โ™€๏ธ:

  • The name server
  • the datagram server
  • and session server

Each server listens for requests from the network on a UDP or TCP well-known port ๐Ÿ“ก. Each application has a small piece of the NetBIOS service built in, possibly as a library ๐Ÿ“š. Each application's NetBIOS support library needs to send a message to the right server to request an operation, like add name, send a datagram, or set up a listen ๐Ÿ’Œ.

The non-kernel common element model doesn't require a TCP connection to be passed between the session server and the application process ๐Ÿ™…โ€โ™€๏ธ. The RETARGET operation for an active NetBIOS Listen can be used by the session server to redirect the session to another TCP connection ๐ŸŽฏ. That connection sits on a port allocated and owned by the application's NetBIOS support library ๐ŸŒธ. The application, whether it has a built-in TCP/IP service or a kernel-based one, can then accept the RETARGETed connection request and process it on its own, separate from the session server ๐Ÿ’œ.

On Unix(tm) or POSIX(tm), the NetBIOS session server could create sub-processes for incoming connections ๐Ÿฃ. The open sessions would be passed to the child through "fork" and "exec" as an open file descriptor ๐Ÿช„. This approach is pretty limited though ๐Ÿฅฒ. A pre-existing process couldn't receive an incoming call, and every called process would have to be a sub-process of the session server ๐Ÿ™ˆ.

B-2. CASUAL AND RESTRICTED NetBIOS APPLICATIONS ๐ŸŽ€

Because NetBIOS was designed for the open system environment of a typical personal computer, it doesn't have the concept of privileged or unprivileged applications ๐Ÿ–ฅ๏ธ. In a lot of multi-user or multi-tasking operating systems, applications get assigned privilege capabilities ๐Ÿ”. Those capabilities limit what an application can acquire and use from system resources ๐Ÿงฑ. On these systems it matters that casual applications, the ones with limited system privileges, can get to NetBIOS services ๐Ÿ’โ€โ™€๏ธ. So can privileged applications, the ones with 'super-user' capabilities whose access to those capabilities and required resources is restricted ๐Ÿ‘‘. It's also important that a systems administrator can restrict certain NetBIOS resources to one particular NetBIOS application ๐Ÿ›ก๏ธ. For example, a file server built on NetBIOS services should be able to have names and TCP ports for sessions that only it can use ๐Ÿ“.

A NetBIOS application needs at least two local resources to talk to another NetBIOS application: a NetBIOS name for itself and, typically, a session ๐Ÿ—ฃ๏ธ. A NetBIOS service can't require that applications directly use privileged system resources ๐Ÿšซ. For instance, plenty of systems require privilege to use TCP and UDP ports numbered below 1024 ๐Ÿ”’. This RFC requires reserved ports for the name and session servers of a NetBIOS service implementation ๐Ÿ“Œ. It doesn't require the application to have direct access to those reserved ports ๐Ÿ™Œ.

For the name service, the manager of the local name table must have access to the NetBIOS name service's reserved UDP port ๐Ÿ“ฎ. It needs to listen for name service UDP packets so it can defend and define its local names on the network ๐Ÿ›ก๏ธ. Still, this manager doesn't need to be part of a user application in a system environment that has privilege restrictions on reserved ports ๐Ÿง‘โ€๐Ÿ’ป.

The internal name server can require certain privileges to add, delete, or use a certain name, if an implementer wants that restriction ๐Ÿ”‘. This restriction is independent of how the NetBIOS service protocols work, and it wouldn't necessarily stop that implementation from interoperating with another implementation ๐Ÿค.

The session server must own a reserved TCP port for session establishment ๐Ÿฐ. The ultimate TCP connection used to send and receive data doesn't have to go through that reserved port, though ๐Ÿ™Œ. The RETARGET procedure lets the NetBIOS session shift to another TCP connection, possibly through a different port at the called end ๐Ÿฆ‹. That port can be an unprivileged resource with a value greater than 1023 ๐Ÿ’–. This is what makes life easier for casual applications ๐ŸŒท.

Alternatively, the RETARGET mechanism lets the TCP port used for data transmission and reception be a reserved port ๐Ÿชช. So an application that wants access to ports maintained by the system administrator can use these restricted TCP ports ๐Ÿ—๏ธ. This is what supports privileged applications ๐Ÿ‘‘.

A particular implementation may want to require extra special privileges for session establishment, and those could be tied to internal information ๐Ÿง . It doesn't have to be based only on TCP port allocation ๐Ÿ™…โ€โ™€๏ธ. For example, a given NetBIOS name might only be used for sessions by applications with a certain system privilege level ๐ŸŽ–๏ธ.

Whether to use reserved or unreserved ports, or to add any additional name registration and usage authorization, is purely a local implementation decision โœจ. The NetBIOS protocols specified in this RFC don't require it ๐Ÿ’œ. Your implementation, your rules, bestie ๐Ÿ’…๐ŸŒˆ.

B-3. TCP VERSUS SESSION KEEP-ALIVES ๐Ÿฆ‹

okay so a KEEP-ALIVE is basically how a connection checks its own vibe ๐Ÿ’… ๐Ÿซถ You send a packet to your connection partner to ask "still there?" and they reply to show the connection is still working ๐ŸŒธ TCP KEEP-ALIVES happen at the TCP level on TCP connections, while session KEEP-ALIVES are used on NetBIOS sessions โœจ These protocol operations are always transparent to the connection user ๐Ÿ™ˆ The user only finds out about a KEEP-ALIVE if it fails, meaning the connection was lost ๐Ÿ’€

The NetBIOS specification[2] says the NetBIOS service has to tell the session user if a session gets lost while it's in a passive or active state ๐Ÿ”ฅ So if the session user is only waiting on a receive and the session drops, the NetBIOS service must tell them. It cannot wait for a session send operation before it informs the user that the connection is gone ๐Ÿ˜ญ

This matters because of how NetBIOS apps manage scarce or volatile resources ๐Ÿ‘‘ Say a user kills a session with a server app by destroying the client app or the NetBIOS service without a NetBIOS Hang Up. The server app will want to clean up and free its resources. If that server only receives and then sends a response, it needs to be told about the session abort while it's in the passive state. Main character energy, honestly ๐Ÿ’œ

The standard TCP service can't detect a lost connection while it's in a passive state, just waiting for a packet to arrive ๐Ÿ’” So some TCP implementations added a KEEP-ALIVE operation that still works with implementations that don't have this feature ๐Ÿงš These implementations send a packet with an invalid sequence number to the connection partner. By specification, the partner must respond with a packet showing the correct sequence number of the connection. If no response comes back within a certain time interval, the TCP service assumes the connection is lost ๐ŸŒˆ

Since many TCP implementations don't have this KEEP-ALIVE function, an optional NetBIOS KEEP-ALIVE operation was added to the NetBIOS session protocols ๐Ÿ“ It uses the properties of TCP to solicit a response from the remote connection partner. A NetBIOS session message called KEEP-ALIVE is sent to the remote partner. Because this makes TCP send an IP packet to the partner, the TCP connection is active. TCP will discover if the connection is lost when the remote TCP partner doesn't acknowledge that IP packet. So the NetBIOS session service does not send a response to a session KEEP-ALIVE message. It just throws it away. The NetBIOS session service that sent the KEEP-ALIVE is only informed of the failure of the TCP connection, and it doesn't wait for a specific response message ๐Ÿซ 

A particular NetBIOS implementation should use KEEP-ALIVES if it wants to stay compatible with the NetBIOS interface specification[2] โœจ Compatibility is especially important if the implementation wants to support existing NetBIOS apps, which typically require session loss detection on their servers. It's also important for future apps that were built for implementations with session loss detection ๐ŸŽ€


B-4. RETARGET ALGORITHMS ๐ŸŒธ

okay this section has 2 suggestions for RETARGET algorithms, called the "straight" and "stack" methods ๐Ÿง  The algorithm in the body of the RFC uses the straight method ๐Ÿ’… Whichever algorithm you pick, you must account for the Session establishment maximum retry count. The retry count is the maximum number of TCP connect operations allowed before a failure is reported ๐Ÿ”ฅ

The straight method makes the session establishment procedure start a retry after a retargetting failure, beginning again with the initial node that the name discovery procedure returned ๐Ÿฆ‹ A retargetting failure happens when a TCP connection attempt fails because of a time-out, or when a NEGATIVE SESSION RESPONSE comes back with an error code of NOT LISTENING ON CALLED NAME. If any other failure happens, the session establishment procedure should retry from the call to the name discovery procedure ๐Ÿ™ˆ

There's a minimum of 2 retries, whether it's from a retargetting failure or a name discovery failure โœจ That gives the session service a chance to re-establish a NetBIOS Listen. Even more importantly, it lets the NetBIOS scope, the local name service, or the NBNS re-learn the correct IP address of a NetBIOS name ๐Ÿ‘‘

The stack method works a lot like the straight method ๐Ÿ’œ The difference is that instead of retrying at the initial node returned by the name discovery procedure, it restarts with the IP address of the last node that sent a SESSION RETARGET RESPONSE before the retargetting failure. To keep the stack method in check, any one host can only be tried a maximum of 2 times ๐Ÿ“


B-5. NBDD SERVICE ๐Ÿงš

If the NBDD doesn't forward datagrams, then don't provide Group and Broadcast NetBIOS datagram services to the NetBIOS user ๐ŸŒˆ So ignore the implementation of the query request. When you get a negative response, get the membership list of IP addresses and send the datagram as a unicast to each member ๐Ÿ’…


B-6. APPLICATION CONSIDERATIONS โœจ

B-6.1 USE OF NetBIOS DATAGRAMS ๐Ÿ’–

Some existing NetBIOS apps use NetBIOS datagrams as the foundation for their own connection-oriented protocols ๐Ÿฅบ This can cause excessive NetBIOS name query activity and put a serious strain on the network, server nodes, and other end nodes ๐Ÿ’€ It is recommended that this practice be avoided in new applications ๐Ÿซถ

๐Ÿ“ฆ where this page comes from