<?xml version='1.0'?>
<chapter>
<title>Server Message Block Protocol</title>
<para>
There are very many systems which can use the NetBIOS / NetBEUI interface or 
make use of the NetBIOS Frames Protocol, but perhaps one of the most important 
is the Server Message Block Protocol (SMB). The Server Message Block Protocol 
(SMB), is an application level protocol used by networking systems and operating 
systems such as Microsoft's Windows for Workgroups, Windows 95 / 98 / ME, LAN 
Manager, Windows NT, Windows 2000 and IBM's OS/2 and LAN Server, NetWare 6 and 
the SAMBA implementation and as such deserves special attention.
The latest versions of the protocol are now known as the
<quote>Common Internet File System protocol</quote>.
</para>
<para>
An implementation of SMB is described in
"Protocols for X/Open PC Interworking: SMB, Version 2", see
<xref linkend='refs-References'/>
</para>
<section id='smb-history'>
<title>History</title>
<para>
According to the INTERNET-DRAFT document by 
<author>
<firstname>christopher</firstname>
<othername>R</othername>
<surname>Hertel</surname>
</author>
draft-crhertel-smb-url-03.txt
titled
<quote>SMB Filesharing URL Scheme</quote>
</para>
<para>
<quote>
The Server Message Block protocol (SMB) was created in the 1980's by
Dr. Barry Feigenbaum at IBM Corporation.  It was later extended by
IBM, 3Com, Intel, and Microsoft.  
</quote>
</para>
<para>
In 1987 Microsoft announced the LAN Manager program and in 1988 IBM announced 
the OS/2 LAN Server, both use versions of the Server Message Block Protocol. 
Enhancements and changes to the protocol have been made and a history can be 
found at:
<ulink url='http://samba.anu.edu.au/cifs/docs/smb-history.html'>http://samba.anu.edu.au/cifs/docs/smb-history.html" 
History of SMB</ulink>
</para>
<para><email>mailto:Dan.Shearer@unisa.edu.au</email></para>
<para>Some dates in the development of the protocol are given below:</para>
<table>
<title>History of SMB and CIFS</title>
<tgroup cols='2'>
<thead>
<row>
<entry>Date</entry>
<entry>Development</entry>
</row>
</thead>
<tbody>
<row>
<entry>29 November 1989</entry>
<entry>
<para>SMB.TXT is the LM 2.0 protocol. Note: In the doc is calls LM 2.0 as LM 1.2 (it's original name before being renamed to LM 2.0). </para>
<para>Microsoft Networks 
SMB FILE SHARING PROTOCOL EXTENSIONS 
SMB File Sharing Protocol Extensions Version 3.0 
Document Version 1.09</para>
</entry>
</row>
<row>
<entry>October 1992</entry>
<entry>Protocols for X/Open PC Interworking: SMB, Version 2</entry>
</row>
<row>
<entry>26 March 2001</entry>
<entry>The Storage Networking Industry Association (SNIA) produced a work-in-progress document: 
Common Internet File System (CIFS) 
Version: CIFS-Spec 0.9 
Draft SNIA CIFS Work Group Work-in-Progress 
</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Microsoft and a number of other companies, have proposed an updated version 
of SMB as an internet standard The Common Internet File System (CIFS). 
</para>
</section>
<section>
<title>Overview</title>
<para>
The Server Message Block Protocol (SMB), is an application level protocol see
<xref linkend='osi-OSI'/> 
</para>
<para>
SMB is used to implement network session control, network file and print 
sharing and messaging. SMB is used to provide functionality that is broadly analogous to
the AppleTalk Session Protocol, AppleTalk Filing Protocol and Printer Access 
Protocol etc in the AppleTalk suite of protocols. SMB is also broadly analogous 
with Novell's NetWare Core Protocol (NCP). It is difficult to find a 
non-proprietary protocol or protocols with in the TCP/IP suite which can be 
compared to SMB; file sharing via FTP or NFS and network printing via LPR are 
examples of similar functionality.
</para>
<para>
SMB requires a transport /session protocol and the early versions of IBM's 
implementation were closely linked with NetBIOS. In general SMB runs either over 
the NetBIOS Frames Protocol (NBF), NetBIOS over TCP/IP, or NetBIOS over IPX; the 
most recent versions of CIFS can run directly over TCP/IP.
</para>
<informaltable frame='none'>
<tgroup cols='7'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c5'/>
<colspec colname='c6'/>
<colspec colname='c7'/>
<spanspec spanname='hspan1' namest='c1' nameend='c7'/>
<tbody>
<row>
<entry spanname='hspan1' align='center'>Server Message Block (SMB) / 
  CIFS</entry>
</row>
<row>
<entry align='center'>/</entry>
<entry></entry>
<entry align='center'>/</entry>
<entry></entry>
<entry align='center'>\</entry>
<entry></entry>
<entry align='center'>\</entry>
</row>
<row>
<entry>NetBIOS Frames Protocol (NBF) i.e. NetBEUI i.e. 
    NetBIOS</entry>
<entry align='center'>or</entry>
<entry>NetBIOS over TCP/IP RFC 1001 RFC 1002</entry>
<entry align='center'>or</entry>
<entry>NetBIOS over IPX</entry>
<entry align='center'>or</entry>
<entry>directly over TCP/IP</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
See
<xref linkend='osi-OSI'/>
for details of the relationship between the various protocols.
</para>
<para>
SMB has inherited some of the advantages and disadvantages of NetBIOS, in 
particular, prior to the latest versions of CIFS it was directly linked with the 
NetBIOS addressing scheme.
</para>
</section>
<section>
<title>Addressing</title>
<para>
Prior to the latest versions of CIFS, SMB uses network names which are 
strings of 16 bytes. In general these names are mapped directly on to NetBIOS 
names (see
<xref linkend='nbf-addressing'/>
above).
The traditional SMB names of systems can be up to 15 
characters long and are padded with blanks if necessary. The 16th byte is used 
to indicate whether the name refers to a server or another function.
</para>
<para>
In Microsoft networks with NT 3.x and NT 4.0 systems some names are used with 
NT 3.x and NT 4.0 Domains as well as for computer names. Some examples of names 
and use of the 16th byte are given below:
</para>
<table frame='all'>
<title>SMB Names</title>
<tgroup cols='2'>
<thead>
<row>
<entry>SMB Name</entry>
<entry>Purpose</entry>
</row>
</thead>
<tbody>
<row>
<entry>Computername[0x00]</entry>
<entry>Workstation service</entry>
</row>
<row>
<entry>Computername[0x20]</entry>
<entry>Server service</entry>
</row>
<row>
<entry>Domainname[0x00]</entry>
<entry>Register computer in domain</entry>
</row>
<row>
<entry>Domainname[0x1C]</entry>
<entry>Domain controller</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
Unique NetBIOS names will map to SMB individual system names, and NetBIOS 
group names will map to workgroup or domain names.
</para>
<para>
Like NetBIOS names, traditional SMB names are non hierarchical and constitute 
a flat non-routable name space which does not scale well.
</para>
</section>
<section>
<title>SMB on NBF</title>
<para>
The most recent version of CIFS can run directly over TCP/IP; however many 
implementations of SMB are designed to run over NBF frames.  SMB is designed to
use NBF frames as a transport.  Whether NBF frames are used natively "on the
wire" or encapsulated in TCP/IP, IPX or another protocol should be transparent
to SMB.
</para>
<section>
<title>SMB on NBF datagram frames</title>
<para>
SMB uses both NBF datagram and session frames.  As explained in the discussion
of NBF the datagram frames are used exclusively to provide a datagram service 
and not a transport for higher level protocols; within this context NBF datagram
frames are generally used with SMB frames that are concerned with address management.
</para>
<table frame='all'>
  <title>Datagram frames (Octets in order transmitted.)</title>
<tgroup cols='4'>
<thead>
<row>
    <entry></entry>
    <entry></entry>
    <entry>Data frame</entry>
    <entry>Data frame</entry>
</row>
<row>
    <entry>Field Name</entry>

    <entry>Length</entry>
    <entry>DATAGRAM</entry>
    <entry>SMB</entry>
</row>
</thead>
  <tbody>
<row>
    <entry morerows='1'>Length</entry>
    <entry morerows='1'>2</entry>

    <entry>0x2C </entry></row>
<row>
    <entry>0x00 </entry></row>
<row>
    <entry morerows='1'>Deliminator</entry>
    <entry morerows='1'>2</entry>
    <entry>0xFF </entry></row>

<row>
    <entry>0xEF </entry></row>
<row>
    <entry>Command</entry>
    <entry>1</entry>
    <entry>0x08</entry></row>
<row>

    <entry>Data 1 </entry>
    <entry>1</entry>
    <entry>Reserved </entry></row>
<row>
    <entry morerows='1'>Data 2 </entry>
    <entry morerows='1'>2</entry>

    <entry>Reserved </entry></row>
<row>
    <entry>Reserved </entry></row>
<row>
    <entry morerows='1'>XMIT Cor </entry>
    <entry morerows='1'>2</entry>
    <entry>Reserved </entry></row>

<row>
    <entry>Reserved </entry></row>
<row>
    <entry morerows='1'>RSP Cor </entry>
    <entry morerows='1'>2</entry>
    <entry>Reserved </entry></row>
<row>

    <entry>Reserved </entry></row>
<row>
    <entry>Destination Name </entry>
    <entry>16</entry>
    <entry>Name of receiver</entry></row>
<row>

    <entry>Source Name</entry>
    <entry>16</entry>
    <entry>Name of sender</entry></row>
<row>
    <entry>Optional </entry>
    <entry></entry>

    <entry>Datagram </entry>
    <entry>SMB frame </entry></row>
</tbody>
</tgroup>
</table>
<table>
  <title>Datagram frames (Octets in order transmitted.)</title>
<tgroup cols='4'>
<thead>
<row>
    <entry></entry>
    <entry></entry>
    <entry>Data frame</entry>
    <entry>Data frame</entry></row>
<row>
    <entry>Field Name</entry>
    <entry>Length</entry>
    <entry>DATAGRAM BROADCAST</entry>
    <entry>SMB</entry></row>
</thead>
  <tbody>
<row>
    <entry morerows='1'>Length</entry>
    <entry morerows='1'>2</entry>
    <entry>0x2C </entry></row>
<row>
    <entry>0x00 </entry></row>
<row>
    <entry morerows='1'>Deliminator</entry>
    <entry morerows='1'>2</entry>
    <entry>0xFF </entry></row>
<row>
    <entry>0xEF </entry></row>
<row>
    <entry>Command</entry>
    <entry>1</entry>
    <entry>0x09</entry></row>
<row>
    <entry>Data 1 </entry>
    <entry>1</entry>
    <entry>Reserved </entry></row>
<row>
    <entry morerows='1'>Data 2 </entry>
    <entry morerows='1'>2</entry>
    <entry>Reserved </entry></row>
<row>
    <entry>Reserved </entry></row>
<row>
    <entry morerows='1'>XMIT Cor </entry>
    <entry morerows='1'>2</entry>
    <entry>Reserved </entry></row>
<row>
    <entry>Reserved </entry></row>
<row>
    <entry morerows='1'>RSP Cor </entry>
    <entry morerows='1'>2</entry>
    <entry>Reserved </entry></row>
<row>
    <entry>Reserved </entry></row>
<row>
    <entry>Destination Name </entry>
    <entry>16</entry>
    <entry>Reserved </entry></row>
<row>
    <entry>Source Name</entry>
    <entry>16</entry>
    <entry>Name of sender</entry></row>
<row>
    <entry>Optional </entry>
    <entry></entry>
    <entry>Datagram </entry>
    <entry>SMB frame </entry></row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>SMB on NBF session frames</title>
<table>
<title>Session Data Transfer frames (Octets in order transmitted.)</title>
<tgroup cols='4'>
<thead>
<row>
<entry></entry>
<entry></entry>
<entry>Data frame</entry>
<entry>Data frame</entry></row>
<row>
<entry>Field Name</entry>
<entry>Length</entry>
<entry>DATA FIRST MIDDLE</entry>
<entry>SMB</entry></row>
</thead>
<tbody>
<row>
<entry morerows='1'>Length</entry>
<entry morerows='1'>2 </entry>
<entry>0x0E </entry></row>
<row>
<entry>0x00 </entry></row>
<row>
<entry morerows='1'>Deliminator</entry>
<entry morerows='1'>2</entry>
<entry>0xFF </entry></row>
<row>
<entry>0xEF </entry></row>
<row>
<entry>Command</entry>
<entry>1</entry>
<entry>0x15</entry></row>
<row>
<entry>Data1</entry>
<entry>1</entry>
<entry>Brrrxryz</entry></row>
<row>
    <entry morerows='1'>Data2</entry>
    <entry morerows='1'>2</entry>
<entry>Re-synch indicator</entry></row>
<row>
<entry>Re-synch indicator</entry></row>
<row>
    <entry morerows='1'>XMIT Cor </entry>
    <entry morerows='1'>2</entry>
<entry>nnnn</entry></row>
<row>
<entry>nnnn</entry></row>
<row>
    <entry morerows='1'>RSP Cor </entry>
    <entry morerows='1'>2</entry>
<entry>nnnn</entry></row>
<row>
<entry>nnnn</entry></row>
<row>
<entry>Dest Num </entry>
<entry>1</entry>
<entry>Remote session num</entry></row>
<row>
<entry>Source Num</entry>
<entry>1</entry>
<entry>Local session num</entry></row>
<row>
<entry>Optional data</entry>
<entry></entry>
<entry>USER DATA Message from send</entry>
<entry>SMB frame</entry></row>
</tbody>
</tgroup>
</table>
<table>
  <title>Session Data Transfer frames (Octets in order 
  transmitted.)</title>
<tgroup cols='4'>
<thead>
<row>
<entry></entry>
<entry></entry>
<entry>Data frame</entry>
<entry>Data frame</entry></row>
<row>
<entry>Field Name</entry>
<entry>Length</entry>
<entry>DATA ONLY LAST</entry>
<entry>SMB</entry></row>
</thead>
  <tbody>
<row>
    <entry morerows='1'>Length</entry>
    <entry morerows='1'>2 </entry>
<entry>0x0E </entry></row>
<row>
<entry>0x00 </entry></row>
<row>
    <entry morerows='1'>Deliminator</entry>
    <entry morerows='1'>2</entry>
<entry>0xFF </entry></row>
<row>
<entry>0xEF </entry></row>
<row>
<entry>Command</entry>
<entry>1</entry>
<entry>0x16</entry></row>
<row>
<entry>Data1</entry>
<entry>1</entry>
<entry>Brrrxryz</entry></row>
<row>
    <entry morerows='1'>Data2</entry>
    <entry morerows='1'>2</entry>
<entry>Re-synch indicator</entry></row>
<row>
<entry>Re-synch indicator</entry></row>
<row>
    <entry morerows='1'>XMIT Cor </entry>
    <entry morerows='1'>2</entry>
<entry>nnnn</entry></row>
<row>
<entry>nnnn</entry></row>
<row>
    <entry morerows='1'>RSP Cor </entry>
    <entry morerows='1'>2</entry>
<entry>nnnn</entry></row>
<row>
<entry>nnnn</entry></row>
<row>
<entry>Dest Num </entry>
<entry>1</entry>
<entry>Remote session num</entry></row>
<row>
<entry>Source Num</entry>
<entry>1</entry>
<entry>Local session num</entry></row>
<row>
<entry>Optional data</entry>
<entry></entry>
<entry>USER DATA Message from send</entry>
<entry>SMB frame</entry></row>
</tbody>
</tgroup>
</table>
</section>
</section>
<section>
<title>SMB frame header</title>
<para>
Each SMB frame begins with a standard header.  Following a deliminator of 
"0xFF", there are three bytes "0x53", "0x4d" and "0x42" corresponding to the 
values "S", "M", "B" which makes identifying SMB frames easier.  The three ID
bytes are followed by a command byte which is discussed in 
<xref linkend='smb-SMBCommandCode'></xref>
</para>

<table>
  <title>SMB frames (Octets in order transmitted.)</title>
<tgroup cols='3'>
<thead>
<row>
    <entry>Field Name</entry>
    <entry>Length</entry>
    <entry>SMB</entry></row>
</thead>
 <tbody>
<row>
    <entry>Deliminator</entry>
    <entry>1</entry>
    <entry>0xFF</entry></row>
<row>
    <entry morerows='2'>ID</entry>
    <entry morerows='2'>3</entry>
    <entry>0x53 "S"</entry></row>
<row>
    <entry>0x4d "M"</entry></row>
<row>
    <entry>0x42 "B"</entry></row>
<row>
    <entry>Command</entry>
    <entry>1</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>Error class</entry>
    <entry>1</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>Reserved</entry>
    <entry>1</entry>
    <entry>reserved</entry></row>
<row>
    <entry morerows='1'>Error code</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>Flags</entry>
    <entry>1</entry>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='1'>Flags 2 / Reserved</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='11'>Reserved? 12?</entry>
    <entry morerows='11'>12</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='1'>authenticated resource 
      identifier / Tree ID</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='1'>caller's Process ID</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='1'>unathenticated User ID</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='1'>Multiplex ID</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry>count of 16-bit fields Word count</entry>
    <entry>1</entry>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='1'>variable no of 16-bit fields 
      byte count</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='1'>count of 8-bit fields that 
      follow</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
<row>
    <entry morerows='1'>variable number of 8-bit 
    fields</entry>
    <entry morerows='1'>2</entry>
    <entry>0xNN</entry></row>
<row>
    <entry>0xNN</entry></row>
</tbody>
</tgroup>
</table>
<para>
SMB is very analogous to the NetWare Core Protocol (NCF); there are numerous 
functions available for accomplishing various tasks. There are very many SMB 
frames for different functions and all share the same header format; the second 
field, <quote>command</quote>, determines the function and possibly the format of 
the rest of 
the frame following the header.
</para>
</section>
<section id='smb-SMBCommandCode'>
<title>SMB Command Codes</title>
<para>
Below is a table giving some of the Core SMB commands: 
</para>
<table>
<title>Core SMB Commands</title>
<tgroup cols='3'>
<thead>
<row>
    <entry>Field Name</entry>
    <entry>smb_com</entry>
    <entry>Description</entry>
</row>
</thead>
<tbody>
<row>
    <entry>SMBmkdir</entry>
    <entry>0x00</entry>
    <entry>Create directory</entry>
</row>
<row>
    <entry>SMBrmdir</entry>
    <entry>0x01</entry>
    <entry>Delete directory</entry>
</row>
<row>
    <entry>SMBopen</entry>
    <entry>0x02</entry>
    <entry>Open file</entry>
</row>
<row>
    <entry>SMBcreate</entry>
    <entry>0x03</entry>
    <entry>Create file</entry>
</row>
<row>
    <entry>SMBclose</entry>
    <entry>0x04</entry>
    <entry>Close file</entry>
</row>
<row>
    <entry>SMBflush</entry>
    <entry>0x05</entry>
    <entry>Commit all files</entry>
</row>
<row>
    <entry>SMBunlink</entry>
    <entry>0x06</entry>
    <entry>Delete file</entry>
</row>
<row>
    <entry>SMBmv</entry>
    <entry>0x07</entry>
    <entry>Rename file</entry>
</row>
<row>
    <entry>SMBgetatr</entry>
    <entry>0x08</entry>
    <entry>Get file attribute</entry>
</row>
<row>
    <entry>SMBsetatr</entry>
    <entry>0x09</entry>
    <entry>Set file attribute</entry>
</row>
<row>
    <entry>SMBread</entry>
    <entry>0x0a</entry>
    <entry>Read byte block</entry>
</row>
<row>
    <entry>SMBwrite</entry>
    <entry>0x0b</entry>
    <entry>Write byte block</entry>
</row>
<row>
    <entry>SMBlock</entry>
    <entry>0x0c</entry>
    <entry>Lock byte block</entry>
</row>
<row>
    <entry>SMBunlock</entry>
    <entry>0x0d</entry>
    <entry>Unlock byte block</entry>
</row>
<row>
    <entry></entry>
    <entry></entry>
    <entry></entry>
</row>
<row>
    <entry>SMBmknew</entry>
    <entry>0x0f</entry>
    <entry>Create new file</entry>
</row>
<row>
    <entry>SMBchkpth</entry>
    <entry>0x10</entry>
    <entry>Check directory</entry>

</row>
<row>
    <entry>SMBexit</entry>
    <entry>0x11</entry>
    <entry>End of process</entry>
</row>
<row>
    <entry>SMBlseek</entry>
    <entry>0x12</entry>
    <entry>LSEEK</entry>
</row>
<row>
    <entry></entry>
    <entry></entry>
    <entry></entry>
</row>
<row>
    <entry>SMBtcon</entry>
    <entry>0x70</entry>
    <entry>Start connection</entry>
</row>
<row>
    <entry>SMBtdis</entry>
    <entry>0x71</entry>
    <entry>End connection</entry>
</row>
<row>
    <entry>SMBnegprot</entry>
    <entry>0x72</entry>
    <entry>Verify dialect</entry>
</row>
<row>
    <entry></entry>
    <entry></entry>
    <entry></entry>
</row>
<row>
    <entry>SMBbskattr</entry>
    <entry>0x80</entry>
    <entry>Get disk attributes</entry>
</row>
<row>
    <entry>SMBsearch</entry>
    <entry>0x81</entry>
    <entry>Search multiple files</entry>
</row>
<row>
    <entry></entry>
    <entry></entry>
    <entry></entry>
</row>
<row>
    <entry>SMBsplopen</entry>
    <entry>0xc0</entry>
    <entry>Create spool file</entry>
</row>
<row>
    <entry>SMBsplwr</entry>
    <entry>0xc1</entry>
    <entry>Spool byte block</entry>
</row>
<row>
    <entry>SMBsplclose</entry>
    <entry>0xc2</entry>
    <entry>Close spool file</entry>
</row>
<row>
    <entry>SMBsplretq</entry>
    <entry>0xc3</entry>
    <entry>Return print queue</entry>
</row>
<row>
    <entry>SMBsends</entry>
    <entry>0xd0</entry>
    <entry>Send message</entry>
</row>
<row>
    <entry>SMBsendb</entry>
    <entry>0xd1</entry>
    <entry>Send broadcast</entry>
</row>
<row>
    <entry>SMBfwdname</entry>
    <entry>0xd2</entry>
    <entry>Forward user name</entry>
</row>
<row>
    <entry>SMBcancelf</entry>
    <entry>0xd3</entry>
    <entry>Cancel forward</entry>
</row>
<row>
    <entry>SMBgetmac</entry>
    <entry>0xd4</entry>
    <entry>Get machine name</entry>
</row>
<row>
    <entry>SMBsendstrt</entry>
    <entry>0xd5</entry>
    <entry>Start multi-block message</entry>
</row>
<row>
    <entry>SMBsendend</entry>
    <entry>0xd6</entry>
    <entry>End multi-block message</entry>
</row>
<row>
    <entry>SMBsendtxt</entry>
    <entry>0xd7</entry>
    <entry>Multi-block message text</entry>
</row>
<row>
    <entry>Never valid</entry>
    <entry>0xfe</entry>
    <entry>Invalid</entry>
</row>
<row>
    <entry>Implementation-dependent</entry>
    <entry>0xff</entry>
    <entry>Implementation-dependent</entry>
</row>
</tbody>
</tgroup>
</table>
<para>Below is a table giving some of the Core plus commands: </para>
<table>
<title>Core plus Commands </title>
<tgroup cols='3'>
<thead>
<row>
    <entry>Field Name</entry>
    <entry>smb_com</entry>
    <entry>Description</entry>
</row>
</thead>
<tbody>
<row>
    <entry>SMBlockreadr</entry>
    <entry>0x13</entry>
    <entry>Lock then read data</entry>
</row>
<row>
    <entry>SMBwriteunlock</entry>
    <entry>0x14</entry>
    <entry>Write then unlock data</entry>
</row>
<row>
    <entry>SMBreadBraw</entry>
    <entry>0x1a</entry>
    <entry>Read block raw</entry></row>
<row>
    <entry>SMBwriteBraw</entry>
    <entry>0x1d</entry>
    <entry>Write block raw</entry>
</row>
</tbody>
</tgroup>
</table>
<para>Below is a table giving some of the LANMAN 1.0 SMB commands: </para>
<table>
  <title>LANMAN 1.0 SMB Commands </title>
<tgroup cols='3'>
<thead>
<row>
    <entry>Field Name</entry>
    <entry>smb_com</entry>
    <entry>Description</entry></row>
</thead>
<tbody>
<row>
    <entry>SMBreadBmpx</entry>
    <entry>0x1b</entry>
    <entry>Read block multiplexed</entry>
</row>
<row>
    <entry>SMBreadBs</entry>
    <entry>0x1c</entry>
    <entry>Read block (secondary response)</entry>
</row>
<row>
    <entry>SMBwriteBmpx</entry>
    <entry>0x1e</entry>
    <entry>Write block multiplexed</entry>
</row>
<row>
    <entry>SMBwriteBs</entry>
    <entry>0x1f</entry>
    <entry>Write block (secondary response)</entry>
</row>
<row>
    <entry>SMBwriteC</entry>
    <entry>0x20</entry>
    <entry>Write complete response</entry>
</row>
<row>
    <entry>SMBsetattrE</entry>
    <entry>0x22</entry>
    <entry>Set file attributes expanded</entry>
</row>
<row>
    <entry>SMBgetattrE</entry>
    <entry>0x23</entry>
    <entry>Get file attributes expanded</entry>
</row>
<row>
    <entry>SMBlockingX</entry>
    <entry>0x24</entry>
    <entry>Lock/unlock byte ranges and X</entry>
</row>
<row>
    <entry>SMBtrans</entry>
    <entry>0x25</entry>
    <entry>Transaction (name, bytes in/out)</entry>
</row>
<row>
    <entry>SMBtranss</entry>
    <entry>0x26</entry>
    <entry>Transaction (secondary 
    request/response)</entry></row>
<row>
    <entry>SMBioctl</entry>
    <entry>0x27</entry>
    <entry>Passes the IOCTL to the server</entry>
</row>
<row>
    <entry>SMBioctls</entry>
    <entry>0x28</entry>
    <entry>IOCTL (secondary request/response)</entry>
</row>
<row>
    <entry>SMBcopy</entry>
    <entry>0x29</entry>
    <entry>Copy</entry>
</row>
<row>
    <entry>SMBmove</entry>
    <entry>0x2a</entry>
    <entry>Move</entry>
</row>
<row>
    <entry>SMBecho</entry>
    <entry>0x2b</entry>
    <entry>Echo</entry>
</row>
<row>
    <entry>SMBwriteclose</entry>
    <entry>0x2c</entry>
    <entry>Write and Close</entry>
</row>
<row>
    <entry>SMBopenX</entry>
    <entry>0x2d</entry>
    <entry>Open and X</entry>
</row>
<row>
    <entry>SMBreadX</entry>
    <entry>0x2e</entry>
    <entry>Read and X</entry>
</row>
<row>
    <entry>SMBwriteX</entry>
    <entry>0x2f</entry>
    <entry>Write and X</entry></row>
<row>
    <entry>SMBsesssetup</entry>
    <entry>0x73</entry>
    <entry>Session Set Up and X (including User 
      Logon)</entry>
</row>
<row>
    <entry>SMBtconX</entry>
    <entry>0x75</entry>
    <entry>Tree connect and X</entry>
</row>
<row>
    <entry>SMBffirst</entry>
    <entry>0x82</entry>
    <entry>Find first</entry>
</row>
<row>
    <entry>SMBfunique</entry>
    <entry>0x83</entry>
    <entry>Find unique</entry>
</row>
<row>
    <entry>SMBfclose</entry>
    <entry>0x84</entry>
    <entry>Find close</entry>
</row>
<row>
    <entry>SMBinvalid</entry>
    <entry>0xfe</entry>
    <entry>Invalid command</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>SMB Error Class</title>
<para>
Below is a table giving some of the SMB Error class values: 
</para>
<table>
<title>SMB Error Class </title>
<tgroup cols='3'>
<thead>
<row>
<entry>Field Name</entry>
<entry>Value</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>SUCCESS</entry>
<entry>0x00</entry>
<entry>The request was successful</entry>
</row>
<row>
<entry>ERRSRV</entry>
<entry>0x02</entry>
<entry>Error generated by the LMX server</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>SMB Return Codes for Error class 0x00</title>
<para>
Below is a table giving some of the SMB Return Code Values when the Error class is 0x00:
</para>
<table>
<title>SMB Return Code</title>
<tgroup cols='3'>
<thead>
<row>
<entry>Field Name</entry>
<entry>Value</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>BUFFERED</entry>
<entry>0x54</entry>
<entry>The Message was buffered</entry>
</row>
<row>
<entry>LOGGED</entry>
<entry>0x55</entry>
<entry>The Message was logged</entry>
</row>
<row>
<entry>DISPLAYED</entry>
<entry>0x56</entry>
<entry>The Message was displayed</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>SMB Return Codes for Error class 0x02</title>
<para>
Below is a table giving some of the SMB Return Code Values when the Error class is 0x02:  
</para>
<table>
<title>SMB Return Code </title>
<tgroup cols='3'>
<thead>
<row>
<entry>Field Name</entry>
<entry>Value</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>ERRerror</entry>
<entry>0x01</entry>
<entry>Non-specific error code</entry>
</row>
<row>
<entry>ERRbadpw</entry>
<entry>0x02</entry>
<entry>Bad password</entry>
</row>
<row>
<entry>ERRbadtype</entry>
<entry>0x03</entry>
<entry>Reserved</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>SMB Dialects</title>
<para>
The SMB protocol has been developed and enhanced since it was first 
introduced. The original version is known as the "core protocol" and is 
understood by systems implementing later versions which are supersets of the 
original. Systems using SMB negotiate which version i.e. dialect they will 
support.
</para>
<para>
The function SMBnegprot 0x72 is used at the beginning of a session to 
establish the dialect to be used.
See <xref linkend='smb-SMBCommandCode'/>
</para>
<para>
When packets are being sent to negotiate the dialect, a string is used to 
indicate which dialects are supported. So just as the use of the string "SMB" 
within SMB packets makes identifying such packets easier, the use of readable 
strings makes understanding which dialects are used easier. Below is a table 
giving some of the strings used to identify dialects and the terms commonly used 
to refer to the given dialect.
</para>
<table>
<title>SMB dialects</title>
<tgroup cols='2'>
<thead>
<row>
<entry>string identifying dialect</entry>
<entry>Reference</entry>
</row>
</thead>
<tbody>
<row>
<entry>PC NETWORK PROGRAM 1.0</entry>
<entry>core protocol</entry>
</row>
<row>
<entry>MICROSOFT NETWORKS 1.03</entry>
<entry>core plus dialect</entry>
</row>
<row>
<entry>MICROSOFT NETWORKS 3.0</entry>
<entry>extended 1.0 protocol</entry>
</row>
<row>
<entry>LANMAN1.0</entry>
<entry>extended 1.0 protocol, first version of full LANMAN 1.0 protocol</entry>
</row>
<row>
<entry>Windows for Workgroups 3.1a</entry>
<entry></entry>
</row>
<row>
<entry>LM1.2X002</entry>
<entry>extended 2.0 protocol</entry>
</row>
<row>
<entry>LANMAN2.1</entry>
<entry></entry>
</row>
<row>
<entry>NT LM 0.12</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>SAMBA</title>
<para>
While this documentation is primarily concerned with protocols rather than 
implementations; there is one implementation that deserves special mention.
A project has been established to provide free implementations of the SMB
protocol and file and printing sharing facilities for various platforms.
More information can be found about the SAMBA project at the web site:
<ulink url='http://www.samba.org'>www.samba.org</ulink>
</para>
<para>SAMBA is freely available for very many platforms and has thus
provided a means for file and print sharing between different platforms
and Operating Systems.  The SAMBA project has had to "reverse engineer" the
protocols and continues to work in this manner in order to keep the software free.</para>
<para>Despite having released a version of SMB to the X-Open organization,
Microsoft continues to develop the protocol as a proprietary protocol and
details of some of the more recent versions have not been made freely 
available.</para>
</section>
<section>
<title>Further information</title>
<para>
Further information is available on the net:
<ulink url='http://samba.anu.edu.au/cifs/docs/what-is-smb.html'>Just what is SMB? V1.0 Richard Sharpe </ulink>
</para>
</section>
</chapter>

