account_creator.h 14 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
account_creator.h
Copyright (C) 2010-2015 Belledonne Communications SARL

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef LINPHONE_ACCOUNT_CREATOR_H_
#define LINPHONE_ACCOUNT_CREATOR_H_

23
#include "linphonecore.h"
24 25 26 27 28 29 30 31 32 33

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @addtogroup misc
 * @{
 */

34 35 36 37
/**
* Enum describing the status of a LinphoneAccountCreator operation.
**/
typedef enum _LinphoneAccountCreatorStatus {
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
	LinphoneAccountCreatorOK,
	LinphoneAccountCreatorReqFailed,

	LinphoneAccountCreatorAccountCreated,
	LinphoneAccountCreatorAccountNotCreated,

	LinphoneAccountCreatorAccountExist,
	LinphoneAccountCreatorAccountNotExist,

	LinphoneAccountCreatorAccountValidated,
	LinphoneAccountCreatorAccountNotValidated,

	LinphoneAccountCreatorEmailInvalid,
	LinphoneAccountCreatorUsernameInvalid,
	LinphoneAccountCreatorUsernameTooShort,
53
	LinphoneAccountCreatorUsernameTooLong,
54 55
	LinphoneAccountCreatorUsernameInvalidSize,
	LinphoneAccountCreatorPasswordTooShort,
56
	LinphoneAccountCreatorPasswordTooLong,
57 58 59 60
	LinphoneAccountCreatorDomainInvalid,
	LinphoneAccountCreatorRouteInvalid,
	LinphoneAccountCreatorDisplayNameInvalid,
	LinphoneAccountCreatorTransportNotSupported,
61
} LinphoneAccountCreatorStatus;
62

63 64 65
/**
 * The LinphoneAccountCreator object used to create an account on a server via XML-RPC.
**/
66 67
typedef struct _LinphoneAccountCreator LinphoneAccountCreator;

68
/**
69 70 71 72 73 74 75 76 77 78 79 80 81
 * An object to handle the callbacks for handling the LinphoneAccountCreator operations.
**/
typedef struct _LinphoneAccountCreatorCbs LinphoneAccountCreatorCbs;

/**
 * Callback used to notify the end of a LinphoneAccountCreator test existence operation.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] status The status of the LinphoneAccountCreator test existence operation that has just finished
**/
typedef void (*LinphoneAccountCreatorCbsExistenceTestedCb)(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status);

/**
 * Callback used to notify the end of a LinphoneAccountCreator test validation operation.
82
 * @param[in] creator LinphoneAccountCreator object
83
 * @param[in] status The status of the LinphoneAccountCreator test validation operation that has just finished
84
**/
85 86 87 88 89 90 91
typedef void (*LinphoneAccountCreatorCbsValidationTestedCb)(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status);

/**
 * Callback used to notify the end of a LinphoneAccountCreator validate operation.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] status The status of the LinphoneAccountCreator validate operation that has just finished
**/
92
typedef void (*LinphoneAccountCreatorCbsCreateAccountCb)(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status);
93

94 95 96
/**
 * Create a LinphoneAccountCreator.
 * @param[in] core The LinphoneCore used for the XML-RPC communication
97
 * @param[in] xmlrpc_url The URL to the XML-RPC server. Must be NON NULL.
98 99
 * @return The new LinphoneAccountCreator object
**/
100
LINPHONE_PUBLIC LinphoneAccountCreator * linphone_account_creator_new(LinphoneCore *core, const char *xmlrpc_url);
101 102

/**
103 104 105 106 107 108 109 110 111
 * Acquire a reference to the LinphoneAccountCreator.
 * @param[in] creator LinphoneAccountCreator object.
 * @return The same LinphoneAccountCreator object.
**/
LINPHONE_PUBLIC LinphoneAccountCreator * linphone_account_creator_ref(LinphoneAccountCreator *creator);

/**
 * Release reference to the LinphoneAccountCreator.
 * @param[in] creator LinphoneAccountCreator object.
112
**/
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
LINPHONE_PUBLIC void linphone_account_creator_unref(LinphoneAccountCreator *creator);

/**
 * Retrieve the user pointer associated with the LinphoneAccountCreator.
 * @param[in] creator LinphoneAccountCreator object.
 * @return The user pointer associated with the LinphoneAccountCreator.
**/
LINPHONE_PUBLIC void *linphone_account_creator_get_user_data(const LinphoneAccountCreator *creator);

/**
 * Assign a user pointer to the LinphoneAccountCreator.
 * @param[in] creator LinphoneAccountCreator object.
 * @param[in] ud The user pointer to associate with the LinphoneAccountCreator.
**/
LINPHONE_PUBLIC void linphone_account_creator_set_user_data(LinphoneAccountCreator *creator, void *ud);
128

129 130 131 132
/**
 * Set the username.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] username The username to set
133
 * @return LinphoneAccountCreatorOk if everything is OK, or a specific error otherwise.
134
**/
135
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_username(LinphoneAccountCreator *creator, const char *username);
136 137 138 139 140 141

/**
 * Get the username.
 * @param[in] creator LinphoneAccountCreator object
 * @return The username of the LinphoneAccountCreator
**/
142
LINPHONE_PUBLIC const char * linphone_account_creator_get_username(const LinphoneAccountCreator *creator);
143 144 145 146 147

/**
 * Set the password.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] password The password to set
148
 * @return LinphoneAccountCreatorOk if everything is OK, or a specific error otherwise.
149
**/
150
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_password(LinphoneAccountCreator *creator, const char *password);
151 152 153 154 155 156

/**
 * Get the password.
 * @param[in] creator LinphoneAccountCreator object
 * @return The password of the LinphoneAccountCreator
**/
157
LINPHONE_PUBLIC const char * linphone_account_creator_get_password(const LinphoneAccountCreator *creator);
158

159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
/**
 * Set the transport.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] transport The transport to set
 * @return LinphoneAccountCreatorOk if everything is OK, or a specific error if given transport is not supported by linphone core.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_transport(LinphoneAccountCreator *creator, LinphoneTransportType transport);

/**
 * Get the transport.
 * @param[in] creator LinphoneAccountCreator object
 * @return The transport of the LinphoneAccountCreator
**/
LINPHONE_PUBLIC LinphoneTransportType linphone_account_creator_get_transport(const LinphoneAccountCreator *creator);

174 175 176 177
/**
 * Set the domain.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] domain The domain to set
178
 * @return LinphoneAccountCreatorOk if everything is OK, or a specific error otherwise.
179
**/
180
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_domain(LinphoneAccountCreator *creator, const char *domain);
181 182 183 184 185 186

/**
 * Get the domain.
 * @param[in] creator LinphoneAccountCreator object
 * @return The domain of the LinphoneAccountCreator
**/
187
LINPHONE_PUBLIC const char * linphone_account_creator_get_domain(const LinphoneAccountCreator *creator);
188 189 190 191 192

/**
 * Set the route.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] route The route to set
193
 * @return LinphoneAccountCreatorOk if everything is OK, or a specific error otherwise.
194
**/
195
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_route(LinphoneAccountCreator *creator, const char *route);
196 197 198 199 200 201

/**
 * Get the route.
 * @param[in] creator LinphoneAccountCreator object
 * @return The route of the LinphoneAccountCreator
**/
202
LINPHONE_PUBLIC const char * linphone_account_creator_get_route(const LinphoneAccountCreator *creator);
203

204 205 206 207
/**
 * Set the email.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] display_name The display name to set
208
 * @return LinphoneAccountCreatorOk if everything is OK, or a specific error otherwise.
209
**/
210
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_display_name(LinphoneAccountCreator *creator, const char *display_name);
211 212 213 214 215 216 217 218

/**
 * Get the email.
 * @param[in] creator LinphoneAccountCreator object
 * @return The display name of the LinphoneAccountCreator
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_display_name(const LinphoneAccountCreator *creator);

219 220 221 222
/**
 * Set the email.
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] email The email to set
223
 * @return LinphoneAccountCreatorOk if everything is OK, or a specific error otherwise.
224
**/
225
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_set_email(LinphoneAccountCreator *creator, const char *email);
226 227 228 229 230 231

/**
 * Get the email.
 * @param[in] creator LinphoneAccountCreator object
 * @return The email of the LinphoneAccountCreator
**/
232 233
LINPHONE_PUBLIC const char * linphone_account_creator_get_email(const LinphoneAccountCreator *creator);

234
/**
235
 * Enable the newsletter subscription.
236 237 238
 * @param[in] creator LinphoneAccountCreator object
 * @param[in] subscribe A boolean telling whether to subscribe to the newsletter or not.
**/
239
LINPHONE_PUBLIC void linphone_account_creator_enable_newsletter_subscription(LinphoneAccountCreator *creator, bool_t subscribe);
240 241

/**
242
 * Tell whether to subscribe to the newsletter or not.
243 244 245
 * @param[in] creator LinphoneAccountCreator object
 * @return A boolean telling whether to subscribe to the newsletter or not.
**/
246
LINPHONE_PUBLIC bool_t linphone_account_creator_newsletter_subscription_enabled(const LinphoneAccountCreator *creator);
247 248

/**
249
 * Get the LinphoneAccountCreatorCbs object associated with a LinphoneAccountCreator.
250
 * @param[in] creator LinphoneAccountCreator object
251
 * @return The LinphoneAccountCreatorCbs object associated with the LinphoneAccountCreator.
252
**/
253
LINPHONE_PUBLIC LinphoneAccountCreatorCbs * linphone_account_creator_get_callbacks(const LinphoneAccountCreator *creator);
254

255 256 257
/**
 * Send an XML-RPC request to test the existence of a Linphone account.
 * @param[in] creator LinphoneAccountCreator object
258
 * @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorReqFailed otherwise
259
**/
260
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_test_existence(LinphoneAccountCreator *creator);
261 262 263 264

/**
 * Send an XML-RPC request to test the validation of a Linphone account.
 * @param[in] creator LinphoneAccountCreator object
265
 * @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorReqFailed otherwise
266
**/
267
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_test_validation(LinphoneAccountCreator *creator);
268 269 270 271

/**
 * Send an XML-RPC request to create a Linphone account.
 * @param[in] creator LinphoneAccountCreator object
272
 * @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorReqFailed otherwise
273
**/
274
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_create_account(LinphoneAccountCreator *creator);
275

276 277 278 279 280 281 282
/**
 * Configure an account (create a proxy config and authentication info for it).
 * @param[in] creator LinphoneAccountCreator object
 * @return A LinphoneProxyConfig object if successful, NULL otherwise
**/
LINPHONE_PUBLIC LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCreator *creator);

