SLPREG(3SLP) Service Location Protocol Library Functions SLPREG(3SLP)

SLPReg - register an SLP advertisement

cc [ flag... ] file... -lslp [ library... ]
#include <slp.h>
SLPError SLPReg(SLPHandle hSLP, const char *pcSrvURL,
     const unsigned short usLifetime, const char *pcSrvType,
     const char *pcAttrs, SLPBoolean fresh,
     SLPRegReport callback, void *pvCookie);

The SLPReg() function registers the URL in pcSrvURL having the lifetime usLifetime with the attribute list in pcAttrs. The pcAttrs list is a comma-separated list of attribute assignments in on-the-wire format (including escaping of reserved characters). The sLifetime parameter must be nonzero and less than or equal to SLP_LIFETIME_MAXIMUM. If the fresh flag is SLP_TRUE, then the registration is new, the SLP protocol fresh flag is set, and the registration replaces any existing registrations.

The pcSrvType parameter is a service type name and can be included for service URLs that are not in the service: scheme. If the URL is in the service: scheme, the pcSrvType parameter is ignored. If the fresh flag is SLP_FALSE, then an existing registration is updated. Rules for new and updated registrations, and the format for pcAttrs and pcScopeList, can be found in RFC 2608. Registrations and updates take place in the language locale of the hSLP handle.

The API library is required to perform the operation in all scopes obtained through configuration.

hSLP
The language specific SLPHandle on which to register the advertisement. hSLP cannot be NULL.

pcSrvURL

The URL to register. The value of pcSrvURL cannot be NULL or the empty string.

usLifetime

An unsigned short giving the life time of the service advertisement, in seconds. The value must be an unsigned integer less than or equal to SLP_LIFETIME_MAXIMUM.

pcSrvType

The service type. If pURL is a service: URL, then this parameter is ignored. pcSrvType cannot be NULL.

pcAttrs

A comma-separated list of attribute assignment expressions for the attributes of the advertisement. pcAttrs cannot be NULL. Use the empty string, "", to indicate no attributes.

fresh

An SLPBoolean that is SLP_TRUE if the registration is new or SLP_FALSE if it is a reregistration.

callback

A callback to report the operation completion status. callback cannot be NULL.

pvCookie

Memory passed to the callback code from the client. pvCookie can be NULL.

This function or its callback may return any SLP error code. See the ERRORS section in slp_api(3SLP).

Example 1 An Initial Registration

The following example shows an initial registration for the "service:video://bldg15" camera service for three hours:


SLPError err;
SLPHandle hSLP;
SLPRegReport regreport;
err = SLPReg(hSLP, "service:video://bldg15",
     10800, "", "(location=B15-corridor),
     (scan-rate=100)", SLP_TRUE,
     regRpt, NULL);

SLP_CONF_FILE
When set, use this file for configuration.

slpd(1M), slp_api(3SLP), slp.conf(4), slpd.reg(4), attributes(5)

System Administration Guide: Network Services

Guttman, E., Perkins, C., Veizades, J., and Day, M. RFC 2608, Service Location Protocol, Version 2. The Internet Society. June 1999.

Kempf, J. and Guttman, E. RFC 2614, An API for Service Location. The Internet Society. June 1999.

January 16, 2003 OmniOS