core.h 190 KB
Newer Older
aymeric's avatar
aymeric committed
1 2
/*
linphone
3
Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org)
aymeric's avatar
aymeric committed
4 5 6 7 8 9 10 11 12 13 14 15 16

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
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
aymeric's avatar
aymeric committed
18 19 20 21 22 23 24
*/
#ifndef LINPHONECORE_H
#define LINPHONECORE_H

#include "ortp/ortp.h"
#include "ortp/payloadtype.h"
#include "mediastreamer2/mscommon.h"
smorlat's avatar
smorlat committed
25
#include "mediastreamer2/msvideo.h"
Sylvain Berfini's avatar
Sylvain Berfini committed
26
#include "mediastreamer2/mediastream.h"
27
#include "mediastreamer2/bitratecontrol.h"
28
#include "linphone/sipsetup.h"
29
#include "linphone/lpconfig.h"
Ghislain MARY's avatar
Ghislain MARY committed
30

smorlat's avatar
smorlat committed
31
#define LINPHONE_IPADDR_SIZE 64
smorlat's avatar
smorlat committed
32
#define LINPHONE_HOSTNAME_SIZE 128
smorlat's avatar
smorlat committed
33

jehan's avatar
jehan committed
34
#ifndef LINPHONE_PUBLIC
Simon Morlat's avatar
Simon Morlat committed
35
#define LINPHONE_PUBLIC MS2_PUBLIC
Sylvain Berfini's avatar
Sylvain Berfini committed
36 37
#endif

38
#ifndef LINPHONE_DEPRECATED
Simon Morlat's avatar
Simon Morlat committed
39
#define LINPHONE_DEPRECATED MS2_DEPRECATED
40
#endif
jehan's avatar
jehan committed
41 42


aymeric's avatar
aymeric committed
43 44 45 46 47
#ifdef __cplusplus
extern "C" {
#endif

struct _LinphoneCore;
48
struct _LinphoneChatRoom;
49 50 51
struct _LinphoneAuthInfo;
struct _SipSetupContext;
struct _LinphoneInfoMessage;
52

jehan's avatar
jehan committed
53 54 55 56 57
/**
 * Linphone core main object created by function linphone_core_new() .
 * @ingroup initializing
 */
typedef struct _LinphoneCore LinphoneCore;
aymeric's avatar
aymeric committed
58

59 60 61 62 63
/**
 * Safely down-cast a belle_sip_object_t into LinphoneCore
 * @ingroup initializing
 */
#define LINPHONE_CORE(object) BELLE_SIP_CAST(object, LinphoneCore)
64

65 66
/**
 * Disable a sip transport
67
 * Use with #LinphoneSipTransports
68 69 70 71 72
 * @ingroup initializing
 */
#define LC_SIP_TRANSPORT_DISABLED 0
/**
 * Randomly chose a sip port for this transport
73
 * Use with #LinphoneSipTransports
74 75
 * @ingroup initializing
 */
Simon Morlat's avatar
Simon Morlat committed
76 77 78 79
#define LC_SIP_TRANSPORT_RANDOM (-1)

/**
 * Don't create any server socket for this transport, ie don't bind on any port.
80
 * Use with #LinphoneSipTransports
Simon Morlat's avatar
Simon Morlat committed
81 82 83
 * @ingroup initializing
**/
#define LC_SIP_TRANSPORT_DONTBIND (-2)
84

jehan's avatar
jehan committed
85 86
/**
 * Linphone core SIP transport ports.
87
 * Special values #LC_SIP_TRANSPORT_RANDOM, #LC_SIP_TRANSPORT_RANDOM, #LC_SIP_TRANSPORT_DONTBIND can be used.
jehan's avatar
jehan committed
88 89 90
 * Use with #linphone_core_set_sip_transports
 * @ingroup initializing
 */
91
typedef struct _LinphoneSipTransports{
jehan's avatar
jehan committed
92
	/**
Simon Morlat's avatar
Simon Morlat committed
93 94
	 * SIP/UDP port.
	 **/
95
	int udp_port;
jehan's avatar
jehan committed
96
	/**
Simon Morlat's avatar
Simon Morlat committed
97
	 * SIP/TCP port
jehan's avatar
jehan committed
98
	 * */
99
	int tcp_port;
jehan's avatar
jehan committed
100
	/**
Simon Morlat's avatar
Simon Morlat committed
101
	 * SIP/DTLS port
jehan's avatar
jehan committed
102
	 * */
103
	int dtls_port;
jehan's avatar
jehan committed
104
	/**
Simon Morlat's avatar
Simon Morlat committed
105
	 * SIP/TLS port
jehan's avatar
jehan committed
106
	 * */
107
	int tls_port;
108 109
} LinphoneSipTransports;

110 111 112
/**
 * Old name of LinphoneSipTransports
 */
113
typedef struct _LinphoneSipTransports LCSipTransports;
jehan's avatar
jehan committed
114

115

116 117
/**
 * Enum describing transport type for LinphoneAddress.
118
 * @ingroup linphone_address
119 120 121 122 123 124 125 126 127
**/
enum _LinphoneTransportType{
	LinphoneTransportUdp,
	LinphoneTransportTcp,
	LinphoneTransportTls,
	LinphoneTransportDtls
};
/*this enum MUST be kept in sync with the SalTransport from sal.h*/

128 129 130 131
/**
 * Typedef for transport type enum.
 * @ingroup linphone_address
**/
132 133
typedef enum _LinphoneTransportType LinphoneTransportType;

134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
/**
 * Enum describing the stream types.
 * @ingroup initializing
**/
enum _LinphoneStreamType {
	LinphoneStreamTypeAudio,
	LinphoneStreamTypeVideo,
	LinphoneStreamTypeText,
	LinphoneStreamTypeUnknown /* WARNING: Make sure this value remains the last one in the list */
};

/**
 * Enum describing the stream types.
 * @ingroup initializing
**/
typedef enum _LinphoneStreamType LinphoneStreamType;
150

151
/**
152
 * Function returning a human readable value for LinphoneStreamType.
153 154
 * @ingroup initializing
 **/
155

156
LINPHONE_PUBLIC const char *linphone_stream_type_to_string(const LinphoneStreamType);
157

Ghislain MARY's avatar
Ghislain MARY committed
158
#include "linphone/dictionary.h"
159
#include "linphone/error_info.h"
160

161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
/**
 * Enum describing the authentication methods
 * @ingroup network_parameters
**/
enum _LinphoneAuthMethod {
	LinphoneAuthHttpDigest, /* Digest authentication requested */
	LinphoneAuthTls, /* Client certificate requested */
};

/**
 * Typedef for authentication methods enum.
 * @ingroup network_parameters
**/
typedef enum _LinphoneAuthMethod LinphoneAuthMethod;

176

177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
/**
 * @addtogroup media_parameters
 * @{
**/

/**
 * Object representing an RTP payload type.
 */
typedef PayloadType LinphonePayloadType;

/**
 * Get the type of payload.
 * @param[in] pt LinphonePayloadType object
 * @return The type of payload.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_type(const LinphonePayloadType *pt);

/**
 * Get the normal bitrate in bits/s.
 * @param[in] pt LinphonePayloadType object
 * @return The normal bitrate in bits/s.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_normal_bitrate(const LinphonePayloadType *pt);

/**
 * Get the mime type.
 * @param[in] pt LinphonePayloadType object
 * @return The mime type.
 */
206
LINPHONE_PUBLIC const char * linphone_payload_type_get_mime_type(const LinphonePayloadType *pt);
207 208 209 210 211 212 213 214

/**
 * Get the number of channels.
 * @param[in] pt LinphonePayloadType object
 * @return The number of channels.
 */
LINPHONE_PUBLIC int linphone_payload_type_get_channels(const LinphonePayloadType *pt);

215

216 217 218 219 220 221 222 223 224 225 226 227 228 229
/**
 * Enum describing RTP AVPF activation modes.
**/
enum _LinphoneAVPFMode{
	LinphoneAVPFDefault=-1, /**<Use default value defined at upper level*/
	LinphoneAVPFDisabled, /**<AVPF is disabled*/
	LinphoneAVPFEnabled /**<AVPF is enabled */
};

/**
 * Enum describing RTP AVPF activation modes.
**/
typedef enum _LinphoneAVPFMode  LinphoneAVPFMode;

230 231 232 233 234 235
/**
 * Enum describing type of media encryption types.
**/
enum _LinphoneMediaEncryption {
	LinphoneMediaEncryptionNone, /**< No media encryption is used */
	LinphoneMediaEncryptionSRTP, /**< Use SRTP media encryption */
johan's avatar
johan committed
236 237
	LinphoneMediaEncryptionZRTP, /**< Use ZRTP media encryption */
	LinphoneMediaEncryptionDTLS /**< Use DTLS media encryption */
238 239 240 241 242 243 244 245 246 247 248 249
};

/**
 * Enum describing type of media encryption types.
**/
typedef enum _LinphoneMediaEncryption LinphoneMediaEncryption;

/**
 * Convert enum member to string.
**/
LINPHONE_PUBLIC const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc);

