task #14314: include cleanups

Couple of more cleanups for task #14314 involving includes:
  1) if.h name should match if_api.c due to LwIP convention and history.
     Standard if.h include can be used with compatibility header in
     posix/net/if.h
  2) API header (if.h) should not be included in core code. This include
     has been eliminated by moving the definition of IF_NAMESIZE to
     netif.h as NETIF_NAMESIZE.  This is now the canonical definition
     and IF_NAMESIZE just maps to it to provide the standard type
This commit is contained in:
Joel Cunningham
2017-02-03 16:45:29 -06:00
parent 3d80e51b2a
commit 4fb7d74165
7 changed files with 19 additions and 14 deletions

View File

@@ -40,8 +40,9 @@
#define LWIP_HDR_IF_H
#include "lwip/opt.h"
#include "lwip/netif.h"
#define IF_NAMESIZE 6 /* 2 chars, 3 nums, 1 \0 */
#define IF_NAMESIZE NETIF_NAMESIZE
char * lwip_if_indextoname(unsigned int ifindex, char *ifname);
unsigned int lwip_if_nametoindex(const char *ifname);

View File

@@ -63,6 +63,12 @@ extern "C" {
#define NETIF_MAX_HWADDR_LEN 6U
#endif
/** The size of a fully constructed netif name which the
* netif can be identified by in APIs. Composed of
* 2 chars, 3 (max) digits, and 1 \0
*/
#define NETIF_NAMESIZE 6
/**
* @defgroup netif_flags Flags
* @ingroup netif

View File

@@ -40,7 +40,6 @@
#include "lwip/netif.h"
#include "lwip/dhcp.h"
#include "lwip/autoip.h"
#include "lwip/if.h"
#include "lwip/priv/tcpip_priv.h"
#ifdef __cplusplus
@@ -76,7 +75,7 @@ struct netifapi_msg {
} common;
struct {
#if LWIP_MPU_COMPATIBLE
char name[IF_NAMESIZE];
char name[NETIF_NAMESIZE];
#else /* LWIP_MPU_COMPATIBLE */
char *name;
#endif /* LWIP_MPU_COMPATIBLE */

View File

@@ -1,6 +1,6 @@
/**
* @file
* This file is a posix wrapper for lwip/if.h.
* This file is a posix wrapper for lwip/if_api.h.
*/
/*
@@ -30,4 +30,4 @@
*
*/
#include "lwip/if.h"
#include "lwip/if_api.h"