Tech-invite3GPPspaceIETF RFCsSIP
in Index   Prev   Next

RFC 2165

Service Location Protocol

Pages: 72
Proposed Standard
Updated by:  26082609
Part 2 of 3 – Pages 19 to 50
First   Prev   Next

Top   ToC   RFC2165 - Page 19   prevText
5. Service Request Message Format

   The Service Request is used to obtain URLs from a Directory Agent or
   Service Agents.
Top   ToC   RFC2165 - Page 20
   The format of the Service Request is as follows:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |         Service Location header (function = SrvReq)           |
     |length of prev resp list string|<Previous Responders Addr Spec>|
     |                                                               |
     \                  <Previous Responders Addr Spec>              \
     |                                                               |
     |  length of predicate string   |  Service Request <predicate>  |
     |                                                               |
     \               Service Request <predicate>, contd.             \
     |                                                               |

   If a UA issues a request which will result in a reply which is too
   large, the SA or DA will return an abbreviated response (in a
   datagram the size of the site's MTU) which has the 'Overflow' bit
   flag set.  The UA must then issue the request again using TCP.

   The <Previous Responders Addr Spec> is described in sections 7 and

   After a User Agent restarts (say, after rebooting of a system,
   loading of the network kernel), Service Requests should be delayed
   for some random time uniformly distributed within a one second
   interval centered about a configured delay value (by default,

   The Service Request allows the User Agent to specify the Service Type
   of the service and a Predicate in a specific language.  The general
   form of a Service Request is shown below:


   The punctuation is necessary even where the fields are omitted.

    -  The <srvtype> refers to the Service Type.  For each type of
       service available, there is a unique Service type name string.
       See section 20.2.1.
Top   ToC   RFC2165 - Page 21
    -  The <na> is the Naming Authority.  This string determines the
       semantic interpretation of the attribute information in the
       <where> part of the Service Request.

    -  The <scope> is a string used to restrict the range of the query.
       Scope is determined administratively, at a given site.  It is not
       necessarily related to network topology (see Section 16).
       Leaving this field out means that the request can be satisfied
       only by unscoped service advertisements.

    -  The <where> string is the Where Clause of the request.  It
       contains a query which allows the selection of those service
       instances which the User Agent is interested in.  The query
       includes attributes, boolean operators and relations.  (See
       section 5.3.)

   In the case of a multicast service request, a list of previous
   responders is sent.  This list will prevent those in the list from
   responding, to be sure that responses from other sources are not
   drowned out.  The request is multicast repeatedly (with a recommended
   wait interval of CONFIG_INTERVAL_2) until there are no new responses,
   or a certain time (CONFIG_INTERVAL_3) has elapsed.  Different timing
   values are applied to a Service Request used for Directory Agent
   Discovery, see Section 5.2.

   In order for a request to succeed in matching registered information,
   the following conditions must be met:

    1. The result must have the same Service Type as the request.

    2. It must have the same Naming Authority.

    3. It must have the same scope.  (If the scope of the request
       as omitted, the request will only match services which were
       registered with no scope.  Note that a scoped request WILL match
       all unscoped Services).

    4. The conditions specified in the Where Clause must match the
       attributes and keywords registered for the service.
Top   ToC   RFC2165 - Page 22
5.1. Service Request Usage

   The User Agent may form Service Requests using preconfigured
   knowledge of a Service Type's attributes.  It may also issue
   Attribute Requests to obtain the attribute values for a Service Type
   before issuing Service Requests (see Section 13).  Having obtained
   the attributes which describe a particular kind of service from an
   Attribute Request, or using configured knowledge of a service's
   attributes, the User Agent can build a predicate that describes the
   service needs of the user.

   Service Requests may be sent directly to a Directory Agent.  Suppose
   a printer supporting the lpr protocol is needed on the 12th floor
   which has UNRESTRICTED_ACCESS and prints 12 pages per minute.
   Suppose further that a Attribute Request indicates that there is a
   printer on the 12th floor, a printer that prints 12 pages per minute,
   and a printer that offers UNRESTRICTED_ACCESS. To check whether they
   are same printer, issue the following request:

      lpr//(& (PAGES PER MINUTE==12)
               (LOCATION==12th FLOOR))/

   Suppose there is no such printer.  The Directory Agent responds with
   a Service Reply with 0 in the number of responses and no reply

   The User Agent then tries a less restrictive query to find a printer,
   using the 12th floor as "where" criteria.

      lpr//(LOCATION==12th FLOOR)/

   In this case, there is now only one reply:

      Returned URL:   service:lpr://

   The Address Specification for the printer is:,
   containing the name of the host managing the requested printer.
   Files would be printed by spooling to that port on that host.  The
   word 'draft' refers to the name of the print queue the lpr server
Top   ToC   RFC2165 - Page 23
   In the absence of a Directory Agent, the request above could be
   multicast.  In this case it would be sent to the Service Specific
   Multicast Address for "service:printer" and not to the Directory
   Agent.  Service Agents that can satisfy the predicate will reply.
   Service Agents which cannot support the character set of the request
   MUST return CHARSET_NOT_UNDERSTOOD in the SrvRply.  In all other
   circumstances, Service Agents which cannot satisfy the reply do not
   send any reply at all.

   The only way a User Agent can be sure there are no services which
   match the query is by retrying the request (CONFIG_INTERVAL_8).  If
   no response comes, the User Agent gives up and assumes there are no
   such printers.

   Another form of query is a simpler 'join' query.  Its syntax has no
   parentheses or logical operators.  Each term is conjoined (AND-ed
   together.)  Rewriting the initial query provides an example:

      lpr//PAGES PER MINUTE==12,
           LOCATION==12th FLOOR/

5.2. Directory Agent Discovery Request

   Normally a Service Request returns a Service Reply.  The sole
   exception to this is a Service Request for the Service Type
   "directory-agent".  This Service Request is answered with a DA

   Without configured knowledge of a Directory Agent (DA), a User Agent
   or Service Agent uses a Service Request to discover a DA. (See
   section 15.1 for mechanisms by which a client may be configured to
   have knowledge of a DA.) Such a Service Request used for Directory
   Agent Discovery includes a predicate of the form:


   This query is always sent to the Directory Agent Discovery multicast
   address.  The Service Type of a Directory Agent is "directory-agent",
   hence it is the Service Type used in the request.  No scope is
   included in the request, so all Directory Agents will reply.  This is
   the only request which omits a scope which all Directory Agents MUST
   respond to.  Normally, a Directory Agent with a scope ONLY responds
   to requests with that scope.  No Naming Authority is included, so
   "IANA" is assumed.  We want to reach all the available directory
   agents.  If the scope were supplied, only DAs supporting that scope
   would reply.
Top   ToC   RFC2165 - Page 24
   DA Advertisement Replies may arrive from different sources, similar
   in form to:

     URL returned:   service:directory-agent://
     Scope returned: ACCOUNTING

     URL returned:   service:directory-agent:// Scope

   The DA Advertisement format is defined in Section 14.

   If the goal is merely to discover any Directory Agent, the first
   reply will do.  If the goal, however, is to discover all reachable
   DAs, the request must be retransmitted after an interval (the
   recommended time is CONFIG_INTERVAL_5).  This retransmitted request
   will include a list of DAs which have already responded.  See
   sections 7 and 20.1.  Directory Agents which receive the request will
   only respond if they are not on this list.  After there are no new
   replies, all DAs are presumed to have been discovered.

   If a DA fails to respond after CONFIG_INTERVAL_6 seconds, the UA or
   Service Agent should use a different DA. DA addresses may be cached
   from previous discovery attempts, preconfigured, or by use of DHCP
   (see section 15.2).  If no such DA responds, DA discovery should be
   used to find a new DA. Only after CONFIG_INTERVAL_7 seconds should it
   be assumed that no DA exists and multicast based Service Requests
   should be used.

5.3. Explanation of Terms of Predicate Grammar

   A predicate has a simple structure, which depends on parentheses,
   commas and slashes to delimit the elements.  Examples of proper usage
   are given throughout this document.  The terms used in the grammar
   are as follows:


         Placed in a Service Request, this is interpreted by a Service
         Agent or Directory Agent to determine what information to


         If this is absent in a Service Request, the request will match
         only services registered without a scope.  If it is present,
         only services registered under that scope or are unscoped will
         match the request.
Top   ToC   RFC2165 - Page 25

         This determines which services the request matches.  An empty
         where-clause will match all services.  The request will be
         limited to services which have the specified Service Type, so
         the where-clause is not the sole factor in picking out which
         services match the request.


         The where-list is a logical expression.  It can be a single
         expression, a disjunction or a conjunction.  A single
         expression must apply for the where-clause to match.  A
         disjunction matches if any expression in the OR list matches.
         A conjunction matches only if all elements in the AND list

         Note that there is no logical negation operator:  This is
         because there is no notion of returning "everything except"
         what matches a given criteria.

         A where-list can be nested and complex.  For example, the
         following requires that three subexpressions must all be true:

                (& (| <query-item> <query-item>)
                   (& <query-item> <query-item> <query-item>)

         Notice that white space, tabs or carriage returns can be added
         anywhere outside query-items.  Each list has 2 or more items in
         it, and lists can be nested.  Services which fulfill the entire
         logical expression match the where-clause.

         degenerate expressions but they should be tolerated.  They are
         equivalent to <query-item>.


         A query item has the form:

               '(' <attr-tag> <comp-op> <attr-val> ')'


               '(' <keyword> ')'
Top   ToC   RFC2165 - Page 26
         Examples of this would be:

            (QUEUE LENGTH <= 234)


         The query-join is a comma delimited list of conditions which
         the service must satisfy in order to match the query.  The
         items are considered to be logically conjoined.  Thus the

               ATTR1=VALUE1, KEYWORD1, KEYWORD2, ATTR2>=34

         is equivalent to the where-list:

               (& (ATTR1=VALUE1) (KEYWORD1) (KEYWORD2) (ATTR2>=34))

         The query-join cannot be mixed with a where-list.  It is
         provided as a convenient mechanism to provide a statement of
         necessary conditions without building a logical expression.

5.4. Service Request Predicate Grammar

   Service Requests can precisely describe the services they need by
   including a Predicate the body of the Request.  This Predicate must
   be constructed according to the grammar below.

   <predicate>  ::= <srvtype>['.'<na>]'/'<scope>'/'<where>'/'

   <srvtype>    ::= string representing type of service.  Only
                    alphanumeric characters, '+', and '-' are allowed.

   <na>         ::= string representing the Naming Authority.
                    Only alphanumeric characters, '+',
                    and '-' are allowed.  If this field is
                    omitted then "IANA" is assumed.

   <scope>      ::= string representing the directory agent scope.
                    '/', ',' (comma) and ':'  are not allowed in
                    this string.  The scopes "LOCAL" and "REMOTE"
                    are reserved.

   <attr-tag>   ::= class name of an attribute of a given Service
                    Type.  This tag cannot include the following
                     characters:  '(', ')', ',', '=', '!', '>',
                     '<', '/', '*', except where escaped (see 17.1.)
Top   ToC   RFC2165 - Page 27
   <keyword>    ::= a class name of an attribute which will have
                    no values.  This string has the same limits
                    as the <attr-tag>, except that white space
                    internal to the keyword is illegal.

   <where>      ::= <where-any> |
                    <where-list> |

   <where-any>  ::=
                    That is NOTHING, or white space.

   <where-list> ::= '(' '&' <where-list> <query-list> ')' |
                    '(' '|' <where-list> <query-list> ')' |
                    '(' <keyword> ')'
                    '(' <attr-tag> <comp-op> <attr-val> ')'

   <query-list> ::= <where-list> |
                    <where-list> <query-list>
   <query-join> ::= <keyword> |
                    <join-item> |
                    <query-join> ',' <keyword> |
                    <query-join> ',' <join-item>

   <join-item>  ::= <attr-tag> <comp-op> <attr-val>

   <comp-op>    ::= "!=" | "==" | '<' | "<=" | '>' | ">="

   <attr-val>   ::= any string (see Section 20.5 for the ways
                    in which attr-vals are interpreted.)
                    Value strings may not contain '/', ','
                    '=', '<', '>', or '*' except where escaped
                    (see 17.1.).

                    '(' and ')' may be used in attribute values
                     for the purpose of encoding a binary values.
                     Binary encodings (See 20.5) may
                     include the above reserved characters.

5.5. String Matching for Requests

   All strings are case insensitive, with respect to string matching on
   queries.  All preceding or trailing blanks should not be considered
   for a match, but blanks internal to a string are relevant.

   For example, "  Some String  " matches "SOME STRING", but not "some
Top   ToC   RFC2165 - Page 28
   String matching may only be performed over the same character sets.
   If a request cannot be satisfied due to a lack of support for the
   character set of the request a CHARSET_NOT_UNDERSTOOD error is

   String comparisons (using comparison operators such as '<' or
   registration, not using any language specific rules.  The ordering is
   strictly by the character value, i.e.  "0" < "A" is true when the
   character set is US-ASCII, since "0" has the value of 48 and "A" has
   the value 65.

   The special character '*' may precede or follow a string in order to
   allow substring matching.  If the '*' precedes a string, it matches
   any attribute value which ends with the string.  If the string ends
   with a '*', it matches any attribute value which begins with the
   string.  Finally, if a string begins and ends with a '*', the string
   will match any attribute value which contains the string.


        "bob*" matches "bob", "bobcat", and "bob and sue" "*bob" matches
        "bob", "bigbob", and "sue and bob" "*bob*" matches "bob",
        "bobcat", "bigbob", and "a bob I know"

   String matching is done after escape sequences have been substituted.
   See sections 17, 5.3, 17.1.

6. Service Reply Message Format

   The format of the Service Reply Message is:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |          Service Location header (function = SrvRply)         |
     |         Error Code            |         URL Entry count       |
     |                         <URL Entry 1> ...
     |                              .                                |
     \                              .                                \
     |                              .                                |
     |                         <URL Entry N> ...

   Each Service Reply message is composed of a list of URL Entries.
Top   ToC   RFC2165 - Page 29
   The Error Code may have one of the following values:

      0        Success

               A SA or DA returns this when a request is received from a
               UA which is in a language for which there is no
               registered Service Information and the request arrived
               with the Monolingual bit set.  See Section 17.

               A SA or DA returns this error when a SrvRply is received
               which cannot be parsed or the declared string lengths
               overrun the message.

               A DA will return this error if it receives a request
               which has a scope not supported by the DA. An SA will not
               return this error; it will simply not reply to the
               multicast request.

               If the DA or SA receives a request or registration in a
               character set which it does not support, it will return
               this error.

   Each <URL Entry> in the list has the form defined in Section 4.2.
   The URL entries in the reply have no delimiters between them, other
   than the length fields.  The URL length fields indicate where the URL
   strings end.  If the presence of an URL Authenticator block is
   signalled by the 'U' bit, the length of the authenticator block is
   determined by information within the block as discussed in section
   4.3.  A User Agent MAY use the authentication block to determine
   whether the Service Agent advertising the URL is, in fact, authorized
   to offer the indicated service.  If, in a list of URL entries, some
   of the URLs indicate services which are in protected scopes (see
   section 16.1) while other URLs in the list indicate services which
   are not in protected scopes, the latter must still have
   Authentication Blocks, but the length of the authentcitor is shown as
   zero, and no authentication need be done.

7. Service Type Request Message Format

   The Service Type Request is used to determine all the types of
   services supported on a network.
Top   ToC   RFC2165 - Page 30
   The request should be sent directly to a DA (though it may also be
   sent to the Service Location General Multicast Address), in order to
   find out all services available on the site network (which are
   advertised by Directory Agents and Service Agents.)  If no DA is
   available, a User Agent MAY issue more than one request to insure
   that all replies have been received.  In each subsequent request, a
   User Agent includes those Service Types that it is aware of.  When no
   new replies arrive within CONFIG_INTERVAL_3 from a request, the User
   Agent can presume that it has acquired a complete set of available
   Service Types.

   The format of a Service Type Request is:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |        Service Location header (function = SrvTypeRqst)       |
     |  length of prev resp string   |<Previous Responders Addr Spec>|
     |                                                               |
     \                  <Previous Responders Addr Spec>              \
     |                                                               |
     |   length of naming authority  |   <Naming Authority String>   |
     |                                                               |
     \            <Naming Authority String>, continued               \
     |                                                               |
     |     length of Scope String    |         <Scope String>        |
     |                                                               |
     \                   <Scope String>, continued                   \
     |                                                               |

   Note that the <Previous Responders Addr Spec> is a comma delimited
   list.  (See section 20.1.)  The 'length of prev responder list' field
   indicates the length of the comma delimited list string.  A previous
   responder list with 3 elements takes this form:

Top   ToC   RFC2165 - Page 31
   The Naming Authority, if included, will limit the replies to Service
   Type Requests to Service Types which have the specified Naming
   Authority.  If this field is omitted (i.e., the length field is
   zero), the default Naming Authority ("IANA") is assumed.  If the
   length field is -1, service types from all naming authorities are

   The Scope String Field, if included, will limit replies to Service
   Types which have the specified scope or are unscoped.  If this field
   is omitted, all Service Types (from the specified Naming Authority)
   are returned.

8. Service Type Reply Message Format

   The Service Type Reply has the following format:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |        Service Location header (function = SrvTypeRply)       |
     |          Error Code           |    number of service types    |
     |                                                               |
     \                     <Service Type Item 1>                     \
     |                                                               |
     |                             . . .                             |
     |                                                               |
     \                     <Service Type Item N>                     \
     |                                                               |

   The format of a Service Type Item is as follows:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     | length of Service Type String |     <Service Type String>     |
     |                                                               |
     \                 <Service Type String>, continued              \
     |                                                               |
Top   ToC   RFC2165 - Page 32
   The Error Code may have one of the following values:

      0        Success

               A SA or DA returns this error when a SrvTypeRqst is
               received which cannot be parsed.

               A DA which is configured to have a scope will return this
               error if it receives a SrvTypeRqst which is set to have a
               scope which it does not support.  An SA will not return
               this error, it will simply silently discard the multicast

               If the DA receives a SrvTypeRqst in a character set which
               it does not support, it MUST use this error.

   The service type's name is provided in the <Service Type String>.  If
   the service type has a naming authority other than "IANA" it should
   be returned following the service type string and a "." character.
   See section 20.2.1 for the formal definition of this field.  User
   Agents calculate Service Specific Multicast addresses based on a hash
   of the Service Type (see Section 3.6.2).  This multicast address may
   then be used for issuing Service and Attribute Requests directly to

   The following are examples of Service Type Strings which might be
   found in Service Type Replies:


9. Service Registration Message Format

   After a Service Agent has found a Directory Agent, it begins to
   register its advertised services one at a time.  A Service Agent must
   wait for some random time uniformly distributed within the range
   specified by CONFIG_INTERVAL_11 before registering again.
   Registration is done using the Service Registration message
   specifying all attributes for a service.  If the service registration
   in a protected scope 16.1, then the service MUST include both a URL
   Authentication block and an Attribute Authentication block (see
   section 4.3).  In that case, the service agent MUST set both the 'U'
   bit and the 'A' bit (see section 4).
Top   ToC   RFC2165 - Page 33
   A Directory Agent must acknowledge each service registration request.
   If authentication blocks are included, the Directory Agent MUST
   verify the authentication before registering the service.  This
   requires obtaining key information, either by preconfiguration,
   maintenance of a security association with the service agent, or
   acquiring the appropriate certificate.

   The format of a Service Registration is:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |           Service Location header (function = SrvReg)         |
     |                                                               |
     \                          <URL-Entry>                          \
     |                                                               |
     |  Length of Attr List String   |          <attr-list>          |
     |                                                               |
     \                    <attr-list>, Continued.                    \
     |                                                               |
     |    (if present) Attribute Authentication Block ...

   The <URL-Entry> is defined at the end of Section 4.2.  The <attr-
   list> is defined in Section 20.3.  The Attribute Authentication
   Block, which is only present if the 'A' bit is set in the message
   header, is defined in section 4.3.

   Service registration may use a connectionless protocol (e.g.  UDP),
   or a connection oriented protocol (e.g.  TCP). If the registration
   operation may contain more information than can be sent in one
   datagram, the Service Agent MUST use a connection oriented protocol
   to register itself with the DA. When a Service Agent registers the
   same attribute class more than once for a service instance, the
   Directory Agent overwrites the all the values associated with that
   attribute class for that service instance.  Separate registrations
   must be made for each language that the service is to be advertised

   If a SA attempts to register a service with a DA and the registration
   is larger than the site path MTU, then the DA will reply with a
   SrvAck, with the error set to INVALID_REGISTRATION and the 'Overflow'
   byte set.
Top   ToC   RFC2165 - Page 34
   An example of Service Registration information is:

      Lifetime (seconds):   16-bit unsigned integer
      URL (at least):       service:<srvtype>://<addr-spec>
      Attributes (if any):  (ATTR1=VALUE),KEYWORD,(ATTR2 = VAL1, VAL2)

   In order to offer continuously advertised services, Service Agents
   should start the reregistration process before the Lifetime they used
   in the registration expires.

   An example of a service registration (valid for 3 hours) is as

      Lifetime:   10800
      URL:        service:lpr://
      Attributes: (SCOPE=DEVELOPMENT),
                  (PAPER COLOR=WHITE),
                  (PAPER SIZE=LETTER),
                  (LANGUAGE=POSTSCRIPT, HPGCL),
                  (LOCATION=12 FLOOR)

   The same registration could be done again, as shown below, in German;
   however, note that "lpr", "service", and "SCOPE" are reserved terms
   and will remain in the language they were originally registered

      Lifetime:   10800
      URL:        service:lpr://
      Attributes: (SCOPE=ENTWICKLUNG),
                  (STANDORT=11 ETAGE)

   Scoped registrations must contain the SCOPE attribute.  Unscoped
   registrations must be registered with all unscoped Directory Agents.

   Registrations of a previously registered service are considered an
   update.  If such an attribute registration is performed in a
   protected scope (see section 16.1), a new Attribute Authentication
   block must also be included, and the 'A' bit set in the registration
   message header.

   The new registration's attributes replace the previous
   registration's, but do not effect attributes which were included
   previously and are not present in the update.
Top   ToC   RFC2165 - Page 35
   For example, suppose service:x:// has been registered with
   attributes A=1, B=2, C=3.  If a new registration comes for
   service:x:// with attributes C=30, D=40, then the attributes for
   the service after the update are A=1, B=2, C=30, D=40.

   In the example above, the SCOPE is set to DEVELOPMENT (in English)
   and ENTWICKLUNG (in German).  Recall that all strings in a message
   must be in one language, which is specified in the header.  The
   string SCOPE is *not* translated, as it is one of the reserved
   strings in the Service Location Protocol (see section 17.2.)

   The Directory Agent may return a server error in the acknowledgment.
   This error is carried in the Error Codes field of the service
   location message header.  A Directory Agent MUST decline to register
   a service if it is specified with an unsupported scope.  In this case
   a SCOPE_NOT_SUPPORTED error is returned in the SrvAck.  A Directory
   Agent MUST NOT accept Service Registrations which have an unsupported
   scope unless it is an unscoped Directory Agent, in which case it MUST
   accept all Service Registrations.

   An unscoped Service Registration will match all requests.  A request
   which specifies a certain scope will therefore return services which
   have that scope and services which are unscoped.  It is strongly
   suggested that one should use scopes in all registrations or none.
   See Sections 16 and 3.7 for details.

   When the URL entry accompanying a registration also contains an
   authentication block (section 4.3), the DA MUST perform the indicated
   authentication, and subsequently indicate the results in the Service
   Acknowledgement message.

10. Service Acknowledgement Message Format

   A Service Acknowledgement is sent as the result of a DA receiving and
   processing a Service Registration or Service Deregistration.  An
   acknowledgment indicating success must have the error code set to
   zero.  Once a DA acknowledges a service registration it makes the
   information available to clients.

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |            Service Location header (function = SrvAck)        |
     |          Error Code           |
Top   ToC   RFC2165 - Page 36
   The Error Code may have one of the following values:

      0        Success

               A DA returns this error when the SrvReg or SrvDereg is
               received which cannot be parsed or the declared string
               lengths overrun the message.

               A DA returns this error when a SrvReg or SrvDeReg is
               invalid.  For instance, an invalid URL, unknown or
               malformed attributes, or deregistering an unregistered
               service all cause this error to be reported.

               A DA which is configured to have a scope will return this
               error if it receives a SrvReq which is set to have a
               scope which it does not support.

               If the DA receives a SrvReg or SrvDereg in a character
               set which it does not support, it will return this error.

               If DA has been configured to require an authentication
               for any service registered in the requested scope, and
               there are no authentication blocks in the registration,
               the DA will return this error.

               If the registration contains an authentication block
               which fails to match the correct result as calculated
               (see section 4.3) over the URL or attribute data to be
               authenticated, the DA will return this error.

   If the Directory Agent accpets a Service Registration, and already
   has an existing entry, it updates the existing entry with the new
   lifetime information and possibly new attributes and new attribute
   values.  Otherwise, if the registration is acceptable (including all
   necessary authentication checks) the Directory Agent creates a new
   entry, and sets the 'F' bit in the Service Acknowledgement returned
   to the Service Agent.
Top   ToC   RFC2165 - Page 37
11. Service Deregister Message Format

   When a service is no longer available for use, the Service Agent must
   deregister itself from Directory Agents that it has been registered
   with.  A service uses the following PDU to deregister itself.

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |           Service Location header (function = SrvDereg)       |
     |         length of URL         |              URL              |
     |                                                               |
     \              URL of Service to Deregister, contd.             \
     |                                                               |
     |             (if present) authentication block .....
     |  length of <tag spec> string  |            <tag spec>         |
     |                                                               |
     \                     <tag spec>, continued                     \
     |                                                               |

   The Service Agent should retry this operation if there is no response
   from the Directory Agent.  The Directory Agent acknowledges this
   operation with a Service Acknowledgment message.  Once the Service
   Agent receives an acknowledgment indicating success, it can assume
   that the service is no longer advertised by the Directory Agent.  The
   Error Code in the Acknowledgment of the Service Deregistration may
   have the same values as described in section 10.

   The Service Deregister Information sent to the directory agent has
   the following form:

        Attribute tags (if any):  ATTR1,KEYWORD,ATTR2

   This will deregister the specified attributes from the service
   information from the directory agent.  If no attribute tags are
   included, the entire service information is deregistered in every
   language and every scope it was registered in.  To deregister the
   printer from the preceding example, use:

Top   ToC   RFC2165 - Page 38
   If the service was originally registered with a URL entry containing
   a URL authentication block, then the Service Deregistration message
   header MUST have the 'U' bit set, and the URL entry is then followed
   by the authentication block, with the authenticator calculated over
   the URL data, the timestamp, and the length of the authenticator as
   explained in section 4.3.  In this calculation, the lifetime of the
   URL data is considered to be zero, no matter what the current value
   for the remaining lifetime of the registered URL.

12. Attribute Request Message Format

   The Attribute Request is used to obtain attribute information.  The
   UA supplies a request and the appropriate attribute information is

   If the UA supplies only a Service Type, then the reply includes all
   attributes and all values for that Service Type.  The reply includes
   only those attributes for which services exist and are advertised by
   the DA or SA which received the Attribute Request.  Since different
   instances of a given service can, and very likely will, have
   different values for the attributes defined by the Service Type, the
   User Agent must form a union of all attributes returned by all
   service Agents.  The Attribute information will be used to form
   Service Requests.

   If the UA supplies a URL, the reply will contain service information
   corresponding to that URL.

   Attribute Requests include a 'select clause'.  This may be used to
   limit the amount of information returned.  If the select clause is
   empty, all information is returned.  Otherwise, the UA supplies a
   comma delimited list of attribute tags and keywords.  If the
   attribute or keyword is defined for a service, it will be returned in
   the Attribute Reply, along with all registered values for that
   attribute.  If the attribute selected has not been registered for
   that URL or Service Type, the attribute or keyword information is
   simply not returned.
Top   ToC   RFC2165 - Page 39
   The Attribute Request message has the following form:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |         Service Location header (function = AttrRqst)         |
     |length of prev resp list string|<Previous Responders Addr Spec>|
     |                                                               |
     \         <Previous Responders Addr Spec>, continued            \
     |                                                               |
     |         length of URL         |              URL              |
     |                                                               |
     \                         URL, continued                        \
     |                                                               |
     |        length of <Scope>      |           <Scope>             |
     |                                                               |
     \                      <Scope>, continued                       \
     |                                                               |
     |   length of <select-list>     |        <select-list>          |
     |                                                               |
     \                   <select-list>, continued                    \
     |                                                               |

   The <Previous Responder Address List> functions exactly as introduced
   in Section 7.  See also Section 20.1.

   The URL can take two forms:  Either it is simply a Service Type, such
   as "service:http:", or it can be a URL, such as
   "service:lpr://".  In the former case, all
   attributes and the full range of values for each attribute for the
   Service Type is returned.  In the latter case, only the attributes
   for the service whose URL is defined are returned.

   The Scope String is provided so that Attribute Requests for Service
   Types can be made so that only the Attribute information pertaining
   to a specific scope will be returned.  This field is ignored in the
   case when a full URL is sent in the Attribute Request.  The rules for
   encoding of the Scope String are given in Section 5.4.
Top   ToC   RFC2165 - Page 40
   The select list takes the form:

    <select-list>  ::= <select-item> |
                       <select-item> ',' <select-list>

    <select-item>  ::= <keyword> | <attr-tag> | <partial-tag> '*'

    <partial-tag>  ::= the partial class name of an attribute
                       If followed by an '*', it matches all class names
                       which begin with the partial tag.  If preceded by
                       a partial tag.  If both preceded and followed by
                       '*' it matches all class names which contain the
                       partial tag.

   For definitions of <attr-tag> and <keyword> see 5.4.

   An example of a select-list following the printer example is:


   If sent to a Directory Agent, the number of previous responders is
   zero and there are no Previous Responder Address Specification.
   These fields are only used for repeated multicasting, exactly as for
   the Service Request.

13. Attribute Reply Message Format

   An Attribute Reply Message takes the form:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |         Service Location header (function = AttrRply)         |
     |         Error Code            |  length of <attr-list> string |
     |                                                               |
     \                          <attr-list>                          \
     |                                                               |

   The Error Code may have the following values:

      0        Success
Top   ToC   RFC2165 - Page 41
               A SA or DA returns this when a request is received from a
               UA which is in a language for which there is no
               registered Service Information and the request arrived
               with the Monolingual bit set.  See Section 17.

               A DA or SA returns this error when a AttrRqst is received
               which cannot be parsed or the declared string lengths
               overrun the message.

               A DA which is configured to have a scope will return this
               error if it receives an AttrRqst which is set to have a
               scope which it does not support.  SAs will silently
               discard multicast AttrRqst messages for scopes they do
               not support.

               If the DA receives an AttrRqst in a character set which
               it does not support, it will return this error.  SAs will
               silently discard multicast AttrRqst messages which arrive
               using character sets they do not support.

   The <attr-list> (attribute list) has the same form as the attribute
   list in a Service Registration, see Section 20.3 for a formal
   definition of this field.

   An Attribute Request for "lpr" might elicit the following reply
   (UNRESTRICTED_ACCESS is a keyword):

         (PAGES PER MINUTE=1,3,12),

   If the message header has the 'A' bit set, the Attribute Reply will
   have an Attribute Authentication block set.  In this case, the
   Attribute Authenticator must be returned with the entire list of
   attributes, exactly as it was registered by an SA in a protected
   scope.  In this case, the URL was registered in a protected scope and
   the UA included a URL but not a select clause.  If the AttrRqst
   specifies that only certain attributes are to be returned, the DA
   does not (typically cannot) compute a new Authenticator so it simply
   returns the attributes without an authenticator block.
Top   ToC   RFC2165 - Page 42
   A UA which wishes to obtain authenticated attributes for a service in
   a protected scope MUST therefore must include a particular URL and no
   select list with the AttrRqst.

14. Directory Agent Advertisement Message Format

   Directory Agent Advertisement Messages have the following format:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     |          Service Location header (function = DAAdvert)        |
     |           Error Code          |         Length of URL         |
     |                                                               |
     \                              URL                              \
     |                                                               |
     |     Length of <Scope-list>    |          <Scope-list>         |
     |                                                               |
     \                    <Scope-list>, continued                    \
     |                                                               |

   The Error Code is set when a DA Advertisement is returned as the
   result of a Service Request.  It will always be set to 0 in the case
   of an unsolicited DA Advertisement.  The Error Code may take the
   values specified in Section 6.

   The URL corresponds to the Directory Agent's location.  The <Scope-
   list> is a comma delimited list of scopes which the DA supports, in
   the following format:

         <Scope-list>    ::=    <Scope> | <Scope-list> ',' <Scope>
         <Scope>         ::=    String representing a scope

   See Section 5.4 for the lexical rules regarding <Scope>.

   DA Advertisements sent in reply to a Directory Agent Discovery
   Request has the same format as the unsolicited DA Advertisement, for

      URL:        service:directory-agent://SLP-RESOLVER.CATCH22.COM
      SCOPE List: ADMIN
Top   ToC   RFC2165 - Page 43
   The Directory Agent can be reached at the Address Specification
   returned, and supports the SCOPE called "ADMIN".

15. Directory Agents

15.1. Introduction

   A Directory Agent acts on behalf of many Service Agents.  It acquires
   information from them and acts as a single point of contact to supply
   that information to User Agents.

   The queries that a User Agent multicasts to Service Agents (in an
   environment without a Directory Agent) are the same as queries that
   the User Agent might unicast to a Directory Agent.  A User Agent may
   cache information about the presence of alternate Directory Agents to
   use in case a selected Directory Agent fails.

   Aside from enhancing the scalability of the protocol (see section
   3.7), running multiple DAs provides robustness of operation.  The DAs
   may have replicated service information which remain accessible even
   when one of the DAs fail.  Directory Agents, in the future, may use
   mechanisms outside of this protocol to coordinate the maintenance of
   a distributed database of Service Location information, and thus
   scale to enterprise networks or larger administrative domains.

   Each Service Agent must register with all DAs they are configured to
   use.  UAs may choose among DAs they are configured to use.

   Locally, Directory Agent consistency is guaranteed using mechanisms
   in the protocol.  There isn't any Directory to Directory Agent
   protocol yet.  Rather, passive detection of DAs by SAs ensures that
   eventually service information will be registered consistently
   between DAs.  Invalid data will age out of the Directory Agents
   leaving only transient stale registrations even in the case of a
   failure of a Service Agent.

15.2. Finding Directory Agents

   A User or Service Agent may be statically configured to use a
   particular DA. This is discouraged unless the application resides on
   a network where any form of multicast or broadcast is impossible.

   Alternatively, a host which uses DHCP [2, 11] may use it to obtain a
   Directory Agent's address.  DHCP options 78 and 79 have been assigned
   for this purpose [21].

   The third way to discover DAs is dynamically.  This is done by
   sending out a Directory Agent Discovery request (see Section 5.2).
Top   ToC   RFC2165 - Page 44
   Lastly, the agent may be informed passively as follows:

   When a Directory Agent first comes on-line it sends an unsolicited DA
   Advertisement to the Service Location general multicast address.  If
   a DA supports a particular scope or set of scopes these are placed in
   the reply.  The class for this attribute is 'SCOPE'.

   Every CONFIG_INTERVAL_9 a Directory Agent will send an unsolicited DA
   Advertisement.  This will ensure that eventually it will be
   discovered by all applications which are concerned.

   When a Directory Agent first comes up it begins with 0 as its XID,
   and increments this by one each time it sends an unsolicited DA
   Advertisement.  When the counter wraps, it should go from 0xFFFF to
   0x0100, not 0.

   If the Directory Agent has stored all of the service information in a
   nonvolatile store, it should initially set the XID to 0x100, as it is
   not coming up 'stateless.'  If it stores service registrations in
   memory only, it will restart without any state.  It should indicate
   this by resetting its XID to 0.

   All Service Agents which receive the unsolicited DA Advertisement
   should examine its XID. If the Directory Agent has never before been
   heard from or if the XID is less than it was previously and less than
   256, the Service Agent should assume the DA does not have its service
   registration, even if it once did.  If this is the case and the DA
   has the proper scope, the SA should register all service information
   with the Directory Agent, after waiting a random interval

   When a Service Agent or User Agent first comes on-line it must issue
   a Directory Agent Discovery Request unless it is using static or DHCP
   configuration, as described in 5.2.

   A Service Agent registers information with ALL newly discovered
   Directory Agents when either of the above two events take place.
   When scopes are being used, a Service Agent SHOULD choose a set of
   scopes to be advertised in and need only register with Directory
   Agents that support the scopes in which they wish to be registered.
   Services MUST be registered with DAs that support their scope and
   those which have no scope, unless specifically configured not to do
   so (see section 22.1.)
Top   ToC   RFC2165 - Page 45
   Once a User Agent becomes aware of a Directory Agent it will unicast
   its queries there.  In the event that more than one Directory Agent
   is detected, it will select one to communicate with.  When scopes are
   supported, the User Agent will direct its queries to different
   Directory Agents depending on which scopes are appropriate domains
   for the query to be answered in.

   The protocol will cause all DAs (of the same scope) to eventually
   obtain consistent information.  Thus one DA should be as good as any
   other for obtaining service information.  There may be temporary
   inconsistencies between DAs.

16. Scope Discovery and Use

   The scope mechanism in the Service Location Protocol enhances its
   scalability.  The primary use of scopes is to provide the capability
   to organize a site network along administrative lines.  A set of
   services can be assigned to a given department of an organization, to
   a certain building or geographical area or for a certain purpose.
   The users of the system can be presented with these organizational
   elements as a top level selection, before services within this domain
   are sought.

   A site network that has grown beyond a size that can be reasonably
   serviced by a few DAs can use the scope mechanism.  DAs have the
   attribute class "SCOPE".  The values for this attribute are a list of
   strings that represent the administrative areas for which this
   Directory Agent is configured.  The semantics and language of the
   strings used to describe the scope are almost entirely the choice of
   the administrative entity of the particular domain in which these
   scopes exist.  The values of SCOPE should be configurable, so the
   system administrator can set its value.  The scopes "LOCAL" and
   "REMOTE" are reserved and SHOULD NOT be used.  Use of these reserved
   values is to be defined in a future protocol document.

   Services with the attribute SCOPE should only be registered with DAs
   which support the same scope or DAs which have no scope.

   Directory Agents advertise their available scopes.  A Service Agent
   may then choose a scope in which to register, and SHOULD register
   with all Directory Agents in that scope, as well as all DAs which
   have no scope.  Failure to be comprehensive in registration according
   to this rule will mean that the service advertisement may not be
   available to all User Agents.
Top   ToC   RFC2165 - Page 46
   A Directory Agent which has a scope will return advertisements in
   response to Directory Agent Discovery requests with the scope
   information included.  Note that the "service:directory-agent" scheme
   is registered with the IANA naming authority (which is automatically
   selected by leaving the Naming Authority field empty.)

   The query:

         directory-agent/MATH DEPT//

   Could receive the following DA Advertisement:

      Returned URL:        service:directory-agent://
      Returned SCOPE:      MATH DEPT

   The same Directory Agent if it had no scope value would reply:

      Returned URL:        service:directory-agent://
      Returned SCOPE:

   If a Directory Agent supported more than one scope it would reply as:

      Returned URL:        service:directory-agent://

   A DA which has no scope will reply to any Directory Agent Discovery

   Being a member of a scope means that an agent SHOULD use those
   Directory Agents that support its scope.  User Agents send all
   requests to DAs which support the indicated scope.  Services are
   registered with the DA(s) in their scope.  For a UA to find a service
   that is registered in a particular scope it must send requests to a
   DA which supports the indicated scope.  There is no limitation on
   scope membership built into the protocol; that is to say, a User
   Agent or Service Agent may be a member of more than one scope.
   Membership is open to all, unless some external authorization
   mechanism is added to limit access.

16.1. Protected Scopes

   Scope membership MAY also define the security access and
   authorization for services in the scope; such scopes are called
   protected scopes.  If a User Agent wishes to be sure that Service
   Agents are authorized to provide the service they advertise, then the
   User Agent should request services from a protected scope which has
   been configured to have the necessary authentication mechanism and
   keys distributed to the Service Agents within the scope.  A directory
Top   ToC   RFC2165 - Page 47
   agent distributing URLs for services in a protected scope will reject
   any registrations or deregistrations for service agents which cannot
   provide cryptographically strong authentication to prove their
   authorization to provide the services.

   For instance, if a campus registrar wishes to find a working printer
   to produce student grade information for mailing, the registrar would
   require the printing user agent to transmit the printable output only
   to those printing Service Agents which have been registered in the
   appropriate protected scope.  Notice that each service agent is,
   under normal circumstances, validated two times:  once when
   registering with the directory agent, and once when the user agent
   validates the URL received with the Service Reply.  This protects
   against the possibilities of malicious Directory Agents as well as
   malicious Service Agents.

   Note that services in protected scopes provide separate
   authentication for their URL entry, and for their attributes.  This
   follows naturally from the needs of the protocol operation.  User
   Agents which specify a service type and attributes needed for service
   in that service type will not receive attribute information from the
   directory agent; they will only receive the appropriate URL entries.
   Only the information returned needs to be authenticated.

   User agents which receive attribute information for a particular URL
   (see section 12), on the other hand, need to authenticate the
   attributes when they are returned (see section 13).  In this case,
   there may be much more data to authenticate, but this operation is
   also performed much less often, usually only while the user is
   browsing the available network resources.

17. Language and Character Encoding Issues

   All Service Registrations declare the language in which the strings
   in the service attributes are written by specifying the appropriate
   code in the message header.  For each language the Service advertises
   a separate registration takes place.  Each of these registrations
   uses the same URL to indicate that they refer to the same service.

   If a Service is fully deregistered (the URL is given in the Service
   Deregister request, without any attribute information) then the
   Service needs to be deregistered only once.  This will effectively
   deregister the service in all languages it has been registered in.
Top   ToC   RFC2165 - Page 48
   If, on the other hand, attribute information is included in the
   Service Deregistration request, a separate Service Deregistration of
   selected attributes must be undertaken in each language in which
   service information has been provided to the DA by a Service Agent.
   Service Registrations in different languages are mutually
   unintelligible.  They share no information except for their service
   type and URL with which they were registered.  No attempt is made to
   match queries with "language independence." Instead, queries are
   handled using string matching against registrations in the same
   language as the query.

   Service Types which are standardized will have definitions for all
   attributes and value strings.  Official translations to other
   languages of the attribute tags and values may be created and
   submitted as part of the standard; this is not feasible for all
   languages.  For those languages which are not defined as part of the
   Service Type, a best effort translation of the standard definitions
   of the Service type's attribute strings MAY be used.

   All Service Requests specify a requested language in the message
   header.  The Directory Agent or Service Agent will respond in the
   same language as the request, if it has a registration in the same
   language as the request.  If this language is not supported, and the
   Monolingual bit is not specified, a reply can be sent in the default
   language (which is English.)  If the 'monolingual bit' flag in the
   header is set and the requested language is not supported, a SrvRply
   is returned with the error field set to LANGUAGE_NOT_SUPPORTED.

   If a query is in a supported language on a SA or DA, but has a
   different dialect than the available service information, the query
   MUST be serviced on a best-effort basis.  If possible, the query
   should be matched against the same dialect.  If that is not possible,
   it MAY be matched against any dialect of the same language.

17.1. Character Encoding and String Issues

   Values for character encoding can be found in IANA's database
   and have the values referred by the MIBEnum value.

   The encoding will determine the interpretation of all character data
   which follows the Service Location Protocol header.  There is no way
   to mix ASCII and UNICODE, for example.  All responses must be in the
   character set of the request, or use US-ASCII. If a request is sent
   to a DA or SA or a registration is sent to a DA, which is unable to
   manipulate or store the character set of the incoming message, the
   request will fail.  The SA or DA returns a CHARSET_NOT_UNDERSTOOD
   error in a SrvAck message in this case.  Requests using US-ASCII will
Top   ToC   RFC2165 - Page 49
   never fail for this reason, since all SAs and DAs must be able to
   accept this character set.

   Certain characters are illegal in certain contexts of the protocol.
   Since the protocol is largely character string based, in some
   contexts characters are used as protocol delimiters.  In these cases
   the delimiting characters must not be used as 'data text.'

17.1.1. Substitution of Character Escape Sequences

   The Service Location Protocol has an 'escape mechanism' which is
   consistent with HTTP 2.0 [5] and SGML [15].  If the character
   sequence "&#" is followed by one or more digits, followed by a
   semicolon ';' the entire sequence is interpreted as a single
   character.  The digits are interpreted as a decimal value in the
   character set of the request, as specified by the header.  Thus, in
   US-ASCII &#44; would be interpreted as a comma.  Substitution of
   these escape strings must be done in all <attr-list> and strings
   present in SrvReq and AttrRqst messages.  Only numerical character
   references are accepted, not 'Entity References,' as defined in HTML.
   These escape values should only be used to provide a mechanism for
   including reserved characters in attribute tag and value strings.

   The interpretation of these escape values is different than in HTML
   in one respect:  In HTML the escape values are considered to be in
   the ISO Latin-1 character set.  In Service Location they are
   interpreted in the character set defined in the header of the

   This escape mechanism allows characters like commas to be included in
   attribute tags and values, which would otherwise be illegal as the
   comma is a protocol delimiter.

   Attribute tags and values of different languages are considered to be
   mutually unintelligible.  A query in one language SHOULD use service
   information registered in that language.

17.2. Language-Independent Strings

   Some strings, such as Service Type names, have standard definitions.
   These strings should be considered as tokens and not as words in a
   language to be translated.
Top   ToC   RFC2165 - Page 50
    Reserved String Section xDefinition
    --------------- ------- --------------------------------------
    SCOPE           3, 15   Used to limit the matching of requests.
    SERVICE         6, 9    The URL scheme of all Service Location
                            information registered with a DA or
                            returned from a Service Request.
    <srvtype>       20.2.1  Used in all service registrations
                            and replies.
    domain names    20.4    A fully qualified domain name, used
                            in registrations and replies.
    IANA            3.3     The default naming authority.
    LOCAL           16      Reserved.
    REMOTE          16      Reserved.
    TRUE            20.5    Boolean true.
    FALSE           20.5    Boolean false.

(page 50 continued on part 3)

Next Section