godot/drivers/unix/net_socket_unix.cpp

/**************************************************************************/
/*  net_socket_unix.cpp                                                   */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

// Some proprietary Unix-derived platforms don't expose Unix sockets
// so this allows skipping this file to reimplement this API differently.
#if defined(UNIX_ENABLED) && !defined(UNIX_SOCKET_UNAVAILABLE)

#include "net_socket_unix.h"

#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

// BSD calls this flag IPV6_JOIN_GROUP
#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

size_t NetSocketUnix::_set_addr_storage(struct sockaddr_storage *p_addr, const IPAddress &p_ip, uint16_t p_port, IP::Type p_ip_type) {}

void NetSocketUnix::_set_ip_port(struct sockaddr_storage *p_addr, IPAddress *r_ip, uint16_t *r_port) {}

NetSocket *NetSocketUnix::_create_func() {}

void NetSocketUnix::make_default() {}

void NetSocketUnix::cleanup() {}

NetSocketUnix::NetSocketUnix() {}

NetSocketUnix::~NetSocketUnix() {}

// Silence a warning reported in GH-27594.
// EAGAIN and EWOULDBLOCK have the same value on most platforms, but it's not guaranteed.
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif

NetSocketUnix::NetError NetSocketUnix::_get_socket_error() const {}

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

bool NetSocketUnix::_can_use_ip(const IPAddress &p_ip, const bool p_for_bind) const {}

_FORCE_INLINE_ Error NetSocketUnix::_change_multicast_group(IPAddress p_ip, String p_if_name, bool p_add) {}

void NetSocketUnix::_set_socket(int p_sock, IP::Type p_ip_type, bool p_is_stream) {}

void NetSocketUnix::_set_close_exec_enabled(bool p_enabled) {}

Error NetSocketUnix::open(Type p_sock_type, IP::Type &ip_type) {}

void NetSocketUnix::close() {}

Error NetSocketUnix::bind(IPAddress p_addr, uint16_t p_port) {}

Error NetSocketUnix::listen(int p_max_pending) {}

Error NetSocketUnix::connect_to_host(IPAddress p_host, uint16_t p_port) {}

Error NetSocketUnix::poll(PollType p_type, int p_timeout) const {}

Error NetSocketUnix::recv(uint8_t *p_buffer, int p_len, int &r_read) {}

Error NetSocketUnix::recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IPAddress &r_ip, uint16_t &r_port, bool p_peek) {}

Error NetSocketUnix::send(const uint8_t *p_buffer, int p_len, int &r_sent) {}

Error NetSocketUnix::sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IPAddress p_ip, uint16_t p_port) {}

Error NetSocketUnix::set_broadcasting_enabled(bool p_enabled) {}

void NetSocketUnix::set_blocking_enabled(bool p_enabled) {}

void NetSocketUnix::set_ipv6_only_enabled(bool p_enabled) {}

void NetSocketUnix::set_tcp_no_delay_enabled(bool p_enabled) {}

void NetSocketUnix::set_reuse_address_enabled(bool p_enabled) {}

bool NetSocketUnix::is_open() const {}

int NetSocketUnix::get_available_bytes() const {}

Error NetSocketUnix::get_socket_address(IPAddress *r_ip, uint16_t *r_port) const {}

Ref<NetSocket> NetSocketUnix::accept(IPAddress &r_ip, uint16_t &r_port) {}

Error NetSocketUnix::join_multicast_group(const IPAddress &p_multi_address, const String &p_if_name) {}

Error NetSocketUnix::leave_multicast_group(const IPAddress &p_multi_address, const String &p_if_name) {}

#endif // UNIX_ENABLED && !UNIX_SOCKET_UNAVAILABLE