Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/jingle/session.h @ 26014:bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Actually negotiate a rawudp transport rather than pretending to use iceudp.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Sun, 19 Oct 2008 04:37:23 +0000 |
parents | |
children | 7252e3d0c627 |
comparison
equal
deleted
inserted
replaced
26013:5a774d0817d8 | 26014:bd598b606ca4 |
---|---|
1 /** | |
2 * @file session.h | |
3 * | |
4 * purple | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
19 */ | |
20 | |
21 #ifndef JINGLE_SESSION_H | |
22 #define JINGLE_SESSION_H | |
23 | |
24 #include "iq.h" | |
25 #include "jabber.h" | |
26 | |
27 #include <glib.h> | |
28 #include <glib-object.h> | |
29 | |
30 G_BEGIN_DECLS | |
31 | |
32 #define JINGLE_TYPE_SESSION (jingle_session_get_type()) | |
33 #define JINGLE_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_SESSION, JingleSession)) | |
34 #define JINGLE_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_SESSION, JingleSessionClass)) | |
35 #define JINGLE_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_SESSION)) | |
36 #define JINGLE_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_SESSION)) | |
37 #define JINGLE_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_SESSION, JingleSessionClass)) | |
38 | |
39 /** @copydoc _JingleSession */ | |
40 typedef struct _JingleSession JingleSession; | |
41 /** @copydoc _JingleSessionClass */ | |
42 typedef struct _JingleSessionClass JingleSessionClass; | |
43 /** @copydoc _JingleSessionPrivate */ | |
44 typedef struct _JingleSessionPrivate JingleSessionPrivate; | |
45 | |
46 /** The session class */ | |
47 struct _JingleSessionClass | |
48 { | |
49 GObjectClass parent_class; /**< The parent class. */ | |
50 }; | |
51 | |
52 /** The session class's private data */ | |
53 struct _JingleSession | |
54 { | |
55 GObject parent; /**< The parent of this object. */ | |
56 JingleSessionPrivate *priv; /**< The private data of this object. */ | |
57 }; | |
58 | |
59 struct _JingleContent; | |
60 | |
61 #ifdef __cplusplus | |
62 extern "C" { | |
63 #endif | |
64 | |
65 /** | |
66 * Gets the session class's GType | |
67 * | |
68 * @return The session class's GType. | |
69 */ | |
70 GType jingle_session_get_type(void); | |
71 | |
72 JingleSession *jingle_session_create(JabberStream *js, const gchar *sid, | |
73 const gchar *local_jid, const gchar *remote_jid, | |
74 gboolean is_initiator); | |
75 JabberStream *jingle_session_get_js(JingleSession *session); | |
76 gchar *jingle_session_get_sid(JingleSession *session); | |
77 gchar *jingle_session_get_local_jid(JingleSession *session); | |
78 gchar *jingle_session_get_remote_jid(JingleSession *session); | |
79 gboolean jingle_session_is_initiator(JingleSession *session); | |
80 gboolean jingle_session_get_state(JingleSession *session); | |
81 | |
82 GList *jingle_session_get_contents(JingleSession *session); | |
83 GList *jingle_session_get_pending_contents(JingleSession *session); | |
84 | |
85 JingleSession *jingle_session_find_by_sid(JabberStream *js, const gchar *sid); | |
86 JingleSession *jingle_session_find_by_jid(JabberStream *js, const gchar *jid); | |
87 | |
88 JabberIq *jingle_session_create_ack(JingleSession *session, const xmlnode *jingle); | |
89 xmlnode *jingle_session_to_xml(JingleSession *session, xmlnode *parent, JingleActionType action); | |
90 JabberIq *jingle_session_to_packet(JingleSession *session, JingleActionType action); | |
91 | |
92 void jingle_session_handle_action(JingleSession *session, xmlnode *jingle, JingleActionType action); | |
93 | |
94 #define jingle_session_create_session_accept(session) \ | |
95 jingle_session_to_packet(session, JINGLE_SESSION_ACCEPT) | |
96 #define jingle_session_create_session_info(session) \ | |
97 jingle_session_to_packet(session, JINGLE_SESSION_INFO) | |
98 #define jingle_session_create_session_initiate(session) \ | |
99 jingle_session_to_packet(session, JINGLE_SESSION_INITIATE) | |
100 #define jingle_session_create_session_terminate(session) \ | |
101 jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE) | |
102 | |
103 struct _JingleContent *jingle_session_find_content(JingleSession *session, | |
104 const gchar *name, const gchar *creator); | |
105 struct _JingleContent *jingle_session_find_pending_content(JingleSession *session, | |
106 const gchar *name, const gchar *creator); | |
107 | |
108 void jingle_session_add_content(JingleSession *session, struct _JingleContent* content); | |
109 void jingle_session_remove_content(JingleSession *session, const gchar *name, const gchar *creator); | |
110 void jingle_session_add_pending_content(JingleSession *session, struct _JingleContent* content); | |
111 void jingle_session_remove_pending_content(JingleSession *session, const gchar *name, const gchar *creator); | |
112 void jingle_session_accept_content(JingleSession *session, const gchar *name, const gchar *creator); | |
113 void jingle_session_accept_session(JingleSession *session); | |
114 | |
115 #ifdef __cplusplus | |
116 } | |
117 #endif | |
118 | |
119 G_END_DECLS | |
120 | |
121 #endif /* JINGLE_SESSION_H */ | |
122 |