to as “devices”. The role a machine has can be different per context. For example,
a machine that is normally a “control point” (for example a file server) can be a
“device” if it needs to have ports opened up in the firewall dynamically. The terms
that are used in UPnP documentation are a bit ambiguous.
A control point can implement more than one profile. Many profiles only serve
as containers for other profiles, or as an abstraction for other profiles, similar to
interfaces or abstract classes in object oriented programming languages. These
profiles are commonly called “subprofiles”. The Internet Gateway Device profile
is a container for a few other profiles. It is mandatory for the Internet Gateway
Device profile to implement WANDevice, which in turn has to have at least one
WANConnection. A control point which implements Internet Gateway Device can
also implement other subprofiles, such as LANDevice.
The WANConnection profile is an example of an abstraction. It is never directly
implemented itself, but it is “instantiated” by implementing WANPPPConnection,
which is often used for DSL routers, or WANIPConnection, common for normal
routers or wireless gateways.
3.2 Protocol design
In UPnP there are a few steps that every device goes through, or can go through.
Some of these steps are mandatory, others are used depending on what role a device
has.
3.2.1 Step 0: Addressing
The first (or actually, zeroth) step in UPnP is addressing. This step is performed
when a device is connected to a network. If it cannot obtain an IP address via
DHCP, because a DHCP server is absent, it will assign an IP address to itself
and try to determine if the IP address is unused. The address is chosen from the
169.254/16 range. If the address is in use, the device will try to assign another
IP address until it has obtained an IP address that it can use. This is often called
“auto-addressing”. The underlying thought is that this way devices can organise
the network themselves without having to rely on a central control point, like a
DHCP server, or a system administrator that assigns IP addresses.
This “auto-addressing” technique is not unique to UPnP. Other protocols, such as
IETF ZeroConf, use similar techniques. Some Linux distributions, like Fedora Core
3 and Fedora Core 4, also include default routes for the 169.254/16 network in
their network configuration.
Even in a network which uses a DHCP server some UPnP devices will sometimes
still send packets using one of the IP addresses in the 169.254/16 range. The
Alcatel Speedtouch 510 ADSL router sends UPnP notification messages (see step
1) using an IP address in this range.
3.2.2 Step 1: Discovery
When a machine joins a network and wants to know what UPnP services are avail-
able on the network, it sends out a discovery message to 239.255.255.250 on port
1900 via UDP. This message contains a header, similar to a HTTP request:
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
Komentáře k této Příručce