mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-01 05:52:32 +07:00
Merge pull request #3273 from cesanta/dhcpname
Make DHCP name size configurable
This commit is contained in:
+18
-14
@@ -1061,6 +1061,10 @@ struct timeval {
|
||||
#define MG_SET_MAC_ADDRESS(mac)
|
||||
#endif
|
||||
|
||||
#ifndef MG_TCPIP_DHCPNAME_SIZE
|
||||
#define MG_TCPIP_DHCPNAME_SIZE 18 // struct mg_tcpip_if :: dhcp_name size
|
||||
#endif
|
||||
|
||||
#ifndef MG_SET_WIFI_CONFIG
|
||||
#define MG_SET_WIFI_CONFIG(data)
|
||||
#endif
|
||||
@@ -3082,19 +3086,20 @@ typedef void (*mg_tcpip_event_handler_t)(struct mg_tcpip_if *ifp, int ev,
|
||||
void *ev_data);
|
||||
|
||||
enum {
|
||||
MG_TCPIP_EV_ST_CHG, // state change uint8_t * (&ifp->state)
|
||||
MG_TCPIP_EV_DHCP_DNS, // DHCP DNS assignment uint32_t *ipaddr
|
||||
MG_TCPIP_EV_DHCP_SNTP, // DHCP SNTP assignment uint32_t *ipaddr
|
||||
MG_TCPIP_EV_ARP, // Got ARP packet struct mg_str *
|
||||
MG_TCPIP_EV_TIMER_1S, // 1 second timer NULL
|
||||
MG_TCPIP_EV_WIFI_SCAN_RESULT, // Wi-Fi scan results struct mg_wifi_scan_bss_data *
|
||||
MG_TCPIP_EV_WIFI_SCAN_END, // Wi-Fi scan has finished NULL
|
||||
MG_TCPIP_EV_WIFI_CONNECT_ERR, // Wi-Fi connect has failed driver and chip specific
|
||||
MG_TCPIP_EV_DRIVER, // Driver event driver specific
|
||||
MG_TCPIP_EV_USER // Starting ID for user events
|
||||
MG_TCPIP_EV_ST_CHG, // state change uint8_t * (&ifp->state)
|
||||
MG_TCPIP_EV_DHCP_DNS, // DHCP DNS assignment uint32_t *ipaddr
|
||||
MG_TCPIP_EV_DHCP_SNTP, // DHCP SNTP assignment uint32_t *ipaddr
|
||||
MG_TCPIP_EV_ARP, // Got ARP packet struct mg_str *
|
||||
MG_TCPIP_EV_TIMER_1S, // 1 second timer NULL
|
||||
MG_TCPIP_EV_WIFI_SCAN_RESULT, // Wi-Fi scan results struct
|
||||
// mg_wifi_scan_bss_data *
|
||||
MG_TCPIP_EV_WIFI_SCAN_END, // Wi-Fi scan has finished NULL
|
||||
MG_TCPIP_EV_WIFI_CONNECT_ERR, // Wi-Fi connect has failed driver and
|
||||
// chip specific
|
||||
MG_TCPIP_EV_DRIVER, // Driver event driver specific
|
||||
MG_TCPIP_EV_USER // Starting ID for user events
|
||||
};
|
||||
|
||||
|
||||
// Network interface
|
||||
struct mg_tcpip_if {
|
||||
uint8_t mac[6]; // MAC address. Must be set to a valid MAC
|
||||
@@ -3114,8 +3119,8 @@ struct mg_tcpip_if {
|
||||
mg_tcpip_event_handler_t fn; // User-specified event handler function
|
||||
struct mg_mgr *mgr; // Mongoose event manager
|
||||
struct mg_queue recv_queue; // Receive queue
|
||||
char dhcp_name[12]; // Name reported to DHCP, "mip" if unset
|
||||
uint16_t mtu; // Interface MTU
|
||||
char dhcp_name[MG_TCPIP_DHCPNAME_SIZE]; // Name for DHCP, "mip" if unset
|
||||
uint16_t mtu; // Interface MTU
|
||||
#define MG_TCPIP_MTU_DEFAULT 1500
|
||||
|
||||
// Internal state, user can use it but should not change it
|
||||
@@ -3168,7 +3173,6 @@ struct mg_tcpip_spi {
|
||||
uint8_t (*txn)(void *, uint8_t); // SPI transaction: write 1 byte, read reply
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -179,6 +179,10 @@
|
||||
#define MG_SET_MAC_ADDRESS(mac)
|
||||
#endif
|
||||
|
||||
#ifndef MG_TCPIP_DHCPNAME_SIZE
|
||||
#define MG_TCPIP_DHCPNAME_SIZE 18 // struct mg_tcpip_if :: dhcp_name size
|
||||
#endif
|
||||
|
||||
#ifndef MG_SET_WIFI_CONFIG
|
||||
#define MG_SET_WIFI_CONFIG(data)
|
||||
#endif
|
||||
|
||||
+14
-14
@@ -20,19 +20,20 @@ typedef void (*mg_tcpip_event_handler_t)(struct mg_tcpip_if *ifp, int ev,
|
||||
void *ev_data);
|
||||
|
||||
enum {
|
||||
MG_TCPIP_EV_ST_CHG, // state change uint8_t * (&ifp->state)
|
||||
MG_TCPIP_EV_DHCP_DNS, // DHCP DNS assignment uint32_t *ipaddr
|
||||
MG_TCPIP_EV_DHCP_SNTP, // DHCP SNTP assignment uint32_t *ipaddr
|
||||
MG_TCPIP_EV_ARP, // Got ARP packet struct mg_str *
|
||||
MG_TCPIP_EV_TIMER_1S, // 1 second timer NULL
|
||||
MG_TCPIP_EV_WIFI_SCAN_RESULT, // Wi-Fi scan results struct mg_wifi_scan_bss_data *
|
||||
MG_TCPIP_EV_WIFI_SCAN_END, // Wi-Fi scan has finished NULL
|
||||
MG_TCPIP_EV_WIFI_CONNECT_ERR, // Wi-Fi connect has failed driver and chip specific
|
||||
MG_TCPIP_EV_DRIVER, // Driver event driver specific
|
||||
MG_TCPIP_EV_USER // Starting ID for user events
|
||||
MG_TCPIP_EV_ST_CHG, // state change uint8_t * (&ifp->state)
|
||||
MG_TCPIP_EV_DHCP_DNS, // DHCP DNS assignment uint32_t *ipaddr
|
||||
MG_TCPIP_EV_DHCP_SNTP, // DHCP SNTP assignment uint32_t *ipaddr
|
||||
MG_TCPIP_EV_ARP, // Got ARP packet struct mg_str *
|
||||
MG_TCPIP_EV_TIMER_1S, // 1 second timer NULL
|
||||
MG_TCPIP_EV_WIFI_SCAN_RESULT, // Wi-Fi scan results struct
|
||||
// mg_wifi_scan_bss_data *
|
||||
MG_TCPIP_EV_WIFI_SCAN_END, // Wi-Fi scan has finished NULL
|
||||
MG_TCPIP_EV_WIFI_CONNECT_ERR, // Wi-Fi connect has failed driver and
|
||||
// chip specific
|
||||
MG_TCPIP_EV_DRIVER, // Driver event driver specific
|
||||
MG_TCPIP_EV_USER // Starting ID for user events
|
||||
};
|
||||
|
||||
|
||||
// Network interface
|
||||
struct mg_tcpip_if {
|
||||
uint8_t mac[6]; // MAC address. Must be set to a valid MAC
|
||||
@@ -52,8 +53,8 @@ struct mg_tcpip_if {
|
||||
mg_tcpip_event_handler_t fn; // User-specified event handler function
|
||||
struct mg_mgr *mgr; // Mongoose event manager
|
||||
struct mg_queue recv_queue; // Receive queue
|
||||
char dhcp_name[12]; // Name reported to DHCP, "mip" if unset
|
||||
uint16_t mtu; // Interface MTU
|
||||
char dhcp_name[MG_TCPIP_DHCPNAME_SIZE]; // Name for DHCP, "mip" if unset
|
||||
uint16_t mtu; // Interface MTU
|
||||
#define MG_TCPIP_MTU_DEFAULT 1500
|
||||
|
||||
// Internal state, user can use it but should not change it
|
||||
@@ -106,5 +107,4 @@ struct mg_tcpip_spi {
|
||||
uint8_t (*txn)(void *, uint8_t); // SPI transaction: write 1 byte, read reply
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user