283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339

/**
 * Acquire a reference to a LinphoneAccountCreatorCbs object.
 * @param[in] cbs LinphoneAccountCreatorCbs object.
 * @return The same LinphoneAccountCreatorCbs object.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorCbs * linphone_account_creator_cbs_ref(LinphoneAccountCreatorCbs *cbs);

/**
 * Release a reference to a LinphoneAccountCreatorCbs object.
 * @param[in] cbs LinphoneAccountCreatorCbs object.
**/
LINPHONE_PUBLIC void linphone_account_creator_cbs_unref(LinphoneAccountCreatorCbs *cbs);

/**
 * Retrieve the user pointer associated with a LinphoneAccountCreatorCbs object.
 * @param[in] cbs LinphoneAccountCreatorCbs object.
 * @return The user pointer associated with the LinphoneAccountCreatorCbs object.
**/
LINPHONE_PUBLIC void *linphone_account_creator_cbs_get_user_data(const LinphoneAccountCreatorCbs *cbs);

/**
 * Assign a user pointer to a LinphoneAccountCreatorCbs object.
 * @param[in] cbs LinphoneAccountCreatorCbs object.
 * @param[in] ud The user pointer to associate with the LinphoneAccountCreatorCbs object.
**/
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_user_data(LinphoneAccountCreatorCbs *cbs, void *ud);

