Android-cuttlefish cvd tool
Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
PairingConnectionCtx Struct Reference
Collaboration diagram for PairingConnectionCtx:
Collaboration graph
[legend]

Public Types

enum class  Role { Client , Server }
 
using Data = std::vector< uint8_t >
 
using ResultCallback = pairing_result_cb
 

Public Member Functions

 PairingConnectionCtx (Role role, const Data &pswd, const PeerInfo &peer_info, const Data &certificate, const Data &priv_key)
 
virtual ~PairingConnectionCtx ()
 
bool Start (int fd, ResultCallback cb, void *opaque)
 

Private Types

enum class  State { Ready , ExchangingMsgs , ExchangingPeerInfo , Stopped }
 

Private Member Functions

bool SetupTlsConnection ()
 
bool WriteHeader (const PairingPacketHeader *header, std::string_view payload)
 
bool ReadHeader (PairingPacketHeader *header)
 
void CreateHeader (PairingPacketHeader *header, adb::proto::PairingPacket::Type type, uint32_t payload_size)
 
bool CheckHeaderType (adb::proto::PairingPacket::Type expected, uint8_t actual)
 
bool DoExchangeMsgs ()
 
bool DoExchangePeerInfo ()
 
void StartWorker ()
 
void NotifyResult (const PeerInfo *p)
 

Static Private Member Functions

static PairingAuthPtr CreatePairingAuthPtr (Role role, const Data &pswd)
 

Private Attributes

std::atomic< Statestate_ {State::Ready}
 
Role role_
 
Data pswd_
 
PeerInfo peer_info_
 
Data cert_
 
Data priv_key_
 
PeerInfo their_info_
 
ResultCallback cb_
 
void * opaque_ = nullptr
 
std::unique_ptr< tls::TlsConnectiontls_
 
PairingAuthPtr auth_
 
unique_fd fd_
 
std::thread thread_
 

Static Private Attributes

static constexpr size_t kExportedKeySize = 64
 

Member Typedef Documentation

◆ Data

using PairingConnectionCtx::Data = std::vector<uint8_t>

◆ ResultCallback

Member Enumeration Documentation

◆ Role

enum class PairingConnectionCtx::Role
strong
Enumerator
Client 
Server 

◆ State

enum class PairingConnectionCtx::State
strongprivate
Enumerator
Ready 
ExchangingMsgs 
ExchangingPeerInfo 
Stopped 

Constructor & Destructor Documentation

◆ PairingConnectionCtx()

PairingConnectionCtx::PairingConnectionCtx ( Role  role,
const Data pswd,
const PeerInfo peer_info,
const Data certificate,
const Data priv_key 
)
explicit

◆ ~PairingConnectionCtx()

PairingConnectionCtx::~PairingConnectionCtx ( )
virtual

Member Function Documentation

◆ CheckHeaderType()

bool PairingConnectionCtx::CheckHeaderType ( adb::proto::PairingPacket::Type  expected,
uint8_t  actual 
)
private

◆ CreateHeader()

void PairingConnectionCtx::CreateHeader ( PairingPacketHeader header,
adb::proto::PairingPacket::Type  type,
uint32_t  payload_size 
)
private

◆ CreatePairingAuthPtr()

PairingAuthPtr PairingConnectionCtx::CreatePairingAuthPtr ( Role  role,
const Data pswd 
)
staticprivate

◆ DoExchangeMsgs()

bool PairingConnectionCtx::DoExchangeMsgs ( )
private

◆ DoExchangePeerInfo()

bool PairingConnectionCtx::DoExchangePeerInfo ( )
private

◆ NotifyResult()

void PairingConnectionCtx::NotifyResult ( const PeerInfo p)
private

◆ ReadHeader()

bool PairingConnectionCtx::ReadHeader ( PairingPacketHeader header)
private

◆ SetupTlsConnection()

bool PairingConnectionCtx::SetupTlsConnection ( )
private

◆ Start()

bool PairingConnectionCtx::Start ( int  fd,
ResultCallback  cb,
void *  opaque 
)

◆ StartWorker()

void PairingConnectionCtx::StartWorker ( )
private

◆ WriteHeader()

bool PairingConnectionCtx::WriteHeader ( const PairingPacketHeader header,
std::string_view  payload 
)
private

Member Data Documentation

◆ auth_

PairingAuthPtr PairingConnectionCtx::auth_
private

◆ cb_

ResultCallback PairingConnectionCtx::cb_
private

◆ cert_

Data PairingConnectionCtx::cert_
private

◆ fd_

unique_fd PairingConnectionCtx::fd_
private

◆ kExportedKeySize

constexpr size_t PairingConnectionCtx::kExportedKeySize = 64
staticconstexprprivate

◆ opaque_

void* PairingConnectionCtx::opaque_ = nullptr
private

◆ peer_info_

PeerInfo PairingConnectionCtx::peer_info_
private

◆ priv_key_

Data PairingConnectionCtx::priv_key_
private

◆ pswd_

Data PairingConnectionCtx::pswd_
private

◆ role_

Role PairingConnectionCtx::role_
private

◆ state_

std::atomic<State> PairingConnectionCtx::state_ {State::Ready}
private

◆ their_info_

PeerInfo PairingConnectionCtx::their_info_
private

◆ thread_

std::thread PairingConnectionCtx::thread_
private

◆ tls_

std::unique_ptr<tls::TlsConnection> PairingConnectionCtx::tls_
private

The documentation for this struct was generated from the following file: