Loading...
Searching...
No Matches
BinaryNinja::CoreDownloadInstance Class Reference

Public Member Functions

 CoreDownloadInstance (BNDownloadInstance *instance)
virtual ~CoreDownloadInstance ()
virtual int PerformRequest (const std::string &url) override
 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, DownloadInstance::Response &response) override
 Virtual method to synchronously perform a request to a url, overridden by a subclass.
Public Member Functions inherited from BinaryNinja::DownloadInstance
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 ()

Additional Inherited Members

Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNDownloadInstance, BNNewDownloadInstanceReference, BNFreeDownloadInstance >
std::atomic< int > m_refs
bool m_registeredRef
BNDownloadInstancem_object
Protected Member Functions inherited from BinaryNinja::DownloadInstance
 DownloadInstance (DownloadProvider *provider)
 DownloadInstance (BNDownloadInstance *instance)
virtual void DestroyInstance ()
 Cleanup any resources created by the instance.
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 inherited from BinaryNinja::DownloadInstance
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)

Constructor & Destructor Documentation

◆ CoreDownloadInstance()

CoreDownloadInstance::CoreDownloadInstance ( BNDownloadInstance * instance)

◆ ~CoreDownloadInstance()

virtual BinaryNinja::CoreDownloadInstance::~CoreDownloadInstance ( )
inlinevirtual

Member Function Documentation

◆ PerformRequest()

int CoreDownloadInstance::PerformRequest ( const std::string & url)
overridevirtual

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

Implements BinaryNinja::DownloadInstance.

◆ PerformCustomRequest()

int CoreDownloadInstance::PerformCustomRequest ( const std::string & method,
const std::string & url,
const std::unordered_map< std::string, std::string > & headers,
DownloadInstance::Response & response )
overridevirtual

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

Implements BinaryNinja::DownloadInstance.