OpenTP1 Version 7 Programming Reference C Language
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>>
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.