<?xml version='1.0'?>
<chapter id='encap-encap'>
<title>Encapsulation in various protocols and encapsulating</title>
<section>
<title>Introduction</title>
<para>
NetBIOS is often described as a "Session Layer" protocol and a variety of 
transport systems have been used in different implementations. Particularly 
because NetBIOS is a non-routable protocol, it has often been implemented using 
other routable protocols to provide the transport.
</para>
<para>
It has traditionally been the NetBIOS API that has been the "standard". In 
most implementations (certainly NetBIOS over TCP/IP and NetBIOS over IPX), 
encapsulation has been implemented to ensure that higher level protocols (such 
as SMB) can run over the encapsulated protocol in the same way as they would run 
over NetBIOS Frames Protocol, NBF (otherwise known as NetBEUI or NetBIOS). Thus 
it is important to understand the NetBIOS Frames Protocol, NBF in order to 
understand the various encapsulation implementations.
</para>
</section>
<section>
<title>IPX/SPX</title>
<para>
IPX/SPX are the protocols native to Novell NetWare. Details of these 
protocols can be found in:
Novell's Guide to NetWare LAN Analysis, see
<xref linkend='refs-References'/>
</para>
<para>
Novell introduced an implementation of NetBIOS over IPX in 1986. The 
implementation uses IPX datagrams to carry the NetBIOS Frames protocol described 
above.
</para>
<para>
The IPX addressing scheme is compared with the native NetBIOS and other 
schemes in
<xref linkend='nbf-addressing'/>
above. In IPX/SPX networks, a 48 bit address (usually a MAC 
address) identifies a node on a network and a 32 bit address identifies each 
network. Thus IPX is a routable protocol requiring relatively little 
administration, which makes it a useful means of implementing NetBIOS.
</para>
<para>
IPX packets are broadly analogous to IP packets in the TCP/IP suite of 
protocols; IPX packets provide an unreliable datagram delivery service. The 
structure of the IPX Header is given below for reference:
</para>
<para>
The IPX Header
</para>
<itemizedlist>
<listitem>
<para>Checksum (2 bytes)</para>
</listitem>
<listitem>
<para>Length (2 bytes)</para>
</listitem>
<listitem>
<para>Transport Control (1 byte)</para>
</listitem>
<listitem>
<para>Packet Type (1 byte) 0 or 4 for IPX, 5 for SPX, 17 (0x11) for NCP, 20 
  (0x14) WAN broadcast</para>
