RFC 3421 (rfc3421) - Page 3 of 8


Select and Sort Extensions for the Service Location Protocol (SLP)



Alternative Format: Original Text Document



RFC 3421           Select and Sort Extensions for SLP      November 2002


3. Sort Extension

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Sort Extension ID = 0x4003   |  Next Extension Offset (NEO)  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | NEO, cont'd   |   length of    |\
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Figure 2. Sort Extension

   The format of the Sort extension is shown in Figure 2.  A UA uses
   this extension in a SrvRqst to request the URL entries in the
   corresponding SrvRply be sorted according to the sort-key-list. The
   sort-key-list is defined using Augmented Backus-Naur Form (ABNF)
   [RFC 2234] as follows:

   sort-key-list  = sort-key / sort-key "," sort-key-list
   sort-key       = key-name ":" type ":" ordering [":" ref-value]
   key-name       = attr-tag from Section 5 of RFC 2608
   type           = "s" / "i"
                    ; "s" for string type
                    ; "i" for integer type
   ordering       = "+" / "-"
                    ; "+" for increasing order
                    ; "-" for decreasing order
   ref-value      = intval from Section 5 of RFC 2608

   Each sort-key in the sort-key-list has a key-name, a type specifier,
   an ordering specifier, and an optional reference value.  The key-name
   MUST be a valid attribute name, and its type is explicitly specified.
   Although SLP has five attribute types (integer, string, boolean,
   opaque and keyword), we only consider integer sort and string sort
   since keyword attributes (they have no values) never need to be
   sorted, and boolean and opaque attributes can be sorted as strings if
   needed.  The integer sort uses the integerOrderingMatch rule defined
   in X.520 [X520], whereas the string sort is performed based on
   lexical ordering.  Strings are compared using the rules defined in
   Section 6.4 of RFC 2608.

   Only integer keys may have a reference value, causing the sort to be
   based on the distance to the reference value.  A reference-based
   sort, such as "X:i:+:12", requires the following two steps:

   Step 1. For each matching service, if its attribute X has a value of
           x, then use |x-12| as its metric.




Zhao, et. al.                 Experimental