36#include <tins/macros.h>
37#include <tins/endianness.h>
38#include <tins/ip_address.h>
39#include <tins/hw_address.h>
96 BootP(
const uint8_t* buffer, uint32_t total_sz, uint32_t vend_field_size = 64);
104 uint8_t
opcode()
const {
return bootp_.opcode; }
110 uint8_t
htype()
const {
return bootp_.htype; }
116 uint8_t
hlen()
const {
return bootp_.hlen; }
122 uint8_t
hops()
const {
return bootp_.hops; }
128 uint32_t
xid()
const {
return Endian::be_to_host(bootp_.xid); }
134 uint16_t
secs()
const {
return Endian::be_to_host(bootp_.secs); }
139 uint16_t
padding()
const {
return Endian::be_to_host(bootp_.padding); }
175 const uint8_t*
sname()
const {
return bootp_.sname; }
181 const uint8_t*
file()
const {
return bootp_.file; }
194 uint32_t header_size()
const;
201 void opcode(uint8_t code);
207 void htype(uint8_t type);
213 void hlen(uint8_t length);
219 void hops(uint8_t count);
225 void xid(uint32_t identifier);
231 void secs(uint16_t value);
237 void padding(uint16_t value);
243 void ciaddr(ipaddress_type address);
249 void yiaddr(ipaddress_type address);
255 void siaddr(ipaddress_type address);
261 void giaddr(ipaddress_type address);
270 size_t copy_threshold = std::min(n,
sizeof(bootp_.chaddr));
271 for (
size_t i = 0; i < copy_threshold; ++i) {
272 if (i < copy_threshold) {
273 bootp_.chaddr[i] = new_chaddr[i];
276 bootp_.chaddr[i] = 0;
285 void sname(
const uint8_t* new_sname);
291 void file(
const uint8_t* new_file);
297 void vend(
const vend_type& newvend_);
308 bool matches_response(
const uint8_t* ptr, uint32_t total_sz)
const;
320 return new BootP(*
this);
333 void write_serialization(uint8_t* buffer, uint32_t total_sz);
Represents a BootP PDU.
Definition bootp.h:47
PDUType pdu_type() const
Getter for the PDU's type.
Definition bootp.h:314
vend_type & vend()
Getter for the vend field.
Definition bootp.h:331
ipaddress_type yiaddr() const
Getter for the yiaddr field.
Definition bootp.h:151
chaddr_type chaddr() const
Getter for the chaddr field.
Definition bootp.h:169
uint8_t hops() const
Getter for the hops field.
Definition bootp.h:122
uint16_t padding() const
Getter for the padding field.
Definition bootp.h:139
ipaddress_type siaddr() const
Getter for the siaddr field.
Definition bootp.h:157
uint32_t xid() const
Getter for the xid field.
Definition bootp.h:128
BootP * clone() const
Definition bootp.h:319
void chaddr(const HWAddress< n > &new_chaddr)
Setter for the chaddr field. The new_chaddr pointer must be at least BOOTP::hlen() bytes long.
Definition bootp.h:269
HWAddress< 16 > chaddr_type
Definition bootp.h:57
const uint8_t * file() const
Getter for the file field.
Definition bootp.h:181
const vend_type & vend() const
Getter for the vend field.
Definition bootp.h:187
std::vector< uint8_t > vend_type
Definition bootp.h:62
uint16_t secs() const
Getter for the secs field.
Definition bootp.h:134
const uint8_t * sname() const
Getter for the sname field.
Definition bootp.h:175
ipaddress_type giaddr() const
Getter for the giaddr field.
Definition bootp.h:163
uint8_t opcode() const
Getter for the opcode field.
Definition bootp.h:104
OpCodes
Enum which contains the different opcodes BootP messages.
Definition bootp.h:72
ipaddress_type ciaddr() const
Getter for the ciaddr field.
Definition bootp.h:145
uint8_t htype() const
Getter for the htype field.
Definition bootp.h:110
uint8_t hlen() const
Getter for the hlen field.
Definition bootp.h:116
IPv4Address ipaddress_type
Definition bootp.h:52
Represents a hardware address.
Definition resolve_utils.h:43
Abstraction of an IPv4 address.
Definition ip_address.h:45
Base class for protocol data units.
Definition pdu.h:107
PDUType
Enum which identifies each type of PDU.
Definition pdu.h:127
The Tins namespace.
Definition address_range.h:38