1# BSD Sockets compatible API 2 3# Copyright (c) 2017 Linaro Limited. 4# SPDX-License-Identifier: Apache-2.0 5 6menuconfig NET_SOCKETS 7 bool "BSD Sockets compatible API" 8 help 9 Provide BSD Sockets like API on top of native Zephyr networking API. 10 11if NET_SOCKETS 12 13config NET_SOCKETS_POSIX_NAMES 14 bool "POSIX names for Sockets API (without full POSIX API)" 15 default y if !POSIX_API 16 depends on !POSIX_API 17 help 18 With this option, Socket API functions are available under the 19 standard POSIX names like socket(), recv(), and close(), etc., 20 even if full POSIX API (CONFIG_POSIX_API) is not enabled. (Note 21 that close() may require a special attention, as in POSIX it 22 closes any file descriptor, while with this option enabled, it 23 will apply only to sockets.) 24 25 Various networking libraries require either 26 CONFIG_NET_SOCKETS_POSIX_NAMES or CONFIG_POSIX_API to be set. 27 If both are disabled, Zephyr's socket functions will be 28 available (only) with ``zsock_`` prefix, (e.g. `zsock_socket`). 29 This is useful only in peculiar cases, e.g. when integrating 30 with 3rd-party socket libraries. 31 32config NET_SOCKETS_POLL_MAX 33 int "Max number of supported poll() entries" 34 default 3 35 help 36 Maximum number of entries supported for poll() call. 37 38config NET_SOCKETS_CONNECT_TIMEOUT 39 int "Timeout value in milliseconds to CONNECT" 40 default 3000 41 range 0 60000 42 help 43 This variable specifies time in milliseconds after connect() 44 API call will timeout if we have not received SYN-ACK from 45 peer. 46 47config NET_SOCKETS_DNS_TIMEOUT 48 int "Timeout value in milliseconds for DNS queries" 49 default 2000 50 range 1000 300000 51 depends on DNS_RESOLVER 52 help 53 This variable specifies time in milliseconds after which DNS 54 query is considered timeout. Minimum timeout is 1 second and 55 maximum timeout is 5 min. 56 57config NET_SOCKETS_SOCKOPT_TLS 58 bool "Enable TCP TLS socket option support [EXPERIMENTAL]" 59 imply TLS_CREDENTIALS 60 select MBEDTLS if NET_NATIVE 61 help 62 Enable TLS socket option support which automatically establishes 63 a TLS connection to the remote host. 64 65config NET_SOCKETS_TLS_SET_MAX_FRAGMENT_LENGTH 66 bool "Set Maximum Fragment Length (MFL)" 67 default y 68 help 69 Call mbedtls_ssl_conf_max_frag_len() on created TLS context 70 configuration, so that Maximum Fragment Length (MFL) will be sent to 71 peer using RFC 6066 max_fragment_length extension. 72 73 Maximum Fragment Length (MFL) value is automatically chosen based on 74 MBEDTLS_SSL_OUT_CONTENT_LEN and MBEDTLS_SSL_IN_CONTENT_LEN mbed TLS 75 macros (which are configured by CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN in 76 case of default mbed TLS config). 77 78 This is mostly useful for TLS client side to tell TLS server what is 79 the maximum supported receive record length. 80 81config NET_SOCKETS_ENABLE_DTLS 82 bool "Enable DTLS socket support [EXPERIMENTAL]" 83 depends on NET_SOCKETS_SOCKOPT_TLS 84 select MBEDTLS_DTLS if NET_NATIVE 85 help 86 Enable DTLS socket support. By default only TLS over TCP is supported. 87 88config NET_SOCKETS_DTLS_TIMEOUT 89 int "Timeout value in milliseconds for DTLS connection" 90 default 5000 91 depends on NET_SOCKETS_ENABLE_DTLS 92 help 93 This variable specifies time in milliseconds after which DTLS 94 connection is considered dead by TLS server and DTLS resources are 95 freed. This is needed to prevent situation when DTLS client shuts down 96 without closing connection gracefully, which can prevent other peers 97 from connecting. Value of 0 indicates no timeout - resources will be 98 freed only when connection is gracefully closed by peer sending TLS 99 notification or socket is closed. 100 101config NET_SOCKETS_TLS_MAX_CONTEXTS 102 int "Maximum number of TLS/DTLS contexts" 103 default 1 104 depends on NET_SOCKETS_SOCKOPT_TLS 105 help 106 "This variable specifies maximum number of TLS/DTLS contexts that can 107 be allocated at the same time." 108 109config NET_SOCKETS_TLS_MAX_CREDENTIALS 110 int "Maximum number of TLS/DTLS credentials per socket" 111 default 4 112 depends on NET_SOCKETS_SOCKOPT_TLS 113 help 114 This variable sets maximum number of TLS/DTLS credentials that can be 115 used with a specific socket. 116 117config NET_SOCKETS_TLS_MAX_CIPHERSUITES 118 int "Maximum number of TLS/DTLS ciphersuites per socket" 119 default 4 120 depends on NET_SOCKETS_SOCKOPT_TLS 121 help 122 This variable sets maximum number of TLS/DTLS ciphersuites that can 123 be used with specific socket, if set explicitly by socket option. 124 By default, all ciphersuites that are available in the system are 125 available to the socket. 126 127config NET_SOCKETS_TLS_MAX_APP_PROTOCOLS 128 int "Maximum number of supported application layer protocols" 129 default 2 130 depends on NET_SOCKETS_SOCKOPT_TLS && MBEDTLS_SSL_ALPN 131 help 132 This variable sets maximum number of supported application layer 133 protocols over TLS/DTL that can be set explicitly by a socket option. 134 By default, no supported application layer protocol is set. 135 136config NET_SOCKETS_OFFLOAD 137 bool "Offload Socket APIs [EXPERIMENTAL]" 138 help 139 Enables direct offloading of socket operations to dedicated TCP/IP 140 hardware. 141 This feature is intended to save resources by bypassing the Zephyr 142 TCP/IP stack in the case where there is only one network interface 143 required in the system, providing full BSD socket offload capability. 144 As a result, it bypasses any potential IP routing that Zephyr might 145 provide between multiple network interfaces. 146 See NET_OFFLOAD for a more deeply integrated approach which offloads 147 from the net_context() API within the Zephyr IP stack. 148 149config NET_SOCKETS_OFFLOAD_TLS 150 bool "Offload TLS socket calls to the offloaded sockets" 151 depends on NET_SOCKETS_OFFLOAD 152 default y 153 help 154 If enabled, the offloading engine is expected to handle TLS/DTLS 155 socket calls. Othwerwise, Zephyrs native TLS socket implementation 156 will be used, and only TCP/UDP socket calls will be offloaded. 157 158config NET_SOCKETS_PACKET 159 bool "Enable packet socket support" 160 help 161 This is an initial version of packet socket support (special type 162 raw socket). Packets are passed to and from the device driver 163 without any changes in the packet headers. It's API caller 164 responsibility to provide all the headers (e.g L2, L3 and so on) 165 while sending. While receiving, packets (including all the headers) 166 will be feed to sockets as it as from the driver. 167 168config NET_SOCKETS_PACKET_DGRAM 169 bool "Enable packet socket SOCK_DGRAM support" 170 depends on NET_SOCKETS_PACKET 171 default y 172 help 173 For AF_PACKET sockets with SOCK_DGRAM type, the L2 header 174 is removed before the packet is passed to the user. Packets sent 175 through a SOCK_DGRAM packet socket get a suitable L2 header based 176 on the information in the sockaddr_ll destination address before 177 they are queued. 178 179config NET_SOCKETS_CAN 180 bool "Enable socket CAN support [EXPERIMENTAL]" 181 select NET_L2_CANBUS_RAW 182 help 183 The value depends on your network needs. 184 185config NET_SOCKETS_CAN_RECEIVERS 186 int "How many simultaneous SocketCAN receivers are allowed" 187 default 1 188 depends on NET_SOCKETS_CAN 189 help 190 The value tells how many sockets can receive data from same 191 Socket-CAN interface. 192 193config NET_SOCKETPAIR 194 bool "Support for the socketpair syscall [EXPERIMENTAL]" 195 depends on HEAP_MEM_POOL_SIZE != 0 196 help 197 Choose y here if you would like to use the socketpair(2) 198 system call. 199 200config NET_SOCKETPAIR_BUFFER_SIZE 201 int "Size of the intermediate buffer, in bytes" 202 default 64 203 range 1 4096 204 depends on NET_SOCKETPAIR 205 help 206 Buffer size for socketpair(2) 207 208config NET_SOCKETS_NET_MGMT 209 bool "Enable network management socket support [EXPERIMENTAL]" 210 depends on NET_MGMT_EVENT 211 select NET_MGMT_EVENT_INFO 212 help 213 Select this if you want to use socket API to get network 214 managements events to your application. 215 216config NET_SOCKETS_NET_MGMT_MAX_LISTENERS 217 int "Max number of sockets to listen" 218 default 1 219 depends on NET_SOCKETS_NET_MGMT 220 help 221 This sets the maximum number of net_mgmt sockets that can 222 be set by the socket interface. So if you have two separate 223 sockets that are used for listening events, you need to set 224 this to two. 225 226module = NET_SOCKETS 227module-dep = NET_LOG 228module-str = Log level for BSD sockets compatible API calls 229module-help = Enables logging for sockets code. 230source "subsys/net/Kconfig.template.log_config.net" 231 232endif # NET_SOCKETS 233