tls: refactor tls_server_hello()
[siplcs.git] / src / core / sipe-svc.h
blob0a3d81043165efb502f2ed61c9d04a28509f069e
1 /**
2 * @file sipe-svc.h
4 * pidgin-sipe
6 * Copyright (C) 2011 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_xml;
34 /**
35 * Service XML callback
37 * @param sipe_private SIPE core private data
38 * @param uri service URI (NULL when request aborted)
39 * @param raw raw XML data (NULL when request failed)
40 * @param xml parsed XML data (NULL when request failed)
41 * @param callback_data callback data
43 typedef void (sipe_svc_callback)(struct sipe_core_private *sipe_private,
44 const gchar *uri,
45 const gchar *raw,
46 struct _sipe_xml *xml,
47 gpointer callback_data);
49 /**
50 * Random bytes buffer
52 struct sipe_svc_random {
53 guchar *buffer;
54 guint length; /* in bytes */
57 /**
58 * Allocate a buffer with N random bits
60 * @param random pointer to random bytes buffer
61 * @param bits number of random bits (will be rounded up be dividable by 16)
63 void sipe_svc_fill_random(struct sipe_svc_random *random,
64 guint bits);
66 /**
67 * Free a random bytes buffer
69 * @param random pointer to random bytes buffer
71 void sipe_svc_free_random(struct sipe_svc_random *random);
73 /**
74 * Trigger fetch of Get & Publish certificate
76 * @param sipe_private SIPE core private data
77 * @param uri service URI
78 * @param wsse_security predefined authentication token
79 * @param certreq certificate request (Base64 encoded)
80 * @param callback callback function
81 * @param callback_data callback data
82 * @return @c TRUE if token fetch was triggered
84 gboolean sipe_svc_get_and_publish_cert(struct sipe_core_private *sipe_private,
85 const gchar *uri,
86 const gchar *authuser,
87 const gchar *wsse_security,
88 const gchar *certreq,
89 sipe_svc_callback *callback,
90 gpointer callback_data);
92 /**
93 * Trigger fetch of WebTicket security token
95 * @param sipe_private SIPE core private data
96 * @param uri service URI
97 * @param authuser user name for authentication
98 * @param wsse_security predefined authentication token
99 * @param service_uri request token for this service URI
100 * @param entropy random bytes buffer for entropy
101 * @param callback callback function
102 * @param callback_data callback data
103 * @return @c TRUE if token fetch was triggered
105 gboolean sipe_svc_webticket(struct sipe_core_private *sipe_private,
106 const gchar *uri,
107 const gchar *authuser,
108 const gchar *wsse_security,
109 const gchar *service_uri,
110 const struct sipe_svc_random *entropy,
111 sipe_svc_callback *callback,
112 gpointer callback_data);
115 * Trigger fetch of WebTicket security token from login.microsoftonline.com
117 * @param sipe_private SIPE core private data
118 * @param authuser user name for authentication
119 * @param service_uri request token for this service URI
120 * @param callback callback function
121 * @param callback_data callback data
122 * @return @c TRUE if token fetch was triggered
124 gboolean sipe_svc_webticket_lmc(struct sipe_core_private *sipe_private,
125 const gchar *authuser,
126 const gchar *service_uri,
127 sipe_svc_callback *callback,
128 gpointer callback_data);
131 * Trigger fetch of service metadata
133 * @param sipe_private SIPE core private data
134 * @param uri service URI
135 * @param callback callback function
136 * @param callback_data callback data
137 * @return @c TRUE if metadata fetch was triggered
139 gboolean sipe_svc_metadata(struct sipe_core_private *sipe_private,
140 const gchar *uri,
141 sipe_svc_callback *callback,
142 gpointer callback_data);
145 * Free service data
147 * @param sipe_private SIPE core private data
149 void sipe_svc_free(struct sipe_core_private *sipe_private);