250 251 252 253
/**
 * @}
**/

254

Simon Morlat's avatar
Simon Morlat committed
255 256 257
/*
 * Note for developers: this enum must be kept synchronized with the SalPrivacy enum declared in sal.h
 */
Simon Morlat's avatar
Simon Morlat committed
258
/**
jehan's avatar
jehan committed
259
 * @ingroup call_control
jehan's avatar
jehan committed
260
 * Defines privacy policy to apply as described by rfc3323
Simon Morlat's avatar
Simon Morlat committed
261
**/
jehan's avatar
jehan committed
262 263
typedef enum _LinphonePrivacy {
	/**
Simon Morlat's avatar
Simon Morlat committed
264
	 * Privacy services must not perform any privacy function
jehan's avatar
jehan committed
265
	 */
Simon Morlat's avatar
Simon Morlat committed
266
	LinphonePrivacyNone=0x0,
jehan's avatar
jehan committed
267
	/**
jehan's avatar
jehan committed
268
	 * Request that privacy services provide a user-level privacy
Simon Morlat's avatar
Simon Morlat committed
269 270
	 * function.
	 * With this mode, "from" header is hidden, usually replaced by  From: "Anonymous" <sip:anonymous@anonymous.invalid>
jehan's avatar
jehan committed
271
	 */
jehan's avatar
jehan committed
272
	LinphonePrivacyUser=0x1,
jehan's avatar
jehan committed
273
	/**
jehan's avatar
jehan committed
274
	 * Request that privacy services modify headers that cannot
Simon Morlat's avatar
Simon Morlat committed
275
	 * be set arbitrarily by the user (Contact/Via).
jehan's avatar
jehan committed
276
	 */
jehan's avatar
jehan committed
277
	LinphonePrivacyHeader=0x2,
Simon Morlat's avatar
Simon Morlat committed
278
	/**
jehan's avatar
jehan committed
279
	 *  Request that privacy services provide privacy for session
Simon Morlat's avatar
Simon Morlat committed
280 281
	 * media
	 */
jehan's avatar
jehan committed
282 283 284 285
	LinphonePrivacySession=0x4,
	/**
	 * rfc3325
	 * The presence of this privacy type in
Simon Morlat's avatar
Simon Morlat committed
286 287 288 289 290
	 * a Privacy header field indicates that the user would like the Network
	 * Asserted Identity to be kept private with respect to SIP entities
	 * outside the Trust Domain with which the user authenticated.  Note
	 * that a user requesting multiple types of privacy MUST include all of
	 * the requested privacy types in its Privacy header field value
jehan's avatar
jehan committed
291 292 293 294 295
	 *
	 */
	LinphonePrivacyId=0x8,
	/**
	 * Privacy service must perform the specified services or
Simon Morlat's avatar
Simon Morlat committed
296
	 * fail the request
jehan's avatar
jehan committed
297 298
	 *
	 **/
Simon Morlat's avatar
Simon Morlat committed
299
	LinphonePrivacyCritical=0x10,
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
300

Simon Morlat's avatar
Simon Morlat committed
301
	/**
Simon Morlat's avatar
Simon Morlat committed
302
	 * Special keyword to use privacy as defined either globally or by proxy using linphone_proxy_config_set_privacy()
Simon Morlat's avatar
Simon Morlat committed
303 304
	 */
	LinphonePrivacyDefault=0x8000,
jehan's avatar
jehan committed
305
} LinphonePrivacy;
jehan's avatar
jehan committed
306 307 308 309 310
/*
 * a mask  of #LinphonePrivacy values
 * */
typedef unsigned int LinphonePrivacyMask;

Simon Morlat's avatar
Simon Morlat committed
311 312

LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
Ghislain MARY's avatar
Ghislain MARY committed
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 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
/**
 * Player interface.
 * @ingroup call_control
**/
typedef struct _LinphonePlayer LinphonePlayer;

/**
 * Callback for notifying end of play (file).
 * @param obj the LinphonePlayer
 * @param user_data the user_data provided when calling linphone_player_open().
 * @ingroup call_control
**/
typedef void (*LinphonePlayerEofCallback)(struct _LinphonePlayer *obj, void *user_data);

LINPHONE_PUBLIC int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data);
LINPHONE_PUBLIC int linphone_player_start(LinphonePlayer *obj);
LINPHONE_PUBLIC int linphone_player_pause(LinphonePlayer *obj);
LINPHONE_PUBLIC int linphone_player_seek(LinphonePlayer *obj, int time_ms);
LINPHONE_PUBLIC MSPlayerState linphone_player_get_state(LinphonePlayer *obj);
LINPHONE_PUBLIC int linphone_player_get_duration(LinphonePlayer *obj);
LINPHONE_PUBLIC int linphone_player_get_current_position(LinphonePlayer *obj);
LINPHONE_PUBLIC void linphone_player_close(LinphonePlayer *obj);
LINPHONE_PUBLIC void linphone_player_destroy(LinphonePlayer *obj);

/**
 * Create an independent media file player.
 * This player support WAVE and MATROSKA formats.
 * @param lc A LinphoneCore object
 * @param snd_card Playback sound card. If NULL, the sound card set in LinphoneCore will be used
 * @param video_out Video display. If NULL, the video display set in LinphoneCore will be used
 * @param window_id Id of the drawing window. Depend of video out
 * @return A pointer on the new instance. NULL if faild.
 */
LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id);

/**
 * Check whether Matroksa format is supported by the player
 * @return TRUE if it is supported
 */
LINPHONE_PUBLIC bool_t linphone_local_player_matroska_supported(void);


357
#include "linphone/address.h"
358
#include "linphone/buffer.h"
359
#include "linphone/call.h"
Ghislain MARY's avatar
Ghislain MARY committed
360 361
#include "linphone/call_log.h"
#include "linphone/call_params.h"
362 363
#include "linphone/content.h"
#include "linphone/event.h"
364
#include "linphone/im_notif_policy.h"
365
#include "linphone/linphonefriend.h"
366
#include "linphone/nat_policy.h"
367
#include "linphone/xmlrpc.h"
368
#include "linphone/conference.h"
Ghislain MARY's avatar
Ghislain MARY committed
369 370 371 372 373 374 375 376 377 378

/**
 * Create a #LinphoneAddress object by parsing the user supplied address, given as a string.
 * @param[in] lc #LinphoneCore object
 * @param[in] address String containing the user supplied address
 * @return The create #LinphoneAddress object
 * @ingroup linphone_address
 */
LINPHONE_PUBLIC LinphoneAddress * linphone_core_create_address(LinphoneCore *lc, const char *address);

Ghislain MARY's avatar
Ghislain MARY committed
379 380 381 382 383
/**
 * @addtogroup misc
 * @{
 */

Simon Morlat's avatar
Simon Morlat committed
384 385 386 387 388
/**
 * The LinphoneInfoMessage is an object representing an informational message sent or received by the core.
**/
typedef struct _LinphoneInfoMessage LinphoneInfoMessage;

389 390 391 392 393 394 395 396
/**
 * Creates an empty info message.
 * @param lc the LinphoneCore
 * @return a new LinphoneInfoMessage.
 *
 * The info message can later be filled with information using linphone_info_message_add_header() or linphone_info_message_set_content(),
 * and finally sent with linphone_core_send_info_message().
**/
397
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_core_create_info_message(LinphoneCore*lc);
398 399 400 401 402 403

/**
 * Send a LinphoneInfoMessage through an established call
 * @param call the call
 * @param info the info message
**/
Ghislain MARY's avatar
Ghislain MARY committed
404
LINPHONE_PUBLIC int linphone_call_send_info_message(LinphoneCall *call, const LinphoneInfoMessage *info);
405 406 407 408 409 410 411

/**
 * Add a header to an info message to be sent.
 * @param im the info message
 * @param name the header'name
 * @param value the header's value
**/
Simon Morlat's avatar
Simon Morlat committed
412
LINPHONE_PUBLIC void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value);
413 414 415 416 417 418 419

/**
 * Obtain a header value from a received info message.
 * @param im the info message
 * @param name the header'name
 * @return the corresponding header's value, or NULL if not exists.
**/
Simon Morlat's avatar
Simon Morlat committed
420
LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, const char *name);
421 422 423 424 425 426 427

/**
 * Assign a content to the info message.
 * @param im the linphone info message
 * @param content the content described as a #LinphoneContent structure.
 * All fields of the LinphoneContent are copied, thus the application can destroy/modify/recycloe the content object freely ater the function returns.
**/
Simon Morlat's avatar
Simon Morlat committed
428
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im,  const LinphoneContent *content);
429 430 431 432

/**
 * Returns the info message's content as a #LinphoneContent structure.
**/
Simon Morlat's avatar
Simon Morlat committed
433
LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im);
434 435 436 437

/**
 * Destroy a LinphoneInfoMessage
**/
Simon Morlat's avatar
Simon Morlat committed
438
LINPHONE_PUBLIC void linphone_info_message_destroy(LinphoneInfoMessage *im);
439
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_info_message_copy(const LinphoneInfoMessage *orig);
Simon Morlat's avatar
Simon Morlat committed
440

Ghislain MARY's avatar
Ghislain MARY committed
441 442 443
/**
 * @}
 */
Simon Morlat's avatar
Simon Morlat committed
444 445


446 447
/**
 * Structure describing policy regarding video streams establishments.
Simon Morlat's avatar
Simon Morlat committed
448
 * @ingroup media_parameters
449 450
**/
struct _LinphoneVideoPolicy{
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
451
	bool_t automatically_initiate; /**<Whether video shall be automatically proposed for outgoing calls.*/
452 453 454 455
	bool_t automatically_accept; /**<Whether video shall be automatically accepted for incoming calls*/
	bool_t unused[2];
};

Simon Morlat's avatar
Simon Morlat committed
456 457 458 459
/**
 * Structure describing policy regarding video streams establishments.
 * @ingroup media_parameters
**/
460 461
typedef struct _LinphoneVideoPolicy LinphoneVideoPolicy;

462

Yann Diorcet's avatar
Yann Diorcet committed
463 464


Simon Morlat's avatar
Simon Morlat committed
465 466 467 468 469
/**
 * @addtogroup call_misc
 * @{
**/

470 471 472
#define LINPHONE_CALL_STATS_AUDIO ((int)LinphoneStreamTypeAudio)
#define LINPHONE_CALL_STATS_VIDEO ((int)LinphoneStreamTypeVideo)
#define LINPHONE_CALL_STATS_TEXT  ((int)LinphoneStreamTypeText)
Yann Diorcet's avatar
Yann Diorcet committed
473

474 475 476 477 478
/**
 * Enum describing ICE states.
 * @ingroup initializing
**/
enum _LinphoneIceState{
Simon Morlat's avatar
Simon Morlat committed
479
	LinphoneIceStateNotActivated, /**< ICE has not been activated for this call or stream*/
Ghislain MARY's avatar
Ghislain MARY committed
480
	LinphoneIceStateFailed, /**< ICE processing has failed */
481 482 483 484 485 486 487 488 489 490 491 492
	LinphoneIceStateInProgress, /**< ICE process is in progress */
	LinphoneIceStateHostConnection, /**< ICE has established a direct connection to the remote host */
	LinphoneIceStateReflexiveConnection, /**< ICE has established a connection to the remote host through one or several NATs */
	LinphoneIceStateRelayConnection /**< ICE has established a connection through a relay */
};

/**
 * Enum describing Ice states.
 * @ingroup initializing
**/
typedef enum _LinphoneIceState LinphoneIceState;

493 494
LINPHONE_PUBLIC const char *linphone_ice_state_to_string(LinphoneIceState state);

Yann Diorcet's avatar
Yann Diorcet committed
495 496 497 498 499 500 501 502 503 504 505 506
/**
 * Enum describing uPnP states.
 * @ingroup initializing
**/
enum _LinphoneUpnpState{
	LinphoneUpnpStateIdle, /**< uPnP is not activate */
	LinphoneUpnpStatePending, /**< uPnP process is in progress */
	LinphoneUpnpStateAdding,   /**< Internal use: Only used by port binding */
	LinphoneUpnpStateRemoving, /**< Internal use: Only used by port binding */
	LinphoneUpnpStateNotAvailable,  /**< uPnP is not available */
	LinphoneUpnpStateOk, /**< uPnP is enabled */
	LinphoneUpnpStateKo, /**< uPnP processing has failed */
Yann Diorcet's avatar
Yann Diorcet committed
507
	LinphoneUpnpStateBlacklisted, /**< IGD router is blacklisted */
Yann Diorcet's avatar
Yann Diorcet committed
508 509 510 511 512 513 514 515
};

/**
 * Enum describing uPnP states.
 * @ingroup initializing
**/
typedef enum _LinphoneUpnpState LinphoneUpnpState;

516

517 518 519 520
/**
 * Enum describing Ip family.
 * @ingroup initializing
**/
Erwan Croze's avatar
Erwan Croze committed
521 522 523 524
enum _LinphoneAddressFamily {
	LinphoneAddressFamilyInet, /* IpV4 */
	LinphoneAddressFamilyInet6, /* IpV6 */
	LinphoneAddressFamilyUnspec, /* Unknown */
525 526 527 528 529 530
};

/**
 * Enum describing Ip family.
 * @ingroup initializing
**/
Erwan Croze's avatar
Erwan Croze committed
531
typedef enum _LinphoneAddressFamily LinphoneAddressFamily;
532

Simon Morlat's avatar
Simon Morlat committed
533 534 535
/**
 * @}
**/
Yann Diorcet's avatar
Yann Diorcet committed
536

537 538
#include "linphone/call_stats.h"

Sylvain Berfini's avatar
Sylvain Berfini committed
539 540
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
541
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_text_stats(LinphoneCall *call);
Yann Diorcet's avatar
Yann Diorcet committed
542

543 544 545 546 547 548
/**
 * Get the remote address of the current call.
 * @param[in] lc LinphoneCore object.
 * @return The remote address of the current call or NULL if there is no current call.
 * @ingroup call_control
 */
549
LINPHONE_PUBLIC const LinphoneAddress * linphone_core_get_current_call_remote_address(LinphoneCore *lc);
550

551

Simon Morlat's avatar
Simon Morlat committed
552
/*keep this in sync with mediastreamer2/msvolume.h*/
Simon Morlat's avatar
Simon Morlat committed
553 554 555 556 557 558

/**
 * Lowest volume measurement that can be returned by linphone_call_get_play_volume() or linphone_call_get_record_volume(), corresponding to pure silence.
 * @ingroup call_misc
**/
#define LINPHONE_VOLUME_DB_LOWEST (-120)
Simon Morlat's avatar
Simon Morlat committed
559

smorlat's avatar
smorlat committed
560 561 562 563
/**
 * @addtogroup proxies
 * @{
**/
564

smorlat's avatar
smorlat committed
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
/**
 * The LinphoneProxyConfig object represents a proxy configuration to be used
 * by the LinphoneCore object.
 * Its fields must not be used directly in favour of the accessors methods.
 * Once created and filled properly the LinphoneProxyConfig can be given to
 * LinphoneCore with linphone_core_add_proxy_config().
 * This will automatically triggers the registration, if enabled.
 *
 * The proxy configuration are persistent to restarts because they are saved
 * in the configuration file. As a consequence, after linphone_core_new() there
 * might already be a list of configured proxy that can be examined with
 * linphone_core_get_proxy_config_list().
 *
 * The default proxy (see linphone_core_set_default_proxy() ) is the one of the list
 * that is used by default for calls.
**/
581
typedef struct _LinphoneProxyConfig LinphoneProxyConfig;
aymeric's avatar
aymeric committed
582

583 584 585 586
/**
 * LinphoneRegistrationState describes proxy registration states.
**/
typedef enum _LinphoneRegistrationState{
Simon Morlat's avatar
Simon Morlat committed
587 588 589 590 591
	LinphoneRegistrationNone, /**<Initial state for registrations */
	LinphoneRegistrationProgress, /**<Registration is in progress */
	LinphoneRegistrationOk,	/**< Registration is successful */
	LinphoneRegistrationCleared, /**< Unregistration succeeded */
	LinphoneRegistrationFailed	/**<Registration failed */
592 593
}LinphoneRegistrationState;

594

