5#ifndef RUNTIME_BIN_SOCKET_H_
6#define RUNTIME_BIN_SOCKET_H_
52 intptr_t
fd()
const {
return fd_; }
118 free(udp_receive_buffer_);
119 udp_receive_buffer_ =
nullptr;
122 static constexpr int kClosedFd = -1;
124 static bool short_socket_read_;
125 static bool short_socket_write_;
130 uint8_t* udp_receive_buffer_;
152 bool v6_only =
false);
161 DISALLOW_ALLOCATION();
168 : sockets_by_port_(SameIntptrValue, kInitialSocketsCount),
169 sockets_by_fd_(SameIntptrValue, kInitialSocketsCount),
170 unix_domain_sockets_(nullptr),
246 static constexpr intptr_t kInitialSocketsCount = 8;
248 OSSocket* FindOSSocketWithAddress(OSSocket* current,
const RawAddr&
addr) {
249 while (current !=
nullptr) {
253 current = current->next;
258 OSSocket* FindOSSocketWithPath(OSSocket* current,
261 while (current !=
nullptr) {
262 ASSERT(current->address.addr.sa_family == AF_UNIX);
263#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
265 if (
path[0] ==
'\0') {
266 condition = current->address.un.sun_path[0] ==
'\0' &&
267 strcmp(&(current->address.un.sun_path[1]),
path + 1) == 0;
282 current = current->next;
287 static bool SameIntptrValue(
void* key1,
void* key2) {
288 return reinterpret_cast<intptr_t
>(key1) ==
reinterpret_cast<intptr_t
>(key2);
291 static uint32_t GetHashmapHashFromIntptr(intptr_t
i) {
292 return static_cast<uint32_t
>((
i + 1) & 0xFFFFFFFF);
295 static void* GetHashmapKeyFromIntptr(intptr_t
i) {
296 return reinterpret_cast<void*
>(
i + 1);
299 OSSocket* LookupByPort(intptr_t
port);
300 void InsertByPort(intptr_t
port, OSSocket* socket);
301 void RemoveByPort(intptr_t
port);
303 OSSocket* LookupByFd(Socket* fd);
304 void InsertByFd(Socket* fd, OSSocket* socket);
305 void RemoveByFd(Socket* fd);
307 bool CloseOneSafe(OSSocket* os_socket, Socket* socket);
310 SimpleHashMap sockets_by_port_;
311 SimpleHashMap sockets_by_fd_;
313 OSSocket* unix_domain_sockets_;
static float next(float f)
static Identical AreIdentical(Namespace *namespc_1, const char *file_1, Namespace *namespc_2, const char *file_2)
Dart_Handle CreateBindListen(Dart_Handle socket_object, RawAddr addr, intptr_t backlog, bool v6_only, bool shared)
ListeningSocketRegistry()
bool CloseSafe(Socket *socketfd)
Dart_Handle CreateUnixDomainBindListen(Dart_Handle socket_object, Namespace *namespc, const char *path, intptr_t backlog, bool shared)
~ListeningSocketRegistry()
static ListeningSocketRegistry * Instance()
static intptr_t CreateBindListen(const RawAddr &addr, intptr_t backlog, bool v6_only=false)
static intptr_t Accept(intptr_t fd)
static constexpr intptr_t kTemporaryFailure
static bool StartAccept(intptr_t fd)
static intptr_t CreateUnixDomainBindListen(const RawAddr &addr, intptr_t backlog)
static bool AreAddressesEqual(const RawAddr &a, const RawAddr &b)
static bool IsSignalSocketFlag(intptr_t flag)
static CObject * ListInterfacesRequest(const CObjectArray &request)
static bool short_socket_read()
Dart_Port isolate_port() const
static void set_short_socket_read(bool short_socket_read)
static Dart_Port GetServicePort()
void set_udp_receive_buffer(uint8_t *buffer)
static CObject * ReverseLookupRequest(const CObjectArray &request)
static bool short_socket_write()
static intptr_t CreateUnixDomainConnect(const RawAddr &addr)
uint8_t * udp_receive_buffer() const
static void SetSocketIdNativeField(Dart_Handle handle, intptr_t id, SocketFinalizer finalizer)
static Socket * GetSocketIdNativeField(Dart_Handle socket)
static intptr_t CreateConnect(const RawAddr &addr)
void set_port(Dart_Port port)
static intptr_t CreateBindDatagram(const RawAddr &addr, bool reuseAddress, bool reusePort, int ttl=1)
static void ReuseSocketIdNativeField(Dart_Handle handle, Socket *socket, SocketFinalizer finalizer)
static CObject * LookupRequest(const CObjectArray &request)
static intptr_t CreateBindConnect(const RawAddr &addr, const RawAddr &source_addr)
static intptr_t CreateUnixDomainBindConnect(const RawAddr &addr, const RawAddr &source_addr)
static void set_short_socket_write(bool short_socket_write)
struct _Dart_Handle * Dart_Handle
FlutterSemanticsFlag flag
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