BinaryNinja::Collaboration::CollabSnapshot Class Reference

Public Member Functions

 CollabSnapshot (BNCollaborationSnapshot *snapshot)
 
Ref< RemoteFileGetFile ()
 
Ref< RemoteProjectGetProject ()
 
Ref< RemoteGetRemote ()
 
std::string GetUrl ()
 
std::string GetId ()
 
std::string GetName ()
 
std::string GetAuthor ()
 
int64_t GetCreated ()
 
int64_t GetLastModified ()
 
std::string GetHash ()
 
std::string GetSnapshotFileHash ()
 
bool HasPulledUndoEntries ()
 
bool IsFinalized ()
 
std::vector< std::string > GetParentIds ()
 
std::vector< std::string > GetChildIds ()
 
uint64_t GetAnalysisCacheBuildId ()
 
std::string GetTitle ()
 Get the title of a snapshot: the first line of its name. More...
 
std::string GetDescription ()
 Get the description of a snapshot: the lines of its name after the first line. More...
 
std::string GetAuthorUsername ()
 Get the username of the author of a snapshot, if possible (vs GetAuthor() which is user id) More...
 
std::vector< Ref< CollabSnapshot > > GetParents ()
 Get all snapshots in this snapshot's file that are parents of this snapshot. More...
 
std::vector< Ref< CollabSnapshot > > GetChildren ()
 Get all snapshots in this snapshot's file that are children of this snapshot. More...
 
std::vector< Ref< CollabUndoEntry > > GetUndoEntries ()
 Get all undo entries in the snapshot. More...
 
Ref< CollabUndoEntryGetUndoEntryById (uint64_t id)
 Get a undo entry in the snapshot by its id. More...
 
void PullUndoEntries (std::function< bool(size_t, size_t)> progress={})
 Pull list of undo entries from the remote. More...
 
Ref< CollabUndoEntryCreateUndoEntry (std::optional< uint64_t > parent, std::string data)
 Create a new undo entry on the remote (and pull it) More...
 
void Finalize ()
 Mark the snapshot as Finalized, preventing future modification and allowing child snapshots This change is pushed instantly (calls the finalize endpoint) More...
 
std::vector< uint8_t > DownloadSnapshotFile (std::function< bool(size_t, size_t)> progress={})
 Download the contents of the file backing a snapshot N.B. More...
 
std::vector< uint8_t > Download (std::function< bool(size_t, size_t)> progress={})
 Download the contents of the snapshot. More...
 
std::vector< uint8_t > DownloadAnalysisCache (std::function< bool(size_t, size_t)> progress={})
 Download the contents of the analysis cache for this snapshot, returns an empty vector if there is no cache (eg: old snapshots) More...
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNCollaborationSnapshot, BNNewCollaborationSnapshotReference, BNFreeCollaborationSnapshot >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNCollaborationSnapshotGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNCollaborationSnapshot, BNNewCollaborationSnapshotReference, BNFreeCollaborationSnapshot >
static BNCollaborationSnapshotGetObject (CoreRefCountObject *obj)
 
