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" 53 #if !defined(DOXYGEN_ONLY) 134 "The behavior of Socket::attach differs from other attach functions in " 135 "Mbed OS and has been known to cause confusion. Replaced by Socket::sigio.")
145 template <
typename T,
typename M>
147 "The attach function does not support cv-qualifiers. Replaced by " 148 "attach(callback(obj, method)).")
149 void attach(T *obj, M method)
154 #if !defined(DOXYGEN_ONLY) 158 virtual nsapi_protocol_t get_proto() = 0;
159 virtual void event();
160 int modify_multicast_group(
const SocketAddress &address, nsapi_socket_option_t socketopt);
173 bool _factory_allocated;
176 static const int READ_FLAG = 0x1u;
177 static const int WRITE_FLAG = 0x2u;
178 static const int FINISHED_FLAG = 0x3u;
186 #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.
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 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.