13#ifndef ZEPHYR_INCLUDE_NET_NET_IP_H_
14#define ZEPHYR_INCLUDE_NET_NET_IP_H_
38#define NET_VLAN_TAG_UNSPEC 0x0fff
49#define PF_UNIX PF_LOCAL
52#define AF_UNSPEC PF_UNSPEC
53#define AF_INET PF_INET
54#define AF_INET6 PF_INET6
55#define AF_PACKET PF_PACKET
57#define AF_NET_MGMT PF_NET_MGMT
58#define AF_LOCAL PF_LOCAL
59#define AF_UNIX PF_UNIX
96#define ntohs(x) sys_be16_to_cpu(x)
104#define ntohl(x) sys_be32_to_cpu(x)
112#define ntohll(x) sys_be64_to_cpu(x)
120#define htons(x) sys_cpu_to_be16(x)
128#define htonl(x) sys_cpu_to_be32(x)
136#define htonll(x) sys_cpu_to_be64(x)
148#define NET_IPV6_ADDR_SIZE 16
161#define NET_IPV4_ADDR_SIZE 4
167#ifndef __socklen_t_defined
169#define __socklen_t_defined
231#if !defined(HAVE_IOVEC)
260#define ALIGN_H(x) ROUND_UP(x, __alignof__(struct cmsghdr))
263#define ALIGN_D(x) ROUND_UP(x, __alignof__(z_max_align_t))
266#if !defined(CMSG_FIRSTHDR)
267#define CMSG_FIRSTHDR(msghdr) \
268 ((msghdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
269 (struct cmsghdr *)((msghdr)->msg_control) : NULL)
272#if !defined(CMSG_NXTHDR)
273#define CMSG_NXTHDR(msghdr, cmsg) \
274 (((cmsg) == NULL) ? CMSG_FIRSTHDR(msghdr) : \
275 (((uint8_t *)(cmsg) + ALIGN_H((cmsg)->cmsg_len) + \
276 ALIGN_D(sizeof(struct cmsghdr)) > \
277 (uint8_t *)((msghdr)->msg_control) + (msghdr)->msg_controllen) ? \
279 (struct cmsghdr *)((uint8_t *)(cmsg) + \
280 ALIGN_H((cmsg)->cmsg_len))))
283#if !defined(CMSG_DATA)
284#define CMSG_DATA(cmsg) ((uint8_t *)(cmsg) + ALIGN_D(sizeof(struct cmsghdr)))
287#if !defined(CMSG_SPACE)
288#define CMSG_SPACE(length) (ALIGN_D(sizeof(struct cmsghdr)) + ALIGN_H(length))
291#if !defined(CMSG_LEN)
292#define CMSG_LEN(length) (ALIGN_D(sizeof(struct cmsghdr)) + length)
299#define PACKET_BROADCAST 1
300#define PACKET_MULTICAST 2
301#define PACKET_OTHERHOST 3
302#define PACKET_OUTGOING 4
303#define PACKET_LOOPBACK 5
304#define PACKET_FASTROUTE 6
307#define ARPHRD_ETHER 1
312#if defined(CONFIG_NET_IPV4)
313#undef NET_SOCKADDR_MAX_SIZE
314#undef NET_SOCKADDR_PTR_MAX_SIZE
315#define NET_SOCKADDR_MAX_SIZE (sizeof(struct sockaddr_in))
316#define NET_SOCKADDR_PTR_MAX_SIZE (sizeof(struct sockaddr_in_ptr))
319#if defined(CONFIG_NET_SOCKETS_PACKET)
320#undef NET_SOCKADDR_MAX_SIZE
321#undef NET_SOCKADDR_PTR_MAX_SIZE
322#define NET_SOCKADDR_MAX_SIZE (sizeof(struct sockaddr_ll))
323#define NET_SOCKADDR_PTR_MAX_SIZE (sizeof(struct sockaddr_ll_ptr))
326#if defined(CONFIG_NET_IPV6)
327#undef NET_SOCKADDR_MAX_SIZE
328#define NET_SOCKADDR_MAX_SIZE (sizeof(struct sockaddr_in6))
329#if !defined(CONFIG_NET_SOCKETS_PACKET)
330#undef NET_SOCKADDR_PTR_MAX_SIZE
331#define NET_SOCKADDR_PTR_MAX_SIZE (sizeof(struct sockaddr_in6_ptr))
335#if !defined(CONFIG_NET_IPV4)
336#if !defined(CONFIG_NET_IPV6)
337#if !defined(CONFIG_NET_SOCKETS_PACKET)
338#define NET_SOCKADDR_MAX_SIZE (sizeof(struct sockaddr_in6))
339#define NET_SOCKADDR_PTR_MAX_SIZE (sizeof(struct sockaddr_in6_ptr))
356 char data[NET_SOCKADDR_PTR_MAX_SIZE -
sizeof(
sa_family_t)];
360struct sockaddr_storage {
362 char data[NET_SOCKADDR_MAX_SIZE -
sizeof(
sa_family_t)];
368 char sun_path[NET_SOCKADDR_MAX_SIZE -
sizeof(
sa_family_t)];
379#define IN6ADDR_ANY_INIT { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, \
380 0, 0, 0, 0, 0, 0, 0 } } }
381#define IN6ADDR_LOOPBACK_INIT { { { 0, 0, 0, 0, 0, 0, 0, \
382 0, 0, 0, 0, 0, 0, 0, 0, 1 } } }
384extern const struct in6_addr in6addr_any;
385extern const struct in6_addr in6addr_loopback;
390#define INET_ADDRSTRLEN 16
394#define INET6_ADDRSTRLEN 46
399#define NET_IPV6_ADDR_LEN sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx")
400#define NET_IPV4_ADDR_LEN sizeof("xxx.xxx.xxx.xxx")
403#define INADDR_ANY_INIT { { { INADDR_ANY } } }
405#define INADDR_LOOPBACK_INIT { { { 127, 0, 0, 1 } } }
433#define NET_MAX_PRIORITIES 8
479struct net_ipv6_frag_hdr {
525static inline const char *net_addr_type2str(
enum net_addr_type type)
545#define NET_IPV6_NEXTHDR_HBHO 0
546#define NET_IPV6_NEXTHDR_DESTO 60
547#define NET_IPV6_NEXTHDR_ROUTING 43
548#define NET_IPV6_NEXTHDR_FRAG 44
549#define NET_IPV6_NEXTHDR_NONE 59
556 struct net_ipv4_hdr *ipv4;
557 struct net_ipv6_hdr *ipv6;
560union net_proto_header {
561 struct net_udp_hdr *udp;
562 struct net_tcp_hdr *tcp;
565#define NET_UDPH_LEN 8
566#define NET_TCPH_LEN 20
567#define NET_ICMPH_LEN 4
569#define NET_IPV6H_LEN 40
570#define NET_ICMPV6H_LEN NET_ICMPH_LEN
571#define NET_IPV6UDPH_LEN (NET_UDPH_LEN + NET_IPV6H_LEN)
572#define NET_IPV6TCPH_LEN (NET_TCPH_LEN + NET_IPV6H_LEN)
573#define NET_IPV6ICMPH_LEN (NET_IPV6H_LEN + NET_ICMPH_LEN)
574#define NET_IPV6_FRAGH_LEN 8
576#define NET_IPV4H_LEN 20
577#define NET_ICMPV4H_LEN NET_ICMPH_LEN
578#define NET_IPV4UDPH_LEN (NET_UDPH_LEN + NET_IPV4H_LEN)
579#define NET_IPV4TCPH_LEN (NET_TCPH_LEN + NET_IPV4H_LEN)
580#define NET_IPV4ICMPH_LEN (NET_IPV4H_LEN + NET_ICMPH_LEN)
582#define NET_IPV6H_LENGTH_OFFSET 0x04
584#define NET_IPV6_FRAGH_OFFSET_MASK 0xfff8
585#define NET_IPV4_FRAGH_OFFSET_MASK 0x1fff
586#define NET_IPV4_MORE_FRAG_MASK 0x2000
587#define NET_IPV4_DO_NOT_FRAG_MASK 0x4000
600 return UNALIGNED_GET(&addr->
s6_addr32[0]) == 0 &&
601 UNALIGNED_GET(&addr->
s6_addr32[1]) == 0 &&
602 UNALIGNED_GET(&addr->
s6_addr32[2]) == 0 &&
615 return addr->
s6_addr[0] == 0xFF;
674 if (
memcmp(addr1, addr2, bytes)) {
686 mask = ((0xff << (8 - remain)) ^ 0xff) << remain;
688 return (addr1[bytes] & mask) == (addr2[bytes] & mask);
700 return addr->
s4_addr[0] == 127U;
712 return UNALIGNED_GET(&addr->
s_addr) == 0;
724 return (
ntohl(UNALIGNED_GET(&addr->
s_addr)) & 0xF0000000) == 0xE0000000;
736 return (
ntohl(UNALIGNED_GET(&addr->
s_addr)) & 0xFFFF0000) == 0xA9FE0000;
747#define net_ipaddr_copy(dest, src) \
748 UNALIGNED_PUT(UNALIGNED_GET(src), dest)
785 return UNALIGNED_GET(&addr1->
s_addr) == UNALIGNED_GET(&addr2->
s_addr);
800 (
const struct in_addr *)addr2);
853 return addr->
s6_addr[0] == 0xFD;
907#if defined(CONFIG_NET_NATIVE_IPV4)
961 return UNALIGNED_GET(&addr->
s6_addr32[0]) == 0 &&
962 UNALIGNED_GET(&addr->
s6_addr32[1]) == 0 &&
963 UNALIGNED_GET(&addr->
s6_addr32[2]) == 0 &&
978 UNALIGNED_GET(&addr->
s6_addr32[1]) == 0x00000000 &&
1012 return (addr_1->
s6_addr[0] == 0xff) && (addr_2->
s6_addr[0] == 0xff) &&
1130 static const struct in6_addr all_nodes_mcast_group = {
1131 { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1132 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } }
1254 switch (lladdr->
len) {
1278#if defined(CONFIG_NET_L2_BT_ZEP1656)
1307 if (!addr || !lladdr) {
1311 switch (lladdr->
len) {
1337#
if defined(CONFIG_NET_L2_BT_ZEP1656)
1471 char *dst,
size_t size);
1510 return (
int32_t)(seq1 - seq2);
1572 static const uint8_t vlan2priority[] = {
1618#include <syscalls/net_ip.h>
static bool net_ipv6_is_my_addr(struct in6_addr *addr)
Check if IPv6 address is found in one of the network interfaces.
Definition: net_ip.h:631
struct net_if_addr * net_if_ipv4_addr_lookup(const struct in_addr *addr, struct net_if **iface)
static void net_ipv6_addr_create(struct in6_addr *addr, uint16_t addr0, uint16_t addr1, uint16_t addr2, uint16_t addr3, uint16_t addr4, uint16_t addr5, uint16_t addr6, uint16_t addr7)
Construct an IPv6 address from eight 16-bit words.
Definition: net_ip.h:1206
static bool net_ipv4_addr_cmp(const struct in_addr *addr1, const struct in_addr *addr2)
Compare two IPv4 addresses.
Definition: net_ip.h:782
#define NET_IPV4_ADDR_SIZE
Definition: net_ip.h:161
struct net_if_addr * net_if_ipv6_addr_lookup(const struct in6_addr *addr, struct net_if **iface)
static bool net_ipv6_is_addr_mcast_org(const struct in6_addr *addr)
Check if the IPv6 address is an organization scope multicast address (FFx8::).
Definition: net_ip.h:1093
static enum net_priority net_vlan2priority(uint8_t priority)
Convert network packet VLAN priority to network packet priority so we can place the packet into corre...
Definition: net_ip.h:1569
static int32_t net_tcp_seq_cmp(uint32_t seq1, uint32_t seq2)
Compare TCP sequence numbers.
Definition: net_ip.h:1508
static bool net_ipv6_is_addr_mcast(const struct in6_addr *addr)
Check if the IPv6 address is a multicast address.
Definition: net_ip.h:613
#define NET_IPV6_ADDR_SIZE
Definition: net_ip.h:148
int net_addr_pton(sa_family_t family, const char *src, void *dst)
Convert a string to IP address.
unsigned short int sa_family_t
Socket address family type.
Definition: net_ip.h:164
static void net_ipv6_addr_create_ll_allrouters_mcast(struct in6_addr *addr)
Create link local allrouters multicast IPv6 address.
Definition: net_ip.h:1237
char * net_addr_ntop(sa_family_t family, const void *src, char *dst, size_t size)
Convert IP address to string form.
net_addr_state
What is the current state of the network address.
Definition: net_ip.h:445
static bool net_ipv4_addr_cmp_raw(const uint8_t *addr1, const uint8_t *addr2)
Compare two raw IPv4 address buffers.
Definition: net_ip.h:796
static bool net_ipv6_addr_cmp(const struct in6_addr *addr1, const struct in6_addr *addr2)
Compare two IPv6 addresses.
Definition: net_ip.h:811
static bool net_ipv6_is_addr_mcast_iface_all_nodes(const struct in6_addr *addr)
Check if the IPv6 address is a interface scope all nodes multicast address (FF01::1).
Definition: net_ip.h:1148
static bool net_ipv4_is_my_addr(const struct in_addr *addr)
Check if the IPv4 address is assigned to any network interface in the system.
Definition: net_ip.h:940
static bool net_ipv6_is_same_mcast_scope(const struct in6_addr *addr_1, const struct in6_addr *addr_2)
Check if the IPv6 addresses have the same multicast scope (FFyx::).
Definition: net_ip.h:1009
static void net_ipv6_addr_copy_raw(uint8_t *dest, const uint8_t *src)
Copy an IPv6 address raw buffer.
Definition: net_ip.h:768
static bool net_ipv6_is_addr_mcast_mesh(const struct in6_addr *addr)
Check if the IPv6 address is a mesh-local scope multicast address (FFx3::).
Definition: net_ip.h:1065
static struct sockaddr_in_ptr * net_sin_ptr(const struct sockaddr_ptr *addr)
Get sockaddr_in_ptr from sockaddr_ptr.
Definition: net_ip.h:1411
const struct in_addr * net_ipv4_broadcast_address(void)
Return pointer to broadcast (all bits ones) IPv4 address.
#define htons(x)
Convert 16-bit value from host to network byte order.
Definition: net_ip.h:120
bool net_if_ipv4_addr_mask_cmp(struct net_if *iface, const struct in_addr *addr)
static bool net_ipv6_is_addr_mcast_global(const struct in6_addr *addr)
Check if the IPv6 address is a global multicast address (FFxE::/16).
Definition: net_ip.h:1023
static void net_ipv6_addr_create_ll_allnodes_mcast(struct in6_addr *addr)
Create link local allnodes multicast IPv6 address.
Definition: net_ip.h:1227
static bool net_ipv6_is_addr_solicited_node(const struct in6_addr *addr)
Check if the IPv6 address is solicited node multicast address FF02:0:0:0:0:1:FFXX:XXXX defined in RFC...
Definition: net_ip.h:975
static void net_ipv6_addr_create_solicited_node(const struct in6_addr *src, struct in6_addr *dst)
Create solicited node IPv6 multicast address FF02:0:0:0:0:1:FFXX:XXXX defined in RFC 3513.
Definition: net_ip.h:1178
static bool net_ipv6_is_addr_mcast_group(const struct in6_addr *addr, const struct in6_addr *group)
Check if the IPv6 address belongs to certain multicast group.
Definition: net_ip.h:1108
static bool net_ipv6_is_addr_mcast_site(const struct in6_addr *addr)
Check if the IPv6 address is a site scope multicast address (FFx5::).
Definition: net_ip.h:1079
static void net_ipv6_addr_create_iid(struct in6_addr *addr, struct net_linkaddr *lladdr)
Create IPv6 address interface identifier.
Definition: net_ip.h:1248
static bool net_ipv6_is_addr_mcast_link(const struct in6_addr *addr)
Check if the IPv6 address is a link local scope multicast address (FFx2::).
Definition: net_ip.h:1051
static bool net_ipv4_addr_mask_cmp(struct net_if *iface, const struct in_addr *addr)
Check if the given address belongs to same subnet that has been configured for the interface.
Definition: net_ip.h:890
net_ip_protocol_secure
Protocol numbers for TLS protocols.
Definition: net_ip.h:75
#define net_ipaddr_copy(dest, src)
Copy an IPv4 or IPv6 address.
Definition: net_ip.h:747
net_ip_mtu
Definition: net_ip.h:409
int net_rx_priority2tc(enum net_priority prio)
Convert Rx network packet priority to traffic class so we can place the packet into correct Rx queue.
static bool net_ipv4_is_addr_loopback(struct in_addr *addr)
Check if the IPv4 address is a loopback address (127.0.0.0/8).
Definition: net_ip.h:698
int net_bytes_from_str(uint8_t *buf, int buf_len, const char *src)
Convert a string of hex values to array of bytes.
static uint8_t net_priority2vlan(enum net_priority priority)
Convert network packet priority to network packet VLAN priority.
Definition: net_ip.h:1598
bool net_if_ipv4_is_addr_bcast(struct net_if *iface, const struct in_addr *addr)
static bool net_ipv6_is_prefix(const uint8_t *addr1, const uint8_t *addr2, uint8_t length)
Check if two IPv6 addresses are same when compared after prefix mask.
Definition: net_ip.h:661
bool net_ipaddr_parse(const char *str, size_t str_len, struct sockaddr *addr)
Parse a string that contains either IPv4 or IPv6 address and optional port, and store the information...
static bool net_ipv6_is_addr_loopback(struct in6_addr *addr)
Check if the IPv6 address is a loopback address (::1).
Definition: net_ip.h:598
static bool net_tcp_seq_greater(uint32_t seq1, uint32_t seq2)
Check that one TCP sequence number is greater.
Definition: net_ip.h:1523
net_sock_type
Socket type.
Definition: net_ip.h:84
const struct in6_addr * net_ipv6_unspecified_address(void)
Return pointer to any (all bits zeros) IPv6 address.
static bool net_ipv6_is_addr_mcast_link_all_nodes(const struct in6_addr *addr)
Check if the IPv6 address is a link local scope all nodes multicast address (FF02::1).
Definition: net_ip.h:1164
const char * net_family2str(sa_family_t family)
Return network address family value as a string.
static bool net_ipv4_is_ll_addr(const struct in_addr *addr)
Check if the given IPv4 address is a link local address.
Definition: net_ip.h:734
static struct sockaddr_can_ptr * net_can_ptr(const struct sockaddr_ptr *addr)
Get sockaddr_can_ptr from sockaddr_ptr.
Definition: net_ip.h:1439
#define ntohl(x)
Convert 32-bit value from network to host byte order.
Definition: net_ip.h:104
static bool net_ipv4_is_addr_bcast(struct net_if *iface, const struct in_addr *addr)
Check if the given IPv4 address is a broadcast address.
Definition: net_ip.h:918
static bool net_ipv6_is_ll_addr(const struct in6_addr *addr)
Check if the given IPv6 address is a link local address.
Definition: net_ip.h:839
static struct sockaddr_in * net_sin(const struct sockaddr *addr)
Get sockaddr_in from sockaddr.
Definition: net_ip.h:1383
const struct in_addr * net_ipv4_unspecified_address(void)
Return pointer to any (all bits zeros) IPv4 address.
static bool net_ipv6_is_addr_mcast_all_nodes_group(const struct in6_addr *addr)
Check if the IPv6 address belongs to the all nodes multicast group.
Definition: net_ip.h:1128
size_t socklen_t
Length of a socket address.
Definition: net_ip.h:168
static struct sockaddr_ll_ptr * net_sll_ptr(const struct sockaddr_ptr *addr)
Get sockaddr_ll_ptr from sockaddr_ptr.
Definition: net_ip.h:1425
static struct sockaddr_in6 * net_sin6(const struct sockaddr *addr)
Get sockaddr_in6 from sockaddr.
Definition: net_ip.h:1370
struct net_if_mcast_addr * net_if_ipv6_maddr_lookup(const struct in6_addr *addr, struct net_if **iface)
static bool net_ipv4_is_addr_unspecified(const struct in_addr *addr)
Check if the IPv4 address is unspecified (all bits zero)
Definition: net_ip.h:710
static bool net_ipv6_is_addr_mcast_scope(const struct in6_addr *addr, int scope)
Check if the IPv6 address is a given scope multicast address (FFyx::).
Definition: net_ip.h:994
static bool net_ipv6_is_ula_addr(const struct in6_addr *addr)
Check if the given IPv6 address is a unique local address.
Definition: net_ip.h:851
static bool net_ipv6_is_addr_mcast_iface(const struct in6_addr *addr)
Check if the IPv6 address is a interface scope multicast address (FFx1::).
Definition: net_ip.h:1037
#define htonl(x)
Convert 32-bit value from host to network byte order.
Definition: net_ip.h:128
int net_tx_priority2tc(enum net_priority prio)
Convert Tx network packet priority to traffic class so we can place the packet into correct Tx queue.
static struct sockaddr_in6_ptr * net_sin6_ptr(const struct sockaddr_ptr *addr)
Get sockaddr_in6_ptr from sockaddr_ptr.
Definition: net_ip.h:1397
net_priority
Network packet priority settings described in IEEE 802.1Q Annex I.1.
Definition: net_ip.h:422
static bool net_ipv4_is_addr_mcast(const struct in_addr *addr)
Check if the IPv4 address is a multicast address.
Definition: net_ip.h:722
net_ip_protocol
Protocol numbers from IANA/BSD.
Definition: net_ip.h:62
static bool net_ipv6_addr_based_on_ll(const struct in6_addr *addr, const struct net_linkaddr *lladdr)
Check if given address is based on link layer address.
Definition: net_ip.h:1304
static void net_ipv4_addr_copy_raw(uint8_t *dest, const uint8_t *src)
Copy an IPv4 address raw buffer.
Definition: net_ip.h:756
static bool net_ipv6_is_my_maddr(struct in6_addr *maddr)
Check if IPv6 multicast address is found in one of the network interfaces.
Definition: net_ip.h:647
static bool net_ipv6_addr_cmp_raw(const uint8_t *addr1, const uint8_t *addr2)
Compare two raw IPv6 address buffers.
Definition: net_ip.h:825
static bool net_ipv6_is_addr_unspecified(const struct in6_addr *addr)
Check if the IPv6 address is unspecified (all bits zero)
Definition: net_ip.h:959
net_addr_type
How the network address is assigned to network interface.
Definition: net_ip.h:453
@ NET_ADDR_ANY_STATE
Default (invalid) address type.
Definition: net_ip.h:446
@ NET_ADDR_TENTATIVE
Tentative address
Definition: net_ip.h:447
@ NET_ADDR_DEPRECATED
Deprecated address
Definition: net_ip.h:449
@ NET_ADDR_PREFERRED
Preferred address
Definition: net_ip.h:448
@ IPPROTO_TLS_1_1
TLS 1.1 protocol.
Definition: net_ip.h:77
@ IPPROTO_TLS_1_0
TLS 1.0 protocol.
Definition: net_ip.h:76
@ IPPROTO_DTLS_1_0
DTLS 1.0 protocol.
Definition: net_ip.h:79
@ IPPROTO_TLS_1_2
TLS 1.2 protocol.
Definition: net_ip.h:78
@ IPPROTO_DTLS_1_2
DTLS 1.2 protocol.
Definition: net_ip.h:80
@ NET_IPV4_MTU
IPv4 MTU length.
Definition: net_ip.h:418
@ NET_IPV6_MTU
IPv6 MTU length.
Definition: net_ip.h:413
@ SOCK_DGRAM
Datagram socket type.
Definition: net_ip.h:86
@ SOCK_RAW
RAW socket type
Definition: net_ip.h:87
@ SOCK_STREAM
Stream socket type
Definition: net_ip.h:85
@ NET_PRIORITY_NC
Network control
Definition: net_ip.h:430
@ NET_PRIORITY_IC
Internetwork control
Definition: net_ip.h:429
@ NET_PRIORITY_CA
Critical applications (highest)
Definition: net_ip.h:426
@ NET_PRIORITY_VO
Voice, < 10 ms latency and jitter
Definition: net_ip.h:428
@ NET_PRIORITY_VI
Video, < 100 ms latency and jitter.
Definition: net_ip.h:427
@ NET_PRIORITY_BE
Best effort (default)
Definition: net_ip.h:424
@ NET_PRIORITY_EE
Excellent effort
Definition: net_ip.h:425
@ NET_PRIORITY_BK
Background (lowest)
Definition: net_ip.h:423
@ IPPROTO_IP
IP protocol (pseudo-val for setsockopt()
Definition: net_ip.h:63
@ IPPROTO_RAW
RAW IP packets
Definition: net_ip.h:71
@ IPPROTO_IPIP
IPIP tunnels
Definition: net_ip.h:66
@ IPPROTO_TCP
TCP protocol
Definition: net_ip.h:67
@ IPPROTO_IGMP
IGMP protocol
Definition: net_ip.h:65
@ IPPROTO_ICMP
ICMP protocol
Definition: net_ip.h:64
@ IPPROTO_IPV6
IPv6 protocol
Definition: net_ip.h:69
@ IPPROTO_UDP
UDP protocol
Definition: net_ip.h:68
@ IPPROTO_ICMPV6
ICMPv6 protocol.
Definition: net_ip.h:70
@ NET_ADDR_ANY
Default value.
Definition: net_ip.h:455
@ NET_ADDR_OVERRIDABLE
Manually set address which is overridable by DHCP.
Definition: net_ip.h:463
@ NET_ADDR_DHCP
Address is from DHCP.
Definition: net_ip.h:459
@ NET_ADDR_MANUAL
Manually set address.
Definition: net_ip.h:461
@ NET_ADDR_AUTOCONF
Auto configured address.
Definition: net_ip.h:457
@ NET_LINK_IEEE802154
IEEE 802.15.4 link address.
Definition: net_linkaddr.h:51
@ NET_LINK_ETHERNET
Ethernet link address.
Definition: net_linkaddr.h:55
@ NET_LINK_BLUETOOTH
Bluetooth IPSP link address.
Definition: net_linkaddr.h:53
#define ARRAY_SIZE(array)
Number of elements in the given array.
Definition: util.h:124
Public API for network link address.
flags
Definition: parser.h:96
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
int memcmp(const void *m1, const void *m2, size_t n)
void * memcpy(void *ZRESTRICT d, const void *ZRESTRICT s, size_t n)
int cmsg_type
Definition: net_ip.h:251
socklen_t cmsg_len
Definition: net_ip.h:249
z_max_align_t cmsg_data[]
Definition: net_ip.h:253
int cmsg_level
Definition: net_ip.h:250
IPv6 address struct.
Definition: net_ip.h:139
uint8_t s6_addr[16]
Definition: net_ip.h:141
uint32_t s6_addr32[4]
Definition: net_ip.h:143
uint16_t s6_addr16[8]
Definition: net_ip.h:142
IPv4 address struct.
Definition: net_ip.h:151
uint8_t s4_addr[4]
Definition: net_ip.h:153
uint32_t s_addr
Definition: net_ip.h:156
uint16_t s4_addr16[2]
Definition: net_ip.h:154
uint32_t s4_addr32[1]
Definition: net_ip.h:155
void * iov_base
Definition: net_ip.h:233
size_t iov_len
Definition: net_ip.h:234
struct iovec * msg_iov
Definition: net_ip.h:241
socklen_t msg_namelen
Definition: net_ip.h:240
void * msg_name
Definition: net_ip.h:239
int msg_flags
Definition: net_ip.h:245
size_t msg_controllen
Definition: net_ip.h:244
size_t msg_iovlen
Definition: net_ip.h:242
void * msg_control
Definition: net_ip.h:243
Network Interface unicast IP addresses.
Definition: net_if.h:52
IP and other configuration related data for network interface.
Definition: net_if.h:472
Network Interface multicast IP addresses.
Definition: net_if.h:93
Network Interface structure.
Definition: net_if.h:595
Hardware link address structure.
Definition: net_linkaddr.h:67
uint8_t * addr
The array of byte representing the address.
Definition: net_linkaddr.h:69
uint8_t type
What kind of address is this for.
Definition: net_linkaddr.h:75
uint8_t len
Length of that address array.
Definition: net_linkaddr.h:72
IPv6/IPv4 network connection tuple.
Definition: net_ip.h:436
struct net_addr * remote_addr
IPv6/IPv4 remote address.
Definition: net_ip.h:437
uint16_t local_port
UDP/TCP local port
Definition: net_ip.h:440
enum net_ip_protocol ip_proto
IP protocol
Definition: net_ip.h:441
uint16_t remote_port
UDP/TCP remote port
Definition: net_ip.h:439
struct net_addr * local_addr
IPv6/IPv4 local address
Definition: net_ip.h:438
sa_family_t can_family
Definition: net_ip.h:227
int can_ifindex
Definition: net_ip.h:228
sa_family_t sin6_family
Definition: net_ip.h:186
uint16_t sin6_port
Definition: net_ip.h:187
uint8_t sin6_scope_id
Definition: net_ip.h:189
struct in6_addr * sin6_addr
Definition: net_ip.h:188
Socket address struct for IPv6.
Definition: net_ip.h:178
uint8_t sin6_scope_id
Definition: net_ip.h:182
struct in6_addr sin6_addr
Definition: net_ip.h:181
uint16_t sin6_port
Definition: net_ip.h:180
sa_family_t sin6_family
Definition: net_ip.h:179
struct in_addr * sin_addr
Definition: net_ip.h:202
uint16_t sin_port
Definition: net_ip.h:201
sa_family_t sin_family
Definition: net_ip.h:200
Socket address struct for IPv4.
Definition: net_ip.h:193
uint16_t sin_port
Definition: net_ip.h:195
struct in_addr sin_addr
Definition: net_ip.h:196
sa_family_t sin_family
Definition: net_ip.h:194
uint8_t * sll_addr
Definition: net_ip.h:223
uint16_t sll_hatype
Definition: net_ip.h:220
int sll_ifindex
Definition: net_ip.h:219
uint8_t sll_pkttype
Definition: net_ip.h:221
sa_family_t sll_family
Definition: net_ip.h:217
uint8_t sll_halen
Definition: net_ip.h:222
uint16_t sll_protocol
Definition: net_ip.h:218
Socket address struct for packet socket.
Definition: net_ip.h:206
uint8_t sll_pkttype
Definition: net_ip.h:211
uint16_t sll_hatype
Definition: net_ip.h:210
sa_family_t sll_family
Definition: net_ip.h:207
uint16_t sll_protocol
Definition: net_ip.h:208
int sll_ifindex
Definition: net_ip.h:209
uint8_t sll_halen
Definition: net_ip.h:212
uint8_t sll_addr[8]
Definition: net_ip.h:213
Generic sockaddr struct.
Definition: net_ip.h:347
char data[NET_SOCKADDR_MAX_SIZE - sizeof(sa_family_t)]
Definition: net_ip.h:349
sa_family_t sa_family
Definition: net_ip.h:348