</listitem>
<listitem>
<para>Destination Node Address (6 bytes)</para>
</listitem>
<listitem>
<para>Destination Network Address (4 bytes)</para>
</listitem>
<listitem>
<para>Destination Socket (2 bytes)</para>
</listitem>
<listitem>
<para>Source Node Address (6 bytes)</para>
</listitem>
<listitem>
<para>Source Network Address (4 bytes)</para>
</listitem>
<listitem>
<para>source Socket ( 2 bytes)</para>
</listitem>
</itemizedlist>
<para>
The Destination Socket indicates the service being carried over IPX, some 
examples and the identifier for NetBIOS are given below:
</para>
<variablelist>
<varlistentry>
<term>0x451</term>
<listitem><para>NetWare Core Protocol (NCP)</para></listitem>
</varlistentry>
<varlistentry>
<term>0x452</term>
<listitem><para>Service Advertising Protocol packet (SAP)</para></listitem>
</varlistentry>
<varlistentry>
<term>0x453</term>
<listitem><para>Routing Information Protocol packet (RIP)</para></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>0x455</emphasis></term>
<listitem>
<para><emphasis>NetBIOS packet</emphasis></para>
</listitem>
</varlistentry>
<varlistentry>
<term>0x456</term>
<listitem><para>Diagnostic packet</para></listitem>
</varlistentry>
<varlistentry>
<term>0x457</term>
<listitem><para>Serialization packet</para></listitem>
</varlistentry>
<varlistentry>
<term>0x4000 to 0x8000</term>
<listitem><para>Dynamically assigned for use with file servers etc.</para></listitem>
</varlistentry>
</variablelist>
<section>
<title>Microsoft Implementation of NetBIOS over IPX</title>
<para>
Microsoft have implemented NetBIOS over the NWLink IPX/SPX compatible 
transport. (NWLink is a clone of Novell's IPX/SPX). The Microsoft implementation 
is compatible with Novell's NetBIOS over IPX. Microsoft sometimes refers to 
NetBIOS over IPX as NBIPX.
</para>
<table>
<title>IPX packets (Octets in order transmitted.)</title>
<tgroup cols='3'>
<thead>
<row>
<entry>Length</entry>
<entry>IPX Field</entry>
<entry>NBIPX</entry>
</row>
</thead>
<tbody>
<row>
<entry>2</entry>
<entry>Checksum</entry>
<entry morerows='9' valign='middle'>&nbsp;</entry></row>
<row>
<entry>2</entry>
<entry>Length</entry></row>
<row>
<entry>1</entry>
<entry>Transport Control</entry></row>
<row>
<entry>1</entry>
<entry>Packet Type 0 or 4 for IPX, 20 (0x14) 
WAN broadcast</entry></row>
<row>
<entry>6</entry>
<entry>Destination Node Address</entry></row>
<row>
<entry>4</entry>
<entry>Destination Network Address</entry></row>
<row>
<entry>2</entry>
<entry>Destination Socket</entry></row>
<row>
<entry>6</entry>
<entry>Source Node Address</entry></row>
<row>
<entry>4</entry>
<entry>Source Network Address</entry></row>
<row>
<entry>2</entry>
<entry>source Socket</entry></row>
<row>
<entry>n</entry>
<entry>Data</entry>
<entry>NBIXP packet</entry></row>
</tbody>
</tgroup>
</table>
<table>
<title>NBIPX session packets (Octets in order transmitted.)</title>
<tgroup cols='2'>
<thead>
<row>
<entry>Length</entry>
<entry>Field</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>NBIPX Connection Control flag</entry>
</row>
<row>
<entry>1</entry>
<entry>Data Stream type</entry>
</row>
<row>
<entry>2</entry>
<entry>Source connection id</entry>
</row>
<row>
<entry>2</entry>
<entry>Destination connection id</entry>
</row>
<row>
<entry>2</entry>
<entry>Send Sequence number</entry>
</row>
<row>
<entry>2</entry>
<entry>Total data length</entry>
</row>
<row>
<entry>2</entry>
<entry>Offset</entry>
</row>
<row>
<entry>2</entry>
<entry>Data length</entry>
</row>
<row>
<entry>2</entry>
<entry>Receive Sequence number</entry>
</row>
<row>
<entry>2</entry>
<entry>Bytes received</entry>
</row>
<row>
<entry>n</entry>
<entry>Data</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
</section>
<section id='OSI'>
<title>NetBIOS Interface and Name Service Support by Lower Layer OSI Protocols</title>
<para>
The MAP/TOP Users Group Technical Report Specification of NetBIOS Interface 
and Name Service Support by Lower Layer OSI Protocols, Version 1.0, September 
27, 1989, is reproduced as an appendix in The Open Group CAE Specification 
"Protocols for X/Open PC Interworking: SMB, Version 2."
</para>
</section>
<section id='ISO'>
<title>International Standards Organization (ISO) Protocol Suite </title>
<para>
Communications Machinery Corporation has implemented a NetBIOS interface for 
ISO protocols.
"Netbios for ISO Networks", see
<xref linkend='refs-References'/>
</para>
</section>
<section>
<title>PPP (Point-to-Point Protocol)</title>
<para>
NetBIOS can be carried over PPP (Point-to-Point Protocol). The relevant 
RFCs are:
</para>
<variablelist>
<varlistentry>
<term>RFC 2097</term>
<listitem><para>The PPP NetBIOS Frames Control Protocol (NBFCP)</para>
<para>PROPOSED STANDARD</para>
</listitem>
</varlistentry>
<varlistentry>
<term>RFC1661 STD0051</term>
<listitem><para>The Point-to-Point Protocol (PPP)</para><para>STANDARD</para></listitem>
</varlistentry>
<varlistentry>
<term>RFC 2153</term>
<listitem><para>PPP Vendor Extensions </para><para>INFORMATIONAL</para></listitem>
</varlistentry>
</variablelist>
</section>
<section>
<title>Encapsulating</title>
<para>
NetBIOS can be used to encapsulate other protocols by providing
a virtual circuit over which other protocols can be transmitted.
This is the opposite situation to those described above where other
protocols provide the transport for NetBIOS.
</para>
<section>
<title>Transmission of IP Datagrams over NetBIOS Networks</title>
<para>
A standard method of encapsulating the Internet Protocol (IP)
datagrams on NetBIOS networks is described in:
</para>
<variablelist>
<varlistentry>
<term>RFC 1088</term>
<listitem><para>A Standard for the Transmission of IP 
Datagrams over NetBIOS Networks</para></listitem>
</varlistentry>
</variablelist>
</section>
</section>
</chapter>
