KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Macros | Typedefs | Variables
in.h File Reference

Definitions for the Internet address family. More...

#include <sys/cdefs.h>
#include <inttypes.h>
#include <sys/socket.h>
#include <arpa/inet.h>

Go to the source code of this file.

Data Structures

struct  in_addr
 Structure used to store an IPv4 address. More...
 
struct  in6_addr
 Structure used to store an IPv6 address. More...
 
struct  sockaddr_in
 Structure used to store an IPv4 address for a socket. More...
 
struct  sockaddr_in6
 Structure used to store an IPv6 address for a socket. More...
 

Macros

#define s6_addr   __s6_addr.__s6_addr8
 
#define INADDR_ANY   0x00000000
 Local IPv4 host address. More...
 
#define INADDR_BROADCAST   0xFFFFFFFF
 IPv4 broadcast address. More...
 
#define INADDR_NONE   0xFFFFFFFF
 IPv4 error address. More...
 
#define IN6ADDR_ANY_INIT
 Initialize an IPv6 local host address. More...
 
#define IN6ADDR_LOOPBACK_INIT
 Initialize an IPv6 loopback address. More...
 
#define INET_ADDRSTRLEN   16
 Length of a string form of a maximal IPv4 address. More...
 
#define INET6_ADDRSTRLEN   46
 Length of a string form of a maximal IPv6 address. More...
 
#define IPPROTO_IP   0
 Internet Protocol Version 4. More...
 
#define IPPROTO_ICMP   1
 Internet Control Message Protocol. More...
 
#define IPPROTO_TCP   6
 Transmission Control Protocol. More...
 
#define IPPROTO_UDP   17
 User Datagram Protocol. More...
 
#define IPPROTO_IPV6   41
 Internet Protocol Version 6. More...
 
#define IPPROTO_UDPLITE   136
 Lightweight User Datagram Protocol. More...
 
#define IP_TTL   24
 TTL for unicast (get/set) More...
 
#define IPV6_JOIN_GROUP   17
 Join a multicast group (set) More...
 
#define IPV6_LEAVE_GROUP   18
 Leave a multicast group (set) More...
 
#define IPV6_MULTICAST_HOPS   19
 Hop limit for multicast (get/set) More...
 
#define IPV6_MULTICAST_IF   20
 Multicast interface (get/set) More...
 
#define IPV6_MULTICAST_LOOP   21
 Multicasts loopback (get/set) More...
 
#define IPV6_UNICAST_HOPS   22
 Hop limit for unicast (get/set) More...
 
#define IPV6_V6ONLY   23
 IPv6 only – no IPv4 (get/set) More...
 
#define UDP_NOCHECKSUM   25
 Don't calculate UDP checksums. More...
 
#define UDPLITE_SEND_CSCOV   26
 Sending checksum coverage. More...
 
#define UDPLITE_RECV_CSCOV   27
 Receiving checksum coverage. More...
 
#define IN6_IS_ADDR_UNSPECIFIED(a)
 Test if an IPv6 Address is unspecified. More...
 
#define IN6_IS_ADDR_LOOPBACK(a)
 Test if an IPv6 Address is a loopback address. More...
 
#define IN6_IS_ADDR_V4MAPPED(a)
 Test if an IPv6 Address is an IPv4 mapped address. More...
 
#define IN6_IS_ADDR_V4COMPAT(a)
 Test if an IPv6 Address is an IPv4 compatibility address. More...
 
#define IN6_IS_ADDR_LINKLOCAL(a)
 Test if an IPv6 Address is a link-local address. More...
 
#define IN6_IS_ADDR_SITELOCAL(a)
 Test if an IPv6 Address is a site-local address. More...
 
#define IN6_IS_ADDR_MULTICAST(a)   ((a)->__s6_addr.__s6_addr8[0] == 0xFF)
 Test if an IPv6 Address is a multicast address. More...
 
#define IN6_IS_ADDR_MC_NODELOCAL(a)
 Test if an IPv6 Address is a node-local multicast address. More...
 
#define IN6_IS_ADDR_MC_LINKLOCAL(a)
 Test if an IPv6 Address is a link-local multicast address. More...
 
#define IN6_IS_ADDR_MC_SITELOCAL(a)
 Test if an IPv6 Address is a site-local multicast address. More...
 
