//********************************************************************* //-------------------- DHCP Configuration -------------------- //********************************************************************* //Defines DHCP ports #define DHCP_CLIENT_PORT (68) #define DHCP_SERVER_PORT (67) //The stack uses the macro STACK_IS_DHCP_ENABLED to determine if DHCP is enabled or not. //The user can for example assign this macro to check if a flag is set. If not defined //by the user, it will be set to true. //#define STACK_IS_DHCP_ENABLED (netflags & 0x01) //Timeouts #define DHCP_TIMEOUT (TICK)(5 * TICK_SECOND)
Data Structures | |
| union | _DHCP_STATE |
Defines | |
| #define | DHCP_CLIENT_PORT (68) |
| #define | DHCP_SERVER_PORT (67) |
| #define | DHCP_TIMEOUT ((TICK16)(2 * TICKS_PER_SECOND)) |
| #define | DHCPDisable() (smDHCPState = SM_DHCP_DISABLED) |
| #define | DHCPIsBound() (DHCPState.bits.bIsBound) |
| #define | STACK_IS_DHCP_ENABLED (1) |
Typedefs | |
| typedef _DHCP_STATE | DHCP_STATE |
| typedef enum _SM_DHCP | SM_DHCP |
Enumerations | |
| enum | _SM_DHCP { SM_DHCP_INIT_FIRST_TIME, SM_DHCP_INIT, SM_DHCP_RESET_WAIT, SM_DHCP_BROADCAST, SM_DHCP_DISCOVER, SM_DHCP_REQUEST, SM_DHCP_BIND, SM_DHCP_BOUND, SM_DHCP_DISABLED } |
Functions | |
| void | DHCPReset (void) |
| void | DHCPTask (void) |
Variables | |
| DHCP_STATE | DHCPState |
| SM_DHCP | smDHCPState |
| #define DHCP_CLIENT_PORT (68) |
| #define DHCP_SERVER_PORT (67) |
| #define DHCP_TIMEOUT ((TICK16)(2 * TICKS_PER_SECOND)) |
| #define DHCPDisable | ( | ) | (smDHCPState = SM_DHCP_DISABLED) |
Puts DHCPTask into unhandled state "SM_DHCP_DISABLED" and hence DHCP is effictively disabled. Note: This macro should be called before DHCPTask is called or else a UDP port will be kept open and there will be no task to process it.
| #define DHCPIsBound | ( | ) | (DHCPState.bits.bIsBound) |
Checks is DHCP is bound
| #define STACK_IS_DHCP_ENABLED (1) |
| typedef union _DHCP_STATE DHCP_STATE |
| enum _SM_DHCP |
| void DHCPReset | ( | void | ) |
Closes any previously opened DHCP socket and resets DHCP state machine so that on next call to DHCPTask will result in new DHCP request.
| void DHCPTask | ( | void | ) |
Fetches pending UDP packet from MAC receive buffer and dispatches it appropriate UDP socket. If not UDP socket is matched, UDP packet is silently discarded. Note: Caller must make sure that MAC receive buffer access pointer is set to begining of UDP packet. Required steps before calling this function is:
If ( MACIsRxReady() ) { MACGetHeader() If MACFrameType == IP IPGetHeader() if ( IPFrameType == IP_PROT_UDP ) Call DHCPTask() ... }
1.4.7