Configuration

The µC/DHCPc module has to be configured according to your specific needs. A template configuration file ( dhcp-c_cfg.h ) is included in the module package (see  Directories and Files ), and this configuration file should be copied into your application directory and included to your project. Here is the list of the values and description of each of the configuration variable. However, keep in mind that future releases of this module might include more configuration options.

Configuration Fields Description 

OS 

Task configuration values can be defined either in the DHCPc configuration file dhcp-c_cfg.h or in a global OS tasks priorities configuration header file which must be included in dhcp-c_cfg.h.

#defineDescriptionPossible Values
DHCPc_OS_CFG_TASK_PRIODHCPc main task priority1 .MUST be >= 1 & <= OS_CFG_PRIO_MAX
DHCPc_OS_CFG_TMR_TASK_PRIODHCPc timer task priority1.MUST be >= 1 & <= OS_CFG_PRIO_MAX
DHCPc_OS_CFG_TASK_STK_SIZEDHCPc main size (depth) of the task stacks2.MUST be >= 1 & <= 65535
DHCPc_OS_CFG_TMR_TASK_STK_SIZEDHCPc t imer size (depth) of the task stacks 2 .MUST be >= 1 & <= 65535

1 See Network Tasks Configuration for further information about Network tasks priority configuration. DHCPc main task should be configured with an higher priority than the timer task.

2 In general, the size of µC/TCP-IP task stacks is dependent on the CPU architecture and compiler used.(See the definition of CPU_STK for stack width). The easiest and best method for calculating the maximum stack usage for any task/function should be performed statically by the compiler or by a static analysis tool since these can calculate function/task maximum stack usage based on the compiler’s actual code generation and optimization settings. So for optimal task stack configuration, we recommend to invest in a task stack calculator tool compatible with your build toolchain.

Connection / Socket

#defineDescriptionPossible Values
DHCPc_CFG_IP_PORT_SERVERUDP port µC/DHCPc will send requests 1

67,

MUST be >= 1 & <= 65535

DHCPc_CFG_IP_PORT_CLIENTUDP port µC/DHCPc will receive replies 1

68,

MUST be >= 1 & <= 65535

DHCPc_CFG_MAX_RX_TIMEOUT_MSValue for the socket receive timeout on each reception attempt.5000,
MUST be >= 1    
DHCPc_CFG_MAX_NBR_IFDefines the maximum number of interface that will be managed by the µC/DHCPc module at any time.

NET_IF_CFG_MAX_NBR_IF,

MUST be >= 1 & <= NET_IF_CFG_MAX_NBR_IF

1 Default ports are specified in RFC #2131.

DHCP Option Configuration

#defineDescriptionPossible Values
DHCPc_CFG_PARAM_REQ_TBL_SIZEConfigure requested parameter table size.MUST be >= 0
DHCPc_CFG_ADDR_VALIDATE_ENOnce the DHCP server has assigned the client an address, the later may perform a final check prior to use this address in order to make sure it is not being used by another host on the network.. DEF_ENABLED  or  DEF_DISABLED

#defineDescriptionPossible Values
DHCPc_CFG_DYN_LOCAL_LINK_ADDR_ENWhether or not the dynamic link-local configuration mechanism is used in the case where a DHCP server could not be contacted. DEF_ENABLED  or  DEF_DISABLED
DHCPc_CFG_LOCAL_LINK_MAX_RETRYMaximum number of link-local configuration retries when the selected address is already in use on the network.MUST be >= 1

Argument Checking and Debug Configuration

These defines determine whether the argument check feature is enabled or not, as well as the memory clear feature. This is a convenient feature while debugging, and should be set to DEF_DISABLED for production code.

#defineDescriptionPossible Values
DHCPc_CFG_ARG_CHK_EXT_ENAllows code generated to check arguments for functions that can be called by the user and, for functions which are internal but receive arguments from an API that the user can call.DEF_ENABLED  or  DEF_DISABLED
DHCPc_CFG_ARG_CHK_DBG_ENAllows code to be generated which checks to make sure that pointers passed to functions are not NULL, and that arguments are within range, etc.DEF_ENABLED  or  DEF_DISABLED
DHCPc_DBG_CFG_MEM_CLR_ENIs  used to clear internal data structures when allocated or de-allocated. By clearing, all bytes in internal data structures are set to ‘0’ or to default initialization values. This configuration is typically set it to  DEF_DISABLED  unless the contents of the internal data structures need to be examined for debugging purposes.DEF_ENABLED  or  DEF_DISABLED