2009-02-05 21:08:46 +00:00
|
|
|
#ifndef _INCLUDE_R_FLAGS_H_
|
|
|
|
#define _INCLUDE_R_FLAGS_H_
|
|
|
|
|
2010-04-09 11:24:40 +00:00
|
|
|
#define USE_BTREE 0
|
2011-05-21 19:05:21 +00:00
|
|
|
/* FUCK YEAH */
|
|
|
|
#define USE_HT 1
|
2009-06-15 02:44:05 +00:00
|
|
|
|
|
|
|
#if USE_BTREE
|
|
|
|
#include <btree.h>
|
|
|
|
#endif
|
|
|
|
|
2009-02-05 21:08:46 +00:00
|
|
|
#include <r_types.h>
|
2011-05-21 19:05:21 +00:00
|
|
|
#include <r_util.h>
|
2010-12-23 23:51:01 +00:00
|
|
|
#include <r_list.h>
|
2009-02-05 21:08:46 +00:00
|
|
|
|
|
|
|
#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
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-12-24 02:17:53 +00:00
|
|
|
typedef struct r_flag_item_t {
|
2009-02-05 21:08:46 +00:00
|
|
|
char name[R_FLAG_NAME_SIZE];
|
2010-04-09 11:24:40 +00:00
|
|
|
ut64 namehash;
|
2009-07-08 11:49:55 +00:00
|
|
|
ut64 offset;
|
|
|
|
ut64 size;
|
2010-12-23 23:51:01 +00:00
|
|
|
int format; // ???
|
2009-02-05 21:08:46 +00:00
|
|
|
int space;
|
2010-04-09 15:13:35 +00:00
|
|
|
char *cmd;
|
2012-10-26 08:00:22 +00:00
|
|
|
char *comment;
|
2009-02-05 21:08:46 +00:00
|
|
|
unsigned char data[R_FLAG_BUF_SIZE]; // only take a minor part of the data
|
2010-01-26 00:28:33 +00:00
|
|
|
} RFlagItem;
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-12-24 02:17:53 +00:00
|
|
|
typedef struct r_flag_t {
|
2012-11-13 02:25:07 +00:00
|
|
|
st64 base;
|
2009-02-05 21:08:46 +00:00
|
|
|
int space_idx;
|
|
|
|
int space_idx2;
|
2011-02-04 17:34:20 +00:00
|
|
|
const char *spaces[R_FLAG_SPACES_MAX];
|
2011-05-21 19:05:21 +00:00
|
|
|
#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;
|
2010-01-26 00:28:33 +00:00
|
|
|
} RFlag;
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-12-24 02:17:53 +00:00
|
|
|
#ifdef R_API
|
2012-07-21 10:11:21 +00:00
|
|
|
R_API RFlag * r_flag_new();
|
2010-04-09 15:13:35 +00:00
|
|
|
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);
|
2010-04-09 15:13:35 +00:00
|
|
|
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);
|
2010-04-09 09:32:17 +00:00
|
|
|
R_API int r_flag_sort(RFlag *f, int namesort);
|
2012-11-13 02:25:07 +00:00
|
|
|
R_API int r_flag_item_set_name(RFlagItem *item, const char *name);
|
2012-10-26 08:00:22 +00:00
|
|
|
R_API void r_flag_item_free (RFlagItem *item);
|
|
|
|
R_API void r_flag_item_set_comment(RFlagItem *item, const char *comment);
|
2011-05-21 19:05:21 +00:00
|
|
|
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);
|
2011-11-22 00:42:16 +00:00
|
|
|
R_API RFlagItem *r_flag_get_at(RFlag *f, ut64 off);
|
2009-02-05 21:08:46 +00:00
|
|
|
|
2009-02-17 09:59:26 +00:00
|
|
|
/* spaces */
|
2011-02-17 00:34:29 +00:00
|
|
|
R_API int r_flag_space_get(RFlag *f, const char *name);
|
2011-02-16 23:58:54 +00:00
|
|
|
R_API const char *r_flag_space_get_i(RFlag *f, int idx);
|
2010-04-09 15:13:35 +00:00
|
|
|
R_API void r_flag_space_set(RFlag *f, const char *name);
|
|
|
|
R_API void r_flag_space_list(RFlag *f);
|
2009-12-24 02:17:53 +00:00
|
|
|
#endif
|
2009-02-17 09:59:26 +00:00
|
|
|
|
2009-02-05 21:08:46 +00:00
|
|
|
#endif
|