This library contains functions that allow the DS80C400 to lease addresses from a DHCP server. Only Ipv4 addresses can be leased using DHCP. Ipv6 addresses are automatically configured. Once the DHCP client negotiates a lease on an address, functions from the socket libraries (rom400_sock.h) can be used to get the current IP address and communicate with other devices.
For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.
Go to the source code of this file.
Defines | |
| #define | ROM400_DHCP_VERSION 10 |
| #define | DHCP_STATUS_INIT 0 |
| #define | DHCP_STATUS_SELECTING 1 |
| #define | DHCP_STATUS_REQUESTING 2 |
| #define | DHCP_STATUS_INITREBOOT 3 |
| #define | DHCP_STATUS_REBOOTING 4 |
| #define | DHCP_STATUS_BOUND 5 |
| #define | DHCP_STATUS_RENEWING 6 |
| #define | DHCP_STATUS_REBINDING 7 |
| #define | DHCP_MSG_DHCPDISCOVER 1 |
| #define | DHCP_MSG_DHCPOFFER 2 |
| #define | DHCP_MSG_DHCPREQUEST 3 |
| #define | DHCP_MSG_DHCPDECLINE 4 |
| #define | DHCP_MSG_DHCPACK 5 |
| #define | DHCP_MSG_DHCPNAK 6 |
| #define | DHCP_MSG_DHCPRELEASE 7 |
| #define | DHCP_MSG_DHCPINFORM 8 |
Functions | |
| unsigned char | dhcp_init (void) |
| Initializes the DHCP client. | |
| unsigned int | dhcp_status (void) |
| Gets the status of the DHCP client. | |
| void | dhcp_stop (void) |
| Disabled the DHCP client. | |
| void | dhcp_registernotify (void(*functionptr)(unsigned int newstate, unsigned char far *packet)) |
| Register a function to be notified when DHCP acquires or loses an IP. | |
| void | dhcp_registerparseoption (void(*functionptr)(unsigned char far *option)) |
| Register a function to be called when an unknown or unhandled DHCP option is encountered. | |
| void | dhcp_registerbuildpacket (unsigned char(*functionptr)(unsigned char far *option, unsigned char msgtype)) |
| Register a function to be called when a DHCP packet is about to be sent. | |
| unsigned int | dhcp_version (void) |
| Returns the version number of this DHCP library. | |
| void | dhcp_getserverip (struct sockaddr *address, int len) |
| Returns the IP address of the DHCP server. | |
| void | dhcp_getprimarydns (struct sockaddr *address) |
| Returns the IP address of the primary DNS server. | |
| void | dhcp_getsecondarydns (struct sockaddr *address) |
| Returns the IP address of the secondary DNS server. | |
| unsigned int | dhcp_gettaskid () |
| Returns task ID of the DHCP process. | |
|
|
DHCP message type ACK |
|
|
DHCP message type DECLINE |
|
|
DHCP message type DISCOVER |
|
|
DHCP message type INFORM |
|
|
DHCP message type NAK |
|
|
DHCP message type OFFER |
|
|
DHCP message type RELEASE |
|
|
DHCP message type REQUEST |
|
|
DHCP status code returned by dhcp_status. The DHCP client is in the BOUND state: it has been configured with a valid address.
|
|
|
DHCP status code returned by dhcp_status. The DHCP client is in the INIT state: it has not yet sent a DHCP_DISCOVER message.
|
|
|
DHCP status code returned by dhcp_status. The DHCP client is in the INITREBOOT state: it has rebooted, and is trying to acquire its old address.
|
|
|
DHCP status code returned by dhcp_status. The DHCP client is in the REBINDING state: it is attempting to get a new lease after its current lease expired.
|
|
|
DHCP status code returned by dhcp_status. The DHCP client is in the REBOOTING state: after a reboot, it is waiting for permission to use its old address.
|
|
|
DHCP status code returned by dhcp_status. The DHCP client is in the RENEWING state: it is attempting to extend the current, valid lease of its address.
|
|
|
DHCP status code returned by dhcp_status. The DHCP client is in the REQUESTING state: it has requested a DHCP address, and is awaiting a reply.
|
|
|
DHCP status code returned by dhcp_status. The DHCP client is in the SELECTING state: it is collecting DHCP offers.
|
|
|
Version number associated with this header file. Should be the same as the version number returned by the dhcp_version function.
|
|
|
Returns the IP address of the primary DNS server. Returns the IP address of the primary DNS server. The DNS server can be set by an option received from a DHCP response, or by setting it manually from the DNS library function dns_setprimary. Note that this DNS server information entry is cleared out on initialization.
|
|
|
Returns the IP address of the secondary DNS server. Returns the IP address of the primary DNS server. The DNS server can be set by an option received from a DHCP response, or by setting it manually from the DNS library function dns_setprimary. Note that this DNS server information entry is cleared out on initialization.
|
|
||||||||||||
|
Returns the IP address of the DHCP server.
|
|
|
Returns task ID of the DHCP process. Returns the task ID of the DHCP process. If the DHCP process has not been initialized (but the init_rom function has been called), this function returns 0. The value returned by this function is suitable to use with the task library--for instance, to alter the priority of the DHCP task.
|
|
|
Initializes the DHCP client. Starts a DHCP Client task and returns to the caller. DHCP is implemented for IPv4 only. The IPv6 portion of the network stack uses neighbor discovery. To read the address that the DHCP client has leased, use the socket library function getnetworkparams.
|
|
|
Register a function to be called when a DHCP packet is about to be sent. The function passed as functionptr will be called when the DHCP client is about to send a DHCP packet. The function pointed to by functionptr should take two argumentis (a pointer and a byte) and return a byte. Whenever the function at functionptr is called, the pointer will be pointing to the first byte after the default options. The user can fill in additional DHCP options, e.g. 0x0c,0x04,'T','I','N','I' would be a DHCP hostname option. The msgtype argument contains the current DHCP message type (DHCP_MSG_DISCOVER or DHCP_MSG_REQUEST). The return value is the number of bytes added to the DHCP options, 6 in the hostname example above. The function does not need to save/restore any registers.
|
|
|
Register a function to be notified when DHCP acquires or loses an IP. The function passed as functionptr will be called when the DHCP client acquires or loses an IP.
|
|
|
Register a function to be called when an unknown or unhandled DHCP option is encountered. The function passed as functionptr will be called when the DHCP client is parsing an unknown DHCP option. The function pointed to by functionptr should take one argument (a pointer) and return void. Whenever the function at functionptr is called, the argument will be pointing to the current unhandled or vendor specific DHCP option. The function does not need to save/restore any registers.
|
|
|
Gets the status of the DHCP client. Returns the current state of the DHCP Client. DHCP Clients that have leased a valid address should return DHCP_STATUS_BOUND.
|
|
|
Disabled the DHCP client. Kills the DHCP client task. Use dhcp_init to restart the DHCP client.
|
|
|
Returns the version number of this DHCP library.
|
| Copyright 2004 Dallas Semiconductor, Inc.. | Documentation generated by Doxygen. |