Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

ip_addr.h File Reference

#include "lwip/arch.h"

Include dependency graph for ipv4/lwip/ip_addr.h:

Go to the source code of this file.

Data Structures

struct  in_addr
struct  ip_addr

Defines

#define IP_ADDR_ANY   (&ip_addr_any)
#define IP_ADDR_BROADCAST   (&ip_addr_broadcast)
#define INADDR_NONE   ((u32_t) 0xffffffff)
#define INADDR_LOOPBACK   ((u32_t) 0x7f000001)
#define IN_CLASSA(a)   ((((u32_t)(a)) & 0x80000000) == 0)
#define IN_CLASSA_NET   0xff000000
#define IN_CLASSA_NSHIFT   24
#define IN_CLASSA_HOST   (0xffffffff & ~IN_CLASSA_NET)
#define IN_CLASSA_MAX   128
#define IN_CLASSB(a)   ((((u32_t)(a)) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET   0xffff0000
#define IN_CLASSB_NSHIFT   16
#define IN_CLASSB_HOST   (0xffffffff & ~IN_CLASSB_NET)
#define IN_CLASSB_MAX   65536
#define IN_CLASSC(a)   ((((u32_t)(a)) & 0xe0000000) == 0xc0000000)
#define IN_CLASSC_NET   0xffffff00
#define IN_CLASSC_NSHIFT   8
#define IN_CLASSC_HOST   (0xffffffff & ~IN_CLASSC_NET)
#define IN_CLASSD(a)   (((u32_t)(a) & 0xf0000000) == 0xe0000000)
#define IN_CLASSD_NET   0xf0000000
#define IN_CLASSD_NSHIFT   28
#define IN_CLASSD_HOST   0x0fffffff
#define IN_MULTICAST(a)   IN_CLASSD(a)
#define IN_EXPERIMENTAL(a)   (((u32_t)(a) & 0xf0000000) == 0xf0000000)
#define IN_BADCLASS(a)   (((u32_t)(a) & 0xf0000000) == 0xf0000000)
#define IN_LOOPBACKNET   127
#define IP4_ADDR(ipaddr, a, b, c, d)
#define ip_addr_set(dest, src)   (dest)->addr = ((struct ip_addr *)src)->addr
#define ip_addr_maskcmp(addr1, addr2, mask)
#define ip_addr_cmp(addr1, addr2)   ((addr1)->addr == (addr2)->addr)
#define ip_addr_isany(addr1)   ((addr1) == NULL || (addr1)->addr == 0)
#define ip_addr_isbroadcast(addr1, mask)
#define ip_addr_ismulticast(addr1)   (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000))
#define ip_addr_debug_print(ipaddr)
#define ip4_addr1(ipaddr)   ((u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff)
#define ip4_addr2(ipaddr)   ((u8_t)(ntohl((ipaddr)->addr) >> 16) & 0xff)
#define ip4_addr3(ipaddr)   ((u8_t)(ntohl((ipaddr)->addr) >> 8) & 0xff)
#define ip4_addr4(ipaddr)   ((u8_t)(ntohl((ipaddr)->addr)) & 0xff)

Functions

void string2ip_addr (struct ip_addr *ip, char *name, int size)

Variables

PACK_STRUCT_BEGIN struct ip_addr PACK_STRUCT_STRUCT
ip_addr ip_addr_any
ip_addr ip_addr_broadcast


Define Documentation

#define IN_BADCLASS  )     (((u32_t)(a) & 0xf0000000) == 0xf0000000)
 

Definition at line 78 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSA  )     ((((u32_t)(a)) & 0x80000000) == 0)
 

Definition at line 54 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSA_HOST   (0xffffffff & ~IN_CLASSA_NET)
 

Definition at line 57 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSA_MAX   128
 

Definition at line 58 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSA_NET   0xff000000
 

Definition at line 55 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSA_NSHIFT   24
 

Definition at line 56 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSB  )     ((((u32_t)(a)) & 0xc0000000) == 0x80000000)
 

Definition at line 60 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSB_HOST   (0xffffffff & ~IN_CLASSB_NET)
 

Definition at line 63 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSB_MAX   65536
 

Definition at line 64 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSB_NET   0xffff0000
 

Definition at line 61 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSB_NSHIFT   16
 

Definition at line 62 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSC  )     ((((u32_t)(a)) & 0xe0000000) == 0xc0000000)
 

