# ip_addr.h File Reference

`#include "net/arch.h"`

Go to the source code of this file.

## Data Structures
struct | ip_addr
## Defines
#define | IP_ADDR_ANY 0
#define | IP_ADDR_BROADCAST (&ip_addr_broadcast)
#define | IP4_ADDR(ipaddr, a, b, c, d)
#define | ip_addr_set(dest, src)
#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) ((uInt8)(ntohl((ipaddr)->addr) >> 24) & 0xff)
#define | ip4_addr2(ipaddr) ((uInt8)(ntohl((ipaddr)->addr) >> 16) & 0xff)
#define | ip4_addr3(ipaddr) ((uInt8)(ntohl((ipaddr)->addr) >> 8) & 0xff)
#define | ip4_addr4(ipaddr) ((uInt8)(ntohl((ipaddr)->addr)) & 0xff)
## Variables
PACK_STRUCT_BEGIN struct ip_addr | PACK_STRUCT_STRUCT
PACK_STRUCT_END struct ip_addr | ip_addr_broadcast

## Define Documentation

#define IP4_ADDR | ( | ipaddr,
|  | a,
|  | b,
|  | c,
|  | d |  | ) |

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

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

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

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

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

#define IP_ADDR_ANY 0

#define IP_ADDR_BROADCAST (&ip_addr_broadcast)

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

#define ip_addr_debug_print | ( | ipaddr |  | ) |

| Value:
    kprintf("%d.%d.%d.%d", \
                        (uInt8)(ntohl((ipaddr)->addr) >> 24) & 0xff, \
                        (uInt8)(ntohl((ipaddr)->addr) >> 16) & 0xff, \
                        (uInt8)(ntohl((ipaddr)->addr) >> 8) & 0xff, \
                        (uInt8)ntohl((ipaddr)->addr) & 0xff)

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

#define ip_addr_isbroadcast | ( | addr1,
|  | mask |  | ) |

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

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

#define ip_addr_maskcmp | ( | addr1,
|  | addr2,
|  | mask |  | ) |

| Value:
    (((addr1)->addr & \
                                                  (mask)->addr) == \
                                                 ((addr2)->addr & \
                                                  (mask)->addr))

#define ip_addr_set | ( | dest,
|  | src |  | ) |

| Value:
    (dest)->addr = \
                                   ((src) == IP_ADDR_ANY? IP_ADDR_ANY:\
                                    ((struct ip_addr *)src)->addr)

## Variable Documentation

PACK_STRUCT_END struct ip_addr ip_addr_broadcast

PACK_STRUCT_BEGIN struct ip_addr PACK_STRUCT_STRUCT