Flutter Engine
The Flutter Engine
Public Types | Static Public Member Functions | List of all members
dart::bin::SocketBase Class Reference

#include <socket_base.h>

Inheritance diagram for dart::bin::SocketBase:
dart::AllStatic

Public Types

enum  SocketRequest { kLookupRequest = 0 , kListInterfacesRequest = 1 , kReverseLookupRequest = 2 }
 
enum  SocketOpKind { kSync , kAsync }
 

Static Public Member Functions

static bool Initialize ()
 
static intptr_t Available (intptr_t fd)
 
static intptr_t Read (intptr_t fd, void *buffer, intptr_t num_bytes, SocketOpKind sync)
 
static intptr_t Write (intptr_t fd, const void *buffer, intptr_t num_bytes, SocketOpKind sync)
 
static intptr_t SendTo (intptr_t fd, const void *buffer, intptr_t num_bytes, const RawAddr &addr, SocketOpKind sync)
 
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 intptr_t RecvFrom (intptr_t fd, void *buffer, intptr_t num_bytes, RawAddr *addr, SocketOpKind sync)
 
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 AvailableDatagram (intptr_t fd, void *buffer, intptr_t num_bytes)
 
static bool IsBindError (intptr_t error_number)
 
static intptr_t GetPort (intptr_t fd)
 
static bool GetSocketName (intptr_t fd, SocketAddress *p_sa)
 
static SocketAddressGetRemotePeer (intptr_t fd, intptr_t *port)
 
static void GetError (intptr_t fd, OSError *os_error)
 
static int GetType (intptr_t fd)
 
static intptr_t GetStdioHandle (intptr_t num)
 
static void Close (intptr_t fd)
 
static bool GetNoDelay (intptr_t fd, bool *enabled)
 
static bool SetNoDelay (intptr_t fd, bool enabled)
 
static bool GetMulticastLoop (intptr_t fd, intptr_t protocol, bool *enabled)
 
static bool SetMulticastLoop (intptr_t fd, intptr_t protocol, bool enabled)
 
static bool GetMulticastHops (intptr_t fd, intptr_t protocol, int *value)
 
static bool SetMulticastHops (intptr_t fd, intptr_t protocol, int value)
 
static bool GetBroadcast (intptr_t fd, bool *value)
 
static bool SetBroadcast (intptr_t fd, bool value)
 
static bool GetOption (intptr_t fd, int level, int option, char *data, unsigned int *length)
 
static bool SetOption (intptr_t fd, int level, int option, const char *data, int length)
 
static bool JoinMulticast (intptr_t fd, const RawAddr &addr, const RawAddr &interface, int interfaceIndex)
 
static bool LeaveMulticast (intptr_t fd, const RawAddr &addr, const RawAddr &interface, int interfaceIndex)
 
static AddressList< SocketAddress > * LookupAddress (const char *host, int type, OSError **os_error)
 
static bool ReverseLookup (const RawAddr &addr, char *host, intptr_t host_len, OSError **os_error)
 
static bool ParseAddress (int type, const char *address, RawAddr *addr)
 
static bool IsValidAddress (const char *address)
 
static bool RawAddrToString (RawAddr *addr, char *str)
 
static bool FormatNumericAddress (const RawAddr &addr, char *address, int len)
 
static AddressList< InterfaceSocketAddress > * ListInterfaces (int type, OSError **os_error)
 

Detailed Description

Definition at line 175 of file socket_base.h.

Member Enumeration Documentation

◆ SocketOpKind

Enumerator
kSync 
kAsync 

Definition at line 183 of file socket_base.h.

◆ SocketRequest

Enumerator
kLookupRequest 
kListInterfacesRequest 
kReverseLookupRequest 

Definition at line 177 of file socket_base.h.

Member Function Documentation

◆ Available()

static intptr_t dart::bin::SocketBase::Available ( intptr_t  fd)
static

◆ AvailableDatagram()

static bool dart::bin::SocketBase::AvailableDatagram ( intptr_t  fd,
void *  buffer,
intptr_t  num_bytes 
)
static

◆ Close()

static void dart::bin::SocketBase::Close ( intptr_t  fd)
static

◆ FormatNumericAddress()

static bool dart::bin::SocketBase::FormatNumericAddress ( const RawAddr addr,
char *  address,
int  len 
)
static

◆ GetBroadcast()

static bool dart::bin::SocketBase::GetBroadcast ( intptr_t  fd,
bool *  value 
)
static

◆ GetError()

static void dart::bin::SocketBase::GetError ( intptr_t  fd,
OSError os_error 
)
static

◆ GetMulticastHops()

static bool dart::bin::SocketBase::GetMulticastHops ( intptr_t  fd,
intptr_t  protocol,
int value 
)
static

◆ GetMulticastLoop()

static bool dart::bin::SocketBase::GetMulticastLoop ( intptr_t  fd,
intptr_t  protocol,
bool *  enabled 
)
static

◆ GetNoDelay()

static bool dart::bin::SocketBase::GetNoDelay ( intptr_t  fd,
bool *  enabled 
)
static

◆ GetOption()

static bool dart::bin::SocketBase::GetOption ( intptr_t  fd,
int  level,
int  option,
char *  data,
unsigned int length 
)
static

◆ GetPort()

static intptr_t dart::bin::SocketBase::GetPort ( intptr_t  fd)
static

◆ GetRemotePeer()

static SocketAddress * dart::bin::SocketBase::GetRemotePeer ( intptr_t  fd,
intptr_t *  port 
)
static

