|
COSA
An Object-Oriented Platform for Arduino Programming
|
#include <DHCP.hh>

Public Member Functions | |
| DHCP (const char *hostname, const uint8_t *mac) | |
| bool | begin (Socket *sock) |
| bool | end () |
| int | discover () |
| int | request (uint8_t ip[4], uint8_t subnet[4], uint8_t gateway[4]) |
| int | renew (Socket *sock) |
| int | release (Socket *sock) |
| uint32_t | lease_obtained () const |
| uint32_t | lease_expires () const |
| const uint8_t * | dhcp_addr () const |
| const uint8_t * | dns_addr () const |
| const uint8_t * | gateway_addr () const |
Static Public Attributes | |
| static const uint16_t | PORT = 68 |
Dynamic Host Configuration Protocol. Supports dynamic assignment of network address. Used with connection-less socket to configure a client with network address and subnet mask. Also provides network addresses for DHCP and DNS server.
| DHCP::DHCP | ( | const char * | hostname, |
| const uint8_t * | mac | ||
| ) |
| bool DHCP::begin | ( | Socket * | sock | ) |
|
inline |
| int DHCP::discover | ( | ) |
|
inline |
| bool DHCP::end | ( | ) |
|
inline |
|
inline |
|
inline |
| int DHCP::release | ( | Socket * | sock | ) |
Release the granted network address lease from successful request(). Returns zero if successful otherwise a negative error code; -1 illegal state, -2 request failed, -3 no response. The given socket is closed and the DHCP client handler is put in idle state.
| [in] | sock | connection-less socket to use for release. |
| int DHCP::renew | ( | Socket * | sock | ) |
Renew the granted network address lease from successful request(). Returns zero if successful otherwise a negative error code; -1 illegal state, -2 request failed, -3 no response.
| [in] | sock | connection-less socket to use for release. |
| int DHCP::request | ( | uint8_t | ip[4], |
| uint8_t | subnet[4], | ||
| uint8_t | gateway[4] | ||
| ) |
Accept the offer provided by DHCP server on successful discover(). Return zero if successful otherwise a negative error code; -1 not initiated, -2 request failed, -3 no response. Client network address and subnet mask are returned in given reference parameters.
| [in,out] | ip | granted network address. |
| [in,out] | subnet | mask. |
| [in,out] | gateway | network address. |
|
static |