#define IN6_IS_ADDR_MC_ORGLOCAL(a)
 Test if an IPv6 Address is an organization-local multicast address. More...
 
#define IN6_IS_ADDR_MC_GLOBAL(a)
 Test if an IPv6 Address is a global multicast address. More...
 

Typedefs

typedef uint16_t in_port_t
 16-bit type used to store a value for an internet port. More...
 
typedef uint32_t in_addr_t
 32-bit value used to store an IPv4 address. More...
 

Variables

const struct in6_addr in6addr_any
 IPv6 local host address. More...
 
const struct in6_addr in6addr_loopback
 IPv6 loopback address. More...
 

Detailed Description

Definitions for the Internet address family.

This file contains the standard definitions (as directed by the POSIX 2008 standard) for internet-related functionality in the AF_INET address family. This does is not guaranteed to have everything that one might have in a fully-standard compliant implementation of the POSIX standard.

Author
Lawrence Sebald

Macro Definition Documentation

#define IN6_IS_ADDR_LINKLOCAL (   a)
Value:
(((a)->__s6_addr.__s6_addr8[0] == 0xFE) && \
(((a)->__s6_addr.__s6_addr8[1] & 0xC0) == 0x80))

Test if an IPv6 Address is a link-local address.

This macro tests whether an IPv6 address (struct in6_addr *) is a link-local address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is link-local, 0 otherwise.
#define IN6_IS_ADDR_LOOPBACK (   a)
Value:
((a)->__s6_addr.__s6_addr32[0] == 0 && \
(a)->__s6_addr.__s6_addr32[1] == 0 && \
(a)->__s6_addr.__s6_addr32[2] == 0 && \
(a)->__s6_addr.__s6_addr16[6] == 0 && \
(a)->__s6_addr.__s6_addr8[14] == 0 && \
(a)->__s6_addr.__s6_addr8[15] == 1)

Test if an IPv6 Address is a loopback address.

