ROSE  0.11.66.0
FunctionIdDatabaseInterface.h
1 #ifndef FUNCTION_ID_DATABASE_INTERFACE_H
2 #define FUNCTION_ID_DATABASE_INTERFACE_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include "sqlite3x.h"
7 #include "LibraryInfo.h"
8 #include "FunctionInfo.h"
9 #include <vector>
10 #include <ctype.h>
11 
19 {
31  {
32  UNKNOWN,
33  COMBINE,
34  REPLACE,
35  NO_ADD
36  };
37 
38  enum DUPLICATE_OPTION duplicateOptionFromString(std::string option);
39 
40 
47  {
48  public:
59  FunctionIdDatabaseInterface(const std::string& dbName);
60 
61 
73  void createTables();
74 
75 
76  // @brief Add an entry for a function to the database
77  void addFunctionToDB(const FunctionInfo& fInfo, enum DUPLICATE_OPTION dupOption = COMBINE);
78 
85  bool matchOneFunction(FunctionInfo& fInfo);
86 
92  std::vector<FunctionInfo> matchFunction(const FunctionInfo& fInfo);
93 
94 
102  bool exactMatchFunction(const FunctionInfo& fInfo);
103 
104 
109  void removeFunctions(const std::string& funcHash);
110 
111 
112  // @brief Add an entry for a library to the database
113  void addLibraryToDB(const LibraryInfo& lInfo, bool replace = false);
114 
119  bool matchLibrary(LibraryInfo& fInfo);
120 
121  private:
122  // @brief The name of the database
123  std::string database_name;
124 
125  // @brief SQLite database handle
126  sqlite3x::sqlite3_connection sqConnection;
127 
128  };
129 }
130 
131 #endif
132 #endif
class FunctionInfo Combines all the information to uniquely identify a single function in one object...
Definition: FunctionInfo.h:24
bool matchOneFunction(FunctionInfo &fInfo)
Lookup a single function in the database.
FunctionIdDatabaseInterface(const std::string &dbName)
FunctionIdentification.
void createTables()
createTables Make sure that all the tables are defined in the function identification database...
void removeFunctions(const std::string &funcHash)
Removes any functions that match the hash from the database.
Creates and holds the handle for the sqlite database used for storing and matching libraries and func...
DUPLICATE_OPTION
Option for what to do if a function with the same hash is found when adding a function.
std::vector< FunctionInfo > matchFunction(const FunctionInfo &fInfo)
Lookup all functions with the hash in the database.
bool matchLibrary(LibraryInfo &fInfo)
Lookup a library in the database.
bool exactMatchFunction(const FunctionInfo &fInfo)
Exactly lookup a function in the database.