static BNCollaborationSnapshotGetObject (const CoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNCollaborationSnapshot, BNNewCollaborationSnapshotReference, BNFreeCollaborationSnapshot >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNCollaborationSnapshotm_object
 

Constructor & Destructor Documentation

◆ CollabSnapshot()

CollabSnapshot::CollabSnapshot ( BNCollaborationSnapshot snapshot)

Member Function Documentation

◆ GetFile()

Ref< RemoteFile > CollabSnapshot::GetFile ( )

◆ GetProject()

Ref< RemoteProject > CollabSnapshot::GetProject ( )

◆ GetRemote()

Ref< Remote > CollabSnapshot::GetRemote ( )

◆ GetUrl()

std::string CollabSnapshot::GetUrl ( )

◆ GetId()

std::string CollabSnapshot::GetId ( )

◆ GetName()

std::string CollabSnapshot::GetName ( )

◆ GetAuthor()

std::string CollabSnapshot::GetAuthor ( )

◆ GetCreated()

int64_t CollabSnapshot::GetCreated ( )

◆ GetLastModified()

int64_t CollabSnapshot::GetLastModified ( )

◆ GetHash()

std::string CollabSnapshot::GetHash ( )

◆ GetSnapshotFileHash()

std::string CollabSnapshot::GetSnapshotFileHash ( )

◆ HasPulledUndoEntries()

bool CollabSnapshot::HasPulledUndoEntries ( )

◆ IsFinalized()

bool CollabSnapshot::IsFinalized ( )

◆ GetParentIds()

std::vector< std::string > CollabSnapshot::GetParentIds ( )

◆ GetChildIds()

std::vector< std::string > CollabSnapshot::GetChildIds ( )

◆ GetAnalysisCacheBuildId()

uint64_t CollabSnapshot::GetAnalysisCacheBuildId ( )

◆ GetTitle()

std::string CollabSnapshot::GetTitle ( )

Get the title of a snapshot: the first line of its name.

Returns
CollabSnapshot title as described

◆ GetDescription()

std::string CollabSnapshot::GetDescription ( )

Get the description of a snapshot: the lines of its name after the first line.

Returns
CollabSnapshot description as described

◆ GetAuthorUsername()

std::string CollabSnapshot::GetAuthorUsername ( )

Get the username of the author of a snapshot, if possible (vs GetAuthor() which is user id)

Returns
CollabSnapshot author username

◆ GetParents()

std::vector< Ref< CollabSnapshot > > CollabSnapshot::GetParents ( )

Get all snapshots in this snapshot's file that are parents of this snapshot.

Returns
List of parent snapshots
Exceptions
RemoteExceptionIf a parent snapshot does not exist in the file or if the remote is not connected

◆ GetChildren()

std::vector< Ref< CollabSnapshot > > CollabSnapshot::GetChildren ( )

Get all snapshots in this snapshot's file that are children of this snapshot.

Returns
List of child snapshots
Exceptions
RemoteExceptionIf a child snapshot does not exist in the file or if the remote is not connected

◆ GetUndoEntries()

std::vector< Ref< CollabUndoEntry > > CollabSnapshot::GetUndoEntries ( )

Get all undo entries in the snapshot.

Returns
All undo entries
Exceptions
RemoteExceptionif undo entries have not been pulled or if the remote is not connected

◆ GetUndoEntryById()

Ref< CollabUndoEntry > CollabSnapshot::GetUndoEntryById ( uint64_t  id)

Get a undo entry in the snapshot by its id.

Parameters
idUndo entry's id
Returns
Undo entry, or null shared_ptr if not found
Exceptions
RemoteExceptionIf undo entries have not been pulled or if the remote is not connected

◆ PullUndoEntries()

void CollabSnapshot::PullUndoEntries ( std::function< bool(size_t, size_t)>  progress = {})

Pull list of undo entries from the remote.

Necessary before calling GetUndoEntries()

Parameters
progressFunction to call on progress updates
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected

◆ CreateUndoEntry()

Ref< CollabUndoEntry > CollabSnapshot::CreateUndoEntry ( std::optional< uint64_t >  parent,
std::string  data 
)

Create a new undo entry on the remote (and pull it)

Parameters
parentUndo entry parent id (if exists)
dataUndo entry data
Returns
Reference to the created undo entry
Exceptions
RemoteExceptionIf there is an error in any request, or if the snapshot is finalized, or if the remote is not connected

◆ Finalize()

void CollabSnapshot::Finalize ( )

Mark the snapshot as Finalized, preventing future modification and allowing child snapshots This change is pushed instantly (calls the finalize endpoint)

Exceptions
RemoteExceptionif there is an error in any request or if the remote is not connected

◆ DownloadSnapshotFile()

std::vector< uint8_t > CollabSnapshot::DownloadSnapshotFile ( std::function< bool(size_t, size_t)>  progress = {})

Download the contents of the file backing a snapshot N.B.

Multiple snapshots can be backed by the same file

Parameters
progressFunction to call on progress updates
Returns
Contents of the file at the point of the snapshot
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected

◆ Download()

std::vector< uint8_t > CollabSnapshot::Download ( std::function< bool(size_t, size_t)>  progress = {})

Download the contents of the snapshot.

Parameters
progressFunction to call on progress updates
Returns
Contents of the snapshot
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected

◆ DownloadAnalysisCache()

std::vector< uint8_t > CollabSnapshot::DownloadAnalysisCache ( std::function< bool(size_t, size_t)>  progress = {})

Download the contents of the analysis cache for this snapshot, returns an empty vector if there is no cache (eg: old snapshots)

Parameters
progressFunction to call on progress updates
Returns
Contents of the analysis cache
Exceptions
RemoteExceptionIf there is an error in any request or if the remote is not connected