21#ifndef INTERNETSOCKET_H
22#define INTERNETSOCKET_H
26#include "rtos/Mutex.h"
27#include "rtos/EventFlags.h"
29#include "mbed_atomic.h"
30#include "mbed_toolchain.h"
31#include "SocketStats.h"
58#if !defined(DOXYGEN_ONLY)
158#if !defined(DOXYGEN_ONLY)
162 virtual nsapi_protocol_t get_proto() = 0;
164 int modify_multicast_group(
const SocketAddress &address, nsapi_socket_option_t socketopt);
168 uint32_t _timeout = osWaitForever;
174 uint8_t _readers = 0;
175 uint8_t _writers = 0;
177 bool _factory_allocated =
false;
180 static const int READ_FLAG = 0x1u;
181 static const int WRITE_FLAG = 0x2u;
182 static const int FINISHED_FLAG = 0x3u;
Abstract Socket interface.
DTLSSocket implement DTLS stream over UDP Socket.
Socket implementation that uses IP network stack.
int get_rtt_estimate_to_address(const SocketAddress &address, uint32_t *rtt_estimate)
Get estimated round trip time to destination address.
int get_stagger_estimate_to_address(const SocketAddress &address, uint16_t data_amount, uint16_t *stagger_min, uint16_t *stagger_max, uint16_t *stagger_rand)
Get estimated stagger value.
int leave_multicast_group(const SocketAddress &address)
Leave an IP multicast group.
nsapi_error_t bind(const SocketAddress &address) override
Bind a specific address to a socket.
void sigio(mbed::Callback< void()> func) override
Register a callback on state change of the socket.
void set_blocking(bool blocking) override
Set blocking or non-blocking mode of the socket.
nsapi_error_t open(NetworkStack *stack)
Open a network socket on the network stack of the given network interface.
int join_multicast_group(const SocketAddress &address)
Subscribe to an IP multicast group.
void set_timeout(int timeout) override
Set timeout on blocking socket operations.
nsapi_error_t getsockopt(int level, int optname, void *optval, unsigned *optlen) override
Get socket options.
~InternetSocket() override
Destroy the socket.
nsapi_error_t close() override
defined(DOXYGEN_ONLY)
nsapi_error_t bind(uint16_t port)
Bind the socket to a port on which to receive data.
nsapi_error_t getpeername(SocketAddress *address) override
Get the remote-end peer associated with this socket.
nsapi_error_t setsockopt(int level, int optname, const void *optval, unsigned optlen) override
Set socket options.
Callback class based on template specialization.
The EventFlags class is used to control event flags or wait for event flags other threads control.
The Mutex class is used to synchronize the execution of threads.
signed int nsapi_error_t
Type used to represent error codes.
NetworkStack * nsapi_create_stack(nsapi_stack_t *stack)
Convert a raw nsapi_stack_t object into a C++ NetworkStack object.
void * nsapi_socket_t
Opaque handle for network sockets.
#define NSAPI_INTERFACE_NAME_MAX_SIZE
Maximum size of network interface name.
A lock-free, primitive atomic flag.