mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
parent
77e968a5e3
commit
ca1751528d
@ -136,6 +136,7 @@ class Net::Dhcp_packet
|
||||
IP_LEASE_TIME = 51,
|
||||
MSG_TYPE = 53,
|
||||
SERVER = 54,
|
||||
PARAM_REQ_LIST = 55,
|
||||
MAX_MSG_SZ = 57,
|
||||
CLI_ID = 61,
|
||||
END = 255,
|
||||
@ -194,6 +195,16 @@ class Net::Dhcp_packet
|
||||
unsigned long value() const { return host_to_big_endian(_value); }
|
||||
};
|
||||
|
||||
/**
|
||||
* DHCP option to request specific option type values from the server
|
||||
*/
|
||||
struct Parameter_request_list : Option
|
||||
{
|
||||
static constexpr Code CODE = Code::PARAM_REQ_LIST;
|
||||
|
||||
Parameter_request_list(Genode::size_t len) : Option(CODE, len) { }
|
||||
};
|
||||
|
||||
enum class Message_type : Genode::uint8_t {
|
||||
DISCOVER = 1,
|
||||
OFFER = 2,
|
||||
@ -306,6 +317,34 @@ class Net::Dhcp_packet
|
||||
|
||||
public:
|
||||
|
||||
class Parameter_request_list_data
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::uint8_t *const _base;
|
||||
Genode::size_t _size { 0 };
|
||||
SIZE_GUARD &_size_guard;
|
||||
|
||||
public:
|
||||
|
||||
Parameter_request_list_data(Genode::uint8_t *base,
|
||||
SIZE_GUARD &size_guard)
|
||||
:
|
||||
_base { base },
|
||||
_size_guard { size_guard }
|
||||
{ }
|
||||
|
||||
template <typename OPTION>
|
||||
void append_param_req()
|
||||
{
|
||||
_size_guard.add(sizeof(_base[0]));
|
||||
_base[_size] = (Genode::uint8_t)OPTION::CODE;
|
||||
_size++;
|
||||
}
|
||||
|
||||
Genode::size_t size() const { return _size; }
|
||||
};
|
||||
|
||||
Options_aggregator(Dhcp_packet &packet,
|
||||
SIZE_GUARD &size_guard)
|
||||
:
|
||||
@ -321,6 +360,21 @@ class Net::Dhcp_packet
|
||||
static_cast<ARGS &&>(args)...);
|
||||
_base += sizeof(OPTION);
|
||||
}
|
||||
|
||||
template <typename INIT_DATA>
|
||||
void append_param_req_list(INIT_DATA && init_data)
|
||||
{
|
||||
_size_guard.add(sizeof(Parameter_request_list));
|
||||
Parameter_request_list_data
|
||||
data((Genode::uint8_t *)(_base + sizeof(Parameter_request_list)),
|
||||
_size_guard);
|
||||
|
||||
init_data(data);
|
||||
Genode::construct_at<Parameter_request_list>((void *)_base,
|
||||
data.size());
|
||||
|
||||
_base += sizeof(Parameter_request_list) + data.size();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user