svc: add HTTP session handling
[siplcs.git] / src / core / sipe-svc.h
blobe1b08ea144c06b910fbeeb153896cfdc507dded2
1 /**
2 * @file sipe-svc.h
4 * pidgin-sipe
6 * Copyright (C) 2011-12 SIPE Project <http://sipe.sourceforge.net/>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * Interface dependencies:
27 * <glib.h>
30 /* Forward declarations */
31 struct sipe_core_private;
32 struct sipe_svc_session;
33 struct sipe_tls_random;
34 struct _sipe_xml;
36 /**
37 * Service XML callback
39 * @param sipe_private SIPE core private data
40 * @param uri service URI (NULL when request aborted)
41 * @param raw raw XML data (NULL when request failed)
42 * @param xml parsed XML data (NULL when request failed)
43 * @param callback_data callback data
45 typedef void (sipe_svc_callback)(struct sipe_core_private *sipe_private,
46 const gchar *uri,
47 const gchar *raw,
48 struct _sipe_xml *xml,
49 gpointer callback_data);
51 /**
52 * Start a session of related service requests
54 * @return Opaque session pointer
56 struct sipe_svc_session *sipe_svc_session_start(void);
58 /**
59 * Close a session of related service requests
61 * @param session Opaque session pointer
63 void sipe_svc_session_close(struct sipe_svc_session *session);
65 /**
66 * Trigger fetch of Get & Publish certificate
68 * @param sipe_private SIPE core private data
69 * @param uri service URI
70 * @param wsse_security predefined authentication token
71 * @param certreq certificate request (Base64 encoded)
72 * @param callback callback function
73 * @param callback_data callback data
74 * @return @c TRUE if certificate fetch was triggered
76 gboolean sipe_svc_get_and_publish_cert(struct sipe_core_private *sipe_private,
77 struct sipe_svc_session *session,
78 const gchar *uri,
79 const gchar *wsse_security,
80 const gchar *certreq,
81 sipe_svc_callback *callback,
82 gpointer callback_data);
84 /**
85 * Trigger [MS-DLX] address book entry search
87 * @param sipe_private SIPE core private data
88 * @param uri service URI
89 * @param wsse_security predefined authentication token
90 * @param search [MS-DLX] AbEntryRequest.ChangeSearchQuery in XML
91 * @param entries array entries in search XML string
92 * @param max_returns how many entries to return
93 * @param callback callback function
94 * @param callback_data callback data
95 * @return @c TRUE if search was triggered
97 gboolean sipe_svc_ab_entry_request(struct sipe_core_private *sipe_private,
98 struct sipe_svc_session *session,
99 const gchar *uri,
100 const gchar *wsse_security,
101 const gchar *search,
102 guint entries,
103 guint max_returns,
104 sipe_svc_callback *callback,
105 gpointer callback_data);
108 * Trigger fetch of WebTicket security token
110 * @param sipe_private SIPE core private data
111 * @param uri service URI
112 * @param wsse_security predefined authentication token. May be @c NULL
113 * @param service_uri request token for this service URI
114 * @param entropy random bytes buffer for entropy
115 * @param callback callback function
116 * @param callback_data callback data
117 * @return @c TRUE if token fetch was triggered
119 gboolean sipe_svc_webticket(struct sipe_core_private *sipe_private,
120 struct sipe_svc_session *session,
121 const gchar *uri,
122 const gchar *wsse_security,
123 const gchar *service_uri,
124 const struct sipe_tls_random *entropy,
125 sipe_svc_callback *callback,
126 gpointer callback_data);
129 * Trigger fetch of WebTicket security token from login.microsoftonline.com
131 * @param sipe_private SIPE core private data
132 * @param service_uri request token for this service URI
133 * @param callback callback function
134 * @param callback_data callback data
135 * @return @c TRUE if token fetch was triggered
137 gboolean sipe_svc_webticket_lmc(struct sipe_core_private *sipe_private,
138 struct sipe_svc_session *session,
139 const gchar *service_uri,
140 sipe_svc_callback *callback,
141 gpointer callback_data);
144 * Trigger fetch of service metadata
146 * @param sipe_private SIPE core private data
147 * @param uri service URI
148 * @param callback callback function
149 * @param callback_data callback data
150 * @return @c TRUE if metadata fetch was triggered
152 gboolean sipe_svc_metadata(struct sipe_core_private *sipe_private,
153 struct sipe_svc_session *session,
154 const gchar *uri,
155 sipe_svc_callback *callback,
156 gpointer callback_data);
159 * Free service data
161 * @param sipe_private SIPE core private data
163 void sipe_svc_free(struct sipe_core_private *sipe_private);