SAP is implemented using the IPX datagram
protocol. The SAP information for querying or
advertising servers becomes the data portion of the
IPX packet. The SAP header is defined in
include/sys/sap_app.h.
The IPX header is 30 bytes and contains fields
for checksum, length, transport control, packet type,
destination address (network, node, socket), and source
address (network, node, socket). For more information
about the IPX header, see
``IPX header fields''.
SAP operation
The SAP Operation field is two bytes long and
determines the format of the rest of the packet.
The SAP Operation field identifies four types of packets.
Operation type
Constant
Hex value
General Service Query
SAP_GSQ
0x0001
General Service Response
SAP_GSR
0x0002
Nearest Service Query
SAP_NSQ
0x0003
Nearest Server Response
SAP_NSR
0x0004
NOTE:
Previous versions of SAP defined the periodic
broadcast as a fifth packet type. Because the periodic
broadcast packet uses the same format as a General Service
Response packet, it is no longer described as a separate
packet type. The difference was only that of context.
However, the #define has been left in
include/sys/sap_app.h to provide backward compatibility.
Server information structure
Each structure contains information for a particular
advertising server. This SAPS (Server Information)
structure is defined in the sap_app.h
file in the include/sys directory.
It has the following format:
The number of Server Information structures
that are passed can be determined by subtracting
the length of the IPX header and Operation
field from the length of the packet and then dividing
the remainder by the size of the Server Information structure.
The number of structures depends on the maximum
packet size used on a network.
Seven structures fit in a 576-byte packet.
The fields of the Server Information structure
(described below) store the information obtained
from SAP response packets.
Server type
This field is in hi-lo order and contains the
object type of the advertising server.
NOTE:
NetWare 3.x servers maintain an object database
called the Bindery. Although NetWare 4.x servers
maintain a distributed object database called the
Directory, they operate in bindery emulation mode
by default to maintain backward compatibility.
Novell administers object types.
If you are developing an advertising application server,
contact Novell to be assigned a unique object type for your server.
This field contains the unique name (per server
type within the internetwork) of a server that
provides a service (file, printing, database
management, archiving, and so on). The name
of the advertising server must be at least
2 characters long and (because the name is
a NULL-terminated string) cannot be more than 47 characters.
Server address
This field contains the server's complete
IPX address: Network, Node, and Socket.
For more information, see
``IPX addressing''.
Hops to server
This field contains the distance vector.
In other words, the number of hops is the
distance to the server, defined in terms of
the number of intermediate networks (the
number of routers that exist between the
client and the server). For NWS,
since the SAP daemon is the
SAP agent, this is in the number of
routers between the server and SAPD.
Initially the field is set to 1; each time
the packet passes through an intermediate network,
the field is incremented by one.