daniestevez / dvb-gse

Rust implementation of DVB-GSE
Apache License 2.0
17 stars 3 forks source link

dvb-gse

Crates.io Rust

dvg-gse is a Rust implementation of the DVB GSE (Generic Stream Encapsulation) protocol and related protocols.

It is mainly intended to be used as a CLI application that receives BBFRAMEs by UDP or TCP packets from a DVB-S2 receiver (such as Longmynd), obtains IP packets from a continous-mode GSE stream, and sends the IP packets to a TUN device.

The crate can also be used as a library to process GSE Packets and DVB-S2/DVB-S2X BBFRAMES.

Quickstart

Install dvb-gse with cargo:

cargo install dvb-gse

Create a TUN device to receive the IP packets:

sudo ip tuntap add dev tun0 mode tun
sudo ip link set tun0 up

Run dvb-gse:

dvb-gse --listen 0.0.0.0:2000 --tun tun0

It is possible to use the environment variable RUST_LOG=debug or RUST_LOG=trace to see more detailed logging information.

Now send BBFRAMEs to UDP port 2000 (how to do this will depend on the DVB-S2 receiver being used). dvb-gse will obtain the IP packets from the GSE stream and write them into the tun0 interface. These packets can be inspected by running Wireshark or tcpdump in tun0.

Input formats

The CLI application supports the following input formats for the BBFRAMEs. The input format is selected with the --input argument:

UDP fragments (--input UDP or --input "UDP fragments")

This corresponds to BBFRAMEs fragmented into multiple UDP packets (since usually DVB-S2 BBFRAMEs are larger than a 1500 byte MTU). The following rules need to be followed.

The CLI application tries to recover from dropped UDP packets.

UDP packets with complete BBFRAMES (--input "UDP complete")

This corresponds to BBFRAMEs carried in a single UDP packet (it will typically be a jumbo packet). The following rules need to be followed.

UDP packets can be dropped. The CLI application will handle this gracefully.

TCP stream (--input TCP)

This corresponds to receiving BBFRAMEs in a TCP stream. The CLI application acts as server. The following rules need to be followed.

If an error occurrs or the client closes the connection, the CLI application will continue listen for new clients.

API documentation

The documentation for dvb-gse Rust crate is hosted in docs.rs.

License

Licensed under either of

at your option.

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.