tcpip_adapter: typedef clean up

This commit is contained in:
Wu Jian Gang
2016-09-06 19:36:03 +08:00
parent 1588d1aa6e
commit df53d1588a
6 changed files with 81 additions and 112 deletions
+5 -6
View File
@@ -266,9 +266,9 @@ static u8_t *add_offer_options(u8_t *optptr)
*optptr++ = ip4_addr4(&ipadd);
if (dhcps_router_enabled(dhcps_offer)) {
struct ip_info if_ip;
tcpip_adapter_ip_info_t if_ip;
//bzero(&if_ip, sizeof(struct ip_info));
memset(&if_ip , 0x00, sizeof(struct ip_info));
memset(&if_ip , 0x00, sizeof(tcpip_adapter_ip_info_t));
tcpip_adapter_get_ip_info(WIFI_IF_AP, &if_ip);
@@ -1024,18 +1024,17 @@ static void dhcps_poll_set(u32_t ip)
* : info -- The current ip info
* Returns : none
*******************************************************************************/
void dhcps_start(struct netif *netif, struct ip_info *info)
void dhcps_start(struct netif *netif, ip4_addr_t ip)
{
struct netif *apnetif = netif;
if (apnetif->dhcps_pcb != NULL) {
udp_remove(apnetif->dhcps_pcb);
}
pcb_dhcps = udp_new();
if (pcb_dhcps == NULL || info == NULL) {
if (pcb_dhcps == NULL || ip4_addr_isany_val(ip)) {
printf("dhcps_start(): could not obtain pcb\n");
}
@@ -1043,7 +1042,7 @@ void dhcps_start(struct netif *netif, struct ip_info *info)
IP4_ADDR(&broadcast_dhcps, 255, 255, 255, 255);
server_address = info->ip;
server_address.addr = ip.addr;
dhcps_poll_set(server_address.addr);
client_address_plus.addr = dhcps_poll.start_ip.addr;
+11 -20
View File
@@ -17,17 +17,6 @@
#include "lwip/ip_addr.h"
//#include "esp_common.h"
#define USE_DNS
/* Here for now until needed in other places in lwIP */
#ifndef isprint
#define in_range(c, lo, up) ((u8_t)c >= lo && (u8_t)c <= up)
#define isprint(c) in_range(c, 0x20, 0x7f)
#define isdigit(c) in_range(c, '0', '9')
#define isxdigit(c) (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
#define islower(c) in_range(c, 'a', 'z')
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
#endif
#ifdef LWIP_ESP8266
typedef struct dhcps_state{
s16_t state;
@@ -164,6 +153,12 @@ typedef enum
CLASSLESS_ROUTE = 121,
} dhcp_msg_option;
/* Defined in esp_misc.h */
typedef struct {
bool enable;
ip4_addr_t start_ip;
ip4_addr_t end_ip;
} dhcps_lease_t;
enum dhcps_offer_option{
OFFER_START = 0x00,
@@ -188,22 +183,18 @@ typedef struct _list_node{
typedef u32_t dhcps_time_t;
typedef u8_t dhcps_offer_t;
/* struct dhcps_lease defined in tcpip_adapter.h */
typedef struct dhcps_lease dhcps_lease_t;
typedef struct _dhcps_options{
typedef struct {
dhcps_offer_t dhcps_offer;
dhcps_time_t dhcps_time;
dhcps_lease_t dhcps_poll;
}dhcps_options_t;
} dhcps_options_t;
#define dhcps_router_enabled(offer) ((offer & OFFER_ROUTER) != 0)
void dhcps_start(struct netif *netif, struct ip_info *info);
#define dhcps_router_enabled(offer) ((offer & OFFER_ROUTER) != 0)
void dhcps_start(struct netif *netif, ip4_addr_t ip);
void dhcps_stop(struct netif *netif);
void *dhcps_option_info(u8_t op_id, u32_t opt_len);
bool dhcp_search_ip_on_mac(u8_t *mac, ip4_addr_t *ip);
#endif
#endif