42#define UHCP_MAGIC (0x55484350)
48#define UHCP_PORT (12345U)
51#define UHCP_PORT_STR "12345"
62typedef struct __attribute__((packed)) {
73typedef struct __attribute__((packed)) {
83typedef struct __attribute__((packed)) {
static uint32_t htonl(uint32_t v)
Convert from host byte order to network byte order, 32 bit.
void uhcp_handle_udp(uint8_t *buf, size_t len, uint8_t *src, uint16_t port, uhcp_iface_t iface)
handle incoming UDP packet
#define UHCP_VER
UHCP version of this header.
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)
uhcp_type_t
Enum containing possible UHCP packet types.
unsigned uhcp_iface_t
typedef for interface handle
void uhcp_handle_push(uhcp_push_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface)
handle incoming UHCP 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.
void uhcp_handle_req(uhcp_req_t *req, uint8_t *src, uint16_t port, uhcp_iface_t iface)
handle incoming UHCP request packet
#define UHCP_MAGIC
UHCP magic number.
@ UHCP_REQ
packet is a request packet
@ UHCP_PUSH
packet is a push / answer packet
Definitions for internet operations.
UHCP packet header struct.
uint32_t uhcp_magic
always contains UHCP in hex
uint8_t ver_type
four bits version number, four bits packet type (see uchp_type_t)
uhcp_hdr_t hdr
member holding parent type
uint8_t prefix_len
contains the prefix length of assigned prefix
struct for request packets
uint8_t prefix_len
contains the requested prefix length
uhcp_hdr_t hdr
member holding parent type