INET Framework for OMNeT++/OMNEST
ip_addr.h File Reference

Classes

struct  inet::tcp::ip_addr
 
struct  inet::tcp::ip_addr2
 

Namespaces

 inet
 Copyright (c) 2005 Jan Ringo�, www.ringos.cz.
 
 inet::tcp
 

Macros

#define IP_ADDR_ANY   ((struct ip_addr *)&ip_addr_any)
 IP_ADDR_ can be used as a fixed IP address for the wildcard and the broadcast address. More...
 
#define IP_ADDR_BROADCAST   ((struct ip_addr *)&ip_addr_broadcast)
 
#define IN_CLASSA(a)   ((((u32_t)(a)) & 0x80000000UL) == 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)) & 0xc0000000UL) == 0x80000000UL)
 
#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)) & 0xe0000000UL) == 0xc0000000UL)
 
#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) & 0xf0000000UL) == 0xe0000000UL)
 
#define IN_CLASSD_NET   0xf0000000 /* These ones aren't really */
 
#define IN_CLASSD_NSHIFT   28 /* net and host fields, but */
 
#define IN_CLASSD_HOST   0x0fffffff /* routing needn't know. */
 
#define IN_MULTICAST(a)   IN_CLASSD(a)
 
#define IN_EXPERIMENTAL(a)   (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL)
 
#define IN_BADCLASS(a)   (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL)
 
#define IN_LOOPBACKNET   127 /* official! */
 
#define IP4_ADDR(ipaddr, a, b, c, d)
 
#define ip_addr_set(dest, src)
 
#define ip_addr_netcmp(addr1, addr2, mask)
 Determine if two address are on the same network. More...
 
#define ip_addr_cmp(addr1, addr2)   ((addr1)->addr == (addr2)->addr)
 
#define ip_addr_isany(addr1)   ((addr1) == nullptr || (addr1)->addr.isUnspecified())
 
#define ip_addr_ismulticast(addr1)   (false)
 
#define ip_addr_islinklocal(addr1)   (((addr1)->addr & ntohl(0xffff0000UL)) == ntohl(0xa9fe0000UL))
 
#define ip_addr_debug_print(debug, ipaddr)
 
#define ip4_addr1(ipaddr)   ((u16_t)(ntohl((ipaddr)->addr) >> 24) & 0xff)
 
#define ip4_addr2(ipaddr)   ((u16_t)(ntohl((ipaddr)->addr) >> 16) & 0xff)
 
#define ip4_addr3(ipaddr)   ((u16_t)(ntohl((ipaddr)->addr) >> 8) & 0xff)
 
#define ip4_addr4(ipaddr)   ((u16_t)(ntohl((ipaddr)->addr)) & 0xff)
 
#define ip_ntoa(addr)   ((addr != nullptr) ? inet_ntoa(*((struct in_addr*)(addr))) : "nullptr")
 Same as inet_ntoa() but takes a struct ip_addr*. More...
 

Functions

u8_t inet::tcp::ip_addr_isbroadcast (struct ip_addr *, struct netif *)
 

Variables

PACK_STRUCT_BEGIN struct inet::tcp::ip_addr inet::tcp::PACK_STRUCT_STRUCT
 
const struct ip_addr inet::tcp::ip_addr_any
 
const struct ip_addr inet::tcp::ip_addr_broadcast
 

Macro Definition Documentation

