Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Netsocket
| Data Structures | |
| class | CellularInterface | 
| CellularInterface class.  More... | |
| class | EthInterface | 
| EthInterface class.  More... | |
| class | MeshInterface | 
| MeshInterface class.  More... | |
| class | NetworkInterface | 
| NetworkInterface class.  More... | |
| class | NetworkStack | 
| NetworkStack class.  More... | |
| struct | nsapi_addr | 
| IP address structure for passing IP addresses by value.  More... | |
| struct | nsapi_wifi_ap | 
| nsapi_wifi_ap structure  More... | |
| struct | nsapi_stack | 
| nsapi_stack structure  More... | |
| struct | nsapi_stack_api | 
| nsapi_stack_api structure  More... | |
| class | Socket | 
| Abstract socket class.  More... | |
| class | SocketAddress | 
| SocketAddress class.  More... | |
| class | TCPServer | 
| TCP socket server.  More... | |
| class | TCPSocket | 
| TCP socket connection.  More... | |
| class | UDPSocket | 
| UDP socket.  More... | |
| class | WiFiInterface | 
| WiFiInterface class.  More... | |
| Typedefs | |
| typedef enum nsapi_security | nsapi_security_t | 
| Enum of encryption types. | |
| typedef struct nsapi_addr | nsapi_addr_t | 
| IP address structure for passing IP addresses by value. | |
| typedef void * | nsapi_socket_t | 
| Opaque handle for network sockets. | |
| typedef struct nsapi_wifi_ap | nsapi_wifi_ap_t | 
| nsapi_wifi_ap structure | |
| typedef struct nsapi_stack | nsapi_stack_t | 
| nsapi_stack structure | |
| typedef struct nsapi_stack_api | nsapi_stack_api_t | 
| nsapi_stack_api structure | |
| Enumerations | |
| enum | nsapi_error { NSAPI_ERROR_OK = 0, NSAPI_ERROR_WOULD_BLOCK = -3001, NSAPI_ERROR_UNSUPPORTED = -3002, NSAPI_ERROR_PARAMETER = -3003, NSAPI_ERROR_NO_CONNECTION = -3004, NSAPI_ERROR_NO_SOCKET = -3005, NSAPI_ERROR_NO_ADDRESS = -3006, NSAPI_ERROR_NO_MEMORY = -3007, NSAPI_ERROR_NO_SSID = -3008, NSAPI_ERROR_DNS_FAILURE = -3009, NSAPI_ERROR_DHCP_FAILURE = -3010, NSAPI_ERROR_AUTH_FAILURE = -3011, NSAPI_ERROR_DEVICE_ERROR = -3012 } | 
| enum | nsapi_security { NSAPI_SECURITY_NONE = 0x0, NSAPI_SECURITY_WEP = 0x1, NSAPI_SECURITY_WPA = 0x2, NSAPI_SECURITY_WPA2 = 0x3, NSAPI_SECURITY_WPA_WPA2 = 0x4, NSAPI_SECURITY_UNKNOWN = 0xFF } | 
| Enum of encryption types.More... | |
| enum | nsapi_version { NSAPI_IPv4, NSAPI_IPv6, NSAPI_UNSPEC } | 
| enum | nsapi_protocol { NSAPI_TCP, NSAPI_UDP } | 
| enum | nsapi_level { NSAPI_STACK, NSAPI_SOCKET } | 
| enum | nsapi_option { NSAPI_REUSEADDR, NSAPI_KEEPALIVE, NSAPI_KEEPIDLE, NSAPI_KEEPINTVL, NSAPI_LINGER, NSAPI_SNDBUF, NSAPI_RCVBUF } | 
| Functions | |
| NetworkStack * | nsapi_create_stack (nsapi_stack_t *stack) | 
| Convert a raw nsapi_stack_t object into a C++ NetworkStack object. | |
| int | nsapi_dns_query (nsapi_stack_t *stack, const char *host, nsapi_addr_t *addr, nsapi_version_t version) | 
| Query a domain name server for an IP address of a given hostname. | |
| int | nsapi_dns_query_multiple (nsapi_stack_t *stack, const char *host, nsapi_addr_t *addr, unsigned addr_count, nsapi_version_t version) | 
| Query a domain name server for multiple IP address of a given hostname. | |
| int | nsapi_dns_add_server (nsapi_addr_t addr) | 
| Add a domain name server to list of servers to query. | |
| int | nsapi_dns_query (NetworkStack *stack, const char *host, SocketAddress *addr, nsapi_version_t version=NSAPI_IPv4) | 
| Query a domain name server for an IP address of a given hostname. | |
| template<typename S > | |
| int | nsapi_dns_query (S *stack, const char *host, SocketAddress *addr, nsapi_version_t version=NSAPI_IPv4) | 
| Query a domain name server for an IP address of a given hostname. | |
| int | nsapi_dns_query_multiple (NetworkStack *stack, const char *host, SocketAddress *addr, unsigned addr_count, nsapi_version_t version=NSAPI_IPv4) | 
| Query a domain name server for multiple IP address of a given hostname. | |
| template<typename S > | |
| int | nsapi_dns_query_multiple (S *stack, const char *host, SocketAddress *addr, unsigned addr_count, nsapi_version_t version=NSAPI_IPv4) | 
| Query a domain name server for multiple IP address of a given hostname. | |
| static int | nsapi_dns_add_server (const SocketAddress &address) | 
| Add a domain name server to list of servers to query. | |
| static int | nsapi_dns_add_server (const char *address) | 
| Add a domain name server to list of servers to query. | |
Typedef Documentation
| typedef struct nsapi_addr nsapi_addr_t | 
IP address structure for passing IP addresses by value.
| typedef enum nsapi_security nsapi_security_t | 
Enum of encryption types.
The security type specifies a particular security to use when connected to a WiFi network
| typedef void* nsapi_socket_t | 
Opaque handle for network sockets.
Definition at line 128 of file nsapi_types.h.
| typedef struct nsapi_stack_api nsapi_stack_api_t | 
nsapi_stack_api structure
Common api structure for network stack operations. A network stack can provide a nsapi_stack_api structure filled out with the appropriate implementation.
Unsupported operations can be left as null pointers.
| typedef struct nsapi_stack nsapi_stack_t | 
nsapi_stack structure
Stack structure representing a specific instance of a stack.
| typedef struct nsapi_wifi_ap nsapi_wifi_ap_t | 
nsapi_wifi_ap structure
Structure representing a WiFi Access Point
Enumeration Type Documentation
| enum nsapi_error | 
- Enumerator:
Definition at line 37 of file nsapi_types.h.
| enum nsapi_level | 
- Enumerator:
- NSAPI_STACK - Stack option level - NSAPI_SOCKET - Socket option level 
Definition at line 147 of file nsapi_types.h.
| enum nsapi_option | 
- Enumerator:
Definition at line 159 of file nsapi_types.h.
| enum nsapi_protocol | 
Definition at line 138 of file nsapi_types.h.
| enum nsapi_security | 
Enum of encryption types.
The security type specifies a particular security to use when connected to a WiFi network
- Enumerator:
Definition at line 58 of file nsapi_types.h.
| enum nsapi_version | 
- Enumerator:
- NSAPI_IPv4 - Address is IPv4 - NSAPI_IPv6 - Address is IPv6 - NSAPI_UNSPEC - Address is unspecified 
Definition at line 105 of file nsapi_types.h.
Function Documentation
| NetworkStack* nsapi_create_stack | ( | nsapi_stack_t * | stack ) | 
Convert a raw nsapi_stack_t object into a C++ NetworkStack object.
- Parameters:
- 
  stack Reference to an object that can be converted to a stack - A raw nsapi_stack_t object