jehan's avatar
jehan committed
595 596 597 598
/**
 * Human readable version of the #LinphoneRegistrationState
 * @param cs sate
 */
599
LINPHONE_PUBLIC const char *linphone_registration_state_to_string(LinphoneRegistrationState cs);
600

601 602 603 604
/**
 * @}
 */

605
#include "linphone/account_creator.h"
Ghislain MARY's avatar
Ghislain MARY committed
606
#include "linphone/auth_info.h"
607
#include "linphone/friendlist.h"
608
#include "linphone/linphone_proxy_config.h"
Ghislain MARY's avatar
Ghislain MARY committed
609
#include "linphone/chat.h"
Simon Morlat's avatar
Simon Morlat committed
610 611 612 613 614 615 616 617 618 619 620


/**
 * @addtogroup initializing
 * @{
**/

/**
 * LinphoneGlobalState describes the global state of the LinphoneCore object.
 * It is notified via the LinphoneCoreVTable::global_state_changed
**/
621 622 623 624
typedef enum _LinphoneGlobalState{
	LinphoneGlobalOff,
	LinphoneGlobalStartup,
	LinphoneGlobalOn,
625 626
	LinphoneGlobalShutdown,
	LinphoneGlobalConfiguring
627 628
}LinphoneGlobalState;

629
LINPHONE_PUBLIC const char *linphone_global_state_to_string(LinphoneGlobalState gs);
aymeric's avatar
aymeric committed
630

631 632 633 634 635 636 637 638
/**
 * LinphoneCoreLogCollectionUploadState is used to notify if log collection upload have been succesfully delivered or not.
 */
typedef enum _LinphoneCoreLogCollectionUploadState {
	LinphoneCoreLogCollectionUploadStateInProgress, /**< Delivery in progress */
	LinphoneCoreLogCollectionUploadStateDelivered, /**< Log collection upload successfully delivered and acknowledged by remote end point */
	LinphoneCoreLogCollectionUploadStateNotDelivered, /**< Log collection upload was not delivered */
} LinphoneCoreLogCollectionUploadState;
639

jehan's avatar
jehan committed
640 641
LINPHONE_PUBLIC const char *linphone_core_log_collection_upload_state_to_string(const LinphoneCoreLogCollectionUploadState lcus);

Simon Morlat's avatar
Simon Morlat committed
642 643
/**
 * Global state notification callback.
644
 * @param lc the #LinphoneCore.
Simon Morlat's avatar
Simon Morlat committed
645 646 647
 * @param gstate the global state
 * @param message informational message.
 */
