simple-ssdp 0.1.0

A SSDP implementation
Documentation
  • Coverage
  • 87.5%
    21 out of 24 items documented0 out of 13 items with examples
  • Size
  • Source code size: 46.59 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.94 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 28s Average build duration of successful builds.
  • all releases: 28s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • MrFastDie/simple-ssdp
    1 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MrFastDie

SSDP

This is an implementation of the RFC draft from SSDP. However, it should be mostly compatible with the newer UPnP

Feel free to contribute at any point.

Planned features

  • Send M-SEARCH request
  • Answer M-SEARCH request
  • Store a list of all services answering M-SEARCH
  • Send ALIVE when service comes up
  • Send BYEBYE when service goes down
  • Accept header in any order (right now only headers in a pre-defined order are working)

Examples

Service

To launch a Service that listens and answers to M-SEARCH requests do:

let desc = ServiceDescription {
    usn_uri: "uuid:83760048-2d32-4e48-854f-f63a8fa9fd09".to_string(), // TODO get from db
    service_type_uri: "AccessTime:Multicast".to_string(),
    expiration: 100,
    location: "https://127.0.0.1/api/v1/adopt".to_string(), // TODO get a servername from conf
};

let service = Service::new(desc);
service.listen(MulticastAddr::Loopback).await;

Client

A client sends a M-SEARCH request and stores a list of all answering services.

let log = LogConfig{
    syslog_server: None,
    syslog_port: None,
    syslog_protocol: None,
    log_level: Some("trace".to_string()),
};

log.initialize_logger();

let client = Client::default();

client
    .discover("uuid:83760048-2d32-4e48-854f-f63a8fa9fd09".to_string(), MulticastAddr::Loopback, "AccessTime:Multicast".to_string())
    .await?;

Now you can fetch a Vec<ServiceDescription> with all answering services using client.get_services()

License

To be fair this is just a setup I need for another project so feel free to do whatever you like with this. So feel free to choose between:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.