FreeBSD kernel IPv4 code
in.h File Reference
#include <sys/cdefs.h>
#include <sys/_types.h>
#include <machine/endian.h>
#include <sys/_sockaddr_storage.h>
Include dependency graph for in.h:

Go to the source code of this file.

Data Structures

struct  in_addr
 
struct  sockaddr_in
 

Macros

#define IPPROTO_IP   0 /* dummy for IP */
 
#define IPPROTO_ICMP   1 /* control message protocol */
 
#define IPPROTO_TCP   6 /* tcp */
 
#define IPPROTO_UDP   17 /* user datagram protocol */
 
#define INADDR_ANY   ((in_addr_t)0x00000000)
 
#define INADDR_BROADCAST   ((in_addr_t)0xffffffff) /* must be masked */
 
#define _UINT8_T_DECLARED
 
#define _UINT16_T_DECLARED
 
#define _UINT32_T_DECLARED
 
#define _IN_ADDR_T_DECLARED
 
#define _IN_PORT_T_DECLARED
 
#define _SA_FAMILY_T_DECLARED
 
#define _STRUCT_IN_ADDR_DECLARED
 
#define _SOCKLEN_T_DECLARED
 
#define in_hosteq(s, t)   ((s).s_addr == (t).s_addr)
 
#define in_nullhost(x)   ((x).s_addr == INADDR_ANY)
 
#define in_allhosts(x)   ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))
 
#define satosin(sa)   ((struct sockaddr_in *)(sa))
 
#define sintosa(sin)   ((struct sockaddr *)(sin))
 
#define ifatoia(ifa)   ((struct in_ifaddr *)(ifa))
 

Typedefs

typedef __uint8_t uint8_t
 
typedef __uint16_t uint16_t
 
typedef __uint32_t uint32_t
 
typedef uint32_t in_addr_t
 
typedef uint16_t in_port_t
 
typedef __sa_family_t sa_family_t
 
typedef __socklen_t socklen_t
 

Functions

int in_broadcast (struct in_addr, struct ifnet *)
 
int in_ifaddr_broadcast (struct in_addr, struct in_ifaddr *)
 
int in_canforward (struct in_addr)
 
int in_localaddr (struct in_addr)
 
bool in_localip (struct in_addr)
 
bool in_localip_fib (struct in_addr, uint16_t)
 
int in_ifhasaddr (struct ifnet *, struct in_addr)
 
struct in_ifaddrin_findlocal (uint32_t, bool)
 
int inet_aton (const char *, struct in_addr *)
 
char * inet_ntoa_r (struct in_addr ina, char *buf)
 
char * inet_ntop (int, const void *, char *, socklen_t)
 
int inet_pton (int af, const char *, void *)
 
void in_ifdetach (struct ifnet *)
 

Macro Definition Documentation

◆ _IN_ADDR_T_DECLARED

#define _IN_ADDR_T_DECLARED

Definition at line 68 of file in.h.

◆ _IN_PORT_T_DECLARED

#define _IN_PORT_T_DECLARED

Definition at line 73 of file in.h.

◆ _SA_FAMILY_T_DECLARED

#define _SA_FAMILY_T_DECLARED

Definition at line 78 of file in.h.

◆ _SOCKLEN_T_DECLARED

#define _SOCKLEN_T_DECLARED

Definition at line 91 of file in.h.

◆ _STRUCT_IN_ADDR_DECLARED

#define _STRUCT_IN_ADDR_DECLARED

Definition at line 86 of file in.h.

◆ _UINT16_T_DECLARED

#define _UINT16_T_DECLARED

Definition at line 58 of file in.h.

◆ _UINT32_T_DECLARED

#define _UINT32_T_DECLARED

Definition at line 63 of file in.h.

◆ _UINT8_T_DECLARED

#define _UINT8_T_DECLARED

Definition at line 53 of file in.h.

◆ ifatoia

#define ifatoia (   ifa)    ((struct in_ifaddr *)(ifa))

Definition at line 680 of file in.h.

◆ in_allhosts

#define in_allhosts (   x)    ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))

Definition at line 676 of file in.h.

◆ in_hosteq

#define in_hosteq (   s,
 
)    ((s).s_addr == (t).s_addr)

Definition at line 674 of file in.h.

◆ in_nullhost

#define in_nullhost (   x)    ((x).s_addr == INADDR_ANY)

Definition at line 675 of file in.h.

◆ INADDR_ANY

#define INADDR_ANY   ((in_addr_t)0x00000000)

Definition at line 48 of file in.h.

◆ INADDR_BROADCAST

#define INADDR_BROADCAST   ((in_addr_t)0xffffffff) /* must be masked */

Definition at line 49 of file in.h.

◆ IPPROTO_ICMP

#define IPPROTO_ICMP   1 /* control message protocol */

