Struct dhcp4r::server::Server
[−]
[src]
pub struct Server { /* fields omitted */ }
This is a convenience module that simplifies the writing of a DHCP server service.
Methods
impl Server
[src]
fn serve<H: Handler>(
udp_soc: UdpSocket,
server_ip: [u8; 4],
handler: H
) -> Error
udp_soc: UdpSocket,
server_ip: [u8; 4],
handler: H
) -> Error
fn reply(
&self,
msg_type: u8,
additional_options: Vec<Option>,
offer_ip: [u8; 4],
req_packet: Packet
) -> Result<usize>
&self,
msg_type: u8,
additional_options: Vec<Option>,
offer_ip: [u8; 4],
req_packet: Packet
) -> Result<usize>
Constructs and sends a reply packet back to the client. additional_options should not include DHCP_MESSAGE_TYPE nor SERVER_IDENTIFIER as these are added automatically.
fn for_this_server(&self, packet: &Packet) -> bool
Checks the packet see if it was intended for this DHCP server (as opposed to some other also on the network).
fn send(&self, p: Packet) -> Result<usize>
Encodes and sends a DHCP packet back to the client.