home *** CD-ROM | disk | FTP | other *** search
/ Internet Core Protocols / Oreilly-InternetCoreProtocols.iso / RFCs / rfc2614.txt < prev    next >
Encoding:
Text File  |  1999-10-14  |  165.1 KB  |  5,100 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                          J. Kempf
  8. Request for Comments: 2614                                   E. Guttman
  9. Category: Informational                                Sun Microsystems
  10.                                                               June 1999
  11.  
  12.  
  13.                       An API for Service Location
  14.  
  15. Status of This Memo
  16.  
  17.    This memo provides information for the Internet community.  It does
  18.    not specify an Internet standard of any kind.  Distribution of this
  19.    memo is unlimited.
  20.  
  21. Abstract
  22.  
  23.    The Service Location Protocol (SLP) provides a new way for clients to
  24.    dynamically discovery network services.  With SLP, it is simple to
  25.    offer highly available services that require no user configuration or
  26.    assistance from network administrators prior to use.  This document
  27.    describes standardized APIs for SLP in C and Java.  The APIs are
  28.    modular and are designed to allow implementations to offer just the
  29.    feature set needed.  In addition, standardized file formats for
  30.    configuration and serialized registrations are defined, allowing SLP
  31.    agents to set network and other parameters in a portable way.  The
  32.    serialized file format allows legacy services to be registered with
  33.    SLP directory agents in cases where modifying the legacy service
  34.    program code is difficult or impossible, and to portably exchange a
  35.    registration database.
  36.  
  37. Table of Contents
  38.  
  39.     1. Introduction                                                    4
  40.         1.1. Goals  . . . . . . . . . . . . . . . . . . . . . . . .    4
  41.         1.2. Terminology  . . . . . . . . . . . . . . . . . . . . .    4
  42.     2. File Formats                                                    7
  43.         2.1. Configuration File Format  . . . . . . . . . . . . . .    8
  44.               2.1.1. DA configuration   . . . . . . . . . . . . . .    9
  45.               2.1.2. Static Scope Configuration . . . . . . . . . .    9
  46.               2.1.3. Tracing and Logging  . . . . . . . . . . . . .   11
  47.               2.1.4. Serialized Proxy Registrations . . . . . . . .   11
  48.               2.1.5. Network Configuration Properties . . . . . . .   12
  49.               2.1.6. SA Configuration . . . . . . . . . . . . . . .   14
  50.               2.1.7. UA Configuration . . . . . . . . . . . . . . .   14
  51.               2.1.8. Security   . . . . . . . . . . . . . . . . . .   15
  52.         2.2. Multihomed Machines. . . . . . . . . . . . . . . . . .   16
  53.         2.3. Serialized Registration File . . . . . . . . . . . . .   16
  54.  
  55.  
  56.  
  57.  
  58. Kempf & Guttman              Informational                      [Page 1]
  59.  
  60. RFC 2614                  Service Location API                 June 1999
  61.  
  62.  
  63.         2.4. Processing Serialized Registration and Configuration
  64.              Files  . . . . . . . . . . . . . . . . . . . . . . . .   18
  65.     3. Binding Independent Implementation Considerations              18
  66.         3.1. Multithreading . . . . . . . . . . . . . . . . . . . .   18
  67.         3.2. Asynchronous and Incremental . . . . . . . . . . . . .   19
  68.         3.3. Type Checking for Service Types. . . . . . . . . . . .   19
  69.         3.4. Refreshing Registrations . . . . . . . . . . . . . . .   19
  70.         3.5. Configuration File Processing  . . . . . . . . . . . .   19
  71.         3.6. Attribute Types  . . . . . . . . . . . . . . . . . . .   20
  72.         3.7. Removal of Duplicates  . . . . . . . . . . . . . . . .   20
  73.         3.8. Character Set Encoding . . . . . . . . . . . . . . . .   20
  74.         3.9. Error Semantics  . . . . . . . . . . . . . . . . . . .   20
  75.        3.10. Modular Implementations  . . . . . . . . . . . . . . .   24
  76.        3.11. Handling Special Service Types . . . . . . . . . . . .   24
  77.        3.12. Scope Discovery and Handling . . . . . . . . . . . . .   24
  78.     4. C Language Binding                                             25
  79.         4.1. Constant Types . . . . . . . . . . . . . . . . . . . .   26
  80.               4.1.1. URL Lifetimes. . . . . . . . . . . . . . . . .   26
  81.               4.1.2. Error Codes. . . . . . . . . . . . . . . . . .   26
  82.               4.1.3. SLPBoolean . . . . . . . . . . . . . . . . . .   27
  83.         4.2. Struct Types   . . . . . . . . . . . . . . . . . . . .   28
  84.               4.2.1. SLPSrvURL  . . . . . . . . . . . . . . . . . .   28
  85.               4.2.2. SLPHandle  . . . . . . . . . . . . . . . . . .   29
  86.         4.3. Callbacks  . . . . . . . . . . . . . . . . . . . . . .   29
  87.               4.3.1. SLPRegReport   . . . . . . . . . . . . . . . .   30
  88.               4.3.2. SLPSrvTypeCallback . . . . . . . . . . . . . .   30
  89.               4.3.3. SLPSrvURLCallback  . . . . . . . . . . . . . .   31
  90.               4.3.4. SLPAttrCallback  . . . . . . . . . . . . . . .   33
  91.         4.4. Opening and Closing an SLPHandle . . . . . . . . . . .   34
  92.               4.4.1. SLPOpen. . . . . . . . . . . . . . . . . . . .   34
  93.               4.4.2. SLPClose . . . . . . . . . . . . . . . . . . .   35
  94.         4.5. Protocol API   . . . . . . . . . . . . . . . . . . . .   36
  95.               4.5.1. SLPReg . . . . . . . . . . . . . . . . . . . .   36
  96.               4.5.2. SLPDereg . . . . . . . . . . . . . . . . . . .   37
  97.               4.5.3. SLPDelAttrs  . . . . . . . . . . . . . . . . .   38
  98.               4.5.4. SLPFindSrvTypes. . . . . . . . . . . . . . . .   39
  99.               4.5.5. SLPFindSrvs  . . . . . . . . . . . . . . . . .   41
  100.               4.5.6. SLPFindAttrs . . . . . . . . . . . . . . . . .   42
  101.         4.6. Miscellaneous Functions  . . . . . . . . . . . . . . .   43
  102.               4.6.1. SLPGetRefreshInterval  . . . . . . . . . . . .   44
  103.               4.6.2. SLPFindScopes  . . . . . . . . . . . . . . . .   44
  104.               4.6.3. SLPParseSrvURL . . . . . . . . . . . . . . . .   45
  105.               4.6.4. SLPEscape  . . . . . . . . . . . . . . . . . .   46
  106.               4.6.5. SLPUnescape  . . . . . . . . . . . . . . . . .   47
  107.               4.6.6. SLPFree  . . . . . . . . . . . . . . . . . . .   48
  108.               4.6.7. SLPGetProperty . . . . . . . . . . . . . . . .   48
  109.               4.6.8. SLPSetProperty . . . . . . . . . . . . . . . .   49
  110.         4.7. Implementation Notes   . . . . . . . . . . . . . . . .   49
  111.  
  112.  
  113.  
  114. Kempf & Guttman              Informational                      [Page 2]
  115.  
  116. RFC 2614                  Service Location API                 June 1999
  117.  
  118.  
  119.               4.7.1. Refreshing Registrations . . . . . . . . . . .   49
  120.               4.7.2. Syntax for String Parameters . . . . . . . . .   49
  121.               4.7.3. Client Side Syntax Checking  . . . . . . . . .   50
  122.               4.7.4. System Properties  . . . . . . . . . . . . . .   50
  123.               4.7.5. Memory Management  . . . . . . . . . . . . . .   51
  124.               4.7.6. Asynchronous and Incremental Return Semantics.   51
  125.         4.8. Example. . . . . . . . . . . . . . . . . . . . . . . .   52
  126.     5. Java Language Binding                                          56
  127.         5.1. Introduction . . . . . . . . . . . . . . . . . . . . .   56
  128.         5.2. Exceptions and Errors  . . . . . . . . . . . . . . . .   56
  129.               5.2.1. Class ServiceLocationException . . . . . . . .   57
  130.         5.3. Basic Data Structures  . . . . . . . . . . . . . . . .   58
  131.               5.3.1. Interface ServiceLocationEnumeration . . . . .   58
  132.               5.3.2. Class ServiceLocationAttribute   . . . . . . .   58
  133.               5.3.3. Class ServiceType  . . . . . . . . . . . . . .   61
  134.               5.3.4. Class ServiceURL   . . . . . . . . . . . . . .   63
  135.         5.4. SLP Access Interfaces  . . . . . . . . . . . . . . . .   67
  136.               5.4.1. Interface Advertiser . . . . . . . . . . . . .   67
  137.               5.4.2. Interface Locator  . . . . . . . . . . . . . .   69
  138.         5.5. The Service Location Manager . . . . . . . . . . . . .   72
  139.               5.5.1. Class ServiceLocationManager . . . . . . . . .   72
  140.         5.6. Service Template Introspection . . . . . . . . . . . .   74
  141.               5.6.1. Abstract Class TemplateRegistry  . . . . . . .   74
  142.               5.6.2. Interface ServiceLocationAttributeVerifier . .   77
  143.               5.6.3. Interface ServiceLocationAttributeDescriptor .   79
  144.         5.7. Implementation Notes . . . . . . . . . . . . . . . . .   81
  145.               5.7.1. Refreshing Registrations . . . . . . . . . . .   81
  146.               5.7.2. Parsing Alternate Transports in ServiceURL . .   81
  147.               5.7.3. String Attribute Values  . . . . . . . . . . .   82
  148.               5.7.4. Client Side Syntax Checking. . . . . . . . . .   82
  149.               5.7.5. Language Locale Handling . . . . . . . . . . .   82
  150.               5.7.6. Setting SLP System Properties. . . . . . . . .   83
  151.               5.7.7. Multithreading . . . . . . . . . . . . . . . .   83
  152.               5.7.8. Modular Implementations  . . . . . . . . . . .   83
  153.               5.7.9. Asynchronous and Incremental Return Semantics.   84
  154.         5.8. Example. . . . . . . . . . . . . . . . . . . . . . . .   85
  155.     6. Internationalization Considerations                            87
  156.         6.1. service URL. . . . . . . . . . . . . . . . . . . . . .   87
  157.         6.2. Character Set Encoding . . . . . . . . . . . . . . . .   87
  158.         6.3. Language Tagging   . . . . . . . . . . . . . . . . . .   88
  159.     7. Security Considerations                                        88
  160.     8. Acknowledgements                                               88
  161.     9. References                                                     89
  162.    10. Authors' Addresses                                             90
  163.    11. Full Copyright Statement                                       91
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Kempf & Guttman              Informational                      [Page 3]
  171.  
  172. RFC 2614                  Service Location API                 June 1999
  173.  
  174.  
  175. 1. Introduction
  176.  
  177.    The Service Location API is designed for standardized access to the
  178.    Service Location Protocol (SLP). The APIs allow client and service
  179.    programs to be be written or modified in a very simple manner to
  180.    provide dynamic service discovery and selection.  Bindings in the C
  181.    and Java languages are defined in this document.  In addition,
  182.    standardized formats for configuration files and for serialized
  183.    registration files are presented.  These files allow SLP agents to
  184.    configure network parameters, to register legacy services that have
  185.    not been SLP enabled, and to portably exchange registration
  186.    databases.
  187.  
  188. 1.1. Goals
  189.  
  190.    The overall goal of the API is to enable source portability of
  191.    applications that use the API between different implementations of
  192.    SLP. The result should facilitate the adoption of SLP, and conversion
  193.    of clients and service programs to SLP.
  194.  
  195.    The goals of the C binding are to create a minimal but complete
  196.    access to the functionality of the SLP protocol, allowing for simple
  197.    memory management and limited code size.
  198.  
  199.    The Java API provides for modular implementations (where unneeded
  200.    features can be omitted) and an object oriented interface to the
  201.    complete set of SLP data and functionality.
  202.  
  203.    The standardized configuration file and serialized file formats
  204.    provide a simple syntax with complete functional coverage of the
  205.    protocol, but without system dependent properties and secure
  206.    information.
  207.  
  208. 1.2. Terminology
  209.  
  210.    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  211.    "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
  212.    document are to be interpreted as described in RFC 2119  [1].
  213.  
  214.       Service Location Protocol (SLP)
  215.  
  216.          The underlying protocol allowing dynamic and scalable service
  217.          discovery.  This protocol is specified in the Service Location
  218.          Protocol Version 2 [7].
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. Kempf & Guttman              Informational                      [Page 4]
  227.  
  228. RFC 2614                  Service Location API                 June 1999
  229.  
  230.  
  231.       SLP framework
  232.  
  233.          When a 'Service Location framework' is mentioned, it refers to
  234.          both the SLP implementation and interface implementation; i.e.
  235.          whatever provides the SLP functionality to user level programs.
  236.          This includes remote agents.
  237.  
  238.       Directory Agent (DA)
  239.  
  240.          A service that automatically gathers service advertisements
  241.          from SAs in order to provide them to UAs.
  242.  
  243.       User Agent (UA)
  244.  
  245.          This is the Service Location process or library that allows SLP
  246.          requests to be made on behalf of a client process.  UAs
  247.          automatically direct requests to DAs when they exist.  In their
  248.          absence, UAs make requests to SAs.
  249.  
  250.       Service Agent (SA)
  251.  
  252.          This is the Service Location process or library that allows
  253.          service software to register and deregister itself with the SLP
  254.          framework.  SAs respond to UA service requests, detect DAs and
  255.          register service advertisements with them.
  256.  
  257.       SA Server
  258.  
  259.          Many operating system platforms only allow a single process to
  260.          listen on a particular port number.  Since SAs are required to
  261.          listen on a multicast address for SLP service requests,
  262.          implementations of the SLP framework on such platforms that
  263.          want to support multiple SAs on one machine need to arrange for
  264.          a single process to do the listening while the advertising SAs
  265.          communicate with that process through another mechanism.  The
  266.          single listening process is called an SA server.  SA servers
  267.          share many characteristics with DAs, but they are not the same.
  268.  
  269.       Service Advertisement
  270.  
  271.          A URL possibly combined with service attributes.  These are
  272.          made available to UAs by SAs, either directly or via a DA.
  273.  
  274.       Locale
  275.  
  276.          The language localization that applies to strings passed into
  277.          or returned from the SLP API. The Locale is expressed using a
  278.          Language Tag [6].  All attribute strings are associated with a
  279.  
  280.  
  281.  
  282. Kempf & Guttman              Informational                      [Page 5]
  283.  
  284. RFC 2614                  Service Location API                 June 1999
  285.  
  286.  
  287.          particular locale.  The locale is completely orthogonal to the
  288.          ANSI C locale.  The SLP locale is mapped into the Java locale
  289.          in the Java API.
  290.  
  291.       Service Template
  292.  
  293.          A document that describes the syntax of the URL for a given
  294.          service type and a definition of all service attributes
  295.          including the meaning, defaults, and constraints on values the
  296.          attributes may take.  See [8] for more information on service
  297.          templates.
  298.  
  299.       The service:  URL
  300.  
  301.          A service of a particular type announces its availability with
  302.          a service:  URL that includes its service access point (domain
  303.          name or IP address, and possibly its port number) and
  304.          optionally basic configuration parameters.  The syntax of the
  305.          service:  URL is defined in the service template.  Other URL's
  306.          can be used in service advertisements if desired.
  307.  
  308.       Service Attributes
  309.  
  310.          The attributes associated with a given service.  The values
  311.          that can be assigned to service attributes are defined by the
  312.          service template.
  313.  
  314.       Scope
  315.  
  316.          A string used to control the availability of service
  317.          advertisements.  Every SLP Agent is configured with one or more
  318.          scope strings.  Scopes are assigned by site administrators to
  319.          group services for many purposes, but chiefly as a means of
  320.          scalability.  DAs store only services advertised having a scope
  321.          string matching the scopes with which they are configured.
  322.  
  323.       Naming Authority (NA)
  324.  
  325.          This is a 'suffix' to the service type string.  It completely
  326.          changes the meaning of the service type.  NAs are used for
  327.          private definitions of well known Service Types and
  328.          experimental Service Type extensions.  The default NA is
  329.          "IANA", which must not be explicitly included.  Service types
  330.          with the IANA naming authority are registered with the Internet
  331.          Assigned Numbers Authority (see [8] for more information on the
  332.          registration procedure).
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Kempf & Guttman              Informational                      [Page 6]
  339.  
  340. RFC 2614                  Service Location API                 June 1999
  341.  
  342.  
  343. 2. File Formats
  344.  
  345.    This section describes the configuration and serialized registration
  346.    file formats.  Both files are defined in the UTF-8 character set [3].
  347.  
  348.    Attribute tags and values in the serialized registration file require
  349.    SLP reserved characters to be escaped.  The SLP reserved characters
  350.    are `(', `)', `,', `\', `!', `<', `=', `>', `~' and control
  351.    characters (characters with UTF codes less than 0x0020 and the
  352.    character 0x007f, which is US-ASCII DEL). The escapes are formed
  353.    exactly as for the wire protocol, i.e.  a backslash followed by two
  354.    hex digits representing the character.  For example, the escape for '
  355.    ,' is '\2c'.  In addition, the characters `\n', `\r', `\t', and `_'
  356.    are prohibited from attribute tags by the SLP wire syntax grammar.
  357.    [7]
  358.  
  359.    In serialized registration files, escaped strings beginning with
  360.    `\ff`, an encoding for a nonUTF-8 character, are treated as opaques.
  361.    Exactly as in the wire protocol, syntactically correct opaque
  362.    encodings consist of a string beginning with `\ff` and containing
  363.    *only* escaped characters that are transformed to bytes.  Such
  364.    strings are only syntactically correct in the serialized registration
  365.    file as attribute values.  In other cases, whenever an escape is
  366.    encountered and the character is not an SLP reserved character, an
  367.    error is signaled.
  368.  
  369.    Escaped characters in URLs in serialized registration files use the
  370.    URL escape convention. [2].
  371.  
  372.    Property names and values in the configuration file have a few
  373.    reserved characters that are involved in file's lexical definition.
  374.    The characters '.'  and '=' are reserved in property names and must
  375.    be escape.  The characters ',', '(', and ')' are reserved in property
  376.    values and must be escaped.  In addition, scope names in the
  377.    net.slp.useScopes property use the SLP wire format escape convention
  378.    for SLP reserved characters.  This simplifies implementation, since
  379.    the same code can be used to unescape scope names as is used in
  380.    processing the serialized registration file or for formatting wire
  381.    messages.
  382.  
  383.    On platforms that only support US-ASCII and not UTF-8, the upper bit
  384.    of bytes incoming from the configuration and registration files
  385.    determines whether the character is US-ASCII or not US-ASCII.
  386.    According to the standard UTF-8 encoding, the upper bit is zero if
  387.    the character is US-ASCII and one if the character is multibyte and
  388.    thus not US-ASCII. Platforms without intrinsic UTF-8 support are
  389.    required to parse the multibyte character and store it in an
  390.    appropriate internal format.  Support for UTF-8 is required to
  391.  
  392.  
  393.  
  394. Kempf & Guttman              Informational                      [Page 7]
  395.  
  396. RFC 2614                  Service Location API                 June 1999
  397.  
  398.  
  399.    implement the SLP protocol (see [7]), and can therefore be used in
  400.    file processing as well.
  401.  
  402.    The location and name of the configuration file is system-dependent,
  403.    but implementations of the API are encouraged to locate it together
  404.    with other configuration files and name it consistently.
  405.  
  406. 2.1. Configuration File Format
  407.  
  408.    The configuration file format consists of a newline delimited list of
  409.    zero or more property definitions.  Each property definition
  410.    corresponds to a particular configurable SLP, network, or other
  411.    parameter in one or more of the three SLP agents.  The file format
  412.    grammar in ABNF [5] syntax is:
  413.  
  414.       config-file   =  line-list
  415.       line-list     =  line / line line-list
  416.       line          =  property-line / comment-line
  417.       comment-line  =  ( "#" / ";" ) 1*allchar newline
  418.       property-line =  property newline
  419.       property      =  tag "=" value-list
  420.       tag           =  prop / prop "." tag
  421.       prop          =  1*tagchar
  422.       value-list    =  value / value "," value-list
  423.       value         =  int / bool /
  424.                        "(" value-list ")" / string
  425.       int           =  1*DIGIT
  426.       bool          =  "true" / "false" / "TRUE" / "FALSE"
  427.       newline       =  CR / ( CRLF )
  428.       string        =  1*stringchar
  429.       tagchar       =  DIGIT / ALPHA / tother / escape
  430.       tother        =  %x21-%x2d / %x2f /
  431.                        %x3a / %x3c-%x40 /
  432.                        %x5b-%x60 / %7b-%7e
  433.                        ; i.e., all characters except `.',
  434.                        ; and `='.
  435.       stringchar    =  DIGIT / ALPHA / sother / escape
  436.       sother        =  %x21-%x29 / %x2a-%x2b /
  437.                        %x2d-%x2f / %x3a-%x40 /
  438.                        %x5b-%x60 / %7b-%7e
  439.                        ; i.e., all characters except `,'
  440.       allchar       =  DIGIT / ALPHA / HTAB / SP
  441.       escape        =  "\" HEXDIG HEXDIG
  442.                        ; Used for reserved characters
  443.  
  444.    With the exception of net.slp.useScopes, net.slp.DAAddresses, and
  445.    net.slp.isBroadcastOnly, all other properties can be changed through
  446.    property accessors in the C and Java APIs.  The property accessors
  447.  
  448.  
  449.  
  450. Kempf & Guttman              Informational                      [Page 8]
  451.  
  452. RFC 2614                  Service Location API                 June 1999
  453.  
  454.  
  455.    only change the property values in the running agent program and do
  456.    not affect the values in the configuration file.  The
  457.    net.slp.useScopes and net.slp.DAAddresses properties are read-only
  458.    because they control the agent's view of the scopes and DAs and are
  459.    therefore critical to the function of the API scope discovery
  460.    algorithm.  Attempts to modify them are unlikely to yield productive
  461.    results, and could harm the ability of the agent to find scopes and
  462.    use DAs.  The net.slp.isBroadcastOnly property is read-only because
  463.    the API library needs to configure networking upon start up and
  464.    changing this property might invalidate the configuration.  Whether
  465.    the local network uses broadcast or multicast is not likely to change
  466.    during the course of the program's execution.
  467.  
  468.    The properties break down into the following subsections describes an
  469.    area and its properties.
  470.  
  471. 2.1.1. DA configuration
  472.  
  473.    Important configuration properties for DAs are included in this
  474.    section.  These are:
  475.  
  476.       net.slp.isDA
  477.  
  478.          A boolean indicating if the SLP server is to act as a DA. If
  479.          false, not run as a DA. Default is false.
  480.  
  481.       net.slp.DAHeartBeat
  482.  
  483.          A 32 bit integer giving the number of seconds for the
  484.          DA heartbeat.  Default is 3 hours (10800 seconds).  This
  485.          property corresponds to the protocol specification parameter
  486.          CONFIG_DA_BEAT [7].  Ignored if isDA is false.
  487.  
  488.       net.slp.DAAttributes
  489.  
  490.          A comma-separated list of parenthesized attribute/value list
  491.          pairs that the DA must advertise in DAAdverts.  The property
  492.          must be in the SLP attribute list wire format, including
  493.          escapes for reserved characters. [7]
  494.  
  495. 2.1.2. Static Scope Configuration
  496.  
  497.    These properties allow various aspects of scope handling to be
  498.    configured.
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506. Kempf & Guttman              Informational                      [Page 9]
  507.  
  508. RFC 2614                  Service Location API                 June 1999
  509.  
  510.  
  511.       net.slp.useScopes
  512.  
  513.          A value-list of strings indicating the only scopes a UA or SA
  514.          is allowed to use when making requests or registering, or the
  515.          scopes a DA must support.  If not present for the DA and SA,
  516.          then in the absence of scope information from DHCP, the default
  517.          scope "DEFAULT" is used.  If not present for the UA, and there
  518.          is no scope information available from DHCP, then the user
  519.          scoping model is in force.  Active and passive DA discovery
  520.          or SA discovery are used for scope discovery, and the scope
  521.          "DEFAULT" is used if no other information is available.  If a
  522.          DA or SA gets another scope in a request, a SCOPE_NOT_SUPPORTED
  523.          error should be returned, unless the request was multicast, in
  524.          which case it should be dropped.  If a DA gets another scope in
  525.          a registration, a SCOPE_NOT_SUPPORTED error must be returned.
  526.          Unlike other properties, this property is "read-only", so
  527.          attempts to change it after the configuration file has been
  528.          read are ignored.  See Section 3.12 for the algorithm the API
  529.          uses in determining what scope information to present.
  530.  
  531.       net.slp.DAAddresses
  532.  
  533.          A value-list of IP addresses or DNS resolvable host names
  534.          giving the SLPv2 DAs to use for statically configured UAs and
  535.          SAs.  Ignored by DAs (unless the DA is also an SA server).
  536.          Default is none.  Unlike other properties, this property is
  537.          "read-only", so attempts to change it after the configuration
  538.          file has been read are ignored.
  539.  
  540.          The following grammar describes the property:
  541.  
  542.  
  543.                addr-list     =  addr / addr "," addr-list
  544.                addr          =  fqdn / hostnumber
  545.                fqdn          =  ALPHA / ALPHA *[ anum / "-" ] anum
  546.                anum          =  ALPHA / DIGIT
  547.                hostnumber    =  1*3DIGIT 3("." 1*3DIGIT)
  548.  
  549.  
  550.          An example is:
  551.  
  552.  
  553.                 sawah,mandi,sambal
  554.  
  555.  
  556.          IP addresses can be used instead of host names in networks
  557.          where DNS is not deployed, but network administrators are
  558.          reminded that using IP addresses will complicate machine
  559.  
  560.  
  561.  
  562. Kempf & Guttman              Informational                     [Page 10]
  563.  
  564. RFC 2614                  Service Location API                 June 1999
  565.  
  566.  
  567.          renumbering, since the SLP configuration property files
  568.          in statically configured networks will have to be changed.
  569.          Similarly, if host names are used, implementors must be careful
  570.          that a name service is available before SLP starts, in other
  571.          words, SLP cannot be used to find the name service.
  572.  
  573. 2.1.3. Tracing and Logging
  574.  
  575.    This section allows tracing and logging information to be printed by
  576.    the various agents.
  577.  
  578.       net.slp.traceDATraffic
  579.  
  580.          A boolean controlling printing of messages about traffic with
  581.          DAs.  Default is false.
  582.  
  583.       net.slp.traceMsg
  584.  
  585.          A boolean controlling printing of details on SLP messages.
  586.          The fields in all incoming messages and outgoing replies are
  587.          printed.  Default is false.
  588.  
  589.       net.slp.traceDrop
  590.  
  591.          A boolean controlling printing details when a SLP message is
  592.          dropped for any reason.  Default is false.
  593.  
  594.       net.slp.traceReg
  595.  
  596.          A boolean controlling dumps of all registered services upon
  597.          registration and deregistration.  If true, the contents
  598.          of the DA or SA server are dumped after a registration or
  599.          deregistration occurs.  Default is false.
  600.  
  601. 2.1.4. Serialized Proxy Registrations
  602.  
  603.    These properties control the reading and writing of serialized
  604.    registrations.
  605.  
  606.       net.slp.serializedRegURL
  607.  
  608.          A string containing a URL pointing to a document containing
  609.          serialized registrations that should be processed when the DA
  610.          or SA server starts up.  Default is none.
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618. Kempf & Guttman              Informational                     [Page 11]
  619.  
  620. RFC 2614                  Service Location API                 June 1999
  621.  
  622.  
  623. 2.1.5. Network Configuration Properties
  624.  
  625.    The properties in this section allow various network configuration
  626.    properties to be set.
  627.  
  628.       net.slp.isBroadcastOnly
  629.  
  630.          A boolean indicating if broadcast should be used instead of
  631.          multicast.  Like the net.slp.useScopes and net.slp.DAAddresses
  632.          properties, this property is "read-only", so attempts to change
  633.          it after the configuration file has been read are ignored.
  634.          Default is false.
  635.  
  636.       net.slp.passiveDADetection
  637.  
  638.          A boolean indicating whether passive DA detection should be
  639.          used.  Default is true.
  640.  
  641.       net.slp.multicastTTL
  642.  
  643.          A positive integer less than or equal to 255, giving the
  644.          multicast TTL. Default is 255.
  645.  
  646.       net.slp.DAActiveDiscoveryInterval
  647.  
  648.          A 16 bit positive integer giving the number of seconds
  649.          between DA active discovery queries.  Default is 900 seconds
  650.          (15 minutes).  This property corresponds to the protocol
  651.          specification parameter CONFIG_DA_FIND [7].  If the property is
  652.          set to zero, active discovery is turned off.  This is useful
  653.          when the DAs available are explicitly restricted to those
  654.          obtained from DHCP or the net.slp.DAAddresses property.
  655.  
  656.       net.slp.multicastMaximumWait
  657.  
  658.          A 32 bit integer giving the maximum amount of time to perform
  659.          multicast, in milliseconds.  Default is 15000 ms (15 sec.).
  660.          This property corresponds to the CONFIG_MC_MAX parameter in the
  661.          protocol specification [7].
  662.  
  663.       net.slp.multicastTimeouts
  664.  
  665.          A value-list of 32 bit integers used as timeouts, in
  666.          milliseconds, to implement the multicast convergence
  667.          algorithm.  Each value specifies the time to wait before
  668.          sending the next request, or until nothing new has
  669.          been learned from two successive requests.  Default
  670.          is:  3000,3000,3000,3000,3000.  In a fast network the
  671.  
  672.  
  673.  
  674. Kempf & Guttman              Informational                     [Page 12]
  675.  
  676. RFC 2614                  Service Location API                 June 1999
  677.  
  678.  
  679.          aggressive values of 1000,1250,1500,2000,4000 allow better
  680.          performance.  This property corresponds to the CONFIG_MC_RETRY
  681.          parameter in the protocol specification [7].  Note that the
  682.          net.slp.DADiscoveryTimeouts property must be used for active DA
  683.          discovery.
  684.  
  685.       net.slp.DADiscoveryTimeouts
  686.  
  687.          A value-list of 32 bit integers used as timeouts, in
  688.          milliseconds, to implement the multicast convergence algorithm
  689.          during active DA discovery.  Each value specifies the time
  690.          to wait before sending the next request, or until nothing
  691.          new has been learned from two successive requests.  This
  692.          property corresponds to the protocol specification parameter
  693.          CONFIG_RETRY [7].  Default is:  2000,2000,2000,2000,3000,4000.
  694.  
  695.       net.slp.datagramTimeouts
  696.  
  697.          A value-list of 32 bit integers used as timeouts, in
  698.          milliseconds, to implement unicast datagram transmission to
  699.          DAs.  The nth value gives the time to block waiting for a reply
  700.          on the nth try to contact the DA. The sum of these values is
  701.          the protocol specification property CONFIG_RETRY_MAX [7].
  702.  
  703.       net.slp.randomWaitBound
  704.  
  705.          A 32 bit integer giving the maximum value for all random
  706.          wait parameters, in milliseconds.  Default is 1000 (1
  707.          sec.).  This value corresponds to the protocol specification
  708.          parameters CONFIG_START_WAIT, CONFIG_REG_PASSIVE, and
  709.          CONFIG_REG_ACTIVE [7].
  710.  
  711.       net.slp.MTU
  712.  
  713.          A 16 bit integer giving the network packet MTU, in bytes.
  714.          This is the maximum size of any datagram to send, but the
  715.          implementation might receive a larger datagram.  The maximum
  716.          size includes IP, and UDP or TCP headers.  Default is 1400.
  717.  
  718.       net.slp.interfaces
  719.  
  720.          Value-list of strings giving the IP addresses of network
  721.          interfaces on which the DA or SA should listen on port 427 for
  722.          multicast, unicast UDP, and TCP messages.  Default is empty,
  723.          i.e.  use the default network interface.  The grammar for this
  724.          property is:
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Kempf & Guttman              Informational                     [Page 13]
  731.  
  732. RFC 2614                  Service Location API                 June 1999
  733.  
  734.  
  735.                addr-list     =  hostnumber / hostnumber "," addr-list
  736.                hostnumber    =  1*3DIGIT 3("." 1*3DIGIT)
  737.  
  738.  
  739.          An example is:
  740.  
  741.  
  742.                   195.42.42.42,195.42.142.1,195.42.120.1
  743.  
  744.  
  745.          The example machine has three interfaces on which the DA should
  746.          listen.
  747.  
  748.          Note that since this property only takes IP addresses, it will
  749.          need to be changed if the network is renumbered.
  750.  
  751. 2.1.6. SA Configuration
  752.  
  753.    This section contains configuration properties for the SA. These
  754.    properties are typically set programmatically by the SA, since they
  755.    are specific to each SA.
  756.  
  757.       net.slp.SAAttributes
  758.  
  759.          A comma-separated list of parenthesized attribute/value list
  760.          pairs that the SA must advertise in SAAdverts.  The property
  761.          must be in the SLP attribute list wire format, including
  762.          escapes for reserved characters. [7]
  763.  
  764. 2.1.7. UA Configuration
  765.  
  766.    This section contains configuration properties for the UA. These
  767.    properties can be set either programmatically by the UA or in the
  768.    configuration file.
  769.  
  770.       net.slp.locale
  771.  
  772.          A RFC 1766 Language Tag [6] for the language locale.  Setting
  773.          this property causes the property value to become the default
  774.          locale for SLP messages.  Default is "en".  This property is
  775.          also used for SA and DA configuration.
  776.  
  777.       net.slp.maxResults
  778.  
  779.          A 32 bit integer giving the maximum number of results to
  780.          accumulate and return for a synchronous request before the
  781.          timeout, or the maximum number of results to return through a
  782.          callback if the request results are reported asynchronously.
  783.  
  784.  
  785.  
  786. Kempf & Guttman              Informational                     [Page 14]
  787.  
  788. RFC 2614                  Service Location API                 June 1999
  789.  
  790.  
  791.          Positive integers and -1 are legal values.  If -1, indicates
  792.          that all results should be returned.  Default value is -1.
  793.  
  794.          DAs and SAs always return all results that match the
  795.          request.  This configuration value applies only to UAs, that
  796.          filter incoming results and only return as many values as
  797.          net.slp.maxResults indicates.
  798.  
  799.       net.slp.typeHint
  800.  
  801.          A value-list of service type names.  In the absence of any
  802.          DAs, UAs perform SA discovery for finding scopes.  These SA
  803.          discovery requests may contain a request for service types as
  804.          an attribute.
  805.  
  806.          The API implementation will use the service type names supplied
  807.          by this property to discover only those SAs (and their scopes)
  808.          which support the desired service type or types.  For example,
  809.          if net.slp.typeHint is set to "service:imap,service:pop3" then
  810.          SA discovery requests will include the search filter:
  811.  
  812.  
  813.          (|(service-type=service:imap)(service-type=service:pop3))
  814.  
  815.  
  816.          The API library can also use unicast to contact the discovered
  817.          SAs for subsequent requests for these service types, to
  818.          optimize network access.
  819.  
  820. 2.1.8. Security
  821.  
  822.    The property in this section allows security for all agents to be set
  823.    on or off.  When the property is true, then the agent must include
  824.    security information on all SLP messages transacted by that agent.
  825.    Since security policy must be set network wide to be effective, a
  826.    single property controls security for all agents.  Key management and
  827.    management of SLP SPI strings [7] are implementation and policy
  828.    dependent.
  829.  
  830.       net.slp.securityEnabled
  831.  
  832.          A boolean indicating whether the agent should enable
  833.          security for URLs, attribute lists, DAAdverts, and SAAdverts.
  834.          Each agent is responsible for interpreting the property
  835.          appropriately.  Default is false.
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Kempf & Guttman              Informational                     [Page 15]
  843.  
  844. RFC 2614                  Service Location API                 June 1999
  845.  
  846.  
  847. 2.2. Multihomed Machines
  848.  
  849.    On multihomed machines, the bandwidth and latency characteristics on
  850.    different network interfaces may differ considerably, to the point
  851.    where different configuration properties are necessary to achieve
  852.    optimal performance.  The net.slp.interfaces property indicates which
  853.    network interfaces are SLP enabled.  An API library implementation
  854.    may support configuration customization on a per network interface
  855.    basis by allowing the interface IP address to be appended to the
  856.    property name.  In that case, the values of the property are only
  857.    used for that particular interface, the generic property (or defaults
  858.    if no generic property is set) applies to all others.
  859.  
  860.    For example, if a configuration has the following properties:
  861.  
  862.  
  863.       net.slp.interfaces=125.196.42.41,125.196.42.42,125.196.42.43
  864.       net.slp.multicastTTL.125.196.42.42=1
  865.  
  866.  
  867.    then the network interface on subnet 42 is restricted to a TTL of 1,
  868.    while the interfaces on the other subnets have the default multicast
  869.    radius, 255.
  870.  
  871.    The net.slp.interfaces property must only be set if there is no
  872.    routing between the interfaces.  If the property is set, the DA (if
  873.    any) and SAs should advertise with the IP address or host name
  874.    appropriate to the interface on the interfaces in the list.  If
  875.    packets are routed between the interfaces, then the DA and SAs should
  876.    only advertise on the default interface.  The property should also be
  877.    set if broadcast is used rather than multicast on the subnets
  878.    connected to the interfaces.  Note that even if unicast packets are
  879.    not routed between the interfaces, multicast may be routed through
  880.    another router.  The danger in listening for multicast on multiple
  881.    interfaces when multicast packets are routed is that the DA or SA may
  882.    receive the same multicast request via more than one interface.
  883.    Since the IP address is different on each interface, the DA or SA
  884.    cannot identify the request as having already being answered via the
  885.    previous responder's list.  The requesting agent will end up getting
  886.    URLs that refer to the same DA or service but have different
  887.    addresses or host names.
  888.  
  889. 2.3. Serialized Registration File
  890.  
  891.    The serialized registration file contains a group of registrations
  892.    that a DA or SA server (if one exists) registers when it starts up.
  893.    These registrations are primarily for older service programs that do
  894.    not internally support SLP and cannot be converted, and for portably
  895.  
  896.  
  897.  
  898. Kempf & Guttman              Informational                     [Page 16]
  899.  
  900. RFC 2614                  Service Location API                 June 1999
  901.  
  902.  
  903.    exchanging registrations between SLP implementations.  The character
  904.    encoding of the registrations is required to be UTF-8.
  905.  
  906.    The syntax of the serialized registration file, in ABNF format [5],
  907.    is as follows:
  908.  
  909.  
  910.       ser-file      =  reg-list
  911.       reg-list      =  reg / reg reg-list
  912.       reg           =  creg / ser-reg
  913.       creg          =  comment-line ser-reg
  914.       comment-line  =  ( "#" / ";" ) 1*allchar newline
  915.       ser-reg       =  url-props [slist] [attr-list] newline
  916.       url-props     =  surl "," lang "," ltime [ "," type ] newline
  917.       surl          =  ;The registration's URL. See
  918.                        ; [8] for syntax.
  919.       lang          =  1*8ALPHA [ "-" 1*8ALPHA ]
  920.                        ;RFC 1766 Language Tag see [6].
  921.       ltime         =  1*5DIGIT
  922.                        ; A positive 16-bit integer
  923.                        ; giving the lifetime
  924.                        ; of the registration.
  925.       type          =  ; The service type name, see [7]
  926.                        ; and [8] for syntax.
  927.       slist         =  "scopes" "=" scope-list newline
  928.       scope-list    =  scope-name / scope-name "," scope-list
  929.       scope         =  ; See grammar of [7] for
  930.                        ; scope-name syntax.
  931.       attr-list     =  attr-def / attr-def attr-list
  932.       attr-def      =  ( attr / keyword ) newline
  933.       keyword       =  attr-id
  934.       attr          =  attr-id "=" attr-val-list
  935.       attr-id       =  ;Attribute id, see [7] for syntax.
  936.       attr-val-list =  attr-val / attr-val "," attr-val-list
  937.       attr-val      =  ;Attribute value, see [7] for syntax.
  938.       allchar       =  char / WSP
  939.       char          =  DIGIT / ALPHA / other
  940.       other         =  %x21-%x2f / %x3a-%x40 /
  941.                        %x5b-%x60 / %7b-%7e
  942.                        ; All printable, nonwhitespace US-ASCII
  943.                        ; characters.
  944.       newline       =  CR / ( CRLF )
  945.  
  946.  
  947.    The syntax for scope names, attribute tags, and attribute values
  948.    requires escapes for special characters as specified in [7].  DAs and
  949.    SA servers that process serialized registrations must handle them
  950.    exactly as if they were registered by an SA. In the url-props
  951.  
  952.  
  953.  
  954. Kempf & Guttman              Informational                     [Page 17]
  955.  
  956. RFC 2614                  Service Location API                 June 1999
  957.  
  958.  
  959.    production, the type token is optional.  If the type token is present
  960.    for a service:  URL, a warning is signaled and the type name is
  961.    ignored.  If the maximum lifetime is specified (65535 sec.), the
  962.    registration is taken to be permanent, and is continually refreshed
  963.    by the DA or SA server until it exits.  Scopes can be included in a
  964.    registration by including an attribute definition with tag "scopes"
  965.    followed by a comma separated list of scope names immediately after
  966.    the url-props production.  If the optional scope list is present, the
  967.    registrations are made in the indicated scopes; otherwise, they are
  968.    registered in the scopes with which the DA or SA server was
  969.    configured through the net.slp.useScopes property.
  970.  
  971.    If the scope list contains scopes that are not in the
  972.    net.slp.useScopes property (provided that property is set) or are not
  973.    specified by DHCP, the API library should reject the registration and
  974.    issue a warning message.
  975.  
  976. 2.4. Processing Serialized Registration and Configuration Files
  977.  
  978.    Implementations are encouraged to make processing of configuration
  979.    and serialized files as transparent as possible to clients of the
  980.    API. At the latest, errors must be caught when the relevant
  981.    configuration item is used.  At the earliest, errors may be caught
  982.    when the relevant file is loaded into the executing agent.  Errors
  983.    should be reported by logging to the appropriate platform logging
  984.    file, error output, or log device, and the default value substituted.
  985.    Serialized registration file entries should be caught and reported
  986.    when the file is loaded.
  987.  
  988.    Configuration file loading must be complete prior to the initiation
  989.    of the first networking connection.  Serialized registration must be
  990.    complete before the DA accepts the first network request.
  991.  
  992. 3. Binding Independent Implementation Considerations
  993.  
  994.    This section discusses a number of implementation considerations
  995.    independent of language binding, with language specific notes where
  996.    applicable.
  997.  
  998. 3.1. Multithreading
  999.  
  1000.    Implementations of both the C and Java APIs are required to make API
  1001.    calls thread-safe.  Access to data structures shared between threads
  1002.    must be co-ordinated to avoid corruption or invalid access.  One way
  1003.    to achieve this goal is to allow only one thread at a time in the
  1004.    implementing library.  Performance in such an implementation suffers,
  1005.    however.  Therefore, where possible, implementations are encouraged
  1006.    to allow multiple threads within the SLP API library.
  1007.  
  1008.  
  1009.  
  1010. Kempf & Guttman              Informational                     [Page 18]
  1011.  
  1012. RFC 2614                  Service Location API                 June 1999
  1013.  
  1014.  
  1015. 3.2. Asynchronous and Incremental
  1016.  
  1017.    The APIs are designed to encourage implementations supporting
  1018.    asynchronous and incremental client interaction.  The goal is to
  1019.    allow large numbers of returned service URLs, service types, and
  1020.    attributes without requiring the allocation of huge chunks of memory.
  1021.    The particular design features to support this goal differ in the two
  1022.    language bindings.
  1023.  
  1024. 3.3. Type Checking for Service Types
  1025.  
  1026.    Service templates [8] allow SLP registrations to be type checked for
  1027.    correctness.  Implementations of the API are free to make use of
  1028.    service type information for type checking, but are not required to
  1029.    do so.  If a type error occurs, the registration should terminate
  1030.    with TYPE_ERROR.
  1031.  
  1032. 3.4. Refreshing Registrations
  1033.  
  1034.    SLP advertisements carry an explicit lifetime with them.  After the
  1035.    lifetime expires, the DA flushes the registration from its cache.  In
  1036.    some cases, an application may want to have the URL continue being
  1037.    registered for the entire time during which the application is
  1038.    executing.  The API includes provision for clients to indicate
  1039.    whether they want URLs to be automatically refreshed.
  1040.    Implementations of the SA API must provide this automatic refreshing
  1041.    capability.  Note that a client which uses this facility should
  1042.    explicitly deregister the service URL before exiting, since the API
  1043.    implementation may not be able to assure that the URL is deregistered
  1044.    when the application exits, although it will time out in the DA
  1045.    eventually.
  1046.  
  1047. 3.5. Configuration File Processing
  1048.  
  1049.    DAs, SAs and UAs processing the configuration file, and DAs and SA
  1050.    servers processing the serialized registration file are required to
  1051.    log any errors using whatever underlying error mechanism is
  1052.    appropriate for the platform.  Examples include writing error
  1053.    messages to the standard output, writing to a system logging device,
  1054.    or displaying the errors to a logging window.  After the error is
  1055.    reported, the offending property must be set to the default and
  1056.    program execution continued.  An agent MUST NOT fail if a file format
  1057.    error occurs.
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066. Kempf & Guttman              Informational                     [Page 19]
  1067.  
  1068. RFC 2614                  Service Location API                 June 1999
  1069.  
  1070.  
  1071. 3.6. Attribute Types
  1072.  
  1073.    String encoded attribute values do not include explicit type
  1074.    information.  All UA implementations and those SA and DA
  1075.    implementations that choose to support type checking should use the
  1076.    type rules described in [8] in order to convert from the string
  1077.    representation on the wire to an object typed appropriately.
  1078.  
  1079. 3.7. Removal of Duplicates
  1080.  
  1081.    The UA implementation SHOULD always collate results to remove
  1082.    duplicates during synchronous operations and for the Java API. During
  1083.    asynchronous operation in C, the UA implementation SHOULD forgo
  1084.    duplicate elimination to reduce memory requirements in the library.
  1085.    This allows the API library to simply take the returned attribute
  1086.    value list strings, URL strings, or service type list strings and
  1087.    call the callback function with it, without any additional
  1088.    processing.  Naturally, the burden of duplicate elimination is thrown
  1089.    onto the client in this case.
  1090.  
  1091. 3.8. Character Set Encoding
  1092.  
  1093.    Character string parameters in the Java API are all represented in
  1094.    Unicode internally because that is the Java-supported character set.
  1095.    Characters buffer parameters in the C API are represented in UTF-8 to
  1096.    maintain maximum compatibility on platforms that only support US-
  1097.    ASCII and not UTF-8.  API functions are still required to handle the
  1098.    full range of UTF-8 characters because the SLP protocol requires it,
  1099.    but the API implementation can represent the characters internally in
  1100.    any convenient way.  On the wire, all characters are converted to
  1101.    UTF-8.  Inside URLs, characters that are not allowed by URL syntax
  1102.    [2] must be escaped according to the URL escape character convention.
  1103.    Strings that are included in SLP messages may include SLP reserved
  1104.    characters and can be escaped by clients through convenience
  1105.    functions provided by the API. The character encoding used in escapes
  1106.    is UTF-8.
  1107.  
  1108.    Due to constraints in SLP, no string parameter passed to the C or
  1109.    Java API may exceed 64K bytes in length.
  1110.  
  1111. 3.9. Error Semantics
  1112.  
  1113.    All errors encountered processing SLP messages should be logged.  For
  1114.    synchronous calls, an error is only reported on a call if no
  1115.    successful replies were received from any SLP framework entity.  If
  1116.    an error occurred among one of several successful replies, then the
  1117.    error should be logged and the successful replies returned.  For
  1118.    asynchronous calls, an error occurring during correspondence with a
  1119.  
  1120.  
  1121.  
  1122. Kempf & Guttman              Informational                     [Page 20]
  1123.  
  1124. RFC 2614                  Service Location API                 June 1999
  1125.  
  1126.  
  1127.    particular remote SLP agent is reported through the first callback
  1128.    (in the C API) or enumeration method invocation (in the Java API)
  1129.    after the error occurs, which would normally report the results of
  1130.    the correspondence.  This allows the callback or client code to
  1131.    determine whether the operation should be terminated or continue.  In
  1132.    some cases, the error returned from the SLP framework may be fatal
  1133.    (SLP_PARSE_ERROR, etc.).  In these cases, the API library terminates
  1134.    the operation.
  1135.  
  1136.    Both the Java and C APIs contain language specific error code
  1137.    mechanisms for returning error information.  The names of the error
  1138.    codes are consistent between the two implementations, however.
  1139.  
  1140.    The following error codes are returned from a remote agent (DA or SA
  1141.    server):
  1142.  
  1143.       LANGUAGE_NOT_SUPPORTED
  1144.  
  1145.          No DA or SA has service advertisement or attribute information
  1146.          in the language requested, but at least one DA or SA indicated,
  1147.          via the LANGUAGE_NOT_SUPPORTED error code, that it might have
  1148.          information for that service in another language.
  1149.  
  1150.       PARSE_ERROR
  1151.  
  1152.          The SLP message was rejected by a remote SLP agent.  The API
  1153.          returns this error only when no information was retrieved, and
  1154.          at least one SA or DA indicated a protocol error.  The data
  1155.          supplied through the API may be malformed or a may have been
  1156.          damaged in transit.
  1157.  
  1158.       INVALID_REGISTRATION
  1159.  
  1160.          The API may return this error if an attempt to register a
  1161.          service was rejected by all DAs because of a malformed URL or
  1162.          attributes.  SLP does not return the error if at least one DA
  1163.          accepted the registration.
  1164.  
  1165.       AUTHENTICATION_ABSENT
  1166.  
  1167.          If the SLP framework supports authentication, this error arises
  1168.          when the UA or SA failed to send an authenticator for requests
  1169.          or registrations in a protected scope.
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178. Kempf & Guttman              Informational                     [Page 21]
  1179.  
  1180. RFC 2614                  Service Location API                 June 1999
  1181.  
  1182.  
  1183.       INVALID_UPDATE
  1184.  
  1185.          An update for a non-existing registration was issued, or the
  1186.          update includes a service type or scope different than that in
  1187.          the initial registration, etc.
  1188.  
  1189.    The following errors result from interactions with remote agents or
  1190.    can occur locally:
  1191.  
  1192.       AUTHENTICATION_FAILED
  1193.  
  1194.          If the SLP framework supports authentication, this error arises
  1195.          when a authentication on an SLP message failed.
  1196.  
  1197.       SCOPE_NOT_SUPPORTED
  1198.  
  1199.          The API returns this error if the SA has been configured with
  1200.          net.slp.useScopes value-list of scopes and the SA request did
  1201.          not specify one or more of these allowable scopes, and no
  1202.          others.  It may be returned by a DA or SA if the scope included
  1203.          in a request is not supported by the DA or SA.
  1204.  
  1205.       REFRESH_REJECTED
  1206.  
  1207.          The SA attempted to refresh a registration more frequently
  1208.          than the minimum refresh interval.  The SA should call the
  1209.          appropriate API function to obtain the minimum refresh interval
  1210.          to use.
  1211.  
  1212.    The following errors are generated through a program interacting with
  1213.    the API implementation.  They do not involve a remote SLP agent.
  1214.  
  1215.       NOT_IMPLEMENTED
  1216.  
  1217.          If an unimplemented feature is used, this error is returned.
  1218.  
  1219.       NETWORK_INIT_FAILED
  1220.  
  1221.          If the network cannot initialize properly, this error is
  1222.          returned.
  1223.  
  1224.       NETWORK_TIMED_OUT
  1225.  
  1226.          When no reply can be obtained in the time specified by the
  1227.          configured timeout interval for a unicast request, this error
  1228.          is returned.
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234. Kempf & Guttman              Informational                     [Page 22]
  1235.  
  1236. RFC 2614                  Service Location API                 June 1999
  1237.  
  1238.  
  1239.       NETWORK_ERROR
  1240.  
  1241.          The failure of networking during normal operations causes this
  1242.          error to be returned.
  1243.  
  1244.       BUFFER_OVERFLOW
  1245.  
  1246.          An outgoing request overflowed the maximum network MTU size.
  1247.          The request should be reduced in size or broken into pieces and
  1248.          tried again.
  1249.  
  1250.       MEMORY_ALLOC_FAILED
  1251.  
  1252.          If the API fails to allocate memory, the operation is aborted
  1253.          and returns this.
  1254.  
  1255.       PARAMETER_BAD
  1256.  
  1257.          If a parameter passed into an interface is bad, this error is
  1258.          returned.
  1259.  
  1260.       INTERNAL_SYSTEM_ERROR
  1261.  
  1262.          A basic failure of the API causes this error to be returned.
  1263.          This occurs when a system call or library fails.  The operation
  1264.          could not recover.
  1265.  
  1266.       HANDLE_IN_USE
  1267.  
  1268.          In the C API, callback functions are not permitted to
  1269.          recursively call into the API on the same SLPHandle, either
  1270.          directly or indirectly.  If an attempt is made to do so, this
  1271.          error is returned from the called API function.
  1272.  
  1273.       TYPE_ERROR
  1274.  
  1275.          If the API supports type checking of registrations against
  1276.          service type templates, this error can arise if the attributes
  1277.          in a registration do not match the service type template for
  1278.          the service.
  1279.  
  1280.    Some error codes are handled differently in the Java API. These
  1281.    differences are discussed in Section 5.
  1282.  
  1283.    The SLP protocol errors OPTION_NOT_UNDERSTOOD, VERSION_NOT_SUPPORTED,
  1284.    INTERNAL_ERROR, MSG_NOT_SUPPORTED, AUTHENTICATON_UNKNOWN, and
  1285.    DA_BUSY_NOW should be handled internally and not surfaced to clients
  1286.    through the API.
  1287.  
  1288.  
  1289.  
  1290. Kempf & Guttman              Informational                     [Page 23]
  1291.  
  1292. RFC 2614                  Service Location API                 June 1999
  1293.  
  1294.  
  1295. 3.10. Modular Implementations
  1296.  
  1297.    Subset implementations that do not support the full range of
  1298.    functionality are required to nevertheless support every interface in
  1299.    order to maintain link compatibility between compliant API
  1300.    implementations and applications.  If a particular operation is not
  1301.    supported, a NOT_IMPLEMENTED error should be returned.  The Java API
  1302.    has some additional conventions for handling subsets.  Applications
  1303.    that are expected to run on a wide variety of platforms should be
  1304.    prepared for subset API implementations by checking returned error
  1305.    codes.
  1306.  
  1307. 3.11. Handling Special Service Types
  1308.  
  1309.    The service types service:directory-agent and service:service-agent
  1310.    are used internally in the SLP framework to discover DAs and SAs.
  1311.    The mechanism of DA and SA discovery is not normally exposed to the
  1312.    API client; however, the client may have interest in discovering DAs
  1313.    and SAs independently of their role in discovering other services.
  1314.    For example, a network management application may want to determine
  1315.    which machines are running SLP DAs.  To facilitate that, API
  1316.    implementations must handle requests to find services and attributes
  1317.    for these two service types so that API clients obtain the
  1318.    information they expect.
  1319.  
  1320.    In particular, if the UA is using a DA, SrvRqst and AttrRqst for
  1321.    these service types must be multicast and not unicast to the DA, as
  1322.    is the case for other service types.  If the requests are not
  1323.    multicast, the DA will respond with an empty reply to a request for
  1324.    services of type service:service-agent and with its URL only to a
  1325.    request for services of type service:directory-agent.  The UA would
  1326.    therefore not obtain a complete picture of the available DAs and SAs.
  1327.  
  1328. 3.12. Scope Discovery and Handling
  1329.  
  1330.    Both APIs contain an operation to obtain a list of currently known
  1331.    scope names.  This scope information comes from a variety of places:
  1332.    DHCP, the net.slp.useScopes property, unicast to DAs configured via
  1333.    DHCP or the net.slp.DAAddresses property, and active and passive
  1334.    discovery.
  1335.  
  1336.    The API is required to be implemented in a way that re-enforces the
  1337.    administrative and user scoping models described in [7].  SA clients
  1338.    only support the administrative scoping model.  SAs must know a
  1339.    priori what DAs they need to register with since there is typically
  1340.    no human intervention in scope selection for SAs.  UAs must support
  1341.    both administrative and user scoping because an application may
  1342.    require human intervention in scope selection.
  1343.  
  1344.  
  1345.  
  1346. Kempf & Guttman              Informational                     [Page 24]
  1347.  
  1348. RFC 2614                  Service Location API                 June 1999
  1349.  
  1350.  
  1351.    API implementations are required to support administrative scoping in
  1352.    the following way.  Scopes configured by DHCP and scopes of DAs
  1353.    configured by DHCP have first priority (in that order) and must be
  1354.    returned if they are available.  The net.slp.useScopes property has
  1355.    second priority, and scopes discovered through the net.slp.useScopes
  1356.    property must be returned if this property is set and there are no
  1357.    scopes available from DHCP. If scopes are not available from either
  1358.    of these sources and the net.slp.DAAddresses property is set, then
  1359.    the scopes available from the configured DAs must be returned.  Note
  1360.    that if both DAs and scopes are configured, the scopes of the
  1361.    configured DAs must match the configured scope list; otherwise and
  1362.    error is signaled and agent execution is terminated.  If no
  1363.    configured scope information is available, then an SA client has
  1364.    default scope, "DEFAULT", and a UA client employs user scoping.
  1365.  
  1366.    User scoping is supported in the following way.  Scopes discovered
  1367.    from active DA discovery, and from passive DA discovery all must be
  1368.    returned.  If no information is available from active and passive DA
  1369.    discovery, then the API library may perform SA discovery, using the
  1370.    service types in the net.slp.typeHint property to limit the search to
  1371.    SAs supporting particular service types.  If no net.slp.typeHint
  1372.    property is set, the UA may perform SA discovery without any service
  1373.    type query.  In the absence of any of the above sources of
  1374.    information, the API must return the default scope, "DEFAULT".  Note
  1375.    that the API must always return some scope information.
  1376.  
  1377.    SLP requires that SAs must perform their operations in all scopes
  1378.    currently known to them. [7].  The API enforces this constraint by
  1379.    not requiring the API client to supply any scopes as parameters to
  1380.    API operations.  The API library must obtain all currently known
  1381.    scopes and use them in SA operations.  UA API clients should use a
  1382.    scope obtained through one of the API operations for finding scopes.
  1383.    Any other scope name may result in a SCOPE_NOT_SUPPORTED error from a
  1384.    remote agent.  The UA API library can optionally check the scope and
  1385.    return the error without contacting a remote agent.
  1386.  
  1387. 4. C Language Binding
  1388.  
  1389.    The C language binding presents a minimal overhead implementation
  1390.    that maps directly into the protocol.  There is one C language
  1391.    function per protocol request, with the exception of the SLPDereg()
  1392.    and SLPDelAttrs() functions, which map into different uses of the SLP
  1393.    deregister request.  Parameters are for the most part character
  1394.    buffers.  Memory management is kept simple by having the client
  1395.    allocate most memory and requiring that client callback functions
  1396.    copy incoming parameters into memory allocated by the client code.
  1397.    Any memory returned directly from the API functions is deallocated
  1398.    using the SLPFree() function.
  1399.  
  1400.  
  1401.  
  1402. Kempf & Guttman              Informational                     [Page 25]
  1403.  
  1404. RFC 2614                  Service Location API                 June 1999
  1405.  
  1406.  
  1407.    To conform with standard C practice, all character strings passed to
  1408.    and returned through the API are null terminated, even though the SLP
  1409.    protocol does not use null terminated strings.  Strings passed as
  1410.    parameters are UTF-8 but they may still be passed as a C string (a
  1411.    null terminated sequence of bytes.)  Escaped characters must be
  1412.    encoded by the API client as UTF-8.  In the common case of US-ASCII,
  1413.    the usual one byte per character C strings work.  API functions
  1414.    assist in escaping and unescaping strings.
  1415.  
  1416.    Unless otherwise noted, parameters to API functions and callbacks are
  1417.    non-NULL. Some parameters may have other restrictions.  If any
  1418.    parameter fails to satisfy the restrictions on its value, the
  1419.    operation returns a PARAMETER_BAD error.
  1420.  
  1421. 4.1. Constant Types
  1422.  
  1423. 4.1.1. URL Lifetimes
  1424.  
  1425. 4.1.1.1. Synopsis
  1426.  
  1427.  
  1428.    typedef enum {
  1429.      SLP_LIFETIME_DEFAULT = 10800,
  1430.      SLP_LIFETIME_MAXIMUM = 65535
  1431.    } SLPURLLifetime;
  1432.  
  1433.  
  1434. 4.1.1.2. Description
  1435.  
  1436.    The SLPURLLifetime enum type contains URL lifetime values, in
  1437.    seconds, that are frequently used.  SLP_LIFETIME_DEFAULT is 3 hours,
  1438.    while SLP_LIFETIME_MAXIMUM is about 18 hours and corresponds to the
  1439.    maximum size of the lifetime field in SLP messages.
  1440.  
  1441. 4.1.2. Error Codes
  1442.  
  1443. 4.1.2.1. Synopsis
  1444.  
  1445.  
  1446.    typedef enum {
  1447.      SLP_LAST_CALL                    = 1,
  1448.      SLP_OK                           = 0,
  1449.      SLP_LANGUAGE_NOT_SUPPORTED       = -1,
  1450.      SLP_PARSE_ERROR                  = -2,
  1451.      SLP_INVALID_REGISTRATION         = -3,
  1452.      SLP_SCOPE_NOT_SUPPORTED          = -4,
  1453.      SLP_AUTHENTICATION_ABSENT        = -6,
  1454.      SLP_AUTHENTICATION_FAILED        = -7,
  1455.  
  1456.  
  1457.  
  1458. Kempf & Guttman              Informational                     [Page 26]
  1459.  
  1460. RFC 2614                  Service Location API                 June 1999
  1461.  
  1462.  
  1463.      SLP_INVALID_UPDATE               = -13,
  1464.      SLP_REFRESH_REJECTED             = -15,
  1465.      SLP_NOT_IMPLEMENTED              = -17,
  1466.      SLP_BUFFER_OVERFLOW              = -18,
  1467.      SLP_NETWORK_TIMED_OUT            = -19,
  1468.      SLP_NETWORK_INIT_FAILED          = -20,
  1469.      SLP_MEMORY_ALLOC_FAILED          = -21,
  1470.      SLP_PARAMETER_BAD                = -22,
  1471.      SLP_NETWORK_ERROR                = -23,
  1472.      SLP_INTERNAL_SYSTEM_ERROR        = -24,
  1473.      SLP_HANDLE_IN_USE                = -25,
  1474.      SLP_TYPE_ERROR                   = -26
  1475.    } SLPError ;
  1476.  
  1477.  
  1478. 4.1.2.2. Description
  1479.  
  1480.    The SLPError enum contains error codes that are returned from API
  1481.    functions.
  1482.  
  1483.    The SLP_OK code indicates that the no error occurred during the
  1484.    operation.
  1485.  
  1486.    The SLP_LAST_CALL code is passed to callback functions when the API
  1487.    library has no more data for them and therefore no further calls will
  1488.    be made to the callback on the currently outstanding operation.  The
  1489.    callback can use this to signal the main body of the client code that
  1490.    no more data will be forthcoming on the operation, so that the main
  1491.    body of the client code can break out of data collection loops.  On
  1492.    the last call of a callback during both a synchronous and
  1493.    asynchronous call, the error code parameter has value SLP_LAST_CALL,
  1494.    and the other parameters are all NULL. If no results are returned by
  1495.    an API operation, then only one call is made, with the error
  1496.    parameter set to SLP_LAST_CALL.
  1497.  
  1498. 4.1.3. SLPBoolean
  1499.  
  1500. 4.1.3.1. Synopsis
  1501.  
  1502.  
  1503.    typedef enum {
  1504.       SLP_FALSE = 0,
  1505.       SLP_TRUE = 1
  1506.  
  1507.    } SLPBoolean;
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Kempf & Guttman              Informational                     [Page 27]
  1515.  
  1516. RFC 2614                  Service Location API                 June 1999
  1517.  
  1518.  
  1519. 4.1.3.2. Description
  1520.  
  1521.    The SLPBoolean enum is used as a boolean flag.
  1522.  
  1523. 4.2. Struct Types
  1524.  
  1525. 4.2.1. SLPSrvURL
  1526.  
  1527. 4.2.1.1. Synopsis
  1528.  
  1529.  
  1530.    typedef struct srvurl {
  1531.      char *s_pcSrvType;
  1532.      char *s_pcHost;
  1533.      int   s_iPort;
  1534.      char *s_pcNetFamily;
  1535.      char *s_pcSrvPart;
  1536.    } SLPSrvURL;
  1537.  
  1538.  
  1539. 4.2.1.2. Description
  1540.  
  1541.    The SLPSrvURL structure is filled in by the SLPParseSrvURL() function
  1542.    with information parsed from a character buffer containing a service
  1543.    URL. The fields correspond to different parts of the URL. Note that
  1544.    the structure is in conformance with the standard Berkeley sockets
  1545.    struct servent, with the exception that the pointer to an array of
  1546.    characters for aliases (s_aliases field) is replaced by the pointer
  1547.    to host name (s_pcHost field).
  1548.  
  1549.       s_pcSrvType
  1550.  
  1551.          A pointer to a character string containing the service
  1552.          type name, including naming authority.  The service type
  1553.          name includes the "service:" if the URL is of the service:
  1554.          scheme. [7]
  1555.  
  1556.       s_pcHost
  1557.  
  1558.          A pointer to a character string containing the host
  1559.          identification information.
  1560.  
  1561.       s_iPort
  1562.  
  1563.          The port number, or zero if none.  The port is only available
  1564.          if the transport is IP.
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Kempf & Guttman              Informational                     [Page 28]
  1571.  
  1572. RFC 2614                  Service Location API                 June 1999
  1573.  
  1574.  
  1575.       s_pcNetFamily
  1576.  
  1577.          A pointer to a character string containing the network address
  1578.          family identifier.  Possible values are "ipx" for the IPX
  1579.          family, "at" for the Appletalk family, and "" (i.e.  the empty
  1580.          string) for the IP address family.
  1581.  
  1582.       s_pcSrvPart
  1583.  
  1584.          The remainder of the URL, after the host identification.
  1585.  
  1586.    The host and port should be sufficient to open a socket to the
  1587.    machine hosting the service, and the remainder of the URL should
  1588.    allow further differentiation of the service.
  1589.  
  1590. 4.2.2. SLPHandle
  1591.  
  1592. 4.2.2.1. Synopsis
  1593.  
  1594.  
  1595.    typedef void* SLPHandle;
  1596.  
  1597.  
  1598.    The SLPHandle type is returned by SLPOpen() and is a parameter to all
  1599.    SLP functions.  It serves as a handle for all resources allocated on
  1600.    behalf of the process by the SLP library.  The type is opaque, since
  1601.    the exact nature differs depending on the implementation.
  1602.  
  1603. 4.3. Callbacks
  1604.  
  1605.    A function pointer to a callback function specific to a particular
  1606.    API operation is included in the parameter list when the API function
  1607.    is invoked.  The callback function is called with the results of the
  1608.    operation in both the synchronous and asynchronous cases.  The memory
  1609.    included in the callback parameters is owned by the API library, and
  1610.    the client code in the callback must copy out the contents if it
  1611.    wants to maintain the information longer than the duration of the
  1612.    current callback call.
  1613.  
  1614.    In addition to parameters for reporting the results of the operation,
  1615.    each callback parameter list contains an error code parameter and a
  1616.    cookie parameter.  The error code parameter reports the error status
  1617.    of the ongoing (for asynchronous) or completed (for synchronous)
  1618.    operation.  The cookie parameter allows the client code that starts
  1619.    the operation by invoking the API function to pass information down
  1620.    to the callback without using global variables.  The callback returns
  1621.    an SLPBoolean to indicate whether the API library should continue
  1622.    processing the operation.  If the value returned from the callback is
  1623.  
  1624.  
  1625.  
  1626. Kempf & Guttman              Informational                     [Page 29]
  1627.  
  1628. RFC 2614                  Service Location API                 June 1999
  1629.  
  1630.  
  1631.    SLP_TRUE, asynchronous operations are terminated, synchronous
  1632.    operations ignore the return (since the operation is already
  1633.    complete).
  1634.  
  1635. 4.3.1. SLPRegReport
  1636.  
  1637. 4.3.1.1. Synopsis
  1638.  
  1639.  
  1640.    typedef void SLPRegReport(SLPHandle hSLP,
  1641.                              SLPError errCode,
  1642.                              void *pvCookie);
  1643.  
  1644.  
  1645. 4.3.1.2. Description
  1646.  
  1647.    The SLPRegReport callback type is the type of the callback function
  1648.    to the SLPReg(), SLPDereg(), and SLPDelAttrs() functions.
  1649.  
  1650. 4.3.1.3. Parameters
  1651.  
  1652.       hSLP
  1653.  
  1654.          The SLPHandle used to initiate the operation.
  1655.  
  1656.       errCode
  1657.  
  1658.          An error code indicating if an error occurred during the
  1659.          operation.
  1660.  
  1661.       pvCookie
  1662.  
  1663.          Memory passed down from the client code that called the
  1664.          original API function, starting the operation.  May be NULL.
  1665.  
  1666. 4.3.2. SLPSrvTypeCallback
  1667.  
  1668. 4.3.2.1. Synopsis
  1669.  
  1670.    typedef SLPBoolean SLPSrvTypeCallback(SLPHandle hSLP,
  1671.                                          const char* pcSrvTypes,
  1672.                                          SLPError errCode,
  1673.                                          void *pvCookie);
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Kempf & Guttman              Informational                     [Page 30]
  1683.  
  1684. RFC 2614                  Service Location API                 June 1999
  1685.  
  1686.  
  1687. 4.3.2.2. Description
  1688.  
  1689.    The SLPSrvTypeCallback type is the type of the callback function
  1690.    parameter to SLPFindSrvTypes() function.  If the hSLP handle
  1691.    parameter was opened asynchronously, the results returned through the
  1692.    callback MAY be uncollated.  If the hSLP handle parameter was opened
  1693.    synchronously, then the returned results must be collated and
  1694.    duplicates eliminated.
  1695.  
  1696. 4.3.2.3. Parameters
  1697.  
  1698.       hSLP
  1699.  
  1700.          The SLPHandle used to initiate the operation.
  1701.  
  1702.       pcSrvTypes
  1703.  
  1704.          A character buffer containing a comma separated, null
  1705.          terminated list of service types.
  1706.  
  1707.       errCode
  1708.  
  1709.          An error code indicating if an error occurred during the
  1710.          operation.  The callback should check this error code before
  1711.          processing the parameters.  If the error code is other than
  1712.          SLP_OK, then the API library may choose to terminate the
  1713.          outstanding operation.
  1714.  
  1715.       pvCookie
  1716.  
  1717.          Memory passed down from the client code that called the
  1718.          original API function, starting the operation.  May be NULL.
  1719.  
  1720. 4.3.2.4. Returns
  1721.  
  1722.    The client code should return SLP_TRUE if more data is desired,
  1723.    otherwise SLP_FALSE.
  1724.  
  1725. 4.3.3. SLPSrvURLCallback
  1726.  
  1727. 4.3.3.1. Synopsis
  1728.  
  1729.  
  1730.    typedef SLPBoolean SLPSrvURLCallback(SLPHandle hSLP,
  1731.                                         const char* pcSrvURL,
  1732.                                         unsigned short sLifetime,
  1733.                                         SLPError errCode,
  1734.                                         void *pvCookie);
  1735.  
  1736.  
  1737.  
  1738. Kempf & Guttman              Informational                     [Page 31]
  1739.  
  1740. RFC 2614                  Service Location API                 June 1999
  1741.  
  1742.  
  1743. 4.3.3.2. Description
  1744.  
  1745.    The SLPSrvURLCallback type is the type of the callback function
  1746.    parameter to SLPFindSrvs() function.  If the hSLP handle parameter
  1747.    was opened asynchronously, the results returned through the callback
  1748.    MAY be uncollated.  If the hSLP handle parameter was opened
  1749.    synchronously, then the returned results must be collated and
  1750.    duplicates eliminated.
  1751.  
  1752. 4.3.3.3. Parameters
  1753.  
  1754.       hSLP
  1755.  
  1756.          The SLPHandle used to initiate the operation.
  1757.  
  1758.       pcSrvURL
  1759.  
  1760.          A character buffer containing the returned service URL.
  1761.  
  1762.       sLifetime
  1763.  
  1764.          An unsigned short giving the life time of the service
  1765.          advertisement, in seconds.  The value must be an unsigned
  1766.          integer less than or equal to SLP_LIFETIME_MAXIMUM.
  1767.  
  1768.       errCode
  1769.  
  1770.          An error code indicating if an error occurred during the
  1771.          operation.  The callback should check this error code before
  1772.          processing the parameters.  If the error code is other than
  1773.          SLP_OK, then the API library may choose to terminate the
  1774.          outstanding operation.
  1775.  
  1776.       pvCookie
  1777.  
  1778.          Memory passed down from the client code that called the
  1779.          original API function, starting the operation.  May be NULL.
  1780.  
  1781. 4.3.3.4. Returns
  1782.  
  1783.    The client code should return SLP_TRUE if more data is desired,
  1784.    otherwise SLP_FALSE.
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794. Kempf & Guttman              Informational                     [Page 32]
  1795.  
  1796. RFC 2614                  Service Location API                 June 1999
  1797.  
  1798.  
  1799. 4.3.4. SLPAttrCallback
  1800.  
  1801. 4.3.4.1. Synopsis
  1802.  
  1803.  
  1804.    typedef SLPBoolean SLPAttrCallback(SLPHandle hSLP,
  1805.                                       const char* pcAttrList,
  1806.                                       SLPError errCode,
  1807.                                       void *pvCookie);
  1808.  
  1809.  
  1810. 4.3.4.2. Description
  1811.  
  1812.    The SLPAttrCallback type is the type of the callback function
  1813.    parameter to SLPFindAttrs() function.
  1814.  
  1815.    The behavior of the callback differs depending on whether the
  1816.    attribute request was by URL or by service type.  If the
  1817.    SLPFindAttrs() operation was originally called with a URL, the
  1818.    callback is called once regardless of whether the handle was opened
  1819.    asynchronously or synchronously.  The pcAttrList parameter contains
  1820.    the requested attributes as a comma separated list (or is empty if no
  1821.    attributes matched the original tag list).
  1822.  
  1823.    If the SLPFindAttrs() operation was originally called with a service
  1824.    type, the value of pcAttrList and calling behavior depend on whether
  1825.    the handle was opened asynchronously or synchronously.  If the handle
  1826.    was opened asynchronously, the callback is called every time the API
  1827.    library has results from a remote agent.  The pcAttrList parameter
  1828.    MAY be uncollated between calls.  It contains a comma separated list
  1829.    with the results from the agent that immediately returned results.
  1830.    If the handle was opened synchronously, the results must be collated
  1831.    from all returning agents and the callback is called once, with the
  1832.    pcAttrList parameter set to the collated result.
  1833.  
  1834. 4.3.4.3. Parameters
  1835.  
  1836.       hSLP
  1837.  
  1838.          The SLPHandle used to initiate the operation.
  1839.  
  1840.       pcAttrList
  1841.  
  1842.          A character buffer containing a comma separated, null
  1843.          terminated list of attribute id/value assignments, in SLP wire
  1844.          format; i.e.  "(attr-id=attr-value-list)" [7].
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850. Kempf & Guttman              Informational                     [Page 33]
  1851.  
  1852. RFC 2614                  Service Location API                 June 1999
  1853.  
  1854.  
  1855.       errCode
  1856.  
  1857.          An error code indicating if an error occurred during the
  1858.          operation.  The callback should check this error code before
  1859.          processing the parameters.  If the error code is other than
  1860.          SLP_OK, then the API library may choose to terminate the
  1861.          outstanding operation.
  1862.  
  1863.       pvCookie
  1864.  
  1865.          Memory passed down from the client code that called the
  1866.          original API function, starting the operation.  May be NULL.
  1867.  
  1868. 4.3.4.4. Returns
  1869.  
  1870.    The client code should return SLP_TRUE if more data is desired,
  1871.    otherwise SLP_FALSE.
  1872.  
  1873. 4.4. Opening and Closing an SLPHandle
  1874.  
  1875. 4.4.1. SLPOpen
  1876.  
  1877. 4.4.1.1. Synopsis
  1878.  
  1879.    SLPError SLPOpen(const char *pcLang, SLPBoolean isAsync, SLPHandle
  1880.    *phSLP);
  1881.  
  1882. 4.4.1.2. Description
  1883.  
  1884.    Returns a SLPHandle handle in the phSLP parameter for the language
  1885.    locale passed in as the pcLang parameter.  The client indicates if
  1886.    operations on the handle are to be synchronous or asynchronous
  1887.    through the isAsync parameter.  The handle encapsulates the language
  1888.    locale for SLP requests issued through the handle, and any other
  1889.    resources required by the implementation.  However, SLP properties
  1890.    are not encapsulated by the handle; they are global.  The return
  1891.    value of the function is an SLPError code indicating the status of
  1892.    the operation.  Upon failure, the phSLP parameter is NULL.
  1893.  
  1894.    An SLPHandle can only be used for one SLP API operation at a time.
  1895.    If the original operation was started asynchronously, any attempt to
  1896.    start an additional operation on the handle while the original
  1897.    operation is pending results in the return of an SLP_HANDLE_IN_USE
  1898.    error from the API function.  The SLPClose() API function terminates
  1899.    any outstanding calls on the handle.  If an implementation is unable
  1900.    to support a asynchronous( resp.  synchronous) operation, due to
  1901.    memory constraints or lack of threading support, the
  1902.    SLP_NOT_IMPLEMENTED flag may be returned when the isAsync flag is
  1903.  
  1904.  
  1905.  
  1906. Kempf & Guttman              Informational                     [Page 34]
  1907.  
  1908. RFC 2614                  Service Location API                 June 1999
  1909.  
  1910.  
  1911.    SLP_TRUE (resp.  SLP_FALSE).
  1912.  
  1913. 4.4.1.3. Parameters
  1914.  
  1915.       pcLang
  1916.  
  1917.          A pointer to an array of characters containing the RFC 1766
  1918.          Language Tag [6] for the natural language locale of requests
  1919.          and registrations issued on the handle.
  1920.  
  1921.       isAsync
  1922.  
  1923.          An SLPBoolean indicating whether the SLPHandle should be opened
  1924.          for asynchronous operation or not.
  1925.  
  1926.       phSLP
  1927.  
  1928.          A pointer to an SLPHandle, in which the open SLPHandle is
  1929.          returned.  If an error occurs, the value upon return is NULL.
  1930.  
  1931. 4.4.2. SLPClose
  1932.  
  1933. 4.4.2.1. Synopsis
  1934.  
  1935.  
  1936.    void SLPClose(SLPHandle hSLP);
  1937.  
  1938.  
  1939. 4.4.2.2. Description
  1940.  
  1941.    Frees all resources associated with the handle.  If the handle was
  1942.    invalid, the function returns silently.  Any outstanding synchronous
  1943.    or asynchronous operations are cancelled so their callback functions
  1944.    will not be called any further.
  1945.  
  1946. 4.4.2.3. Parameters
  1947.  
  1948.       SLPHandle
  1949.  
  1950.          A SLPHandle handle returned from a call to SLPOpen().
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962. Kempf & Guttman              Informational                     [Page 35]
  1963.  
  1964. RFC 2614                  Service Location API                 June 1999
  1965.  
  1966.  
  1967. 4.5. Protocol API
  1968.  
  1969. 4.5.1. SLPReg
  1970.  
  1971. 4.5.1.1. Synopsis
  1972.  
  1973.  
  1974.    SLPError SLPReg(SLPHandle   hSLP,
  1975.                    const char  *pcSrvURL,
  1976.                    const unsigned short usLifetime,
  1977.                    const char  *pcSrvType,
  1978.                    const char  *pcAttrs
  1979.                    SLPBoolean  fresh,
  1980.                    SLPRegReport callback,
  1981.                    void *pvCookie);
  1982.  
  1983.  
  1984. 4.5.1.2. Description
  1985.  
  1986.    Registers the URL in pcSrvURL having the lifetime usLifetime with the
  1987.    attribute list in pcAttrs.  The pcAttrs list is a comma separated
  1988.    list of attribute assignments in the wire format (including escaping
  1989.    of reserved characters).  The usLifetime parameter must be nonzero
  1990.    and less than or equal to SLP_LIFETIME_MAXIMUM. If the fresh flag is
  1991.    SLP_TRUE, then the registration is new (the SLP protocol FRESH flag
  1992.    is set) and the registration replaces any existing registrations.
  1993.    The pcSrvType parameter is a service type name and can be included
  1994.    for service URLs that are not in the service:  scheme.  If the URL is
  1995.    in the service:  scheme, the pcSrvType parameter is ignored.  If the
  1996.    fresh flag is SLP_FALSE, then an existing registration is updated.
  1997.    Rules for new and updated registrations, and the format for pcAttrs
  1998.    and pcScopeList can be found in [7].  Registrations and updates take
  1999.    place in the language locale of the hSLP handle.
  2000.  
  2001.    The API library is required to perform the operation in all scopes
  2002.    obtained through configuration.
  2003.  
  2004. 4.5.1.3. Parameters
  2005.  
  2006.       hSLP
  2007.  
  2008.          The language specific SLPHandle on which to register the
  2009.          advertisement.
  2010.  
  2011.       pcSrvURL
  2012.  
  2013.          The URL to register.  May not be the empty string.
  2014.  
  2015.  
  2016.  
  2017.  
  2018. Kempf & Guttman              Informational                     [Page 36]
  2019.  
  2020. RFC 2614                  Service Location API                 June 1999
  2021.  
  2022.  
  2023.       usLifetime
  2024.  
  2025.          An unsigned short giving the life time of the service
  2026.          advertisement, in seconds.  The value must be an unsigned
  2027.          integer less than or equal to SLP_LIFETIME_MAXIMUM and greater
  2028.          than zero.
  2029.  
  2030.       pcSrvType
  2031.  
  2032.          The service type.  If pURL is a service:  URL, then this
  2033.          parameter is ignored.
  2034.  
  2035.       pcAttrs
  2036.  
  2037.          A comma separated list of attribute assignment expressions for
  2038.          the attributes of the advertisement.  Use empty string, "" for
  2039.          no attributes.
  2040.  
  2041.       fresh
  2042.  
  2043.          An SLPBoolean that is SLP_TRUE if the registration is new or
  2044.          SLP_FALSE if a reregistration.
  2045.  
  2046.       callback
  2047.  
  2048.          A callback to report the operation completion status.
  2049.  
  2050.       pvCookie
  2051.  
  2052.          Memory passed to the callback code from the client.  May be
  2053.          NULL.
  2054.  
  2055. 4.5.1.4. Returns
  2056.  
  2057.    If an error occurs in starting the operation, one of the SLPError
  2058.    codes is returned.
  2059.  
  2060. 4.5.2. SLPDereg
  2061.  
  2062. 4.5.2.1. Synopsis
  2063.  
  2064.  
  2065.    SLPError SLPDereg(SLPHandle  hSLP,
  2066.                      const char *pcURL,
  2067.                      SLPRegReport callback,
  2068.                      void *pvCookie);
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074. Kempf & Guttman              Informational                     [Page 37]
  2075.  
  2076. RFC 2614                  Service Location API                 June 1999
  2077.  
  2078.  
  2079. 4.5.2.2. Description
  2080.  
  2081.    Deregisters the advertisement for URL pcURL in all scopes where the
  2082.    service is registered and all language locales.  The deregistration
  2083.    is not just confined to the locale of the SLPHandle, it is in all
  2084.    locales.  The API library is required to perform the operation in all
  2085.    scopes obtained through configuration.
  2086.  
  2087. 4.5.2.3. Parameters
  2088.  
  2089.       hSLP
  2090.  
  2091.          The language specific SLPHandle to use for deregistering.
  2092.  
  2093.       pcURL
  2094.  
  2095.          The URL to deregister.  May not be the empty string.
  2096.  
  2097.       callback
  2098.  
  2099.          A callback to report the operation completion status.
  2100.  
  2101.       pvCookie
  2102.  
  2103.          Memory passed to the callback code from the client.  May be
  2104.          NULL.
  2105.  
  2106. 4.5.2.4. Returns
  2107.  
  2108.    If an error occurs in starting the operation, one of the SLPError
  2109.    codes is returned.
  2110.  
  2111. 4.5.3. SLPDelAttrs
  2112.  
  2113. 4.5.3.1. Synopsis
  2114.  
  2115.  
  2116.    SLPError SLPDelAttrs(SLPHandle   hSLP,
  2117.                         const char  *pcURL,
  2118.                         const char  *pcAttrs,
  2119.                         SLPRegReport callback,
  2120.                         void *pvCookie);
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Kempf & Guttman              Informational                     [Page 38]
  2131.  
  2132. RFC 2614                  Service Location API                 June 1999
  2133.  
  2134.  
  2135. 4.5.3.2. Description
  2136.  
  2137.    Delete the selected attributes in the locale of the SLPHandle.  The
  2138.    API library is required to perform the operation in all scopes
  2139.    obtained through configuration.
  2140.  
  2141. 4.5.3.3. Parameters
  2142.  
  2143.       hSLP
  2144.  
  2145.          The language specific SLPHandle to use for deleting attributes.
  2146.  
  2147.       pcURL
  2148.  
  2149.          The URL of the advertisement from which the attributes should
  2150.          be deleted.  May not be the empty string.
  2151.  
  2152.       pcAttrs
  2153.  
  2154.          A comma separated list of attribute ids for the attributes to
  2155.          deregister.  See Section 9.8 in [7] for a description of the
  2156.          list format.  May not be the empty string.
  2157.  
  2158.       callback
  2159.  
  2160.          A callback to report the operation completion status.
  2161.  
  2162.       pvCookie
  2163.  
  2164.          Memory passed to the callback code from the client.  May be
  2165.          NULL.
  2166.  
  2167. 4.5.3.4. Returns
  2168.  
  2169.    If an error occurs in starting the operation, one of the SLPError
  2170.    codes is returned.
  2171.  
  2172. 4.5.4. SLPFindSrvTypes
  2173.  
  2174. 4.5.4.1. Synopsis
  2175.  
  2176.  
  2177.    SLPError SLPFindSrvTypes(SLPHandle    hSLP,
  2178.                             const char  *pcNamingAuthority,
  2179.                             const char  *pcScopeList,
  2180.                             SLPSrvTypeCallback callback,
  2181.                             void *pvCookie);
  2182.  
  2183.  
  2184.  
  2185.  
  2186. Kempf & Guttman              Informational                     [Page 39]
  2187.  
  2188. RFC 2614                  Service Location API                 June 1999
  2189.  
  2190.  
  2191.    The SLPFindSrvType() function issues an SLP service type request for
  2192.    service types in the scopes indicated by the pcScopeList.  The
  2193.    results are returned through the callback parameter.  The service
  2194.    types are independent of language locale, but only for services
  2195.    registered in one of scopes and for the indicated naming authority.
  2196.  
  2197.    If the naming authority is "*", then results are returned for all
  2198.    naming authorities.  If the naming authority is the empty string,
  2199.    i.e.  "", then the default naming authority, "IANA", is used.  "IANA"
  2200.    is not a valid naming authority name, and it is a PARAMETER_BAD error
  2201.    to include it explicitly.
  2202.  
  2203.    The service type names are returned with the naming authority intact.
  2204.    If the naming authority is the default (i.e.  empty string) then it
  2205.    is omitted, as is the separating ".".  Service type names from URLs
  2206.    of the service:  scheme are returned with the "service:" prefix
  2207.    intact. [7] See [8] for more information on the syntax of service
  2208.    type names.
  2209.  
  2210. 4.5.4.2. Parameters
  2211.  
  2212.       hSLP
  2213.  
  2214.          The SLPHandle on which to search for types.
  2215.  
  2216.       pcNamingAuthority
  2217.  
  2218.          The naming authority to search.  Use "*" for all naming
  2219.          authorities and the empty string, "", for the default naming
  2220.          authority.
  2221.  
  2222.       pcScopeList
  2223.  
  2224.          A pointer to a char containing comma separated list of scope
  2225.          names to search for service types.  May not be the empty
  2226.          string, "".
  2227.  
  2228.       callback
  2229.  
  2230.          A callback function through which the results of the operation
  2231.          are reported.
  2232.  
  2233.       pvCookie
  2234.  
  2235.          Memory passed to the callback code from the client.  May be
  2236.          NULL.
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242. Kempf & Guttman              Informational                     [Page 40]
  2243.  
  2244. RFC 2614                  Service Location API                 June 1999
  2245.  
  2246.  
  2247. 4.5.4.3. Returns
  2248.  
  2249.    If an error occurs in starting the operation, one of the SLPError
  2250.    codes is returned.
  2251.  
  2252. 4.5.5. SLPFindSrvs
  2253.  
  2254. 4.5.5.1. Synopsis
  2255.  
  2256.  
  2257.    SLPError SLPFindSrvs(SLPHandle  hSLP,
  2258.                         const char *pcServiceType,
  2259.                         const char *pcScopeList,
  2260.                         const char *pcSearchFilter,
  2261.                         SLPSrvURLCallback callback,
  2262.                         void *pvCookie);
  2263.  
  2264.  
  2265. 4.5.5.2. Description
  2266.  
  2267.    Issue the query for services on the language specific SLPHandle and
  2268.    return the results through the callback.  The parameters determine
  2269.    the results
  2270.  
  2271. 4.5.5.3. Parameters
  2272.  
  2273.       hSLP
  2274.  
  2275.          The language specific SLPHandle on which to search for
  2276.          services.
  2277.  
  2278.       pcServiceType
  2279.  
  2280.          The Service Type String, including authority string if any, for
  2281.          the request, such as can be discovered using SLPSrvTypes().
  2282.          This could be, for example "service:printer:lpr" or
  2283.          "service:nfs".  May not be the empty string.
  2284.  
  2285.       pcScopeList
  2286.  
  2287.          A pointer to a char containing comma separated list of scope
  2288.          names.  May not be the empty string, "".
  2289.  
  2290.       pcSearchFilter
  2291.  
  2292.          A query formulated of attribute pattern matching expressions in
  2293.          the form of a LDAPv3 Search Filter, see [4].  If this filter
  2294.          is empty, i.e.  "", all services of the requested type in the
  2295.  
  2296.  
  2297.  
  2298. Kempf & Guttman              Informational                     [Page 41]
  2299.  
  2300. RFC 2614                  Service Location API                 June 1999
  2301.  
  2302.  
  2303.          specified scopes are returned.
  2304.  
  2305.       callback
  2306.  
  2307.          A callback function through which the results of the operation
  2308.          are reported.
  2309.  
  2310.       pvCookie
  2311.  
  2312.          Memory passed to the callback code from the client.  May be
  2313.          NULL.
  2314.  
  2315. 4.5.5.4. Returns
  2316.  
  2317.    If an error occurs in starting the operation, one of the SLPError
  2318.    codes is returned.
  2319.  
  2320. 4.5.6. SLPFindAttrs
  2321.  
  2322. 4.5.6.1. Synopsis
  2323.  
  2324.  
  2325.    SLPError SLPFindAttrs(SLPHandle   hSLP,
  2326.                          const char *pcURLOrServiceType,
  2327.                          const char *pcScopeList,
  2328.                          const char *pcAttrIds,
  2329.                          SLPAttrCallback callback,
  2330.                          void *pvCookie);
  2331.  
  2332.  
  2333. 4.5.6.2. Description
  2334.  
  2335.    This function returns service attributes matching the attribute ids
  2336.    for the indicated service URL or service type.  If pcURLOrServiceType
  2337.    is a service URL, the attribute information returned is for that
  2338.    particular advertisement in the language locale of the SLPHandle.
  2339.  
  2340.    If pcURLOrServiceType is a service type name (including naming
  2341.    authority if any), then the attributes for all advertisements of that
  2342.    service type are returned regardless of the language of registration.
  2343.    Results are returned through the callback.
  2344.  
  2345.    The result is filtered with an SLP attribute request filter string
  2346.    parameter, the syntax of which is described in [7].  If the filter
  2347.    string is the empty string, i.e.  "", all attributes are returned.
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354. Kempf & Guttman              Informational                     [Page 42]
  2355.  
  2356. RFC 2614                  Service Location API                 June 1999
  2357.  
  2358.  
  2359. 4.5.6.3. Parameters
  2360.  
  2361.       hSLP
  2362.  
  2363.          The language specific SLPHandle on which to search for
  2364.          attributes.
  2365.  
  2366.       pcURLOrServiceType
  2367.  
  2368.          The service URL or service type.  See [7] for URL and service
  2369.          type syntax.  May not be the empty string.
  2370.  
  2371.       pcScopeList
  2372.  
  2373.          A pointer to a char containing a comma separated list of scope
  2374.          names.  May not be the empty string, "".
  2375.  
  2376.       pcAttrIds
  2377.  
  2378.          The filter string indicating which attribute values to return.
  2379.          Use empty string, "", to indicate all values.  Wildcards
  2380.          matching all attribute ids having a particular prefix or suffix
  2381.          are also possible.  See [7] for the exact format of the filter
  2382.          string.
  2383.  
  2384.       callback
  2385.  
  2386.          A callback function through which the results of the operation
  2387.          are reported.
  2388.  
  2389.       pvCookie
  2390.  
  2391.          Memory passed to the callback code from the client.  May be
  2392.          NULL.
  2393.  
  2394. 4.5.6.4. Returns
  2395.  
  2396.    If an error occurs in starting the operation, one of the SLPError
  2397.    codes is returned.
  2398.  
  2399. 4.6. Miscellaneous Functions
  2400.  
  2401. 4.6.1. SLPGetRefreshInterval
  2402.  
  2403. 4.6.1.1. Synopsis
  2404.  
  2405.  
  2406.    unsigned short SLPGetRefreshInterval();
  2407.  
  2408.  
  2409.  
  2410. Kempf & Guttman              Informational                     [Page 43]
  2411.  
  2412. RFC 2614                  Service Location API                 June 1999
  2413.  
  2414.  
  2415. 4.6.1.2. Description
  2416.  
  2417.    Returns the maximum across all DAs of the min-refresh-interval
  2418.    attribute.  This value satisfies the advertised refresh interval
  2419.    bounds for all DAs, and, if used by the SA, assures that no refresh
  2420.    registration will be rejected.  If no DA advertises a min-refresh-
  2421.    interval attribute, a value of 0 is returned.
  2422.  
  2423. 4.6.1.3. Returns
  2424.  
  2425.    If no error, the maximum refresh interval value allowed by all DAs (a
  2426.    positive integer).  If no DA advertises a min-refresh-interval
  2427.    attribute, returns 0.  If an error occurs, returns an SLP error code.
  2428.  
  2429. 4.6.2. SLPFindScopes
  2430.  
  2431. 4.6.2.1. Synopsis
  2432.  
  2433.  
  2434.    SLPError SLPFindScopes(SLPHandle hSLP,
  2435.                           char** ppcScopeList);
  2436.  
  2437.  
  2438. 4.6.2.2. Description
  2439.  
  2440.    Sets ppcScopeList parameter to a pointer to a comma separated list
  2441.    including all available scope values.  The list of scopes comes from
  2442.    a variety of sources:  the configuration file's net.slp.useScopes
  2443.    property, unicast to DAs on the net.slp.DAAddresses property, DHCP,
  2444.    or through the DA discovery process.  If there is any order to the
  2445.     scopes, preferred scopes are listed before less desirable scopes.
  2446.    There is always at least one name in the list, the default scope,
  2447.    "DEFAULT".
  2448.  
  2449. 4.6.2.3. Parameters
  2450.  
  2451.       hSLP
  2452.  
  2453.          The SLPHandle on which to search for scopes.
  2454.  
  2455.       ppcScopeList
  2456.  
  2457.          A pointer to char pointer into which the buffer pointer is
  2458.          placed upon return.  The buffer is null terminated.  The memory
  2459.          should be freed by calling SLPFree().
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466. Kempf & Guttman              Informational                     [Page 44]
  2467.  
  2468. RFC 2614                  Service Location API                 June 1999
  2469.  
  2470.  
  2471. 4.6.2.4. Returns
  2472.  
  2473.    If no error occurs, returns SLP_OK, otherwise, the appropriate error
  2474.    code.
  2475.  
  2476. 4.6.3. SLPParseSrvURL
  2477.  
  2478. 4.6.3.1. Synopsis
  2479.  
  2480.  
  2481.    SLPError SLPParseSrvURL(char *pcSrvURL
  2482.                            SLPSrvURL** ppSrvURL);
  2483.  
  2484.  
  2485. 4.6.3.2. Description
  2486.  
  2487.    Parses the URL passed in as the argument into a service URL structure
  2488.    and returns it in the ppSrvURL pointer.  If a parse error occurs,
  2489.    returns SLP_PARSE_ERROR. The input buffer pcSrvURL is destructively
  2490.    modified during the parse and used to fill in the fields of the
  2491.    return structure.  The structure returned in ppSrvURL should be freed
  2492.    with SLPFreeURL().  If the URL has no service part, the s_pcSrvPart
  2493.    string is the empty string, "", i.e.  not NULL. If pcSrvURL is not a
  2494.    service:  URL, then the s_pcSrvType field in the returned data
  2495.    structure is the URL's scheme, which might not be the same as the
  2496.    service type under which the URL was registered.  If the transport is
  2497.    IP, the s_pcTransport field is the empty string.  If the transport is
  2498.    not IP or there is no port number, the s_iPort field is zero.
  2499.  
  2500. 4.6.3.3. Parameters
  2501.  
  2502.       pcSrvURL
  2503.  
  2504.          A pointer to a character buffer containing the null terminated
  2505.          URL string to parse.  It is destructively modified to produce
  2506.          the output structure.
  2507.  
  2508.       ppSrvURL
  2509.  
  2510.          A pointer to a pointer for the SLPSrvURL structure to receive
  2511.          the parsed URL. The memory should be freed by a call to
  2512.          SLPFree() when no longer needed.
  2513.  
  2514. 4.6.3.4. Returns
  2515.  
  2516.    If no error occurs, the return value is SLP_OK. Otherwise, the
  2517.    appropriate error code is returned.
  2518.  
  2519.  
  2520.  
  2521.  
  2522. Kempf & Guttman              Informational                     [Page 45]
  2523.  
  2524. RFC 2614                  Service Location API                 June 1999
  2525.  
  2526.  
  2527. 4.6.4. SLPEscape
  2528.  
  2529. 4.6.4.1. Synopsis
  2530.  
  2531.  
  2532.    SLPError SLPEscape(const char* pcInbuf,
  2533.                       char** ppcOutBuf,
  2534.                       SLPBoolean isTag);
  2535.  
  2536.  
  2537. 4.6.4.2. Description
  2538.  
  2539.    Process the input string in pcInbuf and escape any SLP reserved
  2540.    characters.  If the isTag parameter is SLPTrue, then look for bad tag
  2541.    characters and signal an error if any are found by returning the
  2542.    SLP_PARSE_ERROR code.  The results are put into a buffer allocated by
  2543.    the API library and returned in the ppcOutBuf parameter.  This buffer
  2544.    should be deallocated using SLPFree() when the memory is no longer
  2545.    needed.
  2546.  
  2547. 4.6.4.3. Parameters
  2548.  
  2549.       pcInbuf
  2550.  
  2551.          Pointer to he input buffer to process for escape characters.
  2552.  
  2553.       ppcOutBuf
  2554.  
  2555.          Pointer to a pointer for the output buffer with the SLP
  2556.          reserved characters escaped.  Must be freed using SLPFree()
  2557.          when the memory is no longer needed.
  2558.  
  2559.       isTag
  2560.  
  2561.          When true, the input buffer is checked for bad tag characters.
  2562.  
  2563. 4.6.4.4. Returns
  2564.  
  2565.    Return SLP_PARSE_ERROR if any characters are bad tag characters and
  2566.    the isTag flag is true, otherwise SLP_OK, or the appropriate error
  2567.    code if another error occurs.
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Kempf & Guttman              Informational                     [Page 46]
  2579.  
  2580. RFC 2614                  Service Location API                 June 1999
  2581.  
  2582.  
  2583. 4.6.5. SLPUnescape
  2584.  
  2585. 4.6.5.1. Synopsis
  2586.  
  2587.  
  2588.    SLPError SLPUnescape(const char* pcInbuf,
  2589.                         char** ppcOutBuf,
  2590.                         SLPBoolean isTag);
  2591.  
  2592.  
  2593. 4.6.5.2. Description
  2594.  
  2595.    Process the input string in pcInbuf and unescape any SLP reserved
  2596.    characters.  If the isTag parameter is SLPTrue, then look for bad tag
  2597.    characters and signal an error if any are found with the
  2598.    SLP_PARSE_ERROR code.  No transformation is performed if the input
  2599.    string is an opaque.  The results are put into a buffer allocated by
  2600.    the API library and returned in the ppcOutBuf parameter.  This buffer
  2601.    should be deallocated using SLPFree() when the memory is no longer
  2602.    needed.
  2603.  
  2604. 4.6.5.3. Parameters
  2605.  
  2606.       pcInbuf
  2607.  
  2608.          Pointer to he input buffer to process for escape characters.
  2609.  
  2610.       ppcOutBuf
  2611.  
  2612.          Pointer to a pointer for the output buffer with the SLP
  2613.          reserved characters escaped.  Must be freed using SLPFree()
  2614.          when the memory is no longer needed.
  2615.  
  2616.       isTag
  2617.  
  2618.          When true, the input buffer is checked for bad tag characters.
  2619.  
  2620. 4.6.5.4. Returns
  2621.  
  2622.    Return SLP_PARSE_ERROR if any characters are bad tag characters and
  2623.    the isTag flag is true, otherwise SLP_OK, or the appropriate error
  2624.    code if another error occurs.
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634. Kempf & Guttman              Informational                     [Page 47]
  2635.  
  2636. RFC 2614                  Service Location API                 June 1999
  2637.  
  2638.  
  2639. 4.6.6. SLPFree
  2640.  
  2641. 4.6.6.1. Synopsis
  2642.  
  2643.  
  2644.       void SLPFree(void* pvMem);
  2645.  
  2646.  
  2647. 4.6.6.2. Description
  2648.  
  2649.    Frees memory returned from SLPParseSrvURL(), SLPFindScopes(),
  2650.    SLPEscape(), and SLPUnescape().
  2651.  
  2652. 4.6.6.3. Parameters
  2653.  
  2654.       pvMem
  2655.  
  2656.          A pointer to the storage allocated by the SLPParseSrvURL(),
  2657.          SLPEscape(), SLPUnescape(), or SLPFindScopes() function.
  2658.          Ignored if NULL.
  2659.  
  2660. 4.6.7. SLPGetProperty
  2661.  
  2662. 4.6.7.1. Synopsis
  2663.  
  2664.  
  2665.    const char* SLPGetProperty(const char* pcName);
  2666.  
  2667.  
  2668. 4.6.7.2. Description
  2669.  
  2670.    Returns the value of the corresponding SLP property name.  The
  2671.    returned string is owned by the library and MUST NOT be freed.
  2672.  
  2673. 4.6.7.3. Parameters
  2674.  
  2675.       pcName
  2676.  
  2677.          Null terminated string with the property name, from
  2678.          Section 2.1.
  2679.  
  2680. 4.6.7.4. Returns
  2681.  
  2682.    If no error, returns a pointer to a character buffer containing the
  2683.    property value.  If the property was not set, returns the default
  2684.    value.  If an error occurs, returns NULL. The returned string MUST
  2685.    NOT be freed.
  2686.  
  2687.  
  2688.  
  2689.  
  2690. Kempf & Guttman              Informational                     [Page 48]
  2691.  
  2692. RFC 2614                  Service Location API                 June 1999
  2693.  
  2694.  
  2695. 4.6.8. SLPSetProperty
  2696.  
  2697. 4.6.8.1. Synopsis
  2698.  
  2699.  
  2700.       void SLPSetProperty(const char *pcName,
  2701.                           const char *pcValue);
  2702.  
  2703.  
  2704. 4.6.8.2. Description
  2705.  
  2706.    Sets the value of the SLP property to the new value.  The pcValue
  2707.    parameter should be the property value as a string.
  2708.  
  2709. 4.6.8.3. Parameters
  2710.  
  2711.       pcName
  2712.  
  2713.          Null terminated string with the property name, from
  2714.          Section 2.1.
  2715.  
  2716.       pcValue
  2717.  
  2718.          Null terminated string with the property value, in UTF-8
  2719.          character encoding.
  2720.  
  2721. 4.7. Implementation Notes
  2722.  
  2723. 4.7.1. Refreshing Registrations
  2724.  
  2725.    Clients indicate that they want URLs to be automatically refreshed by
  2726.    setting the usLifetime parameter in the SLPReg() function call to
  2727.    SLP_LIFETIME_MAXIMUM. This will cause the API implementation to
  2728.    refresh the URL before it times out.  Although using
  2729.    SLP_LIFETIME_MAXIMUM to designate automatic reregistration means that
  2730.    a transient URL can't be registered for the maximum lifetime, little
  2731.    hardship is likely to occur, since service URL lifetimes are measured
  2732.    in seconds and the client can simply use a lifetime of
  2733.    SLP_LIFETIME_MAXIMUM - 1 if a transient URL near the maximum lifetime
  2734.    is desired.  API implementations MUST provide this facility.
  2735.  
  2736. 4.7.2. Syntax for String Parameters
  2737.  
  2738.    Query strings, attribute registration lists, attribute deregistration
  2739.    lists, scope lists, and attribute selection lists follow the syntax
  2740.    described in [7] for the appropriate requests.  The API directly
  2741.    reflects the strings passed in from clients into protocol requests,
  2742.    and directly reflects out strings returned from protocol replies to
  2743.  
  2744.  
  2745.  
  2746. Kempf & Guttman              Informational                     [Page 49]
  2747.  
  2748. RFC 2614                  Service Location API                 June 1999
  2749.  
  2750.  
  2751.    clients.  As a consequence, clients are responsible for formatting
  2752.    request strings, including escaping and converting opaque values to
  2753.    escaped byte encoded strings.  Similarly, on output, clients are
  2754.    required to unescape strings and convert escaped string encoded
  2755.    opaques to binary.  The functions SLPEscape() and SLPUnescape() can
  2756.    be used for escaping SLP reserved characters, but perform no opaque
  2757.    processing.
  2758.  
  2759.    Opaque values consist of a character buffer containing a UTF-8-
  2760.    encoded string, the first characters of which are the nonUTF-8
  2761.    encoding '\ff'.  Subsequent characters are the escaped values for the
  2762.    original bytes in the opaque.  The escape convention is relatively
  2763.    simple.  An escape consists of a backslash followed by the two
  2764.    hexadecimal digits encoding the byte.  An example is '\2c' for the
  2765.    byte 0x2c.  Clients handle opaque processing themselves, since the
  2766.    algorithm is relatively simple and uniform.
  2767.  
  2768. 4.7.3. Client Side Syntax Checking
  2769.  
  2770.    Client side API implementations may do syntax checking of scope
  2771.    names, naming authority names, and service type names, but are not
  2772.    required to do so.  Since the C API is designed to be a thin layer
  2773.    over the protocol, some low memory SA implementations may find
  2774.    extensive syntax checking on the client side to be burdensome.  If
  2775.    syntax checking uncovers an error in a parameter, the
  2776.    SLP_PARAMETER_BAD error must be returned.  If any parameter is NULL
  2777.    and is required to be nonNULL, SLP_PARAMETER_BAD is returned.
  2778.  
  2779. 4.7.4. System Properties
  2780.  
  2781.    The system properties established in the configuration file are
  2782.    accessible through the SLPGetProperty() and SLPSetProperty()
  2783.    functions.  The SLPSetProperty() function only modifies properties in
  2784.    the running process, not in the configuration file.  Properties are
  2785.    global to the process, affecting all threads and all handles created
  2786.    with SLPOpen.  Errors are checked when the property is used and, as
  2787.    with parsing the configuration file, are logged.  Program execution
  2788.    continues without interruption by substituting the default for the
  2789.    erroneous parameter.  With the exception of net.slp.locale,
  2790.    net.slp.typeHint, and net.slp.maxResults, clients of the API should
  2791.    rarely be required to override these properties, since they reflect
  2792.    properties of the SLP network that are not of concern to individual
  2793.    agents.  If changes are required, system administrators should modify
  2794.    the configuration file.
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802. Kempf & Guttman              Informational                     [Page 50]
  2803.  
  2804. RFC 2614                  Service Location API                 June 1999
  2805.  
  2806.  
  2807. 4.7.5. Memory Management
  2808.  
  2809.    The only API functions returning memory specifically requiring
  2810.    deallocation on the part of the client are SLPParseSrvURL(),
  2811.    SLPFindScopes(), SLPEscape(), and SLPUnescape().  This memory should
  2812.    be freed using SLPFree() when no longer needed.  Character strings
  2813.    returned via the SLPGetProperty() function should NOT be freed, they
  2814.    are owned by the SLP library.
  2815.  
  2816.    Memory passed to callbacks belongs to the library and MUST NOT be
  2817.    retained by the client code.  Otherwise, crashes are possible.
  2818.    Clients are required to copy data out of the callback parameters.  No
  2819.    other use of the parameter memory in callback parameters is allowed.
  2820.  
  2821. 4.7.6. Asynchronous and Incremental Return Semantics
  2822.  
  2823.    If a handle parameter to an API function was opened asynchronously,
  2824.    API function calls on the handle check the other parameters, open the
  2825.    appropriate operation and return immediately.  In an error occurs in
  2826.    the process of starting the operation, an error code is returned.  If
  2827.    the handle parameter was opened synchronously, the API function call
  2828.    blocks until all results are available, and returns only after the
  2829.    results are reported through the callback function.  The return code
  2830.    indicates whether any errors occurred both starting and during the
  2831.    operation.
  2832.  
  2833.    The callback function is called whenever the API library has results
  2834.    to report.  The callback code is required to check the error code
  2835.    parameter before looking at the other parameters.  If the error code
  2836.    is not SLP_OK, the other parameters may be invalid.  The API library
  2837.    has the option of terminating any outstanding operation on which an
  2838.    error occurs.  The callback code can similarly indicate that the
  2839.    operation should be terminated by passing back SLP_FALSE. Callback
  2840.    functions are not permitted to recursively call into the API on the
  2841.    same SLPHandle.  If an attempt is made to recursively call into the
  2842.    API, the API function returns SLP_HANDLE_IN_USE. Prohibiting
  2843.    recursive callbacks on the same handle simplifies implementation of
  2844.    thread safe code, since locks held on the handle will not be in place
  2845.    during a second outcall on the handle.  On the other hand, it means
  2846.    that handle creation should be fairly lightweight so a client program
  2847.    can easily support multiple outstanding calls.
  2848.  
  2849.    The total number of results received can be controlled by setting the
  2850.    net.slp.maxResults parameter.
  2851.  
  2852.    On the last call to a callback, whether asynchronous or synchronous,
  2853.    the status code passed to the callback has value SLP_LAST_CALL. There
  2854.    are four reasons why the call can terminate:
  2855.  
  2856.  
  2857.  
  2858. Kempf & Guttman              Informational                     [Page 51]
  2859.  
  2860. RFC 2614                  Service Location API                 June 1999
  2861.  
  2862.  
  2863.       DA reply received
  2864.  
  2865.          A reply from a DA has been received and therefore nothing more
  2866.          is expected.
  2867.  
  2868.       Multicast terminated
  2869.  
  2870.          The multicast convergence time has elapsed and the API library
  2871.          multicast code is giving up.
  2872.  
  2873.       Multicast null results
  2874.  
  2875.          Nothing new has been received during multicast for a while and
  2876.          the API library multicast code is giving up on that (as an
  2877.          optimization).
  2878.  
  2879.       Maximum results
  2880.  
  2881.          The user has set the net.slp.maxResults property and that
  2882.          number of replies has been collected and returned
  2883.  
  2884. 4.8. Example
  2885.  
  2886.    This example illustrates how to discover a mailbox.
  2887.  
  2888.    A POP3 server registers itself with the SLP framework.  The
  2889.    attributes it registers are "USER", a list of all users whose mail is
  2890.    available through the POP3 server.
  2891.  
  2892.    The POP3 server code is the following:
  2893.  
  2894.    SLPHandle slph;
  2895.    SLPRegReport errCallback = POPRegErrCallback;
  2896.  
  2897.    /* Create an English SLPHandle, asynchronous processing. */
  2898.  
  2899.    SLPError err = SLPOpen("en", SLP_TRUE, &slph);
  2900.  
  2901.    if( err != SLP_OK ) {
  2902.  
  2903.      /* Deal with error. */
  2904.  
  2905.    }
  2906.  
  2907.    /* Create the service: URL and attribute parameters. */
  2908.  
  2909.    const char* surl = "service:pop3://mail.netsurf.de"; /* the URL */
  2910.  
  2911.  
  2912.  
  2913.  
  2914. Kempf & Guttman              Informational                     [Page 52]
  2915.  
  2916. RFC 2614                  Service Location API                 June 1999
  2917.  
  2918.  
  2919.    const char *pcAttrs = "(user=zaphod,trillian,roger,marvin)"
  2920.  
  2921.    /* Perform the registration. */
  2922.  
  2923.    err = SLPReg(slph,
  2924.                 surl,
  2925.                 SLP_LIFETIME_DEFAULT,
  2926.                 ppcAttrs,
  2927.                 errCallback,
  2928.                 NULL);
  2929.  
  2930.    if (err != SLP_OK ) {
  2931.  
  2932.       /*Deal with error.*/
  2933.  
  2934.    }
  2935.  
  2936.  
  2937.    The errCallback reports any errors:
  2938.  
  2939.    void
  2940.    POPRegErrCallback(SLPHandle hSLP,
  2941.                      SLPError errCode,
  2942.                      unsigned short usLifetime,
  2943.                      void* pvCookie) {
  2944.  
  2945.       if( errCode != SLP_OK ) {
  2946.  
  2947.         /* Report error through a dialog, message, etc. */
  2948.  
  2949.       }
  2950.  
  2951.       /*Use lifetime interval to update periodically. */
  2952.  
  2953.     }
  2954.  
  2955.    The POP3 client locates the server for the user with the following
  2956.    code:
  2957.  
  2958.    /*
  2959.     * The client calls SLPOpen(), exactly as above.
  2960.     */
  2961.  
  2962.    const char *pcSrvType   = "service:pop3"; /* the service type  */
  2963.    const char *pcScopeList = "default";      /* the scope         */
  2964.    const char *pcFilter    = "(user=roger)"; /* the search filter */
  2965.    SLPSrvURLCallback srvCallback =           /* the callback      */
  2966.                                    POPSrvURLCallback;
  2967.  
  2968.  
  2969.  
  2970. Kempf & Guttman              Informational                     [Page 53]
  2971.  
  2972. RFC 2614                  Service Location API                 June 1999
  2973.  
  2974.  
  2975.    err = SLPFindSrvs(slph,
  2976.                      pcSrvType, pcScopeList, pcFilter,
  2977.                      srvCallback, NULL);
  2978.  
  2979.    if( err != SLP_OK ) {
  2980.  
  2981.        /* Deal with error. */
  2982.  
  2983.    }
  2984.  
  2985.    Within the callback, the client code can use the returned POP
  2986.    service:
  2987.  
  2988.   SLPBoolean
  2989.   POPSrvURLCallback(SLPHandle hSLP,
  2990.                     const char* pcSrvURL,
  2991.                     unsigned short sLifetime,
  2992.                     SLPError errCode,
  2993.                     void* pvCookie) {
  2994.  
  2995.      if( errCode != SLP_OK ) {
  2996.  
  2997.         /* Deal with error. */
  2998.  
  2999.      }
  3000.  
  3001.      SLPSrvURL* pSrvURL;
  3002.  
  3003.      errCode = SLPParseSrvURL(pcSrvURL, &pSrvURL);
  3004.  
  3005.      if (err != SLP_OK ) {
  3006.  
  3007.        /* Deal with error. */
  3008.  
  3009.      } else {
  3010.  
  3011.        /* get the server's address */
  3012.  
  3013.        struct hostent *phe = gethostbyname(pSrvURL.s_pcHost);
  3014.  
  3015.        /* use hostname in pSrvURL to connect to the POP3 server
  3016.         *     . . .
  3017.         */
  3018.  
  3019.        SLPFreeSrvURL((void*)pSrvURL);  /* Free the pSrvURL storage */
  3020.      }
  3021.  
  3022.      return SLP_FALSE;                 /* Done! */
  3023.  
  3024.  
  3025.  
  3026. Kempf & Guttman              Informational                     [Page 54]
  3027.  
  3028. RFC 2614                  Service Location API                 June 1999
  3029.  
  3030.  
  3031.    }
  3032.  
  3033.    A client that wanted to discover all the users receiving mail at the
  3034.    server uses with the following query:
  3035.  
  3036.    /*
  3037.     * The client calls SLPOpen(), exactly as above. We assume the
  3038.     * service: URL was retrieved into surl.
  3039.     */
  3040.  
  3041.    const char *pcScopeList = "default";      /* the scope            */
  3042.    const char *pcAttrFilter    = "use";      /* the attribute filter */
  3043.    SLPAttrCallback attrCallBack =            /* the callback         */
  3044.                                   POPUsersCallback
  3045.  
  3046.  
  3047.    err =
  3048.      SLPFindAttrs(slph,
  3049.                   surl,
  3050.                   pcScopeList, pcAttrFilter,
  3051.                   attrCallBack, NULL);
  3052.  
  3053.    if( err != SLP_OK ) {
  3054.  
  3055.         /* Deal with error. */
  3056.  
  3057.    }
  3058.  
  3059.    The callback processes the attributes:
  3060.  
  3061.    SLPBoolean
  3062.    POPUsersCallback(const char* pcAttrList,
  3063.                     SLPError errCode,
  3064.                     void* pvCookie) {
  3065.  
  3066.      if( errCode != SLP_OK ) {
  3067.  
  3068.        /* Deal with error. */
  3069.  
  3070.      } else {
  3071.  
  3072.        /* Parse attributes. */
  3073.  
  3074.      }
  3075.  
  3076.      return SLP_FALSE;  /* Done! */
  3077.  
  3078.    }
  3079.  
  3080.  
  3081.  
  3082. Kempf & Guttman              Informational                     [Page 55]
  3083.  
  3084. RFC 2614                  Service Location API                 June 1999
  3085.  
  3086.  
  3087. 5. Java Language Binding
  3088.  
  3089. 5.1. Introduction
  3090.  
  3091.    The Java API is designed to model the various SLP entities in classes
  3092.    and objects.  APIs are provided for SA, UA, and service type template
  3093.    access capabilities.  The ServiceLocationManager class contains
  3094.    methods that return instances of objects implementing SA and UA
  3095.    capability.  Each of these is modeled in an interface.  The Locator
  3096.    interface provides UA capability and the Advertiser interface
  3097.    provides SA capability.  The TemplateRegistry abstract class contains
  3098.    methods that return objects for template introspection and attribute
  3099.    type checking.  The ServiceURL, ServiceType, and
  3100.    ServiceLocationAttribute classes model the basic SLP concepts.  A
  3101.    concrete subclass instance of TemplateRegistry is returned by a class
  3102.    method.
  3103.  
  3104.    All SLP classes and interfaces are located within a single package.
  3105.    The package name should begin with the name of the implementation and
  3106.    conclude with the suffix "slp".  Thus, the name for a hypothetical
  3107.    implementation from the University of Michigan would look like:
  3108.  
  3109.                              edu.umich.slp
  3110.  
  3111.    This follows the Java convention of prepending the top level DNS
  3112.    domain name for the organization implementing the package onto the
  3113.    organization's name and using that as the package prefix.
  3114.  
  3115. 5.2. Exceptions and Errors
  3116.  
  3117.    Most parameters to API methods are required to be non-null.  The API
  3118.    description indicates if a null parameter is acceptable, or if other
  3119.    restrictions constrain a parameter.  When parameters are checked for
  3120.    validity (such as not being null) or their syntax is checked, an
  3121.    error results in the RuntimeException subclass
  3122.    IllegalArgumentException being thrown.  Clients of the API are
  3123.    reminded that IllegalArgumentException, derived from
  3124.    RuntimeException, is unchecked by the compiler.  Clients should thus
  3125.    be careful to include try/catch blocks for it if the relevant
  3126.    parameters could be erroneous.
  3127.  
  3128.    Standard Java practice is to encode every exceptional condition as a
  3129.    separate subclass of Exception.  Because of the relatively high cost
  3130.    in code size of Exception subclasses, the API contains only a single
  3131.    Exception subclass with different conditions being determined by an
  3132.    integer error code property.  A subset, appropriate to Java, of the
  3133.    error codes described in Section 3 are available as constants on the
  3134.    ServiceLocationException class.  The subset excludes error codes such
  3135.  
  3136.  
  3137.  
  3138. Kempf & Guttman              Informational                     [Page 56]
  3139.  
  3140. RFC 2614                  Service Location API                 June 1999
  3141.  
  3142.  
  3143.    as MEMORY_ALLOC_FAILED.
  3144.  
  3145. 5.2.1. Class ServiceLocationException
  3146.  
  3147. 5.2.1.1. Synopsis
  3148.  
  3149.  
  3150.    public class ServiceLocationException
  3151.    extends Exception
  3152.  
  3153.  
  3154. 5.2.1.2. Description
  3155.  
  3156.    The ServiceLocationException class is thrown by all methods when
  3157.    exceptional conditions occur in the SLP framework.  The error code
  3158.    property determines the exact nature of the condition, and an
  3159.    optional message may provide more information.
  3160.  
  3161. 5.2.1.3. Fields
  3162.  
  3163.  
  3164.    public static final short LANGUAGE_NOT_SUPPORTED = 1
  3165.    public static final short PARSE_ERROR = 2
  3166.    public static final short INVALID_REGISTRATION = 3
  3167.    public static final short SCOPE_NOT_SUPPORTED = 4
  3168.    public static final short AUTHENTICATION_ABSENT = 6
  3169.    public static final short AUTHENTICATION_FAILED = 7
  3170.    public static final short INVALID_UPDATE = 13
  3171.    public static final short REFRESH_REJECTED = 15
  3172.    public static final short NOT_IMPLEMENTED = 16
  3173.    public static final short NETWORK_INIT_FAILED 17
  3174.    public static final short NETWORK_TIMED_OUT = 18
  3175.    public static final short NETWORK_ERROR = 19
  3176.    public static final short INTERNAL_SYSTEM_ERROR = 20
  3177.    public static final short TYPE_ERROR = 21
  3178.    public static final short BUFFER_OVERFLOW = 22
  3179.  
  3180.  
  3181. 5.2.1.4. Instance Methods
  3182.  
  3183.  
  3184.    public short getErrorCode()
  3185.  
  3186.  
  3187.    Return the error code.  The error code takes on one of the static
  3188.    field values.
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194. Kempf & Guttman              Informational                     [Page 57]
  3195.  
  3196. RFC 2614                  Service Location API                 June 1999
  3197.  
  3198.  
  3199. 5.3. Basic Data Structures
  3200.  
  3201. 5.3.1. Interface ServiceLocationEnumeration
  3202.  
  3203.  
  3204.    public interface ServiceLocationEnumeration
  3205.     extends Enumeration
  3206.  
  3207.  
  3208. 5.3.1.1. Description
  3209.  
  3210.    The ServiceLocationEnumeration class is the return type for all
  3211.    Locator SLP operations.  The Java API library may implement this
  3212.    class to block until results are available from the SLP operation, so
  3213.    that the client can achieve asynchronous operation by retrieving
  3214.    results from the enumeration in a separate thread.  Clients use the
  3215.    superclass nextElement() method if they are unconcerned with SLP
  3216.    exceptions.
  3217.  
  3218. 5.3.1.2. Instance Methods
  3219.  
  3220.  
  3221.    public abstract Object next() throws ServiceLocationException
  3222.  
  3223.    Return the next value or block until it becomes available.
  3224.  
  3225.    Throws:
  3226.  
  3227.       ServiceLocationException
  3228.  
  3229.          Thrown if the SLP operation encounters an error.
  3230.  
  3231.       NoSuchElementException
  3232.  
  3233.          If there are no more elements to return.
  3234.  
  3235.  
  3236. 5.3.2. Class ServiceLocationAttribute
  3237.  
  3238. 5.3.2.1. Synopsis
  3239.  
  3240.  
  3241.    public class ServiceLocationAttribute
  3242.      extends Object implements Serializable
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250. Kempf & Guttman              Informational                     [Page 58]
  3251.  
  3252. RFC 2614                  Service Location API                 June 1999
  3253.  
  3254.  
  3255. 5.3.2.2. Description
  3256.  
  3257.    The ServiceLocationAttribute class models SLP attributes.  Instances
  3258.    of this class are returned by Locator.findAttributes() and are
  3259.    communicated along with register/deregister requests.
  3260.  
  3261. 5.3.2.3. Constructors
  3262.  
  3263.  
  3264.    public ServiceLocationAttribute(String id,Vector values)
  3265.  
  3266.  
  3267.    Construct a service location attribute.  Errors in the id or values
  3268.    vector result in an IllegalArgumentException.
  3269.  
  3270.    Parameters:
  3271.  
  3272.       id
  3273.  
  3274.          The attribute name.  The String can consist of any Unicode
  3275.          character.
  3276.  
  3277.       values
  3278.  
  3279.          A Vector of one or more attribute values.  Vector contents
  3280.          must be uniform in type and one of Integer, String, Boolean,
  3281.          or byte[].  If the attribute is a keyword attribute, then the
  3282.          parameter should be null.  String values can consist of any
  3283.          Unicode character.
  3284.  
  3285.  
  3286. 5.3.2.4. Class Methods
  3287.  
  3288.  
  3289.    public static String escapeId(String id)
  3290.  
  3291.  
  3292.    Returns an escaped version of the id parameter, suitable for
  3293.    inclusion in a query.  Any reserved characters as specified in [7]
  3294.    are escaped using UTF-8 encoding.  If any characters in the tag are
  3295.    illegal, throws IllegalArgumentException.
  3296.  
  3297.    Parameters:
  3298.  
  3299.       id
  3300.  
  3301.          The attribute id to escape.  ServiceLocationException is thrown
  3302.          if any characters are illegal for an attribute tag.
  3303.  
  3304.  
  3305.  
  3306. Kempf & Guttman              Informational                     [Page 59]
  3307.  
  3308. RFC 2614                  Service Location API                 June 1999
  3309.  
  3310.  
  3311.    public static String escapeValue(Object value)
  3312.  
  3313.  
  3314.    Returns a String containing the escaped value parameter as a string,
  3315.    suitable for inclusion in a query.  If the parameter is a string,
  3316.    any reserved characters as specified in [7] are escaped using UTF-8
  3317.    encoding.  If the parameter is a byte array, then the escaped string
  3318.    begins with the nonUTF-8 sequence `\ff` and the rest of the string
  3319.    consists of the escaped bytes, which is the encoding for opaques.
  3320.    If the value parameter is a Boolean or Integer, then the returned
  3321.    string contains the object converted into a string.  If the value
  3322.    is any type other than String, Integer, Boolean or byte[], an
  3323.    IllegalArgumentException is thrown.
  3324.  
  3325.    Parameters:
  3326.  
  3327.       value
  3328.  
  3329.          The attribute value to be converted into a string and escaped.
  3330.  
  3331.  
  3332. 5.3.2.5. Instance Methods
  3333.  
  3334.  
  3335.    public Vector getValues()
  3336.  
  3337.  
  3338.    Returns a cloned vector of attribute values, or null if the attribute
  3339.    is a keyword attribute.  If the attribute is single-valued, then the
  3340.    vector contains only one object.
  3341.  
  3342.  
  3343.    public String getId()
  3344.  
  3345.  
  3346.    Returns the attribute's name.
  3347.  
  3348.  
  3349.    public boolean equals(Object o)
  3350.  
  3351.  
  3352.    Overrides Object.equals().  Two attributes are equal if their
  3353.    identifiers are equal and their value vectors contain the same number
  3354.    of equal values as determined by the Object equals() method.  Values
  3355.    having byte[] type are equal if the contents of all byte arrays in
  3356.    both attribute vectors match.  Note that the SLP string matching
  3357.    algorithm [7] MUST NOT be used for comparing attribute identifiers or
  3358.    string values.
  3359.  
  3360.  
  3361.  
  3362. Kempf & Guttman              Informational                     [Page 60]
  3363.  
  3364. RFC 2614                  Service Location API                 June 1999
  3365.  
  3366.  
  3367.    public String toString()
  3368.  
  3369.  
  3370.    Overrides Object.toString().  The string returned contains a
  3371.    formatted representation of the attribute, giving the attribute's
  3372.    id, values, and the Java type of the values.  The returned string is
  3373.    suitable for debugging purposes, but is not in SLP wire format.
  3374.  
  3375.  
  3376.    public int hashCode()
  3377.  
  3378.  
  3379.    Overrides Object.hashCode().  Hashes on the attribute's identifier.
  3380.  
  3381.  
  3382. 5.3.3. Class ServiceType
  3383.  
  3384. 5.3.3.1. Synopsis
  3385.  
  3386.  
  3387.    public class ServiceType extends Object implements Serializable
  3388.  
  3389.  
  3390. 5.3.3.2. Description
  3391.  
  3392.    The ServiceType object models the SLP service type.  It parses a
  3393.    string based service type specifier into its various components, and
  3394.    contains property accessors to return the components.  URL schemes,
  3395.    protocol service types, and abstract service types are all handled.
  3396.  
  3397. 5.3.3.3. Constructors
  3398.  
  3399.  
  3400.    public ServiceType(String type)
  3401.  
  3402.  
  3403.    Construct a service type object from the service type specifier.
  3404.    Throws IllegalArgumentException if the type name is syntactically
  3405.    incorrect.
  3406.  
  3407.    Parameters:
  3408.  
  3409.       type
  3410.  
  3411.          The service type name as a String.  If the service type is from
  3412.          a service:  URL, the "service:" prefix must be intact.
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418. Kempf & Guttman              Informational                     [Page 61]
  3419.  
  3420. RFC 2614                  Service Location API                 June 1999
  3421.  
  3422.  
  3423. 5.3.3.4. Methods
  3424.  
  3425.  
  3426.    public boolean isServiceURL()
  3427.  
  3428.  
  3429.    Returns true if the type name contains the "service:" prefix.
  3430.  
  3431.  
  3432.    public boolean isAbstractType()
  3433.  
  3434.  
  3435.    Returns true if the type name is for an abstract type.
  3436.  
  3437.  
  3438.    public boolean isNADefault()
  3439.  
  3440.    Returns true if the naming authority is the default, i.e.  is the
  3441.    empty string.
  3442.  
  3443.  
  3444.    public String getConcreteTypeName()
  3445.  
  3446.  
  3447.    Returns the concrete type name in an abstract type, or the empty
  3448.    string if the service type is not abstract.  For example, if the type
  3449.    name is "service:printing:ipp", the method returns "ipp".  If the
  3450.    type name is "service:ftp", the method returns "".
  3451.  
  3452.  
  3453.    public String getPrincipleTypeName()
  3454.  
  3455.  
  3456.    Returns the abstract type name for an abstract type, the protocol
  3457.    name in a protocol type, or the URL scheme for a generic URL. For
  3458.    example, in the abstract type name "service:printing:ipp", the method
  3459.    returns "printing".  In the protocol type name "service:ftp", the
  3460.    method returns "ftp".
  3461.  
  3462.  
  3463.    public String getAbstractTypeName()
  3464.  
  3465.  
  3466.    If the type is an abstract type, returns the fully formatted abstract
  3467.    type name including the "service:" and naming authority but without
  3468.    the concrete type name or intervening colon.  If not an abstract
  3469.    type, returns the empty string.  For example, in the abstract type
  3470.    name "service:printing:ipp", the method returns "service:printing".
  3471.  
  3472.  
  3473.  
  3474. Kempf & Guttman              Informational                     [Page 62]
  3475.  
  3476. RFC 2614                  Service Location API                 June 1999
  3477.  
  3478.  
  3479.    public String getNamingAuthority()
  3480.  
  3481.  
  3482.    Return the naming authority name, or the empty string if the naming
  3483.    authority is the default.
  3484.  
  3485.  
  3486.    public boolean equals(Object obj)
  3487.  
  3488.  
  3489.    Overrides Object.equals().  The two objects are equal if they are
  3490.    both ServiceType objects and the components of both are equal.
  3491.  
  3492.  
  3493.    public String toString()
  3494.  
  3495.  
  3496.    Returns the fully formatted type name, including the "service:" if
  3497.    the type was originally from a service:  URL.
  3498.  
  3499.  
  3500.    public int hashCode()
  3501.  
  3502.  
  3503.    Overrides Object.hashCode().  Hashes on the string value of the
  3504.    "service" prefix, naming authority, if any, abstract and concrete
  3505.    type names for abstract types, protocol type name for protocol types,
  3506.    and URL scheme for generic URLs.
  3507.  
  3508.  
  3509. 5.3.4. Class ServiceURL
  3510.  
  3511. 5.3.4.1. Synopsis
  3512.  
  3513.  
  3514.    public class ServiceURL extends Object implements Serializable
  3515.  
  3516.  
  3517. 5.3.4.2. Description
  3518.  
  3519.    The ServiceURL object models the advertised SLP service URL. It can
  3520.    be either a service:  URL or a regular URL. These objects are
  3521.    returned from service lookup requests, and describe the registered
  3522.    services.  This class should be a subclass of java.net.URL but can't
  3523.    since that class is final.
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530. Kempf & Guttman              Informational                     [Page 63]
  3531.  
  3532. RFC 2614                  Service Location API                 June 1999
  3533.  
  3534.  
  3535. 5.3.4.3. Class Variables
  3536.  
  3537.  
  3538.    public static final int NO_PORT = 0
  3539.  
  3540.  
  3541.    Indicates that no port information is required or was returned for
  3542.    this URL.
  3543.  
  3544.  
  3545.    public static final int LIFETIME_NONE = 0
  3546.  
  3547.  
  3548.    Indicates that the URL has a zero lifetime.  This value is never
  3549.    returned from the API, but can be used to create a ServiceURL object
  3550.    to deregister, delete attributes, or find attributes.
  3551.  
  3552.  
  3553.    public static final int LIFETIME_DEFAULT = 10800
  3554.  
  3555.  
  3556.    The default URL lifetime (3 hours) in seconds.
  3557.  
  3558.  
  3559.    public static final int LIFETIME_MAXIMUM = 65535
  3560.  
  3561.  
  3562.    The maximum URL lifetime (about 18 hours) in seconds.
  3563.  
  3564.  
  3565.    public static final int LIFETIME_PERMANENT = -1
  3566.  
  3567.  
  3568.    Indicates that the API implementation should continuously re-register
  3569.    the URL until the application exits.
  3570.  
  3571.  
  3572. 5.3.4.4. Constructors
  3573.  
  3574.  
  3575.    public ServiceURL(String URL,int lifetime)
  3576.  
  3577.  
  3578.    Construct a service URL object having the specified lifetime.
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586. Kempf & Guttman              Informational                     [Page 64]
  3587.  
  3588. RFC 2614                  Service Location API                 June 1999
  3589.  
  3590.  
  3591.    Parameters:
  3592.  
  3593.       URL
  3594.  
  3595.          The URL as a string.  Must be either a service:  URL or a valid
  3596.          generic URL according to RFC 2396 [2].
  3597.  
  3598.       lifetime
  3599.  
  3600.          The service advertisement lifetime in seconds.  This value may
  3601.          be between LIFETIME_NONE and LIFETIME_MAXIMUM.
  3602.  
  3603.  
  3604. 5.3.4.5. Methods
  3605.  
  3606.  
  3607.    public ServiceType getServiceType()
  3608.  
  3609.  
  3610.    Returns the service type object representing the service type name of
  3611.    the URL.
  3612.  
  3613.  
  3614.   public final void setServiceType(ServiceType type)
  3615.   throws ServiceLocationException
  3616.  
  3617.  
  3618.    Set the service type name to the object.  Ignored if the URL is a
  3619.    service:  URL.
  3620.  
  3621.    Parameters:
  3622.  
  3623.       type
  3624.  
  3625.          The service type object.
  3626.  
  3627.  
  3628.    public String getTransport()
  3629.  
  3630.  
  3631.    Get the network layer transport identifier.  If the transport is IP,
  3632.    an empty string, "", is returned.
  3633.  
  3634.  
  3635.    public String getHost()
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642. Kempf & Guttman              Informational                     [Page 65]
  3643.  
  3644. RFC 2614                  Service Location API                 June 1999
  3645.  
  3646.  
  3647.    Returns the host identifier.  For IP, this will be the machine name
  3648.    or IP address.
  3649.  
  3650.  
  3651.    public int getPort()
  3652.  
  3653.  
  3654.    Returns the port number, if any.  For non-IP transports, always
  3655.    returns NO_PORT.
  3656.  
  3657.  
  3658.    public String getURLPath()
  3659.  
  3660.  
  3661.    Returns the URL path description, if any.
  3662.  
  3663.  
  3664.    public int getLifetime()
  3665.  
  3666.  
  3667.    Returns the service advertisement lifetime.  This will be a positive
  3668.    int between LIFETIME_NONE and LIFETIME_MAXIMUM.
  3669.  
  3670.  
  3671.    public boolean equals(Object obj)
  3672.  
  3673.  
  3674.    Compares the object to the ServiceURL and returns true if the two are
  3675.    the same.  Two ServiceURL objects are equal if their current service
  3676.    types match and they have the same host, port, transport, and URL
  3677.    path.
  3678.  
  3679.  
  3680.    public String toString()
  3681.  
  3682.  
  3683.    Returns a formatted string with the URL. Overrides Object.toString().
  3684.    The returned URL has the original service type or URL scheme, not the
  3685.    current service type.
  3686.  
  3687.  
  3688.    public int hashCode()
  3689.  
  3690.  
  3691.    Overrides Object.hashCode().  Hashes on the current service type,
  3692.    transport, host, port, and URL part.
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698. Kempf & Guttman              Informational                     [Page 66]
  3699.  
  3700. RFC 2614                  Service Location API                 June 1999
  3701.  
  3702.  
  3703. 5.4. SLP Access Interfaces
  3704.  
  3705. 5.4.1. Interface Advertiser
  3706.  
  3707. 5.4.1.1. Synopsis
  3708.  
  3709.  
  3710.    public interface Advertiser
  3711.  
  3712.  
  3713. 5.4.1.2. Description
  3714.  
  3715.    The Advertiser is the SA interface, allowing clients to register new
  3716.    service instances with SLP, to change the attributes of existing
  3717.    services, and to deregister service instances.  New registrations and
  3718.    modifications of attributes are made in the language locale with
  3719.    which the Advertiser was created, deregistrations of service
  3720.    instances are made for all locales.
  3721.  
  3722. 5.4.1.3. Instance Methods
  3723.  
  3724.  
  3725.    public abstract Locale getLocale()
  3726.  
  3727.  
  3728.    Return the language locale with which this object was created.
  3729.  
  3730.  
  3731.    public abstract void register(ServiceURL URL,
  3732.                                  Vector attributes)
  3733.    throws ServiceLocationException
  3734.  
  3735.    Register a new service with SLP having the given attributes.
  3736.  
  3737.    The API library is required to perform the operation in all
  3738.    scopes obtained through configuration.
  3739.  
  3740.  
  3741.    Parameters:
  3742.  
  3743.       URL
  3744.  
  3745.          The URL for the service.
  3746.  
  3747.       attributes
  3748.  
  3749.          A vector of ServiceLocationAttribute objects describing the
  3750.          service.
  3751.  
  3752.  
  3753.  
  3754. Kempf & Guttman              Informational                     [Page 67]
  3755.  
  3756. RFC 2614                  Service Location API                 June 1999
  3757.  
  3758.  
  3759.    public abstract void deregister(ServiceURL URL)
  3760.    throws ServiceLocationException
  3761.  
  3762.  
  3763.    Deregister a service from the SLP framework.  This has the effect
  3764.    of deregistering the service from every language locale.  The API
  3765.    library is required to perform the operation in all scopes obtained
  3766.    through configuration.
  3767.  
  3768.    Parameters:
  3769.  
  3770.       URL
  3771.  
  3772.          The URL for the service.
  3773.  
  3774.  
  3775.    public abstract void
  3776.    addAttributes(ServiceURL URL,
  3777.                  Vector attributes)
  3778.    throws ServiceLocationException
  3779.  
  3780.  
  3781.    Update the registration by adding the given attributes.  The API
  3782.    library is required to perform the operation in all scopes obtained
  3783.    through configuration.
  3784.  
  3785.    Parameters:
  3786.  
  3787.       URL
  3788.  
  3789.          The URL for the service.
  3790.  
  3791.       attributes
  3792.  
  3793.          A Vector of ServiceLocationAttribute objects to add to the
  3794.          existing registration.  Use an empty vector to update the URL
  3795.          alone.  May not be null.
  3796.  
  3797.  
  3798.    public abstract void
  3799.    deleteAttributes(ServiceURL URL,
  3800.                     Vector attributeIds)
  3801.    throws ServiceLocationException
  3802.  
  3803.  
  3804.    Delete the attributes from a URL for the locale with which the
  3805.    Advertiser was created.  The API library is required to perform the
  3806.    operation in all scopes obtained through configuration.
  3807.  
  3808.  
  3809.  
  3810. Kempf & Guttman              Informational                     [Page 68]
  3811.  
  3812. RFC 2614                  Service Location API                 June 1999
  3813.  
  3814.  
  3815.    Parameters:
  3816.  
  3817.       URL
  3818.  
  3819.          The URL for the service.
  3820.  
  3821.       attributeIds
  3822.  
  3823.          A vector of Strings indicating the ids of the attributes
  3824.          to remove.  The strings may be attribute ids or they
  3825.          may be wildcard patterns to match ids.  See [7] for the
  3826.          syntax of wildcard patterns.  The strings may include SLP
  3827.          reserved characters, they will be escaped by the API before
  3828.          transmission.  May not be the empty vector or null.
  3829.  
  3830.  
  3831. 5.4.2. Interface Locator
  3832.  
  3833. 5.4.2.1. Synopsis
  3834.  
  3835.  
  3836.    public interface Locator
  3837.  
  3838.  
  3839. 5.4.2.2. Description
  3840.  
  3841.    The Locator is the UA interface, allowing clients to query the SLP
  3842.    framework about existing service types, services instances, and about
  3843.    the attributes of an existing service instance or service type.
  3844.    Queries for services and attributes are made in the locale with which
  3845.    the Locator was created, queries for service types are independent of
  3846.    locale.
  3847.  
  3848. 5.4.2.3. Instance Methods
  3849.  
  3850.  
  3851.    public abstract Locale getLocale()
  3852.  
  3853.  
  3854.    Return the language locale with which this object was created.
  3855.  
  3856.  
  3857.    public abstract ServiceLocationEnumeration
  3858.    findServiceTypes(String namingAuthority,
  3859.                     Vector scopes)
  3860.    throws ServiceLocationException
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866. Kempf & Guttman              Informational                     [Page 69]
  3867.  
  3868. RFC 2614                  Service Location API                 June 1999
  3869.  
  3870.  
  3871.    Returns an enumeration of ServiceType objects giving known service
  3872.    types for the given scopes and given naming authority.  If no service
  3873.    types are found, an empty enumeration is returned.
  3874.  
  3875.    Parameters:
  3876.  
  3877.       namingAuthority
  3878.  
  3879.          The naming authority.  Use "" for the default naming authority
  3880.          and "*" for all naming authorities.
  3881.  
  3882.       scopes
  3883.  
  3884.          A Vector of scope names.  The vector should be selected from
  3885.          the results of a findScopes() API invocation.  Use "DEFAULT"
  3886.          for the default scope.
  3887.  
  3888.  
  3889.    public abstract ServiceLocationEnumeration
  3890.    findServices(ServiceType type,
  3891.                 Vector scopes,
  3892.                 String searchFilter)
  3893.    throws ServiceLocationException
  3894.  
  3895.  
  3896.    Returns a vector of ServiceURL objects for services matching the
  3897.    query, and having a matching type in the given scopes.  If no
  3898.    services are found, an empty enumeration is returned.
  3899.  
  3900.    Parameters:
  3901.  
  3902.       type
  3903.  
  3904.          The SLP service type of the service.
  3905.  
  3906.       scopes
  3907.  
  3908.          A Vector of scope names.  The vector should be selected from
  3909.          the results of a findScopes() API invocation.  Use "DEFAULT"
  3910.          for the default scope.
  3911.  
  3912.       searchFilter
  3913.  
  3914.          An LDAPv3 [4] string encoded query.  If the filter is empty,
  3915.          i.e.  "", all services of the requested type in the specified
  3916.          scopes are returned.  SLP reserved characters must be escaped
  3917.          in the query.  Use ServiceLocationAttribute.escapeId() and
  3918.          ServiceLocationAttribute.escapeValue() to construct the query.
  3919.  
  3920.  
  3921.  
  3922. Kempf & Guttman              Informational                     [Page 70]
  3923.  
  3924. RFC 2614                  Service Location API                 June 1999
  3925.  
  3926.  
  3927.    public abstract ServiceLocationEnumeration
  3928.    findAttributes(ServiceURL URL,
  3929.                   Vector scopes,
  3930.                   Vector attributeIds)
  3931.    throws ServiceLocationException
  3932.  
  3933.  
  3934.    For the URL and scope, return a Vector of ServiceLocationAttribute
  3935.    objects whose ids match the String patterns in the attributeIds
  3936.    Vector.  The request is made in the language locale of the Locator.
  3937.    If no attributes match, an empty enumeration is returned.
  3938.  
  3939.    Parameters:
  3940.  
  3941.       URL
  3942.  
  3943.          The URL for which the attributes are desired.
  3944.  
  3945.       scopes
  3946.  
  3947.          A Vector of scope names.  The vector should be selected from
  3948.          the results of a findScopes() API invocation.  Use "DEFAULT"
  3949.          for the default scope.
  3950.  
  3951.       attributeIds
  3952.  
  3953.          A Vector of String patterns identifying the desired attributes.
  3954.          An empty vector means return all attributes.  As described
  3955.          in [7], the patterns may include wildcards to match substrings.
  3956.          The strings may include SLP reserved characters, they will be
  3957.          escaped by the API before transmission.
  3958.  
  3959.  
  3960.    public abstract ServiceLocationEnumeration
  3961.    findAttributes(ServiceType type,
  3962.                   Vector scopes,
  3963.                   Vector attributeIds)
  3964.    throws ServiceLocationException
  3965.  
  3966.  
  3967.    For the type and scope, return a Vector of all ServiceLocationAttribute
  3968.    objects whose ids match the String patterns in the attributeIds
  3969.    Vector regardless of the Locator's locale.  The request is made
  3970.    independent of language locale.  If no attributes are found, an empty
  3971.    vector is returned.
  3972.  
  3973.  
  3974.  
  3975.  
  3976.  
  3977.  
  3978. Kempf & Guttman              Informational                     [Page 71]
  3979.  
  3980. RFC 2614                  Service Location API                 June 1999
  3981.  
  3982.  
  3983.    Parameters:
  3984.  
  3985.       serviceType
  3986.  
  3987.          The service type.
  3988.  
  3989.       scopes
  3990.  
  3991.          A Vector of scope names.  The vector should be selected from
  3992.          the results of a findScopes() API invocation.  Use "DEFAULT"
  3993.          for the default scope.
  3994.  
  3995.       attributeIds
  3996.  
  3997.          A Vector of String patterns identifying the desired
  3998.          attributes.  An empty vector means return all attributes.
  3999.          As described in [7], the patterns may include wildcards to
  4000.          match all prefixes or suffixes.  The patterns may include SLP
  4001.          reserved characters, they will be escaped by the API before
  4002.          transmission.
  4003.  
  4004. 5.5. The Service Location Manager
  4005.  
  4006. 5.5.1. Class ServiceLocationManager
  4007.  
  4008. 5.5.1.1. Synopsis
  4009.  
  4010.  
  4011.     public class ServiceLocationManager
  4012.     extends Object
  4013.  
  4014.  
  4015. 5.5.1.2. Description
  4016.  
  4017.    The ServiceLocationManager manages access to the service location
  4018.    framework.  Clients obtain the Locator and Advertiser objects for UA
  4019.    and SA, and a Vector of known scope names from the
  4020.    ServiceLocationManager.
  4021.  
  4022. 5.5.1.3. Class Methods
  4023.  
  4024.  
  4025.    public static int getRefreshInterval()
  4026.    throws ServiceLocationException
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034. Kempf & Guttman              Informational                     [Page 72]
  4035.  
  4036. RFC 2614                  Service Location API                 June 1999
  4037.  
  4038.  
  4039.    Returns the maximum across all DAs of the min-refresh-interval
  4040.    attribute.  This value satisfies the advertised refresh interval
  4041.    bounds for all DAs, and, if used by the SA, assures that no
  4042.    refresh registration will be rejected.  If no DA advertises a
  4043.    min-refresh-interval attribute, a value of 0 is returned.
  4044.  
  4045.  
  4046.    public static Vector findScopes()
  4047.    throws ServiceLocationException
  4048.  
  4049.  
  4050.    Returns an Vector of strings with all available scope names.  The
  4051.    list of scopes comes from a variety of sources, see Section 2.1 for
  4052.    the scope discovery algorithm.  There is always at least one string
  4053.    in the Vector, the default scope, "DEFAULT".
  4054.  
  4055.  
  4056.    public static Locator
  4057.    getLocator(Locale locale)
  4058.    throws ServiceLocationException
  4059.  
  4060.  
  4061.    Return a Locator object for the given language Locale.  If the
  4062.    implementation does not support UA functionality, returns null.
  4063.  
  4064.    Parameters:
  4065.  
  4066.       locale
  4067.  
  4068.          The language locale of the Locator.  The default SLP locale is
  4069.          used if null.
  4070.  
  4071.  
  4072.    public static Advertiser
  4073.    getAdvertiser(Locale locale)
  4074.    throws ServiceLocationException
  4075.  
  4076.  
  4077.    Return an Advertiser object for the given language locale.  If the
  4078.    implementation does not support SA functionality, returns null.
  4079.  
  4080.    Parameters:
  4081.  
  4082.       locale
  4083.  
  4084.          The language locale of the Advertiser.  The default SLP locale
  4085.          is used if null.
  4086.  
  4087.  
  4088.  
  4089.  
  4090. Kempf & Guttman              Informational                     [Page 73]
  4091.  
  4092. RFC 2614                  Service Location API                 June 1999
  4093.  
  4094.  
  4095. 5.6. Service Template Introspection
  4096.  
  4097. 5.6.1. Abstract Class TemplateRegistry
  4098.  
  4099. 5.6.1.1. Synopsis
  4100.  
  4101.  
  4102.    public abstract class TemplateRegistry
  4103.  
  4104.  
  4105. 5.6.1.2. Description
  4106.  
  4107.    Subclasses of the TemplateRegistry abstract class provide access to
  4108.    service location templates [8].  Classes implementing
  4109.    TemplateRegistry perform a variety of functions.  They manage the
  4110.    registration and access of service type template documents.  They
  4111.    create attribute verifiers from service templates, for verification
  4112.    of attributes and introspection on template documents.  Note that
  4113.    clients of the Advertiser are not required to verify attributes
  4114.    before registering (though they may get a TYPE_ERROR if the
  4115.    implementation supports type checking and there is a mismatch with
  4116.    the template).
  4117.  
  4118. 5.6.1.3. Class Methods
  4119.  
  4120.  
  4121.    public static TemplateRegistry getTemplateRegistry();
  4122.  
  4123.  
  4124.    Returns the distinguished TemplateRegistry object for performing
  4125.    operations on and with service templates.  Returns null if the
  4126.    implementation doesn't support TemplateRegistry functionality.
  4127.  
  4128. 5.6.1.4. Instance Methods
  4129.  
  4130.  
  4131.    public abstract void
  4132.    registerServiceTemplate(ServiceType type,
  4133.                            String documentURL,
  4134.                            Locale locale,
  4135.                            String version)
  4136.    throws ServiceLocationException
  4137.  
  4138.  
  4139.    Register the service template with the template registry.
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146. Kempf & Guttman              Informational                     [Page 74]
  4147.  
  4148. RFC 2614                  Service Location API                 June 1999
  4149.  
  4150.  
  4151.    Parameters:
  4152.  
  4153.       type
  4154.  
  4155.          The service type.
  4156.  
  4157.       documentURL
  4158.  
  4159.          A string containing the URL of the template document.  May not
  4160.          be the empty string.
  4161.  
  4162.       locale
  4163.  
  4164.          A Locale object containing the language locale of the template.
  4165.  
  4166.       version
  4167.  
  4168.          The version number identifier of template document.
  4169.  
  4170.  
  4171.    public abstract void
  4172.  
  4173.  
  4174.    deregisterServiceTemplate(ServiceType type,
  4175.                              Locale locale,
  4176.                              String version)
  4177.    throws ServiceLocationException
  4178.  
  4179.  
  4180.    Deregister the template for the service type.
  4181.  
  4182.    Parameters:
  4183.  
  4184.       type
  4185.  
  4186.          The service type.
  4187.  
  4188.       locale
  4189.  
  4190.          A Locale object containing the language locale of the template.
  4191.  
  4192.       version
  4193.  
  4194.          A String containing the version number.  Use null to indicate
  4195.          the latest version.
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202. Kempf & Guttman              Informational                     [Page 75]
  4203.  
  4204. RFC 2614                  Service Location API                 June 1999
  4205.  
  4206.  
  4207.    public abstract
  4208.    String findTemplateURL(ServiceType type,
  4209.                           Locale locale,
  4210.                           String version)
  4211.    throws ServiceLocationException
  4212.  
  4213.  
  4214.    Returns the URL for the template document.
  4215.  
  4216.    Parameters:
  4217.  
  4218.       type
  4219.  
  4220.          The service type.
  4221.  
  4222.       locale
  4223.  
  4224.          A Locale object containing the language locale of the template.
  4225.  
  4226.       version
  4227.  
  4228.          A String containing the version number.  Use null to indicate
  4229.          the latest version.
  4230.  
  4231.  
  4232.    public abstract
  4233.    ServiceLocationAttributeVerifier
  4234.    attributeVerifier(String documentURL)
  4235.    throws ServiceLocationException
  4236.  
  4237.  
  4238.    Reads the template document URL and returns an attribute verifier
  4239.    for the service type.  The attribute verifier can be used for
  4240.    verifying that registration attributes match the template, and for
  4241.    introspection on the template definition.
  4242.  
  4243.    Parameters:
  4244.  
  4245.       documentURL
  4246.  
  4247.          A String containing the template document's URL. May not be the
  4248.          empty string.
  4249.  
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258. Kempf & Guttman              Informational                     [Page 76]
  4259.  
  4260. RFC 2614                  Service Location API                 June 1999
  4261.  
  4262.  
  4263. 5.6.2. Interface ServiceLocationAttributeVerifier
  4264.  
  4265. 5.6.2.1. Synopsis
  4266.  
  4267.  
  4268.    public interface ServiceLocationAttributeVerifier
  4269.  
  4270.  
  4271. 5.6.2.2. Description
  4272.  
  4273.    The ServiceLocationAttributeVerifier provides access to service
  4274.    templates.  Classes implementing this interface parse SLP template
  4275.    definitions, provide information on attribute definitions for service
  4276.    types, and verify whether a ServiceLocationAttribute object matches a
  4277.    template for a particular service type.  Clients obtain
  4278.    ServiceLocationAttributeVerifier objects for specific SLP service
  4279.    types through the TemplateRegistry.
  4280.  
  4281. 5.6.2.3. Instance Methods
  4282.  
  4283.  
  4284.    public abstract ServiceType getServiceType()
  4285.  
  4286.  
  4287.    Returns the SLP service type for which this is the verifier.
  4288.  
  4289.  
  4290.    public abstract Locale getLocale()
  4291.  
  4292.  
  4293.    Return the language locale of the template.
  4294.  
  4295.  
  4296.    public abstract String getVersion()
  4297.  
  4298.  
  4299.    Return the template version number identifier.
  4300.  
  4301.  
  4302.    public abstract String getURLSyntax()
  4303.  
  4304.  
  4305.    Return the URL syntax expression for the service:  URL.
  4306.  
  4307.  
  4308.    public abstract String getDescription()
  4309.  
  4310.  
  4311.  
  4312.  
  4313.  
  4314. Kempf & Guttman              Informational                     [Page 77]
  4315.  
  4316. RFC 2614                  Service Location API                 June 1999
  4317.  
  4318.  
  4319.    Return the descriptive help text for the template.
  4320.  
  4321.  
  4322.    public abstract ServiceLocationAttributeDescriptor
  4323.    getAttributeDescriptor(String attrId)
  4324.  
  4325.  
  4326.    Return the ServiceLocationAttributeDescriptor for the attribute
  4327.    having the named id.  If no such attribute exists in this template,
  4328.    return null.  This method is primarily for GUI tools to display
  4329.    attribute information.  Programmatic verification of attributes
  4330.    should use the verifyAttribute() method.
  4331.  
  4332.  
  4333.    public abstract Enumeration
  4334.    getAttributeDescriptors()
  4335.  
  4336.  
  4337.    Returns an Enumeration allowing introspection on the attribute
  4338.    definition in the service template.  The Enumeration returns
  4339.    ServiceLocationAttributeDescriptor objects for the attributes.
  4340.    This method is primarily for GUI tools to display attribute
  4341.    information.  Programmatic verification of attributes should use the
  4342.    verifyAttribute() method.
  4343.  
  4344.  
  4345.    public abstract void
  4346.    verifyAttribute(
  4347.      ServiceLocationAttribute attribute)
  4348.    throws ServiceLocationException
  4349.  
  4350.  
  4351.    Verify that the attribute matches the template definition.  If the
  4352.    attribute doesn't match, ServiceLocationException is thrown with the
  4353.    error code as ServiceLocationException.PARSE_ERROR.
  4354.  
  4355.    Parameters:
  4356.  
  4357.       attribute
  4358.  
  4359.          The ServiceLocationAttribute object to be verified.
  4360.  
  4361.  
  4362.    public abstract void
  4363.    verifyRegistration(
  4364.      Vector attributeVector)
  4365.    throws ServiceLocationException
  4366.  
  4367.  
  4368.  
  4369.  
  4370. Kempf & Guttman              Informational                     [Page 78]
  4371.  
  4372. RFC 2614                  Service Location API                 June 1999
  4373.  
  4374.  
  4375.    Verify that the Vector of ServiceLocationAttribute objects matches
  4376.    the template for this service type.  The vector must contain all the
  4377.    required attributes, and all attributes must match their template
  4378.    definitions.  If the attributes don't match, ServiceLocationException
  4379.    is thrown with the error code as ServiceLocationException.PARSE_ERROR
  4380.  
  4381.    Parameters:
  4382.  
  4383.       attributeVector
  4384.  
  4385.          A Vector of ServiceLocationAttribute objects for the
  4386.          registration.
  4387.  
  4388.  
  4389. 5.6.3. Interface ServiceLocationAttributeDescriptor
  4390.  
  4391. 5.6.3.1. Synopsis
  4392.  
  4393.  
  4394.    public interface
  4395.    ServiceLocationAttributeDescriptor
  4396.  
  4397.  
  4398. 5.6.3.2. Description
  4399.  
  4400.    The ServiceLocationAttributeDescriptor interface provides
  4401.    introspection on a template attribute definition.  Classes
  4402.    implementing the ServiceLocationAttributeDescriptor interface return
  4403.    information on a particular service location attribute definition
  4404.    from the service template.  This information is primarily for GUI
  4405.    tools.  Programmatic attribute verification should be done through
  4406.    the ServiceLocationAttributeVerifier.
  4407.  
  4408. 5.6.3.3. Instance Methods
  4409.  
  4410.  
  4411.    public abstract String getId()
  4412.  
  4413.  
  4414.    Return a String containing the attribute's id.
  4415.  
  4416.  
  4417.    public abstract String getValueType()
  4418.  
  4419.  
  4420.    Return a String containing the fully package-qualified Java type of
  4421.    the attribute.  SLP types are translated into Java types as follows:
  4422.  
  4423.  
  4424.  
  4425.  
  4426. Kempf & Guttman              Informational                     [Page 79]
  4427.  
  4428. RFC 2614                  Service Location API                 June 1999
  4429.  
  4430.  
  4431.       STRING
  4432.  
  4433.          "java.lang.String"
  4434.  
  4435.       INTEGER
  4436.  
  4437.          "java.lang.Integer"
  4438.  
  4439.       BOOLEAN
  4440.  
  4441.          "java.lang.Boolean"
  4442.  
  4443.       OPAQUE
  4444.  
  4445.          "[B" (i.e.  array of byte, byte[])
  4446.  
  4447.       KEYWORD
  4448.  
  4449.          empty string, ""
  4450.  
  4451.  
  4452.  public abstract String getDescription()
  4453.  
  4454.  
  4455.    Return a String containing the attribute's help text.
  4456.  
  4457.  
  4458.    public abstract Enumeration
  4459.    getAllowedValues()
  4460.  
  4461.  
  4462.    Return an Enumeration of allowed values for the attribute type.
  4463.    For keyword attributes returns null.  For no allowed values (i.e.
  4464.    unrestricted) returns an empty Enumeration.
  4465.  
  4466.  
  4467.    public abstract Enumeration
  4468.    getDefaultValues()
  4469.  
  4470.  
  4471.    Return an Enumeration of default values for the attribute type.
  4472.    For keyword attributes returns null.  For no allowed values (i.e.
  4473.    unrestricted) returns an empty Enumeration.
  4474.  
  4475.  
  4476.    public abstract boolean
  4477.    getRequiresExplicitMatch()
  4478.  
  4479.  
  4480.  
  4481.  
  4482. Kempf & Guttman              Informational                     [Page 80]
  4483.  
  4484. RFC 2614                  Service Location API                 June 1999
  4485.  
  4486.  
  4487.    Returns true if the "X"" flag is set, indicating that the attribute
  4488.    should be included in an any Locator.findServices() request search
  4489.    filter.
  4490.  
  4491.  
  4492.    public abstract boolean getIsMultivalued()
  4493.  
  4494.  
  4495.    Returns true if the "M" flag is set.
  4496.  
  4497.  
  4498.    public abstract boolean getIsOptional()
  4499.  
  4500.  
  4501.    Returns true if the "O"" flag is set.
  4502.  
  4503.  
  4504.    public abstract boolean getIsLiteral()
  4505.  
  4506.  
  4507.    Returns true if the "L" flag is set.
  4508.  
  4509.  
  4510.    public abstract boolean getIsKeyword()
  4511.  
  4512.  
  4513.    Returns true if the attribute is a keyword attribute.
  4514.  
  4515.  
  4516. 5.7. Implementation Notes
  4517.  
  4518. 5.7.1. Refreshing Registrations
  4519.  
  4520.    A special lifetime constant, ServiceURL.LIFETIME_PERMANENT, is used
  4521.    by clients to indicate that the URL should be automatically refreshed
  4522.    until the application exits.  The API implementation should interpret
  4523.    this flag as indicating that the URL lifetime is
  4524.    ServiceURL.LIFETIME_MAXIMUM, and MUST arrange for automatic refresh
  4525.    to occur.
  4526.  
  4527. 5.7.2. Parsing Alternate Transports in ServiceURL
  4528.  
  4529.    The ServiceURL class is designed to handle multiple transports.  The
  4530.    standard API performs no additional processing on transports other
  4531.    than IP except to separate out the host identifier and the URL path.
  4532.    However, implementations are free to subclass ServiceURL and support
  4533.    additional methods that provide more detailed parsing of alternate
  4534.    transport information.  For IP transport, the port number, if any, is
  4535.  
  4536.  
  4537.  
  4538. Kempf & Guttman              Informational                     [Page 81]
  4539.  
  4540. RFC 2614                  Service Location API                 June 1999
  4541.  
  4542.  
  4543.    returned from the getPort() method.  For non-IP transports, the
  4544.    getPort() method returns NO_PORT.
  4545.  
  4546. 5.7.3. String Attribute Values
  4547.  
  4548.    In general, translation between Java types for attribute values and
  4549.    the SLP on-the-wire string is straightforward.  However, there are
  4550.    two corner cases.  If the Java attribute value type is String and the
  4551.    value of the string has an on-the-wire representation that is
  4552.    inferred by SLP as an integer, the registered attribute value may not
  4553.    be what the API client intended.  A similar problem could result if
  4554.    the Java attribute value is the string "true" or "false", in which
  4555.    case the on-the-wire representation is inferred to boolean.  To
  4556.    handle these corner cases, the Java API prepends a space onto the
  4557.    string.  So, for example, if the string attribute value is "123", the
  4558.    Java API transforms the value to "123 ", which will have an on-the-
  4559.    wire representation that is inferred by SLP to be string.  Since
  4560.    appended and prepended spaces have no effect on query handling, this
  4561.    procedure should cause no problem with queries.  API clients need to
  4562.    be aware, however, that the transformation is occurring.
  4563.  
  4564. 5.7.4. Client Side Syntax Checking
  4565.  
  4566.    The syntax of scope names, service type names, naming authority
  4567.    names, and URLs is described in [7] and [8].  The various methods and
  4568.    classes taking String parameters for these entities SHOULD type check
  4569.    the parameters for syntax errors on the client side, and throw an
  4570.    IllegalArgumentException if an error occurs.  In addition, character
  4571.    escaping SHOULD be implemented before network transmission for
  4572.    escapable characters in attribute ids and String values.  This
  4573.    reduces the number of error messages transmitted.  The
  4574.    ServiceLocationAttribute class provides methods for clients to obtain
  4575.    escaped attribute id and value strings to facilitate query
  4576.    construction.
  4577.  
  4578. 5.7.5. Language Locale Handling
  4579.  
  4580.    The Locator and Advertiser interfaces are created with a Locale
  4581.    parameter.  The language locale with which these objects are created
  4582.    is used in all SLP requests issued through the object.  If the Locale
  4583.    parameter is null, the default SLP locale is used.  The default SLP
  4584.    locale is determined by, first, checking the net.slp.locale System
  4585.    property.  If that is unset, then the default SLP locale [7] is used,
  4586.    namely "en".  Note that the default SLP locale may not be the same as
  4587.    the default Java locale.
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594. Kempf & Guttman              Informational                     [Page 82]
  4595.  
  4596. RFC 2614                  Service Location API                 June 1999
  4597.  
  4598.  
  4599. 5.7.6. Setting SLP System Properties
  4600.  
  4601.    SLP system properties that are originally set in the configuration
  4602.    file can be overridden programmatically in API clients by simply
  4603.    invoking the System.getProperties() operation to get a copy of the
  4604.    system properties, modifying or adding the SLP property in question,
  4605.    then using System.setProperties() to set the properties to the
  4606.    modified Property object.  Program execution continues without
  4607.    interruption by substituting the default for the erroneous parameter.
  4608.    Errors are checked when the property is used and are logged.
  4609.  
  4610.    The SLP configuration file cannot be read with the
  4611.    java.util.Properties file reader because there are some syntactic
  4612.    differences.  The SLP configuration file syntax defines a different
  4613.    escape convention for non-ASCII characters than the Java syntax.
  4614.    However, after the file has been read, the properties are stored and
  4615.    retrieved from java.util.Properties objects.
  4616.  
  4617.    Properties are global for a process, affecting all threads and all
  4618.    Locator and Advertiser objects obtained through the
  4619.    ServiceLocationManager.  With the exception of the net.slp.locale,
  4620.    net.slp.typeHint, and net.slp.maxResults properties, clients should
  4621.    rarely be required to override these properties, since they reflect
  4622.    properties of the SLP network that are not of concern to individual
  4623.    agents.  If changes are required, system administrators should modify
  4624.    the configuration file.
  4625.  
  4626. 5.7.7. Multithreading
  4627.  
  4628.    Thread-safe operation is relatively easy to achieve in Java.  By
  4629.    simply making each method in the classes implementing the Locator and
  4630.    Advertiser interfaces synchronized, and by synchronizing access to
  4631.    any shared data structures within the class, the Locator and
  4632.    Advertiser interfaces are made safe.  Alternatively, finer grained
  4633.    synchronization is also possible within the classes implementing
  4634.    Advertiser and Locator.
  4635.  
  4636. 5.7.8. Modular Implementations
  4637.  
  4638.    While, at first glance, the API may look rather heavyweight, the
  4639.    design has been carefully arranged so that modular implementations
  4640.    that provide only SA, only UA, or only service template access
  4641.    capability, or any combination of the three, are possible.
  4642.  
  4643.    Because the objects returned from the
  4644.    ServiceLocationManager.getLocator() and
  4645.    ServiceLocationManager.getAdvertiser() operations are interfaces, and
  4646.    because the objects returned through those interfaces are in the set
  4647.  
  4648.  
  4649.  
  4650. Kempf & Guttman              Informational                     [Page 83]
  4651.  
  4652. RFC 2614                  Service Location API                 June 1999
  4653.  
  4654.  
  4655.    of base data structures, an implementation is free to omit either UA
  4656.    or SA capability by simply returning null from the instance creation
  4657.    operation if the classes implementing the missing function cannot be
  4658.    dynamically linked.  API clients are encouraged to check for such a
  4659.    contingency, and to signal an exception if it occurs.  Similarly, the
  4660.    TemplateRegistry concrete subclass can simply be omitted from an
  4661.    implementation that only supports UA and/or SA clients, and the
  4662.    TemplateRegistry.getRegistry() method can return null.  In this way,
  4663.    the API implementation can be tailored for the particular memory
  4664.    requirements at hand.
  4665.  
  4666.    In addition, if an implementation only supports the minimal subset of
  4667.    SLP [7], the unsupported Locator and Advertiser interface operations
  4668.    can throw an exception with ServiceLocationException.NOT_IMPLEMENTED
  4669.    as the error code.  This supports better source portability between
  4670.    low and high memory platforms.
  4671.  
  4672. 5.7.9. Asynchronous and Incremental Return Semantics
  4673.  
  4674.    The Java API contains no specific support for asynchronous operation.
  4675.    Incremental return is not needed for the Advertiser because service
  4676.    registrations can be broken up into pieces when large.  Asynchronous
  4677.    return is also not needed because clients can always issue the
  4678.    Advertiser operation in a separate thread if the calling thread can't
  4679.    block.
  4680.  
  4681.    The Locator can be implemented either synchronously or
  4682.    asynchronously.  Since the return type for Locator calls is
  4683.    ServiceLocationEnumeration, a Java API implementation that supports
  4684.    asynchronous semantics can implement ServiceLocationEnumeration to
  4685.    dole results out as they come in, blocking when no results are
  4686.    available.  If the client code needs to support other processing
  4687.    while the results are trickling in, the call into the enumeration to
  4688.    retrieve the results can be done in a separate thread.
  4689.  
  4690.    Unlike the C case, collation semantics for return of attributes when
  4691.    an attribute request by service type is made require that the API
  4692.    collate returned values so that only one attribute having a collation
  4693.    of all returned values appear to the API client.  In practice, this
  4694.    may limit the amount of asynchronous processing possible with the
  4695.    findAttributes() method.  This requirement is imposed because memory
  4696.    management is much easier in Java and so implementing collation as
  4697.    part of the API should not be as difficult as in C, and it saves the
  4698.    client from having to do the collation.
  4699.  
  4700.  
  4701.  
  4702.  
  4703.  
  4704.  
  4705.  
  4706. Kempf & Guttman              Informational                     [Page 84]
  4707.  
  4708. RFC 2614                  Service Location API                 June 1999
  4709.  
  4710.  
  4711. 5.8. Example
  4712.  
  4713.    In this example, a printer server advertises its availability to
  4714.    clients.  Additionally, the server advertises a service template for
  4715.    use by client software in validating service requests:
  4716.  
  4717.  
  4718.   //Get the Advertiser and TemplateRegistry.
  4719.  
  4720.   Advertiser adv = null;
  4721.   TemplateRegistry tr = null
  4722.  
  4723.   try {
  4724.  
  4725.     adv = ServiceLocationManager.getAdvertiser("en");
  4726.  
  4727.     tr = TemplateRegistry.getTemplateRegistry();
  4728.  
  4729.   } catch( ServiceLocationException ex ) { } //Deal with error.
  4730.  
  4731.   if( adv == null ) {
  4732.  
  4733.     //Serious error as printer can't be registered
  4734.     //  if the implementation doesn't support SA
  4735.     //  functionality.
  4736.  
  4737.   }
  4738.  
  4739.   //Get the printer's attributes, from a file or
  4740.   //  otherwise. We assume that the attributes
  4741.   //  conform to the template, otherwise, we
  4742.   //  could register the template here and verify
  4743.   //  them.
  4744.  
  4745.   Vector attributes = getPrinterAttributes();
  4746.  
  4747.   //Create the service: URL for the printer.
  4748.  
  4749.   ServiceURL printerURL =
  4750.     new ServiceURL(
  4751.       "service:printer:lpr://printshop/color2",
  4752.       ServiceURL.LIFETIME_MAXIMUM);
  4753.  
  4754.   try {
  4755.  
  4756.     //Register the printer.
  4757.  
  4758.     adv.register(printerURL, attributes);
  4759.  
  4760.  
  4761.  
  4762. Kempf & Guttman              Informational                     [Page 85]
  4763.  
  4764. RFC 2614                  Service Location API                 June 1999
  4765.  
  4766.  
  4767.     //If the template registry is available,
  4768.     //  register the printer's template.
  4769.  
  4770.     if( tr != null ) {
  4771.       tr.registerServiceTemplate(
  4772.         new ServiceType("service:printer:lpr"),
  4773.         "http://shop.arv/printer/printer-lpr.slp",
  4774.         new Locale("en",""),
  4775.         "1.0");
  4776.  
  4777.    }
  4778.  
  4779.   } catch( ServiceLocationException ex ) { } //Deal with error.
  4780.  
  4781.  
  4782.    Suppose a client is looking for color printer.  The following code is
  4783.    used to issue a request for printer advertisements:
  4784.  
  4785.  
  4786.   Locator loc = null;
  4787.   TemplateRegistry tr = null;
  4788.  
  4789.   try {
  4790.  
  4791.     loc = ServiceLocationManager.getLocator("en");
  4792.  
  4793.   } catch( ServiceLocationException ex ) { } //Deal with error.
  4794.  
  4795.   if( loc == null ) {
  4796.  
  4797.     //Serious error as client can't be located
  4798.     //  if the implementation doesn't support
  4799.     //  UA functionality.
  4800.  
  4801.   }
  4802.  
  4803.   //We want a color printer that does CMYK
  4804.   //  and prints at least 600 dpi.
  4805.  
  4806.   String query = "(&(marker-type=CMYK)(resolution=600))";
  4807.  
  4808.   //Get scopes.
  4809.  
  4810.   Vector scopes = ServiceLocationManager.findScopes();
  4811.  
  4812.   Enumeration services;
  4813.  
  4814.   try {
  4815.  
  4816.  
  4817.  
  4818. Kempf & Guttman              Informational                     [Page 86]
  4819.  
  4820. RFC 2614                  Service Location API                 June 1999
  4821.  
  4822.  
  4823.     services =
  4824.       loc.findServices(new ServiceType("service:printer"),scopes,query);
  4825.  
  4826.   } catch { } //Deal with error.
  4827.  
  4828.   if (services.hasMoreElements() ) {
  4829.  
  4830.     //Printers can now be used.
  4831.     ServiceURL surl = (ServiceURL) services.next();
  4832.  
  4833.     Socket sock = new Socket(surl.getHost, surl.getPort());
  4834.  
  4835.     // Use the Socket...
  4836.  
  4837.   }
  4838.  
  4839.  
  4840. 6. Internationalization Considerations
  4841.  
  4842. 6.1. service URL
  4843.  
  4844.    The service URL itself must be encoded using the rules set forth in
  4845.    [2].  The character set encoding is limited to specific ranges within
  4846.    the UTF-8 character set [3].
  4847.  
  4848.    The attribute information associated with the service URL must be
  4849.    expressed in UTF-8.  See [8] for attribute internationalization
  4850.    guidelines.
  4851.  
  4852. 6.2. Character Set Encoding
  4853.  
  4854.    Configuration and serialized registration files are encoded in the
  4855.    UTF-8 character set [3].  This is fully compatible with US-ASCII
  4856.    character values.  C platforms that do not support UTF-8 are required
  4857.    to check the top bit of input bytes to determine whether the incoming
  4858.    character is multibyte.  If it is, the character should be dealt with
  4859.    accordingly.  This should require no additional implementation
  4860.    effort, since the SLP wire protocol requires that strings are encoded
  4861.    as UTF-8.  C platforms without UTF-8 support need to supply their own
  4862.    support, if only in the form of multibyte string handling.
  4863.  
  4864.    At the API level, the character encoding is specified to be Unicode
  4865.    for Java and UTF-8 for C. Unicode is the default in Java.  For C, the
  4866.    standard US-ASCII 8 bits per character, null terminated C strings are
  4867.    a subset of the UTF-8 character set, and so work in the API. Because
  4868.    the C API is very simple, the API library needs to do a minimum of
  4869.    processing on UTF-8 strings.  The strings primarily just need to be
  4870.    reflected into the outgoing SLP messages, and reflected out of the
  4871.  
  4872.  
  4873.  
  4874. Kempf & Guttman              Informational                     [Page 87]
  4875.  
  4876. RFC 2614                  Service Location API                 June 1999
  4877.  
  4878.  
  4879.    API from incoming SLP messages.
  4880.  
  4881. 6.3. Language Tagging
  4882.  
  4883.    All SLP requests and registrations are tagged to indicate in which
  4884.    language the strings included are encoded.  This allows multiple
  4885.    languages to be supported.  It also presents the possibility that
  4886.    error conditions result when a request is made in a language that is
  4887.    not supported.  In this case, an error is only returned when there is
  4888.    data available, but not obtainable in the language requested.
  4889.  
  4890.    The dialect portion of the Language Tag is used on 'best effort'
  4891.    basis for matching strings by SLP. Dialects that match are preferred
  4892.    over those which don't.  Dialects that do not match will not prevent
  4893.    string matching or comparisons from occurring.
  4894.  
  4895. 7. Security Considerations
  4896.  
  4897.    Security is handled within the API library and is not exposed to API
  4898.    clients except in the form of exceptions.  The
  4899.    net.slp.securityEnabled, property determines whether an SA client's
  4900.    messages are signed, but a UA client should be prepared for an
  4901.    authentication exception at any time, because it may contact a DA
  4902.    with authenticated advertisements.
  4903.  
  4904.    An adversary could delete valid service advertisements, provide false
  4905.    service information and deny UAs knowledge of existing services
  4906.    unless the mechanisms in SLP for authenticating SLP messages are
  4907.    used.  These mechanisms allow DAAdverts, SAAdverts, Service URLs and
  4908.    Service Attributes to be verified using digital cryptography.  For
  4909.    this reason, all SLP agents should be configured to use SLP SPIs.
  4910.    See [7] for a description of how this mechanism works.
  4911.  
  4912. 8. Acknowledgements
  4913.  
  4914.    The authors would like to thank Don Provan for his pioneering work
  4915.    during the initial stages of API definition.
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930. Kempf & Guttman              Informational                     [Page 88]
  4931.  
  4932. RFC 2614                  Service Location API                 June 1999
  4933.  
  4934.  
  4935. 9. References
  4936.  
  4937.     [1] Bradner, S., "Key Words for Use in RFCs to Indicate
  4938.         Requirement Levels", BCP 14, RFC 2119, March 1997.
  4939.  
  4940.     [2] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform
  4941.         Resource Identifiers (URI): Generic Syntax", RFC 2396,
  4942.         August 1998.
  4943.  
  4944.     [3] Yergeau, F., "UTF-8, a transformation format of ISO 10646",
  4945.         RFC 2279, January 1998.
  4946.  
  4947.     [4] Howes, T., "The String Representation of LDAP Search Filters",
  4948.         RFC 2254  December 1997.
  4949.  
  4950.     [5] Crocker, D. and P. Overell, "Augmented BNF for Syntax
  4951.         Specifications: ABNF", RFC 2234, November 1997.
  4952.  
  4953.     [6] Alvestrand, H., "Tags for the Identification of Languages",
  4954.         RFC 1766, March 1995.
  4955.  
  4956.     [7] Guttman, E., Perkins, C., Veizades, J. and M. Day, "Service
  4957.         Location Protocol, Version 2", RFC 2608, June 1999.
  4958.  
  4959.     [8] Guttman, E., Perkins, C. and J. Kempf, "Service Templates and
  4960.         Service: Schemes", RFC 2609, June 1999.
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986. Kempf & Guttman              Informational                     [Page 89]
  4987.  
  4988. RFC 2614                  Service Location API                 June 1999
  4989.  
  4990.  
  4991. 10. Authors' Addresses
  4992.  
  4993.    Questions about this memo can be directed to:
  4994.  
  4995.    James Kempf
  4996.    Sun Microsystems
  4997.    901 San Antonio Rd.
  4998.    Palo Alto, CA, 94303
  4999.    USA
  5000.  
  5001.    Phone: +1 650 786 5890
  5002.    Fax:   +1 650 786 6445
  5003.    EMail: james.kempf@sun.com
  5004.  
  5005.  
  5006.    Erik Guttman
  5007.    Sun Microsystems
  5008.    Bahnstr. 2
  5009.    74915 Waibstadt
  5010.    Germany
  5011.  
  5012.    Phone: +49 7263 911 701
  5013.    EMail: erik.guttman@sun.com
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.  
  5027.  
  5028.  
  5029.  
  5030.  
  5031.  
  5032.  
  5033.  
  5034.  
  5035.  
  5036.  
  5037.  
  5038.  
  5039.  
  5040.  
  5041.  
  5042. Kempf & Guttman              Informational                     [Page 90]
  5043.  
  5044. RFC 2614                  Service Location API                 June 1999
  5045.  
  5046.  
  5047. 11. Full Copyright Statement
  5048.  
  5049.    Copyright (C) The Internet Society (1999).  All Rights Reserved.
  5050.  
  5051.    This document and translations of it may be copied and furnished to
  5052.    others, and derivative works that comment on or otherwise explain it
  5053.    or assist in its implementation may be prepared, copied, published
  5054.    and distributed, in whole or in part, without restriction of any
  5055.    kind, provided that the above copyright notice and this paragraph are
  5056.    included on all such copies and derivative works.  However, this
  5057.    document itself may not be modified in any way, such as by removing
  5058.    the copyright notice or references to the Internet Society or other
  5059.    Internet organizations, except as needed for the purpose of
  5060.    developing Internet standards in which case the procedures for
  5061.    copyrights defined in the Internet Standards process must be
  5062.    followed, or as required to translate it into languages other than
  5063.    English.
  5064.  
  5065.    The limited permissions granted above are perpetual and will not be
  5066.    revoked by the Internet Society or its successors or assigns.
  5067.  
  5068.    This document and the information contained herein is provided on an
  5069.    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  5070.    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  5071.    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  5072.    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  5073.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE."
  5074.  
  5075. Acknowledgement
  5076.  
  5077.    Funding for the RFC Editor function is currently provided by the
  5078.    Internet Society.
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098. Kempf & Guttman              Informational                     [Page 91]
  5099.  
  5100.