1# SPDX-License-Identifier: Apache-2.0
2
3zephyr_syscall_header(
4  ${ZEPHYR_BASE}/include/zephyr/net/net_if.h
5  ${ZEPHYR_BASE}/include/zephyr/net/net_ip.h
6)
7
8zephyr_library()
9zephyr_library_include_directories(.)
10zephyr_library_compile_definitions_ifdef(
11  CONFIG_NEWLIB_LIBC __LINUX_ERRNO_EXTENSIONS__
12  )
13
14zephyr_library_sources(
15  net_core.c
16  net_if.c
17  net_timeout.c
18  utils.c
19  )
20
21if(CONFIG_NET_OFFLOAD)
22zephyr_library_sources(net_context.c net_pkt.c)
23endif()
24
25zephyr_library_sources_ifdef(CONFIG_NET_MGMT_EVENT   net_mgmt.c)
26
27if(CONFIG_NET_NATIVE)
28zephyr_library_sources(net_context.c)
29zephyr_library_sources(net_pkt.c)
30zephyr_library_sources(net_tc.c)
31zephyr_library_sources(icmp.c)
32zephyr_library_sources_ifdef(CONFIG_NET_IP           connection.c)
33zephyr_library_sources_ifdef(CONFIG_NET_6LO          6lo.c)
34zephyr_library_sources_ifdef(CONFIG_NET_IPV4_AUTO    ipv4_autoconf.c)
35zephyr_library_sources_ifdef(CONFIG_NET_IPV4         icmpv4.c ipv4.c)
36zephyr_library_sources_ifdef(CONFIG_NET_IPV4_ACD     ipv4_acd.c)
37zephyr_library_sources_ifdef(CONFIG_NET_IPV4_IGMP    igmp.c)
38zephyr_library_sources_ifdef(CONFIG_NET_IPV6         icmpv6.c nbr.c
39                                                     ipv6.c ipv6_nbr.c)
40zephyr_library_sources_ifdef(CONFIG_NET_IPV6_MLD     ipv6_mld.c)
41zephyr_library_sources_ifdef(CONFIG_NET_IPV6_PE      ipv6_pe.c)
42zephyr_library_sources_ifdef(CONFIG_NET_IPV6_FRAGMENT     ipv6_fragment.c)
43zephyr_library_sources_ifdef(CONFIG_NET_IPV4_FRAGMENT     ipv4_fragment.c)
44zephyr_library_sources_ifdef(CONFIG_NET_MGMT_EVENT   net_mgmt.c)
45zephyr_library_sources_ifdef(CONFIG_NET_PMTU         pmtu.c)
46zephyr_library_sources_ifdef(CONFIG_NET_ROUTE        route.c)
47zephyr_library_sources_ifdef(CONFIG_NET_STATISTICS   net_stats.c)
48zephyr_library_sources_ifdef(CONFIG_NET_TCP          tcp.c)
49zephyr_library_sources_ifdef(CONFIG_NET_TEST_PROTOCOL           tp.c)
50zephyr_library_sources_ifdef(CONFIG_NET_UDP          udp.c)
51zephyr_library_sources_ifdef(CONFIG_NET_PROMISCUOUS_MODE promiscuous.c)
52
53# Net Connection Socket Adapters
54zephyr_library_sources_ifdef(CONFIG_NET_CONNECTION_SOCKETS  connection.c)
55zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_PACKET      packet_socket.c)
56zephyr_library_sources_ifdef(CONFIG_NET_SOCKETS_CAN         canbus_socket.c)
57
58if(CONFIG_NET_TCP_ISN_RFC6528 OR CONFIG_NET_IPV6_PE OR CONFIG_NET_IPV6_IID_STABLE)
59  zephyr_library_link_libraries_ifdef(CONFIG_MBEDTLS mbedTLS)
60endif()
61endif()
62
63if(CONFIG_NET_PKT_ALLOC_STATS)
64  zephyr_linker_sources(DATA_SECTIONS iterables_net_pkt_alloc_stats.ld)
65  zephyr_iterable_section(NAME net_pkt_alloc_stats_slab GROUP DATA_REGION
66    ${XIP_ALIGN_WITH_INPUT} SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
67endif()
68
69# To get private includes like net_shell.h
70zephyr_library_include_directories(. ${ZEPHYR_BASE}/subsys/net/lib)
71
72zephyr_library_include_directories(
73  ${ZEPHYR_BASE}/kernel/include
74  ${ARCH_DIR}/${ARCH}/include
75  )
76