summaryrefslogtreecommitdiff
path: root/libdhcp/include
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-21 22:32:50 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-21 22:32:50 -0600
commit898ff8c864af4ea22264988031f3e86abc129f25 (patch)
tree4d7e58637f9343cb3ef0f6952dc0b9eafef9ce22 /libdhcp/include
parent26c61695dd785c2a434b4c02a406a683c8386fcc (diff)
tidy dhcp
Diffstat (limited to 'libdhcp/include')
-rw-r--r--libdhcp/include/libdhcp/dhcp.h37
1 files changed, 8 insertions, 29 deletions
diff --git a/libdhcp/include/libdhcp/dhcp.h b/libdhcp/include/libdhcp/dhcp.h
index 4cdd2e2..ec3912e 100644
--- a/libdhcp/include/libdhcp/dhcp.h
+++ b/libdhcp/include/libdhcp/dhcp.h
@@ -69,6 +69,8 @@
#include <libmisc/net.h>
+/*#define _DHCP_DEBUG_*/
+
typedef struct {} implements_net_udpsock;
ssize_t sendto(implements_net_udpsock *sock, void *buf, size_t len, struct net_ip4_addr addr, uint16_t port);
ssize_t recvfrom(implements_net_udpsock *sock, void *buf, size_t len, struct net_ip4_addr *ret_addr, uint16_t *ret_port);
@@ -89,35 +91,20 @@ enum dhcp_event {
typedef void (*dhcp_callback_t)(enum dhcp_event, struct dhcp_lease);
-/*
- * @brief
- * @details If you want to display debug & processing message, Define _DHCP_DEBUG_
- * @note If defined, it depends on <stdio.h>
- */
-//#define _DHCP_DEBUG_
-
-
/* Retry to processing DHCP */
#define MAX_DHCP_RETRY 2 ///< Maximum retry count
#define DHCP_WAIT_TIME 10 ///< Wait Time 10s
-
-/* UDP port numbers for DHCP */
-#define DHCP_SERVER_PORT 67 ///< DHCP server port number
-#define DHCP_CLIENT_PORT 68 ///< DHCP client port number
-
-#define MAGIC_COOKIE 0x63825363 ///< You should not modify it number.
-
/*
* @brief return value of @ref DHCP_run()
*/
enum {
- DHCP_RET_FAILED = 0, ///< Processing Fail
- DHCP_RET_RUNNING, ///< Processing DHCP protocol
- DHCP_RET_IP_ASSIGN, ///< First Occupy IP from DHPC server (if cbfunc == null, act as default default_ip_assign)
- DHCP_RET_IP_CHANGED, ///< Change IP address by new ip from DHCP (if cbfunc == null, act as default default_ip_update)
- DHCP_RET_IP_LEASED, ///< Stand by
- DHCP_RET_STOPPED ///< Stop processing DHCP protocol
+ DHCP_RET_FAILED = 0, // Processing Fail
+ DHCP_RET_RUNNING, // Processing DHCP protocol
+ DHCP_RET_IP_ASSIGN, // First Occupy IP from DHPC server (if cbfunc == null, act as default default_ip_assign)
+ DHCP_RET_IP_CHANGED, // Change IP address by new ip from DHCP (if cbfunc == null, act as default default_ip_update)
+ DHCP_RET_IP_LEASED, // Stand by
+ DHCP_RET_STOPPED // Stop processing DHCP protocol
};
/*
@@ -134,14 +121,6 @@ void DHCP_init(uint8_t s, uint8_t * buf);
void DHCP_time_handler(void);
/*
- * @brief Register call back function
- * @param ip_assign - callback func when IP is assigned from DHCP server first
- * @param ip_update - callback func when IP is changed
- * @param ip_conflict - callback func when the assigned IP is conflict with others.
- */
-void reg_dhcp_cbfunc(void(*ip_assign)(void), void(*ip_update)(void), void(*ip_conflict)(void));
-
-/*
* @brief DHCP client in the main loop
* @return The value is as the follow \n
* @ref DHCP_FAILED \n