updated localization files
[siplcs.git] / src / core / sipe-dialog.h
blob8083f559c6387335d805f14b51a14f5795d3436b
1 /**
2 * @file sipe-dialog.h
4 * pidgin-sipe
6 * Copyright (C) 2009 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 sipmsg;
32 /* Helper macros to iterate over dialog list in a SIP session */
33 #define SIPE_DIALOG_FOREACH { \
34 GSList *entry = session->dialogs; \
35 while (entry) { \
36 struct sip_dialog *dialog = entry->data; \
37 entry = entry->next;
38 #define SIPE_DIALOG_FOREACH_END }}
40 /* dialog is the new term for call-leg */
41 struct sip_dialog {
42 gchar *with; /* URI */
43 gchar *endpoint_GUID;
44 /**
45 * >0 - pro
46 * <0 - contra
47 * 0 - didn't participate
49 int election_vote;
50 gchar *ourtag;
51 gchar *theirtag;
52 gchar *theirepid;
53 gchar *callid;
54 GSList *routes;
55 gchar *request;
56 GSList *supported; /* counterparty capabilities */
57 int cseq;
58 /** corresponds to Session-Expires SIP header value */
59 int expires;
60 gboolean is_established;
61 struct transaction *outgoing_invite;
64 /* RFC3265 subscription */
65 struct sip_subscription {
66 struct sip_dialog dialog;
67 gchar *event;
70 /* Forward declaration */
71 struct sip_session;
73 /**
74 * Free dialog structure
76 * @param dialog (in) Dialog to be freed. May be NULL.
78 void sipe_dialog_free(struct sip_dialog *dialog);
80 /**
81 * Free subscription structure
83 * @param subscription (in) Subscription to be freed. May be NULL.
85 void sipe_subscription_free(struct sip_subscription *subscription);
87 /**
88 * Add a new, empty dialog to a session
90 * @param session (in)
92 * @return dialog the new dialog structure
94 struct sip_dialog *sipe_dialog_add(struct sip_session *session);
96 /**
97 * Find a dialog in a session
99 * @param session (in) may be NULL
100 * @param who (in) dialog identifier. May be NULL
102 * @return dialog the requested dialog or NULL
104 struct sip_dialog *sipe_dialog_find(struct sip_session *session,
105 const gchar *who);
108 * Remove a dialog from a session
110 * @param session (in) may be NULL
111 * @param who (in) dialog identifier. May be NULL
113 void sipe_dialog_remove(struct sip_session *session, const gchar *who);
116 * Remove a dialog from a session
118 * @param session (in) may be NULL
119 * @param dialog (in) dialog identifier. Should contain Call-ID, to-tag and from-tag
120 * to unambiguously identify dialog. May be NULL
122 void
123 sipe_dialog_remove_3(struct sip_session *session,
124 struct sip_dialog *dialog_in);
127 * Remove all dialogs from a session
129 * @param session (in)
131 void sipe_dialog_remove_all(struct sip_session *session);
134 * Does a session have any dialogs?
136 * @param session (in)
138 #define sipe_dialog_any(session) (session->dialogs != NULL)
141 * Return first dialog of a session
143 * @param session (in)
145 #define sipe_dialog_first(session) ((struct sip_dialog *)session->dialogs->data)
148 * Update routes in a dialog from a message
150 * @param dialog (in,out) dialog to fill
151 * @param msg (in) mesage
152 * @param outgoing (in) outgoing or incoming message
154 void sipe_dialog_parse_routes(struct sip_dialog *dialog,
155 const struct sipmsg *msg,
156 gboolean outgoing);
159 * Fill dialog structure from SIP message
161 * @param dialog (in,out) dialog to fill
162 * @param msg (in) mesage
163 * @param outgoing (in) outgoing or incoming message
165 void sipe_dialog_parse(struct sip_dialog *dialog,
166 const struct sipmsg *msg,
167 gboolean outgoing);