- A reference to a network stack
- A reference to a network interface
 
- Returns:
- Reference to the underlying network stack
Definition at line 295 of file NetworkStack.cpp.
| static int nsapi_dns_add_server | ( | const char * | address ) |  [static] | 
Add a domain name server to list of servers to query.
- Parameters:
- 
  addr Destination for the host address 
- Returns:
- 0 on success, negative error code on failure
Definition at line 173 of file nsapi_dns.h.
| static int nsapi_dns_add_server | ( | const SocketAddress & | address ) |  [static] | 
Add a domain name server to list of servers to query.
- Parameters:
- 
  addr Destination for the host address 
- Returns:
- 0 on success, negative error code on failure
Definition at line 163 of file nsapi_dns.h.
| int nsapi_dns_add_server | ( | nsapi_addr_t | addr ) | 
Add a domain name server to list of servers to query.
- Parameters:
- 
  addr Destination for the host address 
- Returns:
- 0 on success, negative error code on failure
Definition at line 42 of file nsapi_dns.cpp.
| int nsapi_dns_query | ( | nsapi_stack_t * | stack, | 
| const char * | host, | ||
| nsapi_addr_t * | addr, | ||
| nsapi_version_t | version | ||
| ) | 
Query a domain name server for an IP address of a given hostname.
- Parameters:
- 
  stack Network stack as target for DNS query host Hostname to resolve addr Destination for the host address version IP version to resolve 
