Loading...
Searching...
No Matches
DownloadProvider

Detailed Description

Classes

class  BinaryNinja::DownloadInstance
 
struct  BinaryNinja::DownloadInstance::Response
 
class  BinaryNinja::DownloadProvider
 

Class Documentation

◆ BinaryNinja::DownloadInstance

class BinaryNinja::DownloadInstance

Public Member Functions

int PerformRequest (const std::string &url, BNDownloadInstanceOutputCallbacks *callbacks)
 Send a GET request to a url, synchronously.
 
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.
 
std::string GetError () const
 Retrieve the error from the last request sent by this instance.
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNDownloadInstance, BNNewDownloadInstanceReference, BNFreeDownloadInstance >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNDownloadInstanceGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Protected Member Functions

 DownloadInstance (DownloadProvider *provider)
 
 DownloadInstance (BNDownloadInstance *instance)
 
virtual void DestroyInstance ()
 Cleanup any resources created by the instance.
 
virtual int PerformRequest (const std::string &url)=0
 Virtual method to synchronously perform a GET request to a url, overridden by a subclass.
 
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.
 
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 BNDownloadInstanceGetObject (CoreRefCountObject *obj)
 
static BNDownloadInstanceGetObject (const CoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNDownloadInstance, BNNewDownloadInstanceReference, BNFreeDownloadInstance >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNDownloadInstancem_object
 

Constructor & Destructor Documentation

◆ DownloadInstance() [1/2]

DownloadInstance::DownloadInstance ( DownloadProvider * provider)
protected

◆ DownloadInstance() [2/2]

DownloadInstance::DownloadInstance ( BNDownloadInstance * instance)
protected

Member Function Documentation

◆ DestroyInstanceCallback()

void DownloadInstance::DestroyInstanceCallback ( void * ctxt)
staticprotected

◆ PerformRequestCallback()

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

◆ 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

◆ DestroyInstance()

void DownloadInstance::DestroyInstance ( )
protectedvirtual

Cleanup any resources created by the instance.

◆ 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.

◆ 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.

◆ ReadDataCallback()

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

◆ WriteDataCallback()

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

◆ NotifyProgressCallback()

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

◆ SetError()

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

◆ 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

◆ 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

◆ GetError()

string DownloadInstance::GetError ( ) const

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

◆ BinaryNinja::DownloadInstance::Response

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

◆ BinaryNinja::DownloadProvider

class BinaryNinja::DownloadProvider

Public Member Functions

virtual Ref< DownloadInstanceCreateNewInstance ()=0
 
- Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNDownloadProvider >
 StaticCoreRefCountObject ()
 
virtual ~StaticCoreRefCountObject ()
 
BNDownloadProviderGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Static Public Member Functions

static std::vector< Ref< DownloadProvider > > GetList ()
 
static Ref< DownloadProviderGetByName (const std::string &name)
 
static void Register (DownloadProvider *provider)
 
- Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNDownloadProvider >
static BNDownloadProviderGetObject (StaticCoreRefCountObject *obj)
 

Protected Member Functions

 DownloadProvider (const std::string &name)
 
 DownloadProvider (BNDownloadProvider *provider)
 

Static Protected Member Functions

static BNDownloadInstanceCreateInstanceCallback (void *ctxt)
 

Additional Inherited Members

- Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNDownloadProvider >
std::atomic< int > m_refs
 
BNDownloadProviderm_object
 

Constructor & Destructor Documentation

◆ DownloadProvider() [1/2]

BinaryNinja::DownloadProvider::DownloadProvider ( const std::string & name)
protected

◆ DownloadProvider() [2/2]

DownloadProvider::DownloadProvider ( BNDownloadProvider * provider)
protected

Member Function Documentation

◆ CreateInstanceCallback()

BNDownloadInstance * DownloadProvider::CreateInstanceCallback ( void * ctxt)
staticprotected

◆ CreateNewInstance()

virtual Ref< DownloadInstance > BinaryNinja::DownloadProvider::CreateNewInstance ( )
pure virtual

◆ GetList()

vector< Ref< DownloadProvider > > DownloadProvider::GetList ( )
static

◆ GetByName()

Ref< DownloadProvider > DownloadProvider::GetByName ( const std::string & name)
static

◆ Register()

void DownloadProvider::Register ( DownloadProvider * provider)
static