|
1 #ifndef __PARSE_H__ |
|
2 #define __PARSE_H__ 1 |
|
3 |
|
4 #include <glib.h> |
1 #include <loudmouth/loudmouth.h> |
5 #include <loudmouth/loudmouth.h> |
2 |
6 |
3 #define PARSE_OK 0 |
7 #define PARSE_OK 0 |
4 #define PARSE_ERROR_NAME 1 |
8 #define PARSE_ERROR_NAME 1 |
5 #define PARSE_ERROR_REQUIRED 2 |
9 #define PARSE_ERROR_REQUIRED 2 |
6 #define PARSE_ERROR_RESTRICTION 3 |
10 #define PARSE_ERROR_RESTRICTION 3 |
7 #define PARSE_ERROR_TOO_MANY_CHILDS 4 |
11 #define PARSE_ERROR_TOO_MANY_CHILDS 4 |
8 |
12 |
9 struct info_iq { |
13 struct info_iq { |
10 char* from; |
14 gchar* from; |
11 char* id; |
15 gchar* id; |
12 char* to; |
16 gchar* to; |
13 char* set; |
17 gchar* set; |
14 }; |
18 }; |
15 |
19 |
16 struct info_jingle { |
20 struct info_jingle { |
17 char* action; // required (content-accept, content-add, |
21 gchar* action; // required (content-accept, content-add, |
18 // content-modify, content-reject, content-remove, description-info |
22 // content-modify, content-reject, content-remove, description-info |
19 // security-info, session-accept, session-info, session-initiate, |
23 // security-info, session-accept, session-info, session-initiate, |
20 // session-terminate, transport-accept, transport-info, transport-reject, |
24 // session-terminate, transport-accept, transport-info, transport-reject, |
21 // transport-replace) |
25 // transport-replace) |
22 char* initiator; // optional |
26 gchar* initiator; // optional |
23 char* responder; // optional |
27 gchar* responder; // optional |
24 char* sid; // required |
28 gchar* sid; // required |
25 }; |
29 }; |
26 |
30 |
27 struct info_content { |
31 struct info_content { |
28 char* creator; // required (initiator, responder) |
32 gchar* creator; // required (initiator, responder) |
29 char* disposition; // optional, default=session |
33 gchar* disposition; // optional, default=session |
30 char* name; // required |
34 gchar* name; // required |
31 char* senders; // optional (both, initiator, none, responder) |
35 gchar* senders; // optional (both, initiator, none, responder) |
32 }; |
36 }; |
33 |
37 |
34 int parse_jingle(LmMessageNode* node, struct info_jingle* ij); |
38 int parse_jingle(LmMessageNode* node, struct info_jingle* ij); |
35 void free_jingle(struct info_jingle* ij); |
39 void free_jingle(struct info_jingle* ij); |
36 int parse_content(LmMessageNode* node, struct info_content* ic); |
40 int parse_content(LmMessageNode* node, struct info_content* ic); |
37 void free_content(struct info_content* ic); |
41 void free_content(struct info_content* ic); |
38 |
42 |
39 int check_restriction(const char* name, const char** values) |
43 int check_restriction(const char* name, const char** values); |
40 |
44 |
41 char* attrcpy(const char* attr); |
45 #endif |