Definition at line 66 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSC_HOST   (0xffffffff & ~IN_CLASSC_NET)
 

Definition at line 69 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSC_NET   0xffffff00
 

Definition at line 67 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSC_NSHIFT   8
 

Definition at line 68 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSD  )     (((u32_t)(a) & 0xf0000000) == 0xe0000000)
 

Definition at line 71 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSD_HOST   0x0fffffff
 

Definition at line 74 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSD_NET   0xf0000000
 

Definition at line 72 of file ipv4/lwip/ip_addr.h.

#define IN_CLASSD_NSHIFT   28
 

Definition at line 73 of file ipv4/lwip/ip_addr.h.

#define IN_EXPERIMENTAL  )     (((u32_t)(a) & 0xf0000000) == 0xf0000000)
 

Definition at line 77 of file ipv4/lwip/ip_addr.h.

#define IN_LOOPBACKNET   127
 

Definition at line 80 of file ipv4/lwip/ip_addr.h.

#define IN_MULTICAST  )     IN_CLASSD(a)
 

Definition at line 75 of file ipv4/lwip/ip_addr.h.

#define INADDR_LOOPBACK   ((u32_t) 0x7f000001)
 

Definition at line 47 of file ipv4/lwip/ip_addr.h.

Referenced by init_by_defaults().

#define INADDR_NONE   ((u32_t) 0xffffffff)
 

Definition at line 46 of file ipv4/lwip/ip_addr.h.

#define IP4_ADDR ipaddr,
a,
b,
c,
 ) 
 

Value:

(ipaddr)->addr = htonl(((u32_t)(a & 0xff) << 24) | ((u32_t)(b & 0xff) << 16) | \
                                                         ((u32_t)(c & 0xff) << 8) | (u32_t)(d & 0xff))

Definition at line 102 of file ipv4/lwip/ip_addr.h.

Referenced by string2ip_addr(), tcp_client(), and udpclient().

#define ip4_addr1 ipaddr   )     ((u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff)
 

Definition at line 130 of file ipv4/lwip/ip_addr.h.

Referenced by dhcp_bind(), and update_arp_entry().

#define ip4_addr2 ipaddr   )     ((u8_t)(ntohl((ipaddr)->addr) >> 16) & 0xff)
 

Definition at line 131 of file ipv4/lwip/ip_addr.h.

Referenced by etharp_output(), and update_arp_entry().

#define ip4_addr3 ipaddr   )     ((u8_t)(ntohl((ipaddr)->addr) >> 8) & 0xff)
 

Definition at line 132 of file ipv4/lwip/ip_addr.h.

Referenced by etharp_output(), and update_arp_entry().

#define ip4_addr4 ipaddr   )     ((u8_t)(ntohl((ipaddr)->addr)) & 0xff)
 

Definition at line 133 of file ipv4/lwip/ip_addr.h.

Referenced by etharp_output(), and update_arp_entry().

#define IP_ADDR_ANY   (&ip_addr_any)
 

Definition at line 43 of file ipv4/lwip/ip_addr.h.

Referenced by arp_init(), arp_tmr(), dhcp_discover(), dhcp_inform(), dhcp_rebind(), dhcp_release(), dhcp_renew(), dhcp_select(), and httpd_init().

#define IP_ADDR_BROADCAST   (&ip_addr_broadcast)
 

Definition at line 44 of file ipv4/lwip/ip_addr.h.

Referenced by dhcp_discover(), dhcp_inform(), dhcp_rebind(), dhcp_select(), and ip_input().

#define ip_addr_cmp addr1,
addr2   )     ((addr1)->addr == (addr2)->addr)
 

Definition at line 110 of file ipv4/lwip/ip_addr.h.

Referenced by add_arp_entry(), arp_arp_input(), arp_lookup(), etharp_arp_input(), etharp_output(), etharp_query(), ip_input(), ip_reass(), and update_arp_entry().

#define ip_addr_debug_print ipaddr   ) 
 

Value:

DEBUGF(LWIP_DEBUG, ("%d.%d.%d.%d", \
                    (u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff, \
                    (u8_t)(ntohl((ipaddr)->addr) >> 16) & 0xff, \
                    (u8_t)(ntohl((ipaddr)->addr) >> 8) & 0xff, \
                    (u8_t)ntohl((ipaddr)->addr) & 0xff))

Definition at line 123 of file ipv4/lwip/ip_addr.h.

Referenced by ip_forward(), ip_input(), lwip_accept(), lwip_bind(), lwip_connect(), lwip_getpeername(), lwip_getsockname(), lwip_recvfrom(), lwip_sendto(), and netif_add().

#define ip_addr_isany addr1   )     ((addr1) == NULL || (addr1)->addr == 0)
 

Definition at line 112 of file ipv4/lwip/ip_addr.h.

Referenced by add_arp_entry(), arp_tmr(), etharp_output(), ip_input(), and ip_output_if().

#define ip_addr_isbroadcast addr1,
mask   ) 
 

Value:

(((((addr1)->addr) & ~((mask)->addr)) == \
                                         (0xffffffff & ~((mask)->addr))) || \
                                         ((addr1)->addr == 0xffffffff) || \
                                         ((addr1)->addr == 0x00000000))

Definition at line 114 of file ipv4/lwip/ip_addr.h.

Referenced by etharp_output(), icmp_input(), and ip_input().

#define ip_addr_ismulticast addr1   )     (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000))
 

Definition at line 120 of file ipv4/lwip/ip_addr.h.

Referenced by etharp_output(), icmp_input(), and ip_input().

#define ip_addr_maskcmp addr1,
addr2,
mask   ) 
 

Value:

(((addr1)->addr & \
                                              (mask)->addr) == \
                                             ((addr2)->addr & \
                                              (mask)->addr))

Definition at line 106 of file ipv4/lwip/ip_addr.h.

Referenced by arp_ip_input(), etharp_ip_input(), etharp_output(), ip_input(), and ip_route().

#define ip_addr_set dest,
src   )     (dest)->addr = ((struct ip_addr *)src)->addr
 

Definition at line 105 of file ipv4/lwip/ip_addr.h.

Referenced by add_arp_entry(), arp_arp_input(), arp_init(), arp_query(), arp_tmr(), dhcp_bind(), dhcp_discover(), dhcp_handle_ack(), dhcp_handle_offer(), etharp_arp_input(), etharp_query(), icmp_input(), ip_output_if(), netif_set_gw(), netif_set_ipaddr(), netif_set_netmask(), and update_arp_entry().


Function Documentation

void string2ip_addr struct ip_addr ip,
char *  name,
int  size
 

Definition at line 53 of file ip_addr.c.

References get_int_from_char(), IP4_ADDR, name, and NULL.

Referenced by udpecho_thread().

00053                                                              {
00054   int i, index=0, sum[4]={0,0,0,0}, ciphers[3]={0,0,0},cont=0;
00055 
00056   if(name != NULL){
00057     for(i=0; i<3; i++){
00058       do{
00059         ciphers[cont]=get_int_from_char(name[index]);
00060         index++;
00061         cont++;
00062       }while(name[index] != 0x2e); //0x2e is the hex ascii code for '.'
00063       if(cont==3)
00064         sum[i] = ciphers[0]*100 + ciphers[1]*10 + ciphers[2];
00065       else if(cont==2)
00066         sum[i] = ciphers[0]*10 + ciphers[1];
00067       else
00068         sum[i] = ciphers[0];
00069       index++;
00070       ciphers[0] = 0; ciphers[1]= 0; ciphers[2] = 0; cont = 0;
00071     }
00072 
00073     while(name[index]!='\0'){
00074       ciphers[cont]= get_int_from_char(name[index]);
00075       index++;
00076       cont++;
00077     }
00078     if(cont==3)
00079       sum[3] = ciphers[0]*100 + ciphers[1]*10 + ciphers[2];
00080     else if(cont==2)
00081       sum[3] = ciphers[0]*10 + ciphers[1];
00082     else
00083       sum[3] = ciphers[0];
00084 
00085     IP4_ADDR(ip, sum[0],sum[1],sum[2],sum[3]);
00086   }
00087 }

Here is the call graph for this function:


Variable Documentation

struct ip_addr ip_addr_any
 

Definition at line 99 of file ipv4/lwip/ip_addr.h.

struct ip_addr ip_addr_broadcast
 

Definition at line 100 of file ipv4/lwip/ip_addr.h.

PACK_STRUCT_BEGIN struct ip_addr PACK_STRUCT_STRUCT
 


Generated on Wed Jan 14 12:59:06 2004 for RTL-lwIP-0.4 by doxygen 1.3.4