ucs: fix Persona key extraction
[siplcs.git] / src / core / sipe-dialog.h
blobdd3c929b70a29de80c6e72f170498c08a6ebe42a
1 /**
2 * @file sipe-dialog.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_delayed_invite;
31 struct sipmsg;
33 /* Helper macros to iterate over dialog list in a SIP session */
34 #define SIPE_DIALOG_FOREACH { \
35 GSList *entry = session->dialogs; \
36 while (entry) { \
37 struct sip_dialog *dialog = entry->data; \
38 entry = entry->next;
39 #define SIPE_DIALOG_FOREACH_END }}
41 /* dialog is the new term for call-leg */
42 struct sip_dialog {
43 gchar *with; /* URI */
44 gchar *endpoint_GUID;
45 /**
46 * >0 - pro
47 * <0 - contra
48 * 0 - didn't participate
50 int election_vote;
51 gchar *ourtag;
52 gchar *theirtag;
53 gchar *theirepid;
54 gchar *callid;
55 GSList *routes;
56 gchar *request;
57 GSList *supported; /* counterparty capabilities */
58 GSList *filetransfers;
59 int cseq;
60 /** corresponds to Session-Expires SIP header value */
61 int expires;
62 gboolean is_established;
63 struct transaction *outgoing_invite;
64 struct sipe_delayed_invite *delayed_invite;
67 /* Forward declaration */
68 struct sip_session;
70 /**
71 * Free dialog structure
73 * @param dialog (in) Dialog to be freed. May be NULL.
75 void sipe_dialog_free(struct sip_dialog *dialog);
77 /**
78 * Add a new, empty dialog to a session
80 * @param session (in)
82 * @return dialog the new dialog structure
84 struct sip_dialog *sipe_dialog_add(struct sip_session *session);
86 /**
87 * Find a dialog in a session
89 * @param session (in) may be NULL
90 * @param who (in) dialog identifier. May be NULL
92 * @return dialog the requested dialog or NULL
94 struct sip_dialog *sipe_dialog_find(struct sip_session *session,
95 const gchar *who);
97 /**
98 * Remove a dialog from a session
100 * @param session (in) may be NULL
101 * @param who (in) dialog identifier. May be NULL
103 void sipe_dialog_remove(struct sip_session *session, const gchar *who);
106 * Remove a dialog from a session
108 * @param session (in) may be NULL
109 * @param dialog (in) dialog identifier. Should contain Call-ID, to-tag and from-tag
110 * to unambiguously identify dialog. May be NULL
112 void
113 sipe_dialog_remove_3(struct sip_session *session,
114 struct sip_dialog *dialog_in);
117 * Remove all dialogs from a session
119 * @param session (in)
121 void sipe_dialog_remove_all(struct sip_session *session);
124 * Does a session have any dialogs?
126 * @param session (in)
128 #define sipe_dialog_any(session) (session->dialogs != NULL)
131 * Return first dialog of a session
133 * @param session (in)
135 #define sipe_dialog_first(session) ((struct sip_dialog *)session->dialogs->data)
138 * Fill dialog structure from SIP message
140 * @param dialog (in,out) dialog to fill
141 * @param msg (in) mesage
142 * @param outgoing (in) outgoing or incoming message
144 void sipe_dialog_parse(struct sip_dialog *dialog,
145 const struct sipmsg *msg,
146 gboolean outgoing);