Merge branch 'kernel' of 106.109.8.71:/srv/git/dbi into kernel
[kernel/swap-modules.git] / parser / msg_parser.h
1 #ifndef _MSG_PARSER_H
2 #define _MSG_PARSER_H
3
4 #include <linux/types.h>
5
6 struct msg_buf;
7
8 enum APP_TYPE {
9         AT_TIZEN_NATIVE_APP     = 0x01,
10         AT_PID                  = 0x02,
11         AT_COMMON_EXEC          = 0x03
12 };
13
14 enum {
15         SIZE_APP_TYPE = 4
16 };
17
18 /* Basic application information */
19 struct app_info_data {
20         enum APP_TYPE app_type;
21         pid_t tgid;
22         char *exec_path;
23 };
24
25 /* Configuration struct */
26 struct conf_data {
27         u64 use_features;
28         u32 sys_trace_period;
29         u32 data_msg_period;
30 };
31
32 /* Application and library functions to set probes */
33 struct func_inst_data {
34         u64 addr;
35         char *args;
36 };
37
38 /* Library struct */
39 struct lib_inst_data {
40         char *path;
41         u32 cnt_func;
42         struct func_inst_data **func;
43 };
44
45 /* Application struct */
46 struct app_inst_data {
47         struct app_info_data *app_info;
48         u32 cnt_func;
49         struct func_inst_data **func;
50         u32 cnt_lib;
51         struct lib_inst_data **lib;
52 };
53
54 /* User space instrumentation struct */
55 struct us_inst_data {
56         u32 cnt;
57         struct app_inst_data **app_inst;
58 };
59
60
61 struct app_info_data *create_app_info(struct msg_buf *mb);
62 void destroy_app_info(struct app_info_data *app_info);
63
64 struct conf_data *create_conf_data(struct msg_buf *mb);
65 void destroy_conf_data(struct conf_data *conf);
66
67 struct func_inst_data *create_func_inst_data(struct msg_buf *mb);
68 void destroy_func_inst_data(struct func_inst_data *func_inst);
69
70 struct lib_inst_data *create_lib_inst_data(struct msg_buf *mb);
71 void destroy_lib_inst_data(struct lib_inst_data *lib_inst);
72
73 struct app_inst_data *create_app_inst_data(struct msg_buf *mb);
74 void destroy_app_inst_data(struct app_inst_data *app_inst);
75
76 struct us_inst_data *create_us_inst_data(struct msg_buf *mb);
77 void destroy_us_inst_data(struct us_inst_data *us_inst);
78
79
80 /* empty functions for calculating size fields in structures */
81 struct func_inst_data make_func_inst_data(void);
82 struct lib_inst_data make_lib_inst_data(void);
83 struct app_inst_data make_app_inst_data(void);
84 struct us_inst_data make_us_inst_data(void);
85
86 enum {
87         MIN_SIZE_STRING = 1,
88         MIN_SIZE_FUNC_INST = sizeof(make_func_inst_data().addr) +
89                              MIN_SIZE_STRING,
90         MIN_SIZE_LIB_INST = MIN_SIZE_STRING +
91                             sizeof(make_lib_inst_data().cnt_func),
92         MIN_SIZE_APP_INFO = SIZE_APP_TYPE + MIN_SIZE_STRING + MIN_SIZE_STRING,
93         MIN_SIZE_APP_INST = MIN_SIZE_APP_INFO +
94                             sizeof(make_app_inst_data().cnt_func) +
95                             sizeof(make_app_inst_data().cnt_lib),
96         MIN_SIZE_US_INST = sizeof(make_us_inst_data().cnt)
97 };
98
99 #endif /* _MSG_PARSER_H */