SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
The SimpleLink device lets users set the DHCP server parameters. The following parameters can be set:
The range of the DHCP server addresses must be in the subnet of the AP IP address. This configuration is persistent. The configuration should be performed when the DHCP server is not running.
Example:
_i16 Status;
SlNetAppDhcpServerBasicOpt_t dhcpParams;
_u8 outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
dhcpParams.lease_time = 4096; // lease time (in seconds) of the IP Address
dhcpParams.ipv4_addr_start = SL_IPV4_VAL(192,168,1,10); // first IP Address for allocation
dhcpParams.ipv4_addr_last = SL_IPV4_VAL(192,168,1,16); // last IP Address for allocation.
Status = sl_NetAppStop(SL_NETAPP_DHCP_SERVER_ID); // Stop DHCP server before settingsif( Status )
{
// error
}
Status = sl_NetAppSet(SL_NETAPP_DHCP_SERVER_ID, SL_NETAPP_DHCP_SRV_BASIC_OPT, outLen, (_u8* )&dhcpParams);
if( Status )
{
// error
}
Status = sl_NetAppStart(SL_NETAPP_DHCP_SERVER_ID); // Start DHCP server with new settingsif( Status )
{
// error
}