5#ifndef RUNTIME_BIN_SOCKET_BASE_H_
6#define RUNTIME_BIN_SOCKET_BASE_H_
10#if defined(DART_HOST_OS_FUCHSIA)
12#elif defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
14#elif defined(DART_HOST_OS_MACOS)
16#elif defined(DART_HOST_OS_WINDOWS)
19#error Unknown target os.
34 struct sockaddr_in
in;
35 struct sockaddr_in6
in6;
36 struct sockaddr_un
un;
37 struct sockaddr_storage
ss;
61 explicit SocketAddress(
struct sockaddr* sa,
bool unnamed_unix_socket =
false);
67 const char*
as_string()
const {
return as_string_; }
71 bool unnamed_unix_socket =
false);
87#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
88 defined(DART_HOST_OS_ANDROID)
92 static constexpr intptr_t kMaxUnixPathLength =
93 sizeof(((
struct sockaddr_un*)
nullptr)->sun_path);
94 char as_string_[kMaxUnixPathLength];
96 char as_string_[INET6_ADDRSTRLEN];
121 const char* interface_name_;
122 intptr_t interface_index_;
131 : count_(
count), addresses_(new
T*[count_]) {}
134 for (intptr_t
i = 0;
i < count_;
i++) {
135 delete addresses_[
i];
140 intptr_t
count()
const {
return count_; }
141 T*
GetAt(intptr_t
i)
const {
return addresses_[
i]; }
145 const intptr_t count_;
159 intptr_t
level()
const {
return level_; }
160 intptr_t
type()
const {
return type_; }
161 void*
data()
const {
return data_; }
167 const intptr_t level_;
168 const intptr_t type_;
170 const size_t data_length_;
191 static intptr_t
Read(intptr_t fd,
195 static intptr_t
Write(intptr_t fd,
210 size_t buffer_num_bytes,
212 intptr_t num_messages,
222 int64_t* p_buffer_num_bytes,
264#if defined(DART_HOST_OS_WINDOWS)
265 static bool HasPendingWrite(intptr_t fd);
292#if !defined(DART_HOST_OS_WINDOWS)
293 static intptr_t WriteImpl(intptr_t fd,
299 DISALLOW_ALLOCATION();
AddressList(intptr_t count)
void SetAt(intptr_t i, T *addr)
T * GetAt(intptr_t i) const
int interface_index() const
SocketAddress * socket_address() const
const char * interface_name() const
~InterfaceSocketAddress()
InterfaceSocketAddress(struct sockaddr *sa, const char *interface_name, intptr_t interface_index)
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)
const char * as_string() const
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)
SocketAddress(struct sockaddr *sa, bool unnamed_unix_socket=false)
static intptr_t GetAddrPort(const RawAddr &addr)
static intptr_t GetInAddrLength(const RawAddr &addr)
const RawAddr & addr() const
static bool LeaveMulticast(intptr_t fd, const RawAddr &addr, const RawAddr &interface, int interfaceIndex)
static bool AvailableDatagram(intptr_t fd, void *buffer, intptr_t num_bytes)
static int GetType(intptr_t fd)
static AddressList< SocketAddress > * LookupAddress(const char *host, int type, OSError **os_error)
static bool SetMulticastHops(intptr_t fd, intptr_t protocol, int value)
static intptr_t GetStdioHandle(intptr_t num)
static intptr_t ReceiveMessage(intptr_t fd, void *buffer, int64_t *p_buffer_num_bytes, SocketControlMessage **p_messages, SocketOpKind sync, OSError *p_oserror)
static bool SetOption(intptr_t fd, int level, int option, const char *data, int length)
static SocketAddress * GetRemotePeer(intptr_t fd, intptr_t *port)
static bool FormatNumericAddress(const RawAddr &addr, char *address, int len)
static bool SetNoDelay(intptr_t fd, bool enabled)
static bool GetSocketName(intptr_t fd, SocketAddress *p_sa)
static bool ParseAddress(int type, const char *address, RawAddr *addr)
static intptr_t Available(intptr_t fd)
static void Close(intptr_t fd)
static void GetError(intptr_t fd, OSError *os_error)
static intptr_t RecvFrom(intptr_t fd, void *buffer, intptr_t num_bytes, RawAddr *addr, SocketOpKind sync)
static bool IsBindError(intptr_t error_number)
static intptr_t Read(intptr_t fd, void *buffer, intptr_t num_bytes, SocketOpKind sync)
static bool SetBroadcast(intptr_t fd, bool value)
static bool GetNoDelay(intptr_t fd, bool *enabled)
static bool SetMulticastLoop(intptr_t fd, intptr_t protocol, bool enabled)
static bool IsValidAddress(const char *address)
static bool GetOption(intptr_t fd, int level, int option, char *data, unsigned int *length)
static bool ReverseLookup(const RawAddr &addr, char *host, intptr_t host_len, OSError **os_error)
static bool RawAddrToString(RawAddr *addr, char *str)
static intptr_t SendTo(intptr_t fd, const void *buffer, intptr_t num_bytes, const RawAddr &addr, SocketOpKind sync)
static bool GetMulticastHops(intptr_t fd, intptr_t protocol, int *value)
static bool GetMulticastLoop(intptr_t fd, intptr_t protocol, bool *enabled)
static bool JoinMulticast(intptr_t fd, const RawAddr &addr, const RawAddr &interface, int interfaceIndex)
static intptr_t SendMessage(intptr_t fd, void *buffer, size_t buffer_num_bytes, SocketControlMessage *messages, intptr_t num_messages, SocketOpKind sync, OSError *p_oserror)
static AddressList< InterfaceSocketAddress > * ListInterfaces(int type, OSError **os_error)
static bool GetBroadcast(intptr_t fd, bool *value)
static intptr_t Write(intptr_t fd, const void *buffer, intptr_t num_bytes, SocketOpKind sync)
static intptr_t GetPort(intptr_t fd)
bool is_file_descriptors_control_message()
SocketControlMessage(intptr_t level, intptr_t type, void *data, size_t data_length)
size_t data_length() const
struct _Dart_Handle * Dart_Handle
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 host
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