init
Embed:
(wiki syntax)
Show/hide line numbers
nsapi_types.h
00001 00002 /** \addtogroup netsocket */ 00003 /** @{*/ 00004 /* nsapi.h - The network socket API 00005 * Copyright (c) 2015 ARM Limited 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 */ 00019 00020 #ifndef NSAPI_TYPES_H 00021 #define NSAPI_TYPES_H 00022 00023 #include <stdint.h> 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 00030 /** Enum of standardized error codes 00031 * 00032 * Valid error codes have negative values and may 00033 * be returned by any network operation. 00034 * 00035 * @enum nsapi_error 00036 */ 00037 enum nsapi_error { 00038 NSAPI_ERROR_OK = 0, /*!< no error */ 00039 NSAPI_ERROR_WOULD_BLOCK = -3001, /*!< no data is not available but call is non-blocking */ 00040 NSAPI_ERROR_UNSUPPORTED = -3002, /*!< unsupported functionality */ 00041 NSAPI_ERROR_PARAMETER = -3003, /*!< invalid configuration */ 00042 NSAPI_ERROR_NO_CONNECTION = -3004, /*!< not connected to a network */ 00043 NSAPI_ERROR_NO_SOCKET = -3005, /*!< socket not available for use */ 00044 NSAPI_ERROR_NO_ADDRESS = -3006, /*!< IP address is not known */ 00045 NSAPI_ERROR_NO_MEMORY = -3007, /*!< memory resource not available */ 00046 NSAPI_ERROR_NO_SSID = -3008, /*!< ssid not found */ 00047 NSAPI_ERROR_DNS_FAILURE = -3009, /*!< DNS failed to complete successfully */ 00048 NSAPI_ERROR_DHCP_FAILURE = -3010, /*!< DHCP failed to complete successfully */ 00049 NSAPI_ERROR_AUTH_FAILURE = -3011, /*!< connection to access point failed */ 00050 NSAPI_ERROR_DEVICE_ERROR = -3012, /*!< failure interfacing with the network processor */ 00051 NSAPI_ERROR_IN_PROGRESS = -3013, /*!< operation (eg connect) in progress */ 00052 NSAPI_ERROR_ALREADY = -3014, /*!< operation (eg connect) already in progress */ 00053 NSAPI_ERROR_IS_CONNECTED = -3015, /*!< socket is already connected */ 00054 NSAPI_ERROR_CONNECTION_LOST = -3016, /*!< connection lost */ 00055 NSAPI_ERROR_CONNECTION_TIMEOUT = -3017, /*!< connection timed out */ 00056 NSAPI_ERROR_ADDRESS_IN_USE = -3018, /*!< Address already in use */ 00057 }; 00058 00059 00060 /** Enum of connection status types 00061 * 00062 * Valid error codes have negative values. 00063 * 00064 * @enum nsapi_connection_status 00065 */ 00066 typedef enum nsapi_connection_status { 00067 NSAPI_STATUS_LOCAL_UP = 0, /*!< local IP address set */ 00068 NSAPI_STATUS_GLOBAL_UP = 1, /*!< global IP address set */ 00069 NSAPI_STATUS_DISCONNECTED = 2, /*!< no connection to network */ 00070 NSAPI_STATUS_CONNECTING = 3, /*!< connecting to network */ 00071 NSAPI_STATUS_ERROR_UNSUPPORTED = NSAPI_ERROR_UNSUPPORTED 00072 } nsapi_connection_status_t; 00073 00074 00075 /** Enum of event types 00076 * 00077 * Event callbacks are accompanied with an event-dependent parameter passed as an intptr_t. 00078 * 00079 * @enum nsapi_event 00080 */ 00081 typedef enum nsapi_event { 00082 NSAPI_EVENT_CONNECTION_STATUS_CHANGE = 0 /*!< network connection status has changed, the parameter = new status (nsapi_connection_status_t) */ 00083 } nsapi_event_t; 00084 00085 00086 /** Type used to represent error codes 00087 * 00088 * This is a separate type from enum nsapi_error to avoid breaking 00089 * compatibility in type-sensitive overloads 00090 */ 00091 typedef signed int nsapi_error_t; 00092 00093 /** Type used to represent the size of data passed through sockets 00094 */ 00095 typedef unsigned int nsapi_size_t; 00096 00097 /** Type used to represent either a size or error pased through sockets 00098 * 00099 * A valid nsapi_size_or_error_t is either a non-negative size or a 00100 * negative error code from the nsapi_error_t 00101 */ 00102 typedef signed int nsapi_size_or_error_t; 00103 00104 /** Enum of encryption types 00105 * 00106 * The security type specifies a particular security to use when 00107 * connected to a WiFi network 00108 */ 00109 typedef enum nsapi_security { 00110 NSAPI_SECURITY_NONE = 0x0, /*!< open access point */ 00111 NSAPI_SECURITY_WEP = 0x1, /*!< phrase conforms to WEP */ 00112 NSAPI_SECURITY_WPA = 0x2, /*!< phrase conforms to WPA */ 00113 NSAPI_SECURITY_WPA2 = 0x3, /*!< phrase conforms to WPA2 */ 00114 NSAPI_SECURITY_WPA_WPA2 = 0x4, /*!< phrase conforms to WPA/WPA2 */ 00115 NSAPI_SECURITY_PAP = 0x5, /*!< phrase conforms to PPP authentication context */ 00116 NSAPI_SECURITY_CHAP = 0x6, /*!< phrase conforms to PPP authentication context */ 00117 NSAPI_SECURITY_UNKNOWN = 0xFF, /*!< unknown/unsupported security in scan results */ 00118 } nsapi_security_t; 00119 00120 /** Maximum size of IP address representation 00121 */ 00122 #define NSAPI_IP_SIZE NSAPI_IPv6_SIZE 00123 00124 /** Maximum number of bytes for IP address 00125 */ 00126 #define NSAPI_IP_BYTES NSAPI_IPv6_BYTES 00127 00128 /** Maximum size of MAC address representation 00129 */ 00130 #define NSAPI_MAC_SIZE 18 00131 00132 /** Maximum number of bytes for MAC address 00133 */ 00134 #define NSAPI_MAC_BYTES 6 00135 00136 /** Size of IPv4 representation 00137 */ 00138 #define NSAPI_IPv4_SIZE 16 00139 00140 /** Number of bytes in IPv4 address 00141 */ 00142 #define NSAPI_IPv4_BYTES 4 00143 00144 /** Size of IPv6 representation 00145 */ 00146 #define NSAPI_IPv6_SIZE 40 00147 00148 /** Number of bytes in IPv6 address 00149 */ 00150 #define NSAPI_IPv6_BYTES 16 00151 00152 /** Enum of IP address versions 00153 * 00154 * The IP version specifies the type of an IP address. 00155 * 00156 * @enum nsapi_version 00157 */ 00158 typedef enum nsapi_version { 00159 NSAPI_UNSPEC , /*!< Address is unspecified */ 00160 NSAPI_IPv4 , /*!< Address is IPv4 */ 00161 NSAPI_IPv6 , /*!< Address is IPv6 */ 00162 } nsapi_version_t; 00163 00164 /** IP address structure for passing IP addresses by value 00165 */ 00166 typedef struct nsapi_addr { 00167 /** IP version 00168 * - NSAPI_IPv4 00169 * - NSAPI_IPv6 00170 * - NSAPI_UNSPEC 00171 */ 00172 nsapi_version_t version; 00173 00174 /** IP address 00175 * The raw bytes of the IP address stored in big-endian format 00176 */ 00177 uint8_t bytes[NSAPI_IP_BYTES]; 00178 } nsapi_addr_t; 00179 00180 00181 /** Opaque handle for network sockets 00182 */ 00183 typedef void *nsapi_socket_t; 00184 00185 00186 /** Enum of socket protocols 00187 * 00188 * The socket protocol specifies a particular protocol to 00189 * be used with a newly created socket. 00190 * 00191 * @enum nsapi_protocol 00192 */ 00193 typedef enum nsapi_protocol { 00194 NSAPI_TCP , /*!< Socket is of TCP type */ 00195 NSAPI_UDP , /*!< Socket is of UDP type */ 00196 } nsapi_protocol_t; 00197 00198 /** Enum of standardized stack option levels 00199 * for use with NetworkStack::setstackopt and getstackopt. 00200 * 00201 * @enum nsapi_stack_level 00202 */ 00203 typedef enum nsapi_stack_level { 00204 NSAPI_STACK = 5000, /*!< Stack option level - see nsapi_stack_option_t for options */ 00205 } nsapi_stack_level_t; 00206 00207 /** Enum of standardized stack option names for level NSAPI_STACK 00208 * of NetworkStack::setstackopt and getstackopt. 00209 * 00210 * These options may not be supported on all stacks, in which 00211 * case NSAPI_ERROR_UNSUPPORTED may be returned. 00212 * 00213 * @enum nsapi_stack_option 00214 */ 00215 typedef enum nsapi_stack_option { 00216 NSAPI_IPV4_MRU , /*!< Sets/gets size of largest IPv4 fragmented datagram to reassemble */ 00217 NSAPI_IPV6_MRU , /*!< Sets/gets size of largest IPv6 fragmented datagram to reassemble */ 00218 } nsapi_stack_option_t; 00219 00220 /** Enum of standardized socket option levels 00221 * for use with Socket::setsockopt and getsockopt. 00222 * 00223 * @enum nsapi_socket_level 00224 */ 00225 typedef enum nsapi_socket_level { 00226 NSAPI_SOCKET = 7000, /*!< Socket option level - see nsapi_socket_option_t for options */ 00227 } nsapi_socket_level_t; 00228 00229 /** Enum of standardized socket option names for level NSAPI_SOCKET 00230 * of Socket::setsockopt and getsockopt. 00231 * 00232 * These options may not be supported on all stacks, in which 00233 * case NSAPI_ERROR_UNSUPPORTED may be returned. 00234 * 00235 * @enum nsapi_socket_option 00236 */ 00237 typedef enum nsapi_socket_option { 00238 NSAPI_REUSEADDR , /*!< Allow bind to reuse local addresses */ 00239 NSAPI_KEEPALIVE , /*!< Enables sending of keepalive messages */ 00240 NSAPI_KEEPIDLE , /*!< Sets timeout value to initiate keepalive */ 00241 NSAPI_KEEPINTVL , /*!< Sets timeout value for keepalive */ 00242 NSAPI_LINGER , /*!< Keeps close from returning until queues empty */ 00243 NSAPI_SNDBUF , /*!< Sets send buffer size */ 00244 NSAPI_RCVBUF , /*!< Sets recv buffer size */ 00245 NSAPI_ADD_MEMBERSHIP , /*!< Add membership to multicast address */ 00246 NSAPI_DROP_MEMBERSHIP , /*!< Drop membership to multicast address */ 00247 } nsapi_socket_option_t; 00248 00249 /** Supported IP protocol versions of IP stack 00250 * 00251 * @enum nsapi_ip_stack 00252 */ 00253 typedef enum nsapi_ip_stack { 00254 DEFAULT_STACK = 0, 00255 IPV4_STACK, 00256 IPV6_STACK, 00257 IPV4V6_STACK 00258 } nsapi_ip_stack_t; 00259 00260 /* Backwards compatibility - previously didn't distinguish stack and socket options */ 00261 typedef nsapi_socket_level_t nsapi_level_t; 00262 typedef nsapi_socket_option_t nsapi_option_t; 00263 00264 /** nsapi_wifi_ap structure 00265 * 00266 * Structure representing a WiFi Access Point 00267 */ 00268 typedef struct nsapi_wifi_ap { 00269 char ssid[33]; /* 32 is what 802.11 defines as longest possible name; +1 for the \0 */ 00270 uint8_t bssid[6]; 00271 nsapi_security_t security; 00272 int8_t rssi; 00273 uint8_t channel; 00274 } nsapi_wifi_ap_t; 00275 00276 00277 /** nsapi_stack structure 00278 * 00279 * Stack structure representing a specific instance of a stack. 00280 */ 00281 typedef struct nsapi_stack { 00282 /** Network stack operation table 00283 * 00284 * Provides access to the underlying api of the stack. This is not 00285 * flattened into the nsapi_stack to allow allocation in read-only 00286 * memory. 00287 */ 00288 const struct nsapi_stack_api *stack_api; 00289 00290 /** Opaque handle for network stacks 00291 */ 00292 void *stack; 00293 00294 // Internal nsapi buffer 00295 unsigned _stack_buffer[16]; 00296 } nsapi_stack_t; 00297 00298 /** nsapi_ip_mreq structure 00299 */ 00300 typedef struct nsapi_ip_mreq { 00301 nsapi_addr_t imr_multiaddr; /* IP multicast address of group */ 00302 nsapi_addr_t imr_interface; /* local IP address of interface */ 00303 } nsapi_ip_mreq_t; 00304 00305 /** nsapi_stack_api structure 00306 * 00307 * Common api structure for network stack operations. A network stack 00308 * can provide a nsapi_stack_api structure filled out with the 00309 * appropriate implementation. 00310 * 00311 * Unsupported operations can be left as null pointers. 00312 */ 00313 typedef struct nsapi_stack_api 00314 { 00315 /** Get the local IP address 00316 * 00317 * @param stack Stack handle 00318 * @return Local IP Address or null address if not connected 00319 */ 00320 nsapi_addr_t (*get_ip_address)(nsapi_stack_t *stack); 00321 00322 /** Translates a hostname to an IP address 00323 * 00324 * The hostname may be either a domain name or an IP address. If the 00325 * hostname is an IP address, no network transactions will be performed. 00326 * 00327 * If no stack-specific DNS resolution is provided, the hostname 00328 * will be resolve using a UDP socket on the stack. 00329 * 00330 * @param stack Stack handle 00331 * @param addr Destination for the host IP address 00332 * @param host Hostname to resolve 00333 * @param version Address family 00334 * @return 0 on success, negative error code on failure 00335 */ 00336 nsapi_error_t (*gethostbyname)(nsapi_stack_t *stack, const char *host, nsapi_addr_t *addr, nsapi_version_t version); 00337 00338 /** Add a domain name server to list of servers to query 00339 * 00340 * @param addr Destination for the host address 00341 * @return 0 on success, negative error code on failure 00342 */ 00343 nsapi_error_t (*add_dns_server)(nsapi_stack_t *stack, nsapi_addr_t addr); 00344 00345 /* Set stack-specific stack options 00346 * 00347 * The setstackopt allow an application to pass stack-specific hints 00348 * to the underlying stack. For unsupported options, 00349 * NSAPI_ERROR_UNSUPPORTED is returned and the stack is unmodified. 00350 * 00351 * @param stack Stack handle 00352 * @param level Stack-specific protocol level 00353 * @param optname Stack-specific option identifier 00354 * @param optval Option value 00355 * @param optlen Length of the option value 00356 * @return 0 on success, negative error code on failure 00357 */ 00358 nsapi_error_t (*setstackopt)(nsapi_stack_t *stack, int level, 00359 int optname, const void *optval, unsigned optlen); 00360 00361 /* Get stack-specific stack options 00362 * 00363 * The getstackopt allow an application to retrieve stack-specific hints 00364 * from the underlying stack. For unsupported options, 00365 * NSAPI_ERROR_UNSUPPORTED is returned and optval is unmodified. 00366 * 00367 * @param stack Stack handle 00368 * @param level Stack-specific protocol level 00369 * @param optname Stack-specific option identifier 00370 * @param optval Destination for option value 00371 * @param optlen Length of the option value 00372 * @return 0 on success, negative error code on failure 00373 */ 00374 nsapi_error_t (*getstackopt)(nsapi_stack_t *stack, int level, 00375 int optname, void *optval, unsigned *optlen); 00376 00377 /** Opens a socket 00378 * 00379 * Creates a network socket and stores it in the specified handle. 00380 * The handle must be passed to following calls on the socket. 00381 * 00382 * A stack may have a finite number of sockets, in this case 00383 * NSAPI_ERROR_NO_SOCKET is returned if no socket is available. 00384 * 00385 * @param stack Stack context 00386 * @param socket Destination for the handle to a newly created socket 00387 * @param proto Protocol of socket to open, NSAPI_TCP or NSAPI_UDP 00388 * @return 0 on success, negative error code on failure 00389 */ 00390 nsapi_error_t (*socket_open)(nsapi_stack_t *stack, nsapi_socket_t *socket, 00391 nsapi_protocol_t proto); 00392 00393 /** Close the socket 00394 * 00395 * Closes any open connection and deallocates any memory associated 00396 * with the socket. 00397 * 00398 * @param stack Stack handle 00399 * @param socket Socket handle 00400 * @return 0 on success, negative error code on failure 00401 */ 00402 nsapi_error_t (*socket_close)(nsapi_stack_t *stack, nsapi_socket_t socket); 00403 00404 /** Bind a specific address to a socket 00405 * 00406 * Binding a socket specifies the address and port on which to recieve 00407 * data. If the IP address is zeroed, only the port is bound. 00408 * 00409 * @param stack Stack handle 00410 * @param socket Socket handle 00411 * @param addr Local address to bind, may be null 00412 * @param port Local port to bind 00413 * @return 0 on success, negative error code on failure. 00414 */ 00415 nsapi_error_t (*socket_bind)(nsapi_stack_t *stack, nsapi_socket_t socket, 00416 nsapi_addr_t addr, uint16_t port); 00417 00418 /** Listen for connections on a TCP socket 00419 * 00420 * Marks the socket as a passive socket that can be used to accept 00421 * incoming connections. 00422 * 00423 * @param stack Stack handle 00424 * @param socket Socket handle 00425 * @param backlog Number of pending connections that can be queued 00426 * simultaneously 00427 * @return 0 on success, negative error code on failure 00428 */ 00429 nsapi_error_t (*socket_listen)(nsapi_stack_t *stack, nsapi_socket_t socket, int backlog); 00430 00431 /** Connects TCP socket to a remote host 00432 * 00433 * Initiates a connection to a remote server specified by the 00434 * indicated address. 00435 * 00436 * @param stack Stack handle 00437 * @param socket Socket handle 00438 * @param addr The address of the remote host 00439 * @param port The port of the remote host 00440 * @return 0 on success, negative error code on failure 00441 */ 00442 nsapi_error_t (*socket_connect)(nsapi_stack_t *stack, nsapi_socket_t socket, 00443 nsapi_addr_t addr, uint16_t port); 00444 00445 /** Accepts a connection on a TCP socket 00446 * 00447 * The server socket must be bound and set to listen for connections. 00448 * On a new connection, creates a network socket and stores it in the 00449 * specified handle. The handle must be passed to following calls on 00450 * the socket. 00451 * 00452 * A stack may have a finite number of sockets, in this case 00453 * NSAPI_ERROR_NO_SOCKET is returned if no socket is available. 00454 * 00455 * This call is non-blocking. If accept would block, 00456 * NSAPI_ERROR_WOULD_BLOCK is returned immediately. 00457 * 00458 * @param stack Stack handle 00459 * @param server Socket handle to server to accept from 00460 * @param socket Destination for a handle to the newly created socket 00461 * @param addr Destination for the address of the remote host 00462 * @param port Destination for the port of the remote host 00463 * @return 0 on success, negative error code on failure 00464 */ 00465 nsapi_error_t (*socket_accept)(nsapi_stack_t *stack, nsapi_socket_t server, 00466 nsapi_socket_t *socket, nsapi_addr_t *addr, uint16_t *port); 00467 00468 /** Send data over a TCP socket 00469 * 00470 * The socket must be connected to a remote host. Returns the number of 00471 * bytes sent from the buffer. 00472 * 00473 * This call is non-blocking. If send would block, 00474 * NSAPI_ERROR_WOULD_BLOCK is returned immediately. 00475 * 00476 * @param stack Stack handle 00477 * @param socket Socket handle 00478 * @param data Buffer of data to send to the host 00479 * @param size Size of the buffer in bytes 00480 * @return Number of sent bytes on success, negative error 00481 * code on failure 00482 */ 00483 nsapi_size_or_error_t (*socket_send)(nsapi_stack_t *stack, nsapi_socket_t socket, 00484 const void *data, nsapi_size_t size); 00485 00486 /** Receive data over a TCP socket 00487 * 00488 * The socket must be connected to a remote host. Returns the number of 00489 * bytes received into the buffer. 00490 * 00491 * This call is non-blocking. If recv would block, 00492 * NSAPI_ERROR_WOULD_BLOCK is returned immediately. 00493 * 00494 * @param stack Stack handle 00495 * @param socket Socket handle 00496 * @param data Destination buffer for data received from the host 00497 * @param size Size of the buffer in bytes 00498 * @return Number of received bytes on success, negative error 00499 * code on failure 00500 */ 00501 nsapi_size_or_error_t (*socket_recv)(nsapi_stack_t *stack, nsapi_socket_t socket, 00502 void *data, nsapi_size_t size); 00503 00504 /** Send a packet over a UDP socket 00505 * 00506 * Sends data to the specified address. Returns the number of bytes 00507 * sent from the buffer. 00508 * 00509 * This call is non-blocking. If sendto would block, 00510 * NSAPI_ERROR_WOULD_BLOCK is returned immediately. 00511 * 00512 * @param stack Stack handle 00513 * @param socket Socket handle 00514 * @param addr The address of the remote host 00515 * @param port The port of the remote host 00516 * @param data Buffer of data to send to the host 00517 * @param size Size of the buffer in bytes 00518 * @return Number of sent bytes on success, negative error 00519 * code on failure 00520 */ 00521 nsapi_size_or_error_t (*socket_sendto)(nsapi_stack_t *stack, nsapi_socket_t socket, 00522 nsapi_addr_t addr, uint16_t port, const void *data, nsapi_size_t size); 00523 00524 /** Receive a packet over a UDP socket 00525 * 00526 * Receives data and stores the source address in address if address 00527 * is not NULL. Returns the number of bytes received into the buffer. 00528 * 00529 * This call is non-blocking. If recvfrom would block, 00530 * NSAPI_ERROR_WOULD_BLOCK is returned immediately. 00531 * 00532 * @param stack Stack handle 00533 * @param socket Socket handle 00534 * @param addr Destination for the address of the remote host 00535 * @param port Destination for the port of the remote host 00536 * @param data Destination buffer for data received from the host 00537 * @param size Size of the buffer in bytes 00538 * @return Number of received bytes on success, negative error 00539 * code on failure 00540 */ 00541 nsapi_size_or_error_t (*socket_recvfrom)(nsapi_stack_t *stack, nsapi_socket_t socket, 00542 nsapi_addr_t *addr, uint16_t *port, void *buffer, nsapi_size_t size); 00543 00544 /** Register a callback on state change of the socket 00545 * 00546 * The specified callback will be called on state changes such as when 00547 * the socket can recv/send/accept successfully and on when an error 00548 * occurs. The callback may also be called spuriously without reason. 00549 * 00550 * The callback may be called in an interrupt context and should not 00551 * perform expensive operations such as recv/send calls. 00552 * 00553 * @param stack Stack handle 00554 * @param socket Socket handle 00555 * @param callback Function to call on state change 00556 * @param data Argument to pass to callback 00557 */ 00558 void (*socket_attach)(nsapi_stack_t *stack, nsapi_socket_t socket, 00559 void (*callback)(void *), void *data); 00560 00561 /* Set stack-specific socket options 00562 * 00563 * The setsockopt allow an application to pass stack-specific hints 00564 * to the underlying stack. For unsupported options, 00565 * NSAPI_ERROR_UNSUPPORTED is returned and the socket is unmodified. 00566 * 00567 * @param stack Stack handle 00568 * @param socket Socket handle 00569 * @param level Stack-specific protocol level 00570 * @param optname Stack-specific option identifier 00571 * @param optval Option value 00572 * @param optlen Length of the option value 00573 * @return 0 on success, negative error code on failure 00574 */ 00575 nsapi_error_t (*setsockopt)(nsapi_stack_t *stack, nsapi_socket_t socket, int level, 00576 int optname, const void *optval, unsigned optlen); 00577 00578 /* Get stack-specific socket options 00579 * 00580 * The getstackopt allow an application to retrieve stack-specific hints 00581 * from the underlying stack. For unsupported options, 00582 * NSAPI_ERROR_UNSUPPORTED is returned and optval is unmodified. 00583 * 00584 * @param stack Stack handle 00585 * @param socket Socket handle 00586 * @param level Stack-specific protocol level 00587 * @param optname Stack-specific option identifier 00588 * @param optval Destination for option value 00589 * @param optlen Length of the option value 00590 * @return 0 on success, negative error code on failure 00591 */ 00592 nsapi_error_t (*getsockopt)(nsapi_stack_t *stack, nsapi_socket_t socket, int level, 00593 int optname, void *optval, unsigned *optlen); 00594 } nsapi_stack_api_t; 00595 00596 00597 #ifdef __cplusplus 00598 } 00599 #endif 00600 00601 #endif 00602 00603 /** @}*/
Generated on Tue Jul 12 2022 13:25:01 by
1.7.2