Crate dhcproto

source ·
Expand description

§dhcproto

A DHCP parser and encoder for DHCPv4 and DHCPv6. dhcproto aims to be a functionally complete DHCP implementation.

§DHCPv4

use dhcproto::v4::{Message, Encoder, Decoder, Decodable, Encodable};
// decode
let bytes = dhcp_offer();
let msg = Message::decode(&mut Decoder::new(&bytes))?;
// now encode
let mut buf = Vec::new();
let mut e = Encoder::new(&mut buf);
msg.encode(&mut e)?;

§DHCPv6

use dhcproto::v6::{Message, Encoder, Decoder, Decodable, Encodable};
// decode
let bytes = solicit();
let msg = Message::decode(&mut Decoder::new(&bytes))?;
// now encode
let mut buf = Vec::new();
let mut e = Encoder::new(&mut buf);
msg.encode(&mut e)?;

Re-exports§

Modules§

  • Decodable trait & Decoder
  • Encodable trait & Encoder
  • Error types for Encoding/Decoding
  • DHCPv4
  • DHCPv6

Structs§

  • A domain name
  • The error type for errors that get returned in the crate