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.
|
#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.
|
|
|
void | uhcp_handle_udp (uint8_t *buf, size_t len, uint8_t *src, uint16_t port, uhcp_iface_t iface) |
| handle incoming UDP packet
|
|
void | uhcp_handle_req (uhcp_req_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface) |
| handle incoming UHCP request packet
|
|
void | uhcp_handle_push (uhcp_push_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface) |
| handle incoming UHCP push packet
|
|
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)
|
|
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.
|
|
◆ UHCP_MAGIC
#define UHCP_MAGIC (0x55484350) /* "UHCP" in hex */ |
UHCP magic number.
Definition at line 42 of file uhcp.h.
◆ UHCP_PORT
#define UHCP_PORT (12345U) |
UHCP port number.
Definition at line 48 of file uhcp.h.
◆ UHCP_PORT_STR
#define UHCP_PORT_STR "12345" |
UHCP port number (as string for e.g., getaddrinfo() service arg.
Definition at line 51 of file uhcp.h.
◆ UHCP_VER
UHCP version of this header.
Definition at line 45 of file uhcp.h.
◆ uhcp_iface_t
typedef for interface handle
Definition at line 91 of file uhcp.h.
◆ uhcp_type_t
Enum containing possible UHCP packet types.
Enumerator |
---|
UHCP_REQ | packet is a request packet
|
UHCP_PUSH | packet is a push / answer packet
|
Definition at line 54 of file uhcp.h.
◆ udp_sendto()
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.
- Parameters
-
[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 |
◆ uhcp_handle_prefix()
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.
- Parameters
-
[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 |
◆ uhcp_handle_push()
handle incoming UHCP push packet
This function will be called by uhcp_handle_udp() for incoming push packet.
◆ uhcp_handle_req()
handle incoming UHCP request packet
This function will be called by uhcp_handle_udp() for incoming request packet.
◆ uhcp_handle_udp()
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.
- Parameters
-
[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 |
◆ uhcp_hdr_set()
function to set constant values in UHCP header
Definition at line 165 of file uhcp.h.