521fa314e2
Change-Id: Ib970c8647409196902ed53d6e9631a1673a4ab2e
33 lines
873 B
C
33 lines
873 B
C
|
|
#define COUNT(s) (sizeof(s) / sizeof(s[0]))
|
|
|
|
struct call_handler {
|
|
const char *name;
|
|
const char *(*namefunc)(const message *m_out);
|
|
int (*outfunc)(struct trace_proc *proc, const message *m_out);
|
|
void (*infunc)(struct trace_proc *proc, const message *m_out,
|
|
const message *m_in, int failed);
|
|
};
|
|
#define HANDLER(n,o,i) { .name = n, .outfunc = o, .infunc = i }
|
|
#define HANDLER_NAME(n,o,i) { .namefunc = n, .outfunc = o, .infunc = i }
|
|
|
|
struct calls {
|
|
endpoint_t endpt;
|
|
unsigned int base;
|
|
const struct call_handler *map;
|
|
unsigned int count;
|
|
};
|
|
|
|
struct flags {
|
|
unsigned int mask;
|
|
unsigned int value;
|
|
const char *name;
|
|
};
|
|
#define FLAG(f) { f, f, #f }
|
|
#define FLAG_MASK(m,f) { m, f, #f }
|
|
#define FLAG_ZERO(f) { ~0, f, #f }
|
|
|
|
/* not great, but it prevents a massive potential for typos.. */
|
|
#define NAME(r) case r: return #r
|
|
#define TEXT(v) case v: text = #v; break
|