6#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
13#include <netinet/tcp.h>
30 int len =
sizeof(errno);
33 reinterpret_cast<socklen_t*
>(&len)));
44 if (S_ISCHR(buf.st_mode)) {
47 if (S_ISFIFO(buf.st_mode)) {
50 if (S_ISREG(buf.st_mode)) {
60 struct addrinfo hints;
61 memset(&hints, 0,
sizeof(hints));
63 hints.ai_socktype = SOCK_STREAM;
64 hints.ai_flags = AI_ADDRCONFIG;
65 hints.ai_protocol = IPPROTO_TCP;
66 struct addrinfo*
info =
nullptr;
74 ASSERT(*os_error ==
nullptr);
81 for (
struct addrinfo* c =
info; c !=
nullptr; c = c->ai_next) {
82 if ((c->ai_family == AF_INET) || (c->ai_family == AF_INET6)) {
87 AddressList<SocketAddress>* addresses =
new AddressList<SocketAddress>(
count);
88 for (
struct addrinfo* c =
info; c !=
nullptr; c = c->ai_next) {
89 if ((c->ai_family == AF_INET) || (c->ai_family == AF_INET6)) {
90 addresses->SetAt(i,
new SocketAddress(c->ai_addr));
101 int on = enabled ? 1 : 0;
104 : IPV6_MULTICAST_LOOP;
106 fd, level, optname,
reinterpret_cast<char*
>(&on),
sizeof(on))) ==
115 socklen_t optlen =
static_cast<socklen_t
>(*length);
117 *
length =
static_cast<unsigned int>(optlen);
124 int interfaceIndex) {
125 int proto =
addr.addr.sa_family == AF_INET ? IPPROTO_IP : IPPROTO_IPV6;
126 struct group_req mreq;
127 mreq.gr_interface = interfaceIndex;
130 setsockopt(fd, proto, MCAST_JOIN_GROUP, &mreq,
sizeof(mreq))) == 0;
136 int interfaceIndex) {
137 int proto =
addr.addr.sa_family == AF_INET ? IPPROTO_IP : IPPROTO_IPV6;
138 struct group_req mreq;
139 mreq.gr_interface = interfaceIndex;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static int16_t FromType(int type)
static intptr_t GetAddrLength(const RawAddr &addr, bool unnamed_unix_socket=false)
static bool LeaveMulticast(intptr_t fd, const RawAddr &addr, const RawAddr &interface, int interfaceIndex)
static int GetType(intptr_t fd)
static AddressList< SocketAddress > * LookupAddress(const char *host, int type, OSError **os_error)
static void GetError(intptr_t fd, OSError *os_error)
static bool SetMulticastLoop(intptr_t fd, intptr_t protocol, bool enabled)
static bool GetOption(intptr_t fd, int level, int option, char *data, unsigned int *length)
static bool JoinMulticast(intptr_t fd, const RawAddr &addr, const RawAddr &interface, int interfaceIndex)
static int8_t data[kExtLength]
#define NO_RETRY_EXPECTED(expression)
#define VOID_NO_RETRY_EXPECTED(expression)
#define TEMP_FAILURE_RETRY(expression)