Git Product home page Git Product logo

lsdp's Introduction

LSDP (Lenbrook Service Discovery Protocol) in Rust

You've probably never heard about this protocol. Neither had I before implementing it. Lenbrook Group is the manufacturer behind brands like Bluesound, NAD etc. and have in their infinte wisdom decided that instead of leveraging the multitude of avaliable service discovery protocols out there, they would write their own.

Now why would a manufacturer forego using established standards like mDNS or SSDP? Lenbrook claims it's because their customers lack the ability to configure their networks. Maybe if their customer didn't buy "audiophile" garbage routers this would be less of a problem but here we are.

The protocol is basically a worse version of mDNS over UDP Broadcast instead of UDP Multicast. In an effort to get some more experience with parsing binary protocols in Rust I wrote this crate mostly to explore Nom. The crate ships with tokio features turned on which facilites service discovery but if you for some reason just want the decoding, you can disable the tokio features which gives you a reasonably lightweight crate.

How do I use this?

use anyhow::Result;
use lsdp::{net::Discover, ClassID};

#[tokio::main]
async fn main() -> Result<()> {
    println!("Finding devices using LSDP");

    let d = Discover::start().await?;

    d.query(lsdp::QueryMessage::new(vec![ClassID::All])).await?;

    tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;

    for (_, d) in d.inventory().await.lock().await.iter() {
        println!(
            "Found {}: {:?} with data {:?}",
            d.addr, d.records[0].cid, d.records[0].data
        );
    }

    Ok(())
}

lsdp's People

Contributors

coral avatar

Stargazers

 avatar Colin Edwards avatar Masanori Ogino avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.