Dhcp Transmitter Module
This module implements the Dhcp Transmitter class providing all functionality to send DHCP messages.
- class mtf.network_port.dhcp_transmitter.DhcpTransmitter
Transmit DHCP messages on an Ethernet network.
- message_queue
- __init__()
Creates a new instance.
- Returns:
DhcpTransmitter: The newly created instance.
- ip_to_int(ip)
Converts an IPv4 address to an integer.
- Args:
ip (str): The string representation of the given IPv4 address.
- Returns:
int: The int representation of the given IPv4 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)
Sends a DHCP message using an Ethernet transmitter.
- Args:
channel_name (str): The channel to send the message over. client_ip (str): The client’s IP address. server_ip (str): The server’s IP address. mac_client (str): The client’s MAC address. subnet_mask (str): The subnet mask of the network. xid (int): The xID. type (int): The message type. lease_time (int, optional): The lease time.
- Returns:
bool: True on success, 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)
Sends a DHCP ACK message using the given parameters.
- Args:
channel_name (str): The channel to send the ACK over. client_ip (str): The client’s IP address. server_ip (str): The server’s IP address. mac_client (str): The client’s MAC address. subnet_mask (str): The subnet mask of the network. xid (int): The xID. lease_time (int, optional): The lease time.
- Returns:
bool: True if the message was successfully sent; otherwise False.
- send_dhcp_offer(channel_name: str, client_ip: str, server_ip: str, mac_client: str, subnet_mask: str, xid: int, lease_time: int = None)
Sends a DHCP OFFER message.
- Args:
channel_name (str): The chanel to send te message over. client_ip (str): The client’s IP address. server_ip (str): The server’s IP address. mac_client (str): The client’s MAC address. subnet_mask (str): The subnet mask of the network. xid (int): The xID. lease_time (int, optional): The lease time.
- Returns:
bool: True if the message was successfully sent; otherwise False.