Definition at line 44 of file in.h.

◆ IPPROTO_IP

#define IPPROTO_IP   0 /* dummy for IP */

Definition at line 43 of file in.h.

◆ IPPROTO_TCP

#define IPPROTO_TCP   6 /* tcp */

Definition at line 45 of file in.h.

◆ IPPROTO_UDP

#define IPPROTO_UDP   17 /* user datagram protocol */

Definition at line 46 of file in.h.

◆ satosin

#define satosin (   sa)    ((struct sockaddr_in *)(sa))

Definition at line 678 of file in.h.

◆ sintosa

#define sintosa (   sin)    ((struct sockaddr *)(sin))

Definition at line 679 of file in.h.

Typedef Documentation

◆ in_addr_t

Definition at line 67 of file in.h.

◆ in_port_t

Definition at line 72 of file in.h.

◆ sa_family_t

typedef __sa_family_t sa_family_t

Definition at line 77 of file in.h.

◆ socklen_t

typedef __socklen_t socklen_t

Definition at line 90 of file in.h.

◆ uint16_t

typedef __uint16_t uint16_t

Definition at line 57 of file in.h.

◆ uint32_t

typedef __uint32_t uint32_t

Definition at line 62 of file in.h.

◆ uint8_t

typedef __uint8_t uint8_t

Definition at line 52 of file in.h.

Function Documentation

◆ in_broadcast()

int in_broadcast ( struct in_addr  in,
struct ifnet *  ifp 
)

Definition at line 1213 of file in.c.

References in_ifaddr_broadcast(), INADDR_ANY, INADDR_BROADCAST, and in_addr::s_addr.

Referenced by div_output_inbound(), rib4_preadd(), tcp_dropwithreset(), and tcp_input_with_port().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ in_canforward()

int in_canforward ( struct in_addr  in)

Definition at line 250 of file in.c.

References in_addr::s_addr.

Referenced by ip_forward().

Here is the caller graph for this function:

◆ in_findlocal()

struct in_ifaddr * in_findlocal ( uint32_t  fibnum,
bool  loopback_ok 
)

Definition at line 221 of file in.c.

References in_ifaddr::ia_ifa, IA_SIN, and V_in_ifaddrhead.

◆ in_ifaddr_broadcast()

int in_ifaddr_broadcast ( struct in_addr  in,
struct in_ifaddr ia 
)

Definition at line 1191 of file in.c.

References in_ifaddr::ia_subnet, in_ifaddr::ia_subnetmask, in_addr::s_addr, and V_broadcast_lowest.

Referenced by in_broadcast(), and ip_output().

Here is the caller graph for this function:

◆ in_ifdetach()

void in_ifdetach ( struct ifnet *  ifp)

Definition at line 1243 of file in.c.

References IN_MULTI_LOCK, IN_MULTI_UNLOCK, in_pcbpurgeif0(), in_purgemaddrs(), inm_release_wait(), V_ripcbinfo, V_udbinfo, and V_ulitecbinfo.

Here is the call graph for this function:

◆ in_ifhasaddr()

int in_ifhasaddr ( struct ifnet *  ifp,
struct in_addr  in 
)

Definition at line 166 of file in.c.

References in_ifaddr::ia_addr, in_addr::s_addr, and sockaddr_in::sin_addr.

◆ in_localaddr()

int in_localaddr ( struct in_addr  in)

Definition at line 111 of file in.c.

References in_ifaddr::ia_subnet, in_ifaddr::ia_subnetmask, in_addr::s_addr, and V_in_ifaddrhead.

Referenced by tcp_mss_update().

Here is the caller graph for this function:

◆ in_localip()

bool in_localip ( struct in_addr  in)

Definition at line 131 of file in.c.

References IA_SIN, INADDR_HASH, and in_addr::s_addr.

Referenced by in_gif_set_running(), in_gre_set_running(), ip_output_pfil(), ip_tryforward(), tcp_input_with_port(), and tcp_twstart().

Here is the caller graph for this function:

◆ in_localip_fib()

bool in_localip_fib ( struct in_addr  in,
uint16_t  fib 
)

Definition at line 148 of file in.c.

References in_ifaddr::ia_ifa, IA_SIN, INADDR_HASH, and in_addr::s_addr.

Referenced by ip_input().

Here is the caller graph for this function:

◆ inet_aton()

int inet_aton ( const char *  ,
struct in_addr  
)

Referenced by IpAddr(), and netdump_modevent().

Here is the caller graph for this function:

◆ inet_ntoa_r()

◆ inet_ntop()

char * inet_ntop ( int  ,
const void *  ,
char *  ,
socklen_t   
)

Referenced by sysctl_net_inet_tcp_fastopen_ccache_list().

Here is the caller graph for this function:

◆ inet_pton()

int inet_pton ( int  af,
const char *  ,
void *   
)