libpurple/protocols/jabber/jingle/session.h

Sat, 07 Sep 2013 00:10:19 +0530

author
Ankit Vani <a@nevitus.org>
date
Sat, 07 Sep 2013 00:10:19 +0530
branch
soc.2013.gobjectification
changeset 34935
686fa55b0deb
parent 33632
78c026f584bd
child 36889
4dfe09057bed
permissions
-rw-r--r--

Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API

26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1 /**
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
2 * @file session.h
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
3 *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
4 * purple
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
5 *
28322
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26702
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26702
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26702
diff changeset
8 * source distribution.
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 26702
diff changeset
9 *
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
13 * (at your option) any later version.
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
14 *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
18 * GNU General Public License for more details.
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
19 *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
23 */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
24
26702
b3c0c14c4c5e Standardize the header file sentinels to PURPLE_JABBER_[BLAH]_H
Paul Aurich <darkrain42@pidgin.im>
parents: 26404
diff changeset
25 #ifndef PURPLE_JABBER_JINGLE_SESSION_H
b3c0c14c4c5e Standardize the header file sentinels to PURPLE_JABBER_[BLAH]_H
Paul Aurich <darkrain42@pidgin.im>
parents: 26404
diff changeset
26 #define PURPLE_JABBER_JINGLE_SESSION_H
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
27
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
28 #include "iq.h"
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
29 #include "jabber.h"
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
30
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
31 #include <glib.h>
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
32 #include <glib-object.h>
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
33
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
34 G_BEGIN_DECLS
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
35
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
36 #define JINGLE_TYPE_SESSION (jingle_session_get_type())
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
37 #define JINGLE_SESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JINGLE_TYPE_SESSION, JingleSession))
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
38 #define JINGLE_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JINGLE_TYPE_SESSION, JingleSessionClass))
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
39 #define JINGLE_IS_SESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JINGLE_TYPE_SESSION))
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
40 #define JINGLE_IS_SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JINGLE_TYPE_SESSION))
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
41 #define JINGLE_SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JINGLE_TYPE_SESSION, JingleSessionClass))
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
42
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
43 /** @copydoc _JingleSession */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
44 typedef struct _JingleSession JingleSession;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
45 /** @copydoc _JingleSessionClass */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
46 typedef struct _JingleSessionClass JingleSessionClass;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
47 /** @copydoc _JingleSessionPrivate */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
48 typedef struct _JingleSessionPrivate JingleSessionPrivate;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
49
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
50 /** The session class */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
51 struct _JingleSessionClass
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
52 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
53 GObjectClass parent_class; /**< The parent class. */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
54 };
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
55
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
56 /** The session class's private data */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
57 struct _JingleSession
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
58 {
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
59 GObject parent; /**< The parent of this object. */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
60 JingleSessionPrivate *priv; /**< The private data of this object. */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
61 };
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
62
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
63 struct _JingleContent;
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
64
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
65 /**
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
66 * Gets the session class's GType
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
67 *
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
68 * @return The session class's GType.
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
69 */
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
70 GType jingle_session_get_type(void);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
71
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
72 JingleSession *jingle_session_create(JabberStream *js, const gchar *sid,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
73 const gchar *local_jid, const gchar *remote_jid,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
74 gboolean is_initiator);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
75 JabberStream *jingle_session_get_js(JingleSession *session);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
76 gchar *jingle_session_get_sid(JingleSession *session);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
77 gchar *jingle_session_get_local_jid(JingleSession *session);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
78 gchar *jingle_session_get_remote_jid(JingleSession *session);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
79 gboolean jingle_session_is_initiator(JingleSession *session);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
80 gboolean jingle_session_get_state(JingleSession *session);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
81
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
82 GList *jingle_session_get_contents(JingleSession *session);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
83 GList *jingle_session_get_pending_contents(JingleSession *session);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
84
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
85 JingleSession *jingle_session_find_by_sid(JabberStream *js, const gchar *sid);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
86 JingleSession *jingle_session_find_by_jid(JabberStream *js, const gchar *jid);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
87
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33632
diff changeset
88 JabberIq *jingle_session_create_ack(JingleSession *session, const PurpleXmlNode *jingle);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33632
diff changeset
89 PurpleXmlNode *jingle_session_to_xml(JingleSession *session, PurpleXmlNode *parent, JingleActionType action);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
90 JabberIq *jingle_session_to_packet(JingleSession *session, JingleActionType action);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
91
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33632
diff changeset
92 void jingle_session_handle_action(JingleSession *session, PurpleXmlNode *jingle, JingleActionType action);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
93
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
94 struct _JingleContent *jingle_session_find_content(JingleSession *session,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
95 const gchar *name, const gchar *creator);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
96 struct _JingleContent *jingle_session_find_pending_content(JingleSession *session,
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
97 const gchar *name, const gchar *creator);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
98
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
99 void jingle_session_add_content(JingleSession *session, struct _JingleContent* content);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
100 void jingle_session_remove_content(JingleSession *session, const gchar *name, const gchar *creator);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
101 void jingle_session_add_pending_content(JingleSession *session, struct _JingleContent* content);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
102 void jingle_session_remove_pending_content(JingleSession *session, const gchar *name, const gchar *creator);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
103 void jingle_session_accept_content(JingleSession *session, const gchar *name, const gchar *creator);
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
104 void jingle_session_accept_session(JingleSession *session);
26404
3947a428b87d Add functions for more easily creating session-terminate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
105 JabberIq *jingle_session_terminate_packet(JingleSession *session, const gchar *reason);
3947a428b87d Add functions for more easily creating session-terminate packets.
Michael Ruprecht <maiku@pidgin.im>
parents: 26147
diff changeset
106 JabberIq *jingle_session_redirect_packet(JingleSession *session, const gchar *sid);
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
107
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
108 G_END_DECLS
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
109
26702
b3c0c14c4c5e Standardize the header file sentinels to PURPLE_JABBER_[BLAH]_H
Paul Aurich <darkrain42@pidgin.im>
parents: 26404
diff changeset
110 #endif /* PURPLE_JABBER_JINGLE_SESSION_H */
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
111

mercurial