Dhcp Transmitter Module

class mtf.network_port.dhcp_transmitter.DhcpTransmitter

Transmit DHCP messages on an Ethernet network

message_queue
__init__()
ip_to_int(ip)

Converts an IPv4 address to an integer Args:

ip (str): IP address in string format

Return:

bytes: Integer representation of the IP address

send_dhcp_msg(channel_name: str, client_ip: str, server_ip: str, mac_client: str, subnet_mask: str, xid: int, type: int, lease_time: int | None = None)

Send a DHCP message using an Ethernet transmitter Args:

channel_name (str): The channel name client_ip (str): The ip address client server_ip (str): The ip address server mac_client (str): The mac address client subnet_mask (str): The subnet mask for the network xid (int) type (int) lease_time (int, optional)

Return:

bool: True if the message was successfully sent, False otherwise

send_dhcp_ack(channel_name: str, client_ip: str, server_ip: str, mac_client: str, subnet_mask: str, xid: int, lease_time: int | None = None)
Send a DHCP ACK message using the send_dhcp_msg method
Args:

channel_name (str): The channel name client_ip (str): The ip address client server_ip (str): The ip address server mac_client (str): The mac address client subnet_mask (str): The subnet mask for the network xid (int) lease_time (int, optional)

Return:

bool: True if the message was successfully sent, False otherwise

send_dhcp_offer(channel_name: str, client_ip: str, server_ip: str, mac_client: str, subnet_mask: str, xid: int, lease_time: int | None = None)

Send a DHCP OFFER message Args:

channel_name (str): The name of the communication channel client_ip (str): The IP address offered to the client server_ip (str): The IP address of the DHCP server mac_client (str): The MAC address of the client subnet_mask (str): The subnet mask for the network xid (int) lease_time (int, optional)

Returns:

bool: True if the message was successfully sent, False otherwise