The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
in.h File Reference

IPv4 addresses and ports, and the IP protocols. More...

#include <stdint.h>
#include <sys/socket.h>

Go to the source code of this file.

Data Structures

struct  in_addr
struct  sockaddr_in
struct  in6_addr
struct  sockaddr_in6

Macros

#define IN6ADDR_ANY_INIT   {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
#define IN6ADDR_LOOPBACK_INIT   {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}
#define IPPROTO_IP   0
#define IPPROTO_ICMP   1
#define IPPROTO_TCP   6
#define IPPROTO_UDP   17
#define IPPROTO_IPV6   41
#define IPV6_V6ONLY   26
#define INADDR_ANY   ((in_addr_t)0x00000000)
#define INADDR_BROADCAST   ((in_addr_t)0xFFFFFFFF)
#define INADDR_NONE   ((in_addr_t)0xFFFFFFFF)
#define INADDR_LOOPBACK   ((in_addr_t)0x7F000001)
#define INET_ADDRSTRLEN   16
#define INET6_ADDRSTRLEN   46

Typedefs

typedef uint32_t in_addr_t
typedef uint16_t in_port_t

Variables

const struct in6_addr in6addr_any
const struct in6_addr in6addr_loopback

Detailed Description

IPv4 addresses and ports, and the IP protocols.

the IPv6 types are here for programs that know both families. there is no IPv6 network: socket(AF_INET6, ...) gives EAFNOSUPPORT, and programs then use IPv4.

addresses and ports in the structs are in network byte order (big endian); htons, htonl, ntohs and ntohl change between it and the CPU's.

Macro Definition Documentation

◆ IN6ADDR_ANY_INIT

#define IN6ADDR_ANY_INIT   {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}

◆ IN6ADDR_LOOPBACK_INIT

#define IN6ADDR_LOOPBACK_INIT   {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}

◆ IPPROTO_IP

#define IPPROTO_IP   0

◆ IPPROTO_ICMP

#define IPPROTO_ICMP   1

◆ IPPROTO_TCP

#define IPPROTO_TCP   6

◆ IPPROTO_UDP

#define IPPROTO_UDP   17

◆ IPPROTO_IPV6

#define IPPROTO_IPV6   41

◆ IPV6_V6ONLY

#define IPV6_V6ONLY   26

◆ INADDR_ANY

#define INADDR_ANY   ((in_addr_t)0x00000000)

◆ INADDR_BROADCAST

#define INADDR_BROADCAST   ((in_addr_t)0xFFFFFFFF)

◆ INADDR_NONE

#define INADDR_NONE   ((in_addr_t)0xFFFFFFFF)

◆ INADDR_LOOPBACK

#define INADDR_LOOPBACK   ((in_addr_t)0x7F000001)

◆ INET_ADDRSTRLEN

#define INET_ADDRSTRLEN   16

◆ INET6_ADDRSTRLEN

#define INET6_ADDRSTRLEN   46

Typedef Documentation

◆ in_addr_t

◆ in_port_t

Variable Documentation

◆ in6addr_any

const struct in6_addr in6addr_any
extern

◆ in6addr_loopback

const struct in6_addr in6addr_loopback
extern