From 4169ef924b12cb5c7eff4b8c13ff8dce4559c523 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 13 Aug 2021 15:47:17 +0000 Subject: [PATCH] added some dhcp6 definitions --- hio/lib/dhcp-svr.c | 1 + hio/lib/hio-dhcp.h | 75 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/hio/lib/dhcp-svr.c b/hio/lib/dhcp-svr.c index a3ab735..dae1c2f 100644 --- a/hio/lib/dhcp-svr.c +++ b/hio/lib/dhcp-svr.c @@ -22,6 +22,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include "hio-prv.h" diff --git a/hio/lib/hio-dhcp.h b/hio/lib/hio-dhcp.h index 28e7947..7632302 100644 --- a/hio/lib/hio-dhcp.h +++ b/hio/lib/hio-dhcp.h @@ -28,7 +28,75 @@ #include #include -#define HIO_DNS_PORT (53) +#define HIO_DHCP6_SERVER_PORT (547) +#define HIO_DHCP6_CLIENT_PORT (546) +#define HIO_DHCP6_HOP_COUNT_LIMIT (32) + +enum hio_dhcp6_msg_t +{ + HIO_DHCP6_MSG_SOLICIT = 1, + HIO_DHCP6_MSG_ADVERTISE = 2, + HIO_DHCP6_MSG_REQUEST = 3, + HIO_DHCP6_MSG_CONFIRM = 4, + HIO_DHCP6_MSG_RENEW = 5, + HIO_DHCP6_MSG_REBIND = 6, + HIO_DHCP6_MSG_REPLY = 7, + HIO_DHCP6_MSG_RELEASE = 8, + HIO_DHCP6_MSG_DECLINE = 9, + HIO_DHCP6_MSG_RECONFIGURE = 10, + HIO_DHCP6_MSG_INFOREQ = 11, + HIO_DHCP6_MSG_RELAYFORW = 12, + HIO_DHCP6_MSG_RELAYREPL = 13, +}; +typedef enum hio_dhcp6_msg_t hio_dhcp6_msg_t; + +enum hio_dhcp6_opt_t +{ + HIO_DHCP6_OPT_RELAY_MESSAGE = 9, + HIO_DHCP6_OPT_INTERFACE_ID = 18 +}; +typedef enum hio_dhcp6_opt_t hio_dhcp6_opt_t; + + + +/* ---------------------------------------------------------------- */ +#include + +struct hio_dhcp6_pkt_hdr_t +{ + hio_uint8_t msgtype; + hio_uint8_t transid[3]; +}; +typedef struct hio_dhcp6_pkt_hdr_t hio_dhcp6_pkt_hdr_t; + +struct hio_dhcp6_relay_hdr_t +{ + hio_uint8_t msgtype; /* RELAY-FORW, RELAY-REPL */ + hio_uint8_t hopcount; + hio_uint8_t linkaddr[16]; + hio_uint8_t peeraddr[16]; +}; +typedef struct hio_dhcp6_relay_hdr_t hio_dhcp6_relay_hdr_t; + +struct hio_dhcp6_opt_hdr_t +{ + hio_uint16_t code; + hio_uint16_t len; /* length of option data, excludes the option header */ +}; +typedef struct hio_dhcp6_opt_hdr_t hio_dhcp6_opt_hdr_t; + +#include + + +struct hio_dhcp6_pktinf_t +{ + hio_dhcp6_pkt_hdr_t* hdr; + hio_oow_t len; +}; +typedef struct hio_dhcp6_pktinf_t hio_dhcp6_pktinf_t; + +/* ---------------------------------------------------------------- */ + typedef struct hio_svc_dhcs_t hio_svc_dhcs_t; @@ -39,12 +107,15 @@ extern "C" { #endif HIO_EXPORT hio_svc_dhcs_t* hio_svc_dhcs_start ( - hio_t* hio, + hio_t* hio +#if 0 + , const hio_skad_t* serv_addr, /* required */ const hio_skad_t* bind_addr, /* optional. can be HIO_NULL */ const hio_ntime_t* send_tmout, /* required */ const hio_ntime_t* reply_tmout, /* required */ hio_oow_t max_tries /* required */ +#endif ); HIO_EXPORT void hio_svc_dhcs_stop (