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;
190 #endif // INTERNETSOCKET_H nsapi_error_t open(NetworkStack *stack)
Open a network socket on the network stack of the given network interface.
Socket implementation that uses IP network stack.
~InternetSocket() override
Destroy the socket.
DTLSSocket implement DTLS stream over UDP Socket.
NetworkStack * nsapi_create_stack(nsapi_stack_t *stack)
Convert a raw nsapi_stack_t object into a C++ NetworkStack object.
int join_multicast_group(const SocketAddress &address)
Subscribe to an IP multicast group.
The EventFlags class is used to control event flags or wait for event flags other threads control...
void * nsapi_socket_t
Opaque handle for network sockets.
signed int nsapi_error_t
Type used to represent error codes.
#define NSAPI_INTERFACE_NAME_MAX_SIZE
Maximum size of network interface name.
A lock-free, primitive atomic flag.
void set_blocking(bool blocking) override
Set blocking or non-blocking mode of the socket.
void set_timeout(int timeout) override
Set timeout on blocking socket operations.
Abstract Socket interface.
int get_rtt_estimate_to_address(const SocketAddress &address, uint32_t *rtt_estimate)
Get estimated round trip time to destination address.
nsapi_error_t setsockopt(int level, int optname, const void *optval, unsigned optlen) override
Set socket options.
The Mutex class is used to synchronize the execution of threads.
nsapi_error_t getpeername(SocketAddress *address) override
Get the remote-end peer associated with this socket.
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 getsockopt(int level, int optname, void *optval, unsigned *optlen) override
Get socket options.
nsapi_error_t close() override
defined(DOXYGEN_ONLY)
Callback class based on template specialization.
nsapi_error_t bind(uint16_t port)
Bind the socket to a port on which to receive data.
void sigio(mbed::Callback< void()> func) override
Register a callback on state change of the socket.