20 #ifndef INTERNETSOCKET_H 21 #define INTERNETSOCKET_H 25 #include "rtos/Mutex.h" 26 #include "rtos/EventFlags.h" 28 #include "mbed_atomic.h" 29 #include "mbed_toolchain.h" 30 #include "SocketStats.h" 57 #if !defined(DOXYGEN_ONLY) 177 "The behavior of Socket::attach differs from other attach functions in " 178 "Mbed OS and has been known to cause confusion. Replaced by Socket::sigio.")
188 template <
typename T,
typename M>
190 "The attach function does not support cv-qualifiers. Replaced by " 191 "attach(callback(obj, method)).")
192 void attach(T *obj, M method)
197 #if !defined(DOXYGEN_ONLY) 201 virtual nsapi_protocol_t get_proto() = 0;
202 virtual void event();
203 int modify_multicast_group(
const SocketAddress &address, nsapi_socket_option_t socketopt);
216 bool _factory_allocated;
219 static const int READ_FLAG = 0x1u;
220 static const int WRITE_FLAG = 0x2u;
221 static const int FINISHED_FLAG = 0x3u;
229 #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.
DTLSSocket implement DTLS stream over UDP Socket.
virtual void sigio(mbed::Callback< void()> func)
Register a callback on state change of the 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...
virtual nsapi_error_t getpeername(SocketAddress *address)
Get the remote-end peer associated with this socket.
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.
Abstract Socket interface.
int get_rtt_estimate_to_address(const SocketAddress &address, uint32_t *rtt_estimate)
Get estimated round trip time to destination address.
virtual ~InternetSocket()
Destroy the socket.
void attach(mbed::Callback< void()> func)
Register a callback on state change of the socket.
virtual nsapi_error_t close()
defined(DOXYGEN_ONLY)
virtual nsapi_error_t getsockopt(int level, int optname, void *optval, unsigned *optlen)
Get socket options.
The Mutex class is used to synchronize the execution of threads.
virtual nsapi_error_t setsockopt(int level, int optname, const void *optval, unsigned optlen)
Set socket options.
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.
virtual void set_blocking(bool blocking)
Set blocking or non-blocking mode of the socket.
virtual void set_timeout(int timeout)
Set timeout on blocking socket operations.
Callback class based on template specialization.
nsapi_error_t bind(uint16_t port)
Bind the socket to a port on which to receive data.