996454362c7f9b34c8f40b0a8364f433f2bc1251
[siplcs.git] / src / core / sip-transport.h
blob996454362c7f9b34c8f40b0a8364f433f2bc1251
1 /**
2 * @file sip-transport.h
4 * pidgin-sipe
6 * Copyright (C) 2010-2013 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
23 /* Forward declarations */
24 struct sipmsg;
25 struct sip_dialog;
26 struct sipe_core_private;
27 struct transaction;
29 /* Transaction that can be associated with a SIP request */
30 typedef gboolean (*TransCallback) (struct sipe_core_private *,
31 struct sipmsg *,
32 struct transaction *);
34 struct transaction_payload {
35 GDestroyNotify destroy;
36 void *data;
39 struct transaction {
40 TransCallback callback;
41 TransCallback timeout_callback;
43 /** Not yet perfect, but surely better then plain CSeq
44 * Format is: <Call-ID><CSeq>
45 * (RFC3261 17.2.3 for matching server transactions: Request-URI, To tag, From tag, Call-ID, CSeq, and top Via)
47 gchar *key;
48 gchar *timeout_key;
49 struct sipmsg *msg;
50 struct transaction_payload *payload;
53 /* Send SIP response */
54 void sip_transport_response(struct sipe_core_private *sipe_private,
55 struct sipmsg *msg,
56 guint code,
57 const char *text,
58 const char *body);
60 /* Send SIP request */
61 struct transaction *sip_transport_request(struct sipe_core_private *sipe_private,
62 const gchar *method,
63 const gchar *url,
64 const gchar *to,
65 const gchar *addheaders,
66 const gchar *body,
67 struct sip_dialog *dialog,
68 TransCallback callback);
70 /* Send SIP request with timeout [in seconds] */
71 struct transaction *sip_transport_request_timeout(struct sipe_core_private *sipe_private,
72 const gchar *method,
73 const gchar *url,
74 const gchar *to,
75 const gchar *addheaders,
76 const gchar *body,
77 struct sip_dialog *dialog,
78 TransCallback callback,
79 guint timeout,
80 TransCallback timeout_callback);
82 /* Common SIP request types */
83 void sip_transport_ack(struct sipe_core_private *sipe_private,
84 struct sip_dialog *dialog);
85 void sip_transport_bye(struct sipe_core_private *sipe_private,
86 struct sip_dialog *dialog);
87 struct transaction *sip_transport_info(struct sipe_core_private *sipe_private,
88 const gchar *addheaders,
89 const gchar *body,
90 struct sip_dialog *dialog,
91 TransCallback callback);
92 struct transaction *sip_transport_invite(struct sipe_core_private *sipe_private,
93 const gchar *addheaders,
94 const gchar *body,
95 struct sip_dialog *dialog,
96 TransCallback callback);
97 struct transaction *sip_transport_service(struct sipe_core_private *sipe_private,
98 const gchar *uri,
99 const gchar *addheaders,
100 const gchar *body,
101 TransCallback callback);
102 void sip_transport_subscribe(struct sipe_core_private *sipe_private,
103 const gchar *uri,
104 const gchar *addheaders,
105 const gchar *body,
106 struct sip_dialog *dialog,
107 TransCallback callback);
108 void sip_transport_update(struct sipe_core_private *sipe_private,
109 struct sip_dialog *dialog);
111 /* Misc. SIP transport stuff */
112 guint sip_transport_port(struct sipe_core_private *sipe_private);
113 void sip_transport_deregister(struct sipe_core_private *sipe_private);
114 void sip_transport_disconnect(struct sipe_core_private *sipe_private);
115 void sip_transport_authentication_completed(struct sipe_core_private *sipe_private);
117 int sip_transaction_cseq(struct transaction *trans);
120 Local Variables:
121 mode: c
122 c-file-style: "bsd"
123 indent-tabs-mode: t
124 tab-width: 8
125 End: