/usr/include/libr/r_lib.h is in libradare2-dev 0.9.6-3.1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | #ifndef _LIB_R_LIB_H_
#define _LIB_R_LIB_H_
// TODO: rename type from int to 4 byte string
// TODO: use 4 chars to idnetify plugin type
#include "r_types.h"
#include "r_list.h"
#ifdef __cplusplus
extern "C" {
#endif
R_LIB_VERSION_HEADER (r_lib);
// rename to '.' ??
#define R_LIB_SEPARATOR "."
#define R_LIB_ENV "LIBR_PLUGINS"
/* XXX : This must depend on HOST_OS */
#if __WINDOWS__
#define R_LIB_EXT "dll"
#elif __APPLE__
#define R_LIB_EXT "dylib"
#else
#define R_LIB_EXT "so"
#endif
/* store list of loaded plugins */
typedef struct r_lib_plugin_t {
int type;
char *file;
void *data; /* user pointer */
struct r_lib_handler_t *handler;
void *dl_handler; // DL HANDLER
} RLibPlugin;
/* store list of initialized plugin handlers */
typedef struct r_lib_handler_t {
int type;
char desc[128];
void *user; /* user pointer */
int (*constructor)(RLibPlugin *, void *user, void *data);
int (*destructor)(RLibPlugin *, void *user, void *data);
} RLibHandler;
/* this structure should be pointed by the 'radare_plugin' symbol
found in the loaded .so */
typedef struct r_lib_struct_t {
int type;
void *data; /* pointer to data handled by plugin handler */
} RLibStruct;
enum {
R_LIB_TYPE_IO, /* io layer */
R_LIB_TYPE_DBG, /* debugger */
R_LIB_TYPE_LANG, /* language */
R_LIB_TYPE_ASM, /* assembler */
R_LIB_TYPE_ANAL, /* analysis */
R_LIB_TYPE_PARSE, /* parsers */
R_LIB_TYPE_BIN, /* bins */
R_LIB_TYPE_BIN_XTR, /* bin extractors */
R_LIB_TYPE_BP, /* breakpoint */
R_LIB_TYPE_SYSCALL, /* syscall */
R_LIB_TYPE_FASTCALL,/* fastcall */
R_LIB_TYPE_CRYPTO, /* cryptography */
R_LIB_TYPE_CMD, /* commands */
R_LIB_TYPE_EGG, /* r_egg plugin */
R_LIB_TYPE_LAST
};
typedef struct r_lib_t {
/* linked list with all the plugin handler */
/* only one handler per handler-id allowed */
/* this is checked in add_handler function */
char symname[32];
RList /*RLibPlugin*/ *plugins;
RList /*RLibHandler*/ *handlers;
} RLib;
#ifdef R_API
/* low level api */
R_API void *r_lib_dl_open(const char *libname);
R_API void *r_lib_dl_sym(void *handler, const char *name);
R_API int r_lib_dl_close(void *handler);
R_API int r_lib_dl_check_filename(const char *file);
/* high level api */
R_API RLib *r_lib_new(const char *symname);
R_API RLib *r_lib_free(RLib *lib);
R_API int r_lib_run_handler(RLib *lib, RLibPlugin *plugin, RLibStruct *symbol);
R_API RLibHandler *r_lib_get_handler(RLib *lib, int type);
R_API int r_lib_open(RLib *lib, const char *file);
R_API int r_lib_opendir(RLib *lib, const char *path);
R_API char *r_lib_path(const char *libname);
R_API void r_lib_list(RLib *lib);
R_API int r_lib_add_handler(RLib *lib, int type, const char *desc,
int (*cb)(RLibPlugin *, void *, void *),
int (*dt)(RLibPlugin *, void *, void *),
void *user );
R_API int r_lib_del_handler(RLib *lib, int type);
R_API int r_lib_close(RLib *lib, const char *file);
#endif
#ifdef __cplusplus
}
#endif
#endif
|