Android-cuttlefish cvd tool
|
#include <limits.h>
#include <stdint.h>
#include <sys/types.h>
#include <functional>
#include <string>
#include <android-base/macros.h>
#include "adb_trace.h"
#include "fdevent/fdevent.h"
#include "socket.h"
#include "types.h"
Go to the source code of this file.
Classes | |
struct | adisconnect |
Macros | |
#define | A_SYNC 0x434e5953 |
#define | A_CNXN 0x4e584e43 |
#define | A_OPEN 0x4e45504f |
#define | A_OKAY 0x59414b4f |
#define | A_CLSE 0x45534c43 |
#define | A_WRTE 0x45545257 |
#define | A_AUTH 0x48545541 |
#define | A_STLS 0x534C5453 |
#define | A_VERSION_MIN 0x01000000 |
#define | A_VERSION_SKIP_CHECKSUM 0x01000001 |
#define | A_VERSION 0x01000001 |
#define | A_STLS_VERSION_MIN 0x01000000 |
#define | A_STLS_VERSION 0x01000000 |
#define | ADB_VERSION_MAJOR 1 |
#define | ADB_VERSION_MINOR 0 |
#define | ADB_SERVER_VERSION 41 |
#define | TOKEN_SIZE 20 |
#define | DEBUG_PACKETS 0 |
#define | print_packet(tag, p) |
#define | DEFAULT_ADB_LOCAL_TRANSPORT_PORT 5555 |
#define | ADB_CLASS 0xff |
#define | ADB_SUBCLASS 0x42 |
#define | ADB_PROTOCOL 0x1 |
#define | ADB_DBC_CLASS 0xDC |
#define | ADB_DBC_SUBCLASS 0x2 |
#define | CHUNK_SIZE (64 * 1024) |
#define | ABB_ARG_DELIMETER ('\0') |
#define | USB_FFS_ADB_PATH "/dev/usb-ffs/adb/" |
#define | USB_FFS_ADB_EP(x) USB_FFS_ADB_PATH #x |
#define | USB_FFS_ADB_EP0 USB_FFS_ADB_EP(ep0) |
#define | USB_FFS_ADB_OUT USB_FFS_ADB_EP(ep1) |
#define | USB_FFS_ADB_IN USB_FFS_ADB_EP(ep2) |
Typedefs | |
using | TransportId = uint64_t |
Enumerations | |
enum | TransportType { kTransportUsb , kTransportLocal , kTransportAny , kTransportHost } |
enum | ConnectionState { kCsAny = -1 , kCsConnecting = 0 , kCsAuthorizing , kCsUnauthorized , kCsNoPerm , kCsDetached , kCsOffline , kCsBootloader , kCsDevice , kCsHost , kCsRecovery , kCsSideload , kCsRescue } |
enum class | HostRequestResult { Handled , SwitchedTransport , Unhandled } |
Functions | |
std::string | command_to_string (uint32_t cmd) |
std::string | adb_version () |
uint32_t | calculate_apacket_checksum (const apacket *packet) |
std::string | to_string (ConnectionState state) |
bool | ConnectionStateIsOnline (ConnectionState state) |
void | print_packet (const char *label, apacket *p) |
void | handle_packet (apacket *p, atransport *t) |
bool | is_one_device_mandatory () |
int | launch_server (const std::string &socket_spec, const char *one_device) |
int | adb_server_main (int is_daemon, const std::string &socket_spec, const char *one_device, int ack_reply_fd) |
std::string | getEmulatorSerialString (int console_port) |
unique_fd | service_to_fd (std::string_view name, atransport *transport) |
unique_fd | daemon_service_to_fd (std::string_view name, atransport *transport) |
asocket * | daemon_service_to_socket (std::string_view name, atransport *transport) |
unique_fd | execute_abb_command (std::string_view command) |
bool | handle_forward_request (const char *service, atransport *transport, int reply_fd) |
bool | handle_forward_request (const char *service, std::function< atransport *(std::string *error)> transport_acquirer, int reply_fd) |
apacket * | get_apacket () |
void | put_apacket (apacket *p) |
bool | connect_emulator (int port) |
int | connect_emulator_arbitrary_ports (int console_port, int adb_port, std::string *error) |
HostRequestResult | handle_host_request (std::string_view service, TransportType type, const char *serial, TransportId transport_id, int reply_fd, asocket *s) |
void | handle_online (atransport *t) |
void | handle_offline (atransport *t) |
void | send_connect (atransport *t) |
void | send_tls_request (atransport *t) |
void | send_ready (unsigned local, unsigned remote, atransport *t, uint32_t ack_bytes) |
void | parse_banner (const std::string &, atransport *t) |
void | usb_init () |
Variables | |
constexpr size_t | MAX_PAYLOAD_V1 = 4 * 1024 |
constexpr size_t | MAX_PAYLOAD = 1024 * 1024 |
constexpr size_t | INITIAL_DELAYED_ACK_BYTES = 32 * 1024 * 1024 |
constexpr size_t | LINUX_MAX_SOCKET_SIZE = 4194304 |
const char * | adb_device_banner |
#define A_AUTH 0x48545541 |
#define A_CLSE 0x45534c43 |
#define A_CNXN 0x4e584e43 |
#define A_OKAY 0x59414b4f |
#define A_OPEN 0x4e45504f |
#define A_STLS 0x534C5453 |
#define A_STLS_VERSION 0x01000000 |
#define A_STLS_VERSION_MIN 0x01000000 |
#define A_SYNC 0x434e5953 |
#define A_VERSION 0x01000001 |
#define A_VERSION_MIN 0x01000000 |
#define A_VERSION_SKIP_CHECKSUM 0x01000001 |
#define A_WRTE 0x45545257 |
#define ABB_ARG_DELIMETER ('\0') |
#define ADB_CLASS 0xff |
#define ADB_DBC_CLASS 0xDC |
#define ADB_DBC_SUBCLASS 0x2 |
#define ADB_PROTOCOL 0x1 |
#define ADB_SERVER_VERSION 41 |
#define ADB_SUBCLASS 0x42 |
#define ADB_VERSION_MAJOR 1 |
#define ADB_VERSION_MINOR 0 |
#define CHUNK_SIZE (64 * 1024) |
#define DEBUG_PACKETS 0 |
#define DEFAULT_ADB_LOCAL_TRANSPORT_PORT 5555 |
#define print_packet | ( | tag, | |
p | |||
) |
#define TOKEN_SIZE 20 |
#define USB_FFS_ADB_EP | ( | x | ) | USB_FFS_ADB_PATH #x |
#define USB_FFS_ADB_EP0 USB_FFS_ADB_EP(ep0) |
#define USB_FFS_ADB_IN USB_FFS_ADB_EP(ep2) |
#define USB_FFS_ADB_OUT USB_FFS_ADB_EP(ep1) |
#define USB_FFS_ADB_PATH "/dev/usb-ffs/adb/" |
using TransportId = uint64_t |
enum ConnectionState |
|
strong |
enum TransportType |
int adb_server_main | ( | int | is_daemon, |
const std::string & | socket_spec, | ||
const char * | one_device, | ||
int | ack_reply_fd | ||
) |
std::string adb_version | ( | ) |
uint32_t calculate_apacket_checksum | ( | const apacket * | packet | ) |
std::string command_to_string | ( | uint32_t | cmd | ) |
bool connect_emulator | ( | int | port | ) |
int connect_emulator_arbitrary_ports | ( | int | console_port, |
int | adb_port, | ||
std::string * | error | ||
) |
|
inline |
unique_fd daemon_service_to_fd | ( | std::string_view | name, |
atransport * | transport | ||
) |
asocket * daemon_service_to_socket | ( | std::string_view | name, |
atransport * | transport | ||
) |
unique_fd execute_abb_command | ( | std::string_view | command | ) |
apacket * get_apacket | ( | ) |
std::string getEmulatorSerialString | ( | int | console_port | ) |
bool handle_forward_request | ( | const char * | service, |
atransport * | transport, | ||
int | reply_fd | ||
) |
bool handle_forward_request | ( | const char * | service, |
std::function< atransport *(std::string *error)> | transport_acquirer, | ||
int | reply_fd | ||
) |
HostRequestResult handle_host_request | ( | std::string_view | service, |
TransportType | type, | ||
const char * | serial, | ||
TransportId | transport_id, | ||
int | reply_fd, | ||
asocket * | s | ||
) |
void handle_offline | ( | atransport * | t | ) |
void handle_online | ( | atransport * | t | ) |
void handle_packet | ( | apacket * | p, |
atransport * | t | ||
) |
bool is_one_device_mandatory | ( | ) |
int launch_server | ( | const std::string & | socket_spec, |
const char * | one_device | ||
) |
void parse_banner | ( | const std::string & | banner, |
atransport * | t | ||
) |
void print_packet | ( | const char * | label, |
apacket * | p | ||
) |
void put_apacket | ( | apacket * | p | ) |
void send_connect | ( | atransport * | t | ) |
void send_ready | ( | unsigned | local, |
unsigned | remote, | ||
atransport * | t, | ||
uint32_t | ack_bytes | ||
) |
void send_tls_request | ( | atransport * | t | ) |
unique_fd service_to_fd | ( | std::string_view | name, |
atransport * | transport | ||
) |
std::string to_string | ( | ConnectionState | state | ) |
void usb_init | ( | ) |
|
extern |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |