Android-cuttlefish cvd tool
Classes | Macros | Enumerations | Functions | Variables
sockets.cpp File Reference
#include "sysdeps.h"
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <algorithm>
#include <chrono>
#include <mutex>
#include <string>
#include <vector>
#include <android-base/strings.h>
#include <android-base/properties.h>
#include <log/log_properties.h>
#include "adb.h"
#include "adb_io.h"
#include "adb_utils.h"
#include "transport.h"
#include "types.h"
Include dependency graph for sockets.cpp:

Classes

struct  ClosingSocket
 

Macros

#define TRACE_TAG   SOCKETS
 

Enumerations

enum class  SocketFlushResult { Destroyed , TryAgain , Completed }
 

Functions

asocketfind_local_socket (unsigned local_id, unsigned peer_id)
 
void install_local_socket (asocket *s)
 
void remove_socket (asocket *s)
 
void close_all_sockets (atransport *t)
 
static SocketFlushResult local_socket_flush_incoming (asocket *s)
 
static bool local_socket_flush_outgoing (asocket *s)
 
static int local_socket_enqueue (asocket *s, apacket::payload_type data)
 
static void local_socket_ready (asocket *s)
 
static void deferred_close (unique_fd fd)
 
static void local_socket_destroy (asocket *s)
 
static void local_socket_close (asocket *s)
 
static void local_socket_event_func (int fd, unsigned ev, void *_s)
 
void local_socket_ack (asocket *s, std::optional< int32_t > acked_bytes)
 
asocketcreate_local_socket (unique_fd ufd)
 
asocketcreate_local_service_socket (std::string_view name, atransport *transport)
 
static int remote_socket_enqueue (asocket *s, apacket::payload_type data)
 
static void remote_socket_ready (asocket *s)
 
static void remote_socket_shutdown (asocket *s)
 
static void remote_socket_close (asocket *s)
 
asocketcreate_remote_socket (unsigned id, atransport *t)
 
void connect_to_remote (asocket *s, std::string_view destination)
 

Variables

static std::recursive_mutex & local_socket_list_lock = *new std::recursive_mutex()
 
static unsigned local_socket_next_id = 1
 
static auto & local_socket_list = *new std::vector<asocket*>()
 
static auto & local_socket_closing_list = *new std::vector<asocket*>()
 

Macro Definition Documentation

◆ TRACE_TAG

#define TRACE_TAG   SOCKETS

Enumeration Type Documentation

◆ SocketFlushResult

enum class SocketFlushResult
strong
Enumerator
Destroyed 
TryAgain 
Completed 

Function Documentation

◆ close_all_sockets()

void close_all_sockets ( atransport t)

◆ connect_to_remote()

void connect_to_remote ( asocket s,
std::string_view  destination 
)

◆ create_local_service_socket()

asocket * create_local_service_socket ( std::string_view  name,
atransport transport 
)

◆ create_local_socket()

asocket * create_local_socket ( unique_fd  ufd)

◆ create_remote_socket()

asocket * create_remote_socket ( unsigned  id,
atransport t 
)

◆ deferred_close()

static void deferred_close ( unique_fd  fd)
static

◆ find_local_socket()

asocket * find_local_socket ( unsigned  local_id,
unsigned  peer_id 
)

◆ install_local_socket()

void install_local_socket ( asocket s)

◆ local_socket_ack()

void local_socket_ack ( asocket s,
std::optional< int32_t >  acked_bytes 
)

◆ local_socket_close()

static void local_socket_close ( asocket s)
static

◆ local_socket_destroy()

static void local_socket_destroy ( asocket s)
static

◆ local_socket_enqueue()

static int local_socket_enqueue ( asocket s,
apacket::payload_type  data 
)
static

◆ local_socket_event_func()

static void local_socket_event_func ( int  fd,
unsigned  ev,
void *  _s 
)
static

◆ local_socket_flush_incoming()

static SocketFlushResult local_socket_flush_incoming ( asocket s)
static

◆ local_socket_flush_outgoing()

static bool local_socket_flush_outgoing ( asocket s)
static

◆ local_socket_ready()

static void local_socket_ready ( asocket s)
static

◆ remote_socket_close()

static void remote_socket_close ( asocket s)
static

◆ remote_socket_enqueue()

static int remote_socket_enqueue ( asocket s,
apacket::payload_type  data 
)
static

◆ remote_socket_ready()

static void remote_socket_ready ( asocket s)
static

◆ remote_socket_shutdown()

static void remote_socket_shutdown ( asocket s)
static

◆ remove_socket()

void remove_socket ( asocket s)

Variable Documentation

◆ local_socket_closing_list

auto& local_socket_closing_list = *new std::vector<asocket*>()
static

◆ local_socket_list

auto& local_socket_list = *new std::vector<asocket*>()
static

◆ local_socket_list_lock

std::recursive_mutex& local_socket_list_lock = *new std::recursive_mutex()
static

◆ local_socket_next_id

unsigned local_socket_next_id = 1
static