diff options
| author | Brian Potchik <brian@vector35.com> | 2018-08-10 13:58:07 -0400 |
|---|---|---|
| committer | Brian Potchik <brian@vector35.com> | 2018-08-10 13:58:07 -0400 |
| commit | 199092fb6960090d88c8fecba1a0dbe503a9f7e0 (patch) | |
| tree | e4431ce420679b186ff4eef2a72099b276cb4df3 | |
| parent | 6ef32157e767aacd142012206bcf79c48266da2a (diff) | |
Finish DownloadProvider C++ API.
| -rw-r--r-- | binaryninjaapi.h | 5 | ||||
| -rw-r--r-- | downloadprovider.cpp | 22 |
2 files changed, 20 insertions, 7 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index a11bef1c..6cfa49bf 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -3680,9 +3680,10 @@ namespace BinaryNinja virtual int PerformRequest(const std::string& url) = 0; int PerformRequest(const std::string& url, BNDownloadInstanceOutputCallbacks* callbacks); - - std::string GetError() const; + uint64_t WriteDataCallback(uint8_t* data, uint64_t len); + bool NotifyProgressCallback(uint64_t progress, uint64_t total); void SetError(const std::string& error); + std::string GetError() const; }; class CoreDownloadInstance: public DownloadInstance diff --git a/downloadprovider.cpp b/downloadprovider.cpp index 436e2516..8e56bbf5 100644 --- a/downloadprovider.cpp +++ b/downloadprovider.cpp @@ -41,12 +41,15 @@ int DownloadInstance::PerformRequestCallback(void* ctxt, const char* url) } -string DownloadInstance::GetError() const +uint64_t DownloadInstance::WriteDataCallback(uint8_t* data, uint64_t len) { - char* str = BNGetErrorForDownloadInstance(m_object); - string result = str; - BNFreeString(str); - return result; + return BNWriteDataForDownloadInstance(m_object, data, len); +} + + +bool DownloadInstance::NotifyProgressCallback(uint64_t progress, uint64_t total) +{ + return BNNotifyProgressForDownloadInstance(m_object, progress, total); } @@ -56,6 +59,15 @@ void DownloadInstance::SetError(const string& error) } +string DownloadInstance::GetError() const +{ + char* str = BNGetErrorForDownloadInstance(m_object); + string result = str; + BNFreeString(str); + return result; +} + + int DownloadInstance::PerformRequest(const string& url, BNDownloadInstanceOutputCallbacks* callbacks) { return BNPerformDownloadRequest(m_object, url.c_str(), callbacks); |
