BinaryNinja::DownloadInstance Class Referenceabstract

Classes

struct  Response
 

Public Member Functions

int PerformRequest (const std::string &url, BNDownloadInstanceOutputCallbacks *callbacks)
 Send a GET request to a url, synchronously. More...
 
int PerformCustomRequest (const std::string &method, const std::string &url, const std::unordered_map< std::string, std::string > &headers, Response &response, BNDownloadInstanceInputOutputCallbacks *callbacks)
 Send a request to a url, synchronously. More...
 
std::string GetError () const
 Retrieve the error from the last request sent by this instance. More...
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNDownloadInstance, BNNewDownloadInstanceReference, BNFreeDownloadInstance >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNDownloadInstance * GetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 

Protected Member Functions

 DownloadInstance (DownloadProvider *provider)
 
 DownloadInstance (BNDownloadInstance *instance)
 
virtual void DestroyInstance ()
 Cleanup any resources created by the instance. More...
 
virtual int PerformRequest (const std::string &url)=0
 Virtual method to synchronously perform a GET request to a url, overridden by a subclass. More...
 
virtual int PerformCustomRequest (const std::string &method, const std::string &url, const std::unordered_map< std::string, std::string > &headers, Response &response)=0
 Virtual method to synchronously perform a request to a url, overridden by a subclass. More...
 
int64_t ReadDataCallback (uint8_t *data, uint64_t len)
 
uint64_t WriteDataCallback (uint8_t *data, uint64_t len)
 
bool NotifyProgressCallback (uint64_t progress, uint64_t total)
 
void SetError (const std::string &error)
 

Static Protected Member Functions

static void DestroyInstanceCallback (void *ctxt)
 
static int PerformRequestCallback (void *ctxt, const char *url)
 
static int PerformCustomRequestCallback (void *ctxt, const char *method, const char *url, uint64_t headerCount, const char *const *headerKeys, const char *const *headerValues, BNDownloadInstanceResponse **response)
 
static void PerformFreeResponse (void *ctxt, BNDownloadInstanceResponse *response)
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNDownloadInstance, BNNewDownloadInstanceReference, BNFreeDownloadInstance >
static BNDownloadInstance * GetObject (CoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNDownloadInstance, BNNewDownloadInstanceReference, BNFreeDownloadInstance >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNDownloadInstance * m_object
 

Class Documentation

◆ BinaryNinja::DownloadInstance::Response

struct BinaryNinja::DownloadInstance::Response
Class Members
unordered_map< string, string > headers
uint16_t statusCode

Constructor & Destructor Documentation

◆ DownloadInstance() [1/2]

DownloadInstance::DownloadInstance ( DownloadProvider provider)
protected

◆ DownloadInstance() [2/2]

DownloadInstance::DownloadInstance ( BNDownloadInstance *  instance)
protected

Member Function Documentation

◆ DestroyInstance()

void DownloadInstance::DestroyInstance ( )
protectedvirtual

Cleanup any resources created by the instance.

◆ DestroyInstanceCallback()

void DownloadInstance::DestroyInstanceCallback ( void *  ctxt)
staticprotected

◆ GetError()

string DownloadInstance::GetError ( ) const

Retrieve the error from the last request sent by this instance.

◆ NotifyProgressCallback()

bool DownloadInstance::NotifyProgressCallback ( uint64_t  progress,
uint64_t  total 
)
protected

◆ PerformCustomRequest() [1/2]

virtual int BinaryNinja::DownloadInstance::PerformCustomRequest ( const std::string &  method,
const std::string &  url,
const std::unordered_map< std::string, std::string > &  headers,
Response response 
)
protectedpure virtual

Virtual method to synchronously perform a request to a url, overridden by a subclass.

Parameters
methodRequest method e.g. GET
urlFull url to request
headersHTTP headers as keys/values
responseStructure into which the response status code and headers should be stored
Returns
Zero on successful request, negative on failed request

Implemented in BinaryNinja::CoreDownloadInstance.

◆ PerformCustomRequest() [2/2]

int BinaryNinja::DownloadInstance::PerformCustomRequest ( const std::string &  method,
const std::string &  url,
const std::unordered_map< std::string, std::string > &  headers,
Response response,
BNDownloadInstanceInputOutputCallbacks callbacks 
)

Send a request to a url, synchronously.

Parameters
methodRequest method e.g. GET
urlFull url to request
headersHTTP headers as keys/values
responseStructure into which the response status code and headers are stored
callbacksStructure with callback functions for input and output data
Returns
Zero on successful request, negative on failed request

◆ PerformCustomRequestCallback()

int DownloadInstance::PerformCustomRequestCallback ( void *  ctxt,
const char *  method,
const char *  url,
uint64_t  headerCount,
const char *const *  headerKeys,
const char *const *  headerValues,
BNDownloadInstanceResponse **  response 
)
staticprotected

◆ PerformFreeResponse()

void DownloadInstance::PerformFreeResponse ( void *  ctxt,
BNDownloadInstanceResponse response 
)
staticprotected

◆ PerformRequest() [1/2]

virtual int BinaryNinja::DownloadInstance::PerformRequest ( const std::string &  url)
protectedpure virtual

Virtual method to synchronously perform a GET request to a url, overridden by a subclass.

Parameters
urlFull url to request
Returns
Zero on successful request, negative on failed request

Implemented in BinaryNinja::CoreDownloadInstance.

◆ PerformRequest() [2/2]

int BinaryNinja::DownloadInstance::PerformRequest ( const std::string &  url,
BNDownloadInstanceOutputCallbacks callbacks 
)

Send a GET request to a url, synchronously.

Parameters
urlFull url to request
callbacksStructure with callback functions for output data
Returns
Zero on successful request, negative on failed request

◆ PerformRequestCallback()

int DownloadInstance::PerformRequestCallback ( void *  ctxt,
const char *  url 
)
staticprotected

◆ ReadDataCallback()

int64_t DownloadInstance::ReadDataCallback ( uint8_t *  data,
uint64_t  len 
)
protected

◆ SetError()

void DownloadInstance::SetError ( const std::string &  error)
protected

◆ WriteDataCallback()

uint64_t DownloadInstance::WriteDataCallback ( uint8_t *  data,
uint64_t  len 
)
protected

The documentation for this class was generated from the following files: