SAPAdvertiseMyServer --
advertise/stop advertising service of specific type on internetwork
Synopsis
#include <sap_app.h>
int SAPAdvertiseMyServer(uint16 ServerType, char ServerName, uint16 Socket,
int Action);
Description
SAPAdvertiseMyServer causes the named server to be advertised by
the SAP daemon. To start the advertising process, this call needs
to be made once only.
NOTE:
This function is supported only when the SAP daemon is running.
This function does not use mapped memory, but sends a message via the
protocol stack to the SAP daemon. The message is acknowledged by
the SAP daemon to ensure that it was received.
Only the root user has permission to advertise using the
SAP_ADVERTISE_FOREVER flag, and only root can unadvertise
a server advertised with this flag.
When a server is advertised with the SAP_ADVERTISE_FOREVER flag,
the server description is written to /etc/netware/sapouts. When
NetWare® services are started, this file is read and the services are
automatically re-advertised. Servers can be removed from sapouts
only via a SAPAdvertiseMyServer call with the Action
flag set to SAP_STOP_ADVERTISING.
Specifies the type of server assigned
for the server's service class.
(IN) ServerName
Pointer to the NULL-terminated name of the server to be
advertised (maximum of 48 characters including NULL).
(IN) Socket
Specifies the socket number at which the advertised service may be accessed.
(IN) Action
Specifies the type of action the SAP daemon is to perform.
Usage
If SAP_ADVERTISE is set in Action, the SAP
daemon places the PID of the advertising process in the advertise
table entry.
If SAP_ADVERTISE_FOREVER is set in Action, the
SAP daemon places its own PID in the table.
The
kill(2)
system call with arguments ``(pid, 0)'' is used to determine if the process
that made the SAPAdvertiseMyServer call is still active. As long
as the process is active, the services for that process will be advertised.
When the process terminates, the services for that process will be marked
as HOPS = 16, or down.
The ServerType argument specifies the type of server to be
advertised. See the table below for some common values.
Defined Constants for SAP daemon
Value
Server Type
FILE_SERVER_TYPE
0x0004
NetWare Server
PRINT_SERVER_TYPE
0x0047
Print Server
BTRIEVE_SERVER_TYPE
0x004B
Btrieve Server
ACCESS_SERVER_TYPE
0x0098
NetWare Access Server
OLD_NVT_SERVER_TYPE
0x009E
NVT over NVT protocol
I386_SERVER_TYPE
0x0107
386 NetWare (3.x)
SPX_NVT_SERVER_TYPE
0x0247
NVT2 over SPX/SPXII protocol
TIME_SYNC_SERVER_TYPE
0x026B
Time Synchronization
DIRECTORY_SERVER_TYPE
0x0278
Directory Server
The ServerName argument specifies the NULL-terminated
name of the server to be advertised. If the name contained in
ServerName is not less than SAP_MAX_SERVER_NAME_LENGTH,
the request to advertise the server will be rejected.
The Socket argument is the socket number to which clients may
make service requests. If Socket is zero (0), however, the effect
of the SAPAdvertiseMyServer call is a notification to the
network without providing real service.
The Action argument specifies the type of action the
SAP daemon is to perform. Three values are valid:
Flag
Description
SAP_ADVERTISE
Advertise my server while my process lives or until it is discontinued
SAP_ADVERTISE_FOREVER
Advertise my server until it is discontinued
SAP_STOP_ADVERTISING
Discontinue advertising my server
Return values
If successful, the function returns a zero (0); otherwise, it returns a
negative number which is the negative of the error code.