Expand description
DHCPv6
This module provides types and utility functions for encoding/decoding a DHCPv4 message.
Example - constructing messages
use dhcproto::{v6, Encodable, Encoder};
// arbitrary DUID
let duid = vec![
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
];
// construct a new Message with a random xid
let mut msg = v6::Message::new(v6::MessageType::Solicit);
// set an option
msg.opts_mut()
.insert(v6::DhcpOption::ClientId(duid));
// now encode to bytes
let mut buf = Vec::new();
let mut e = Encoder::new(&mut buf);
msg.encode(&mut e)?;
// buf now has the contents of the encoded DHCP message
Example - encoding/decoding messages
use dhcproto::{v6::Message, Decoder, Decodable, Encoder, Encodable};
// example message
let solicit = solicit();
// decode
let msg = Message::decode(&mut Decoder::new(&solicit))?;
// now encode
let mut buf = Vec::new();
let mut e = Encoder::new(&mut buf);
msg.encode(&mut e)?;
assert_eq!(solicit, buf);
Re-exports
pub use crate::decoder::Decodable;
pub use crate::decoder::Decoder;
pub use crate::encoder::Encodable;
pub use crate::encoder::Encoder;
pub use crate::error::*;
Modules
Structs
- Authentication
- Identity Association Address
- Identity Association for Non-Temporary Addresses
- Identity Association Prefix Delegation
- Identity Association Prefix Delegation Prefix Option
- Identity Association for Temporary Addresses
- wrapper around interface id
- See RFC 8415 for updated DHCPv6 info DHCP for Ipv6
- Option Request Option https://datatracker.ietf.org/doc/html/rfc8415#section-21.7
- Server Unicast
- fallback for options not yet implemented
- user class
- vendor class
- vendor options
Enums
- DHCPv6 option types
- DHCPv6 message types https://datatracker.ietf.org/doc/html/rfc8415#section-7.3
- option code type
- Status code for Server Unicast
Constants
- default dhcpv6 client port
- default dhcpv6 server port