Mbed library for ENC28J60 Ethernet modules. Full support for TCP/IP and UDP Server, Client and HTTP server (webserver). DHCP and DNS is included.

Dependents:   mBuino_ENC28_MQTT Nucleo_Web_ENC28J60 Nucleo_Web_ENC28J60_ADC Serial_over_Ethernet ... more

Library for ENC28J60 Ethernet modules.

/media/uploads/hudakz/enc28j60_module01.jpg

Ported to mbed from Norbert Truchsess's UIPEthernet library for Arduino. Thank you Norbert!

  • Full support for persistent (streaming) TCP/IP and UDP connections Client and Server each, ARP, ICMP, DHCP and DNS.
  • Works with both Mbed OS 2 and Mbed OS 5.

Usage:

  • Import the library into your project.
  • Add #include "UipEthernet.h" to main.cpp
  • Create one instance of the UipEthernet class initialized with the MAC address you'd like to use and SPI pins of the connected Mbed board.

Example programs:

Import programWebSwitch_ENC28J60

HTTP Server serving a simple webpage which enables to remotely turn a digital output on/off. Compile, download, run and type 'IP_address/secret/' (don't forget the last '/') into your web browser and hit ENTER.

Import programHTTPServer_Echo_ENC28J60

A simple HTTP server echoing received requests. Ethernet connection is over an ENC28J60 board. Usage: Type the server's IP address into you web browser and hit <ENTER>.

Import programTcpServer_ENC28J60

Simple TCP/IP Server using the UIPEthernet library for ENC28J60 Ethernet boards.

Import programTcpClient_ENC28J60

Simple TCP/IP Client using the UIPEthernet library for ENC28J60 Ethernet boards.

Import programUdpServer_ENC28J60

Simple UDP Server using the UIPEthernet library for ENC28J60 Ethernet boards.

Import programUdpClient_ENC28J60

Simple UDP Client using the UIPEthernet library for ENC28J60 Ethernet boards.

Import programMQTT_Hello_ENC28J60

MQTT Client example program. Ethernet connection is via an ENC28J60 module.

Committer:
hudakz
Date:
Sat Sep 07 17:42:42 2019 +0000
Revision:
15:53715cc81c63
Parent:
14:7648334eb41b
Timeout parameter added for the 'connect' function, SPI speed reduced from 20 to 10 Mb/s, debug messages fixed ...

Who changed what in which revision?

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