BinaryNinja::EnterpriseServer::LicenseCheckout Class Reference

RAII object for holding an Enterprise license in a scope. More...

Detailed Description

RAII object for holding an Enterprise license in a scope.

Automatically releases the license when destroyed.

Example:

using namespace BinaryNinja;
assert(EnterpriseServer::AuthenticateWithCredentials("username", "password", true));
{
Ref<BinaryView> bv = OpenView("/bin/ls", true, {}, options);
printf("%llx\n", bv->GetStart());
// License is released at end of scope
}
RAII object for holding an Enterprise license in a scope.
Definition: enterprise.h:212
Definition: binaryninjaapi.h:191
bool Connect()
Perform initial connect to the server, pulling signing key and time limit.
Definition: enterprise.cpp:69
bool AuthenticateWithCredentials(const std::string &username, const std::string &password, bool remember)
Authenticate to the server with username and password.
Definition: enterprise.cpp:26
Definition: binaryninjaapi.h:59
Ref< BinaryView > OpenView(const std::string &filename, bool updateAnalysis=true, std::function< bool(size_t, size_t)> progress={}, Json::Value options=Json::Value(Json::objectValue))
OpenView opens a file on disk and returns a BinaryView, attempting to use the most relevant BinaryVie...
Definition: binaryview.cpp:4412

Public Member Functions

 LicenseCheckout (int64_t duration=900)
 RAII constructor that checks out a license. More...
 
 ~LicenseCheckout ()
 

Constructor & Destructor Documentation

◆ LicenseCheckout()

BinaryNinja::EnterpriseServer::LicenseCheckout::LicenseCheckout ( int64_t  duration = 900)
explicit

RAII constructor that checks out a license.

License will be refreshed automatically in a background thread while checked out, in intervals of duration In the event of program crash, the license will expire duration seconds after the most recent background refresh, so you may want a smaller value like 60 if you expect your program to crash / be killed often. See class docs for example usage.

Parameters
durationDuration for refreshes and also length of each license checkout.
Exceptions
EnterpriseExceptionIf license checkout fails

◆ ~LicenseCheckout()

BinaryNinja::EnterpriseServer::LicenseCheckout::~LicenseCheckout ( )