00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef FILE_REFERENCES_H
00026 #define FILE_REFERENCES_H
00027
00028 #include <set>
00029
00030 enum FlowTypes { FLOW_NONE, FLOW_RET, FLOW_CALL, FLOW_JUMP, FLOW_CJUMP };
00031
00032 struct IstrReference
00033 {
00034 IstrReference() {};
00035 IstrReference(vma_t _from,vma_t _to,bool _direct,enum FlowTypes _type,bool _isApi=false):
00036 from(_from),to(_to),type(_type),direct(_direct),isApi(_isApi) {};
00037 IstrReference(vma_t _from,vma_t _to):
00038 from(_from),to(_to) {};
00039 vma_t from;
00040 vma_t to;
00041 enum FlowTypes type;
00042 bool direct;
00043 bool isApi;
00044 bool operator==(const IstrReference& rhs) const
00045 { return from==rhs.from && to==rhs.to; };
00046 bool operator<(const IstrReference& rhs) const
00047 { return from<rhs.from || (from==rhs.from && to<rhs.to); }
00048 };
00049
00050 class IstrReferences
00051 {
00052 typedef std::set< IstrReference,std::less<IstrReference> > TRefs;
00053 TRefs refs;
00054 public:
00055 typedef TRefs::const_iterator iterator;
00056 void Add(vma_t from,vma_t to,enum FlowTypes type);
00057 bool IsPresent(vma_t from,vma_t to) const;
00058 iterator beginReferenceTo(vma_t addr) const;
00059 iterator endReferenceTo(vma_t addr) const;
00060 };
00061
00062 #endif // FILE_REFERENCES_H