|
1 /** |
|
2 * @file register.h |
|
3 * @brief register.c header file |
|
4 * @author Nicolas Cornu |
|
5 */ |
|
6 |
1 #ifndef __JINGLE_REGISTER_H__ |
7 #ifndef __JINGLE_REGISTER_H__ |
2 #define __JINGLE_REGISTER_H__ |
8 #define __JINGLE_REGISTER_H__ |
3 |
9 |
4 #include <jingle/jingle.h> |
10 #include <jingle/jingle.h> |
5 |
11 |
6 #define NS_JINGLE_APP_PREFIX "urn:xmpp:jingle:apps:" |
12 #define NS_JINGLE_APP_PREFIX "urn:xmpp:jingle:apps:" |
7 #define NS_JINGLE_TRANSPORT_PREFIX "urn:xmpp:jingle:transports:" |
13 #define NS_JINGLE_TRANSPORT_PREFIX "urn:xmpp:jingle:transports:" |
8 |
14 |
9 |
15 |
|
16 /** |
|
17 * @brief A transport can be either of type "streaming" or "datagram" |
|
18 */ |
10 typedef enum { |
19 typedef enum { |
11 /* A datagram transport has one or more components with which to exchange |
20 /** |
|
21 * A datagram transport has one or more components with which to exchange |
12 * packets with UDP-like behavior. Packets might be of arbitrary length, |
22 * packets with UDP-like behavior. Packets might be of arbitrary length, |
13 * might be received out of order, and might not be received at all |
23 * might be received out of order, and might not be received at all |
14 * (i.e., the transport is lossy). */ |
24 * (i.e., the transport is lossy). |
|
25 */ |
15 JINGLE_TRANSPORT_STREAMING, |
26 JINGLE_TRANSPORT_STREAMING, |
16 |
27 |
17 /* A streaming transport has one or more components with which to exchange |
28 /** |
|
29 * A streaming transport has one or more components with which to exchange |
18 * bidirectional bytestreams with TCP-like behavior. Bytes are received |
30 * bidirectional bytestreams with TCP-like behavior. Bytes are received |
19 * reliably and in order, and applications MUST NOT rely on a stream being |
31 * reliably and in order, and applications MUST NOT rely on a stream being |
20 * chunked in any specific way. */ |
32 * chunked in any specific way. |
|
33 */ |
21 JINGLE_TRANSPORT_DATAGRAM |
34 JINGLE_TRANSPORT_DATAGRAM |
22 } JingleTransportType; |
35 } JingleTransportType; |
23 |
36 |
24 /** |
37 /** |
|
38 * @brief A way for transport modules to rank themselves. |
|
39 * |
25 * We need to rank transports to determine which one to choose. |
40 * We need to rank transports to determine which one to choose. |
26 * With this system, In-Band Bytestreams could have a low priority, SOCKS5 |
41 * With this system, In-Band Bytestreams could have a low priority, |
27 * Bytestream a normal priority, and some stream transport method that allow |
42 * SOCKS5 Bytestreams a normal priority.\n |
28 * direct connection would have a high priority, since it would be the fastest. |
43 * 0 will always be an invalid priority. |
29 */ |
44 */ |
30 typedef enum { |
45 typedef enum { |
31 JINGLE_TRANSPORT_NONE, |
46 JINGLE_TRANSPORT_PRIO_LOW = 1, |
32 JINGLE_TRANSPORT_LOW, |
47 JINGLE_TRANSPORT_PRIO_NORMAL, |
33 JINGLE_TRANSPORT_NORMAL, |
48 JINGLE_TRANSPORT_PRIO_HIGH |
34 JINGLE_TRANSPORT_HIGH |
|
35 } JingleTransportPriority; |
49 } JingleTransportPriority; |
36 |
50 |
37 typedef gconstpointer (*JingleAppCheck) (JingleContent *cn, GError **err); |
51 typedef gconstpointer (*JingleAppCheck) (JingleContent *cn, GError **err); |
38 typedef gboolean (*JingleAppHandle) (JingleAction action, gconstpointer data, LmMessageNode *node); |
52 typedef gboolean (*JingleAppHandle) (JingleAction action, gconstpointer data, LmMessageNode *node); |
39 typedef void (*JingleAppToMessage) (gconstpointer data, LmMessageNode *node); |
53 typedef void (*JingleAppToMessage) (gconstpointer data, LmMessageNode *node); |
49 typedef void (*JingleTransportSend) (session_content *sc, gconstpointer data, gchar *buf, gsize size); |
63 typedef void (*JingleTransportSend) (session_content *sc, gconstpointer data, gchar *buf, gsize size); |
50 typedef void (*JingleTransportInit) (session_content *sc, gconstpointer data); |
64 typedef void (*JingleTransportInit) (session_content *sc, gconstpointer data); |
51 typedef void (*JingleTransportEnd) (session_content *sc, gconstpointer data); |
65 typedef void (*JingleTransportEnd) (session_content *sc, gconstpointer data); |
52 typedef gchar* (*JingleTransportInfo) (gconstpointer data); |
66 typedef gchar* (*JingleTransportInfo) (gconstpointer data); |
53 |
67 |
|
68 /** |
|
69 * @brief Struct containing functions provided by an app module. |
|
70 */ |
54 typedef struct { |
71 typedef struct { |
55 /* check if the description of a JingleContent is correct */ |
72 /** |
|
73 * @brief Check if the description node of a JingleContent is correct |
|
74 */ |
56 JingleAppCheck check; |
75 JingleAppCheck check; |
57 |
76 |
58 /* handle an incoming jingle message (session-info, description-info...). |
77 /** |
|
78 * @brief Handle an incoming jingle message (session-info, description-info...) |
|
79 * |
59 * If the function could not handle the incoming data, the caller should |
80 * If the function could not handle the incoming data, the caller should |
60 * reply to the incoming message with an error iq */ |
81 * reply to the incoming message with an error iq. |
|
82 */ |
61 JingleAppHandle handle; |
83 JingleAppHandle handle; |
62 |
84 |
63 /* Insert data from the gconstpointer to the node given as an argument */ |
85 /** |
|
86 * @brief Insert data from the gconstpointer to the node given as an argument |
|
87 */ |
64 JingleAppToMessage tomessage; |
88 JingleAppToMessage tomessage; |
65 |
89 |
|
90 /** |
|
91 * @brief Handle incoming data |
|
92 */ |
66 JingleAppHandleData handle_data; |
93 JingleAppHandleData handle_data; |
67 |
94 |
68 JingleAppStart start; |
95 JingleAppStart start; |
69 |
96 |
70 JingleAppSend send; |
97 JingleAppSend send; |
71 |
98 |
72 JingleAppStop stop; |
99 JingleAppStop stop; |
73 |
100 |
74 JingleAppInfo info; |
101 JingleAppInfo info; |
75 |
102 |
76 } JingleAppFuncs; |
103 } JingleAppFuncs; |
77 |
104 |
78 typedef struct { |
105 typedef struct { |
|
106 /** |
|
107 * @brief Check if the transport node of a JingleContent is correct |
|
108 */ |
79 JingleTransportCheck check; |
109 JingleTransportCheck check; |
80 |
110 |
|
111 /** |
|
112 * @brief Insert data from the gconstpointer to the node given as an argument |
|
113 */ |
81 JingleTransportToMessage tomessage; |
114 JingleTransportToMessage tomessage; |
82 |
115 |
83 JingleTransportNew new; |
116 JingleTransportNew new; |
84 |
117 |
85 JingleTransportSend send; |
118 JingleTransportSend send; |
86 |
119 |
87 JingleTransportInit init; |
120 JingleTransportInit init; |
88 |
121 |
89 JingleTransportEnd end; |
122 JingleTransportEnd end; |
90 |
123 |
91 JingleTransportInfo info; |
124 JingleTransportInfo info; |
92 |
125 |
93 } JingleTransportFuncs; |
126 } JingleTransportFuncs; |
94 |
127 |
95 |
128 |