648 649 650 651 652
typedef void (*LinphoneCoreCbsGlobalStateChangedCb)(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
/**
 * Old name of #LinphoneCoreCbsGlobalStateChangedCb.
 */
typedef LinphoneCoreCbsGlobalStateChangedCb LinphoneCoreGlobalStateChangedCb;
653 654 655 656 657
/**
 * Call state notification callback.
 * @param lc the LinphoneCore
 * @param call the call object whose state is changed.
 * @param cstate the new state of the call
658
 * @param message a non NULL informational message about the state.
659
 */
660 661 662 663 664
typedef void (*LinphoneCoreCbsCallStateChangedCb)(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
/**
 * Old name of #LinphoneCoreCbsCallStateChangedCb.
 */
typedef LinphoneCoreCbsCallStateChangedCb LinphoneCoreCallStateChangedCb;
665 666 667 668 669 670 671 672

/**
 * Call encryption changed callback.
 * @param lc the LinphoneCore
 * @param call the call on which encryption is changed.
 * @param on whether encryption is activated.
 * @param authentication_token an authentication_token, currently set for ZRTP kind of encryption only.
 */
673 674 675 676 677
typedef void (*LinphoneCoreCbsCallEncryptionChangedCb)(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token);
/**
 * Old name of #LinphoneCoreCbsCallEncryptionChangedCb.
 */
typedef LinphoneCoreCbsCallEncryptionChangedCb LinphoneCoreCallEncryptionChangedCb;
678

jehan's avatar
jehan committed
679 680 681
/** @ingroup Proxies
 * Registration state notification callback prototype
 * */
682 683 684 685 686 687
typedef void (*LinphoneCoreCbsRegistrationStateChangedCb)(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message) ;
/**
 * Old name of #LinphoneCoreCbsRegistrationStateChangedCb.
 */
typedef LinphoneCoreCbsRegistrationStateChangedCb LinphoneCoreRegistrationStateChangedCb;

Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
688 689
/** Callback prototype
 * @deprecated
690
 */
691
typedef void (*ShowInterfaceCb)(LinphoneCore *lc) ;
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
692 693
/** Callback prototype
 * @deprecated
694
 */
695
typedef void (*DisplayStatusCb)(LinphoneCore *lc, const char *message) ;
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
696 697
/** Callback prototype
 * @deprecated
698
 */
699
typedef void (*DisplayMessageCb)(LinphoneCore *lc, const char *message) ;
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
700 701
/** Callback prototype
 * @deprecated
702
 */
703
typedef void (*DisplayUrlCb)(LinphoneCore *lc, const char *message, const char *url) ;
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
704
/** Callback prototype
705
 */
Simon Morlat's avatar
Simon Morlat committed
706
typedef void (*LinphoneCoreCbFunc)(LinphoneCore *lc,void * user_data);
jehan's avatar
jehan committed
707 708 709
/**
 * Report status change for a friend previously \link linphone_core_add_friend() added \endlink to #LinphoneCore.
 * @param lc #LinphoneCore object .
jehan's avatar
jehan committed
710 711
 * @param lf Updated #LinphoneFriend .
 */
712 713 714 715 716
typedef void (*LinphoneCoreCbsNotifyPresenceReceivedCb)(LinphoneCore *lc, LinphoneFriend * lf);
/**
 * Old name of #LinphoneCoreCbsNotifyPresenceReceivedCb.
 */
typedef LinphoneCoreCbsNotifyPresenceReceivedCb LinphoneCoreNotifyPresenceReceivedCb;
717 718 719 720 721 722 723
/**
 * Reports presence model change for a specific URI or phone number of a friend
 * @param lc #LinphoneCore object
 * @param lf #LinphoneFriend object
 * @param uri_or_tel The URI or phone number for which teh presence model has changed
 * @param presence_model The new presence model
 */
724 725 726 727 728
typedef void (*LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb)(LinphoneCore *lc, LinphoneFriend *lf, const char *uri_or_tel, const LinphonePresenceModel *presence_model);
/**
 * Old name of #LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb.
 */
typedef LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb LinphoneCoreNotifyPresenceReceivedForUriOrTelCb;
jehan's avatar
jehan committed
729 730
/**
 *  Reports that a new subscription request has been received and wait for a decision.
731 732 733 734
 *  Status on this subscription request is notified by \link linphone_friend_set_inc_subscribe_policy() changing policy \endlink for this friend
 * @param lc #LinphoneCore object
 * @param lf #LinphoneFriend corresponding to the subscriber
 * @param url of the subscriber
jehan's avatar
jehan committed
735
 *  Callback prototype
736
 */
737 738 739 740 741
typedef void (*LinphoneCoreCbsNewSubscriptionRequestedCb)(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
/**
 * Old name of #LinphoneCoreCbsNewSubscriptionRequestedCb.
 */
typedef LinphoneCoreCbsNewSubscriptionRequestedCb LinphoneCoreNewSubscriptionRequestedCb;
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
742
/**
743 744 745 746
 * Callback for requesting authentication information to application or user.
 * @param lc the LinphoneCore
 * @param realm the realm (domain) on which authentication is required.
 * @param username the username that needs to be authenticated.
747 748 749 750 751 752 753 754 755
 * @param domain the domain on which authentication is required.
 * Application shall reply to this callback using linphone_core_add_auth_info().
 */
typedef void (*LinphoneCoreAuthInfoRequestedCb)(LinphoneCore *lc, const char *realm, const char *username, const char *domain);

/**
 * Callback for requesting authentication information to application or user.
 * @param lc the LinphoneCore
 * @param auth_info a LinphoneAuthInfo pre-filled with username, realm and domain values as much as possible
756
 * @param method the type of authentication requested
757 758
 * Application shall reply to this callback using linphone_core_add_auth_info().
 */
759 760 761 762 763
typedef void (*LinphoneCoreCbsAuthenticationRequestedCb)(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method);
/**
 * Old name of #LinphoneCoreCbsAuthenticationRequestedCb.
 */
typedef LinphoneCoreCbsAuthenticationRequestedCb LinphoneCoreAuthenticationRequestedCb;
764

Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
765
/**
766 767 768 769 770
 * Callback to notify a new call-log entry has been added.
 * This is done typically when a call terminates.
 * @param lc the LinphoneCore
 * @param newcl the new call log entry added.
 */
771 772 773 774 775
typedef void (*LinphoneCoreCbsCallLogUpdatedCb)(LinphoneCore *lc, LinphoneCallLog *newcl);
/**
 * Old name of #LinphoneCoreCbsCallLogUpdatedCb.
 */
typedef LinphoneCoreCbsCallLogUpdatedCb LinphoneCoreCallLogUpdatedCb;
776

jehan's avatar
jehan committed
777 778
/**
 * Callback prototype
779
 * @deprecated use #LinphoneCoreMessageReceivedCb instead.
jehan's avatar
jehan committed
780 781 782 783 784
 *
 * @param lc #LinphoneCore object
 * @param room #LinphoneChatRoom involved in this conversation. Can be be created by the framework in case \link #LinphoneAddress the from \endlink is not present in any chat room.
 * @param from #LinphoneAddress from
 * @param message incoming message
785
 */
786
typedef void (*LinphoneCoreTextMessageReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message);
787

788 789 790 791 792 793
/**
 * Chat message callback prototype
 *
 * @param lc #LinphoneCore object
 * @param room #LinphoneChatRoom involved in this conversation. Can be be created by the framework in case \link #LinphoneAddress the from \endlink is not present in any chat room.
 * @param LinphoneChatMessage incoming message
794
 */
795 796 797 798 799
typedef void (*LinphoneCoreCbsMessageReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
/**
 * Old name of #LinphoneCoreCbsMessageReceivedCb.
 */
typedef LinphoneCoreCbsMessageReceivedCb LinphoneCoreMessageReceivedCb;
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
800

jehan's avatar
jehan committed
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832
/**
 * File transfer receive callback prototype. This function is called by the core upon an incoming File transfer is started. This function may be call several time for the same file in case of large file.
 *
 *
 * @param lc #LinphoneCore object
 * @param message #LinphoneChatMessage message from which the body is received.
 * @param content #LinphoneContent incoming content information
 * @param buff pointer to the received data
 * @param size number of bytes to be read from buff. 0 means end of file.
 *
 */
typedef void (*LinphoneCoreFileTransferRecvCb)(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size);

/**
 * File transfer send callback prototype. This function is called by the core upon an outgoing File transfer is started. This function is called until size is set to 0.
 * <br> a #LinphoneContent with a size equal zero
 *
 * @param lc #LinphoneCore object
 * @param message #LinphoneChatMessage message from which the body is received.
 * @param content #LinphoneContent outgoing content
 * @param buff pointer to the buffer where data chunk shall be written by the app
 * @param size as input value, it represents the number of bytes expected by the framework. As output value, it means the number of bytes wrote by the application in the buffer. 0 means end of file.
 *
 */
typedef void (*LinphoneCoreFileTransferSendCb)(LinphoneCore *lc, LinphoneChatMessage *message,  const LinphoneContent* content, char* buff, size_t* size);

/**
 * File transfer progress indication callback prototype.
 *
 * @param lc #LinphoneCore object
 * @param message #LinphoneChatMessage message from which the body is received.
 * @param content #LinphoneContent incoming content information
833 834
 * @param offset The number of bytes sent/received since the beginning of the transfer.
 * @param total The total number of bytes to be sent/received.
jehan's avatar
jehan committed
835
 */
836
typedef void (*LinphoneCoreFileTransferProgressIndicationCb)(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
jehan's avatar
jehan committed
837

838 839 840 841 842 843
/**
 * Is composing notification callback prototype.
 *
 * @param[in] lc #LinphoneCore object
 * @param[in] room #LinphoneChatRoom involved in the conversation.
 */
844 845 846 847 848
typedef void (*LinphoneCoreCbsIsComposingReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room);
/**
 * Old name of #LinphoneCoreCbsIsComposingReceivedCb.
 */
typedef LinphoneCoreCbsIsComposingReceivedCb LinphoneCoreIsComposingReceivedCb;
849

Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
850
/**
851 852 853 854 855
 * Callback for being notified of DTMFs received.
 * @param lc the linphone core
 * @param call the call that received the dtmf
 * @param dtmf the ascii code of the dtmf
 */
856 857 858 859 860
typedef void (*LinphoneCoreCbsDtmfReceivedCb)(LinphoneCore* lc, LinphoneCall *call, int dtmf);
/**
 * Old name of #LinphoneCoreCbsDtmfReceivedCb.
 */
typedef LinphoneCoreCbsDtmfReceivedCb LinphoneCoreDtmfReceivedCb;
861

smorlat's avatar
smorlat committed
862
/** Callback prototype */
863 864 865 866 867
typedef void (*LinphoneCoreCbsReferReceivedCb)(LinphoneCore *lc, const char *refer_to);
/**
 * Old name of #LinphoneCoreCbsReferReceivedCb.
 */
typedef LinphoneCoreCbsReferReceivedCb LinphoneCoreReferReceivedCb;
smorlat's avatar
smorlat committed
868
/** Callback prototype */
869 870 871 872 873
typedef void (*LinphoneCoreCbsBuddyInfoUpdatedCb)(LinphoneCore *lc, LinphoneFriend *lf);
/**
 * Old name of #LinphoneCoreCbsBuddyInfoUpdatedCb.
 */
typedef LinphoneCoreCbsBuddyInfoUpdatedCb LinphoneCoreBuddyInfoUpdatedCb;
874 875 876 877 878 879
/**
 * Callback for notifying progresses of transfers.
 * @param lc the LinphoneCore
 * @param transfered the call that was transfered
 * @param new_call_state the state of the call to transfer target at the far end.
 */
880 881 882 883 884
typedef void (*LinphoneCoreCbsTransferStateChangedCb)(LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state);
/**
 * Old name of LinphoneCoreCbsTransferStateChangedCb.
 */
typedef LinphoneCoreCbsTransferStateChangedCb LinphoneCoreTransferStateChangedCb;
885

Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
886
/**
887 888 889 890 891
 * Callback for receiving quality statistics for calls.
 * @param lc the LinphoneCore
 * @param call the call
 * @param stats the call statistics.
 */
892 893 894 895 896
typedef void (*LinphoneCoreCbsCallStatsUpdatedCb)(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *stats);
/**
 * Old name of #LinphoneCoreCbsCallStatsUpdatedCb.
 */
typedef LinphoneCoreCbsCallStatsUpdatedCb LinphoneCoreCallStatsUpdatedCb;
897

Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
898
/**
899 900 901
 * Callback prototype for receiving info messages.
 * @param lc the LinphoneCore
 * @param call the call whose info message belongs to.
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
902
 * @param msg the info message.
903
 */
904 905 906 907 908
typedef void (*LinphoneCoreCbsInfoReceivedCb)(LinphoneCore *lc, LinphoneCall *call, const LinphoneInfoMessage *msg);
/**
 * Old name of #LinphoneCoreCbsInfoReceivedCb.
 */
typedef LinphoneCoreCbsInfoReceivedCb LinphoneCoreInfoReceivedCb;
909

910 911 912 913 914 915 916 917 918 919
/**
 * LinphoneGlobalState describes the global state of the LinphoneCore object.
 * It is notified via the LinphoneCoreVTable::global_state_changed
**/
typedef enum _LinphoneConfiguringState {
	LinphoneConfiguringSuccessful,
	LinphoneConfiguringFailed,
	LinphoneConfiguringSkipped
} LinphoneConfiguringState;

920 921 922 923 924 925
/**
 * Converts a _LinphoneConfiguringState enum to a string.
 * @ingroup misc
**/
LINPHONE_PUBLIC const char *linphone_configuring_state_to_string(LinphoneConfiguringState cs);

926 927 928 929 930
/**
 * Callback prototype for configuring status changes notification
 * @param lc the LinphoneCore
 * @param message informational message.
 */
931 932 933 934 935
typedef void (*LinphoneCoreCbsConfiguringStatusCb)(LinphoneCore *lc, LinphoneConfiguringState status, const char *message);
/**
 * Old name of #LinphoneCoreCbsConfiguringStatusCb.
 */
typedef LinphoneCoreCbsConfiguringStatusCb LinphoneCoreConfiguringStatusCb;
936

937 938 939 940 941
/**
 * Callback prototype for reporting network change either automatically detected or notified by #linphone_core_set_network_reachable.
 * @param lc the LinphoneCore
 * @param reachable true if network is reachable.
 */
942 943 944 945 946
typedef void (*LinphoneCoreCbsNetworkReachableCb)(LinphoneCore *lc, bool_t reachable);
/**
 * Old name of #LinphoneCoreCbsNetworkReachableCb.
 */
typedef LinphoneCoreCbsNetworkReachableCb LinphoneCoreNetworkReachableCb;
947

948 949 950 951 952 953
/**
 * Callback prototype for reporting log collection upload state change.
 * @param[in] lc LinphoneCore object
 * @param[in] state The state of the log collection upload
 * @param[in] info Additional information: error message in case of error state, URL of uploaded file in case of success.
 */
954 955 956 957 958
typedef void (*LinphoneCoreCbsLogCollectionUploadStateChangedCb)(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info);
/**
 * Old name of #LinphoneCoreCbsLogCollectionUploadStateChangedCb.
 */
typedef LinphoneCoreCbsLogCollectionUploadStateChangedCb LinphoneCoreLogCollectionUploadStateChangedCb;
959 960 961 962 963

/**
 * Callback prototype for reporting log collection upload progress indication.
 * @param[in] lc LinphoneCore object
 */
964 965 966 967 968
typedef void (*LinphoneCoreCbsLogCollectionUploadProgressIndicationCb)(LinphoneCore *lc, size_t offset, size_t total);
/**
 * Old name of #LinphoneCoreCbsLogCollectionUploadProgressIndicationCb.
 */
typedef LinphoneCoreCbsLogCollectionUploadProgressIndicationCb LinphoneCoreLogCollectionUploadProgressIndicationCb;
969

970 971 972 973 974
/**
 * Callback prototype for reporting when a friend list has been added to the core friends list.
 * @param[in] lc LinphoneCore object
 * @param[in] list LinphoneFriendList object
 */
975 976 977 978 979
typedef void (*LinphoneCoreCbsFriendListCreatedCb) (LinphoneCore *lc, LinphoneFriendList *list);
/**
 * Old name of #LinphoneCoreCbsFriendListCreatedCb.
 */
typedef LinphoneCoreCbsFriendListCreatedCb LinphoneCoreFriendListCreatedCb;
980 981 982 983 984 985

/**
 * Callback prototype for reporting when a friend list has been removed from the core friends list.
 * @param[in] lc LinphoneCore object
 * @param[in] list LinphoneFriendList object
 */
986 987 988 989 990
typedef void (*LinphoneCoreCbsFriendListRemovedCb) (LinphoneCore *lc, LinphoneFriendList *list);
/**
 * Old name of #LinphoneCoreCbsFriendListRemovedCb.
 */
typedef LinphoneCoreCbsFriendListRemovedCb LinphoneCoreFriendListRemovedCb;
991

smorlat's avatar
smorlat committed
992 993
/**
 * This structure holds all callbacks that the application should implement.
994
 *  None is mandatory.
smorlat's avatar
smorlat committed
995
**/
Simon Morlat's avatar
Simon Morlat committed
996
typedef struct _LinphoneCoreVTable{
997 998 999
	LinphoneCoreGlobalStateChangedCb global_state_changed; /**<Notifies global state changes*/
	LinphoneCoreRegistrationStateChangedCb registration_state_changed;/**<Notifies registration state changes*/
	LinphoneCoreCallStateChangedCb call_state_changed;/**<Notifies call state changes*/
1000
	LinphoneCoreNotifyPresenceReceivedCb notify_presence_received; /**< Notify received presence events*/
1001
	LinphoneCoreNotifyPresenceReceivedForUriOrTelCb notify_presence_received_for_uri_or_tel; /**< Notify received presence events*/
1002
	LinphoneCoreNewSubscriptionRequestedCb new_subscription_requested; /**< Notify about pending presence subscription request */
1003 1004
	LINPHONE_DEPRECATED LinphoneCoreAuthInfoRequestedCb auth_info_requested; /**< @deprecated Use authentication_requested instead. Ask the application some authentication information */
	LinphoneCoreAuthenticationRequestedCb authentication_requested; /**< Ask the application some authentication information */
1005
	LinphoneCoreCallLogUpdatedCb call_log_updated; /**< Notifies that call log list has been updated */
1006
	LinphoneCoreMessageReceivedCb message_received; /**< a message is received, can be text or external body*/
1007
	LinphoneCoreIsComposingReceivedCb is_composing_received; /**< An is-composing notification has been received */
1008 1009 1010 1011 1012 1013 1014 1015
	LinphoneCoreDtmfReceivedCb dtmf_received; /**< A dtmf has been received received */
	LinphoneCoreReferReceivedCb refer_received; /**< An out of call refer was received */
	LinphoneCoreCallEncryptionChangedCb call_encryption_changed; /**<Notifies on change in the encryption of call streams */
	LinphoneCoreTransferStateChangedCb transfer_state_changed; /**<Notifies when a transfer is in progress */
	LinphoneCoreBuddyInfoUpdatedCb buddy_info_updated; /**< a LinphoneFriend's BuddyInfo has changed*/
	LinphoneCoreCallStatsUpdatedCb call_stats_updated; /**<Notifies on refreshing of call's statistics. */
	LinphoneCoreInfoReceivedCb info_received; /**<Notifies an incoming informational message received.*/
	LinphoneCoreSubscriptionStateChangedCb subscription_state_changed; /**<Notifies subscription state change */
1016
	LinphoneCoreNotifyReceivedCb notify_received; /**< Notifies a an event notification, see linphone_core_subscribe() */
1017
	LinphoneCorePublishStateChangedCb publish_state_changed;/**Notifies publish state change (only from #LinphoneEvent api)*/
1018
	LinphoneCoreConfiguringStatusCb configuring_status; /** Notifies configuring status changes */
Ghislain MARY's avatar
Ghislain MARY committed
1019 1020 1021 1022
	LINPHONE_DEPRECATED DisplayStatusCb display_status; /**< @deprecated Callback that notifies various events with human readable text.*/
	LINPHONE_DEPRECATED DisplayMessageCb display_message;/**< @deprecated Callback to display a message to the user */
	LINPHONE_DEPRECATED DisplayMessageCb display_warning;/**< @deprecated Callback to display a warning to the user */
	LINPHONE_DEPRECATED DisplayUrlCb display_url; /**< @deprecated */
1023
	LINPHONE_DEPRECATED ShowInterfaceCb show; /**< vNotifies the application that it should show up*/
Ghislain MARY's avatar
Ghislain MARY committed
1024 1025 1026 1027
	LINPHONE_DEPRECATED LinphoneCoreTextMessageReceivedCb text_received; /**< @deprecated, use #message_received instead <br> A text message has been received */
	LINPHONE_DEPRECATED LinphoneCoreFileTransferRecvCb file_transfer_recv; /**< @deprecated Callback to store file received attached to a #LinphoneChatMessage */
	LINPHONE_DEPRECATED LinphoneCoreFileTransferSendCb file_transfer_send; /**< @deprecated Callback to collect file chunk to be sent for a #LinphoneChatMessage */
	LINPHONE_DEPRECATED LinphoneCoreFileTransferProgressIndicationCb file_transfer_progress_indication; /**< @deprecated Callback to indicate file transfer progress */
1028 1029 1030
	LinphoneCoreNetworkReachableCb network_reachable; /**< Callback to report IP network status (I.E up/down )*/
	LinphoneCoreLogCollectionUploadStateChangedCb log_collection_upload_state_changed; /**< Callback to upload collected logs */
	LinphoneCoreLogCollectionUploadProgressIndicationCb log_collection_upload_progress_indication; /**< Callback to indicate log collection upload progress */
1031 1032
	LinphoneCoreFriendListCreatedCb friend_list_created;
	LinphoneCoreFriendListRemovedCb friend_list_removed;
Simon Morlat's avatar
Simon Morlat committed
1033
	void *user_data; /**<User data associated with the above callbacks */
aymeric's avatar
aymeric committed
1034 1035
} LinphoneCoreVTable;

1036
/**
1037
 * Instantiate a vtable with all arguments set to NULL
1038
 * @return newly allocated vtable
1039
 */
1040
LINPHONE_PUBLIC LinphoneCoreVTable *linphone_core_v_table_new(void);
1041

1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
/**
 * Sets a user data pointer in the vtable.
 * @param table the vtable
 * @param data the user data to attach
 */
LINPHONE_PUBLIC void linphone_core_v_table_set_user_data(LinphoneCoreVTable *table, void *data);

/**
 * Gets a user data pointer in the vtable.
 * @param table the vtable