xref: /netbsd-src/external/bsd/libevent/dist/test/regress.gen.h (revision a5847cc334d9a7029f6352b847e9e8d71a0f9e0c)
1 /*	$NetBSD: regress.gen.h,v 1.1.1.1 2009/11/02 10:01:03 plunky Exp $	*/
2 /*
3  * Automatically generated from ./regress.rpc
4  */
5 
6 #ifndef ___REGRESS_RPC_
7 #define ___REGRESS_RPC_
8 
9 #include <event-config.h>
10 #ifdef _EVENT_HAVE_STDINT_H
11 #include <stdint.h>
12 #endif
13 #define EVTAG_HAS(msg, member) ((msg)->member##_set == 1)
14 #ifdef __GNUC__
15 #define EVTAG_ASSIGN(msg, member, args...) (*(msg)->base->member##_assign)(msg, ## args)
16 #define EVTAG_GET(msg, member, args...) (*(msg)->base->member##_get)(msg, ## args)
17 #else
18 #define EVTAG_ASSIGN(msg, member, ...) (*(msg)->base->member##_assign)(msg, ## __VA_ARGS__)
19 #define EVTAG_GET(msg, member, ...) (*(msg)->base->member##_get)(msg, ## __VA_ARGS__)
20 #endif
21 #define EVTAG_ADD(msg, member) (*(msg)->base->member##_add)(msg)
22 #define EVTAG_LEN(msg, member) ((msg)->member##_length)
23 
24 struct msg;
25 struct kill;
26 struct run;
27 
28 /* Tag definition for msg */
29 enum msg_ {
30   MSG_FROM_NAME=1,
31   MSG_TO_NAME=2,
32   MSG_ATTACK=3,
33   MSG_RUN=4,
34   MSG_MAX_TAGS
35 };
36 
37 /* Structure declaration for msg */
38 struct msg_access_ {
39   int (*from_name_assign)(struct msg *, const char *);
40   int (*from_name_get)(struct msg *, char * *);
41   int (*to_name_assign)(struct msg *, const char *);
42   int (*to_name_get)(struct msg *, char * *);
43   int (*attack_assign)(struct msg *, const struct kill*);
44   int (*attack_get)(struct msg *, struct kill* *);
45   int (*run_assign)(struct msg *, int, const struct run *);
46   int (*run_get)(struct msg *, int, struct run * *);
47   struct run * (*run_add)(struct msg *);
48 };
49 
50 struct msg {
51   struct msg_access_ *base;
52 
53   char *from_name_data;
54   char *to_name_data;
55   struct kill* attack_data;
56   struct run **run_data;
57   int run_length;
58   int run_num_allocated;
59 
60   uint8_t from_name_set;
61   uint8_t to_name_set;
62   uint8_t attack_set;
63   uint8_t run_set;
64 };
65 
66 struct msg *msg_new(void);
67 void msg_free(struct msg *);
68 void msg_clear(struct msg *);
69 void msg_marshal(struct evbuffer *, const struct msg *);
70 int msg_unmarshal(struct msg *, struct evbuffer *);
71 int msg_complete(struct msg *);
72 void evtag_marshal_msg(struct evbuffer *, uint32_t,
73     const struct msg *);
74 int evtag_unmarshal_msg(struct evbuffer *, uint32_t,
75     struct msg *);
76 int msg_from_name_assign(struct msg *, const char *);
77 int msg_from_name_get(struct msg *, char * *);
78 int msg_to_name_assign(struct msg *, const char *);
79 int msg_to_name_get(struct msg *, char * *);
80 int msg_attack_assign(struct msg *, const struct kill*);
81 int msg_attack_get(struct msg *, struct kill* *);
82 int msg_run_assign(struct msg *, int, const struct run *);
83 int msg_run_get(struct msg *, int, struct run * *);
84 struct run * msg_run_add(struct msg *);
85 /* --- msg done --- */
86 
87 /* Tag definition for kill */
88 enum kill_ {
89   KILL_WEAPON=65825,
90   KILL_ACTION=2,
91   KILL_HOW_OFTEN=3,
92   KILL_MAX_TAGS
93 };
94 
95 /* Structure declaration for kill */
96 struct kill_access_ {
97   int (*weapon_assign)(struct kill *, const char *);
98   int (*weapon_get)(struct kill *, char * *);
99   int (*action_assign)(struct kill *, const char *);
100   int (*action_get)(struct kill *, char * *);
101   int (*how_often_assign)(struct kill *, const uint32_t);
102   int (*how_often_get)(struct kill *, uint32_t *);
103 };
104 
105 struct kill {
106   struct kill_access_ *base;
107 
108   char *weapon_data;
109   char *action_data;
110   uint32_t how_often_data;
111 
112   uint8_t weapon_set;
113   uint8_t action_set;
114   uint8_t how_often_set;
115 };
116 
117 struct kill *kill_new(void);
118 void kill_free(struct kill *);
119 void kill_clear(struct kill *);
120 void kill_marshal(struct evbuffer *, const struct kill *);
121 int kill_unmarshal(struct kill *, struct evbuffer *);
122 int kill_complete(struct kill *);
123 void evtag_marshal_kill(struct evbuffer *, uint32_t,
124     const struct kill *);
125 int evtag_unmarshal_kill(struct evbuffer *, uint32_t,
126     struct kill *);
127 int kill_weapon_assign(struct kill *, const char *);
128 int kill_weapon_get(struct kill *, char * *);
129 int kill_action_assign(struct kill *, const char *);
130 int kill_action_get(struct kill *, char * *);
131 int kill_how_often_assign(struct kill *, const uint32_t);
132 int kill_how_often_get(struct kill *, uint32_t *);
133 /* --- kill done --- */
134 
135 /* Tag definition for run */
136 enum run_ {
137   RUN_HOW=1,
138   RUN_SOME_BYTES=2,
139   RUN_FIXED_BYTES=3,
140   RUN_MAX_TAGS
141 };
142 
143 /* Structure declaration for run */
144 struct run_access_ {
145   int (*how_assign)(struct run *, const char *);
146   int (*how_get)(struct run *, char * *);
147   int (*some_bytes_assign)(struct run *, const uint8_t *, uint32_t);
148   int (*some_bytes_get)(struct run *, uint8_t * *, uint32_t *);
149   int (*fixed_bytes_assign)(struct run *, const uint8_t *);
150   int (*fixed_bytes_get)(struct run *, uint8_t **);
151 };
152 
153 struct run {
154   struct run_access_ *base;
155 
156   char *how_data;
157   uint8_t *some_bytes_data;
158   uint32_t some_bytes_length;
159   uint8_t fixed_bytes_data[24];
160 
161   uint8_t how_set;
162   uint8_t some_bytes_set;
163   uint8_t fixed_bytes_set;
164 };
165 
166 struct run *run_new(void);
167 void run_free(struct run *);
168 void run_clear(struct run *);
169 void run_marshal(struct evbuffer *, const struct run *);
170 int run_unmarshal(struct run *, struct evbuffer *);
171 int run_complete(struct run *);
172 void evtag_marshal_run(struct evbuffer *, uint32_t,
173     const struct run *);
174 int evtag_unmarshal_run(struct evbuffer *, uint32_t,
175     struct run *);
176 int run_how_assign(struct run *, const char *);
177 int run_how_get(struct run *, char * *);
178 int run_some_bytes_assign(struct run *, const uint8_t *, uint32_t);
179 int run_some_bytes_get(struct run *, uint8_t * *, uint32_t *);
180 int run_fixed_bytes_assign(struct run *, const uint8_t *);
181 int run_fixed_bytes_get(struct run *, uint8_t **);
182 /* --- run done --- */
183 
184 #endif  /* ___REGRESS_RPC_ */
185