1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added renewal option add/search on DHCP.

This commit is contained in:
Matias Fontanini
2012-03-17 23:49:44 -03:00
parent 9ff5d85cd2
commit fd09f11ad5
2 changed files with 27 additions and 0 deletions

View File

@@ -251,6 +251,20 @@ namespace Tins {
*/
bool search_lease_time(uint32_t *value);
/**
* \brief Adds a lease renewal time option.
* \param time The lease renew time.
* \return True if the option was added successfully. \sa DHCP::add_option
*/
bool add_renewal_time(uint32_t time);
/**
* \brief Searchs for a lease renewal time option.
* \param value A pointer in which the option's value will be stored.
* \return True if the option was found, false otherwise.
*/
bool search_renewal_time(uint32_t *value);
/**
* \brief Adds a subnet mask option.
* \param mask The subnet mask.

View File

@@ -142,6 +142,19 @@ bool Tins::DHCP::search_lease_time(uint32_t *value) {
return false;
}
bool Tins::DHCP::add_renewal_time(uint32_t time) {
time = Utils::net_to_host_l(time);
return add_option(DHCP_RENEWAL_TIME, sizeof(uint32_t), (const uint8_t*)&time);
}
bool Tins::DHCP::search_renewal_time(uint32_t *value) {
if(generic_search(DHCP_RENEWAL_TIME, value)) {
*value = Utils::net_to_host_l(*value);
return true;
}
return false;
}
bool Tins::DHCP::add_subnet_mask(uint32_t mask) {
return add_option(SUBNET_MASK, sizeof(uint32_t), (const uint8_t*)&mask);
}