#ifndef R2_EGG_H #define R2_EGG_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif R_LIB_VERSION_HEADER(r_egg); #define R_EGG_INCDIR_ENV "EGG_INCDIR" #define R_EGG_INCDIR_PATH "/lib/radare2/" R2_VERSION "/egg" // rename to REggShellcode #define R_EGG_PLUGIN_SHELLCODE 0 #define R_EGG_PLUGIN_ENCODER 1 typedef struct r_egg_plugin_t { RPluginMeta meta; int type; RBuffer* (*build) (void *egg); } REggPlugin; typedef struct r_egg_lang_t { int pushargs; int nalias; int nsyscalls; char *conditionstr; char *syscallbody; char *includefile; char *setenviron; char *mathline; // used for confusing mathop int commentmode; int varsize; int varxs; int lastctxdelta; int nargs; int docall; int nfunctions; int nbrackets; int slurpin; int slurp; int line; char elem[1024]; int attsyntax; int elem_n; char *callname; char *endframe; char *ctxpush[32]; char *file; char *dstvar; char *dstval; char *includedir; char *ifelse_table[32][32]; // used to solve if-else problem in a not so ugly way int ndstval; int skipline;// BOOL int quoteline; int quotelinevar; int stackframe; int stackfixed; int oc; int mode; int inlinectr; struct { char *name; char *body; // int fastcall; /* TODO: NOT YET USED */ } inlines[256]; int ninlines; struct { char *name; char *arg; } syscalls[256]; struct { char *name; char *content; } aliases[256]; char *nested[32]; char *nested_callname[32]; // char *nestede[32] = {0}; // seems nestede are not used any more // (only one place that gives nestede[] value, where could be replaced) int nestedi[32]; } REggLang; typedef struct r_egg_t { RBuffer *src; // input source code RBuffer *buf; // output compiled bytes RBuffer *bin; // input binary data RList *list; RAsm *rasm; RSyscall *syscall; REggLang lang; Sdb *db; RList *patches; // struct r_egg_emit_t *remit; int arch; int endian; int bits; ut32 os; int context; RLibStore *libstore; void *priv; /* backend-private per-session state, owned by remit->priv_new/free */ } REgg; /* XXX: this may fail in different arches */ #if 0 // XXX should be a ph subcommand to hash strings. ?h must be removed r2 -q - <