Provides UHCP (micro host configuration protocol) More...
Provides UHCP (micro host configuration protocol)
UHCP (micro host configuration protocol) is a RIOT-proprietary protocol that was developed to have a simple drop-in replacement for DHCPv6 prefix delegation (which was not implemented when UHCP was introduced).
If you have root access on your host machine or access to a DHCPv6 server providing prefix delegation, DHCPv6 is preferred over UHCP.
Files | |
file | uhcp.h |
UHCP header. | |
Data Structures | |
struct | uhcp_hdr_t |
UHCP packet header struct. More... | |
struct | uhcp_req_t |
struct for request packets More... | |
struct | uhcp_push_t |
struct for push packets More... | |
Macros | |
#define | UHCP_MAGIC (0x55484350) /* "UHCP" in hex */ |
UHCP magic number. | |
#define | UHCP_VER (0) |
UHCP version of this header. | |
#define | UHCP_PORT (12345U) |
UHCP port number. | |
#define | UHCP_PORT_STR "12345" |
UHCP port number (as string for e.g., getaddrinfo() service arg. | |
Typedefs | |
typedef unsigned | uhcp_iface_t |
typedef for interface handle | |
Enumerations | |
enum | uhcp_type_t { UHCP_REQ, UHCP_PUSH } |
Enum containing possible UHCP packet types. More... | |
Functions | |
void | uhcp_handle_udp (uint8_t *buf, size_t len, uint8_t *src, uint16_t port, uhcp_iface_t iface) |
handle incoming UDP packet More... | |
void | uhcp_handle_req (uhcp_req_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface) |
handle incoming UHCP request packet More... | |
void | uhcp_handle_push (uhcp_push_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface) |
handle incoming UHCP push packet More... | |
void | uhcp_handle_prefix (uint8_t *prefix, uint8_t prefix_len, uint16_t lifetime, uint8_t *src, uhcp_iface_t iface) |
handle incoming prefix (as parsed from push packet) More... | |
static void | uhcp_hdr_set (uhcp_hdr_t *hdr, uhcp_type_t type) |
function to set constant values in UHCP header | |
int | udp_sendto (uint8_t *buf, size_t len, uint8_t *dst, uint16_t dst_port, uhcp_iface_t dst_iface) |
UDP send function used by UHCP client / server. More... | |
enum uhcp_type_t |
int udp_sendto | ( | uint8_t * | buf, |
size_t | len, | ||
uint8_t * | dst, | ||
uint16_t | dst_port, | ||
uhcp_iface_t | dst_iface | ||
) |
UDP send function used by UHCP client / server.
Supposed to be implemented by UHCP clients.
[in] | buf | buffer to send |
[in] | len | length of buf |
[in] | dst | ptr to IPv6 destination address |
[in] | dst_port | destination port |
[in] | dst_iface | interface number of destination interface |
void uhcp_handle_prefix | ( | uint8_t * | prefix, |
uint8_t | prefix_len, | ||
uint16_t | lifetime, | ||
uint8_t * | src, | ||
uhcp_iface_t | iface | ||
) |
handle incoming prefix (as parsed from push packet)
Supposed to be implemented by UHCP client implementations for the network stack.
The function might be called with an already configured prefix. In that case, the lifetime MUST be updated.
If the function is called with a different prefix than before, the old prefix MUST be considered obsolete.
[in] | prefix | ptr to assigned prefix |
[in] | prefix_len | length of assigned prefix |
[in] | lifetime | lifetime of prefix |
[in] | src | ptr to IPv6 source address |
[in] | iface | number of interface the packet came in |
void uhcp_handle_push | ( | uhcp_push_t * | req, |
uint8_t * | src, | ||
uint16_t | port, | ||
uhcp_iface_t | iface | ||
) |
handle incoming UHCP push packet
This function will be called by uhcp_handle_udp() for incoming push packet.
void uhcp_handle_req | ( | uhcp_req_t * | req, |
uint8_t * | src, | ||
uint16_t | port, | ||
uhcp_iface_t | iface | ||
) |
handle incoming UHCP request packet
This function will be called by uhcp_handle_udp() for incoming request packet.
void uhcp_handle_udp | ( | uint8_t * | buf, |
size_t | len, | ||
uint8_t * | src, | ||
uint16_t | port, | ||
uhcp_iface_t | iface | ||
) |
handle incoming UDP packet
This function should be called by UHCP server/client network code for every incoming UDP packet destined to UCHP_PORT.
[in] | buf | buffer containing UDP packet |
[in] | len | length of buf |
[in] | src | ptr to IPv6 source address |
[in] | port | source port of packet |
[in] | iface | interface number of incoming packet |