5#ifdef USE_SOCKET_IMPL_LWIP_SOCKETS
17 if (!monitor_loop || this->
fd_ < 0)
19#ifdef USE_LWIP_FAST_SELECT
33#ifdef USE_LWIP_FAST_SELECT
45 int ret = lwip_close(this->
fd_);
51 int fl = lwip_fcntl(this->
fd_, F_GETFL, 0);
57 lwip_fcntl(this->
fd_, F_SETFL, fl);
82static std::unique_ptr<LwIPSocketImpl> create_socket(
int domain,
int type,
int protocol,
bool loop_monitored =
false) {
83 int ret = lwip_socket(domain,
type, protocol);
86 return make_unique<LwIPSocketImpl>(ret, loop_monitored);
89std::unique_ptr<Socket> socket(
int domain,
int type,
int protocol) {
90 return create_socket(domain,
type, protocol,
false);
94 return create_socket(domain,
type, protocol,
true);
int setblocking(bool blocking)
int getsockname(struct sockaddr *addr, socklen_t *addrlen)
size_t getsockname_to(std::span< char, SOCKADDR_STR_LEN > buf)
Format local address into a fixed-size buffer (no heap allocation)
struct lwip_sock * cached_sock_
LwIPSocketImpl(int fd, bool monitor_loop=false)
int getpeername(struct sockaddr *addr, socklen_t *addrlen)
size_t getpeername_to(std::span< char, SOCKADDR_STR_LEN > buf)
Format peer address into a fixed-size buffer (no heap allocation)
size_t format_sockaddr_to(const struct sockaddr *addr_ptr, socklen_t len, std::span< char, SOCKADDR_STR_LEN > buf)
Format sockaddr into caller-provided buffer, returns length written (excluding null)
struct lwip_sock * hook_fd_for_fast_select(int fd)
Resolve an fd to its lwip_sock and install the netconn event-callback hook so the main loop is woken ...
std::unique_ptr< Socket > socket_loop_monitored(int domain, int type, int protocol)
Create a socket and monitor it for data in the main loop.
bool wake_register_fd(int fd)
Register a socket file descriptor with the host select() loop.
void wake_unregister_fd(int fd)
Unregister a socket file descriptor. Not thread-safe — main loop only.
Platform-specific main loop wake primitives.