NetBIOS
Until the 1990s, the Network Basic Input/Output System (NetBIOS)
programming API had been the most widely used programming API on
PCs. NetBIOS allows for both reliable-connection-oriented and
unreliable-connectionless communication. Windows 2000 supports
NetBIOS for its legacy applications. Microsoft discourages
application developers from using NetBIOS because other APIs,
such as named pipes and Winsock, are much more flexible and
portable. NetBIOS is supported by the TCP/IP, NetBEUI, and
IPX/SPX protocols on Windows 2000.
NetBIOS Names:
NetBIOS relies on a naming convention whereby computers
and network services are assigned a 16-byte name called a
NetBIOS name. The 16th byte of a NetBIOS name is treated as a
modifier that can specify a name as unique or as part of a group.
Only one instance of a unique NetBIOS name can be assigned to a
network, but multiple applications can assign the same group
name. A client can broadcast messages by sending them to a group
name.
To support interoperability with Windows NT 4 systems as well as
Consumer Windows, Windows 2000 automatically defines a NetBIOS name
for a domain that is the first 15 bytes of the Domain Name System
(DNS) name that an administrator assigns to the domain. For example,
if a domain were named mspress.microsoft.com, the NetBIOS name of
the domain would be mspress. Similarly, Windows 2000 requires an
administrator to assign each computer a NetBIOS name at the time
of installation.
Another concept used by NetBIOS is that of LAN adapter (LANA)
numbers. A LANA number is assigned to every NetBIOS-compatible
protocol that layers above a network adapter. For example, if a
computer has two network adapters and TCP/IP and NetBEUI can use
either adapter, there would be four LANA numbers. LANA numbers are
important because a NetBIOS application must explicitly assign its
service name to each LANA through which it's willing to accept
client connections. If the application listens for client
connections on a particular name, clients can access the name
only via protocols on the network adapters for which the name is
registered.
A networking service called Windows Internet Name Service (WINS) maintains
the mapping between NetBIOS names and TCP/IP protocol addresses.
If WINS isn't installed, NetBIOS uses name broadcasting to
propagate names within a Windows network. Note that NetBIOS names
are secondary to DNS names: computer names are registered and
resolved first through DNS, with Windows 2000 falling back on
NetBIOS names only if DNS name resolution fails.
NetBIOS Operation
A NetBIOS server application uses the NetBIOS API to enumerate the
LANAs present on a system and assign a NetBIOS name representing
the application's service to each LANA. If the server is connection
oriented, it performs a NetBIOS listen command to wait for client
connection attempts. After a client is connected, the server
executes NetBIOS functions to send and receive data. Connectionless
communication is similar, but the server simply reads messages
without establishing connections.
A connection-oriented client uses NetBIOS functions to establish a
connection with a NetBIOS server and then executes further NetBIOS
functions to send and receive data. An established NetBIOS
connection is also known as a session. If the client wants to send
connectionless messages, it simply specifies the NetBIOS name of
the server with the send function.
NetBIOS consists of a number of functions, but they all route
through the same interface: Netbios. This routing scheme is the
result of a legacy left over from the time when NetBIOS was
implemented on MS-DOS as an MS-DOS interrupt service. A NetBIOS
application would execute an MS-DOS interrupt and pass a data
structure to the NetBIOS implementation that specified every
aspect of the command being executed. As a result, the Netbios
function in Windows 2000 takes a single parameter, which is a data
structure that contains the parameters specific to the service the
application requests.
NetBIOS API Implementation
The components that implement the NetBIOS API are shown in the
Figure below. The Netbios function is exported to applications
by \Winnt\System32\Netapi32.dll. Netapi32.dll opens a handle to
the kernel-mode driver named the NetBIOS emulator
(\Winnt\System32\Drivers\Netbios.sys) and issues Win32
DeviceIoControl file commands on behalf of an application.
The NetBIOS emulator translates NetBIOS commands issued by an
application into TDI commands that it sends to protocol
drivers.
|
If an application wants to use NetBIOS over the TCP/IP protocol,
the NetBIOS emulator requires the presence of the NetBT
driver (\Winnt\System32\Drivers\Netbt.sys).
NetBT is known as the NetBIOS over TCP/IP driver and is
responsible for supporting NetBIOS semantics that are inherent
to the NetBEUI protocol, but not the TCP/IP protocol.
For example, NetBIOS relies on NetBEUI's message-mode
transmission and NetBIOS name resolution facilities,
so the NetBT driver implements them on top of the TCP/IP
protocol. Similarly, the NwLinkNB driver implements NetBIOS
semantics over the IPX/SPX protocol.
|