#include "net_socket_posix.h"
#ifndef UNIX_SOCKET_UNAVAILABLE
#if defined(UNIX_ENABLED)
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#ifdef WEB_ENABLED
#include <arpa/inet.h>
#endif
#if !defined(IPV6_ADD_MEMBERSHIP) && defined(IPV6_JOIN_GROUP)
#define IPV6_ADD_MEMBERSHIP …
#endif
#if !defined(IPV6_DROP_MEMBERSHIP) && defined(IPV6_LEAVE_GROUP)
#define IPV6_DROP_MEMBERSHIP …
#endif
#define SOCK_EMPTY …
#define SOCK_BUF(x) …
#define SOCK_CBUF(x) …
#define SOCK_IOCTL …
#define SOCK_FIONREAD_LEN_TYPE …
#define SOCK_CLOSE …
#define SOCK_CONNECT(p_sock, p_addr, p_addr_len) …
#elif defined(WINDOWS_ENABLED)
#include <winsock2.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#define SOCK_EMPTY …
#define SOCK_BUF …
#define SOCK_CBUF …
#define SOCK_IOCTL …
#define SOCK_FIONREAD_LEN_TYPE …
#define SOCK_CLOSE …
#define SOCK_CONNECT …
#if defined(__MINGW32__) && !defined(SIO_UDP_NETRESET)
#define SIO_UDP_NETRESET …
#endif
#endif
size_t NetSocketPosix::_set_addr_storage(struct sockaddr_storage *p_addr, const IPAddress &p_ip, uint16_t p_port, IP::Type p_ip_type) { … }
void NetSocketPosix::_set_ip_port(struct sockaddr_storage *p_addr, IPAddress *r_ip, uint16_t *r_port) { … }
NetSocket *NetSocketPosix::_create_func() { … }
void NetSocketPosix::make_default() { … }
void NetSocketPosix::cleanup() { … }
NetSocketPosix::NetSocketPosix() : … { … }
NetSocketPosix::~NetSocketPosix() { … }
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
NetSocketPosix::NetError NetSocketPosix::_get_socket_error() const { … }
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
bool NetSocketPosix::_can_use_ip(const IPAddress &p_ip, const bool p_for_bind) const { … }
_FORCE_INLINE_ Error NetSocketPosix::_change_multicast_group(IPAddress p_ip, String p_if_name, bool p_add) { … }
void NetSocketPosix::_set_socket(SOCKET_TYPE p_sock, IP::Type p_ip_type, bool p_is_stream) { … }
void NetSocketPosix::_set_close_exec_enabled(bool p_enabled) { … }
Error NetSocketPosix::open(Type p_sock_type, IP::Type &ip_type) { … }
void NetSocketPosix::close() { … }
Error NetSocketPosix::bind(IPAddress p_addr, uint16_t p_port) { … }
Error NetSocketPosix::listen(int p_max_pending) { … }
Error NetSocketPosix::connect_to_host(IPAddress p_host, uint16_t p_port) { … }
Error NetSocketPosix::poll(PollType p_type, int p_timeout) const { … }
Error NetSocketPosix::recv(uint8_t *p_buffer, int p_len, int &r_read) { … }
Error NetSocketPosix::recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IPAddress &r_ip, uint16_t &r_port, bool p_peek) { … }
Error NetSocketPosix::send(const uint8_t *p_buffer, int p_len, int &r_sent) { … }
Error NetSocketPosix::sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IPAddress p_ip, uint16_t p_port) { … }
Error NetSocketPosix::set_broadcasting_enabled(bool p_enabled) { … }
void NetSocketPosix::set_blocking_enabled(bool p_enabled) { … }
void NetSocketPosix::set_ipv6_only_enabled(bool p_enabled) { … }
void NetSocketPosix::set_tcp_no_delay_enabled(bool p_enabled) { … }
void NetSocketPosix::set_reuse_address_enabled(bool p_enabled) { … }
void NetSocketPosix::set_reuse_port_enabled(bool p_enabled) { … }
bool NetSocketPosix::is_open() const { … }
int NetSocketPosix::get_available_bytes() const { … }
Error NetSocketPosix::get_socket_address(IPAddress *r_ip, uint16_t *r_port) const { … }
Ref<NetSocket> NetSocketPosix::accept(IPAddress &r_ip, uint16_t &r_port) { … }
Error NetSocketPosix::join_multicast_group(const IPAddress &p_multi_address, const String &p_if_name) { … }
Error NetSocketPosix::leave_multicast_group(const IPAddress &p_multi_address, const String &p_if_name) { … }
#endif