radare2/libr/include/r_flags.h

73 lines
1.9 KiB
C
Raw Normal View History

#ifndef _INCLUDE_R_FLAGS_H_
#define _INCLUDE_R_FLAGS_H_
#define USE_BTREE 0
/* FUCK YEAH */
#define USE_HT 1
2009-06-15 02:44:05 +00:00
#if USE_BTREE
#include <btree.h>
#endif
#include <r_types.h>
#include <r_util.h>
2010-12-23 23:51:01 +00:00
#include <r_list.h>
#define R_FLAG_NAME_SIZE 128
#define R_FLAG_BUF_SIZE 128
2010-12-23 23:51:01 +00:00
#define R_FLAG_SPACES_MAX 128
typedef struct r_flag_item_t {
char name[R_FLAG_NAME_SIZE];
ut64 namehash;
ut64 offset;
ut64 size;
2010-12-23 23:51:01 +00:00
int format; // ???
int space;
char *cmd;
char *comment;
unsigned char data[R_FLAG_BUF_SIZE]; // only take a minor part of the data
} RFlagItem;
typedef struct r_flag_t {
st64 base;
int space_idx;
int space_idx2;
const char *spaces[R_FLAG_SPACES_MAX];
#if USE_HT
RHashTable64 *ht_off;
RHashTable64 *ht_name;
#endif
2009-06-15 02:44:05 +00:00
#if USE_BTREE
struct btree_node *tree; /* index by offset */
struct btree_node *ntree; /* index by name */
#endif
2010-12-23 23:51:01 +00:00
RList *flags;
} RFlag;
#ifdef R_API
2012-07-21 10:11:21 +00:00
R_API RFlag * r_flag_new();
R_API RFlag * r_flag_free(RFlag *f);
2012-07-21 10:11:21 +00:00
R_API void r_flag_list(RFlag *f, int rad);
R_API RFlagItem *r_flag_get(RFlag *f, const char *name);
R_API RFlagItem *r_flag_get_i(RFlag *f, ut64 off);
2012-07-21 10:11:21 +00:00
R_API int r_flag_unset(RFlag *f, const char *name, RFlagItem *p);
R_API int r_flag_unset_i(RFlag *f, ut64 addr, RFlagItem *p);
R_API int r_flag_set(RFlag *fo, const char *name, ut64 addr, ut32 size, int dup);
R_API int r_flag_sort(RFlag *f, int namesort);
R_API int r_flag_item_set_name(RFlagItem *item, const char *name);
R_API void r_flag_item_free (RFlagItem *item);
R_API void r_flag_item_set_comment(RFlagItem *item, const char *comment);
R_API int r_flag_unset_glob(RFlag *f, const char *name);
R_API int r_flag_rename(RFlag *f, RFlagItem *item, const char *name);
R_API RFlagItem *r_flag_get_at(RFlag *f, ut64 off);
/* spaces */
R_API int r_flag_space_get(RFlag *f, const char *name);
R_API const char *r_flag_space_get_i(RFlag *f, int idx);
R_API void r_flag_space_set(RFlag *f, const char *name);
R_API void r_flag_space_list(RFlag *f);
#endif
#endif