AVL trees for storing opdis addresses and instructions. More...
#include <sys/types.h>
#include <opdis/model.h>
#include <opdis/types.h>
Go to the source code of this file.
Data Structures | |
struct | opdis_tree_node_t |
A node in an AVL tree. More... | |
struct | opdis_tree_base_t |
The base of the tree. More... | |
Typedefs | |
typedef void *(* | OPDIS_TREE_KEY_FN )(void *item) |
Callback to get the key for an item stored in a tree. | |
typedef int(* | OPDIS_TREE_CMP_FN )(void *a, void *b) |
Callback to compare two keys. | |
typedef void(* | OPDIS_TREE_FREE_FN )(void *item) |
Callback to free items stored in the tree. | |
typedef opdis_tree_base_t * | opdis_tree_t |
A generic AVL tree. | |
typedef opdis_tree_base_t * | opdis_vma_tree_t |
An AVL tree for storing opdis addresses. | |
typedef opdis_tree_base_t * | opdis_insn_tree_t |
An AVL tree for storing opdis instructions. | |
typedef int(* | OPDIS_TREE_FOREACH_FN )(void *item, void *arg) |
Callback invoked by opdis_tree_foreach. | |
typedef int(* | OPDIS_ADDR_TREE_FOREACH_FN )(opdis_vma_t addr, void *arg) |
Callback invoked for every address emitted by opdis_vma_tree_foreach. | |
typedef int(* | OPDIS_INSN_TREE_FOREACH_FN )(opdis_insn_t *insn, void *arg) |
Callback invoked for each insn emitted by opdis_insn_tree_foreach. | |
Functions | |
opdis_tree_t LIBCALL | opdis_tree_init (OPDIS_TREE_KEY_FN key_fn, OPDIS_TREE_CMP_FN cmp_fn, OPDIS_TREE_FREE_FN free_fn) |
Allocate and initialize for an AVL tree. | |
int LIBCALL | opdis_tree_add (opdis_tree_t tree, void *data) |
Insert a node into the tree. | |
int LIBCALL | opdis_tree_update (opdis_tree_t tree, void *data) |
Insert or overwrite a node in the tree. | |
int LIBCALL | opdis_tree_delete (opdis_tree_t tree, void *key) |
Remove an item from the tree. | |
int LIBCALL | opdis_tree_contains (opdis_tree_t tree, void *key) |
Determine if tree contains data. | |
void *LIBCALL | opdis_tree_find (opdis_tree_t tree, void *key) |
Find data in a tree. | |
void *LIBCALL | opdis_tree_closest (opdis_tree_t tree, void *key) |
Find closest match to data in a tree. This returns the item that matches the key, or the item that is closest to (but less than) the key, or NULL if there is no item less than or equal to the key. | |
void *LIBCALL | opdis_tree_next (opdis_tree_t tree, void *key) |
Find the data succeeding the key in a tree. This returns the item that occurs immediately after key in the tree, or immediately after where key would be if it were in the tree. If there are no items greater than key in the tree, this returns NULL. | |
void LIBCALL | opdis_tree_foreach (opdis_tree_t tree, OPDIS_TREE_FOREACH_FN fn, void *arg) |
Iterate over the tree, invoking a callback for each item. | |
size_t LIBCALL | opdis_tree_count (opdis_tree_t tree) |
Return the number of items in the tree. | |
void LIBCALL | opdis_tree_free (opdis_tree_t tree) |
Free an AVL tree. | |
opdis_vma_tree_t LIBCALL | opdis_vma_tree_init (void) |
Allocate an Address Tree. | |
int LIBCALL | opdis_vma_tree_add (opdis_vma_tree_t tree, opdis_vma_t addr) |
Insert an address into the tree. | |
int LIBCALL | opdis_vma_tree_delete (opdis_vma_tree_t tree, opdis_vma_t addr) |
Delete an address from the tree. | |
int LIBCALL | opdis_vma_tree_contains (opdis_vma_tree_t tree, opdis_vma_t addr) |
Determine if an address is in the tree. | |
opdis_vma_t LIBCALL | opdis_vma_tree_find (opdis_vma_tree_t tree, opdis_vma_t addr) |
Find an address in the tree. | |
void LIBCALL | opdis_vma_tree_foreach (opdis_vma_tree_t tree, OPDIS_ADDR_TREE_FOREACH_FN fn, void *arg) |
Invoke a callback for every item in the tree. | |
void LIBCALL | opdis_vma_tree_free (opdis_vma_tree_t tree) |
Free the address tree. | |
opdis_insn_tree_t LIBCALL | opdis_insn_tree_init (int manage) |
Allocate an Instruction Tree. | |
int LIBCALL | opdis_insn_tree_add (opdis_insn_tree_t tree, opdis_insn_t *insn) |
Insert an instruction into the tree. | |
int LIBCALL | opdis_insn_tree_delete (opdis_insn_tree_t tree, opdis_vma_t addr) |
Delete an instruction from the tree. | |
int LIBCALL | opdis_insn_tree_contains (opdis_insn_tree_t tree, opdis_vma_t addr) |
Determine if an instruction is in the tree. | |
opdis_insn_t *LIBCALL | opdis_insn_tree_find (opdis_insn_tree_t tree, opdis_vma_t addr) |
Find an instruction in the tree. | |
void LIBCALL | opdis_insn_tree_foreach (opdis_insn_tree_t tree, OPDIS_INSN_TREE_FOREACH_FN fn, void *arg) |
Invoke a callback for every item in the tree. | |
void LIBCALL | opdis_insn_tree_free (opdis_insn_tree_t tree) |
Free the instruction tree. |
AVL trees for storing opdis addresses and instructions.
This provides balanced binary (AVL) trees which store opdis address or instruction objects order by address.