Skip to content

Commit e8dbd1a

Browse files
committed
[nrf noup] include: net: socket_ncs: prevent overlaps
nrf-squash! [nrf noup] include: net: add NCS extensions Adds a base value for NCS specific socket options to prevent overlaps with Zephyr's socket options. Signed-off-by: Mirko Covizzi <[email protected]>
1 parent 5b7257c commit e8dbd1a

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

include/zephyr/net/socket_ncs.h

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,33 @@ extern "C" {
2525
#define SOCK_NATIVE 0x80000000
2626
#define SOCK_NATIVE_TLS 0x40000000
2727

28+
/** Define a base for NCS specific socket options to prevent overlaps with Zephyr's socket options.
29+
*/
30+
#define NET_SOCKET_NCS_BASE 1000000000
31+
2832
/* NCS specific TLS level socket options */
2933

3034
/** Socket option to set DTLS handshake timeout, specifically for nRF sockets.
3135
* The option accepts an integer, indicating the total handshake timeout,
3236
* including retransmissions, in seconds.
3337
* Accepted values for the option are: 1, 3, 7, 15, 31, 63, 123.
3438
*/
35-
#define TLS_DTLS_HANDSHAKE_TIMEO 18
39+
#define TLS_DTLS_HANDSHAKE_TIMEO (NET_SOCKET_NCS_BASE + 18)
3640

3741
/** Socket option to save DTLS connection, specifically for nRF sockets.
3842
*/
39-
#define TLS_DTLS_CONN_SAVE 19
43+
#define TLS_DTLS_CONN_SAVE (NET_SOCKET_NCS_BASE + 19)
4044

4145
/** Socket option to load DTLS connection, specifically for nRF sockets.
4246
*/
43-
#define TLS_DTLS_CONN_LOAD 20
47+
#define TLS_DTLS_CONN_LOAD (NET_SOCKET_NCS_BASE + 20)
4448

4549
/** Socket option to get result of latest TLS/DTLS completed handshakes end status,
4650
* specifically for nRF sockets.
4751
* The option accepts an integer, indicating the setting.
4852
* Accepted vaules for the option are: 0 and 1.
4953
*/
50-
#define TLS_DTLS_HANDSHAKE_STATUS 21
54+
#define TLS_DTLS_HANDSHAKE_STATUS (NET_SOCKET_NCS_BASE + 21)
5155

5256
/* Valid values for TLS_DTLS_HANDSHAKE_TIMEO option */
5357
#define TLS_DTLS_HANDSHAKE_TIMEO_NONE 0 /**< No timeout */
@@ -66,20 +70,20 @@ extern "C" {
6670
/* NCS specific socket options */
6771

6872
/** sockopt: enable sending data as part of exceptional events */
69-
#define SO_EXCEPTIONAL_DATA 33
73+
#define SO_EXCEPTIONAL_DATA (NET_SOCKET_NCS_BASE + 33)
7074
/** sockopt: Keep socket open when its PDN connection is lost
7175
* or the device is put into flight mode.
7276
*/
73-
#define SO_KEEPOPEN 34
77+
#define SO_KEEPOPEN (NET_SOCKET_NCS_BASE + 34)
7478
/** sockopt: bind to PDN */
75-
#define SO_BINDTOPDN 40
79+
#define SO_BINDTOPDN (NET_SOCKET_NCS_BASE + 40)
7680

7781
/** sockopt: Release assistance indication (RAI).
7882
* The option accepts an integer, indicating the type of RAI.
7983
* Accepted values for the option are: @ref RAI_NO_DATA, @ref RAI_LAST, @ref RAI_ONE_RESP,
8084
* @ref RAI_ONGOING, @ref RAI_WAIT_MORE.
8185
*/
82-
#define SO_RAI 61
86+
#define SO_RAI (NET_SOCKET_NCS_BASE + 61)
8387

8488
/** Release assistance indication (RAI).
8589
* Indicate that the application does not intend to send more data.
@@ -117,27 +121,27 @@ extern "C" {
117121
/** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */
118122
#define IPPROTO_ALL 512
119123
/** sockopt: disable all replies to unexpected traffics */
120-
#define SO_SILENCE_ALL 30
124+
#define SO_SILENCE_ALL (NET_SOCKET_NCS_BASE + 30)
121125

122126
/* NCS specific IPPROTO_IP level socket options */
123127

124128
/** sockopt: enable IPv4 ICMP replies */
125-
#define SO_IP_ECHO_REPLY 31
129+
#define SO_IP_ECHO_REPLY (NET_SOCKET_NCS_BASE + 31)
126130

127131
/* NCS specific IPPROTO_IPV6 level socket options */
128132

129133
/** sockopt: enable IPv6 ICMP replies */
130-
#define SO_IPV6_ECHO_REPLY 32
134+
#define SO_IPV6_ECHO_REPLY (NET_SOCKET_NCS_BASE + 32)
131135

132136
/** sockopt: Delay IPv6 address refresh during power saving mode */
133-
#define SO_IPV6_DELAYED_ADDR_REFRESH 62
137+
#define SO_IPV6_DELAYED_ADDR_REFRESH (NET_SOCKET_NCS_BASE + 62)
134138

135139
/* NCS specific TCP level socket options */
136140

137141
/** sockopt: Configurable TCP server session timeout in minutes.
138142
* Range is 0 to 135. 0 is no timeout and 135 is 2 h 15 min. Default is 0 (no timeout).
139143
*/
140-
#define SO_TCP_SRV_SESSTIMEO 55
144+
#define SO_TCP_SRV_SESSTIMEO (NET_SOCKET_NCS_BASE + 55)
141145

142146
/* NCS specific gettaddrinfo() flags */
143147

0 commit comments

Comments
 (0)