1 #ifndef __JINGLE_H__ |
|
2 #define __JINGLE_H__ 1 |
|
3 |
|
4 #include <glib.h> |
|
5 #include <loudmouth/loudmouth.h> |
|
6 |
|
7 #define NS_JINGLE "urn:xmpp:jingle:1" |
|
8 #define NS_JINGLE_ERRORS "urn:xmpp:jingle:errors:1" |
|
9 |
|
10 |
|
11 typedef enum { |
|
12 JINGLE_UNKNOWN_ACTION, |
|
13 JINGLE_CONTENT_ACCEPT, |
|
14 JINGLE_CONTENT_ADD, |
|
15 JINGLE_CONTENT_MODIFY, |
|
16 JINGLE_CONTENT_REJECT, |
|
17 JINGLE_CONTENT_REMOVE, |
|
18 JINGLE_DESCRIPTION_INFO, |
|
19 JINGLE_SECURITY_INFO, |
|
20 JINGLE_SESSION_ACCEPT, |
|
21 JINGLE_SESSION_INFO, |
|
22 JINGLE_SESSION_INITIATE, |
|
23 JINGLE_SESSION_TERMINATE, |
|
24 JINGLE_TRANSPORT_ACCEPT, |
|
25 JINGLE_TRANSPORT_INFO, |
|
26 JINGLE_TRANSPORT_REJECT, |
|
27 JINGLE_TRANSPORT_REPLACE, |
|
28 } JingleAction; |
|
29 |
|
30 typedef enum { |
|
31 JINGLE_CREATOR_INITIATOR, |
|
32 JINGLE_CREATOR_RESPONDER, |
|
33 } JingleCreator; |
|
34 |
|
35 typedef enum { |
|
36 JINGLE_SENDERS_BOTH, |
|
37 JINGLE_SENDERS_INITIATOR, |
|
38 JINGLE_SENDERS_NONE, |
|
39 JINGLE_SENDERS_RESPONDER, |
|
40 } JingleSenders; |
|
41 |
|
42 typedef struct { |
|
43 /* action attribute */ |
|
44 JingleAction action; |
|
45 |
|
46 /* full JID of the entity that has initiated the session flow. |
|
47 * may be different from the 'from' address on the IQ-set of the |
|
48 * session-initiate message. |
|
49 * recommended for session-initiate, not recommended otherwise. */ |
|
50 const gchar *initiator; |
|
51 |
|
52 /* full JID of the entity that has replied to the initation. |
|
53 * can be different from the 'to' address on the IQ-set. |
|
54 * recommended for session-accept, not recommended otherwise. */ |
|
55 const gchar *responder; |
|
56 |
|
57 /* Random session identifier generated by the initator. */ |
|
58 const gchar *sid; |
|
59 |
|
60 /* Doubly-linked list of JingleContentNode. */ |
|
61 GList *content; |
|
62 |
|
63 } JingleNode; |
|
64 |
|
65 typedef struct { |
|
66 /* which party originally generated the content type. |
|
67 * the defined values are "initiator" and "responder" |
|
68 * (where the default is "initiator"). required. */ |
|
69 JingleCreator creator; |
|
70 |
|
71 /* how the content definition is to be interpreted by the recipient. |
|
72 * optional, the default value is "session". */ |
|
73 const gchar *disposition; // optional, default=session |
|
74 |
|
75 /* A unique name or identifier for the content type |
|
76 * according to the creator. required.*/ |
|
77 const gchar *name; |
|
78 |
|
79 /* which parties in the session will be generating content. |
|
80 * allowable values are both, initiator, none, responder. |
|
81 * default is both. |
|
82 * required for content-modify, optional otherwise */ |
|
83 JingleSenders senders; |
|
84 |
|
85 /* each content element (must) contain one description |
|
86 * child element that specifies a desired application. |
|
87 * the content of this node is app specific. */ |
|
88 LmMessageNode *description; |
|
89 |
|
90 /* each content element (must) contain one transport |
|
91 * child element that specifies a potential transport |
|
92 * method */ |
|
93 LmMessageNode *transport; |
|
94 |
|
95 } JingleContentNode; |
|
96 |
|
97 struct JingleActionList { |
|
98 const gchar *name; |
|
99 void (*handler)(LmMessage *, JingleNode *, GError **); |
|
100 }; |
|
101 |
|
102 |
|
103 LmMessage *jingle_new_iq_error(LmMessage *m, const gchar *errtype, |
|
104 const gchar *cond, const gchar *jinglecond); |
|
105 void jingle_send_iq_error(LmMessage *m, const gchar *errtype, |
|
106 const gchar *cond, const gchar *jinglecond); |
|
107 void jingle_ack_iq(LmMessage *m); |
|
108 JingleAction jingle_action_from_str(const gchar* string); |
|
109 |
|
110 #endif |
|