[][src]Crate upnp_rs

This crate implements the communication components of the UPnP Device Architecture (UDA), specifically the search and notification functions of the Simple Service Discovery Protocol (SSDP). It also provides support for device description elements from the Service Control Protocol Description (SCPD), superceded by General Event Notification Architecture (GENA).

The UDA covers the search for devices by a control point (client) as well as how devices respond with, and proactively advertise, capabilities. There are currently 3 versions of the UDA specification, v1.0, v1.1 (also standardized as ISO/IEC 29341-1-1), and v2.0.

For more information see the specifications and other documents at Open Connectivity Foundation.

The main interface is the ssdp module.

Example

The following example issues a single v1.0 multicast search and collects and returns a set of device responses.

use upnp::SpecVersion;
use upnp::ssdp::search::*;

let mut options = Options::default_for(SpecVersion::V10);
options.search_target = SearchTarget::RootDevices;

match search_once(options) {
    Ok(responses) => {
        println!("search returned {} results.", responses.len());
        for (index, response) in responses.iter().enumerate() {
            println!("{}: {:#?}", index, response);
        }
    }
    Err(error) => {
        println!("search failed with error: {:#?}", error);
    }
}

Documentation

Where possible any documentation for fields, functions, and values will be taken directly from the UDA specifications. In general the description will be taken from the version of the specication where the component in question was first introduced.

Modules

ssdp

This module implements the Simple Service Discovery Protocol (SSDP) specified components.

Enums

Error

This provides a common error type across the stack.

MessageErrorKind

This denotes the classes of errors that can arise while processing messages.

SpecVersion

This denotes the version of the UPnP Device Architecture (UDA) specification to use for a given interaction.

Constants

UPNP_STRING

The protocol short form identifier used in constructing numerous values.