tls: add Server Key Exchange message
[siplcs.git] / src / core / sipe-session.h
blob1315ba07a57a327669c8ca6c85d557228e2720f9
1 /**
2 * @file sipe-sesion.h
4 * pidgin-sipe
6 * Copyright (C) 2009-11 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Interface dependencies:
26 * <glib.h>
29 /* Forward declarations */
30 struct sipe_core_private;
31 struct sipe_chat_session;
33 /* Helper macros to iterate over session list in a SIP account */
34 #define SIPE_SESSION_FOREACH { \
35 GSList *entry = sipe_private->sessions; \
36 while (entry) { \
37 struct sip_session *session = entry->data; \
38 entry = entry->next;
39 #define SIPE_SESSION_FOREACH_END }}
41 /** Correspond to multi-party conversation */
42 struct sip_session {
43 /** chat session */
44 struct sipe_chat_session *chat_session;
46 gchar *with; /* For IM or call sessions only (not multi-party) . A URI.*/
47 /** key is user (URI) */
48 GSList *dialogs;
49 /** Key is <Call-ID><CSeq><METHOD><To> */
50 GHashTable *unconfirmed_messages;
51 GSList *outgoing_message_queue;
54 * Multiparty conversation related fields
56 /** Call-Id identifying the conversation */
57 gchar *callid; /* For multiparty conversations */
58 int bid;
59 gboolean is_voting_in_progress;
60 GSList *pending_invite_queue;
63 * Conference related fields
65 gchar *im_mcu_uri;
66 gchar *subject;
67 gboolean locked;
68 struct sip_dialog *focus_dialog;
69 /** Key is Message-Id */
70 GHashTable *conf_unconfirmed_messages;
73 * Media call related fields
75 gboolean is_call;
78 * Group Chat related fields
80 gboolean is_groupchat;
83 /**
84 * An item in outgoing message queue.
86 * Messages are put in the queue until a response to initial INVITE is received
87 * from remote dialog participant.
89 struct queued_message {
90 /** Body of the message. */
91 gchar *body;
92 /**
93 * Content type of message body, e.g. text/plain for chat messages,
94 * text/x-msmsgsinvite for filetransfer initialization. Setting this to NULL
95 * means default value text/plain.
97 gchar *content_type;
98 guint cseq;
102 * Add a new chat session
104 * @param sipe_private (in) SIPE core data. May be NULL
105 * @param chat_session (in) non-NULL to rejoin existing chat
106 * @param multiparty (in) multiparty or conference
107 * @param id (in) new chat session identifier (ignored for rejoin).
109 * @return pointer to new session
111 struct sip_session *
112 sipe_session_add_chat(struct sipe_core_private *sipe_private,
113 struct sipe_chat_session *chat_session,
114 gboolean multiparty,
115 const gchar *id);
117 #ifdef HAVE_VV
120 * Add a new media call session
122 * @param sipe_private (in) SIPE core data.
123 * @param who (in) remote partner.
125 * @return pointer to new session
127 struct sip_session *
128 sipe_session_add_call(struct sipe_core_private *sipe_private,
129 const gchar *who);
132 * Find media call session
134 * @param sipe_private (in) SIPE core data. May be NULL.
135 * @param who (in) remote partner.
137 * @return pointer to session or NULL
139 struct sip_session *
140 sipe_session_find_call(struct sipe_core_private *sipe_private,
141 const gchar *who);
143 #endif
146 * Find chat session
148 * @param sipe_private (in) SIPE core data. May be NULL
149 * @param chat_session (in) chat session data. May be NULL
151 * @return pointer to session or NULL
153 struct sip_session *
154 sipe_session_find_chat(struct sipe_core_private *sipe_private,
155 struct sipe_chat_session *chat_session);
158 * Find chat session by Call ID
160 * @param sipe_private (in) SIPE core data. May be NULL
161 * @param callid (in) Call ID. May be NULL
163 * @return pointer to session or NULL
165 struct sip_session *
166 sipe_session_find_chat_by_callid(struct sipe_core_private *sipe_private,
167 const gchar *callid);
170 * Find Conference session
172 * @param sipe_private (in) SIPE core data. May be NULL
173 * @param focus_uri (in) URI of conference focus. May be NULL
175 * @return pointer to session or NULL
177 struct sip_session *
178 sipe_session_find_conference(struct sipe_core_private *sipe_private,
179 const gchar *focus_uri);
182 * Find IM session
184 * @param sipe_private (in) SIPE core data. May be NULL
185 * @param who (in) remote partner. May be NULL
187 * @return pointer to session or NULL
189 struct sip_session *
190 sipe_session_find_im(struct sipe_core_private *sipe_private,
191 const gchar *who);
194 * Find or add new IM session
196 * @param sipe_private (in) SIPE core data
197 * @param who (in) remote partner
199 * @return pointer to session
201 struct sip_session *
202 sipe_session_find_or_add_im(struct sipe_core_private *sipe_private,
203 const gchar *who);
206 * Find Chat by Call ID or IM session
208 * @param sipe_private (in) SIPE core data. May be NULL
209 * @param callid (in) Call ID. May be NULL
210 * @param who (in) remote partner. May be NULL
212 * @return pointer to session or NULL
214 struct sip_session *
215 sipe_session_find_chat_or_im(struct sipe_core_private *sipe_private,
216 const gchar *callid,
217 const gchar *who);
220 * Close a session
222 * @param sipe_private (in) SIPE core data
223 * @param session (in) pointer to session
225 void
226 sipe_session_close(struct sipe_core_private *sipe_private,
227 struct sip_session *session);
230 * Remove a session from a SIP account
232 * @param sipe_private (in) SIPE core data
233 * @param session (in) pointer to session
235 void
236 sipe_session_remove(struct sipe_core_private *sipe_private,
237 struct sip_session *session);
240 * Add a message to outgoing queue.
242 * @param session (in) SIP session
243 * @param body (in) message to send
244 * @param content_type (in) content type of the message body
246 void
247 sipe_session_enqueue_message(struct sip_session *session,
248 const gchar *body, const gchar *content_type);
251 * Removes and deallocates the first item in outgoing message queue.
253 * @param session (in) SIP session
255 * @return pointer to new message queue head
257 GSList *
258 sipe_session_dequeue_message(struct sip_session *session);