Android-cuttlefish cvd tool
Namespaces | Classes | Typedefs | Functions | Variables
cuttlefish::confui::packet Namespace Reference

Namespaces

namespace  impl
 

Classes

struct  ParsedPacket
 
struct  PayloadHeader
 

Typedefs

using BufferType = std::vector< std::uint8_t >
 
using Payload = std::tuple< PayloadHeader, BufferType >
 
using ConfUiPacketInfo = std::vector< std::vector< std::uint8_t > >
 

Functions

static std::optional< std::vector< std::uint8_t > > ReadRawData (SharedFD s)
 
static std::optional< ParsedPacketParseRawData (const std::vector< std::uint8_t > &data_to_parse)
 
std::optional< ParsedPacketReadPayload (SharedFD s)
 
template<typename... Args>
bool WritePayload (SharedFD d, const std::string &cmd_str, const std::string &session_id, Args &&... args)
 
std::string ToString (const ParsedPacket &packet)
 

Variables

constexpr const ssize_t kMaxPayloadLength = 10000
 

Typedef Documentation

◆ BufferType

using cuttlefish::confui::packet::BufferType = typedef std::vector<std::uint8_t>

◆ ConfUiPacketInfo

using cuttlefish::confui::packet::ConfUiPacketInfo = typedef std::vector<std::vector<std::uint8_t> >

◆ Payload

Function Documentation

◆ ParseRawData()

static std::optional< ParsedPacket > cuttlefish::confui::packet::ParseRawData ( const std::vector< std::uint8_t > &  data_to_parse)
static

Here is how the raw data, i.e. tokens[2:] looks like

n:l[0]:l[1]:l[2]:...:l[n-1]:data[0]data[1]data[2]...data[n]

Thus it basically has the number of items, the lengths of each item, and the byte representation of each item. n and l[i] are separated by ':' Note that the byte representation may have ':' in it. This could mess up the parsing if we totally depending on ':' separation.

However, it is safe to assume that there's no ':' inside n or the string for l[i]. So, we do anyway split the data_to_parse by ':', and take n and from l[0] through l[n-1] only.

◆ ReadPayload()

std::optional< ParsedPacket > cuttlefish::confui::packet::ReadPayload ( SharedFD  s)

◆ ReadRawData()

static std::optional< std::vector< std::uint8_t > > cuttlefish::confui::packet::ReadRawData ( SharedFD  s)
static

◆ ToString()

std::string cuttlefish::confui::packet::ToString ( const ParsedPacket packet)

◆ WritePayload()

template<typename... Args>
bool cuttlefish::confui::packet::WritePayload ( SharedFD  d,
const std::string &  cmd_str,
const std::string &  session_id,
Args &&...  args 
)

Variable Documentation

◆ kMaxPayloadLength

constexpr const ssize_t cuttlefish::confui::packet::kMaxPayloadLength = 10000
constexpr