This macro tests whether an IPv6 address (struct in6_addr *) is a loopback address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is a loopback, 0 otherwise.
#define IN6_IS_ADDR_MC_GLOBAL (   a)
Value:
(((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x0E))
#define IN6_IS_ADDR_MULTICAST(a)
Test if an IPv6 Address is a multicast address.
Definition: in.h:352

Test if an IPv6 Address is a global multicast address.

This macro tests whether an IPv6 address (struct in6_addr *) is a global multicast address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is a global multicast address, 0 otherwise.
#define IN6_IS_ADDR_MC_LINKLOCAL (   a)
Value:
(((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x02))
#define IN6_IS_ADDR_MULTICAST(a)
Test if an IPv6 Address is a multicast address.
Definition: in.h:352

Test if an IPv6 Address is a link-local multicast address.

This macro tests whether an IPv6 address (struct in6_addr *) is a link-local multicast address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is a link-local multicast address, 0 otherwise.
#define IN6_IS_ADDR_MC_NODELOCAL (   a)
Value:
(((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x01))
#define IN6_IS_ADDR_MULTICAST(a)
Test if an IPv6 Address is a multicast address.
Definition: in.h:352

Test if an IPv6 Address is a node-local multicast address.

This macro tests whether an IPv6 address (struct in6_addr *) is a node-local multicast address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is a node-local multicast address, 0 otherwise.
#define IN6_IS_ADDR_MC_ORGLOCAL (   a)
Value:
(((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x08))
#define IN6_IS_ADDR_MULTICAST(a)
Test if an IPv6 Address is a multicast address.
Definition: in.h:352

Test if an IPv6 Address is an organization-local multicast address.

This macro tests whether an IPv6 address (struct in6_addr *) is an organization-local multicast address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is an organization-local multicast address, 0 otherwise.
#define IN6_IS_ADDR_MC_SITELOCAL (   a)
Value:
(((a)->__s6_addr.__s6_addr8[1] & 0x0F) == 0x05))
#define IN6_IS_ADDR_MULTICAST(a)
Test if an IPv6 Address is a multicast address.
Definition: in.h:352

Test if an IPv6 Address is a site-local multicast address.

This macro tests whether an IPv6 address (struct in6_addr *) is a site-local multicast address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is a site-local multicast address, 0 otherwise.
#define IN6_IS_ADDR_MULTICAST (   a)    ((a)->__s6_addr.__s6_addr8[0] == 0xFF)

Test if an IPv6 Address is a multicast address.

This macro tests whether an IPv6 address (struct in6_addr *) is a multicast address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is multicast, 0 otherwise.
#define IN6_IS_ADDR_SITELOCAL (   a)
Value:
(((a)->__s6_addr.__s6_addr8[0] == 0xFE) && \
(((a)->__s6_addr.__s6_addr8[1] & 0xC0) == 0xC0))

Test if an IPv6 Address is a site-local address.

This macro tests whether an IPv6 address (struct in6_addr *) is a site-local address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is site-local, 0 otherwise.
#define IN6_IS_ADDR_UNSPECIFIED (   a)
Value:
((a)->__s6_addr.__s6_addr32[0] == 0 && \
(a)->__s6_addr.__s6_addr32[1] == 0 && \
(a)->__s6_addr.__s6_addr32[2] == 0 && \
(a)->__s6_addr.__s6_addr32[3] == 0)

Test if an IPv6 Address is unspecified.

This macro tests whether an IPv6 address (struct in6_addr *) is an unspecified address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is unspecified, 0 otherwise.
#define IN6_IS_ADDR_V4COMPAT (   a)
Value:
((a)->__s6_addr.__s6_addr32[0] == 0 && \
(a)->__s6_addr.__s6_addr32[1] == 0 && \
(a)->__s6_addr.__s6_addr32[2] == 0 && \
(a)->__s6_addr.__s6_addr32[3] != 0 && \
(a)->__s6_addr.__s6_addr8[15] != 1)

Test if an IPv6 Address is an IPv4 compatibility address.

This macro tests whether an IPv6 address (struct in6_addr *) is an IPv4 compatibility address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is IPv4 compat, 0 otherwise.
#define IN6_IS_ADDR_V4MAPPED (   a)
Value:
((a)->__s6_addr.__s6_addr32[0] == 0 && \
(a)->__s6_addr.__s6_addr32[1] == 0 && \
(a)->__s6_addr.__s6_addr16[4] == 0 && \
(a)->__s6_addr.__s6_addr16[5] == 0xFFFF)

Test if an IPv6 Address is an IPv4 mapped address.

This macro tests whether an IPv6 address (struct in6_addr *) is an IPv4 mapped address.

Parameters
aThe address to test (struct in6_addr *)
Returns
Nonzero if the address is IPv4 mapped, 0 otherwise.
#define IN6ADDR_ANY_INIT
Value:
{{{ 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0 }}}

Initialize an IPv6 local host address.

This macro can be used to initialize a struct in6_addr to any local address. It functions similarly to INADDR_ANY for IPv4.

#define IN6ADDR_LOOPBACK_INIT
Value:
{{{ 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 1 }}}

Initialize an IPv6 loopback address.

This macro can be used to initialize a struct in6_addr to the loopback address.

#define INADDR_ANY   0x00000000

Local IPv4 host address.

This address can be used by many things if you prefer to not specify the local address, and would rather it be detected automatically.

#define INADDR_BROADCAST   0xFFFFFFFF

IPv4 broadcast address.

This address is the normal IPv4 broadcast address (255.255.255.255).

#define INADDR_NONE   0xFFFFFFFF

IPv4 error address.

This address is non-standard, but is available on many systems. It is used to detect failure from some functions that normally return addresses (such as the inet_addr function).

#define INET6_ADDRSTRLEN   46

Length of a string form of a maximal IPv6 address.

#define INET_ADDRSTRLEN   16

Length of a string form of a maximal IPv4 address.

#define IPPROTO_ICMP   1

Internet Control Message Protocol.

#define IPPROTO_IP   0

Internet Protocol Version 4.

#define IPPROTO_IPV6   41

Internet Protocol Version 6.

#define IPPROTO_TCP   6

Transmission Control Protocol.

#define IPPROTO_UDP   17

User Datagram Protocol.

#define IPPROTO_UDPLITE   136

Lightweight User Datagram Protocol.

#define s6_addr   __s6_addr.__s6_addr8

Typedef Documentation

typedef uint32_t in_addr_t

32-bit value used to store an IPv4 address.

typedef uint16_t in_port_t

16-bit type used to store a value for an internet port.

Variable Documentation

const struct in6_addr in6addr_any

IPv6 local host address.

This constant variable contains the IPv6 local host address.

const struct in6_addr in6addr_loopback

IPv6 loopback address.

This constant variable contains the IPv6 loopback address.