mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Committer:
be_bryan
Date:
Mon Dec 11 17:54:04 2017 +0000
Revision:
0:b74591d5ab33
motor ++

Who changed what in which revision?

UserRevisionLine numberNew contents of line
be_bryan 0:b74591d5ab33 1
be_bryan 0:b74591d5ab33 2 /* NetworkStack
be_bryan 0:b74591d5ab33 3 * Copyright (c) 2015 ARM Limited
be_bryan 0:b74591d5ab33 4 *
be_bryan 0:b74591d5ab33 5 * Licensed under the Apache License, Version 2.0 (the "License");
be_bryan 0:b74591d5ab33 6 * you may not use this file except in compliance with the License.
be_bryan 0:b74591d5ab33 7 * You may obtain a copy of the License at
be_bryan 0:b74591d5ab33 8 *
be_bryan 0:b74591d5ab33 9 * http://www.apache.org/licenses/LICENSE-2.0
be_bryan 0:b74591d5ab33 10 *
be_bryan 0:b74591d5ab33 11 * Unless required by applicable law or agreed to in writing, software
be_bryan 0:b74591d5ab33 12 * distributed under the License is distributed on an "AS IS" BASIS,
be_bryan 0:b74591d5ab33 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
be_bryan 0:b74591d5ab33 14 * See the License for the specific language governing permissions and
be_bryan 0:b74591d5ab33 15 * limitations under the License.
be_bryan 0:b74591d5ab33 16 */
be_bryan 0:b74591d5ab33 17
be_bryan 0:b74591d5ab33 18 #ifndef NETWORK_STACK_H
be_bryan 0:b74591d5ab33 19 #define NETWORK_STACK_H
be_bryan 0:b74591d5ab33 20
be_bryan 0:b74591d5ab33 21 #include "nsapi_types.h"
be_bryan 0:b74591d5ab33 22 #include "netsocket/SocketAddress.h"
be_bryan 0:b74591d5ab33 23 #include "netsocket/NetworkInterface.h"
be_bryan 0:b74591d5ab33 24
be_bryan 0:b74591d5ab33 25
be_bryan 0:b74591d5ab33 26 /** NetworkStack class
be_bryan 0:b74591d5ab33 27 *
be_bryan 0:b74591d5ab33 28 * Common interface that is shared between hardware that
be_bryan 0:b74591d5ab33 29 * can connect to a network over IP. By implementing the
be_bryan 0:b74591d5ab33 30 * NetworkStack, a network stack can be used as a target
be_bryan 0:b74591d5ab33 31 * for instantiating network sockets.
be_bryan 0:b74591d5ab33 32 * @addtogroup netsocket
be_bryan 0:b74591d5ab33 33 */
be_bryan 0:b74591d5ab33 34 class NetworkStack
be_bryan 0:b74591d5ab33 35 {
be_bryan 0:b74591d5ab33 36 public:
be_bryan 0:b74591d5ab33 37 virtual ~NetworkStack() {};
be_bryan 0:b74591d5ab33 38
be_bryan 0:b74591d5ab33 39 /** Get the local IP address
be_bryan 0:b74591d5ab33 40 *
be_bryan 0:b74591d5ab33 41 * @return Null-terminated representation of the local IP address
be_bryan 0:b74591d5ab33 42 * or null if not yet connected
be_bryan 0:b74591d5ab33 43 */
be_bryan 0:b74591d5ab33 44 virtual const char *get_ip_address() = 0;
be_bryan 0:b74591d5ab33 45
be_bryan 0:b74591d5ab33 46 /** Translates a hostname to an IP address with specific version
be_bryan 0:b74591d5ab33 47 *
be_bryan 0:b74591d5ab33 48 * The hostname may be either a domain name or an IP address. If the
be_bryan 0:b74591d5ab33 49 * hostname is an IP address, no network transactions will be performed.
be_bryan 0:b74591d5ab33 50 *
be_bryan 0:b74591d5ab33 51 * If no stack-specific DNS resolution is provided, the hostname
be_bryan 0:b74591d5ab33 52 * will be resolve using a UDP socket on the stack.
be_bryan 0:b74591d5ab33 53 *
be_bryan 0:b74591d5ab33 54 * @param host Hostname to resolve
be_bryan 0:b74591d5ab33 55 * @param address Destination for the host SocketAddress
be_bryan 0:b74591d5ab33 56 * @param version IP version of address to resolve, NSAPI_UNSPEC indicates
be_bryan 0:b74591d5ab33 57 * version is chosen by the stack (defaults to NSAPI_UNSPEC)
be_bryan 0:b74591d5ab33 58 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 59 */
be_bryan 0:b74591d5ab33 60 virtual nsapi_error_t gethostbyname(const char *host,
be_bryan 0:b74591d5ab33 61 SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC);
be_bryan 0:b74591d5ab33 62
be_bryan 0:b74591d5ab33 63 /** Add a domain name server to list of servers to query
be_bryan 0:b74591d5ab33 64 *
be_bryan 0:b74591d5ab33 65 * @param address Destination for the host address
be_bryan 0:b74591d5ab33 66 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 67 */
be_bryan 0:b74591d5ab33 68 virtual nsapi_error_t add_dns_server(const SocketAddress &address);
be_bryan 0:b74591d5ab33 69
be_bryan 0:b74591d5ab33 70 /* Set stack options
be_bryan 0:b74591d5ab33 71 *
be_bryan 0:b74591d5ab33 72 * setstackopt allows an application to pass stack-specific options
be_bryan 0:b74591d5ab33 73 * to the underlying stack using stack-specific level and option names,
be_bryan 0:b74591d5ab33 74 * or to request generic options using levels from nsapi_stack_level_t.
be_bryan 0:b74591d5ab33 75 *
be_bryan 0:b74591d5ab33 76 * For unsupported options, NSAPI_ERROR_UNSUPPORTED is returned
be_bryan 0:b74591d5ab33 77 * and the stack is unmodified.
be_bryan 0:b74591d5ab33 78 *
be_bryan 0:b74591d5ab33 79 * @param level Stack-specific protocol level or nsapi_stack_level_t
be_bryan 0:b74591d5ab33 80 * @param optname Level-specific option name
be_bryan 0:b74591d5ab33 81 * @param optval Option value
be_bryan 0:b74591d5ab33 82 * @param optlen Length of the option value
be_bryan 0:b74591d5ab33 83 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 84 */
be_bryan 0:b74591d5ab33 85 virtual nsapi_error_t setstackopt(int level, int optname, const void *optval, unsigned optlen);
be_bryan 0:b74591d5ab33 86
be_bryan 0:b74591d5ab33 87 /* Get stack options
be_bryan 0:b74591d5ab33 88 *
be_bryan 0:b74591d5ab33 89 * getstackopt allows an application to retrieve stack-specific options
be_bryan 0:b74591d5ab33 90 * to the underlying stack using stack-specific level and option names,
be_bryan 0:b74591d5ab33 91 * or to request generic options using levels from nsapi_stack_level_t.
be_bryan 0:b74591d5ab33 92 *
be_bryan 0:b74591d5ab33 93 * @param level Stack-specific protocol level or nsapi_stack_level_t
be_bryan 0:b74591d5ab33 94 * @param optname Level-specific option name
be_bryan 0:b74591d5ab33 95 * @param optval Destination for option value
be_bryan 0:b74591d5ab33 96 * @param optlen Length of the option value
be_bryan 0:b74591d5ab33 97 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 98 */
be_bryan 0:b74591d5ab33 99 virtual nsapi_error_t getstackopt(int level, int optname, void *optval, unsigned *optlen);
be_bryan 0:b74591d5ab33 100
be_bryan 0:b74591d5ab33 101 protected:
be_bryan 0:b74591d5ab33 102 friend class Socket;
be_bryan 0:b74591d5ab33 103 friend class UDPSocket;
be_bryan 0:b74591d5ab33 104 friend class TCPSocket;
be_bryan 0:b74591d5ab33 105 friend class TCPServer;
be_bryan 0:b74591d5ab33 106
be_bryan 0:b74591d5ab33 107 /** Opens a socket
be_bryan 0:b74591d5ab33 108 *
be_bryan 0:b74591d5ab33 109 * Creates a network socket and stores it in the specified handle.
be_bryan 0:b74591d5ab33 110 * The handle must be passed to following calls on the socket.
be_bryan 0:b74591d5ab33 111 *
be_bryan 0:b74591d5ab33 112 * A stack may have a finite number of sockets, in this case
be_bryan 0:b74591d5ab33 113 * NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
be_bryan 0:b74591d5ab33 114 *
be_bryan 0:b74591d5ab33 115 * @param handle Destination for the handle to a newly created socket
be_bryan 0:b74591d5ab33 116 * @param proto Protocol of socket to open, NSAPI_TCP or NSAPI_UDP
be_bryan 0:b74591d5ab33 117 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 118 */
be_bryan 0:b74591d5ab33 119 virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto) = 0;
be_bryan 0:b74591d5ab33 120
be_bryan 0:b74591d5ab33 121 /** Close the socket
be_bryan 0:b74591d5ab33 122 *
be_bryan 0:b74591d5ab33 123 * Closes any open connection and deallocates any memory associated
be_bryan 0:b74591d5ab33 124 * with the socket.
be_bryan 0:b74591d5ab33 125 *
be_bryan 0:b74591d5ab33 126 * @param handle Socket handle
be_bryan 0:b74591d5ab33 127 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 128 */
be_bryan 0:b74591d5ab33 129 virtual nsapi_error_t socket_close(nsapi_socket_t handle) = 0;
be_bryan 0:b74591d5ab33 130
be_bryan 0:b74591d5ab33 131 /** Bind a specific address to a socket
be_bryan 0:b74591d5ab33 132 *
be_bryan 0:b74591d5ab33 133 * Binding a socket specifies the address and port on which to recieve
be_bryan 0:b74591d5ab33 134 * data. If the IP address is zeroed, only the port is bound.
be_bryan 0:b74591d5ab33 135 *
be_bryan 0:b74591d5ab33 136 * @param handle Socket handle
be_bryan 0:b74591d5ab33 137 * @param address Local address to bind
be_bryan 0:b74591d5ab33 138 * @return 0 on success, negative error code on failure.
be_bryan 0:b74591d5ab33 139 */
be_bryan 0:b74591d5ab33 140 virtual nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address) = 0;
be_bryan 0:b74591d5ab33 141
be_bryan 0:b74591d5ab33 142 /** Listen for connections on a TCP socket
be_bryan 0:b74591d5ab33 143 *
be_bryan 0:b74591d5ab33 144 * Marks the socket as a passive socket that can be used to accept
be_bryan 0:b74591d5ab33 145 * incoming connections.
be_bryan 0:b74591d5ab33 146 *
be_bryan 0:b74591d5ab33 147 * @param handle Socket handle
be_bryan 0:b74591d5ab33 148 * @param backlog Number of pending connections that can be queued
be_bryan 0:b74591d5ab33 149 * simultaneously
be_bryan 0:b74591d5ab33 150 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 151 */
be_bryan 0:b74591d5ab33 152 virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog) = 0;
be_bryan 0:b74591d5ab33 153
be_bryan 0:b74591d5ab33 154 /** Connects TCP socket to a remote host
be_bryan 0:b74591d5ab33 155 *
be_bryan 0:b74591d5ab33 156 * Initiates a connection to a remote server specified by the
be_bryan 0:b74591d5ab33 157 * indicated address.
be_bryan 0:b74591d5ab33 158 *
be_bryan 0:b74591d5ab33 159 * @param handle Socket handle
be_bryan 0:b74591d5ab33 160 * @param address The SocketAddress of the remote host
be_bryan 0:b74591d5ab33 161 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 162 */
be_bryan 0:b74591d5ab33 163 virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address) = 0;
be_bryan 0:b74591d5ab33 164
be_bryan 0:b74591d5ab33 165 /** Accepts a connection on a TCP socket
be_bryan 0:b74591d5ab33 166 *
be_bryan 0:b74591d5ab33 167 * The server socket must be bound and set to listen for connections.
be_bryan 0:b74591d5ab33 168 * On a new connection, creates a network socket and stores it in the
be_bryan 0:b74591d5ab33 169 * specified handle. The handle must be passed to following calls on
be_bryan 0:b74591d5ab33 170 * the socket.
be_bryan 0:b74591d5ab33 171 *
be_bryan 0:b74591d5ab33 172 * A stack may have a finite number of sockets, in this case
be_bryan 0:b74591d5ab33 173 * NSAPI_ERROR_NO_SOCKET is returned if no socket is available.
be_bryan 0:b74591d5ab33 174 *
be_bryan 0:b74591d5ab33 175 * This call is non-blocking. If accept would block,
be_bryan 0:b74591d5ab33 176 * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
be_bryan 0:b74591d5ab33 177 *
be_bryan 0:b74591d5ab33 178 * @param server Socket handle to server to accept from
be_bryan 0:b74591d5ab33 179 * @param handle Destination for a handle to the newly created socket
be_bryan 0:b74591d5ab33 180 * @param address Destination for the remote address or NULL
be_bryan 0:b74591d5ab33 181 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 182 */
be_bryan 0:b74591d5ab33 183 virtual nsapi_error_t socket_accept(nsapi_socket_t server,
be_bryan 0:b74591d5ab33 184 nsapi_socket_t *handle, SocketAddress *address=0) = 0;
be_bryan 0:b74591d5ab33 185
be_bryan 0:b74591d5ab33 186 /** Send data over a TCP socket
be_bryan 0:b74591d5ab33 187 *
be_bryan 0:b74591d5ab33 188 * The socket must be connected to a remote host. Returns the number of
be_bryan 0:b74591d5ab33 189 * bytes sent from the buffer.
be_bryan 0:b74591d5ab33 190 *
be_bryan 0:b74591d5ab33 191 * This call is non-blocking. If send would block,
be_bryan 0:b74591d5ab33 192 * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
be_bryan 0:b74591d5ab33 193 *
be_bryan 0:b74591d5ab33 194 * @param handle Socket handle
be_bryan 0:b74591d5ab33 195 * @param data Buffer of data to send to the host
be_bryan 0:b74591d5ab33 196 * @param size Size of the buffer in bytes
be_bryan 0:b74591d5ab33 197 * @return Number of sent bytes on success, negative error
be_bryan 0:b74591d5ab33 198 * code on failure
be_bryan 0:b74591d5ab33 199 */
be_bryan 0:b74591d5ab33 200 virtual nsapi_size_or_error_t socket_send(nsapi_socket_t handle,
be_bryan 0:b74591d5ab33 201 const void *data, nsapi_size_t size) = 0;
be_bryan 0:b74591d5ab33 202
be_bryan 0:b74591d5ab33 203 /** Receive data over a TCP socket
be_bryan 0:b74591d5ab33 204 *
be_bryan 0:b74591d5ab33 205 * The socket must be connected to a remote host. Returns the number of
be_bryan 0:b74591d5ab33 206 * bytes received into the buffer.
be_bryan 0:b74591d5ab33 207 *
be_bryan 0:b74591d5ab33 208 * This call is non-blocking. If recv would block,
be_bryan 0:b74591d5ab33 209 * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
be_bryan 0:b74591d5ab33 210 *
be_bryan 0:b74591d5ab33 211 * @param handle Socket handle
be_bryan 0:b74591d5ab33 212 * @param data Destination buffer for data received from the host
be_bryan 0:b74591d5ab33 213 * @param size Size of the buffer in bytes
be_bryan 0:b74591d5ab33 214 * @return Number of received bytes on success, negative error
be_bryan 0:b74591d5ab33 215 * code on failure
be_bryan 0:b74591d5ab33 216 */
be_bryan 0:b74591d5ab33 217 virtual nsapi_size_or_error_t socket_recv(nsapi_socket_t handle,
be_bryan 0:b74591d5ab33 218 void *data, nsapi_size_t size) = 0;
be_bryan 0:b74591d5ab33 219
be_bryan 0:b74591d5ab33 220 /** Send a packet over a UDP socket
be_bryan 0:b74591d5ab33 221 *
be_bryan 0:b74591d5ab33 222 * Sends data to the specified address. Returns the number of bytes
be_bryan 0:b74591d5ab33 223 * sent from the buffer.
be_bryan 0:b74591d5ab33 224 *
be_bryan 0:b74591d5ab33 225 * This call is non-blocking. If sendto would block,
be_bryan 0:b74591d5ab33 226 * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
be_bryan 0:b74591d5ab33 227 *
be_bryan 0:b74591d5ab33 228 * @param handle Socket handle
be_bryan 0:b74591d5ab33 229 * @param address The SocketAddress of the remote host
be_bryan 0:b74591d5ab33 230 * @param data Buffer of data to send to the host
be_bryan 0:b74591d5ab33 231 * @param size Size of the buffer in bytes
be_bryan 0:b74591d5ab33 232 * @return Number of sent bytes on success, negative error
be_bryan 0:b74591d5ab33 233 * code on failure
be_bryan 0:b74591d5ab33 234 */
be_bryan 0:b74591d5ab33 235 virtual nsapi_size_or_error_t socket_sendto(nsapi_socket_t handle, const SocketAddress &address,
be_bryan 0:b74591d5ab33 236 const void *data, nsapi_size_t size) = 0;
be_bryan 0:b74591d5ab33 237
be_bryan 0:b74591d5ab33 238 /** Receive a packet over a UDP socket
be_bryan 0:b74591d5ab33 239 *
be_bryan 0:b74591d5ab33 240 * Receives data and stores the source address in address if address
be_bryan 0:b74591d5ab33 241 * is not NULL. Returns the number of bytes received into the buffer.
be_bryan 0:b74591d5ab33 242 *
be_bryan 0:b74591d5ab33 243 * This call is non-blocking. If recvfrom would block,
be_bryan 0:b74591d5ab33 244 * NSAPI_ERROR_WOULD_BLOCK is returned immediately.
be_bryan 0:b74591d5ab33 245 *
be_bryan 0:b74591d5ab33 246 * @param handle Socket handle
be_bryan 0:b74591d5ab33 247 * @param address Destination for the source address or NULL
be_bryan 0:b74591d5ab33 248 * @param buffer Destination buffer for data received from the host
be_bryan 0:b74591d5ab33 249 * @param size Size of the buffer in bytes
be_bryan 0:b74591d5ab33 250 * @return Number of received bytes on success, negative error
be_bryan 0:b74591d5ab33 251 * code on failure
be_bryan 0:b74591d5ab33 252 */
be_bryan 0:b74591d5ab33 253 virtual nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address,
be_bryan 0:b74591d5ab33 254 void *buffer, nsapi_size_t size) = 0;
be_bryan 0:b74591d5ab33 255
be_bryan 0:b74591d5ab33 256 /** Register a callback on state change of the socket
be_bryan 0:b74591d5ab33 257 *
be_bryan 0:b74591d5ab33 258 * The specified callback will be called on state changes such as when
be_bryan 0:b74591d5ab33 259 * the socket can recv/send/accept successfully and on when an error
be_bryan 0:b74591d5ab33 260 * occurs. The callback may also be called spuriously without reason.
be_bryan 0:b74591d5ab33 261 *
be_bryan 0:b74591d5ab33 262 * The callback may be called in an interrupt context and should not
be_bryan 0:b74591d5ab33 263 * perform expensive operations such as recv/send calls.
be_bryan 0:b74591d5ab33 264 *
be_bryan 0:b74591d5ab33 265 * @param handle Socket handle
be_bryan 0:b74591d5ab33 266 * @param callback Function to call on state change
be_bryan 0:b74591d5ab33 267 * @param data Argument to pass to callback
be_bryan 0:b74591d5ab33 268 */
be_bryan 0:b74591d5ab33 269 virtual void socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *data) = 0;
be_bryan 0:b74591d5ab33 270
be_bryan 0:b74591d5ab33 271 /* Set stack-specific socket options
be_bryan 0:b74591d5ab33 272 *
be_bryan 0:b74591d5ab33 273 * The setsockopt allow an application to pass stack-specific hints
be_bryan 0:b74591d5ab33 274 * to the underlying stack. For unsupported options,
be_bryan 0:b74591d5ab33 275 * NSAPI_ERROR_UNSUPPORTED is returned and the socket is unmodified.
be_bryan 0:b74591d5ab33 276 *
be_bryan 0:b74591d5ab33 277 * @param handle Socket handle
be_bryan 0:b74591d5ab33 278 * @param level Stack-specific protocol level
be_bryan 0:b74591d5ab33 279 * @param optname Stack-specific option identifier
be_bryan 0:b74591d5ab33 280 * @param optval Option value
be_bryan 0:b74591d5ab33 281 * @param optlen Length of the option value
be_bryan 0:b74591d5ab33 282 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 283 */
be_bryan 0:b74591d5ab33 284 virtual nsapi_error_t setsockopt(nsapi_socket_t handle, int level,
be_bryan 0:b74591d5ab33 285 int optname, const void *optval, unsigned optlen);
be_bryan 0:b74591d5ab33 286
be_bryan 0:b74591d5ab33 287 /* Get stack-specific socket options
be_bryan 0:b74591d5ab33 288 *
be_bryan 0:b74591d5ab33 289 * The getstackopt allow an application to retrieve stack-specific hints
be_bryan 0:b74591d5ab33 290 * from the underlying stack. For unsupported options,
be_bryan 0:b74591d5ab33 291 * NSAPI_ERROR_UNSUPPORTED is returned and optval is unmodified.
be_bryan 0:b74591d5ab33 292 *
be_bryan 0:b74591d5ab33 293 * @param handle Socket handle
be_bryan 0:b74591d5ab33 294 * @param level Stack-specific protocol level
be_bryan 0:b74591d5ab33 295 * @param optname Stack-specific option identifier
be_bryan 0:b74591d5ab33 296 * @param optval Destination for option value
be_bryan 0:b74591d5ab33 297 * @param optlen Length of the option value
be_bryan 0:b74591d5ab33 298 * @return 0 on success, negative error code on failure
be_bryan 0:b74591d5ab33 299 */
be_bryan 0:b74591d5ab33 300 virtual nsapi_error_t getsockopt(nsapi_socket_t handle, int level,
be_bryan 0:b74591d5ab33 301 int optname, void *optval, unsigned *optlen);
be_bryan 0:b74591d5ab33 302 };
be_bryan 0:b74591d5ab33 303
be_bryan 0:b74591d5ab33 304
be_bryan 0:b74591d5ab33 305 /** Convert a raw nsapi_stack_t object into a C++ NetworkStack object
be_bryan 0:b74591d5ab33 306 *
be_bryan 0:b74591d5ab33 307 * @param stack Reference to an object that can be converted to a stack
be_bryan 0:b74591d5ab33 308 * - A raw nsapi_stack_t object
be_bryan 0:b74591d5ab33 309 * - A reference to a network stack
be_bryan 0:b74591d5ab33 310 * - A reference to a network interface
be_bryan 0:b74591d5ab33 311 * @return Reference to the underlying network stack
be_bryan 0:b74591d5ab33 312 */
be_bryan 0:b74591d5ab33 313 NetworkStack *nsapi_create_stack(nsapi_stack_t *stack);
be_bryan 0:b74591d5ab33 314 NetworkStack *nsapi_create_stack(NetworkStack *stack);
be_bryan 0:b74591d5ab33 315
be_bryan 0:b74591d5ab33 316 template <typename IF>
be_bryan 0:b74591d5ab33 317 NetworkStack *nsapi_create_stack(IF *iface)
be_bryan 0:b74591d5ab33 318 {
be_bryan 0:b74591d5ab33 319 return nsapi_create_stack(static_cast<NetworkInterface *>(iface)->get_stack());
be_bryan 0:b74591d5ab33 320 }
be_bryan 0:b74591d5ab33 321
be_bryan 0:b74591d5ab33 322
be_bryan 0:b74591d5ab33 323 #endif