#define IN_BADCLASS (   a)    (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL)
#define IN_CLASSA (   a)    ((((u32_t)(a)) & 0x80000000UL) == 0)
#define IN_CLASSA_HOST   (0xffffffff & ~IN_CLASSA_NET)
#define IN_CLASSA_MAX   128
#define IN_CLASSA_NET   0xff000000
#define IN_CLASSA_NSHIFT   24
#define IN_CLASSB (   a)    ((((u32_t)(a)) & 0xc0000000UL) == 0x80000000UL)
#define IN_CLASSB_HOST   (0xffffffff & ~IN_CLASSB_NET)
#define IN_CLASSB_MAX   65536
#define IN_CLASSB_NET   0xffff0000
#define IN_CLASSB_NSHIFT   16
#define IN_CLASSC (   a)    ((((u32_t)(a)) & 0xe0000000UL) == 0xc0000000UL)
#define IN_CLASSC_HOST   (0xffffffff & ~IN_CLASSC_NET)
#define IN_CLASSC_NET   0xffffff00
#define IN_CLASSC_NSHIFT   8
#define IN_CLASSD (   a)    (((u32_t)(a) & 0xf0000000UL) == 0xe0000000UL)
#define IN_CLASSD_HOST   0x0fffffff /* routing needn't know. */
#define IN_CLASSD_NET   0xf0000000 /* These ones aren't really */
#define IN_CLASSD_NSHIFT   28 /* net and host fields, but */
#define IN_EXPERIMENTAL (   a)    (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL)
#define IN_LOOPBACKNET   127 /* official! */
#define IN_MULTICAST (   a)    IN_CLASSD(a)
#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))
const value< double, compose< units::m, pow< units::s,-1 > > > c(299792458)
u32_t htonl(u32_t n)
uint32_t u32_t
Definition: cc.h:39
value< double, units::m > b
Definition: Units.h:1054
#define ip4_addr1 (   ipaddr)    ((u16_t)(ntohl((ipaddr)->addr) >> 24) & 0xff)
#define ip4_addr2 (   ipaddr)    ((u16_t)(ntohl((ipaddr)->addr) >> 16) & 0xff)
#define ip4_addr3 (   ipaddr)    ((u16_t)(ntohl((ipaddr)->addr) >> 8) & 0xff)
#define ip4_addr4 (   ipaddr)    ((u16_t)(ntohl((ipaddr)->addr)) & 0xff)
#define IP_ADDR_ANY   ((struct ip_addr *)&ip_addr_any)

IP_ADDR_ can be used as a fixed IP address for the wildcard and the broadcast address.

#define IP_ADDR_BROADCAST   ((struct ip_addr *)&ip_addr_broadcast)
#define ip_addr_cmp (   addr1,
  addr2 
)    ((addr1)->addr == (addr2)->addr)
#define ip_addr_debug_print (   debug,
  ipaddr 
)
Value:
LWIP_DEBUGF(debug, ("%" U16_F ".%" U16_F ".%" U16_F ".%" U16_F, \
ipaddr != nullptr ? \
(u16_t)(ntohl((ipaddr)->addr) >> 24) & 0xff : 0, \
ipaddr != nullptr ? \
(u16_t)(ntohl((ipaddr)->addr) >> 16) & 0xff : 0, \
ipaddr != nullptr ? \
(u16_t)(ntohl((ipaddr)->addr) >> 8) & 0xff : 0, \
ipaddr != nullptr ? \
(u16_t)ntohl((ipaddr)->addr) & 0xff : 0))
#define U16_F
Definition: cc.h:56
u32_t ntohl(u32_t n)
uint16_t u16_t
Definition: cc.h:35
#define LWIP_DEBUGF(debug, message)
Definition: debug.h:98
#define ip_addr_isany (   addr1)    ((addr1) == nullptr || (addr1)->addr.isUnspecified())
#define ip_addr_islinklocal (   addr1)    (((addr1)->addr & ntohl(0xffff0000UL)) == ntohl(0xa9fe0000UL))
#define ip_addr_ismulticast (   addr1)    (false)
#define ip_addr_netcmp (   addr1,
  addr2,
  mask 
)
Value:
(((addr1)->addr & \
(mask)->addr) == \
((addr2)->addr & \
(mask)->addr))

Determine if two address are on the same network.

  • addr1 IP address 1
  • addr2 IP address 2
  • mask network identifier mask
    Returns
    !0 if the network identifiers of both address match
#define ip_addr_set (   dest,
  src 
)
Value:
(dest)->addr = \
((src) == nullptr ? L3Address() : \
(src)->addr)
#define ip_ntoa (   addr)    ((addr != nullptr) ? inet_ntoa(*((struct in_addr*)(addr))) : "nullptr")

Same as inet_ntoa() but takes a struct ip_addr*.