IDA SDK
|
Functions that provide the lowest level public interface to the database. Namely, we use Btree. To learn more about BTree:
https://en.wikipedia.org/wiki/B-tree
We do not use Btree directly. Instead, we have another layer built on the top of Btree. Here is a brief explanation of this layer.
An object called "netnode" is modeled on the top of Btree. Each netnode has a unique id: a 32-bit value (64-bit for ida64). Initially there is a trivial mapping of the linear addresses used in the program to netnodes (later this mapping may be modified using ea2node and node2ea functions; this is used for fast database rebasings). If we have additional information about an address (for example, a comment is attached to it), this information is stored in the corresponding netnode. See nalt.hpp to see how the kernel uses netnodes. Also, some netnodes have no corresponding linear address (however, they still have an id). They are used to store information not related to a particular address.
Each netnode _may_ have the following attributes:
Initially a new netnode contains no information at all so no disk space is used for it. As you add new information, the netnode grows.
All arrays that are attached to the netnode behave in the same manner. Initially:
If you need to store objects bigger that MAXSPECSIZE, please note that there are high-level functions to store arbitrary sized objects in supvals. See setblob/getblob and other blob-related functions.
You may use netnodes to store additional information about the program. Limitations on the use of netnodes are the following:
Advanced info:
In fact a netnode may contain up to 256 arrays of arbitrary sized objects (not only the 4 listed above). Each array has an 8-bit tag. Usually tags are represented by character constants. For example, altvals and supvals are simply 2 of 256 arrays, with the tags 'A' and 'S' respectively.
Classes | |
struct | altadjust_visitor_t |
visitor to be used by altadjust2 to skip the adjustment of some altvals More... | |
class | netnode |
Definition of the IDA database node. More... | |
Functions | |
CASSERT (sizeof(netnode)==4) | |
Helper functions | |
They should not be called directly! See netnode | |
idaman bool ida_export | netnode_check (netnode *, const char *name, size_t namlen, bool create) |
idaman void ida_export | netnode_kill (netnode *) |
idaman bool ida_export | netnode_start (netnode *) |
idaman bool ida_export | netnode_end (netnode *) |
idaman bool ida_export | netnode_next (netnode *) |
idaman bool ida_export | netnode_prev (netnode *) |
idaman ssize_t ida_export | netnode_get_name (nodeidx_t num, qstring *out) |
idaman bool ida_export | netnode_rename (nodeidx_t num, const char *newname, size_t namlen) |
idaman ssize_t ida_export | netnode_valobj (nodeidx_t num, void *buf, size_t bufsize) |
idaman ssize_t ida_export | netnode_valstr (nodeidx_t num, char *buf, size_t bufsize) |
idaman ssize_t ida_export | netnode_qvalstr (nodeidx_t num, qstring *buf) |
idaman bool ida_export | netnode_set (nodeidx_t num, const void *value, size_t length) |
idaman bool ida_export | netnode_delvalue (nodeidx_t num) |
idaman nodeidx_t ida_export | netnode_altval (nodeidx_t num, nodeidx_t alt, int tag) |
idaman uchar ida_export | netnode_charval (nodeidx_t num, nodeidx_t alt, int tag) |
idaman nodeidx_t ida_export | netnode_altval_idx8 (nodeidx_t num, uchar alt, int tag) |
idaman uchar ida_export | netnode_charval_idx8 (nodeidx_t num, uchar alt, int tag) |
idaman ssize_t ida_export | netnode_supval (nodeidx_t num, nodeidx_t alt, void *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_supstr (nodeidx_t num, nodeidx_t alt, char *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_qsupstr (nodeidx_t num, qstring *buf, nodeidx_t alt, int tag) |
idaman bool ida_export | netnode_supset (nodeidx_t num, nodeidx_t alt, const void *value, size_t length, int tag) |
idaman bool ida_export | netnode_supdel (nodeidx_t num, nodeidx_t alt, int tag) |
idaman nodeidx_t ida_export | netnode_lower_bound (nodeidx_t num, nodeidx_t cur, int tag) |
idaman nodeidx_t ida_export | netnode_supfirst (nodeidx_t num, int tag) |
idaman nodeidx_t ida_export | netnode_supnext (nodeidx_t num, nodeidx_t cur, int tag) |
idaman nodeidx_t ida_export | netnode_suplast (nodeidx_t num, int tag) |
idaman nodeidx_t ida_export | netnode_supprev (nodeidx_t num, nodeidx_t cur, int tag) |
idaman ssize_t ida_export | netnode_supval_idx8 (nodeidx_t num, uchar alt, void *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_supstr_idx8 (nodeidx_t num, uchar alt, char *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_qsupstr_idx8 (nodeidx_t num, qstring *buf, uchar alt, int tag) |
idaman bool ida_export | netnode_supset_idx8 (nodeidx_t num, uchar alt, const void *value, size_t length, int tag) |
idaman bool ida_export | netnode_supdel_idx8 (nodeidx_t num, uchar alt, int tag) |
idaman nodeidx_t ida_export | netnode_lower_bound_idx8 (nodeidx_t num, uchar alt, int tag) |
idaman nodeidx_t ida_export | netnode_supfirst_idx8 (nodeidx_t num, int tag) |
idaman nodeidx_t ida_export | netnode_supnext_idx8 (nodeidx_t num, uchar alt, int tag) |
idaman nodeidx_t ida_export | netnode_suplast_idx8 (nodeidx_t num, int tag) |
idaman nodeidx_t ida_export | netnode_supprev_idx8 (nodeidx_t num, uchar alt, int tag) |
idaman bool ida_export | netnode_supdel_all (nodeidx_t num, int tag) |
idaman int ida_export | netnode_supdel_range (nodeidx_t num, nodeidx_t idx1, nodeidx_t idx2, int tag) |
idaman int ida_export | netnode_supdel_range_idx8 (nodeidx_t num, nodeidx_t idx1, nodeidx_t idx2, int tag) |
idaman ssize_t ida_export | netnode_hashval (nodeidx_t num, const char *idx, void *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_hashstr (nodeidx_t num, const char *idx, char *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_qhashstr (nodeidx_t num, qstring *buf, const char *idx, int tag) |
idaman nodeidx_t ida_export | netnode_hashval_long (nodeidx_t num, const char *idx, int tag) |
idaman bool ida_export | netnode_hashset (nodeidx_t num, const char *idx, const void *value, size_t length, int tag) |
idaman bool ida_export | netnode_hashdel (nodeidx_t num, const char *idx, int tag) |
idaman ssize_t ida_export | netnode_hashfirst (nodeidx_t num, char *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_qhashfirst (nodeidx_t num, qstring *buf, int tag) |
idaman ssize_t ida_export | netnode_hashnext (nodeidx_t num, const char *idx, char *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_qhashnext (nodeidx_t num, qstring *buf, const char *idx, int tag) |
idaman ssize_t ida_export | netnode_hashlast (nodeidx_t num, char *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_qhashlast (nodeidx_t num, qstring *buf, int tag) |
idaman ssize_t ida_export | netnode_hashprev (nodeidx_t num, const char *idx, char *buf, size_t bufsize, int tag) |
idaman ssize_t ida_export | netnode_qhashprev (nodeidx_t num, qstring *buf, const char *idx, int tag) |
idaman size_t ida_export | netnode_blobsize (nodeidx_t num, nodeidx_t start, int tag) |
idaman void *ida_export | netnode_getblob (nodeidx_t num, void *buf, size_t *bufsize, nodeidx_t start, int tag) |
idaman ssize_t ida_export | netnode_qgetblob (nodeidx_t num, bytevec_t *buf, size_t elsize, nodeidx_t start, int tag) |
idaman bool ida_export | netnode_setblob (nodeidx_t num, const void *buf, size_t size, nodeidx_t start, int tag) |
idaman int ida_export | netnode_delblob (nodeidx_t num, nodeidx_t start, int tag) |
idaman bool ida_export | netnode_inited (void) |
idaman bool ida_export | netnode_is_available (void) |
idaman size_t ida_export | netnode_copy (nodeidx_t num, nodeidx_t count, nodeidx_t target, bool move) |
idaman size_t ida_export | netnode_altshift (nodeidx_t num, nodeidx_t from, nodeidx_t to, nodeidx_t size, int tag) |
idaman size_t ida_export | netnode_charshift (nodeidx_t num, nodeidx_t from, nodeidx_t to, nodeidx_t size, int tag) |
idaman size_t ida_export | netnode_supshift (nodeidx_t num, nodeidx_t from, nodeidx_t to, nodeidx_t size, int tag) |
idaman size_t ida_export | netnode_blobshift (nodeidx_t num, nodeidx_t from, nodeidx_t to, nodeidx_t size, int tag) |
idaman void ida_export | netnode_altadjust (nodeidx_t num, nodeidx_t from, nodeidx_t to, nodeidx_t size, bool(idaapi *should_skip)(nodeidx_t ea)) |
idaman void ida_export | netnode_altadjust2 (nodeidx_t num, nodeidx_t from, nodeidx_t to, nodeidx_t size, altadjust_visitor_t &av) |
idaman bool ida_export | netnode_exist (const netnode &n) |
Macros | |
#define | BADNODE nodeidx_t(-1) |
A number to represent a bad netnode reference. | |
Typedefs | |
typedef uint64 | nodeidx64_t |
typedef uint32 | nodeidx32_t |
typedef nodeidx32_t | nodeidx_t |
Variables | |
const int | MAXNAMESIZE = 512 |
Maximum length of a netnode name. WILL BE REMOVED IN THE FUTURE. | |
const int | MAX_NODENAME_SIZE = 32*1024 |
Maximum length of a name. We permit names up to 32KB-1 bytes. | |
const int | MAXSPECSIZE = 1024 |
Maximum length of strings or objects stored in a supval array element. | |
const uchar | atag = 'A' |
Array of altvals. | |
const uchar | stag = 'S' |
Array of supvals. | |
const uchar | htag = 'H' |
Array of hashvals. | |
const uchar | vtag = 'V' |
Value of netnode. | |
const uchar | ntag = 'N' |
Name of netnode. | |
const uchar | ltag = 'L' |
Links between netnodes. | |
const int | NETMAP_IDX = 0x100 |
const int | NETMAP_VAL = 0x200 |
const int | NETMAP_STR = 0x400 |
const int | NETMAP_X8 = 0x800 |
const int | NETMAP_V8 = 0x1000 |
const int | NETMAP_VAL_NDX = 0x2000 |