Mistake on this page?
Report an issue in GitHub or email us
nsapi_types.h
1 
2 /** \addtogroup netsocket */
3 /** @{*/
4 /* nsapi.h - The network socket API
5  * Copyright (c) 2015 ARM Limited
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef NSAPI_TYPES_H
21 #define NSAPI_TYPES_H
22 
23 #include <stdint.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 
30 /** Enum of standardized error codes
31  *
32  * Valid error codes have negative values and may
33  * be returned by any network operation.
34  *
35  * @enum nsapi_error
36  */
38  NSAPI_ERROR_OK = 0, /*!< no error */
39  NSAPI_ERROR_WOULD_BLOCK = -3001, /*!< no data is not available but call is non-blocking */
40  NSAPI_ERROR_UNSUPPORTED = -3002, /*!< unsupported functionality */
41  NSAPI_ERROR_PARAMETER = -3003, /*!< invalid configuration */
42  NSAPI_ERROR_NO_CONNECTION = -3004, /*!< not connected to a network */
43  NSAPI_ERROR_NO_SOCKET = -3005, /*!< socket not available for use */
44  NSAPI_ERROR_NO_ADDRESS = -3006, /*!< IP address is not known */
45  NSAPI_ERROR_NO_MEMORY = -3007, /*!< memory resource not available */
46  NSAPI_ERROR_NO_SSID = -3008, /*!< ssid not found */
47  NSAPI_ERROR_DNS_FAILURE = -3009, /*!< DNS failed to complete successfully */
48  NSAPI_ERROR_DHCP_FAILURE = -3010, /*!< DHCP failed to complete successfully */
49  NSAPI_ERROR_AUTH_FAILURE = -3011, /*!< connection to access point failed */
50  NSAPI_ERROR_DEVICE_ERROR = -3012, /*!< failure interfacing with the network processor */
51  NSAPI_ERROR_IN_PROGRESS = -3013, /*!< operation (eg connect) in progress */
52  NSAPI_ERROR_ALREADY = -3014, /*!< operation (eg connect) already in progress */
53  NSAPI_ERROR_IS_CONNECTED = -3015, /*!< socket is already connected */
54  NSAPI_ERROR_CONNECTION_LOST = -3016, /*!< connection lost */
55  NSAPI_ERROR_CONNECTION_TIMEOUT = -3017, /*!< connection timed out */
56  NSAPI_ERROR_ADDRESS_IN_USE = -3018, /*!< Address already in use */
57  NSAPI_ERROR_TIMEOUT = -3019, /*!< operation timed out */
58  NSAPI_ERROR_BUSY = -3020, /*!< device is busy and cannot accept new operation */
59 };
60 
61 
62 /** Enum of connection status types
63  *
64  * Valid error codes have negative values.
65  *
66  * @enum nsapi_connection_status
67  */
69  NSAPI_STATUS_LOCAL_UP = 0, /*!< local IP address set */
70  NSAPI_STATUS_GLOBAL_UP = 1, /*!< global IP address set */
71  NSAPI_STATUS_DISCONNECTED = 2, /*!< no connection to network */
72  NSAPI_STATUS_CONNECTING = 3, /*!< connecting to network */
73  NSAPI_STATUS_ERROR_UNSUPPORTED = NSAPI_ERROR_UNSUPPORTED
74 } nsapi_connection_status_t;
75 
76 
77 /** Enum of event types
78  *
79  * Event callbacks are accompanied with an event-dependent parameter passed as an intptr_t.
80  *
81  * @enum nsapi_event
82  */
83 typedef enum nsapi_event {
84  NSAPI_EVENT_CONNECTION_STATUS_CHANGE = 0, /*!< network connection status has changed, the parameter = new status (nsapi_connection_status_t) */
85  NSAPI_EVENT_CELLULAR_STATUS_BASE = 0x1000, /*!< Cellular modem status has changed, See the enum values from enum cellular_connection_status_t in /features/cellular/framework/common/CellularCommon.h */
86  NSAPI_EVENT_CELLULAR_STATUS_END = 0x1FFF /*!< cellular modem status has changed, See the enum values from enum cellular_connection_status_t in /features/cellular/framework/common/CellularCommon.h */
87 } nsapi_event_t;
88 
89 
90 /** Type used to represent error codes
91  *
92  * This is a separate type from enum nsapi_error to avoid breaking
93  * compatibility in type-sensitive overloads
94  */
95 typedef signed int nsapi_error_t;
96 
97 /** Type used to represent the size of data passed through sockets
98  */
99 typedef unsigned int nsapi_size_t;
100 
101 /** Type used to represent either a size or error passed through sockets
102  *
103  * A valid nsapi_size_or_error_t is either a non-negative size or a
104  * negative error code from the nsapi_error_t
105  */
106 typedef signed int nsapi_size_or_error_t;
107 
108 /** Type used to represent either a value or error
109  *
110  * A valid nsapi_value_or_error_t is either a non-negative value or a
111  * negative error code from the nsapi_error_t
112  */
113 typedef signed int nsapi_value_or_error_t;
114 
115 /** Enum of encryption types
116  *
117  * The security type specifies a particular security to use when
118  * connected to a WiFi network
119  */
120 typedef enum nsapi_security {
121  NSAPI_SECURITY_NONE = 0x0, /*!< open access point */
122  NSAPI_SECURITY_WEP = 0x1, /*!< phrase conforms to WEP */
123  NSAPI_SECURITY_WPA = 0x2, /*!< phrase conforms to WPA */
124  NSAPI_SECURITY_WPA2 = 0x3, /*!< phrase conforms to WPA2 */
125  NSAPI_SECURITY_WPA_WPA2 = 0x4, /*!< phrase conforms to WPA/WPA2 */
126  NSAPI_SECURITY_PAP = 0x5, /*!< phrase conforms to PPP authentication context */
127  NSAPI_SECURITY_CHAP = 0x6, /*!< phrase conforms to PPP authentication context */
128  NSAPI_SECURITY_EAP_TLS = 0x7, /*!< phrase conforms to EAP-TLS */
129  NSAPI_SECURITY_PEAP = 0x8, /*!< phrase conforms to PEAP */
130  NSAPI_SECURITY_WPA2_ENT = 0x9, /*!< phrase conforms to WPA2-AES and WPA-TKIP with enterprise security */
131  NSAPI_SECURITY_UNKNOWN = 0xFF, /*!< unknown/unsupported security in scan results */
133 
134 /** Size of 2 char network interface name from driver
135  */
136 #define NSAPI_INTERFACE_PREFIX_SIZE 2
137 
138 /** Maximum size of network interface name
139  */
140 #define NSAPI_INTERFACE_NAME_MAX_SIZE 6
141 
142 /** Maximum size of IP address representation
143  */
144 #define NSAPI_IP_SIZE NSAPI_IPv6_SIZE
145 
146 /** Maximum number of bytes for IP address
147  */
148 #define NSAPI_IP_BYTES NSAPI_IPv6_BYTES
149 
150 /** Maximum size of MAC address representation
151  */
152 #define NSAPI_MAC_SIZE 18
153 
154 /** Maximum number of bytes for MAC address
155  */
156 #define NSAPI_MAC_BYTES 6
157 
158 /** Size of IPv4 representation
159  */
160 #define NSAPI_IPv4_SIZE 16
161 
162 /** Number of bytes in IPv4 address
163  */
164 #define NSAPI_IPv4_BYTES 4
165 
166 /** Size of IPv6 representation
167  */
168 #define NSAPI_IPv6_SIZE 40
169 
170 /** Number of bytes in IPv6 address
171  */
172 #define NSAPI_IPv6_BYTES 16
173 
174 /** Enum of IP address versions
175  *
176  * The IP version specifies the type of an IP address.
177  *
178  * @enum nsapi_version
179  */
180 typedef enum nsapi_version {
181  NSAPI_UNSPEC, /*!< Address is unspecified */
182  NSAPI_IPv4, /*!< Address is IPv4 */
183  NSAPI_IPv6, /*!< Address is IPv6 */
184 } nsapi_version_t;
185 
186 /** IP address structure for passing IP addresses by value
187  */
188 typedef struct nsapi_addr {
189  /** IP version
190  * - NSAPI_IPv4
191  * - NSAPI_IPv6
192  * - NSAPI_UNSPEC
193  */
194  nsapi_version_t version;
195 
196  /** IP address
197  * The raw bytes of the IP address stored in big-endian format
198  */
200 } nsapi_addr_t;
201 
202 
203 /** Opaque handle for network sockets
204  */
205 typedef void *nsapi_socket_t;
206 
207 
208 /** Enum of socket protocols
209  *
210  * The socket protocol specifies a particular protocol to
211  * be used with a newly created socket.
212  *
213  * @enum nsapi_protocol
214  */
215 typedef enum nsapi_protocol {
216  NSAPI_TCP, /*!< Socket is of TCP type */
217  NSAPI_UDP, /*!< Socket is of UDP type */
218 } nsapi_protocol_t;
219 
220 /** Enum of standardized stack option levels
221  * for use with NetworkStack::setstackopt and getstackopt.
222  *
223  * @enum nsapi_stack_level
224  */
225 typedef enum nsapi_stack_level {
226  NSAPI_STACK = 5000, /*!< Stack option level - see nsapi_stack_option_t for options */
227 } nsapi_stack_level_t;
228 
229 /** Enum of standardized stack option names for level NSAPI_STACK
230  * of NetworkStack::setstackopt and getstackopt.
231  *
232  * These options may not be supported on all stacks, in which
233  * case NSAPI_ERROR_UNSUPPORTED may be returned.
234  *
235  * @enum nsapi_stack_option
236  */
237 typedef enum nsapi_stack_option {
238  NSAPI_IPV4_MRU, /*!< Sets/gets size of largest IPv4 fragmented datagram to reassemble */
239  NSAPI_IPV6_MRU, /*!< Sets/gets size of largest IPv6 fragmented datagram to reassemble */
240 } nsapi_stack_option_t;
241 
242 /** Enum of standardized socket option levels
243  * for use with Socket::setsockopt and getsockopt.
244  *
245  * @enum nsapi_socket_level
246  */
247 typedef enum nsapi_socket_level {
248  NSAPI_SOCKET = 7000, /*!< Socket option level - see nsapi_socket_option_t for options */
249 } nsapi_socket_level_t;
250 
251 /** Enum of standardized socket option names for level NSAPI_SOCKET
252  * of Socket::setsockopt and getsockopt.
253  *
254  * These options may not be supported on all stacks, in which
255  * case NSAPI_ERROR_UNSUPPORTED may be returned.
256  *
257  * @enum nsapi_socket_option
258  */
259 typedef enum nsapi_socket_option {
260  NSAPI_REUSEADDR, /*!< Allow bind to reuse local addresses */
261  NSAPI_KEEPALIVE, /*!< Enables sending of keepalive messages */
262  NSAPI_KEEPIDLE, /*!< Sets timeout value to initiate keepalive */
263  NSAPI_KEEPINTVL, /*!< Sets timeout value for keepalive */
264  NSAPI_LINGER, /*!< Keeps close from returning until queues empty */
265  NSAPI_SNDBUF, /*!< Sets send buffer size */
266  NSAPI_RCVBUF, /*!< Sets recv buffer size */
267  NSAPI_ADD_MEMBERSHIP, /*!< Add membership to multicast address */
268  NSAPI_DROP_MEMBERSHIP, /*!< Drop membership to multicast address */
269  NSAPI_BIND_TO_DEVICE, /*!< Bind socket network interface name*/
270 } nsapi_socket_option_t;
271 
272 /** Supported IP protocol versions of IP stack
273  *
274  * @enum nsapi_ip_stack
275  */
276 typedef enum nsapi_ip_stack {
277  DEFAULT_STACK = 0,
278  IPV4_STACK,
279  IPV6_STACK,
280  IPV4V6_STACK
281 } nsapi_ip_stack_t;
282 
283 /* Backwards compatibility - previously didn't distinguish stack and socket options */
284 typedef nsapi_socket_level_t nsapi_level_t;
285 typedef nsapi_socket_option_t nsapi_option_t;
286 
287 /** nsapi_wifi_ap structure
288  *
289  * Structure representing a WiFi Access Point
290  */
291 typedef struct nsapi_wifi_ap {
292  char ssid[33]; /* 32 is what 802.11 defines as longest possible name; +1 for the \0 */
293  uint8_t bssid[6];
294  nsapi_security_t security;
295  int8_t rssi;
296  uint8_t channel;
298 
299 
300 /** nsapi_stack structure
301  *
302  * Stack structure representing a specific instance of a stack.
303  */
304 typedef struct nsapi_stack {
305  /** Network stack operation table
306  *
307  * Provides access to the underlying api of the stack. This is not
308  * flattened into the nsapi_stack to allow allocation in read-only
309  * memory.
310  */
311  const struct nsapi_stack_api *stack_api;
312 
313  /** Opaque handle for network stacks
314  */
315  void *stack;
316 
317  // Internal nsapi buffer
318  unsigned _stack_buffer[16];
319 } nsapi_stack_t;
320 
321 /** nsapi_ip_mreq structure
322  */
323 typedef struct nsapi_ip_mreq {
324  nsapi_addr_t imr_multiaddr; /* IP multicast address of group */
325  nsapi_addr_t imr_interface; /* local IP address of interface */
327 
328 /** nsapi_stack_api structure
329  *
330  * Common api structure for network stack operations. A network stack
331  * can provide a nsapi_stack_api structure filled out with the
332  * appropriate implementation.
333  *
334  * Unsupported operations can be left as null pointers.
335  */
336 typedef struct nsapi_stack_api {
337  /** Get the local IP address
338  *
339  * @param stack Stack handle
340  * @return Local IP Address or null address if not connected
341  */
342  nsapi_addr_t (*get_ip_address)(nsapi_stack_t *stack);
343 
344  /** Translates a hostname to an IP address
345  *
346  * The hostname may be either a domain name or an IP address. If the
347  * hostname is an IP address, no network transactions will be performed.
348  *
349  * If no stack-specific DNS resolution is provided, the hostname
350  * will be resolve using a UDP socket on the stack.
351  *
352  * @param stack Stack handle
353  * @param addr Destination for the host IP address
354  * @param host Hostname to resolve
355  * @param version Address family
356  * @return 0 on success, negative error code on failure
357  */
358  nsapi_error_t (*gethostbyname)(nsapi_stack_t *stack, const char *host, nsapi_addr_t *addr, nsapi_version_t version);
359 
360  /** Add a domain name server to list of servers to query
361  *
362  * @param addr Destination for the host address
363  * @return 0 on success, negative error code on failure
364  */
365  nsapi_error_t (*add_dns_server)(nsapi_stack_t *stack, nsapi_addr_t addr);
366 
367  /** Set stack-specific stack options
368  *
369  * The setstackopt allow an application to pass stack-specific hints
370  * to the underlying stack. For unsupported options,
371  * NSAPI_ERROR_UNSUPPORTED is returned and the stack is unmodified.
372  *
373  * @param stack Stack handle
374  * @param level Stack-specific protocol level
375  * @param optname Stack-specific option identifier
376  * @param optval Option value
377  * @param optlen Length of the option value
378  * @return 0 on success, negative error code on failure
379  */
380  nsapi_error_t (*setstackopt)(nsapi_stack_t *stack, int level,
381  int optname, const void *optval, unsigned optlen);
382 
383  /** Get stack-specific stack options
384  *
385  * The getstackopt allow an application to retrieve stack-specific hints
386  * from the underlying stack. For unsupported options,
387  * NSAPI_ERROR_UNSUPPORTED is returned and optval is unmodified.
388  *
389  * @param stack Stack handle
390  * @param level Stack-specific protocol level
391  * @param optname Stack-specific option identifier
392  * @param optval Destination for option value
393  * @param optlen Length of the option value
394  * @return 0 on success, negative error code on failure
395  */
396  nsapi_error_t (*getstackopt)(nsapi_stack_t *stack, int level,
397  int optname, void *optval, unsigned *optlen);
398 
399  /** Opens a socket
400  *
401  * Creates a network socket and stores it in the specified handle.
402  * The handle must be passed to following calls on the socket.
403  *
404  * A stack may have a finite number of sockets, in this case
405  * NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
406  *
407  * @param stack Stack context
408  * @param socket Destination for the handle to a newly created socket
409  * @param proto Protocol of socket to open, NSAPI_TCP or NSAPI_UDP
410  * @return 0 on success, negative error code on failure
411  */
412  nsapi_error_t (*socket_open)(nsapi_stack_t *stack, nsapi_socket_t *socket,
413  nsapi_protocol_t proto);
414 
415  /** Close the socket
416  *
417  * Closes any open connection and deallocates any memory associated
418  * with the socket.
419  *
420  * @param stack Stack handle
421  * @param socket Socket handle
422  * @return 0 on success, negative error code on failure
423  */
424  nsapi_error_t (*socket_close)(nsapi_stack_t *stack, nsapi_socket_t socket);
425 
426  /** Bind a specific address to a socket
427  *
428  * Binding a socket specifies the address and port on which to receive
429  * data. If the IP address is zeroed, only the port is bound.
430  *
431  * @param stack Stack handle
432  * @param socket Socket handle
433  * @param addr Local address to bind, may be null
434  * @param port Local port to bind
435  * @return 0 on success, negative error code on failure.
436  */
437  nsapi_error_t (*socket_bind)(nsapi_stack_t *stack, nsapi_socket_t socket,
438  nsapi_addr_t addr, uint16_t port);
439 
440  /** Listen for connections on a TCP socket
441  *
442  * Marks the socket as a passive socket that can be used to accept
443  * incoming connections.
444  *
445  * @param stack Stack handle
446  * @param socket Socket handle
447  * @param backlog Number of pending connections that can be queued
448  * simultaneously
449  * @return 0 on success, negative error code on failure
450  */
451  nsapi_error_t (*socket_listen)(nsapi_stack_t *stack, nsapi_socket_t socket, int backlog);
452 
453  /** Connects TCP socket to a remote host
454  *
455  * Initiates a connection to a remote server specified by the
456  * indicated address.
457  *
458  * @param stack Stack handle
459  * @param socket Socket handle
460  * @param addr The address of the remote host
461  * @param port The port of the remote host
462  * @return 0 on success, negative error code on failure
463  */
464  nsapi_error_t (*socket_connect)(nsapi_stack_t *stack, nsapi_socket_t socket,
465  nsapi_addr_t addr, uint16_t port);
466 
467  /** Accepts a connection on a TCP socket
468  *
469  * The server socket must be bound and set to listen for connections.
470  * On a new connection, creates a network socket and stores it in the
471  * specified handle. The handle must be passed to following calls on
472  * the socket.
473  *
474  * A stack may have a finite number of sockets, in this case
475  * NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
476  *
477  * This call is non-blocking. If accept would block,
478  * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
479  *
480  * @param stack Stack handle
481  * @param server Socket handle to server to accept from
482  * @param socket Destination for a handle to the newly created socket
483  * @param addr Destination for the address of the remote host
484  * @param port Destination for the port of the remote host
485  * @return 0 on success, negative error code on failure
486  */
487  nsapi_error_t (*socket_accept)(nsapi_stack_t *stack, nsapi_socket_t server,
488  nsapi_socket_t *socket, nsapi_addr_t *addr, uint16_t *port);
489 
490  /** Send data over a TCP socket
491  *
492  * The socket must be connected to a remote host. Returns the number of
493  * bytes sent from the buffer.
494  *
495  * This call is non-blocking. If send would block,
496  * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
497  *
498  * @param stack Stack handle
499  * @param socket Socket handle
500  * @param data Buffer of data to send to the host
501  * @param size Size of the buffer in bytes
502  * @return Number of sent bytes on success, negative error
503  * code on failure
504  */
505  nsapi_size_or_error_t (*socket_send)(nsapi_stack_t *stack, nsapi_socket_t socket,
506  const void *data, nsapi_size_t size);
507 
508  /** Receive data over a TCP socket
509  *
510  * The socket must be connected to a remote host. Returns the number of
511  * bytes received into the buffer.
512  *
513  * This call is non-blocking. If recv would block,
514  * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
515  *
516  * @param stack Stack handle
517  * @param socket Socket handle
518  * @param data Destination buffer for data received from the host
519  * @param size Size of the buffer in bytes
520  * @return Number of received bytes on success, negative error
521  * code on failure
522  */
523  nsapi_size_or_error_t (*socket_recv)(nsapi_stack_t *stack, nsapi_socket_t socket,
524  void *data, nsapi_size_t size);
525 
526  /** Send a packet over a UDP socket
527  *
528  * Sends data to the specified address. Returns the number of bytes
529  * sent from the buffer.
530  *
531  * This call is non-blocking. If sendto would block,
532  * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
533  *
534  * @param stack Stack handle
535  * @param socket Socket handle
536  * @param addr The address of the remote host
537  * @param port The port of the remote host
538  * @param data Buffer of data to send to the host
539  * @param size Size of the buffer in bytes
540  * @return Number of sent bytes on success, negative error
541  * code on failure
542  */
543  nsapi_size_or_error_t (*socket_sendto)(nsapi_stack_t *stack, nsapi_socket_t socket,
544  nsapi_addr_t addr, uint16_t port, const void *data, nsapi_size_t size);
545 
546  /** Receive a packet over a UDP socket
547  *
548  * Receives data and stores the source address in address if address
549  * is not NULL. Returns the number of bytes received into the buffer.
550  *
551  * This call is non-blocking. If recvfrom would block,
552  * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
553  *
554  * @param stack Stack handle
555  * @param socket Socket handle
556  * @param addr Destination for the address of the remote host
557  * @param port Destination for the port of the remote host
558  * @param data Destination buffer for data received from the host
559  * @param size Size of the buffer in bytes
560  * @return Number of received bytes on success, negative error
561  * code on failure
562  */
563  nsapi_size_or_error_t (*socket_recvfrom)(nsapi_stack_t *stack, nsapi_socket_t socket,
564  nsapi_addr_t *addr, uint16_t *port, void *buffer, nsapi_size_t size);
565 
566  /** Register a callback on state change of the socket
567  *
568  * The specified callback will be called on state changes such as when
569  * the socket can recv/send/accept successfully and on when an error
570  * occurs. The callback may also be called spuriously without reason.
571  *
572  * The callback may be called in an interrupt context and should not
573  * perform expensive operations such as recv/send calls.
574  *
575  * @param stack Stack handle
576  * @param socket Socket handle
577  * @param callback Function to call on state change
578  * @param data Argument to pass to callback
579  */
580  void (*socket_attach)(nsapi_stack_t *stack, nsapi_socket_t socket,
581  void (*callback)(void *), void *data);
582 
583  /** Set stack-specific socket options
584  *
585  * The setsockopt allow an application to pass stack-specific hints
586  * to the underlying stack. For unsupported options,
587  * NSAPI_ERROR_UNSUPPORTED is returned and the socket is unmodified.
588  *
589  * @param stack Stack handle
590  * @param socket Socket handle
591  * @param level Stack-specific protocol level
592  * @param optname Stack-specific option identifier
593  * @param optval Option value
594  * @param optlen Length of the option value
595  * @return 0 on success, negative error code on failure
596  */
597  nsapi_error_t (*setsockopt)(nsapi_stack_t *stack, nsapi_socket_t socket, int level,
598  int optname, const void *optval, unsigned optlen);
599 
600  /** Get stack-specific socket options
601  *
602  * The getstackopt allow an application to retrieve stack-specific hints
603  * from the underlying stack. For unsupported options,
604  * NSAPI_ERROR_UNSUPPORTED is returned and optval is unmodified.
605  *
606  * @param stack Stack handle
607  * @param socket Socket handle
608  * @param level Stack-specific protocol level
609  * @param optname Stack-specific option identifier
610  * @param optval Destination for option value
611  * @param optlen Length of the option value
612  * @return 0 on success, negative error code on failure
613  */
614  nsapi_error_t (*getsockopt)(nsapi_stack_t *stack, nsapi_socket_t socket, int level,
615  int optname, void *optval, unsigned *optlen);
617 
618 
619 #ifdef __cplusplus
620 }
621 #endif
622 
623 #endif
624 
625 /** @}*/
nsapi_stack structure
Definition: nsapi_types.h:304
nsapi_stack_option
Enum of standardized stack option names for level NSAPI_STACK of NetworkStack::setstackopt and getsta...
Definition: nsapi_types.h:237
const struct nsapi_stack_api * stack_api
Network stack operation table.
Definition: nsapi_types.h:311
void * nsapi_socket_t
Opaque handle for network sockets.
Definition: nsapi_types.h:205
void * stack
Opaque handle for network stacks.
Definition: nsapi_types.h:315
nsapi_security
Enum of encryption types.
Definition: nsapi_types.h:120
nsapi_stack_api structure
Definition: nsapi_types.h:336
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:95
struct nsapi_stack_api nsapi_stack_api_t
nsapi_stack_api structure
nsapi_stack_level
Enum of standardized stack option levels for use with NetworkStack::setstackopt and getstackopt...
Definition: nsapi_types.h:225
nsapi_ip_stack
Supported IP protocol versions of IP stack.
Definition: nsapi_types.h:276
signed int nsapi_size_or_error_t
Type used to represent either a size or error passed through sockets.
Definition: nsapi_types.h:106
#define NSAPI_IP_BYTES
Maximum number of bytes for IP address.
Definition: nsapi_types.h:148
nsapi_socket_level
Enum of standardized socket option levels for use with Socket::setsockopt and getsockopt.
Definition: nsapi_types.h:247
signed int nsapi_value_or_error_t
Type used to represent either a value or error.
Definition: nsapi_types.h:113
struct nsapi_addr nsapi_addr_t
IP address structure for passing IP addresses by value.
nsapi_wifi_ap structure
Definition: nsapi_types.h:291
nsapi_event
Enum of event types.
Definition: nsapi_types.h:83
struct nsapi_wifi_ap nsapi_wifi_ap_t
nsapi_wifi_ap structure
uint8_t bytes[16]
IP address The raw bytes of the IP address stored in big-endian format.
Definition: nsapi_types.h:199
Callback< R(ArgTs...)> callback(R(*func)(ArgTs...)=0)
Create a callback class with type inferred from the arguments.
Definition: Callback.h:709
nsapi_version_t version
IP version.
Definition: nsapi_types.h:194
nsapi_connection_status
Enum of connection status types.
Definition: nsapi_types.h:68
unsigned int nsapi_size_t
Type used to represent the size of data passed through sockets.
Definition: nsapi_types.h:99
IP address structure for passing IP addresses by value.
Definition: nsapi_types.h:188
enum nsapi_security nsapi_security_t
Enum of encryption types.
struct nsapi_ip_mreq nsapi_ip_mreq_t
nsapi_ip_mreq structure
nsapi_error
Enum of standardized error codes.
Definition: nsapi_types.h:37
struct nsapi_stack nsapi_stack_t
nsapi_stack structure
nsapi_ip_mreq structure
Definition: nsapi_types.h:323
nsapi_protocol
Enum of socket protocols.
Definition: nsapi_types.h:215
nsapi_socket_option
Enum of standardized socket option names for level NSAPI_SOCKET of Socket::setsockopt and getsockopt...
Definition: nsapi_types.h:259
nsapi_version
Enum of IP address versions.
Definition: nsapi_types.h:180
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.