- Returns:
- 0 on success, negative error code on failure NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
- Parameters:
- 
  stack Network stack as target for DNS query host Hostname to resolve addr Destination for the host address version IP version to resolve (defaults to NSAPI_IPv4) 
- Returns:
- 0 on success, negative error code on failure NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
Definition at line 291 of file nsapi_dns.cpp.
| int nsapi_dns_query | ( | S * | stack, | 
| const char * | host, | ||
| SocketAddress * | addr, | ||
| nsapi_version_t | version = NSAPI_IPv4 | ||
| ) | 
Query a domain name server for an IP address of a given hostname.
- Parameters:
- 
  stack Network stack as target for DNS query host Hostname to resolve addr Destination for the host address version IP version to resolve (defaults to NSAPI_IPv4) 
- Returns:
- 0 on success, negative error code on failure NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
Definition at line 101 of file nsapi_dns.h.
| int nsapi_dns_query | ( | NetworkStack * | stack, | 
| const char * | host, | ||
| SocketAddress * | addr, | ||
| nsapi_version_t | version = NSAPI_IPv4 | ||
| ) | 
Query a domain name server for an IP address of a given hostname.
- Parameters:
- 
  stack Network stack as target for DNS query host Hostname to resolve addr Destination for the host address version IP version to resolve (defaults to NSAPI_IPv4) 
- Returns:
- 0 on success, negative error code on failure NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
Definition at line 299 of file nsapi_dns.cpp.
| int nsapi_dns_query_multiple | ( | NetworkStack * | stack, | 
| const char * | host, | ||
| SocketAddress * | addr, | ||
| unsigned | addr_count, | ||
| nsapi_version_t | version = NSAPI_IPv4 | ||
| ) | 
Query a domain name server for multiple IP address of a given hostname.
- Parameters:
- 
  stack Network stack as target for DNS query host Hostname to resolve addr Array for the host addresses addr_count Number of addresses allocated in the array version IP version to resolve (defaults to NSAPI_IPv4) 
- Returns:
- Number of addresses found on success, negative error code on failure NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
Definition at line 275 of file nsapi_dns.cpp.
| int nsapi_dns_query_multiple | ( | S * | stack, | 
| const char * | host, | ||
| SocketAddress * | addr, | ||
| unsigned | addr_count, | ||
| nsapi_version_t | version = NSAPI_IPv4 | ||
| ) | 
Query a domain name server for multiple IP address of a given hostname.
- Parameters:
- 
  stack Network stack as target for DNS query host Hostname to resolve addr Array for the host addresses addr_count Number of addresses allocated in the array version IP version to resolve (defaults to NSAPI_IPv4) 
- Returns:
- Number of addresses found on success, negative error code on failure NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
Definition at line 144 of file nsapi_dns.h.
| int nsapi_dns_query_multiple | ( | nsapi_stack_t * | stack, | 
| const char * | host, | ||
| nsapi_addr_t * | addr, | ||
| unsigned | addr_count, | ||
| nsapi_version_t | version | ||
| ) | 
Query a domain name server for multiple IP address of a given hostname.
- Parameters:
- 
  stack Network stack as target for DNS query host Hostname to resolve addr Array for the host addresses addr_count Number of addresses allocated in the array version IP version to resolve 
- Returns:
- Number of addresses found on success, negative error code on failure NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
- Parameters:
- 
  stack Network stack as target for DNS query host Hostname to resolve addr Array for the host addresses addr_count Number of addresses allocated in the array version IP version to resolve (defaults to NSAPI_IPv4) 
- Returns:
- Number of addresses found on success, negative error code on failure NSAPI_ERROR_DNS_FAILURE indicates the host could not be found
Definition at line 268 of file nsapi_dns.cpp.
Generated on Tue Jul 12 2022 17:35:08 by
 1.7.2
 1.7.2