◆ GetSocketName()

static bool dart::bin::SocketBase::GetSocketName ( intptr_t  fd,
SocketAddress p_sa 
)
static

◆ GetStdioHandle()

static intptr_t dart::bin::SocketBase::GetStdioHandle ( intptr_t  num)
static

◆ GetType()

static int dart::bin::SocketBase::GetType ( intptr_t  fd)
static

◆ Initialize()

static bool dart::bin::SocketBase::Initialize ( )
static

◆ IsBindError()

static bool dart::bin::SocketBase::IsBindError ( intptr_t  error_number)
static

◆ IsValidAddress()

bool dart::bin::SocketBase::IsValidAddress ( const char *  address)
static

Definition at line 306 of file socket_base.cc.

306 {
307 ASSERT(address != nullptr);
308 RawAddr raw;
309 memset(&raw, 0, sizeof(raw));
310 int type = strchr(address, ':') == nullptr ? SocketAddress::TYPE_IPV4
313 raw.addr.sa_family = AF_INET;
314 } else {
315 raw.addr.sa_family = AF_INET6;
316 }
317 return SocketBase::ParseAddress(type, address, &raw);
318}
GLenum type
static bool ParseAddress(int type, const char *address, RawAddr *addr)
#define ASSERT(E)

◆ JoinMulticast()

static bool dart::bin::SocketBase::JoinMulticast ( intptr_t  fd,
const RawAddr addr,
const RawAddr interface,
int  interfaceIndex 
)
static

◆ LeaveMulticast()

static bool dart::bin::SocketBase::LeaveMulticast ( intptr_t  fd,
const RawAddr addr,
const RawAddr interface,
int  interfaceIndex 
)
static

◆ ListInterfaces()

static AddressList< InterfaceSocketAddress > * dart::bin::SocketBase::ListInterfaces ( int  type,
OSError **  os_error 
)
static

◆ LookupAddress()

static AddressList< SocketAddress > * dart::bin::SocketBase::LookupAddress ( const char *  host,
int  type,
OSError **  os_error 
)
static

◆ ParseAddress()

static bool dart::bin::SocketBase::ParseAddress ( int  type,
const char *  address,
RawAddr addr 
)
static

◆ RawAddrToString()

static bool dart::bin::SocketBase::RawAddrToString ( RawAddr addr,
char *  str 
)
static

◆ Read()

static intptr_t dart::bin::SocketBase::Read ( intptr_t  fd,
void *  buffer,
intptr_t  num_bytes,
SocketOpKind  sync 
)
static

◆ ReceiveMessage()

static intptr_t dart::bin::SocketBase::ReceiveMessage ( intptr_t  fd,
void *  buffer,
int64_t *  p_buffer_num_bytes,
SocketControlMessage **  p_messages,
SocketOpKind  sync,
OSError p_oserror 
)
static

◆ RecvFrom()

static intptr_t dart::bin::SocketBase::RecvFrom ( intptr_t  fd,
void *  buffer,
intptr_t  num_bytes,
RawAddr addr,
SocketOpKind  sync 
)
static

◆ ReverseLookup()

static bool dart::bin::SocketBase::ReverseLookup ( const RawAddr addr,
char *  host,
intptr_t  host_len,
OSError **  os_error 
)
static

◆ SendMessage()

static intptr_t dart::bin::SocketBase::SendMessage ( intptr_t  fd,
void *  buffer,
size_t  buffer_num_bytes,
SocketControlMessage messages,
intptr_t  num_messages,
SocketOpKind  sync,
OSError p_oserror 
)
static

◆ SendTo()

static intptr_t dart::bin::SocketBase::SendTo ( intptr_t  fd,
const void *  buffer,
intptr_t  num_bytes,
const RawAddr addr,
SocketOpKind  sync 
)
static

◆ SetBroadcast()

static bool dart::bin::SocketBase::SetBroadcast ( intptr_t  fd,
bool  value 
)
static

◆ SetMulticastHops()

static bool dart::bin::SocketBase::SetMulticastHops ( intptr_t  fd,
intptr_t  protocol,
int  value 
)
static

◆ SetMulticastLoop()

static bool dart::bin::SocketBase::SetMulticastLoop ( intptr_t  fd,
intptr_t  protocol,
bool  enabled 
)
static

◆ SetNoDelay()

static bool dart::bin::SocketBase::SetNoDelay ( intptr_t  fd,
bool  enabled 
)
static

◆ SetOption()

static bool dart::bin::SocketBase::SetOption ( intptr_t  fd,
int  level,
int  option,
const char *  data,
int  length 
)
static

◆ Write()

intptr_t dart::bin::SocketBase::Write ( intptr_t  fd,
const void *  buffer,
intptr_t  num_bytes,
SocketOpKind  sync 
)
static

Definition at line 321 of file socket_base.cc.

324 {
325 // For non-blocking sockets we must write as many bytes as possible into
326 // the output to trigger EAGAIN otherwise we are not guaranteed to
327 // receive an event from epoll which we are using in edge-triggering
328 // (EPOLLET) mode. See man epoll for more information and guidelines.
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)) {
335 break;
336 }
337
338 return -1; // Error occurred.
339 }
340
341 num_bytes_left -= written_bytes;
342 buffer = static_cast<const char*>(buffer) + written_bytes;
343 }
344
345 return num_bytes - num_bytes_left;
346}
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
Definition: switches.h:126

The documentation for this class was generated from the following files: