OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

tpadvertise - Advertise a service name

Format

ANSI C, C++

#include <xatmi.h>
int tpadvertise (char *svcname,
                 void (*func)(TPSVCINFO *) )

K&R C

#include <xatmi.h>
int tpadvertise (svcname, func)
char  *svcname;
void  (*func)();

Description

The function tpadvertise() allows a server to advertise the services that it offers. By default, a server's services are advertised when it is booted and unadvertised when it is shut down.

The function tpadvertise() advertises svcname for the server. The argument svcname should be 15 characters or fewer, but cannot be NULL or the NULL string (""). Longer names are accepted and truncated to 15 characters. Users should make sure that truncated names do not match other service names. The argument func is the address of a service function. This function is invoked whenever a request for svcname is received by the server. The argument func cannot be NULL.

If svcname is already advertised for the server and func matches its current function, tpadvertise() returns success (this includes truncated names that match already advertised names). However, if svcname is already advertised for the server but func does not match its current function, an error is returned (this can happen if truncated names match already advertised names).

<<Arguments>>

<<svcname

Specify the name of the service to be requested. >>

<<(*func)()

The address of the service function.>>

Return value

The function tpadvertise() returns -1 on error and sets tperrno to indicate the error condition.

Errors

Under the following conditions, tpadvertise() fails and sets tperrno to one of the following values:

Return value Return value (numeric) Explanation
TPEINVAL 4 The argument svcname is NULL or the NULL string (""), or func is NULL.
TPELIMIT 5 The argument svcname cannot be advertised because of space limitations.
TPEMATCH 23 The argument svcname is already advertised for the server, but not with a function indicated by func.
Although the function fails, svcname remains advertised with its current function (that is, func does not replace the current function).
TPEPROTO 9 tpadvertise() was called in an improper context.
TPESYSTEM 12 A communication resource manager system error has occurred.
The exact nature of the error is determined in a product-specific manner.
TPEOS 7 An operating system error has occurred. The exact nature of the error is determined in a product-specific manner.

See also

tpservice(), tpunadvertise().

<<Notes on use with OpenTP1>>

  1. <<The function tpadvertise() can be called only by SPPs. When the server starts, all services specified in the user service definition are automatically advertised. Combinations of service names and functions can be advertised only when they are specified in the user service definition of this function.>>
  2. <<Under the OpenTP1, if the service group of UAPs which call the function tpadvertise() is the same as the service group of UAPs which have advertised the services, this function returns normally. If the two groups do not match, the function returns with an error.>>
  3. <<The behavior caused by XATMI errors encountered during OSI TP communication may be different from the behavior caused by errors encountered conventional TCP/IP communication.>>