|
SatCat5
|
DHCP Server for managing leases to other clients.
#include <ip_dhcp.h>
Public Member Functions | |
| DhcpServer (satcat5::udp::Dispatch *iface, satcat5::ip::DhcpPool *pool) | |
| Attach this DHCP server to a UDP-dispatch object and address pool. | |
| void | count_leases (unsigned &free, unsigned &taken) const |
| Report the number of active or open leases. | |
| satcat5::ip::Addr | request (u32 lease_seconds, const satcat5::ip::Addr &addr=satcat5::ip::ADDR_NONE) |
| Manually request/reserve an IP address for the next N seconds. More... | |
| void | max_lease (u32 seconds) |
| Change the lease timeout. (Mostly used for testing.) | |
| 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. | |
| void | set_dns (const satcat5::ip::Addr &addr) |
| Set various optional client-configuration fields. More... | |
| void | set_domain (const char *name) |
| Set various optional client-configuration fields. More... | |
| void | set_gateway (const satcat5::ip::Subnet &gateway) |
| Set various optional client-configuration fields. More... | |
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 | 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. | |
| satcat5::ip::Addr | offer (u32 client_id, u32 req_ipaddr, u32 req_lease) |
| satcat5::ip::Addr | reserve (u32 client_id, u32 req_ipaddr, u32 req_lease) |
| void | query (unsigned elapsed_msec) |
Private Attributes | |
| satcat5::udp::Dispatch *const | m_iface |
| satcat5::ip::DhcpPool *const | m_pool |
| u32 | m_time |
| Arbitrary timescale (+1/sec) | |
| u32 | m_max_lease |
| Maximum lease in seconds. | |
| unsigned | m_next_lease |
| Next lease request. | |
| unsigned | m_next_timer |
| Next timer event. | |
| satcat5::ip::Addr | m_dns |
| DNS server, if one is available. | |
| const char * | m_domain |
| Domain name (human-readable) | |
| satcat5::ip::Subnet | m_gateway |
| Default gateway and subnet mask. | |
| satcat5::net::Protocol * | m_next |
| Linked list of Protocols. | |
| unsigned | m_trem |
| unsigned | m_tnext |
|
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 587 of file ip_dhcp.cc.
| Addr DhcpServer::request | ( | u32 | lease_seconds, |
| const satcat5::ip::Addr & | addr = satcat5::ip::ADDR_NONE |
||
| ) |
Manually request/reserve an IP address for the next N seconds.
Request a specific address or ADDR_NONE for the first available.
Definition at line 579 of file ip_dhcp.cc.
|
inline |
|
inline |
|
inline |