35 #include <tins/bootp.h> 36 #include <tins/macros.h> 37 #include <tins/pdu_option.h> 38 #include <tins/cxxstd.h> 103 RESOURCE_LOCATION_SERVERS,
112 NON_LOCAL_SOURCE_ROUTING,
114 MAX_DGRAM_REASSEMBLY,
116 PATH_MTU_AGING_TIMEOUT,
117 PATH_MTU_PLATEAU_TABLE,
121 PERFORM_MASK_DISCOVERY,
124 ROUTER_SOLICITATION_ADDRESS,
126 TRAILER_ENCAPSULATION,
128 IEEE802_3_ENCAPSULATION,
130 TCP_KEEPALIVE_INTERVAL,
131 TCP_KEEPALIVE_GARBAGE,
135 VENDOR_ENCAPSULATED_OPTIONS,
136 NETBIOS_NAME_SERVERS,
142 DHCP_REQUESTED_ADDRESS,
144 DHCP_OPTION_OVERLOAD,
146 DHCP_SERVER_IDENTIFIER,
147 DHCP_PARAMETER_REQUEST_LIST,
149 DHCP_MAX_MESSAGE_SIZE,
152 VENDOR_CLASS_IDENTIFIER,
153 DHCP_CLIENT_IDENTIFIER,
158 DHCP_AGENT_OPTIONS = 82,
159 SUBNET_SELECTION = 118,
180 static metadata extract_metadata(
const uint8_t *buffer, uint32_t total_sz);
200 DHCP(
const uint8_t* buffer, uint32_t total_sz);
206 void add_option(
const option& opt);
217 internal_add_option(opt);
218 options_.push_back(std::move(opt));
238 const option* search_option(
OptionTypes opt)
const;
247 void type(
Flags type);
276 void lease_time(uint32_t time);
285 void renewal_time(uint32_t time);
294 void rebind_time(uint32_t time);
312 void routers(
const std::vector<ipaddress_type>& routers);
321 void domain_name_servers(
const std::vector<ipaddress_type>& dns);
348 void domain_name(
const std::string& name);
357 void hostname(
const std::string& name);
369 uint8_t type()
const;
389 uint32_t lease_time()
const;
399 uint32_t renewal_time()
const;
409 uint32_t rebind_time()
const;
430 std::vector<ipaddress_type> routers()
const;
440 std::vector<ipaddress_type> domain_name_servers()
const;
470 std::string domain_name()
const;
480 std::string hostname()
const;
486 const options_type
options()
const {
return options_; }
499 uint32_t header_size()
const;
505 return new DHCP(*
this);
508 static const uint32_t MAX_DHCP_SIZE;
510 void write_serialization(uint8_t* buffer, uint32_t total_sz);
512 template <
typename T>
514 const option* option = search_option(opt);
518 return option->
to<T>();
521 void internal_add_option(
const option& opt);
523 options_type::const_iterator search_option_iterator(
OptionTypes opt)
const;
524 options_type::iterator search_option_iterator(
OptionTypes opt);
526 options_type options_;
532 #endif // TINS_DHCP_H Flags
Definition: dhcp.h:77
PDUType pdu_type() const
Getter for the PDU's type.
Definition: dhcp.h:492
DHCP * clone() const
Definition: dhcp.h:504
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
Represents a PDU option field.
Definition: pdu_option.h:201
OptionTypes
DHCP options enum.
Definition: dhcp.h:91
const options_type options() const
Getter for the options list.
Definition: dhcp.h:486
The Tins namespace.
Definition: address_range.h:38
T to() const
Constructs a T from this PDUOption.
Definition: pdu_option.h:389
std::vector< option > options_type
Definition: dhcp.h:172
PDUOption< uint8_t, DHCP > option
Definition: dhcp.h:167
Abstraction of an IPv4 address.
Definition: ip_address.h:45
Represents the DHCP PDU.
Definition: dhcp.h:67
void add_option(option &&opt)
Adds a new option to this DHCP PDU.
Definition: dhcp.h:216
Represents a BootP PDU.
Definition: bootp.h:47
byte_array serialization_type
Definition: pdu.h:112
Exception thrown when an option is not found.
Definition: exceptions.h:56