Define RPluginMeta and RPluginStatus ##api

This commit is contained in:
pancake 2022-12-08 21:24:45 +01:00 committed by pancake
parent 59c2811e4f
commit 3aa5ea0f22
2 changed files with 30 additions and 6 deletions

View File

@ -113,13 +113,15 @@ typedef bool (*RArchPluginFiniCallback)(RArchSession *s);
// TODO: use `const char *const` instead of `char*`
typedef struct r_arch_plugin_t {
// all const
// RPluginMeta meta; // = { .name = ... }
char *name;
char *desc;
char *license;
char *arch;
char *author;
char *version;
char *license;
// all const
char *arch;
char *cpus;
ut32 endian;
RSysBits bits;
@ -132,7 +134,8 @@ typedef struct r_arch_plugin_t {
RArchPluginDecodeCallback decode;
RArchPluginModifyCallback patch;
RArchPluginMnemonicsCallback mnemonics;
//TODO: reenable this later
//TODO: reenable this later? maybe it should be called reset() or setenv().. but esilinit/fini
// seems to specific to esil and those functions may want to do moreo things like io stuff
// bool (*esil_init)(REsil *esil);
// void (*esil_fini)(REsil *esil);
} RArchPlugin;
@ -143,7 +146,6 @@ R_API bool r_arch_load_decoder(RArch *arch, const char *dname);
R_API bool r_arch_use_decoder(RArch *arch, const char *dname);
R_API bool r_arch_unload_decoder(RArch *arch, const char *dname);
// deprecate
R_API int r_arch_info(RArch *arch, int query);
R_API bool r_arch_decode(RArch *a, RAnalOp *op, RArchDecodeMask mask);

View File

@ -31,6 +31,24 @@ R_LIB_VERSION_HEADER (r_lib);
#define R_LIB_EXT "so"
#endif
typedef enum r_plugin_status_t {
R_PLUGIN_STATUS_BROKEN = 0,
R_PLUGIN_STATUS_INCOMPLETE = 1,
R_PLUGIN_STATUS_BASIC = 2,
R_PLUGIN_STATUS_OK = 3,
R_PLUGIN_STATUS_GOOD= 4,
R_PLUGIN_STATUS_COMPLETE = 5,
} RPluginStatus;
typedef struct r_plugin_meta_t {
char *name;
char *desc;
char *author;
char *version;
char *license;
RPluginStatus status;
} RPluginMeta;
/* store list of loaded plugins */
typedef struct r_lib_plugin_t {
int type;
@ -38,9 +56,13 @@ typedef struct r_lib_plugin_t {
void *data; /* user pointer */
struct r_lib_handler_t *handler;
void *dl_handler; // DL HANDLER
void (*free)(void *data);
#if 0
char *author;
char *version;
void (*free)(void *data);
char *license;
RLibStatus status;
#endif
} RLibPlugin;
/* store list of initialized plugin handlers */