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