/**
 * Get the existence tested callback.
 * @param[in] cbs LinphoneAccountCreatorCbs object.
 * @return The current existence tested callback.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorCbsExistenceTestedCb linphone_account_creator_cbs_get_existence_tested(const LinphoneAccountCreatorCbs *cbs);

/**
 * Set the existence tested callback.
 * @param[in] cbs LinphoneAccountCreatorCbs object.
 * @param[in] cb The existence tested callback to be used.
**/
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_existence_tested(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsExistenceTestedCb cb);

/**
 * Get the validation tested callback.
 * @param[in] cbs LinphoneAccountCreatorCbs object.
 * @return The current validation tested callback.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorCbsValidationTestedCb linphone_account_creator_cbs_get_validation_tested(const LinphoneAccountCreatorCbs *cbs);

/**
 * Set the validation tested callback.
 * @param[in] cbs LinphoneAccountCreatorCbs object.
 * @param[in] cb The validation tested callback to be used.
**/
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_validation_tested(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsValidationTestedCb cb);

/**
340
 * Get the create account callback.
341
 * @param[in] cbs LinphoneAccountCreatorCbs object.
342
 * @return The current create account callback.
343
**/
344
LINPHONE_PUBLIC LinphoneAccountCreatorCbsCreateAccountCb linphone_account_creator_cbs_get_create_account(const LinphoneAccountCreatorCbs *cbs);
345 346

/**
347
 * Set the create account callback.
348
 * @param[in] cbs LinphoneAccountCreatorCbs object.
349
 * @param[in] cb The create account callback to be used.
350
**/
351
LINPHONE_PUBLIC void linphone_account_creator_cbs_set_create_account(LinphoneAccountCreatorCbs *cbs, LinphoneAccountCreatorCbsCreateAccountCb cb);
352

353 354 355 356 357 358 359 360 361 362
/**
 * @}
 */


#ifdef __cplusplus
}
#endif

#endif /* LINPHONE_ACCOUNT_CREATOR_H_ */