Skip to end of metadata
Go to start of metadata
The LiveTribe :: SLP Module

Introduction to SLP attributes

SLP allows to specify attributes for a service.
In SLP, an attribute is a key-value pair (the key is called tag) that adds information to the service itself. A set of attributes thus describes the service.
This additional information can be, for example, displayed to users, or can be used by SLP UserAgents to filter out services that do no match certain attribute expressions.

The attribute tag must always be present, and it's always a string.

The attribute value can be:

  • not present: only the tag is present (for example 'secure')
  • single valued: only one value is present (for example 'hostAddress=192.168.0.1')
  • multi valued: multiple values are present in a comma separated list (for example 'saslMechanisms=PLAIN,DIGEST-MD5,KERBEROS_V5')

The attribute value types can be:

  • boolean, whose value can only be "true" or "false" (for example 'supportsConfidentiality=true')
  • integer, whose value are in the range of Java integers (for example 'quality=5')
  • string, whose value can be localized (for example 'description=Servizio Molto Importante' or 'description=Very Important Service')
  • opaque, a list of bytes that always starts with \FF (for example 'digest=\FF\00\01\02', where the tag digest is a byte array of length 3 containing byte 0, byte 1 and byte 2)

Attribute values can be escaped if they contain reserved characters (the reserved characters are: ( ) , \ ! < = > ~ and all the ASCII control characters, i.e. from ASCII code 0 to 31 included) using the escape sequence '\' HEXDIG HEXDIG, where the two HEXDIGs are the exadecimal representation of the character/byte in question.
For example, if your service denote a parsing service, one attribute can be 'separator=\2C', which denotes that the value of the separator tag is the comma (since 2C exadecimal is 44 decimal, which is the ASCII code for the comma, which is a reserved character).

Attributes can be specified as a string, where each attribute is enclosed in parenthesis:

(integers=1,2),(present),(description=string),(condition=true),(bytes=\FF\CA\FE\BA\BE)

Service Templates

The entity that defines a ServiceType, such as "service:jmx", should also define a list of attributes that describe that service type.
In the JMX case, the JMX expert group defined few attributes, among which:

Tag

Type

MultiValued

Required

Description

AgentName

string

no

yes

A logical name for the JMX Agent

ProtocolType

string

no

no

The connector protocol

AgentHost

string

yes

no

The list of IP addresses on which the JMX Agent is running

SLP specifies that other attributes can be added, even if they don't appear in the service template for the exposed service type; in that case, it is suggested that the tag name begins with 'x-', because, by convention, no attribute defined by the service template begins with those characters.

Attribute expressions

UserAgent can find services not only by their service type (the most common case), but also specifying an expression that is evaluated against the service attributes.
The syntax of this expression follows the LDAPv3 search filter syntax, which is ugly but simple (wink)

The expression A and B is written as:

(&(A)(B))

The expression A or B is written as:

(|(A)(B))

The expression not A is written as:

(!(A))

Operands are the usual ones: = for equal to, != for not equal to, > for greater than, >= for greater than or equal to, < for less than, <= for less than or equal to.

Globbing is supported only using the * operator, with the usual meaning of 'any number of characters'.

Expression examples:

(&(name=Foo)(quality<5))

means name=Foo and quality<5.

(&(name=F*o)(|(quality<5)(secure=*))

means any name starting with 'F' and ending with 'o' and (quality<5 or attribute secure present)

Code Examples

Advertising a service with attributes

Discovering a service using attribute filter
Labels: