Skip to main content

esp_netif_dhcps_option

Function esp_netif_dhcps_option 

Source
pub unsafe extern "C" fn esp_netif_dhcps_option(
    esp_netif: *mut esp_netif_t,
    opt_op: esp_netif_dhcp_option_mode_t,
    opt_id: esp_netif_dhcp_option_id_t,
    opt_val: *mut c_void,
    opt_len: u32,
) -> esp_err_t
Expand description

@brief Set or Get DHCP server option

@note Please note that not all combinations of identifiers and options are supported.

Get operations:

  • IP_ADDRESS_LEASE_TIME
  • ESP_NETIF_SUBNET_MASK/REQUESTED_IP_ADDRESS (both options do the same, they reflect dhcps_lease_t)
  • ROUTER_SOLICITATION_ADDRESS
  • DOMAIN_NAME_SERVER

Set operations:

  • IP_ADDRESS_LEASE_TIME
  • ESP_NETIF_SUBNET_MASK – set operation is allowed only if the configured mask corresponds to the settings, if not, please use esp_netif_set_ip_info() to prevent misconfiguration of DHCPS.
  • REQUESTED_IP_ADDRESS – if the address pool is enabled, a sanity check for start/end addresses is performed before setting.
  • ROUTER_SOLICITATION_ADDRESS
  • DOMAIN_NAME_SERVER
  • ESP_NETIF_CAPTIVEPORTAL_URI – set operation copies the pointer to the URI, so it is owned by the application and needs to be maintained valid throughout the entire DHCP Server lifetime.

@param[in] esp_netif Handle to esp-netif instance @param[in] opt_op ESP_NETIF_OP_SET to set an option, ESP_NETIF_OP_GET to get an option. @param[in] opt_id Option index to get or set, must be one of the supported enum values. @param[inout] opt_val Pointer to the option parameter. @param[in] opt_len Length of the option parameter.

@return - ESP_OK - ESP_ERR_ESP_NETIF_INVALID_PARAMS - ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED - ESP_ERR_ESP_NETIF_DHCP_ALREADY_STARTED