ROSE  0.11.50.0
MagicNumber.h
1 #ifndef ROSE_BinaryAnalysis_MagicNumber_H
2 #define ROSE_BinaryAnalysis_MagicNumber_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/BinaryAnalysis/MemoryMap.h>
7 
8 namespace Rose {
9 namespace BinaryAnalysis {
10 
14 class MagicNumberDetails;
15 
16 class MagicNumber {
17 public:
18  enum Mechanism { FAST, SLOW, NONE };
19 
20 private:
21  MagicNumberDetails *details_;
22  Mechanism mechanism_;
23  size_t maxBytes_;
24 
25 public:
27  MagicNumber(): details_(NULL), maxBytes_(256) {
28  init();
29  }
30 
31  ~MagicNumber();
32 
46  Mechanism mechanism() const { return mechanism_; }
47 
55  size_t maxBytesToCheck() const { return maxBytes_; }
56  void maxBytesToCheck(size_t n) { maxBytes_ = n; }
60  std::string identify(const MemoryMap::Ptr&, rose_addr_t va) const;
61 
62 private:
63  void init();
64 };
65 
66 } // namespace
67 } // namespace
68 
69 #endif
70 #endif
Main namespace for the ROSE library.
void maxBytesToCheck(size_t n)
Property: Max number of bytes to check at once.
Definition: MagicNumber.h:56
MagicNumber()
Create a magic number analyzer.
Definition: MagicNumber.h:27
std::string identify(const MemoryMap::Ptr &, rose_addr_t va) const
Identify the magic number at the specified address.
size_t maxBytesToCheck() const
Property: Max number of bytes to check at once.
Definition: MagicNumber.h:55
Mechanism mechanism() const
Property: The mechanism being used to find magic numbers.
Definition: MagicNumber.h:46