26 switch (addr_.
ss.ss_family) {
40 bool unnamed_unix_socket) {
42 (
addr.
ss.ss_family == AF_UNIX));
43 switch (
addr.
ss.ss_family) {
45 return sizeof(
struct sockaddr_in6);
47 return sizeof(
struct sockaddr_in);
59 if (!unnamed_unix_socket &&
addr.
un.sun_path[0] ==
'\0') {
60 intptr_t
i =
sizeof(
addr.
un.sun_path) - 1;
61 while (
addr.
un.sun_path[
i] ==
'\0') {
66 return sizeof(
struct sockaddr_un) - nulls;
76 return (
addr.
ss.ss_family == AF_INET6) ?
sizeof(
struct in6_addr)
77 : sizeof(struct in_addr);
81 if (
a.ss.ss_family !=
b.ss.ss_family) {
84 if (
a.ss.ss_family == AF_INET) {
85 return memcmp(&
a.in.sin_addr, &
b.in.sin_addr,
sizeof(
a.in.sin_addr)) == 0;
86 }
else if (
a.ss.ss_family == AF_INET6) {
87 return memcmp(&
a.in6.sin6_addr, &
b.in6.sin6_addr,
88 sizeof(
a.in6.sin6_addr)) == 0 &&
89 a.in6.sin6_scope_id ==
b.in6.sin6_scope_id;
90 }
else if (
a.ss.ss_family == AF_UNIX) {
93 int len =
sizeof(
a.un.sun_path);
94 for (
int i = 0;
i <
len;
i++) {
95 if (
a.un.sun_path[
i] !=
b.un.sun_path[
i])
return false;
96 if (
a.un.sun_path[
i] ==
'\0')
return true;
107 uint8_t*
data =
nullptr;
110 obj, &data_type,
reinterpret_cast<void**
>(&
data), &
len);
115 ((
len !=
sizeof(in_addr)) && (
len !=
sizeof(in6_addr)))) {
118 memset(
reinterpret_cast<void*
>(
addr), 0,
sizeof(
RawAddr));
119 if (
len ==
sizeof(in_addr)) {
120 addr->
in.sin_family = AF_INET;
121 memmove(
reinterpret_cast<void*
>(&
addr->
in.sin_addr),
data,
len);
124 addr->
in6.sin6_family = AF_INET6;
125 memmove(
reinterpret_cast<void*
>(&
addr->
in6.sin6_addr),
data,
len);
133#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
136 bool is_abstract = (
path[0] ==
'@');
145 if (
sizeof(
path) >
sizeof(
addr->
un.sun_path)) {
147 "The length of path exceeds the limit. "
148 "Check out man 7 unix page",
152 addr->
un.sun_family = AF_UNIX;
154#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
157 addr->
un.sun_path[0] =
'\0';
178 if (
addr->
ss.ss_family == AF_INET) {
180 }
else if (
addr->
ss.ss_family == AF_INET6) {
188 if (
addr.
ss.ss_family == AF_INET) {
189 return ntohs(
addr.
in.sin_port);
190 }
else if (
addr.
ss.ss_family == AF_INET6) {
191 return ntohs(
addr.
in6.sin6_port);
192 }
else if (
addr.
ss.ss_family == AF_UNIX) {
207 if (
addr.
addr.sa_family == AF_INET6) {
223 if (
addr.
addr.sa_family == AF_INET6) {
224 in_addr =
reinterpret_cast<const void*
>(&
addr.
in6.sin6_addr);
226 in_addr =
reinterpret_cast<const void*
>(&
addr.
in.sin_addr);
233 if (
addr->
addr.sa_family != AF_INET6)
return;
234 addr->
in6.sin6_scope_id = scope_id;
238 if (
addr.
addr.sa_family == AF_INET6) {
246 const char* address =
248 ASSERT(address !=
nullptr);
250 memset(&raw, 0,
sizeof(raw));
254 raw.
addr.sa_family = AF_INET;
256 raw.
addr.sa_family = AF_INET6;
268 const char* address =
272 ASSERT(address !=
nullptr);
276 if (addresses !=
nullptr) {
291 char str[INET6_ADDRSTRLEN];
300 intptr_t error_number =
307 ASSERT(address !=
nullptr);
309 memset(&raw, 0,
sizeof(raw));
313 raw.
addr.sa_family = AF_INET;
315 raw.
addr.sa_family = AF_INET6;
320#if !defined(DART_HOST_OS_WINDOWS)
329 ssize_t num_bytes_left = num_bytes;
330 while (num_bytes_left > 0) {
331 ssize_t written_bytes = WriteImpl(fd,
buffer, num_bytes_left, sync);
332 static_assert(EAGAIN == EWOULDBLOCK);
333 if (written_bytes == -1) {
334 if ((sync == kAsync) && (errno == EWOULDBLOCK)) {
341 num_bytes_left -= written_bytes;
342 buffer =
static_cast<const char*
>(
buffer) + written_bytes;
345 return num_bytes - num_bytes_left;
static bool ok(int result)
#define FUNCTION_NAME(name)
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
T * GetAt(intptr_t i) const
static Dart_CObject * NewUint8Array(const void *data, intptr_t length)
static Dart_Handle NewDartOSError()
static const char * GetStringValue(Dart_Handle str_obj)
static Dart_Handle NewString(const char *str)
static intptr_t GetIntptrValue(Dart_Handle value_obj)
const char * path() const
static void SetAddrScope(RawAddr *addr, intptr_t scope_id)
static void GetSockAddr(Dart_Handle obj, RawAddr *addr)
static int16_t FromType(int type)
static intptr_t GetAddrScope(const RawAddr &addr)
static void SetAddrPort(RawAddr *addr, intptr_t port)
static CObjectUint8Array * ToCObject(const RawAddr &addr)
static bool AreAddressesEqual(const RawAddr &a, const RawAddr &b)
static intptr_t GetAddrLength(const RawAddr &addr, bool unnamed_unix_socket=false)
static Dart_Handle GetUnixDomainSockAddr(const char *path, Namespace *namespc, RawAddr *addr)
static Dart_Handle ToTypedData(const RawAddr &addr)
static intptr_t GetAddrPort(const RawAddr &addr)
static intptr_t GetInAddrLength(const RawAddr &addr)
const RawAddr & addr() const
static AddressList< SocketAddress > * LookupAddress(const char *host, int type, OSError **os_error)
static bool ParseAddress(int type, const char *address, RawAddr *addr)
static bool IsBindError(intptr_t error_number)
static bool IsValidAddress(const char *address)
static bool RawAddrToString(RawAddr *addr, char *str)
static intptr_t Write(intptr_t fd, const void *buffer, intptr_t num_bytes, SocketOpKind sync)
struct _Dart_Handle * Dart_Handle
struct _Dart_NativeArguments * Dart_NativeArguments
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static Dart_Handle ThrowIfError(Dart_Handle handle)
void FUNCTION_NAME() InternetAddress_RawAddrToString(Dart_NativeArguments args)
void FUNCTION_NAME() SocketBase_IsBindError(Dart_NativeArguments args)
void FUNCTION_NAME() InternetAddress_ParseScopedLinkLocalAddress(Dart_NativeArguments args)
void FUNCTION_NAME() InternetAddress_Parse(Dart_NativeArguments args)
DART_EXPORT void Dart_SetBooleanReturnValue(Dart_NativeArguments args, bool retval)
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type, intptr_t length)
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, intptr_t offset, const uint8_t *native_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_NewApiError(const char *error)
DART_EXPORT Dart_Handle Dart_Null()
static int8_t data[kExtLength]
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service port
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
struct sockaddr_storage ss