BBR 1 Ebene

Committer:
borlanic
Date:
Mon May 14 11:29:06 2018 +0000
Revision:
0:fbdae7e6d805
BBR

Who changed what in which revision?

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