Rizin
unix-like reverse engineering framework and cli tools
rz_event.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2018 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #ifndef RZ_EVENT_H
5 #define RZ_EVENT_H
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #include <ht_up.h>
12 #include <rz_vector.h>
13 
14 typedef struct rz_event_t {
15  void *user;
16  bool incall;
17  HtUP *callbacks;
19  RzVector /*<RzEventCallbackHandle>*/ pending_unhook;
22 
24  int handle;
25  int type;
27 
28 typedef void (*RzEventCallback)(RzEvent *ev, int type, void *user, void *data);
29 
30 typedef enum {
32  RZ_EVENT_META_SET, // RzEventMeta
33  RZ_EVENT_META_DEL, // RzEventMeta
34  RZ_EVENT_META_CLEAR, // RzEventMeta
35  RZ_EVENT_CLASS_NEW, // RzEventClass
36  RZ_EVENT_CLASS_DEL, // RzEventClass
37  RZ_EVENT_CLASS_RENAME, // RzEventClassRename
38  RZ_EVENT_CLASS_ATTR_SET, // RzEventClassAttr
39  RZ_EVENT_CLASS_ATTR_DEL, // RzEventClassAttrSet
40  RZ_EVENT_CLASS_ATTR_RENAME, // RzEventClassAttrRename
41  RZ_EVENT_DEBUG_PROCESS_FINISHED, // RzEventDebugProcessFinished
42  RZ_EVENT_IO_WRITE, // RzEventIOWrite
43  RZ_EVENT_IO_DESC_CLOSE, // RzEventIODescClose
44  RZ_EVENT_IO_MAP_DEL, // RzEventIOMapDel
45  RZ_EVENT_BIN_FILE_DEL, // RzEventBinFileDel
47 } RzEventType;
48 
49 typedef struct rz_event_meta_t {
50  int type;
52  const char *string;
54 
55 typedef struct rz_event_class_t {
56  const char *name;
58 
59 typedef struct rz_event_class_rename_t {
60  const char *name_old;
61  const char *name_new;
63 
64 typedef struct rz_event_class_attr_t {
65  const char *class_name;
66  int attr_type; // RzAnalysisClassAttrType
67  const char *attr_id;
69 
70 typedef struct rz_event_class_attr_set_t {
72  const char *content;
74 
77  const char *attr_id_new;
79 
81  int pid;
83 
84 RZ_API RzEvent *rz_event_new(void *user);
85 RZ_API void rz_event_free(RzEvent *ev);
88 RZ_API void rz_event_send(RzEvent *ev, int type, void *data);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif
static mcore_handle handle
Definition: asm_mcore.c:8
#define RZ_API
int type
Definition: mipsasm.c:17
struct rz_event_class_attr_rename_t RzEventClassAttrRename
RZ_API void rz_event_send(RzEvent *ev, int type, void *data)
Definition: event.c:115
RZ_API void rz_event_free(RzEvent *ev)
Definition: event.c:37
struct rz_event_class_attr_set_t RzEventClassAttrSet
struct rz_event_callback_handle_t RzEventCallbackHandle
RzEventType
Definition: rz_event.h:30
@ RZ_EVENT_CLASS_ATTR_SET
Definition: rz_event.h:38
@ RZ_EVENT_MAX
Definition: rz_event.h:46
@ RZ_EVENT_META_CLEAR
Definition: rz_event.h:34
@ RZ_EVENT_META_SET
Definition: rz_event.h:32
@ RZ_EVENT_CLASS_DEL
Definition: rz_event.h:36
@ RZ_EVENT_IO_DESC_CLOSE
Definition: rz_event.h:43
@ RZ_EVENT_CLASS_NEW
Definition: rz_event.h:35
@ RZ_EVENT_IO_MAP_DEL
Definition: rz_event.h:44
@ RZ_EVENT_CLASS_ATTR_DEL
Definition: rz_event.h:39
@ RZ_EVENT_CLASS_ATTR_RENAME
Definition: rz_event.h:40
@ RZ_EVENT_BIN_FILE_DEL
Definition: rz_event.h:45
@ RZ_EVENT_ALL
Definition: rz_event.h:31
@ RZ_EVENT_CLASS_RENAME
Definition: rz_event.h:37
@ RZ_EVENT_IO_WRITE
Definition: rz_event.h:42
@ RZ_EVENT_META_DEL
Definition: rz_event.h:33
@ RZ_EVENT_DEBUG_PROCESS_FINISHED
Definition: rz_event.h:41
struct rz_event_t RzEvent
RZ_API RzEvent * rz_event_new(void *user)
Definition: event.c:17
struct rz_event_class_rename_t RzEventClassRename
void(* RzEventCallback)(RzEvent *ev, int type, void *user, void *data)
Definition: rz_event.h:28
RZ_API RzEventCallbackHandle rz_event_hook(RzEvent *ev, int type, RzEventCallback cb, void *user)
Definition: event.c:58
struct rz_event_class_attr_t RzEventClassAttr
struct rz_event_meta_t RzEventMeta
struct rz_event_class_t RzEventClass
RZ_API void rz_event_unhook(RzEvent *ev, RzEventCallbackHandle handle)
Definition: event.c:95
struct rz_event_debug_process_finished_t RzEventDebugProcessFinished
const char * attr_id_new
Definition: rz_event.h:77
RzEventClassAttr attr
Definition: rz_event.h:76
RzEventClassAttr attr
Definition: rz_event.h:71
const char * content
Definition: rz_event.h:72
const char * attr_id
Definition: rz_event.h:67
const char * class_name
Definition: rz_event.h:65
const char * name_old
Definition: rz_event.h:60
const char * name_new
Definition: rz_event.h:61
const char * name
Definition: rz_event.h:56
const char * string
Definition: rz_event.h:52
RzVector all_callbacks
Definition: rz_event.h:18
int next_handle
Definition: rz_event.h:20
HtUP * callbacks
Definition: rz_event.h:17
void * user
Definition: rz_event.h:15
bool incall
Definition: rz_event.h:16
RzVector pending_unhook
while inside of a call and a handle is unhooked, the unhook is deferred and saved here
Definition: rz_event.h:19
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const char * cb[]
Definition: z80_tab.h:176