|
SatCat5
|
DHCP Client for leasing an IP address from a server.
#include <ip_dhcp.h>
Public Member Functions | |
| DhcpClient (satcat5::udp::Dispatch *iface) | |
| Attach this DHCP client to a UDP-dispatch object. | |
| void | inform (const satcat5::ip::Addr &new_addr) |
| Set a static IP and fetch other parameters from the server. | |
| void | release (const satcat5::ip::Addr &new_addr=satcat5::ip::ADDR_NONE) |
| Relinquish the currently held lease, if one exists. More... | |
| void | renew () |
| Request extension of current lease if held, otherwise request a new lease. More... | |
| satcat5::ip::DhcpState | state () const |
| Report current lease state. | |
| u32 | status () const |
| Report remaining lease time, or zero if none is held. | |
| void | set_client_id (const satcat5::ip::DhcpId *id) |
| Set an explicit client identifier (RFC2132 Section 9.14). More... | |
| virtual void | gateway_change (const satcat5::ip::Addr &dstaddr, const satcat5::ip::Addr &gateway) |
| Callback for changes to gateway configuration. More... | |
| void | timer_once (unsigned msec) |
| Configure a one-time notification after X milliseconds. | |
| void | timer_every (unsigned msec) |
| Configure a repeating notification every X milliseconds. | |
| void | timer_stop () |
| Stop all future notifications. | |
| unsigned | timer_interval () const |
| Accessor for recurring timer interval, if one is set. | |
| unsigned | timer_remaining () const |
| Accessor for time to next event, if one is set. | |
Static Public Member Functions | |
| static unsigned | count_timer () |
| Count all objects of this type, including idle timers. | |
Protected Attributes | |
| satcat5::net::Type | m_filter |
| Incoming packet filter. | |
Private Member Functions | |
| void | arp_event (const satcat5::eth::MacAddr &mac, const satcat5::ip::Addr &ip) override |
| Callback for any announced MAC/IP address pair. More... | |
| void | frame_rcvd (satcat5::io::LimitedRead &src) override |
| Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value. More... | |
| void | timer_event () override |
| Child class MUST override this method. | |
| void | next_timer () |
| void | send_message (u8 opcode) |
| void | query (unsigned elapsed_msec) |
Private Attributes | |
| satcat5::udp::Dispatch *const | m_iface |
| const satcat5::ip::DhcpId * | m_client_id |
| satcat5::udp::Address | m_server |
| Server IP+MAC address. | |
| satcat5::ip::DhcpState | m_state |
| Client state. | |
| satcat5::ip::Addr | m_ipaddr |
| Assigned IP address, if any. | |
| u16 | m_seconds |
| Seconds since start of process. | |
| u32 | m_server_id |
| Server-ID (may not match IP-addr) | |
| u32 | m_timeout |
| Time to next action, in seconds. | |
| u32 | m_xid |
| Client/server transaction-ID. | |
| satcat5::eth::ArpListener * | m_next |
| unsigned | m_trem |
| unsigned | m_tnext |
|
overrideprivatevirtual |
Callback for any announced MAC/IP address pair.
Child class MUST override this method.
Implements satcat5::eth::ArpListener.
Definition at line 213 of file ip_dhcp.cc.
|
overrideprivatevirtual |
Dispatch calls frame_rcvd(...) for each incoming frame with with a matching net::Type value.
The child class SHOULD read the frame contents from the provided "src" object, which is only valid until the function returns.
To send a reply:
The child class MUST override this method.
Implements satcat5::net::Protocol.
Definition at line 227 of file ip_dhcp.cc.
|
inlinevirtualinherited |
Callback for changes to gateway configuration.
Child class MAY override this method.
Reimplemented in satcat5::ip::Address, and satcat5::test::CountArpResponse.
| void DhcpClient::release | ( | const satcat5::ip::Addr & | new_addr = satcat5::ip::ADDR_NONE | ) |
Relinquish the currently held lease, if one exists.
Halts automatic requests until renew() is called. If an address is provided, set the new static IP address.
Definition at line 178 of file ip_dhcp.cc.
| void DhcpClient::renew | ( | ) |
Request extension of current lease if held, otherwise request a new lease.
Resumes automatic requests.
Definition at line 186 of file ip_dhcp.cc.
|
inline |