Replaced struct ip_addr by typedef ip_addr_t to make changing the actual implementation behind the typedef easier.

This commit is contained in:
goldsimon
2010-02-04 18:47:44 +00:00
parent 24fcf9a86e
commit 5d360a6711
51 changed files with 296 additions and 290 deletions

View File

@@ -108,7 +108,7 @@
static void autoip_handle_arp_conflict(struct netif *netif);
/* creates a pseudo random LL IP-Address for a network interface */
static void autoip_create_addr(struct netif *netif, struct ip_addr *ipaddr);
static void autoip_create_addr(struct netif *netif, ip_addr_t *ipaddr);
/* sends an ARP probe */
static err_t autoip_arp_probe(struct netif *netif);
@@ -171,7 +171,7 @@ autoip_handle_arp_conflict(struct netif *netif)
* @param ipaddr ip address to initialize
*/
static void
autoip_create_addr(struct netif *netif, struct ip_addr *ipaddr)
autoip_create_addr(struct netif *netif, ip_addr_t *ipaddr)
{
/* Here we create an IP-Address out of range 169.254.1.0 to 169.254.254.255
* compliant to RFC 3927 Section 2.1
@@ -233,7 +233,7 @@ static err_t
autoip_bind(struct netif *netif)
{
struct autoip *autoip = netif->autoip;
struct ip_addr sn_mask, gw_addr;
ip_addr_t sn_mask, gw_addr;
LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE,
("autoip_bind(netif=%p) %c%c%"U16_F" %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
@@ -297,7 +297,7 @@ autoip_start(struct netif *netif)
autoip->state = AUTOIP_STATE_OFF;
autoip->ttw = 0;
autoip->sent_num = 0;
memset(&autoip->llipaddr, 0, sizeof(struct ip_addr));
memset(&autoip->llipaddr, 0, sizeof(ip_addr_t));
autoip->lastconflict = 0;
}
@@ -451,7 +451,7 @@ autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr)
* when probing ip.dst == llipaddr && hw.src != netif->hwaddr
* we have a conflict and must solve it
*/
struct ip_addr sipaddr, dipaddr;
ip_addr_t sipaddr, dipaddr;
struct eth_addr netifaddr;
netifaddr.addr[0] = netif->hwaddr[0];
netifaddr.addr[1] = netif->hwaddr[1];

View File

@@ -82,7 +82,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
#endif /* LWIP_DEBUG */
struct icmp_echo_hdr *iecho;
struct ip_hdr *iphdr;
struct ip_addr tmpaddr;
ip_addr_t tmpaddr;
s16_t hlen;
ICMP_STATS_INC(icmp.recv);

View File

@@ -100,8 +100,8 @@ Steve Reynolds
*----------------------------------------------------------------------------*/
static struct igmp_group* igmp_group_list;
static struct ip_addr allsystems;
static struct ip_addr allrouters;
static ip_addr_t allsystems;
static ip_addr_t allrouters;
/**
* Initialize the IGMP module
@@ -241,7 +241,7 @@ igmp_report_groups( struct netif *netif)
* NULL if the group wasn't found.
*/
struct igmp_group *
igmp_lookfor_group(struct netif *ifp, struct ip_addr *addr)
igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr)
{
struct igmp_group *group = igmp_group_list;
@@ -267,7 +267,7 @@ igmp_lookfor_group(struct netif *ifp, struct ip_addr *addr)
* NULL on memory error.
*/
struct igmp_group *
igmp_lookup_group(struct netif *ifp, struct ip_addr *addr)
igmp_lookup_group(struct netif *ifp, ip_addr_t *addr)
{
struct igmp_group *group = igmp_group_list;
@@ -340,7 +340,7 @@ igmp_remove_group(struct igmp_group *group)
* @param dest destination ip address of the igmp packet
*/
void
igmp_input(struct pbuf *p, struct netif *inp, struct ip_addr *dest)
igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest)
{
struct ip_hdr * iphdr;
struct igmp_msg* igmp;
@@ -456,7 +456,7 @@ igmp_input(struct pbuf *p, struct netif *inp, struct ip_addr *dest)
* @return ERR_OK if group was joined on the netif(s), an err_t otherwise
*/
err_t
igmp_joingroup(struct ip_addr *ifaddr, struct ip_addr *groupaddr)
igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr)
{
err_t err = ERR_VAL; /* no matching interface */
struct igmp_group *group;
@@ -526,7 +526,7 @@ igmp_joingroup(struct ip_addr *ifaddr, struct ip_addr *groupaddr)
* @return ERR_OK if group was left on the netif(s), an err_t otherwise
*/
err_t
igmp_leavegroup(struct ip_addr *ifaddr, struct ip_addr *groupaddr)
igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr)
{
err_t err = ERR_VAL; /* no matching interface */
struct igmp_group *group;
@@ -690,7 +690,7 @@ igmp_delaying_member( struct igmp_group *group, u8_t maxresp)
* returns errors returned by netif->output
*/
err_t
igmp_ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
igmp_ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
u8_t ttl, u8_t proto, struct netif *netif)
{
/* This is the "router alert" option */
@@ -711,8 +711,8 @@ igmp_send(struct igmp_group *group, u8_t type)
{
struct pbuf* p = NULL;
struct igmp_msg* igmp = NULL;
struct ip_addr src = {0};
struct ip_addr* dest = NULL;
ip_addr_t src = {0};
ip_addr_t* dest = NULL;
/* IP header + "router alert" option + IGMP header */
p = pbuf_alloc(PBUF_TRANSPORT, IGMP_MINLEN, PBUF_RAM);

View File

@@ -281,7 +281,7 @@ lwip_standard_chksum(void *dataptr, int len)
*/
u16_t
inet_chksum_pseudo(struct pbuf *p,
struct ip_addr *src, struct ip_addr *dest,
ip_addr_t *src, ip_addr_t *dest,
u8_t proto, u16_t proto_len)
{
u32_t acc;
@@ -343,7 +343,7 @@ inet_chksum_pseudo(struct pbuf *p,
#if LWIP_UDPLITE
u16_t
inet_chksum_pseudo_partial(struct pbuf *p,
struct ip_addr *src, struct ip_addr *dest,
ip_addr_t *src, ip_addr_t *dest,
u8_t proto, u16_t proto_len, u16_t chksum_len)
{
u32_t acc;

View File

@@ -78,7 +78,7 @@ const struct ip_hdr *current_header;
* @return the netif on which to send to reach dest
*/
struct netif *
ip_route(struct ip_addr *dest)
ip_route(ip_addr_t *dest)
{
struct netif *netif;
@@ -118,7 +118,7 @@ static struct netif *
ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
{
struct netif *netif;
struct ip_addr dest;
ip_addr_t dest;
PERF_START;
dest = iphdr->dest;
@@ -495,7 +495,7 @@ ip_input(struct pbuf *p, struct netif *inp)
* unique identifiers independent of destination"
*/
err_t
ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
u8_t ttl, u8_t tos,
u8_t proto, struct netif *netif)
{
@@ -509,7 +509,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
* @ param ip_options pointer to the IP options, copied into the IP header
* @ param optlen length of ip_options
*/
err_t ip_output_if_opt(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options,
u16_t optlen)
{
@@ -622,7 +622,7 @@ err_t ip_output_if_opt(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest
* see ip_output_if() for more return values
*/
err_t
ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto)
{
struct netif *netif;
@@ -657,7 +657,7 @@ ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
* see ip_output_if() for more return values
*/
err_t
ip_output_hinted(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint)
{
struct netif *netif;

View File

@@ -40,9 +40,9 @@
#include "lwip/ip_addr.h"
#include "lwip/netif.h"
/* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in struct ip_addr.h */
const struct ip_addr ip_addr_any = { IPADDR_ANY };
const struct ip_addr ip_addr_broadcast = { IPADDR_BROADCAST };
/* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in ip_addr.h */
const ip_addr_t ip_addr_any = { IPADDR_ANY };
const ip_addr_t ip_addr_broadcast = { IPADDR_BROADCAST };
/**
* Determine if an address is a broadcast address on a network interface
@@ -51,7 +51,7 @@ const struct ip_addr ip_addr_broadcast = { IPADDR_BROADCAST };
* @param netif the network interface against which the address is checked
* @return returns non-zero if the address is a broadcast address
*/
u8_t ip_addr_isbroadcast(struct ip_addr *addr, struct netif *netif)
u8_t ip_addr_isbroadcast(ip_addr_t *addr, struct netif *netif)
{
u32_t addr2test;
@@ -99,7 +99,7 @@ u8_t ip_addr_isbroadcast(struct ip_addr *addr, struct netif *netif)
u32_t
ipaddr_addr(const char *cp)
{
struct ip_addr val;
ip_addr_t val;
if (ipaddr_aton(cp, &val)) {
return ip4_addr_get_u32(&val);
@@ -119,7 +119,7 @@ ipaddr_addr(const char *cp)
* @return 1 if cp could be converted to addr, 0 on failure
*/
int
ipaddr_aton(const char *cp, struct ip_addr *addr)
ipaddr_aton(const char *cp, ip_addr_t *addr)
{
u32_t val;
u8_t base;
@@ -220,7 +220,7 @@ ipaddr_aton(const char *cp, struct ip_addr *addr)
* represenation of addr
*/
char *
ipaddr_ntoa(struct ip_addr *addr)
ipaddr_ntoa(ip_addr_t *addr)
{
static char str[16];
u32_t s_addr;

View File

@@ -629,7 +629,7 @@ static u8_t buf[LWIP_MEM_ALIGN_SIZE(IP_FRAG_MAX_MTU + MEM_ALIGNMENT - 1)];
* @return ERR_OK if sent successfully, err_t otherwise
*/
err_t
ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest)
{
struct pbuf *rambuf;
#if IP_FRAG_USES_STATIC_BUF