#include <stddef.h>
#include <network.h>
#include <dhcpc.h>
Go to the source code of this file.
|
#define | DHCP_OP_REQUEST 1 |
|
#define | DHCP_OP_REPLY 2 |
|
#define | DHCP_RETRANSMIT_COUNT 4 |
|
#define | DHCP_RETRANSMIT_TIME 5000 /* in ms */ |
|
#define | DHCPC_STATE_INIT 0 |
|
#define | DHCPC_STATE_SELECTING 1 |
|
#define | DHCPC_STATE_REQUESTING 2 |
|
#define | DHCPC_STATE_BOUND 3 |
|
#define | DHCPC_STATE_RENEW 4 |
|
#define | DHCPC_STATE_REBIND 5 |
|
#define | DHCPDISCOVER 1 |
|
#define | DHCPOFFER 2 |
|
#define | DHCPREQUEST 3 |
|
#define | DHCPDECLINE 4 |
|
#define | DHCPACK 5 |
|
#define | DHCPNAK 6 |
|
#define | DHCPRELEASE 7 |
|
#define | DHCP_TIMEOUT 0 |
|
#define | DHCP_HDR_LEN 240 |
|
#define | DHCP_OMSGTYPE_LEN 3 |
|
#define | DHCP_MAGICCOOKIE 0x63825363 |
|
#define | DHCP_HTYPE_ETHER 1 |
|
#define | DHCP_BROADCAST 0x8000 |
|
#define | DHCP_OPT_END 255 |
|
#define | DHCP_OPT_PAD 0 |
|
#define | DHCP_OPT_SUBNET 1 |
|
#define | DHCP_OPT_GATEWAY 3 |
|
#define | DHCP_OPT_DNS 6 |
|
#define | DHCP_OPT_HNAME 12 |
|
#define | DHCP_OPT_DOMAIN 15 |
|
#define | DHCP_OPT_REQUEST 50 |
|
#define | DHCP_OPT_LEASE 51 |
|
#define | DHCP_OPT_MSGTYPE 53 |
|
#define | DHCP_OPT_SERVER 54 |
|
#define | DHCP_OPT_PARAMREQ 55 |
|
#define | DHCP_TRACE(format,...) |
|
syscall dhcpRecvReply |
( |
int |
descrp, |
|
|
struct dhcpData * |
data, |
|
|
uint |
timeout |
|
) |
| |
Wait, with timeout, for a response from a DHCP server and update the DHCP transfer data. The exact behavior of this function depends on the current DHCP client state:
- If in DHCPC_STATE_SELECTING, the client waits until it gets a DHCPOFFER reply from any server.
- If in DHCPC_STATE_REQUESTING, the client waits until it gets a DHCPACK or DHCPNAK reply from the server to which it sent the DHCPREQUEST.
- Parameters
-
[in] | descrp | Network device on which to wait for a response. |
[in,out] | data | DHCP transfer data. |
[in] | timeout | Milliseconds to wait before timing out. |
- Returns
- OK if successful; TIMEOUT if timed out; SYSERR if other error occurred.
syscall dhcpSendRequest |
( |
int |
descrp, |
|
|
struct dhcpData * |
data |
|
) |
| |
Send a DHCPDISCOVER or DHCPREQUEST packet, depending on the current state of the DHCP client (DHCPC_STATE_INIT or DHCPC_STATE_SELECTING, respectively).
- Parameters
-
[in] | descrp | Network device on which to send the DHCP packet. |
[in,out] | data | DHCP transfer data that has been filled in appropriately for DHCPC_STATE_INIT or DHCPC_STATE_SELECTING. |
- Returns
- OK if packet was successfully sent; SYSERR otherwise.