b38edbc703f7bbd0cefdc834da2bd09747fa61c0
[citadel.git] / citadel / modules / xmpp / xmpp_xmacros.h
1
2 /*
3  * define the structures for one token each
4  * typename: TheToken_<Tokenname>
5  */
6
7 #define XMPPARGS char *token, long len
8 typedef void (*XMPP_callback)(XMPPARGS);
9 #define CALLBACK(NAME)  XMPP_callback CB_##NAME; 
10 #define PAYLOAD(STRUCTNAME, NAME) StrBuf *NAME;int encoding_##NAME;
11 #define STRPROP(STRUCTNAME, NAME) StrBuf *NAME;
12 #define TOKEN(NAME, STRUCT) typedef struct __##NAME     \
13         STRUCT                                          \
14         TheToken_##NAME;
15 #define SUBTOKEN(NAME, NS, STOKEN, STRUCT) typedef struct __##NAME##NS##STOKEN \
16         STRUCT                                                         \
17         theSubToken_##NAME##NS##STOKEN;
18
19 #include "token.def"
20
21 #undef STRPROP
22 #undef PAYLOAD
23 #undef TOKEN
24 #undef SUBTOKEN
25
26
27 /*
28  * forward declarations for freeing the members of one struct instance
29  # name: free_buf_<Tokenname>
30  */
31
32 #define SUBTOKEN(NAME, NS, STOKEN, STRUCT) void free_buf__##NAME##NS##STOKEN \
33         (theSubToken_##NAME##NS##STOKEN *pdata);
34 #define TOKEN(NAME, STRUCT)                                             \
35         void free_buf_##NAME(TheToken_##NAME *pdata);
36 #include "token.def"
37 #undef STRPROP
38 #undef PAYLOAD
39 #undef TOKEN
40 #undef SUBTOKEN
41
42 /*
43  * forward declarations, freeing structs and member. 
44  * name: free_<Tokenname>
45  */
46 #define SUBTOKEN(NAME, NS, STOKEN, STRUCT) void free__##NAME##NS##STOKEN \
47         (theSubToken_##NAME##NS##STOKEN *pdata);
48 #define TOKEN(NAME, STRUCT)                                             \
49         void free_##NAME(TheToken_##NAME *pdata);
50
51 #include "token.def"
52 #undef STRPROP
53 #undef PAYLOAD
54 #undef TOKEN
55 #undef SUBTOKEN
56
57 #undef CALLBACK