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