| 
16 | 16 | extern "C" {  | 
17 | 17 | #endif  | 
18 | 18 | 
 
  | 
 | 19 | +#include <stddef.h>  | 
 | 20 | + | 
19 | 21 | /* When CONFIG_NET_SOCKETS_OFFLOAD is enabled, offloaded sockets take precedence  | 
20 | 22 |  * when creating a new socket. Combine this flag with a socket type when  | 
21 | 23 |  * creating a socket, to enforce native socket creation (e. g. SOCK_STREAM | SOCK_NATIVE).  | 
@@ -116,6 +118,41 @@ extern "C" {  | 
116 | 118 |  */  | 
117 | 119 | #define RAI_WAIT_MORE 5  | 
118 | 120 | 
 
  | 
 | 121 | +/** sockopt: set a callback to be called when a send operation is done sending data on air and  | 
 | 122 | + * the data has been acknowledged by the peer, if required by the network protocol, or until the  | 
 | 123 | + * timeout, given by the SO_SNDTIMEO socket option, is reached. Valid timeout values are  | 
 | 124 | + * 1 to 600 seconds.  | 
 | 125 | + * This option takes a @ref socket_ncs_sendcb structure.  | 
 | 126 | + *  | 
 | 127 | + * @note The callback is executed in an interrupt context.  | 
 | 128 | + *	 Take care to offload any processing as appropriate.  | 
 | 129 | + *  | 
 | 130 | + * @note This is only supported by the following modem firmware:  | 
 | 131 | + *       - mfw_nrf9151-ntn  | 
 | 132 | + *  | 
 | 133 | + * This socket option cannot be used along the @ref MSG_WAITACK send flag.  | 
 | 134 | + */  | 
 | 135 | +#define SO_SENDCB (NET_SOCKET_NCS_BASE + 63)  | 
 | 136 | + | 
 | 137 | +/** Parameters returned in the @ref socket_ncs_sendcb_t callback. */  | 
 | 138 | +struct socket_ncs_sendcb_params {  | 
 | 139 | +	/** Socket handle. */  | 
 | 140 | +	int fd;  | 
 | 141 | +	/** Status. Can be 0 on successful send or EAGAIN on timeout. */  | 
 | 142 | +	int status;  | 
 | 143 | +	/** Number of bytes that was sent. */  | 
 | 144 | +	size_t bytes_sent;  | 
 | 145 | +};  | 
 | 146 | + | 
 | 147 | +/** Callback type in the @ref socket_ncs_sendcb structure. */  | 
 | 148 | +typedef void (*socket_ncs_sendcb_t)(const struct socket_ncs_sendcb_params *params);  | 
 | 149 | + | 
 | 150 | +/** Option value for the @ref SO_SENDCB socket option. */  | 
 | 151 | +struct socket_ncs_sendcb {  | 
 | 152 | +	/** Callback function. */  | 
 | 153 | +	socket_ncs_sendcb_t callback;  | 
 | 154 | +};  | 
 | 155 | + | 
119 | 156 | /* NCS specific IPPROTO_ALL level socket options */  | 
120 | 157 | 
 
  | 
121 | 158 | /** IPv4 and IPv6 protocol level (pseudo-val) for nRF sockets. */  | 
 | 
0 commit comments