26#include "mbed_toolchain.h"
49#define NSAPI_IPTOS_TOS_MASK 0x1E
50#define NSAPI_IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
51#define NSAPI_IPTOS_LOWDELAY 0x10
52#define NSAPI_IPTOS_THROUGHPUT 0x08
53#define NSAPI_IPTOS_RELIABILITY 0x04
54#define NSAPI_IPTOS_LOWCOST 0x02
55#define NSAPI_IPTOS_MINCOST IPTOS_LOWCOST
66#define NSAPI_IPTOS_PREC_MASK 0xe0
67#define NSAPI_IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
68#define NSAPI_IPTOS_PREC_NETCONTROL 0xe0
69#define NSAPI_IPTOS_PREC_INTERNETCONTROL 0xc0
70#define NSAPI_IPTOS_PREC_CRITIC_ECP 0xa0
71#define NSAPI_IPTOS_PREC_FLASHOVERRIDE 0x80
72#define NSAPI_IPTOS_PREC_FLASH 0x60
73#define NSAPI_IPTOS_PREC_IMMEDIATE 0x40
74#define NSAPI_IPTOS_PREC_PRIORITY 0x20
75#define NSAPI_IPTOS_PREC_ROUTINE 0x00
121} nsapi_connection_status_t;
185#define NSAPI_INTERFACE_PREFIX_SIZE 2
189#define NSAPI_INTERFACE_NAME_MAX_SIZE 6
193#define NSAPI_IP_SIZE NSAPI_IPv6_SIZE
197#define NSAPI_IP_BYTES NSAPI_IPv6_BYTES
207#define NSAPI_HOSTNAME_SIZE 64
211#define NSAPI_MAC_SIZE 18
215#define NSAPI_MAC_BYTES 6
219#define NSAPI_IPv4_SIZE 16
223#define NSAPI_IPv4_BYTES 4
227#define NSAPI_IPv6_SIZE 40
231#define NSAPI_IPv6_BYTES 16
287} nsapi_stack_level_t;
300} nsapi_stack_option_t;
309} nsapi_socket_level_t;
335} nsapi_socket_option_t;
339} nsapi_tlssocket_level_t;
347} nsapi_tlssocket_option_t;
361typedef nsapi_socket_level_t nsapi_level_t;
362typedef nsapi_socket_option_t nsapi_option_t;
395 unsigned _stack_buffer[16];
416 uint16_t data_amount;
417 uint16_t stagger_min;
418 uint16_t stagger_max;
419 uint16_t stagger_rand;
441 void *network_interface;
501 int optname,
const void *optval,
unsigned optlen);
518 int optname,
void *optval,
unsigned *optlen);
535 nsapi_protocol_t proto);
718 void (*callback)(
void *),
void *data);
736 int optname,
const void *optval,
unsigned optlen);
754 int optname,
void *optval,
unsigned *optlen);
enum nsapi_security nsapi_security_t
Enum of encryption types.
nsapi_security
Enum of encryption types.
nsapi_socket_option
Enum of standardized socket option names for level NSAPI_SOCKET of Socket::setsockopt and getsockopt.
nsapi_ip_stack
Supported IP protocol versions of IP stack.
nsapi_event
Enum of event types.
signed int nsapi_size_or_error_t
Type used to represent either a size or error passed through sockets.
nsapi_stack_level
Enum of standardized stack option levels for use with NetworkStack::setstackopt and getstackopt.
nsapi_stack_option
Enum of standardized stack option names for level NSAPI_STACK of NetworkStack::setstackopt and getsta...
struct nsapi_pktinfo nsapi_pktinfo_t
nsapi_pktinfo structure
#define NSAPI_IP_BYTES
Maximum number of bytes for IP address.
struct nsapi_addr nsapi_addr_t
IP address structure for passing IP addresses by value.
struct nsapi_stagger_req nsapi_stagger_req_t
nsapi_stagger_req structure
signed int nsapi_value_or_error_t
Type used to represent either a value or error.
struct nsapi_latency_req nsapi_latency_req_t
nsapi_latency_req structure
struct nsapi_stack nsapi_stack_t
nsapi_stack structure
nsapi_connection_status
Enum of connection status types.
signed int nsapi_error_t
Type used to represent error codes.
nsapi_socket_level
Enum of standardized socket option levels for use with Socket::setsockopt and getsockopt.
struct nsapi_stack_api nsapi_stack_api_t
nsapi_stack_api structure
struct nsapi_ip_mreq nsapi_ip_mreq_t
nsapi_ip_mreq structure
struct nsapi_wifi_ap nsapi_wifi_ap_t
nsapi_wifi_ap structure
nsapi_error
Enum of standardized error codes.
nsapi_version
Enum of IP address versions.
nsapi_protocol
Enum of socket protocols.
void * nsapi_socket_t
Opaque handle for network sockets.
struct nsapi_msghdr nsapi_msghdr_t
Header structure for control info.
unsigned int nsapi_size_t
Type used to represent the size of data passed through sockets.
@ NSAPI_SECURITY_WPA_WPA2
@ NSAPI_SECURITY_WPA2_ENT
@ NSAPI_SECURITY_WPA3_WPA2
@ NSAPI_EVENT_CELLULAR_STATUS_END
@ NSAPI_EVENT_CELLULAR_STATUS_BASE
@ NSAPI_EVENT_CONNECTION_STATUS_CHANGE
@ NSAPI_STATUS_CONNECTING
@ NSAPI_STATUS_DISCONNECTED
@ NSAPI_ERROR_IN_PROGRESS
@ NSAPI_ERROR_DEVICE_ERROR
@ NSAPI_ERROR_DNS_FAILURE
@ NSAPI_ERROR_IS_CONNECTED
@ NSAPI_ERROR_DHCP_FAILURE
@ NSAPI_ERROR_ADDRESS_IN_USE
@ NSAPI_ERROR_WOULD_BLOCK
@ NSAPI_ERROR_AUTH_FAILURE
@ NSAPI_ERROR_NO_CONNECTION
@ NSAPI_ERROR_CONNECTION_LOST
@ NSAPI_ERROR_CONNECTION_TIMEOUT
@ NSAPI_ERROR_UNSUPPORTED
@ NSAPI_TLSSOCKET_SET_HOSTNAME
@ NSAPI_TLSSOCKET_SET_CLKEY
@ NSAPI_TLSSOCKET_SET_CACERT
@ NSAPI_TLSSOCKET_SET_CLCERT
IP address structure for passing IP addresses by value.
nsapi_version_t version
IP version.
uint8_t bytes[16]
IP address The raw bytes of the IP address stored in big-endian format.
nsapi_latency_req structure
Header structure for control info.
nsapi_stack_api structure
nsapi_error_t(* socket_listen)(nsapi_stack_t *stack, nsapi_socket_t socket, int backlog)
Listen for connections on a TCP socket.
nsapi_error_t(* gethostbyname)(nsapi_stack_t *stack, const char *host, nsapi_addr_t *addr, nsapi_version_t version)
Translates a hostname to an IP address.
nsapi_size_or_error_t(* socket_sendto)(nsapi_stack_t *stack, nsapi_socket_t socket, nsapi_addr_t addr, uint16_t port, const void *data, nsapi_size_t size)
Send a packet over a UDP socket.
nsapi_size_or_error_t(* socket_recv)(nsapi_stack_t *stack, nsapi_socket_t socket, void *data, nsapi_size_t size)
Receive data over a TCP socket.
nsapi_error_t(* socket_accept)(nsapi_stack_t *stack, nsapi_socket_t server, nsapi_socket_t *socket, nsapi_addr_t *addr, uint16_t *port)
Accepts a connection on a TCP socket.
nsapi_error_t(* socket_close)(nsapi_stack_t *stack, nsapi_socket_t socket)
Close the socket.
nsapi_error_t(* socket_open)(nsapi_stack_t *stack, nsapi_socket_t *socket, nsapi_protocol_t proto)
Opens a socket.
nsapi_error_t(* socket_connect)(nsapi_stack_t *stack, nsapi_socket_t socket, nsapi_addr_t addr, uint16_t port)
Connects TCP socket to a remote host.
nsapi_addr_t(* get_ip_address)(nsapi_stack_t *stack)
Get the local IP address.
nsapi_error_t(* add_dns_server)(nsapi_stack_t *stack, nsapi_addr_t addr)
Add a domain name server to list of servers to query.
nsapi_size_or_error_t(* socket_recvfrom)(nsapi_stack_t *stack, nsapi_socket_t socket, nsapi_addr_t *addr, uint16_t *port, void *buffer, nsapi_size_t size)
Receive a packet over a UDP socket.
nsapi_error_t(* setstackopt)(nsapi_stack_t *stack, int level, int optname, const void *optval, unsigned optlen)
Set stack-specific stack options.
nsapi_error_t(* socket_bind)(nsapi_stack_t *stack, nsapi_socket_t socket, nsapi_addr_t addr, uint16_t port)
Bind a specific address to a socket.
nsapi_error_t(* setsockopt)(nsapi_stack_t *stack, nsapi_socket_t socket, int level, int optname, const void *optval, unsigned optlen)
Set stack-specific socket options.
nsapi_error_t(* getsockopt)(nsapi_stack_t *stack, nsapi_socket_t socket, int level, int optname, void *optval, unsigned *optlen)
Get stack-specific socket options.
nsapi_error_t(* getstackopt)(nsapi_stack_t *stack, int level, int optname, void *optval, unsigned *optlen)
Get stack-specific stack options.
void(* socket_attach)(nsapi_stack_t *stack, nsapi_socket_t socket, void(*callback)(void *), void *data)
Register a callback on state change of the socket.
nsapi_size_or_error_t(* socket_send)(nsapi_stack_t *stack, nsapi_socket_t socket, const void *data, nsapi_size_t size)
Send data over a TCP socket.
const struct nsapi_stack_api * stack_api
Network stack operation table.
void * stack
Opaque handle for network stacks.
nsapi_stagger_req structure