From 95b145165e424d69554d03d4ebcf4cc13d43ec88 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Fri, 7 Feb 2020 20:06:11 -0500 Subject: Undobuffer merging and mergetool --- binaryninjaapi.h | 68 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 31 deletions(-) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index a3bf8578..8267cbb8 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -832,46 +832,46 @@ __attribute__ ((format (printf, 1, 2))) class BinaryView; - class UndoAction + class User : public CoreRefCountObject { - private: - std::string m_typeName; - BNActionType m_actionType; - - static void FreeCallback(void* ctxt); - static void UndoCallback(void* ctxt, BNBinaryView* data); - static void RedoCallback(void* ctxt, BNBinaryView* data); - static char* SerializeCallback(void* ctxt); - - public: - UndoAction(const std::string& name, BNActionType action); - virtual ~UndoAction() {} + private: + std::string m_id; + std::string m_name; + std::string m_email; + public: + User(BNUser* user); + std::string GetName(); + std::string GetEmail(); + std::string GetId(); + }; - const std::string& GetTypeName() const { return m_typeName; } - BNActionType GetActionType() const { return m_actionType; } - BNUndoAction GetCallbacks(); + struct InstructionTextToken; - void Add(BNBinaryView* view); + struct UndoAction + { + BNActionType actionType; + std::string summaryText; + std::vector summaryTokens; - virtual void Undo(BinaryView* data) = 0; - virtual void Redo(BinaryView* data) = 0; - virtual Json::Value Serialize() = 0; + UndoAction() {}; + UndoAction(const BNUndoAction& action); }; - class UndoActionType + struct UndoEntry { - protected: - std::string m_nameForRegister; - - static bool DeserializeCallback(void* ctxt, const char* data, BNUndoAction* result); - - public: - UndoActionType(const std::string& name); - virtual ~UndoActionType() {} + Ref user; + std::string hash; + std::vector actions; + uint64_t timestamp; + }; - static void Register(UndoActionType* type); + struct MergeResult + { + BNMergeStatus status; + UndoAction action; + std::string hash; - virtual UndoAction* Deserialize(const Json::Value& data) = 0; + MergeResult(const BNMergeResult& result); }; class FileMetadata: public CoreRefCountObject @@ -911,12 +911,18 @@ __attribute__ ((format (printf, 1, 2))) bool Rebase(BinaryView* data, uint64_t address); bool Rebase(BinaryView* data, uint64_t address, const std::function& progressCallback); + MergeResult MergeUserAnalysis(const std::string& name, const std::function& progress, + const std::vector excludedHashes = {} ); + void BeginUndoActions(); void CommitUndoActions(); bool Undo(); bool Redo(); + std::vector> GetUsers(); + std::vector GetUndoEntries(); + std::string GetCurrentView(); uint64_t GetCurrentOffset(); bool Navigate(const std::string& view, uint64_t offset); -- cgit v1.3.1