Mbed OS Reference
Loading...
Searching...
No Matches
NetworkInterface.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 ARM Limited
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/** @file NetworkInterface.h Network Interface base class */
19/** @addtogroup netinterface
20 * Network Interface classes
21 * @{ */
22
23
24#ifndef NETWORK_INTERFACE_H
25#define NETWORK_INTERFACE_H
26
27#include "netsocket/nsapi_types.h"
29#include "Callback.h"
30#include "DNS.h"
31
32
33// Predeclared classes
34class NetworkStack;
35class EthInterface;
36class WiFiInterface;
37class MeshInterface;
39class EMACInterface;
40class PPPInterface;
41
42/** Common interface that is shared between network devices.
43 *
44 */
45class NetworkInterface: public DNS {
46public:
47
48 virtual ~NetworkInterface();
49
50 /** Return the default network interface.
51 *
52 * Returns the default network interface, as determined by JSON option
53 * target.network-default-interface-type or other overrides.
54 *
55 * The type of the interface returned can be tested by calling ethInterface(),
56 * wifiInterface(), meshInterface(), cellularInterface(), emacInterface() and checking
57 * for NULL pointers.
58 *
59 * The default behavior is to return the default interface for the
60 * interface type specified by target.network-default-interface-type. Targets
61 * should set this in their targets.json to guide default selection,
62 * and applications may override.
63 *
64 * The interface returned should be already configured for use such that its
65 * connect() method works with no parameters. For connection types needing
66 * configuration, settings should normally be obtained from JSON - the
67 * settings for the core types are under the "nsapi" JSON config tree.
68 *
69 * The list of possible settings for default interface type is open-ended,
70 * as is the number of possible providers. Core providers are:
71 *
72 * * ETHERNET: EthernetInterface, using default EMAC and OnboardNetworkStack
73 * * MESH: ThreadInterface or LoWPANNDInterface, using default NanostackRfPhy
74 * * CELLULAR: OnboardModemInterface
75 * * WIFI: None - always provided by a specific class
76 *
77 * Specific drivers may be activated by other settings of the
78 * default-network-interface-type configuration. This will depend on the
79 * target and the driver. For example a board may have its default setting
80 * as "AUTO" which causes it to autodetect an Ethernet cable. This should
81 * be described in the target's documentation.
82 *
83 * An application can override all target settings by implementing
84 * NetworkInterface::get_default_instance() themselves - the default
85 * definition is weak, and calls get_target_default_instance().
86 */
88
89 /** Set network interface as default one.
90 */
91 virtual void set_as_default();
92
93 /** Get the local MAC address.
94 *
95 * Provided MAC address is intended for info or debug purposes and
96 * may be not provided if the underlying network interface does not
97 * provide a MAC address.
98 *
99 * @return Null-terminated representation of the local MAC address
100 * or null if no MAC address is available.
101 */
102 virtual const char *get_mac_address();
103
104 /** Set the MAC address to the interface.
105 *
106 * Set the provided MAC address on the network interface. The address must
107 * be unique globally. The address must be set before calling the interface
108 * connect() method.
109 *
110 * Not all interfaces are supporting MAC address set and an error is not returned
111 * for this method call. Verify the changed MAC address by checking packet
112 * captures from the used network interface.
113 *
114 * 6-byte EUI-48 MAC addresses are used for Ethernet while Mesh interface is
115 * using 8-byte EUI-64 address.
116 *
117 * More information about obtaining MAC address can be found from:
118 * https://standards.ieee.org/products-services/regauth/index.html
119 *
120 * @param mac_addr Buffer containing the MAC address in hexadecimal format.
121 * @param addr_len Length of provided buffer in bytes (6 or 8)
122 * @retval NSAPI_ERROR_OK on success
123 * @retval NSAPI_ERROR_UNSUPPORTED if this feature is not supported
124 * @retval NSAPI_ERROR_PARAMETER if address is not valid
125 * @retval NSAPI_ERROR_BUSY if address can't be set.
126 */
127 virtual nsapi_error_t set_mac_address(uint8_t *mac_addr, nsapi_size_t addr_len);
128
129 /** Get the local IP address
130 *
131 * @param address SocketAddress representation of the local IP address
132 * @retval NSAPI_ERROR_OK on success
133 * @retval NSAPI_ERROR_UNSUPPORTED if this feature is not supported
134 * @retval NSAPI_ERROR_PARAMETER if the provided pointer is invalid
135 * @retval NSAPI_ERROR_NO_ADDRESS if the address cannot be obtained from stack
136 */
138
139 /** Get the IPv6 link local address
140 *
141 * @param address SocketAddress representation of the link local IPv6 address
142 * @retval NSAPI_ERROR_OK on success
143 * @retval NSAPI_ERROR_UNSUPPORTED if this feature is not supported
144 * @retval NSAPI_ERROR_PARAMETER if the provided pointer is invalid
145 */
147
148 /** Get the local network mask.
149 *
150 * @param address SocketAddress representation of netmask
151 * @retval NSAPI_ERROR_OK on success
152 * @retval NSAPI_ERROR_UNSUPPORTED if this feature is not supported
153 * @retval NSAPI_ERROR_PARAMETER if the provided pointer is invalid
154 * @retval NSAPI_ERROR_NO_ADDRESS if the address cannot be obtained from stack
155 */
157
158 /** Get the local gateway.
159 *
160 * @param address SocketAddress representation of gateway address
161 * @retval NSAPI_ERROR_OK on success
162 * @retval NSAPI_ERROR_UNSUPPORTED if this feature is not supported
163 * @retval NSAPI_ERROR_PARAMETER if the provided pointer is invalid
164 * @retval NSAPI_ERROR_NO_ADDRESS if the address cannot be obtained from stack
165 */
167
168 /** Get the network interface name
169 *
170 * @return Null-terminated representation of the network interface name
171 * or null if interface not exists
172 */
173 virtual char *get_interface_name(char *interface_name);
174
175 /** Configure this network interface to use a static IP address.
176 * Implicitly disables DHCP, which can be enabled in set_dhcp.
177 * Requires that the network is disconnected.
178 *
179 * @param ip_address SocketAddress object containing the local IP address
180 * @param netmask SocketAddress object containing the local network mask
181 * @param gateway SocketAddress object containing the local gateway
182 * @retval NSAPI_ERROR_OK on success
183 * @retval NSAPI_ERROR_UNSUPPORTED if this function is unsupported
184 */
185 virtual nsapi_error_t set_network(const SocketAddress &ip_address, const SocketAddress &netmask, const SocketAddress &gateway);
186
187 /** Enable or disable DHCP on connecting the network.
188 *
189 * Enabled by default unless a static IP address has been assigned. Requires
190 * that the network is disconnected.
191 *
192 * @param dhcp True to enable DHCP.
193 * @retval NSAPI_ERROR_OK on success.
194 * @retval NSAPI_ERROR_UNSUPPORTED if operation is not supported.
195 */
196 virtual nsapi_error_t set_dhcp(bool dhcp);
197
198 /** Connect to a network.
199 *
200 * This blocks until connection is established, but asynchronous operation can be enabled
201 * by calling NetworkInterface::set_blocking(false).
202 *
203 * In asynchronous mode this starts the connection sequence and returns immediately.
204 * Status of the connection can then checked from NetworkInterface::get_connection_status()
205 * or from status callbacks.
206 *
207 * NetworkInterface internally handles reconnections until disconnect() is called.
208 *
209 * @return NSAPI_ERROR_OK if connection established in blocking mode.
210 * @return NSAPI_ERROR_OK if asynchronous operation started.
211 * @return NSAPI_ERROR_BUSY if asynchronous operation cannot be started.
212 Implementation guarantees event generation, which can be used as an
213 trigger to reissue the rejected request.
214 * @return NSAPI_ERROR_IS_CONNECTED if already connected.
215 * @return negative error code on failure.
216 */
217 virtual nsapi_error_t connect() = 0;
218
219 /** Disconnect from the network
220 *
221 * This blocks until interface is disconnected, unless interface is set to
222 * asynchronous (non-blocking) mode by calling NetworkInterface::set_blocking(false).
223 *
224 * @return NSAPI_ERROR_OK on successfully disconnected in blocking mode.
225 * @return NSAPI_ERROR_OK if asynchronous operation started.
226 * @return NSAPI_ERROR_BUSY if asynchronous operation cannot be started.
227 Implementation guarantees event generation, which can be used as an
228 trigger to reissue the rejected request.
229 * @return NSAPI_ERROR_NO_CONNECTION if already disconnected.
230 * @return negative error code on failure.
231 */
233
234 /** Translate a hostname to an IP address with specific version using network interface name.
235 *
236 * The hostname may be either a domain name or an IP address. If the
237 * hostname is an IP address, no network transactions will be performed.
238 *
239 * If no stack-specific DNS resolution is provided, the hostname
240 * will be resolve using a UDP socket on the stack.
241 *
242 * @param host Hostname to resolve.
243 * @param address Pointer to a SocketAddress to store the result.
244 * @param version IP version of address to resolve, NSAPI_UNSPEC indicates
245 * version is chosen by the stack (defaults to NSAPI_UNSPEC).
246 * @param interface_name Network interface name
247 * @retval NSAPI_ERROR_OK on success
248 * @retval int Negative error code on failure.
249 * See @ref NetworkStack::gethostbyname
250 */
251 virtual nsapi_error_t gethostbyname(const char *host,
252 SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC, const char *interface_name = NULL);
253
254 /** Translate a hostname to the multiple IP addresses with specific version using network interface name.
255 *
256 * The hostname may be either a domain name or an IP address. If the
257 * hostname is an IP address, no network transactions will be performed.
258 *
259 * If no stack-specific DNS resolution is provided, the hostname
260 * will be resolve using a UDP socket on the stack.
261 *
262 * @param hostname Hostname to resolve.
263 * @param hints Pointer to a SocketAddress with query parameters.
264 * @param res Pointer to a SocketAddress array to store the result..
265 * @param interface_name Network interface name
266 * @return number of results on success, negative error code on failure.
267 */
268 virtual nsapi_value_or_error_t getaddrinfo(const char *hostname, SocketAddress *hints, SocketAddress **res, const char *interface_name = NULL);
269
270 /** Hostname translation callback (for use with gethostbyname_async()).
271 *
272 * Callback will be called after DNS resolution completes or a failure occurs.
273 *
274 * @note Callback should not take more than 10ms to execute, otherwise it might
275 * prevent underlying thread processing. A portable user of the callback
276 * should not make calls to network operations due to stack size limitations.
277 * The callback should not perform expensive operations such as socket recv/send
278 * calls or blocking operations.
279 *
280 * <br>
281 * \c result : Negative error code on failure, or value that represents the number of DNS records
282 * <br>
283 * \c address : On success, destination for the host SocketAddress.
284 */
286
287 /** Translate a hostname to an IP address (asynchronous) using network interface name.
288 *
289 * The hostname may be either a domain name or a dotted IP address. If the
290 * hostname is an IP address, no network transactions will be performed.
291 *
292 * If no stack-specific DNS resolution is provided, the hostname
293 * will be resolve using a UDP socket on the stack.
294 *
295 * Call is non-blocking. Result of the DNS operation is returned by the callback.
296 * If this function returns failure, callback will not be called. In case result
297 * is success (IP address was found from DNS cache), callback will be called
298 * before function returns.
299 *
300 * @param host Hostname to resolve.
301 * @param callback Callback that is called for result.
302 * @param version IP version of address to resolve, NSAPI_UNSPEC indicates
303 * version is chosen by the stack (defaults to NSAPI_UNSPEC).
304 * @param interface_name Network interface name
305 * @return 0 on immediate success,
306 * negative error code on immediate failure or
307 * a positive unique id that represents the hostname translation operation
308 * and can be passed to cancel.
309 */
310 virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version = NSAPI_UNSPEC,
311 const char *interface_name = NULL);
312
313 /** Translate a hostname to the multiple IP addresses (asynchronous) using network interface name.
314 *
315 * The hostname may be either a domain name or a dotted IP address. If the
316 * hostname is an IP address, no network transactions will be performed.
317 *
318 * If no stack-specific DNS resolution is provided, the hostname
319 * will be resolve using a UDP socket on the stack.
320 *
321 * Call is non-blocking. Result of the DNS operation is returned by the callback.
322 * If this function returns failure, callback will not be called. In case result
323 * is success (IP address was found from DNS cache), callback will be called
324 * before function returns.
325 *
326 * @param hostname Hostname to resolve.
327 * @param hints Pointer to a SocketAddress with query parameters.
328 * @param callback Callback that is called for result.
329 * @param interface_name Network interface name
330 * @return 0 on immediate success,
331 * negative error code on immediate failure or
332 * a positive unique id that represents the hostname translation operation
333 * and can be passed to cancel.
334 */
335 virtual nsapi_value_or_error_t getaddrinfo_async(const char *hostname, SocketAddress *hints, hostbyname_cb_t callback, const char *interface_name = NULL);
336
337 /** Cancel asynchronous hostname translation.
338 *
339 * When translation is cancelled, callback will not be called.
340 *
341 * @param id Unique id of the hostname translation operation (returned
342 * by gethostbyname_async)
343 * @return NSAPI_ERROR_OK on success, negative error code on failure.
344 */
346
347 /** Add a domain name server to list of servers to query
348 *
349 * @param address Address for the dns host.
350 * @param interface_name Network interface name. Currently unused, the server is added for all interfaces.
351 * @return NSAPI_ERROR_OK on success, negative error code on failure.
352 */
353 virtual nsapi_error_t add_dns_server(const SocketAddress &address, const char *interface_name);
354
355 /** Get a domain name server from a list of servers to query
356 *
357 * Returns a DNS server address for a index. If returns error no more
358 * DNS servers to read.
359 *
360 * @param index Index of the DNS server, starts from zero
361 * @param address Destination for the host address
362 * @param interface_name Network interface name
363 * @return NSAPI_ERROR_OK on success, negative error code on failure
364 */
365 virtual nsapi_error_t get_dns_server(int index, SocketAddress *address, const char *interface_name = NULL);
366
367 /** Register callback for status reporting.
368 *
369 * The specified status callback function will be called on status changes
370 * on the network. The parameters on the callback are the event type and
371 * event-type dependent reason parameter. Only one callback can be registered at a time.
372 *
373 * To unregister a callback call with status_cb parameter as a zero.
374 *
375 * *NOTE:* Any callbacks registered with this function will be overwritten if
376 * add_event_listener() API is used.
377 *
378 * @param status_cb The callback for status changes.
379 */
380 virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
381
382#if MBED_CONF_NSAPI_ADD_EVENT_LISTENER_RETURN_CHANGE
383 /** Add event listener for interface.
384 *
385 * This API allows multiple callback to be registered for a single interface.
386 * of both leads to undefined behavior.
387 *
388 * @param status_cb The callback for status changes.
389 * @return NSAPI_ERROR_OK on success
390 * @return NSAPI_ERROR_NO_MEMORY if the function fails to create a new entry.
391 */
392 nsapi_error_t add_event_listener(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
393#else
394 /** Add event listener for interface.
395 *
396 * This API allows multiple callback to be registered for a single interface.
397 * When first called, internal list of event handlers are created and registered to
398 * interface through attach() API.
399 *
400 * Application may only use attach() or add_event_listener() interface. Mixing usage
401 * of both leads to undefined behavior.
402 *
403 * @warning This version of the function does not use the `std::nothrow` feature. Subsequently,
404 * the function may fail to allocate memory and cause a system error. To use the new
405 * version with the changes, set "nsapi.add-event-listener-return-change": 1 in the
406 * target overrides section in your mbed_app.json file.
407 *
408 * @param status_cb The callback for status changes.
409 */
410 MBED_DEPRECATED_SINCE("mbed-os-6.12", "This function return value will change to nsapi_error_t in the next major release. See documentation for details.")
411 void add_event_listener(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
412#endif
413
414#if MBED_CONF_PLATFORM_CALLBACK_COMPARABLE
415 /** Remove event listener from interface.
416 *
417 * Remove previously added callback from the handler list.
418 *
419 * @param status_cb The callback to unregister.
420 */
421 void remove_event_listener(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
422#endif
423
424 /** Get the connection status.
425 *
426 * @return The connection status (@see nsapi_types.h).
427 */
428 virtual nsapi_connection_status_t get_connection_status() const;
429
430 /** Set asynchronous operation of connect() and disconnect() calls.
431 *
432 * By default, interfaces are in synchronous mode which means that
433 * connect() or disconnect() blocks until it reach the target state or requested operation fails.
434 *
435 * @param blocking Use false to set NetworkInterface in asynchronous mode.
436 * @return NSAPI_ERROR_OK on success
437 * @return NSAPI_ERROR_UNSUPPORTED if driver does not support asynchronous mode.
438 * @return negative error code on failure.
439 */
440 virtual nsapi_error_t set_blocking(bool blocking);
441
442 /** Return pointer to an EthInterface.
443 * @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
444 */
446 {
447 return nullptr;
448 }
449
450 /** Return pointer to a WiFiInterface.
451 * @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
452 */
454 {
455 return nullptr;
456 }
457
458 /** Return pointer to a MeshInterface.
459 * @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
460 */
462 {
463 return nullptr;
464 }
465
466 /** Return pointer to an EMACInterface.
467 * @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
468 */
470 {
471 return nullptr;
472 }
473
474 /** Return pointer to a CellularInterface.
475 * @return Pointer to requested interface type or NULL if this class doesn't implement the interface.
476 */
478 {
479 return nullptr;
480 }
481
482#if !defined(DOXYGEN_ONLY)
483
484protected:
485 friend NetworkStack *_nsapi_create_stack(NetworkInterface *iface, std::false_type);
486
487 /** Provide access to the NetworkStack object
488 *
489 * @return The underlying NetworkStack object
490 */
491 virtual NetworkStack *get_stack() = 0;
492
493 /** Get the target's default network instance.
494 *
495 * This method can be overridden by the target. Default implementations
496 * are provided weakly by various subsystems as described in
497 * NetworkInterface::get_default_instance(), so targets should not
498 * need to override in simple cases.
499 *
500 * If a target has more elaborate interface selection, it can completely
501 * override this behavior by implementing
502 * NetworkInterface::get_target_default_instance() themselves, either
503 * unconditionally, or for a specific network-default-interface-type setting
504 *
505 * For example, a device with both Ethernet and Wi-fi could be set up its
506 * target so that:
507 * * DEVICE_EMAC is set, and it provides EMAC::get_default_instance(),
508 * which means EthernetInterface provides EthInterface::get_target_instance()
509 * based on that EMAC.
510 * * It provides WifiInterface::get_target_default_instance().
511 * * The core will route NetworkInterface::get_default_instance() to
512 * either of those if network-default-interface-type is set to
513 * ETHERNET or WIFI.
514 * * The board overrides NetworkInterface::get_target_default_instance()
515 * if network-default-interface-type is set to AUTO. This returns
516 * either EthInterface::get_default_instance() or WiFIInterface::get_default_instance()
517 * depending on a cable detection.
518 *
519 *
520 * performs the search described by get_default_instance.
521 */
522 static NetworkInterface *get_target_default_instance();
523#endif //!defined(DOXYGEN_ONLY)
524
525public:
526 /** Set default parameters on an interface.
527 *
528 * A network interface instantiated directly or using calls such as
529 * WiFiInterface::get_default_instance() is initially unconfigured.
530 * This call can be used to set the default parameters that would
531 * have been set if the interface had been requested using
532 * NetworkInterface::get_default_instance() (see nsapi JSON
533 * configuration).
534 */
536
537private:
538 // Unified implementation for different versions of add_event_listener.
539 nsapi_error_t internal_add_event_listener(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
540};
541
542#endif
543
544/** @}*/
Domain Name Service.
SocketAddress class.
Common interface that is shared between cellular interfaces.
Base class for DNS provider.
Definition: DNS.h:28
EMACInterface class Implementation of the NetworkInterface for an EMAC-based driver.
Definition: EMACInterface.h:42
Common interface between Ethernet hardware.
Definition: EthInterface.h:30
Common interface that is shared between mesh hardware.
Definition: MeshInterface.h:30
Common interface that is shared between network devices.
static NetworkInterface * get_default_instance()
Return the default network interface.
virtual WiFiInterface * wifiInterface()
Return pointer to a WiFiInterface.
virtual nsapi_error_t get_dns_server(int index, SocketAddress *address, const char *interface_name=NULL)
Get a domain name server from a list of servers to query.
virtual void set_default_parameters()
defined(DOXYGEN_ONLY)
virtual char * get_interface_name(char *interface_name)
Get the network interface name.
virtual nsapi_error_t gethostbyname_async_cancel(int id)
Cancel asynchronous hostname translation.
virtual nsapi_error_t add_dns_server(const SocketAddress &address, const char *interface_name)
Add a domain name server to list of servers to query.
virtual void attach(mbed::Callback< void(nsapi_event_t, intptr_t)> status_cb)
Register callback for status reporting.
virtual nsapi_error_t set_dhcp(bool dhcp)
Enable or disable DHCP on connecting the network.
virtual nsapi_error_t get_ip_address(SocketAddress *address)
Get the local IP address.
virtual nsapi_error_t get_netmask(SocketAddress *address)
Get the local network mask.
virtual void set_as_default()
Set network interface as default one.
virtual nsapi_error_t set_mac_address(uint8_t *mac_addr, nsapi_size_t addr_len)
Set the MAC address to the interface.
virtual nsapi_error_t gethostbyname(const char *host, SocketAddress *address, nsapi_version_t version=NSAPI_UNSPEC, const char *interface_name=NULL)
Translate a hostname to an IP address with specific version using network interface name.
virtual MeshInterface * meshInterface()
Return pointer to a MeshInterface.
virtual nsapi_error_t get_ipv6_link_local_address(SocketAddress *address)
Get the IPv6 link local address.
virtual nsapi_connection_status_t get_connection_status() const
Get the connection status.
virtual nsapi_value_or_error_t getaddrinfo(const char *hostname, SocketAddress *hints, SocketAddress **res, const char *interface_name=NULL)
Translate a hostname to the multiple IP addresses with specific version using network interface name.
virtual nsapi_error_t set_blocking(bool blocking)
Set asynchronous operation of connect() and disconnect() calls.
virtual nsapi_value_or_error_t getaddrinfo_async(const char *hostname, SocketAddress *hints, hostbyname_cb_t callback, const char *interface_name=NULL)
Translate a hostname to the multiple IP addresses (asynchronous) using network interface name.
virtual const char * get_mac_address()
Get the local MAC address.
virtual nsapi_error_t connect()=0
Connect to a network.
virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version=NSAPI_UNSPEC, const char *interface_name=NULL)
Translate a hostname to an IP address (asynchronous) using network interface name.
void add_event_listener(mbed::Callback< void(nsapi_event_t, intptr_t)> status_cb)
Add event listener for interface.
mbed::Callback< void(nsapi_value_or_error_t result, SocketAddress *address)> hostbyname_cb_t
Hostname translation callback (for use with gethostbyname_async()).
virtual EthInterface * ethInterface()
Return pointer to an EthInterface.
virtual EMACInterface * emacInterface()
Return pointer to an EMACInterface.
virtual nsapi_error_t get_gateway(SocketAddress *address)
Get the local gateway.
virtual CellularInterface * cellularInterface()
Return pointer to a CellularInterface.
virtual nsapi_error_t set_network(const SocketAddress &ip_address, const SocketAddress &netmask, const SocketAddress &gateway)
Configure this network interface to use a static IP address.
virtual nsapi_error_t disconnect()=0
Disconnect from the network.
NetworkStack class.
Definition: NetworkStack.h:42
PPPInterface class Implementation of the NetworkInterface for an PPP-service.
Definition: PPPInterface.h:34
SocketAddress class.
Definition: SocketAddress.h:37
Common interface between Wi-Fi devices.
Definition: WiFiInterface.h:32
Callback class based on template specialization.
Definition: Callback.h:53
signed int nsapi_value_or_error_t
Type used to represent either a value or error.
Definition: nsapi_types.h:160
signed int nsapi_error_t
Type used to represent error codes.
Definition: nsapi_types.h:142
unsigned int nsapi_size_t
Type used to represent the size of data passed through sockets.
Definition: nsapi_types.h:146
@ NSAPI_UNSPEC
Definition: nsapi_types.h:230
#define MBED_DEPRECATED_SINCE(D, M)
MBED_DEPRECATED("message string") Mark a function declaration as deprecated, if it used then a warnin...