diff options
Diffstat (limited to 'debian/openslp-dfsg/openslp-dfsg-1.2.1/doc/html/ProgrammersGuide/SLPReg.html')
| -rw-r--r-- | debian/openslp-dfsg/openslp-dfsg-1.2.1/doc/html/ProgrammersGuide/SLPReg.html | 313 |
1 files changed, 313 insertions, 0 deletions
diff --git a/debian/openslp-dfsg/openslp-dfsg-1.2.1/doc/html/ProgrammersGuide/SLPReg.html b/debian/openslp-dfsg/openslp-dfsg-1.2.1/doc/html/ProgrammersGuide/SLPReg.html new file mode 100644 index 00000000..3d15ead2 --- /dev/null +++ b/debian/openslp-dfsg/openslp-dfsg-1.2.1/doc/html/ProgrammersGuide/SLPReg.html @@ -0,0 +1,313 @@ +<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="GENERATOR" content="Mozilla/4.77C-CCK-MCD Caldera Systems OpenLinux [en] (X11; U; Linux 2.4.2 i686) [Netscape]"> + <title>OpenSLP Programmers Guide - SLPReg()</title> +</head> +<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" alink="#FF0000"> + +<h2> +SLPReg</h2> + +<hr WIDTH="100%"> +<h3> +Declaration</h3> +<tt>#include <slp.h></tt> +<p><tt><a href="SLPError.html">SLPError</a> SLPReg( <a href="SLPTypes.html#SLPHandle">SLPHandle</a> +<a href="#hslp">hslp</a>,</tt> +<br><tt> +const char* <a href="#srvurl">srvurl</a>,</tt> +<br><tt> +unsigned short <a href="#lifetime">lifetime</a>,</tt> +<br><tt> +const char* <a href="#srvtype">srvtype</a>,</tt> +<br><tt> +const char* <a href="#attrs">attrs</a>,</tt> +<br><tt> +<a href="SLPTypes.html#SLPBoolean">SLPBoolean</a> <a href="#fresh">fresh</a>,</tt> +<br><tt> +<a href="SLPRegReport.html">SLPRegReport</a> <a href="#callback">callback</a>,</tt> +<br><tt> +void* <a href="#cookie">cookie </a>)</tt> +<h3> +Description</h3> +Registers the URL in <tt>srvurl</tt> having the lifetime <tt>lifetime</tt> +with the attribute list in <tt>attrs</tt>. The <tt>attrs</tt> list is a +comma separated list of attribute assignments in the wire format (including +escaping of reserved characters). The <tt>lifetime</tt> parameter must +be nonzero and less than or equal to <tt><a href="SLPTypes.html#SLPURLLifetime">SLP_LIFETIME_MAXIMUM</a></tt>. +If the <tt>fresh</tt> flag is <tt>SLP_TRUE</tt>, then the registration +is new (the SLP protocol FRESH flag is set) and the registration replaces +any existing registrations. The <tt>srvtype</tt> 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 <tt>srvtype</tt> parameter +is ignored. If the fresh flag is <tt>SLP</tt>_FALSE, then an existing registration +is updated. Registrations and updates take place in the language locale +of the <tt>hslp</tt> handle. +<br> +<h3> +Parameters</h3> + +<table BORDER CELLPADDING=5 NOSAVE > +<tr VALIGN=TOP NOSAVE> +<td NOSAVE><a NAME="hslp"></a><tt>hslp</tt></td> + +<td NOSAVE>The language specific <tt>SLPHandle</tt> on which to register +the service.</td> +</tr> + +<tr VALIGN=TOP NOSAVE> +<td><a NAME="srvurl"></a><tt>srvurl</tt></td> + +<td NOSAVE>The service URL to register. May not be the empty string. +May not be NULL. Must conform to SLP Service URL syntax. <tt><a href="SLPError.html#INVALID_REGISTRATION">SLP_INVALID_REGISTRATION</a></tt> +will be returned if srvurl is not a SLP Service URL. See <a href="Syntax.html">Syntax</a> +for more information on Service URL syntax.</td> +</tr> + +<tr VALIGN=TOP NOSAVE> +<td NOSAVE><a NAME="lifetime"></a><tt>lifetime</tt></td> + +<td NOSAVE>An unsigned short giving the lifetime of the service in seconds. +The value must be an unsigned integer less than or equal to <tt><a href="SLPTypes.html#SLPURLLifetime">SLP_LIFETIME_MAXIMUM</a></tt> +and greater than zero. <i>If lifetime is set to <tt><a href="SLPTypes.html#SLPURLLifetime">SLP_LIFETIME_MAXIMUM</a></tt>, +it will remain registered for the life of the calling process.</i></td> +</tr> + +<tr VALIGN=TOP NOSAVE> +<td><a NAME="srvtype"></a>srvtype</td> + +<td NOSAVE>This parameter is always ignored because the Service URL syntax +required for the <tt>srvurl</tt> parameter encapsulates the service-type. +See <a href="Syntax.html">Syntax</a> for more information on Service URL +syntax.</td> +</tr> + +<tr VALIGN=TOP NOSAVE> +<td NOSAVE><a NAME="attrs"></a>attrs</td> + +<td>A list of attribute assignment expressions for the attributes of the +registered service. Use the empty string, "" for no attributes. +Example: "(attr1=val1),(attr2=val2),(attr3=val3)"</td> +</tr> + +<tr VALIGN=TOP NOSAVE> +<td><a NAME="fresh"></a><tt>fresh</tt></td> + +<td NOSAVE>An SLPBoolean that is <tt>SLP_TRUE</tt> if the registration +is new or <tt>SLP_FALSE</tt> for a re-registration. Currently, OpenSLP +does not support incremental registrations. If <tt>fresh</tt> is +<tt>SLP_FALSE</tt>, +<tt>SLPReg()</tt> +will return <tt><a href="SLPError.html#SLP_NOT_IMPLEMENTED">SLP_NOT_IMPLEMENTED</a></tt>.</td> +</tr> + +<tr VALIGN=TOP NOSAVE> +<td><a NAME="callback"></a><tt>callback</tt></td> + +<td NOSAVE>The address of an <tt><a href="SLPRegReport.html">SLPRegReport</a></tt> +function that will be called to report the operation completion status. +Man not be NULL. See <a href="Callbacks.html">Callbacks</a> for more information +on how callbacks are used by the SLPAPI.</td> +</tr> + +<tr VALIGN=TOP NOSAVE> +<td NOSAVE><a NAME="cookie"></a><tt>cookie</tt></td> + +<td NOSAVE>Pointer to memory that gets passed to the callback code. +May be NULL.</td> +</tr> +</table> + +<h3> +Returns</h3> + +<table BORDER NOSAVE > +<tr NOSAVE> +<td NOSAVE>SLP_OK</td> + +<td>Indicates that the no error occurred during the operation.</td> +</tr> + +<tr> +<td>SLP_INVALID_REGISTRATION</td> + +<td>The deregistered service url does not conform to valid service url +syntax. The service url being deregistered is not registered this +means that either it was never registered via a call to SLPReg() or that +the registration lifetime has expired. SLP_INVALID_REGISTRATION +is commonly returned when an attempt is made to deregister a service that +was registered by a call to SLPReg() on a different host.</td> +</tr> + +<tr> +<td>SLP_PARSE_ERROR</td> + +<td>The SLP message was rejected by a remote SLP agent. The API returns +this error only when no information was retrieved, and at least one SA +or DA indicated a protocol error. The data supplied through the API may +be malformed or a may have been damaged in transit.</td> +</tr> + +<tr> +<td>SLP_AUTHENTICATION_ABSENT</td> + +<td>If the SLP framework supports authentication, this error arises when +the UA or SA failed to send an authenticator for requests or registrations.</td> +</tr> + +<tr> +<td>SLP_AUTHENTICATION_FAILED</td> + +<td>If the SLP framework supports authentication, this error arises when +a authentication on an SLP message failed.</td> +</tr> + +<tr> +<td>SLP_NETWORK_TIMED_OUT</td> + +<td>When no reply can be obtained in the time specified by the configured +timeout interval for a unicast request, this error is returned. In +other words, slpd is running, but something is wrong with it</td> +</tr> + +<tr> +<td>SLP_NETWORK_INIT_FAILED</td> + +<td>If the network cannot initialize properly, this error is returned. +Will also be returned if an SA or DA agent (slpd) can not be contacted. +slpd must be running in order to call SLPReg() or SLPDereg().</td> +</tr> + +<tr> +<td>SLP_MEMORY_ALLOC_FAILED </td> + +<td>Out of memory error</td> +</tr> + +<tr> +<td>SLP_PARAMETER_BAD</td> + +<td>If a parameter passed into a function is bad, this error is returned.</td> +</tr> + +<tr> +<td>SLP_NETWORK_ERROR</td> + +<td>The failure of networking during normal operations causes this error +to be returned. In OpenSLP, this is the error you'll get if an underlying +socket() call failed.</td> +</tr> + +<tr> +<td>SLP_INTERNAL_SYSTEM_ERROR</td> + +<td>A basic failure of the API causes this error to be returned. This occurs +when a system call or library fails. The operation could not recover.</td> +</tr> + +<tr> +<td>SLP_HANDLE_IN_USE</td> + +<td>Callback functions are not permitted to recursively call into the API +on the same SLPHandle, either directly or indirectly. If an attempt is +made to do so, this error is returned from the called API function.</td> +</tr> +</table> + +<p>Be aware, especially if the call is async, of error codes that may be +passed to the SLPRegReport() callback function. +<h3> +Status</h3> + +<table CELLPADDING=5 NOSAVE > +<tr VALIGN=TOP NOSAVE> +<td NOSAVE>OpenSLP 0.8.0</td> + +<td NOSAVE>Fully implemented as specified by RFC 2614</td> +</tr> +</table> + +<h3> +See Also</h3> +<a href="SLPDereg.html">SLPDeReg()</a>, <a href="Syntax.html">Syntax</a>, +<a href="Callbacks.html">Callbacks</a> +<br> +<h3> +Example Code</h3> + +<blockquote><tt>#include <slp.h></tt> +<p><tt>void MySLPRegReport(SLPHandle hslp, SLPError errcode, void* cookie)</tt> +<br><tt>{</tt> +<br><tt> /* return the error code in the cookie */</tt> +<br><tt> *(SLPError*)cookie = errcode;</tt> +<p><tt> /* You could do something else here like print +out */</tt> +<br><tt> /* the errcode, etc. Remember, as a general +rule, */</tt> +<br><tt> /* do not try to do too much in a callback because +*/</tt> +<br><tt> /* it is being executed by the same thread that +is */</tt> +<br><tt> /* reading slp packets from the wire. +*/</tt> +<br><tt>}</tt> +<p><tt>int main(int argc, char* argv[])</tt> +<br><tt>{</tt> +<br><tt> SLPError err;</tt> +<br><tt> SLPError callbackerr;</tt> +<br><tt> SLPHandle hslp;</tt> +<p><tt> err = SLPOpen("en",SLP_FALSE,&hslp);</tt> +<br><tt> if(err != SLP_OK)</tt> +<br><tt> {</tt> +<br><tt> printf("Error opening +slp handle %i\n",err);</tt> +<br><tt> return err;</tt> +<br><tt> }</tt> +<p><tt> /* Register a service with SLP */</tt> +<br><tt> err = SLPReg( hslp,</tt> +<br><tt> +"service:myservice.myorg://hostname.domain.com:6672",</tt> +<br><tt> +SLP_LIFETIME_MAXIMUM,</tt> +<br><tt> +0,</tt> +<br><tt> +"(public_key=......my_pgp_key.......)",</tt> +<br><tt> +SLP_TRUE,</tt> +<br><tt> +MySLPRegReport,</tt> +<br><tt> +&callbackerr );</tt> +<p><tt> /* err may contain an error code that occurred +as the slp library */</tt> +<br><tt> /* _prepared_ to make the call. +*/</tt> +<br><tt> if(( err != SLP_OK) || (callbackerr != SLP_OK))</tt> +<br><tt> {</tt> +<br><tt> printf("Error registering +service with slp %i\n",err);</tt> +<br><tt> return err;</tt> +<br><tt> }</tt> +<p><tt> /* callbackerr may contain an error code (that +was assigned through */</tt> +<br><tt> /* the callback cookie) that occurred as slp +packets were sent on */</tt> +<br><tt> /* the wire */</tt> +<br><tt> if( callbackerr != SLP_OK)</tt> +<br><tt> {</tt> +<br><tt> printf("Error registering +service with slp %i\n",callbackerr);</tt> +<br><tt> return callbackerr;</tt> +<br><tt> }</tt> +<p><tt> /* Now that we're done using slp, close the slp +handle */</tt> +<br><tt> SLPClose(hslp);</tt> +<p><tt> /* rest of program */</tt> +<br><tt>}</tt> +<br><tt></tt> </blockquote> + +</body> +</html> |
