Classes | |
class | BinaryNinja::WebsocketClient |
class | BinaryNinja::CoreWebsocketClient |
class | BinaryNinja::WebsocketProvider |
class BinaryNinja::WebsocketClient |
Public Member Functions | |
bool | Connect (const std::string &host, const std::unordered_map< std::string, std::string > &headers, BNWebsocketClientOutputCallbacks *callbacks) |
Connect to a given url, asynchronously. | |
virtual bool | Write (const std::vector< uint8_t > &data)=0 |
Write some data to the websocket. | |
virtual bool | Disconnect ()=0 |
Disconnect the websocket. | |
Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNWebsocketClient, BNNewWebsocketClientReference, BNFreeWebsocketClient > | |
CoreRefCountObject () | |
virtual | ~CoreRefCountObject () |
BNWebsocketClient * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | ReleaseForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Protected Member Functions | |
WebsocketClient (WebsocketProvider *provider) | |
WebsocketClient (BNWebsocketClient *instance) | |
bool | ReadData (uint8_t *data, uint64_t len) |
virtual void | DestroyClient () |
Cleanup any resources created by the client. | |
virtual bool | Connect (const std::string &host, const std::unordered_map< std::string, std::string > &headers)=0 |
Virtual method for performing the connection, overridden by a subclass. | |
Static Protected Member Functions | |
static void | DestroyClientCallback (void *ctxt) |
static bool | ConnectCallback (void *ctxt, const char *host, uint64_t headerCount, const char *const *headerKeys, const char *const *headerValues) |
static bool | WriteCallback (const uint8_t *data, uint64_t len, void *ctxt) |
static bool | DisconnectCallback (void *ctxt) |
static void | ErrorCallback (const char *msg, void *ctxt) |
Additional Inherited Members | |
Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNWebsocketClient, BNNewWebsocketClientReference, BNFreeWebsocketClient > | |
static BNWebsocketClient * | GetObject (CoreRefCountObject *obj) |
static BNWebsocketClient * | GetObject (const CoreRefCountObject *obj) |
Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNWebsocketClient, BNNewWebsocketClientReference, BNFreeWebsocketClient > | |
std::atomic< int > | m_refs |
bool | m_registeredRef |
BNWebsocketClient * | m_object |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protectedvirtual |
Cleanup any resources created by the client.
|
protectedpure virtual |
Virtual method for performing the connection, overridden by a subclass.
host | Full url with scheme, domain, optionally port, and path |
headers | HTTP header keys and values |
Implemented in BinaryNinja::CoreWebsocketClient.
bool WebsocketClient::Connect | ( | const std::string & | host, |
const std::unordered_map< std::string, std::string > & | headers, | ||
BNWebsocketClientOutputCallbacks * | callbacks ) |
Connect to a given url, asynchronously.
The connection will be run in a separate thread managed by the websocket provider.
Callbacks will be called **on the thread of the connection**, so be sure to ExecuteOnMainThread any long-running or gui operations in the callbacks.
If the connection succeeds, connectedCallback will be called. On normal termination, disconnectedCallback will be called. If the connection succeeds, but later fails, disconnectedCallback will not be called, and errorCallback will be called instead. If the connection fails, neither connectedCallback nor disconnectedCallback will be called, and errorCallback will be called instead.
If connectedCallback or readCallback return false, the connection will be aborted.
host | Full url with scheme, domain, optionally port, and path |
headers | HTTP header keys and values |
callbacks | Structure with callbacks for various websocket events |
|
pure virtual |
Write some data to the websocket.
data | Data to write |
Implemented in BinaryNinja::CoreWebsocketClient.
|
pure virtual |
Disconnect the websocket.
Implemented in BinaryNinja::CoreWebsocketClient.
class BinaryNinja::CoreWebsocketClient |
Public Member Functions | |
CoreWebsocketClient (BNWebsocketClient *instance) | |
virtual | ~CoreWebsocketClient () |
virtual bool | Connect (const std::string &host, const std::unordered_map< std::string, std::string > &headers) override |
Virtual method for performing the connection, overridden by a subclass. | |
virtual bool | Write (const std::vector< uint8_t > &data) override |
Write some data to the websocket. | |
virtual bool | Disconnect () override |
Disconnect the websocket. | |
Public Member Functions inherited from BinaryNinja::WebsocketClient | |
bool | Connect (const std::string &host, const std::unordered_map< std::string, std::string > &headers, BNWebsocketClientOutputCallbacks *callbacks) |
Connect to a given url, asynchronously. | |
Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNWebsocketClient, BNNewWebsocketClientReference, BNFreeWebsocketClient > | |
CoreRefCountObject () | |
virtual | ~CoreRefCountObject () |
BNWebsocketClient * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | ReleaseForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Additional Inherited Members | |
Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNWebsocketClient, BNNewWebsocketClientReference, BNFreeWebsocketClient > | |
static BNWebsocketClient * | GetObject (CoreRefCountObject *obj) |
static BNWebsocketClient * | GetObject (const CoreRefCountObject *obj) |
Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNWebsocketClient, BNNewWebsocketClientReference, BNFreeWebsocketClient > | |
std::atomic< int > | m_refs |
bool | m_registeredRef |
BNWebsocketClient * | m_object |
Protected Member Functions inherited from BinaryNinja::WebsocketClient | |
WebsocketClient (WebsocketProvider *provider) | |
WebsocketClient (BNWebsocketClient *instance) | |
bool | ReadData (uint8_t *data, uint64_t len) |
virtual void | DestroyClient () |
Cleanup any resources created by the client. | |
Static Protected Member Functions inherited from BinaryNinja::WebsocketClient | |
static void | DestroyClientCallback (void *ctxt) |
static bool | ConnectCallback (void *ctxt, const char *host, uint64_t headerCount, const char *const *headerKeys, const char *const *headerValues) |
static bool | WriteCallback (const uint8_t *data, uint64_t len, void *ctxt) |
static bool | DisconnectCallback (void *ctxt) |
static void | ErrorCallback (const char *msg, void *ctxt) |
CoreWebsocketClient::CoreWebsocketClient | ( | BNWebsocketClient * | instance | ) |
|
inlinevirtual |
|
overridevirtual |
Virtual method for performing the connection, overridden by a subclass.
host | Full url with scheme, domain, optionally port, and path |
headers | HTTP header keys and values |
Implements BinaryNinja::WebsocketClient.
|
overridevirtual |
Write some data to the websocket.
data | Data to write |
Implements BinaryNinja::WebsocketClient.
|
overridevirtual |
class BinaryNinja::WebsocketProvider |
Public Member Functions | |
virtual Ref< WebsocketClient > | CreateNewClient ()=0 |
Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNWebsocketProvider > | |
StaticCoreRefCountObject () | |
virtual | ~StaticCoreRefCountObject () |
BNWebsocketProvider * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Static Public Member Functions | |
static std::vector< Ref< WebsocketProvider > > | GetList () |
static Ref< WebsocketProvider > | GetByName (const std::string &name) |
static void | Register (WebsocketProvider *provider) |
Static Public Member Functions inherited from BinaryNinja::StaticCoreRefCountObject< BNWebsocketProvider > | |
static BNWebsocketProvider * | GetObject (StaticCoreRefCountObject *obj) |
Protected Member Functions | |
WebsocketProvider (const std::string &name) | |
WebsocketProvider (BNWebsocketProvider *provider) | |
Static Protected Member Functions | |
static BNWebsocketClient * | CreateClientCallback (void *ctxt) |
Additional Inherited Members | |
Public Attributes inherited from BinaryNinja::StaticCoreRefCountObject< BNWebsocketProvider > | |
std::atomic< int > | m_refs |
BNWebsocketProvider * | m_object |
|
protected |
|
protected |
|
staticprotected |
|
pure virtual |
Implemented in BinaryNinja::CoreWebsocketProvider.
|
static |
|
static |
|
static |