Service advertising protocol (SAP)

SAP packet structure

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.

``SAP packet structure'' illustrates the layout of the SAP packet.

SAP packet structure

IPX header

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

 --------------------------------------------------------------------------
| 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:

#define SAP_MAX_SERVER_NAME_LENGTH 48

typedef struct saps_s { uint16 serverType; uint8 serverName[SAP_MAX_SERVER_NAME_LENGTH]; ipxAddr_t serverAddress; uint16 serverHops; } SAPS, *SAPSP;

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.

``Common serfer object types'' lists some of Novell's common object types.

Common serfer object types

Bindery object Type (hex)
File Server 0x0004
Job Server 0x0005
Gateway 0x0006
Print Server 0x0007
Archive Server 0x0009
Remote Bridge Server 0x0024
Target Service Agent 0x002E
Advertising Print Server 0x0047
NetWare Access Server 0x0098
Communications Server 0x0130
Named Pipes/SQL Server 0x0200
NVT2 Server 0x0247
Time Synchronization Server 0x026B
Directory Services Server 0x0278
Wildcard (only for General Service Queries) 0xFFFF (All types respond)

 ------------------------------------------------------------------------------------
| Bindery object                             |  Type (hex)                          |
|--------------------------------------------|--------------------------------------|
| File Server                                |  0x0004                              |
|--------------------------------------------|--------------------------------------|
| Job Server                                 |  0x0005                              |
|--------------------------------------------|--------------------------------------|
| Gateway                                    |  0x0006                              |
|--------------------------------------------|--------------------------------------|
| Print Server                               |  0x0007                              |
|--------------------------------------------|--------------------------------------|
| Archive Server                             |  0x0009                              |
|--------------------------------------------|--------------------------------------|
| Remote Bridge Server                       |  0x0024                              |
|--------------------------------------------|--------------------------------------|
| Target Service Agent                       |  0x002E                              |
|--------------------------------------------|--------------------------------------|
| Advertising Print Server                   |  0x0047                              |
|--------------------------------------------|--------------------------------------|
| NetWare Access Server                      |  0x0098                              |
|--------------------------------------------|--------------------------------------|
| Communications Server                      |  0x0130                              |
|--------------------------------------------|--------------------------------------|
| Named Pipes/SQL Server                     |  0x0200                              |
|--------------------------------------------|--------------------------------------|
| NVT2 Server                                |  0x0247                              |
|--------------------------------------------|--------------------------------------|
| Time Synchronization Server                |  0x026B                              |
|--------------------------------------------|--------------------------------------|
| Directory Services Server                  |  0x0278                              |
|--------------------------------------------|--------------------------------------|
| Wildcard (only for General Service Queries)|  0xFFFF (All types respond)          |
|--------------------------------------------|--------------------------------------|

Server name

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.


© 1999 The Santa Cruz Operation, Inc. All rights reserved.
UnixWare 7 Release 7.1 - 19 March 1999