Android-cuttlefish cvd tool
|
#include <fastboot_driver.h>
Public Member Functions | |
FastBootDriver (std::unique_ptr< Transport > transport, DriverCallbacks driver_callbacks={}, bool no_checks=false) | |
~FastBootDriver () | |
RetCode | Boot (std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | Continue (std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | CreatePartition (const std::string &partition, const std::string &size) |
RetCode | DeletePartition (const std::string &partition) override |
RetCode | Download (const std::string &name, android::base::borrowed_fd fd, size_t size, std::string *response=nullptr, std::vector< std::string > *info=nullptr) override |
RetCode | Download (android::base::borrowed_fd fd, size_t size, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | Download (const std::string &name, const std::vector< char > &buf, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | Download (const std::vector< char > &buf, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | Download (const std::string &partition, struct sparse_file *s, uint32_t sz, size_t current, size_t total, bool use_crc, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | Download (sparse_file *s, bool use_crc=false, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | Erase (const std::string &partition, std::string *response=nullptr, std::vector< std::string > *info=nullptr) override |
RetCode | Flash (const std::string &partition, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | GetVar (const std::string &key, std::string *val, std::vector< std::string > *info=nullptr) override |
RetCode | GetVarAll (std::vector< std::string > *response) |
RetCode | Reboot (std::string *response=nullptr, std::vector< std::string > *info=nullptr) override |
RetCode | RebootTo (std::string target, std::string *response=nullptr, std::vector< std::string > *info=nullptr) override |
RetCode | ResizePartition (const std::string &partition, const std::string &size) override |
RetCode | SetActive (const std::string &slot, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | Upload (const std::string &outfile, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | SnapshotUpdateCommand (const std::string &command, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | FetchToFd (const std::string &partition, android::base::borrowed_fd fd, int64_t offset=-1, int64_t size=-1, std::string *response=nullptr, std::vector< std::string > *info=nullptr) override |
RetCode | FlashPartition (const std::string &partition, const std::vector< char > &data) |
RetCode | FlashPartition (const std::string &partition, android::base::borrowed_fd fd, uint32_t sz) override |
RetCode | FlashPartition (const std::string &partition, sparse_file *s, uint32_t sz, size_t current, size_t total) |
RetCode | Partitions (std::vector< std::tuple< std::string, uint64_t > > *partitions) |
RetCode | Require (const std::string &var, const std::vector< std::string > &allowed, bool *reqmet, bool invert=false) |
void | SetInfoCallback (std::function< void(const std::string &)> info) |
std::string | Error () |
RetCode | WaitForDisconnect () override |
void | set_transport (std::unique_ptr< Transport > transport) |
RetCode | RawCommand (const std::string &cmd, const std::string &message, std::string *response=nullptr, std::vector< std::string > *info=nullptr, int *dsize=nullptr) |
RetCode | RawCommand (const std::string &cmd, std::string *response=nullptr, std::vector< std::string > *info=nullptr, int *dsize=nullptr) |
![]() | |
virtual RetCode | FlashPartition (const std::string &partition, android::base::borrowed_fd fd, uint32_t sz)=0 |
virtual RetCode | DeletePartition (const std::string &partition)=0 |
virtual RetCode | WaitForDisconnect ()=0 |
virtual RetCode | Reboot (std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0 |
virtual RetCode | RebootTo (std::string target, std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0 |
virtual RetCode | GetVar (const std::string &key, std::string *val, std::vector< std::string > *info=nullptr)=0 |
virtual RetCode | FetchToFd (const std::string &partition, android::base::borrowed_fd fd, int64_t offset=-1, int64_t size=-1, std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0 |
virtual RetCode | Download (const std::string &name, android::base::borrowed_fd fd, size_t size, std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0 |
virtual RetCode | RawCommand (const std::string &cmd, const std::string &message, std::string *response=nullptr, std::vector< std::string > *info=nullptr, int *dsize=nullptr)=0 |
virtual RetCode | ResizePartition (const std::string &partition, const std::string &size)=0 |
virtual RetCode | Erase (const std::string &partition, std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0 |
virtual | ~IFastBootDriver ()=default |
Static Public Member Functions | |
static const std::string | RCString (RetCode rc) |
Static Public Attributes | |
static constexpr int | RESP_TIMEOUT = 30 |
static constexpr uint32_t | MAX_DOWNLOAD_SIZE = std::numeric_limits<uint32_t>::max() |
static constexpr size_t | TRANSPORT_CHUNK_SIZE = 1024 |
Protected Member Functions | |
RetCode | DownloadCommand (uint32_t size, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | HandleResponse (std::string *response=nullptr, std::vector< std::string > *info=nullptr, int *dsize=nullptr) |
std::string | ErrnoStr (const std::string &msg) |
Protected Attributes | |
std::unique_ptr< Transport > | transport_ |
Private Member Functions | |
RetCode | SendBuffer (android::base::borrowed_fd fd, size_t size) |
RetCode | SendBuffer (const std::vector< char > &buf) |
RetCode | SendBuffer (const void *buf, size_t size) |
RetCode | ReadBuffer (void *buf, size_t size) |
RetCode | UploadInner (const std::string &outfile, std::string *response=nullptr, std::vector< std::string > *info=nullptr) |
RetCode | RunAndReadBuffer (const std::string &cmd, std::string *response, std::vector< std::string > *info, const std::function< RetCode(const char *, uint64_t)> &write_fn) |
int | SparseWriteCallback (std::vector< char > &tpbuf, const char *data, size_t len) |
Private Attributes | |
std::string | error_ |
std::function< void(const std::string &)> | prolog_ |
std::function< void(int)> | epilog_ |
std::function< void(const std::string &)> | info_ |
std::function< void(const std::string &)> | text_ |
bool | disable_checks_ |
Friends | |
class | FastBootTest |
fastboot::FastBootDriver::FastBootDriver | ( | std::unique_ptr< Transport > | transport, |
DriverCallbacks | driver_callbacks = {} , |
||
bool | no_checks = false |
||
) |
fastboot::FastBootDriver::~FastBootDriver | ( | ) |
RetCode fastboot::FastBootDriver::Boot | ( | std::string * | response = nullptr , |
std::vector< std::string > * | info = nullptr |
||
) |
RetCode fastboot::FastBootDriver::Continue | ( | std::string * | response = nullptr , |
std::vector< std::string > * | info = nullptr |
||
) |
RetCode fastboot::FastBootDriver::CreatePartition | ( | const std::string & | partition, |
const std::string & | size | ||
) |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
RetCode fastboot::FastBootDriver::Download | ( | android::base::borrowed_fd | fd, |
size_t | size, | ||
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
RetCode fastboot::FastBootDriver::Download | ( | const std::string & | name, |
const std::vector< char > & | buf, | ||
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
RetCode fastboot::FastBootDriver::Download | ( | const std::string & | partition, |
struct sparse_file * | s, | ||
uint32_t | sz, | ||
size_t | current, | ||
size_t | total, | ||
bool | use_crc, | ||
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
RetCode fastboot::FastBootDriver::Download | ( | const std::vector< char > & | buf, |
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
RetCode fastboot::FastBootDriver::Download | ( | sparse_file * | s, |
bool | use_crc = false , |
||
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
|
protected |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
|
protected |
std::string fastboot::FastBootDriver::Error | ( | ) |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
RetCode fastboot::FastBootDriver::Flash | ( | const std::string & | partition, |
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
RetCode fastboot::FastBootDriver::FlashPartition | ( | const std::string & | partition, |
const std::vector< char > & | data | ||
) |
RetCode fastboot::FastBootDriver::FlashPartition | ( | const std::string & | partition, |
sparse_file * | s, | ||
uint32_t | sz, | ||
size_t | current, | ||
size_t | total | ||
) |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
RetCode fastboot::FastBootDriver::GetVarAll | ( | std::vector< std::string > * | response | ) |
|
protected |
RetCode fastboot::FastBootDriver::Partitions | ( | std::vector< std::tuple< std::string, uint64_t > > * | partitions | ) |
|
virtual |
Implements fastboot::IFastBootDriver.
RetCode fastboot::FastBootDriver::RawCommand | ( | const std::string & | cmd, |
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr , |
||
int * | dsize = nullptr |
||
) |
|
static |
|
private |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
|
overridevirtual |
Implements fastboot::IFastBootDriver.
RetCode fastboot::FastBootDriver::Require | ( | const std::string & | var, |
const std::vector< std::string > & | allowed, | ||
bool * | reqmet, | ||
bool | invert = false |
||
) |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
|
private |
|
private |
|
private |
|
private |
void fastboot::FastBootDriver::set_transport | ( | std::unique_ptr< Transport > | transport | ) |
RetCode fastboot::FastBootDriver::SetActive | ( | const std::string & | slot, |
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
void fastboot::FastBootDriver::SetInfoCallback | ( | std::function< void(const std::string &)> | info | ) |
RetCode fastboot::FastBootDriver::SnapshotUpdateCommand | ( | const std::string & | command, |
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
|
private |
RetCode fastboot::FastBootDriver::Upload | ( | const std::string & | outfile, |
std::string * | response = nullptr , |
||
std::vector< std::string > * | info = nullptr |
||
) |
|
private |
|
overridevirtual |
Implements fastboot::IFastBootDriver.
|
friend |
|
private |
|
private |
|
private |
|
private |
|
staticconstexpr |
|
private |
|
staticconstexpr |
|
private |
|
protected |
|
staticconstexpr |