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
|
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>
|
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;
|
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 {
|
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];
|
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
|
2010-01-12 01:25:06 +00:00
|
|
|
R_API struct r_flag_t * r_flag_new();
|
2010-04-09 15:13:35 +00:00
|
|
|
R_API RFlag * r_flag_free(RFlag *f);
|
|
|
|
R_API void r_flag_list(struct r_flag_t *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);
|
2009-04-03 11:11:17 +00:00
|
|
|
R_API int r_flag_unset(struct r_flag_t *f, const char *name);
|
2010-06-20 23:58:45 +00:00
|
|
|
R_API int r_flag_unset_i(struct r_flag_t *f, ut64 addr);
|
2009-07-08 11:49:55 +00:00
|
|
|
R_API int r_flag_set(struct r_flag_t *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);
|
2009-04-03 11:11:17 +00:00
|
|
|
R_API int r_flag_name_check(const char *name);
|
|
|
|
R_API int r_flag_name_filter(char *name);
|
2010-07-20 22:05:33 +00:00
|
|
|
R_API void r_flag_item_rename(RFlagItem *item, const char *name);
|
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
|