Service Location Protocol


The Service Location Protocol is a service discovery protocol that allows computers and other devices to find services in a local area network without prior configuration. SLP has been designed to scale from small, unmanaged networks to large enterprise networks. It has been defined in RFC 2608 and RFC 3224 as standards track document.

Overview

SLP is used by devices to announce services on a local network. Each service must have a URL that is used to locate the service. Additionally it may have an unlimited number of name/value pairs, called attributes. Each device must always be in one or more scopes. Scopes are simple strings and are used to group services, comparable to the network neighborhood in other systems. A device cannot see services that are in different scopes.
The URL of a printer could look like:
service:printer:lpr://myprinter/myqueue
This URL describes a queue called "myqueue" on a printer with the host name "myprinter". The protocol used by the printer is LPR. Note that a special URL scheme "service:" is used by the printer. "service:" URLs are not required: any URL scheme can be used, but they allow you to search for all services of the same type regardless of the protocol that they use. The first three components of the "service:" URL type are also called service type. The first two components are called abstract service type. In a non-"service:" URL the schema name is the service type.
The attributes of the printer could look like:
,
,
,
,
,

The example uses the standard syntax for attributes in SLP, only newlines have been added to improve readability.
The definition of a "service:" URL and the allowed attributes for the URL are specified by a service template, a formalized description of the URL syntax and the attributes. Service templates are defined in RFC 2609.
SLP allows several query types to locate services and obtain information about them:
SLP has three different roles for devices. A device can also have two or all three roles at the same time.
Today most implementations are daemons that can act both as UA and SA. Usually they can be configured to become a DA as well.

Network protocol

SLP is a packet-oriented protocol. Most packets are transmitted using UDP, but TCP can also be used for the transmission of longer packets. Because of the potential unreliability of UDP, SLP repeats all multicasts several times in increasing intervals until an answer has been received.
All devices are required to listen on port 427 for UDP packets, SAs and DAs should also listen for TCP on the same port. Multicasting is used extensively by SLP, especially by devices that join a network and need to find other devices.
The operation of SLP differs considerably, depending on whether a Directory Agent is in the network or not. When a client first joins a network it multicasts a query for DAs on the network. If no DA answers it will assume that it is in a network without DAs. It is also possible to add DAs later, as they multicast a 'heartbeat' packet in a predefined interval that will be received by all other devices. When an SA discovers a DA, it is required to register all services at the DA. When a service disappears the SA should notify the DA and unregister it.
In order to send a query in a network without a DA, the UA sends a multicast UDP packet that contains the query. All SAs that contain matches will send a UDP answer to the UA. If the answer is too large to fit into a single UDP packet, the packet will be marked as "overflown" and the UA is free to send the query directly to the SA using TCP, which can transmit packets of any size.
In order to send a query in a network with a DA, the UA will send the query packet to the DA using either UDP or TCP. As every SA must register all services with the DA, the DA is able to fulfill the request completely and simply sends the result back to the UA.

Security

SLP contains a public-key cryptography based security mechanism that allows signing of service announcements. In practice it is rarely used: