From 2f1d16a3069f5e43186aaf5c4f07adddd79b603f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 4 Dec 2017 11:55:23 +0100 Subject: [PATCH] Use c-wrapper for the Core object. --- coreapi/CMakeLists.txt | 1 + coreapi/account_creator.c | 3 + coreapi/account_creator_service.c | 3 + coreapi/authentication.c | 3 + coreapi/buffer.c | 3 + coreapi/call_log.c | 3 + coreapi/callbacks.c | 30 +- coreapi/chat.c | 16 +- coreapi/conference.cc | 10 +- coreapi/content.c | 3 + coreapi/core_private.h | 35 + coreapi/error_info.c | 3 + coreapi/event.c | 3 + coreapi/factory.c | 3 + coreapi/friend.c | 3 + coreapi/friendlist.c | 3 + coreapi/im_notif_policy.c | 3 + coreapi/linphone_tunnel_config.c | 3 + coreapi/linphonecore.c | 249 +-- coreapi/misc.c | 5 +- coreapi/nat_policy.c | 3 + coreapi/payload_type.c | 3 + coreapi/player.c | 3 + coreapi/presence.c | 3 + coreapi/private.h | 1449 +---------------- coreapi/private_functions.h | 594 +++++++ coreapi/private_structs.h | 834 ++++++++++ coreapi/private_types.h | 70 + coreapi/video_definition.c | 3 + coreapi/xmlrpc.c | 3 + src/CMakeLists.txt | 2 + src/address/address.cpp | 1 + src/address/identity-address.cpp | 4 + src/c-wrapper/api/c-call-params.cpp | 5 +- src/c-wrapper/api/c-call.cpp | 8 +- src/c-wrapper/api/c-chat-room.cpp | 4 +- src/c-wrapper/api/c-core.cpp | 47 + src/c-wrapper/api/c-participant.cpp | 1 + src/c-wrapper/c-wrapper.h | 6 +- src/call/call-p.h | 2 +- src/call/call.cpp | 44 +- src/call/call.h | 3 + .../encryption-chat-message-modifier.cpp | 4 +- src/conference/session/media-session.cpp | 2 +- src/core/core-call.cpp | 192 +++ src/core/core-chat-room.cpp | 2 +- src/core/core-p.h | 16 + src/core/core.cpp | 72 +- src/core/core.h | 20 +- tester/call_single_tester.c | 2 +- tester/conference-event-tester.cpp | 18 +- tester/cpim-tester.cpp | 2 +- tester/main-db-tester.cpp | 2 +- tester/multipart-tester.cpp | 2 +- tools/python/apixml2python.py | 1 - 55 files changed, 2056 insertions(+), 1756 deletions(-) create mode 100644 coreapi/core_private.h create mode 100644 coreapi/private_functions.h create mode 100644 coreapi/private_structs.h create mode 100644 coreapi/private_types.h create mode 100644 src/c-wrapper/api/c-core.cpp create mode 100644 src/core/core-call.cpp diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index d12a73f06..cbb971d70 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -38,6 +38,7 @@ list(APPEND LINPHONE_PRIVATE_HEADER_FILES carddav.h conference_private.h contact_providers_priv.h + core_private.h enum.h lime.h lpc2xml.h diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 16d23a221..6e57615fc 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -30,6 +30,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include +// TODO: From coreapi. Remove me later. +#include "private.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneAccountCreatorCbs); BELLE_SIP_INSTANCIATE_VPTR(LinphoneAccountCreatorCbs, belle_sip_object_t, diff --git a/coreapi/account_creator_service.c b/coreapi/account_creator_service.c index 3cf0bbff6..26ee9fc4f 100644 --- a/coreapi/account_creator_service.c +++ b/coreapi/account_creator_service.c @@ -22,6 +22,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneAccountCreatorService); BELLE_SIP_INSTANCIATE_VPTR(LinphoneAccountCreatorService, belle_sip_object_t, diff --git a/coreapi/authentication.c b/coreapi/authentication.c index 59a9db475..9d310da3c 100644 --- a/coreapi/authentication.c +++ b/coreapi/authentication.c @@ -28,6 +28,9 @@ #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + static void _linphone_auth_info_uninit(LinphoneAuthInfo *obj); static void _linphone_auth_info_copy(LinphoneAuthInfo *dst, const LinphoneAuthInfo *src); diff --git a/coreapi/buffer.c b/coreapi/buffer.c index ce28b271a..c3bd79270 100644 --- a/coreapi/buffer.c +++ b/coreapi/buffer.c @@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + static void linphone_buffer_destroy(LinphoneBuffer *buffer) { if (buffer->content) belle_sip_free(buffer->content); } diff --git a/coreapi/call_log.c b/coreapi/call_log.c index abed37602..9ca518db7 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -35,6 +35,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + typedef struct _CallLogStorageResult { LinphoneCore *core; bctbx_list_t *result; diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index e2a672940..a14a588e0 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -54,22 +54,6 @@ using namespace LinphonePrivate; static void register_failure(SalOp *op); -static bool_t already_a_call_with_remote_address(const LinphoneCore *lc, const LinphoneAddress *remote) { - bctbx_list_t *elem; - ms_message("Searching for already_a_call_with_remote_address."); - - for(elem=lc->calls;elem!=NULL;elem=elem->next){ - const LinphoneCall *call=(LinphoneCall*)elem->data; - const LinphoneAddress *cRemote=linphone_call_get_remote_address(call); - if (linphone_address_weak_equal(cRemote,remote)) { - ms_warning("already_a_call_with_remote_address found."); - return TRUE; - } - } - return FALSE; -} - - static LinphoneCall * look_for_broken_call_to_replace(LinphonePrivate::SalOp *h, LinphoneCore *lc) { const bctbx_list_t *calls = linphone_core_get_calls(lc); const bctbx_list_t *it = calls; @@ -128,7 +112,7 @@ static void call_received(SalCallOp *h) { } else if (sal_address_has_param(h->get_remote_contact_address(), "text")) { linphone_address_unref(toAddr); linphone_address_unref(fromAddr); - shared_ptr chatRoom = lc->cppCore->findChatRoom( + shared_ptr chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom( ChatRoomId(IdentityAddress(h->get_to()), IdentityAddress(h->get_to())) ); if (chatRoom) { @@ -169,7 +153,7 @@ static void call_received(SalCallOp *h) { } } - if (!linphone_core_can_we_add_call(lc)) { /* Busy */ + if (!L_GET_PRIVATE_FROM_C_OBJECT(lc)->canWeAddCall()) { /* Busy */ h->decline(SalReasonBusy, nullptr); LinphoneErrorInfo *ei = linphone_error_info_new(); linphone_error_info_set(ei, nullptr, LinphoneReasonBusy, 486, "Busy - too many calls", nullptr); @@ -186,7 +170,7 @@ static void call_received(SalCallOp *h) { fromAddressToSearchIfMe = linphone_address_new(pAssertedId); else ms_warning("Hidden from identity, don't know if it's me"); - if (fromAddressToSearchIfMe && already_a_call_with_remote_address(lc, fromAddressToSearchIfMe)) { + if (fromAddressToSearchIfMe && L_GET_PRIVATE_FROM_C_OBJECT(lc)->isAlreadyInCallWithAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(fromAddressToSearchIfMe))) { char *addr = linphone_address_as_string(fromAddr); ms_warning("Receiving a call while one with same address [%s] is initiated, refusing this one with busy message", addr); h->decline(SalReasonBusy, nullptr); @@ -767,7 +751,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ if (addr.hasUriParam("method") && (addr.getUriParamValue("method") == "BYE")) { if (linphone_core_conference_server_enabled(lc)) { // Removal of a participant at the server side - shared_ptr chatRoom = lc->cppCore->findChatRoom( + shared_ptr chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom( ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to())) ); if (chatRoom) { @@ -785,7 +769,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ } else { // The server asks a participant to leave a chat room LinphoneChatRoom *cr = L_GET_C_BACK_PTR( - lc->cppCore->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to()))) + L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to()))) ); if (cr) { L_GET_CPP_PTR_FROM_C_OBJECT(cr)->leave(); @@ -795,7 +779,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ static_cast(op)->reply(SalReasonDeclined); } } else if (addr.hasParam("admin")) { - LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom( + LinphoneChatRoom *cr = L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom( ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to())) )); if (cr) { @@ -814,7 +798,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){ return; } } else { - LinphoneChatRoom *cr = L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to())))); + LinphoneChatRoom *cr = L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to())))); if (!cr) cr = _linphone_client_group_chat_room_new(lc, addr.asString().c_str(), nullptr); L_GET_CPP_PTR_FROM_C_OBJECT(cr)->join(); diff --git a/coreapi/chat.c b/coreapi/chat.c index 65f85d15a..3dc067c80 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -60,12 +60,12 @@ bool_t linphone_core_chat_enabled(const LinphoneCore *lc) { const bctbx_list_t *linphone_core_get_chat_rooms (LinphoneCore *lc) { if (lc->chat_rooms) bctbx_list_free_with_data(lc->chat_rooms, (bctbx_list_free_func)linphone_chat_room_unref); - lc->chat_rooms = L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(lc->cppCore->getChatRooms()); + lc->chat_rooms = L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getChatRooms()); return lc->chat_rooms; } static LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) { - return L_GET_C_BACK_PTR(core->cppCore->getOrCreateBasicChatRoom( + return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(core)->getOrCreateBasicChatRoom( *L_GET_CPP_PTR_FROM_C_OBJECT(addr), linphone_core_realtime_text_enabled(core) )); @@ -79,11 +79,11 @@ LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call){ } LinphoneChatRoom *linphone_core_get_chat_room (LinphoneCore *lc, const LinphoneAddress *addr) { - return L_GET_C_BACK_PTR(lc->cppCore->getOrCreateBasicChatRoom(*L_GET_CPP_PTR_FROM_C_OBJECT(addr))); + return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoom(*L_GET_CPP_PTR_FROM_C_OBJECT(addr))); } LinphoneChatRoom *linphone_core_create_client_group_chat_room (LinphoneCore *lc, const char *subject) { - return L_GET_C_BACK_PTR(lc->cppCore->createClientGroupChatRoom(L_C_TO_STRING(subject))); + return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->createClientGroupChatRoom(L_C_TO_STRING(subject))); } LinphoneChatRoom *_linphone_core_join_client_group_chat_room (LinphoneCore *lc, const LinphonePrivate::Address &addr) { @@ -101,7 +101,7 @@ void linphone_core_delete_chat_room (LinphoneCore *, LinphoneChatRoom *cr) { } LinphoneChatRoom *linphone_core_get_chat_room_from_uri(LinphoneCore *lc, const char *to) { - return L_GET_C_BACK_PTR(lc->cppCore->getOrCreateBasicChatRoomFromUri(L_C_TO_STRING(to))); + return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getOrCreateBasicChatRoomFromUri(L_C_TO_STRING(to))); } LinphoneChatRoom *linphone_core_find_chat_room( @@ -109,7 +109,7 @@ LinphoneChatRoom *linphone_core_find_chat_room( const LinphoneAddress *peer_addr, const LinphoneAddress *local_addr ) { - return L_GET_C_BACK_PTR(lc->cppCore->findChatRoom(LinphonePrivate::ChatRoomId( + return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(LinphonePrivate::ChatRoomId( LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(peer_addr)), LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(local_addr)) ))); @@ -120,7 +120,7 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room ( const LinphoneAddress *local_addr, const LinphoneAddress *participant_addr ) { - return L_GET_C_BACK_PTR(lc->cppCore->findOneToOneChatRoom( + return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findOneToOneChatRoom( LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(local_addr)), LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant_addr)) )); @@ -137,7 +137,7 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, localAddress = op->get_to(); } - shared_ptr chatRoom = lc->cppCore->findChatRoom( + shared_ptr chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom( LinphonePrivate::ChatRoomId(LinphonePrivate::IdentityAddress(peerAddress), LinphonePrivate::IdentityAddress(localAddress)) ); diff --git a/coreapi/conference.cc b/coreapi/conference.cc index eb88aa5a1..522353ff6 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -36,6 +36,9 @@ #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + using namespace std; namespace Linphone { @@ -535,6 +538,7 @@ int LocalConference::remoteParticipantsCount() { int LocalConference::convertConferenceToCall(){ int err=0; +#if 0 bctbx_list_t *calls=m_core->calls; if (remoteParticipantsCount()!=1){ @@ -551,6 +555,7 @@ int LocalConference::convertConferenceToCall(){ break; } } +#endif return err; } @@ -583,6 +588,7 @@ int LocalConference::removeParticipant(const LinphoneAddress *uri) { } int LocalConference::terminate() { +#if 0 bctbx_list_t *calls=m_core->calls; m_terminating =TRUE; @@ -596,11 +602,12 @@ int LocalConference::terminate() { Conference::terminate(); m_terminating = FALSE; - +#endif return 0; } int LocalConference::enter() { +#if 0 if (linphone_core_sound_resources_locked(m_core)) { return -1; } @@ -608,6 +615,7 @@ int LocalConference::enter() { _linphone_call_pause(m_core->current_call); } if (m_localParticipantStream==NULL) addLocalEndpoint(); +#endif return 0; } diff --git a/coreapi/content.c b/coreapi/content.c index 055591ee5..8d20964bd 100644 --- a/coreapi/content.c +++ b/coreapi/content.c @@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + static void linphone_content_set_sal_body_handler(LinphoneContent *content, SalBodyHandler *body_handler) { if (content->body_handler != NULL) { sal_body_handler_unref(content->body_handler); diff --git a/coreapi/core_private.h b/coreapi/core_private.h new file mode 100644 index 000000000..e5d52703e --- /dev/null +++ b/coreapi/core_private.h @@ -0,0 +1,35 @@ +/* + * core_private.h + * Copyright (C) 2010-2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _CORE_PRIVATE_H_ +#define _CORE_PRIVATE_H_ + +#include "linphone/types.h" +#include "private_structs.h" +#include "private_types.h" + +struct _LinphoneCore { + belle_sip_object_t base; + std::shared_ptr cppPtr; + std::weak_ptr weakCppPtr; + int owner; + LINPHONE_CORE_STRUCT_FIELDS +}; + +#endif /* _CORE_PRIVATE_H_ */ diff --git a/coreapi/error_info.c b/coreapi/error_info.c index 556cb35f1..a4c29c7f3 100644 --- a/coreapi/error_info.c +++ b/coreapi/error_info.c @@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneErrorInfo); static void linphone_error_info_reset(LinphoneErrorInfo *ei); diff --git a/coreapi/event.c b/coreapi/event.c index d4e8541da..950c4ca2c 100644 --- a/coreapi/event.c +++ b/coreapi/event.c @@ -23,6 +23,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + using namespace LinphonePrivate; const char * linphone_subscription_dir_to_string(LinphoneSubscriptionDir dir){ diff --git a/coreapi/factory.c b/coreapi/factory.c index 80a0a42e7..73e1d0d99 100644 --- a/coreapi/factory.c +++ b/coreapi/factory.c @@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + #ifndef PACKAGE_SOUND_DIR #define PACKAGE_SOUND_DIR "." #endif diff --git a/coreapi/friend.c b/coreapi/friend.c index 1f3b1a378..9f39717c5 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -42,6 +42,9 @@ #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + using namespace std; using namespace LinphonePrivate; diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 0e1a5644e..a0a7e08c1 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -23,6 +23,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFriendListCbs); BELLE_SIP_INSTANCIATE_VPTR(LinphoneFriendListCbs, belle_sip_object_t, diff --git a/coreapi/im_notif_policy.c b/coreapi/im_notif_policy.c index 9b628a46c..dff428f73 100644 --- a/coreapi/im_notif_policy.c +++ b/coreapi/im_notif_policy.c @@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneImNotifPolicy); BELLE_SIP_INSTANCIATE_VPTR(LinphoneImNotifPolicy, belle_sip_object_t, diff --git a/coreapi/linphone_tunnel_config.c b/coreapi/linphone_tunnel_config.c index f51d9c8e6..a12ac5c41 100644 --- a/coreapi/linphone_tunnel_config.c +++ b/coreapi/linphone_tunnel_config.c @@ -24,6 +24,9 @@ #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + struct _LinphoneTunnelConfig { belle_sip_object_t base; char *host; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4ae85aa58..93b6adcc7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -51,7 +51,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "chat/chat-room/client-group-chat-room-p.h" #include "chat/chat-room/server-group-chat-room-p.h" #include "conference/handlers/remote-conference-event-handler.h" -#include "core/core.h" +#include "core/core-p.h" // For migration purpose. #include "address/address-p.h" @@ -128,7 +128,6 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t cu static void set_sip_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime); static void set_media_network_reachable(LinphoneCore* lc,bool_t isReachable); static void linphone_core_run_hooks(LinphoneCore *lc); -static void linphone_core_uninit(LinphoneCore *lc); static void linphone_core_zrtp_cache_close(LinphoneCore *lc); void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName); @@ -456,15 +455,6 @@ void linphone_core_cbs_set_ec_calibration_audio_uninit(LinphoneCoreCbs *cbs, Lin } -typedef belle_sip_object_t_vptr_t LinphoneCore_vptr_t; -BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCore); -BELLE_SIP_INSTANCIATE_VPTR(LinphoneCore, belle_sip_object_t, - linphone_core_uninit, // destroy - NULL, // clone - NULL, // Marshall - FALSE -); - void lc_callback_obj_init(LCCallbackObj *obj,LinphoneCoreCbFunc func,void* ud) { obj->_func=func; obj->_user_data=ud; @@ -2021,8 +2011,7 @@ static void linphone_core_start(LinphoneCore * lc) { lc->auto_net_state_mon=lc->sip_conf.auto_net_state_mon; - new(&lc->cppCore) std::shared_ptr(); - lc->cppCore = Core::create(lc); + L_GET_PRIVATE_FROM_C_OBJECT(lc)->init(); linphone_core_set_state(lc,LinphoneGlobalOn,"Ready"); } @@ -2142,7 +2131,7 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve const LinphoneAddress *resource = linphone_event_get_resource(lev); const LinphoneAddress *from = linphone_event_get_from(lev); - shared_ptr chatRoom = lc->cppCore->findChatRoom(LinphonePrivate::ChatRoomId( + shared_ptr chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(LinphonePrivate::ChatRoomId( IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)), IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(from)) )); @@ -2166,7 +2155,7 @@ static void _linphone_core_conference_subscription_state_changed(LinphoneCore *l state == LinphoneSubscriptionIncomingReceived ) { const LinphoneAddress *resource = linphone_event_get_resource(lev); - shared_ptr chatRoom = lc->cppCore->findChatRoom(LinphonePrivate::ChatRoomId( + shared_ptr chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(LinphonePrivate::ChatRoomId( IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)), IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(resource)) )); @@ -2326,7 +2315,8 @@ static void _linphone_core_set_system_context(LinphoneCore *lc, void *system_con #endif LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata, void *system_context) { - LinphoneCore *core = belle_sip_object_new(LinphoneCore); + LinphoneCore *core = L_INIT(Core); + Core::create(core); linphone_core_init(core, cbs, config, userdata, system_context); return core; } @@ -2737,13 +2727,11 @@ bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc){ } static void apply_jitter_value(LinphoneCore *lc, int value, MSFormatType stype){ - LinphoneCall *call; - bctbx_list_t *it; - for (it=lc->calls;it!=NULL;it=it->next){ - MediaStream *ms; - call=(LinphoneCall*)it->data; - ms = stype==MSAudio ? linphone_call_get_stream(call, LinphoneStreamTypeAudio) : linphone_call_get_stream(call, LinphoneStreamTypeVideo); - if (ms){ + for (const auto &call : L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getCalls()) { + MediaStream *ms = (stype == MSAudio) + ? L_GET_PRIVATE(call)->getMediaStream(LinphoneStreamTypeAudio) + : L_GET_PRIVATE(call)->getMediaStream(LinphoneStreamTypeVideo); + if (ms) { RtpSession *s=ms->sessions.rtp_session; if (s){ if (value>0){ @@ -3210,8 +3198,6 @@ static void linphone_core_do_plugin_tasks(LinphoneCore *lc){ } void linphone_core_iterate(LinphoneCore *lc){ - bctbx_list_t *calls; - LinphoneCall *call; uint64_t curtime_ms = ms_get_cur_time_ms(); /*monotonic time*/ time_t current_real_time = ms_time(NULL); int64_t diff_time; @@ -3251,7 +3237,6 @@ void linphone_core_iterate(LinphoneCore *lc){ lc->prevtime_ms = curtime_ms; }else{ lc->prevtime_ms += 1000; - } } @@ -3301,17 +3286,10 @@ void linphone_core_iterate(LinphoneCore *lc){ proxy_update(lc); /* We have to iterate for each call */ - calls = lc->calls; - while (calls) { - call = reinterpret_cast(bctbx_list_get_data(calls)); - /* Get immediately a reference to next one in case the one we are going to examine is destroyed - * and removed during linphone_call_start_invite() */ - calls = bctbx_list_next(calls); - L_GET_PRIVATE_FROM_C_OBJECT(call)->iterate(current_real_time, one_second_elapsed); - } + L_GET_PRIVATE_FROM_C_OBJECT(lc)->iterateCalls(current_real_time, one_second_elapsed); if (linphone_core_video_preview_enabled(lc)){ - if (lc->previewstream==NULL && lc->calls==NULL) + if (lc->previewstream==NULL && !L_GET_PRIVATE_FROM_C_OBJECT(lc)->hasCalls()) toggle_video_preview(lc,TRUE); #ifdef VIDEO_ENABLED if (lc->previewstream) video_stream_iterate(lc->previewstream); @@ -3613,9 +3591,8 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const return NULL; } - if(!linphone_core_can_we_add_call(lc)){ + if (!L_GET_PRIVATE_FROM_C_OBJECT(lc)->canWeAddCall()) return NULL; - } cp = linphone_call_params_copy(params); proxy=linphone_core_lookup_known_proxy(lc,addr); @@ -3636,8 +3613,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const call=linphone_call_new_outgoing(lc,parsed_url2,addr,cp,proxy); linphone_address_unref(parsed_url2); - if(linphone_core_add_call(lc,call)!= 0) - { + if (L_GET_PRIVATE_FROM_C_OBJECT(lc)->addCall(L_GET_CPP_PTR_FROM_C_OBJECT(call)) != 0) { ms_warning("we had a problem in adding the call into the invite ... weird"); linphone_call_unref(call); linphone_call_params_unref(cp); @@ -3648,7 +3624,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const /* Unless this call is for a conference, it becomes now the current one*/ if (linphone_call_params_get_local_conference_mode(params) == FALSE) #endif - lc->current_call=call; + L_GET_PRIVATE_FROM_C_OBJECT(lc)->setCurrentCall(L_GET_CPP_PTR_FROM_C_OBJECT(call)); bool defer = L_GET_PRIVATE_FROM_C_OBJECT(call)->initiateOutgoing(); if (!defer) { if (L_GET_PRIVATE_FROM_C_OBJECT(call)->startInvite(nullptr) != 0) { @@ -3689,9 +3665,9 @@ bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ /* Play the ring if this is the only call*/ - if (bctbx_list_size(lc->calls)==1){ + if (linphone_core_get_calls_nb(lc)==1){ MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard; - lc->current_call=call; + L_GET_PRIVATE_FROM_C_OBJECT(lc)->setCurrentCall(L_GET_CPP_PTR_FROM_C_OBJECT(call)); if (lc->ringstream && lc->dmfs_playing_start_time!=0){ linphone_core_stop_dtmf_stream(lc); } @@ -3765,13 +3741,7 @@ LinphoneStatus linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *call } LinphoneStatus linphone_core_terminate_all_calls(LinphoneCore *lc) { - bctbx_list_t *calls=lc->calls; - while(calls) { - LinphoneCall *c=(LinphoneCall*)calls->data; - calls=calls->next; - linphone_call_terminate(c); - } - return 0; + return L_GET_CPP_PTR_FROM_C_OBJECT(lc)->terminateAllCalls(); } LinphoneStatus linphone_core_decline_call(LinphoneCore *lc, LinphoneCall *call, LinphoneReason reason) { @@ -3779,31 +3749,29 @@ LinphoneStatus linphone_core_decline_call(LinphoneCore *lc, LinphoneCall *call, } const bctbx_list_t *linphone_core_get_calls(LinphoneCore *lc) { - return lc->calls; + if (lc->callsCache) { + bctbx_list_free(lc->callsCache); + lc->callsCache = NULL; + } + lc->callsCache = L_GET_RESOLVED_C_LIST_FROM_CPP_LIST(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getCalls()); + return lc->callsCache; } bool_t linphone_core_in_call(const LinphoneCore *lc){ return linphone_core_get_current_call((LinphoneCore *)lc)!=NULL || linphone_core_is_in_conference(lc); } -LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc){ - return lc->current_call; +LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc) { + shared_ptr call = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getCurrentCall(); + return call ? L_GET_C_BACK_PTR(call) : NULL; } LinphoneStatus linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call) { return linphone_call_pause(call); } -LinphoneStatus linphone_core_pause_all_calls(LinphoneCore *lc){ - const bctbx_list_t *elem; - for(elem=lc->calls;elem!=NULL;elem=elem->next){ - LinphoneCall *call=(LinphoneCall *)elem->data; - LinphoneCallState cs=linphone_call_get_state(call); - if (cs==LinphoneCallStreamsRunning || cs==LinphoneCallPausedByRemote){ - _linphone_call_pause(call); - } - } - return 0; +LinphoneStatus linphone_core_pause_all_calls(LinphoneCore *lc) { + return L_GET_CPP_PTR_FROM_C_OBJECT(lc)->pauseAllCalls(); } int linphone_core_preempt_sound_resources(LinphoneCore *lc){ @@ -3830,11 +3798,6 @@ LinphoneStatus linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call) { return linphone_call_resume(call); } -static int remote_address_compare(LinphoneCall *call, const LinphoneAddress *raddr){ - const LinphoneAddress *addr=linphone_call_get_remote_address (call); - return !linphone_address_weak_equal (addr,raddr); -} - LinphoneCall *linphone_core_get_call_by_remote_address(const LinphoneCore *lc, const char *remote_address){ LinphoneCall *call=NULL; LinphoneAddress *raddr=linphone_address_new(remote_address); @@ -3849,11 +3812,9 @@ LinphoneCall *linphone_core_find_call_from_uri(const LinphoneCore *lc, const cha return linphone_core_get_call_by_remote_address(lc, remote_address); } -LinphoneCall *linphone_core_get_call_by_remote_address2(const LinphoneCore *lc, const LinphoneAddress *raddr){ - const bctbx_list_t *elem=bctbx_list_find_custom(lc->calls,(int (*)(const void*,const void *))remote_address_compare,raddr); - - if (elem) return (LinphoneCall*) elem->data; - return NULL; +LinphoneCall *linphone_core_get_call_by_remote_address2(const LinphoneCore *lc, const LinphoneAddress *raddr) { + shared_ptr call = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getCallByRemoteAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(raddr)); + return call ? L_GET_C_BACK_PTR(call) : NULL; } int linphone_core_send_publish(LinphoneCore *lc, LinphonePresenceModel *presence) { @@ -5226,11 +5187,6 @@ void * linphone_core_get_native_video_window_id(const LinphoneCore *lc){ /* unsets the video id for all calls (indeed it may be kept by filters or videostream object itself by paused calls)*/ static void unset_video_window_id(LinphoneCore *lc, bool_t preview, void *id){ -#ifdef VIDEO_ENABLED - LinphoneCall *call; - bctbx_list_t *elem; -#endif - if ((id != NULL) #ifndef _WIN32 && ((unsigned long)id != (unsigned long)-1) @@ -5239,18 +5195,7 @@ static void unset_video_window_id(LinphoneCore *lc, bool_t preview, void *id){ ms_error("Invalid use of unset_video_window_id()"); return; } -#ifdef VIDEO_ENABLED - for(elem=lc->calls;elem!=NULL;elem=elem->next){ - call=(LinphoneCall *) elem->data; - VideoStream *vstream = reinterpret_cast(linphone_call_get_stream(call, LinphoneStreamTypeVideo)); - if (vstream){ - if (preview) - video_stream_set_native_preview_window_id(vstream,id); - else - video_stream_set_native_window_id(vstream,id); - } - } -#endif + L_GET_PRIVATE_FROM_C_OBJECT(lc)->unsetVideoWindowId(!!preview, id); } void linphone_core_set_native_video_window_id(LinphoneCore *lc, void *id){ @@ -5917,8 +5862,6 @@ void sip_config_uninit(LinphoneCore *lc) delete lc->sal; lc->sal=NULL; - lc->cppCore.~shared_ptr(); - if (lc->sip_conf.guessed_contact) ms_free(lc->sip_conf.guessed_contact); if (config->contact) @@ -6060,7 +6003,7 @@ LinphoneXmlRpcSession * linphone_core_create_xml_rpc_session(LinphoneCore *lc, c return linphone_xml_rpc_session_new(lc, url); } -static void linphone_core_uninit(LinphoneCore *lc) +void _linphone_core_uninit(LinphoneCore *lc) { bctbx_list_t *elem = NULL; int i=0; @@ -6068,12 +6011,7 @@ static void linphone_core_uninit(LinphoneCore *lc) linphone_task_list_free(&lc->hooks); lc->video_conf.show_local = FALSE; - while(lc->calls) { - LinphoneCall *the_call = reinterpret_cast(lc->calls->data); - linphone_call_terminate(the_call); - linphone_core_iterate(lc); - ms_usleep(10000); - } + L_GET_PRIVATE_FROM_C_OBJECT(lc)->uninit(); for (elem = lc->friends_lists; elem != NULL; elem = bctbx_list_next(elem)) { LinphoneFriendList *list = (LinphoneFriendList *)elem->data; @@ -6203,15 +6141,19 @@ static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable, linphone_core_invalidate_friend_subscriptions(lc); lc->sal->reset_transports(); /*mark all calls as broken, so that they can be either dropped immediately or restaured when network will be back*/ +#if 0 bctbx_list_for_each(lc->calls, (MSIterateFunc) linphone_call_set_broken); +#endif } } void linphone_core_repair_calls(LinphoneCore *lc){ +#if 0 if (lc->calls && lp_config_get_int(lc->config, "sip", "repair_broken_calls", 1) && lc->media_network_reachable){ /*if we are registered and there were broken calls due to a past network disconnection, attempt to repair them*/ bctbx_list_for_each(lc->calls, (MSIterateFunc) linphone_call_repair_if_broken); } +#endif } static void set_media_network_reachable(LinphoneCore* lc, bool_t is_media_reachable){ @@ -6221,10 +6163,14 @@ static void set_media_network_reachable(LinphoneCore* lc, bool_t is_media_reacha if (!lc->media_network_reachable){ /*mark all calls as broken, so that they can be either dropped immediately or restaured when network will be back*/ +#if 0 bctbx_list_for_each(lc->calls, (MSIterateFunc) linphone_call_set_broken); +#endif }else{ if (lp_config_get_int(lc->config, "net", "recreate_sockets_when_network_is_up", 0)){ +#if 0 bctbx_list_for_each(lc->calls, (MSIterateFunc)linphone_call_refresh_sockets); +#endif } linphone_core_repair_calls(lc); if (lc->bw_controller){ @@ -6287,80 +6233,12 @@ void linphone_core_destroy(LinphoneCore *lc){ linphone_core_unref(lc); } -int linphone_core_get_calls_nb(const LinphoneCore *lc){ - return (int)bctbx_list_size(lc->calls); +int linphone_core_get_calls_nb(const LinphoneCore *lc) { + return (int)L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getCallsNb(); } -/** - * Check if we do not have exceed the number of simultaneous call - * @ingroup call_control -**/ -bool_t linphone_core_can_we_add_call(LinphoneCore *lc) -{ - if(linphone_core_get_calls_nb(lc) < lc->max_calls) - return TRUE; - ms_message("Maximum amount of simultaneous calls reached !"); - return FALSE; -} - -static void notify_soundcard_usage(LinphoneCore *lc, bool_t used){ - MSSndCard *card=lc->sound_conf.capt_sndcard; - if (card && ms_snd_card_get_capabilities(card) & MS_SND_CARD_CAP_IS_SLOW){ - ms_snd_card_set_usage_hint(card,used); - } -} - -void linphone_core_soundcard_hint_check( LinphoneCore* lc){ - bctbx_list_t* the_calls = lc->calls; - LinphoneCall* call = NULL; - bool_t dont_need_sound = TRUE; - bool_t use_rtp_io = !!lp_config_get_int(lc->config, "sound", "rtp_io", FALSE); - bool_t use_rtp_io_enable_local_output = !!lp_config_get_int(lc->config, "sound", "rtp_io_enable_local_output", FALSE); - - /* check if the remaining calls are paused */ - while( the_calls ){ - call = reinterpret_cast(the_calls->data); - if (linphone_call_get_state(call) != LinphoneCallPausing && linphone_call_get_state(call) != LinphoneCallPaused - && linphone_call_get_state(call) != LinphoneCallEnd && linphone_call_get_state(call) != LinphoneCallError){ - dont_need_sound = FALSE; - break; - } - the_calls = the_calls->next; - } - /* if no more calls or all calls are paused, we can free the soundcard */ - if ( (lc->calls==NULL || dont_need_sound) && !lc->use_files && (!use_rtp_io || (use_rtp_io && use_rtp_io_enable_local_output))){ - ms_message("Notifying soundcard that we don't need it anymore for calls."); - notify_soundcard_usage(lc,FALSE); - } -} - -int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call) { - if (linphone_core_can_we_add_call(lc)){ - if (lc->calls==NULL) notify_soundcard_usage(lc,TRUE); - lc->calls = bctbx_list_append(lc->calls,call); - linphone_core_notify_call_created(lc, call); - return 0; - } - return -1; -} - -int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call) { - bctbx_list_t *it; - bctbx_list_t *the_calls = lc->calls; - - it=bctbx_list_find(the_calls,call); - if (it) - { - the_calls = bctbx_list_erase_link(the_calls,it); - } - else - { - ms_warning("could not find the call into the list\n"); - return -1; - } - lc->calls = the_calls; - - return 0; +void linphone_core_soundcard_hint_check(LinphoneCore* lc) { + L_GET_CPP_PTR_FROM_C_OBJECT(lc)->soundcardHintCheck(); } void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *file){ @@ -6754,31 +6632,8 @@ const char *linphone_core_get_user_certificates_path(LinphoneCore *lc){ return lc->user_certificates_path; } -bool_t linphone_core_sound_resources_locked(LinphoneCore *lc){ - bctbx_list_t *elem; - for(elem=lc->calls;elem!=NULL;elem=elem->next) { - LinphoneCall *c=(LinphoneCall*)elem->data; - - if (linphone_call_media_in_progress(c)) { - return TRUE; - } - - switch (linphone_call_get_state(c)) { - case LinphoneCallOutgoingInit: - case LinphoneCallOutgoingProgress: - case LinphoneCallOutgoingRinging: - case LinphoneCallOutgoingEarlyMedia: - case LinphoneCallConnected: - case LinphoneCallRefered: - case LinphoneCallIncomingEarlyMedia: - case LinphoneCallUpdating: - ms_message("Call %p is locking sound resources.",c); - return TRUE; - default: - break; - } - } - return FALSE; +bool_t linphone_core_sound_resources_locked(LinphoneCore *lc) { + return !!L_GET_CPP_PTR_FROM_C_OBJECT(lc)->areSoundResourcesLocked(); } void linphone_core_set_srtp_enabled(LinphoneCore *lc, bool_t enabled) { @@ -6883,7 +6738,7 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) { } void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) { - L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(lc->cppCore); + L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(L_GET_CPP_PTR_FROM_C_OBJECT(lc)); } void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) { @@ -7189,6 +7044,7 @@ LinphoneStatus linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *c } LinphoneStatus linphone_core_add_all_to_conference(LinphoneCore *lc) { +#if 0 bctbx_list_t *calls=lc->calls; while (calls) { LinphoneCall *call=(LinphoneCall*)calls->data; @@ -7200,6 +7056,7 @@ LinphoneStatus linphone_core_add_all_to_conference(LinphoneCore *lc) { if(lc->conf_ctx && linphone_conference_check_class(lc->conf_ctx, LinphoneConferenceClassLocal)) { linphone_core_enter_conference(lc); } +#endif return 0; } diff --git a/coreapi/misc.c b/coreapi/misc.c index 14604b538..ae1384348 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -60,6 +60,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc){ const bctbx_list_t *elem; int maxbw=LinphonePrivate::PayloadTypeHandler::getMinBandwidth(linphone_core_get_download_bandwidth(lc), @@ -176,7 +179,7 @@ int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, sock /* this functions runs a simple stun test and return the number of milliseconds to complete the tests, or -1 if the test were failed.*/ int linphone_run_stun_tests(LinphoneCore *lc, int audioPort, int videoPort, int textPort, char *audioCandidateAddr, int *audioCandidatePort, char *videoCandidateAddr, int *videoCandidatePort, char *textCandidateAddr, int *textCandidatePort) { - LinphonePrivate::StunClient *client = new LinphonePrivate::StunClient(lc->cppCore); + LinphonePrivate::StunClient *client = new LinphonePrivate::StunClient(L_GET_CPP_PTR_FROM_C_OBJECT(lc)); int ret = client->run(audioPort, videoPort, textPort); strncpy(audioCandidateAddr, client->getAudioCandidate().address.c_str(), LINPHONE_IPADDR_SIZE); *audioCandidatePort = client->getAudioCandidate().port; diff --git a/coreapi/nat_policy.c b/coreapi/nat_policy.c index 86f676412..a305fa6a7 100644 --- a/coreapi/nat_policy.c +++ b/coreapi/nat_policy.c @@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + static LinphoneNatPolicy * _linphone_nat_policy_new_with_ref(LinphoneCore *lc, const char *ref) { LinphoneNatPolicy *policy = belle_sip_object_new(LinphoneNatPolicy); policy->lc = lc; diff --git a/coreapi/payload_type.c b/coreapi/payload_type.c index b2b042181..75ccc1f94 100644 --- a/coreapi/payload_type.c +++ b/coreapi/payload_type.c @@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" #include "utils/payload-type-handler.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + struct _LinphonePayloadType { belle_sip_object_t base; OrtpPayloadType *pt; diff --git a/coreapi/player.c b/coreapi/player.c index 1bf49fd7f..39ee83e7b 100644 --- a/coreapi/player.c +++ b/coreapi/player.c @@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphonePlayer); BELLE_SIP_INSTANCIATE_VPTR(LinphonePlayer, belle_sip_object_t, diff --git a/coreapi/presence.c b/coreapi/presence.c index 071981d59..eea5c8980 100644 --- a/coreapi/presence.c +++ b/coreapi/presence.c @@ -23,6 +23,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + using namespace LinphonePrivate; extern const char *__policy_enum_to_str(LinphoneSubscribePolicy pol); diff --git a/coreapi/private.h b/coreapi/private.h index 7270f010b..37d433c90 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -112,19 +112,15 @@ #endif #endif -#include -#include -#include -#include - #ifdef SQLITE_STORAGE_ENABLED #include #endif -#ifdef __cplusplus -extern "C" { -#endif + +#include "private_structs.h" +#include "private_functions.h" +#include "core_private.h" #define STRING_RESET(field) if (field) bctbx_free(field); (field) = NULL @@ -132,951 +128,11 @@ extern "C" { #define STRING_TRANSFER(field, newvalue) do{ if (field){bctbx_free(field);field=NULL;}; field=newvalue; }while(0) - -struct _LinphoneQualityReporting{ - reporting_session_report_t * reports[3]; /**Store information on audio and video media streams (RFC 6035) */ - bool_t was_video_running; /*Keep video state since last check in order to detect its (de)activation*/ - LinphoneQualityReportingReportSendCb on_report_sent; -}; - -struct _LinphoneCallLog{ - belle_sip_object_t base; - void *user_data; - struct _LinphoneCore *lc; - LinphoneCallDir dir; /**< The direction of the call*/ - LinphoneCallStatus status; /**< The status of the call*/ - LinphoneAddress *from; /**= 6) || __GNUC__ > 4) -#pragma GCC diagnostic push -#endif -#if defined(__clang__) || defined(__GNUC__) -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif -#ifdef _MSC_VER -#pragma deprecated(message_state_changed_cb) -#endif - LinphoneChatMessageStateChangedCb message_state_changed_cb; -#if defined(__clang__) || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic pop -#endif -};*/ - -typedef struct StunCandidate{ - char addr[64]; - int port; -}StunCandidate; - - -typedef struct _PortConfig{ - char multicast_ip[LINPHONE_IPADDR_SIZE]; - char multicast_bind_ip[LINPHONE_IPADDR_SIZE]; - int rtp_port; - int rtcp_port; -}PortConfig; - -LinphoneCallCbs *_linphone_call_cbs_new(void); - - -void linphone_call_notify_state_changed(LinphoneCall *call, LinphoneCallState cstate, const char *message); -void linphone_call_notify_dtmf_received(LinphoneCall *call, int dtmf); -void linphone_call_notify_encryption_changed(LinphoneCall *call, bool_t on, const char *authentication_token); -void linphone_call_notify_transfer_state_changed(LinphoneCall *call, LinphoneCallState cstate); -void linphone_call_notify_stats_updated(LinphoneCall *call, const LinphoneCallStats *stats); -void linphone_call_notify_info_message_received(LinphoneCall *call, const LinphoneInfoMessage *msg); -void linphone_call_notify_ack_processing(LinphoneCall *call, LinphoneHeaders *msg, bool_t is_received); - -LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg); -LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, LinphonePrivate::SalCallOp *op); -void _linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams *params); -void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const char *message); -/* private: */ -LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress * to); -void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state); -LinphonePlayer *linphone_call_build_player(LinphoneCall*call); -void linphone_call_refresh_sockets(LinphoneCall *call); -void linphone_call_replace_op(LinphoneCall *call, LinphonePrivate::SalOp *op); -void linphone_call_reinvite_to_recover_from_connection_loss(LinphoneCall *call); - -LinphonePrivate::SalCallOp *linphone_call_get_op(const LinphoneCall *call); -LinphoneProxyConfig * linphone_call_get_dest_proxy(const LinphoneCall *call); -LINPHONE_PUBLIC MediaStream * linphone_call_get_stream(LinphoneCall *call, LinphoneStreamType type); -LinphoneCallLog * linphone_call_get_log(const LinphoneCall *call); -IceSession * linphone_call_get_ice_session(const LinphoneCall *call); -bool_t linphone_call_get_audio_muted(const LinphoneCall *call); -void linphone_call_set_audio_muted(LinphoneCall *call, bool_t value); -bool_t linphone_call_get_all_muted(const LinphoneCall *call); - -LinphoneCallParams * linphone_call_params_new(LinphoneCore *core); -SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params); -SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params); -SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params); -void linphone_call_params_set_custom_headers(LinphoneCallParams *params, const SalCustomHeader *ch); -void linphone_call_params_set_custom_sdp_attributes(LinphoneCallParams *params, const SalCustomSdpAttribute *csa); -void linphone_call_params_set_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type, const SalCustomSdpAttribute *csa); -bool_t linphone_call_params_get_in_conference(const LinphoneCallParams *params); -void linphone_call_params_set_in_conference(LinphoneCallParams *params, bool_t value); -bool_t linphone_call_params_get_internal_call_update(const LinphoneCallParams *params); -void linphone_call_params_set_internal_call_update(LinphoneCallParams *params, bool_t value); -bool_t linphone_call_params_implicit_rtcp_fb_enabled(const LinphoneCallParams *params); -void linphone_call_params_enable_implicit_rtcp_fb(LinphoneCallParams *params, bool_t value); -int linphone_call_params_get_down_bandwidth(const LinphoneCallParams *params); -void linphone_call_params_set_down_bandwidth(LinphoneCallParams *params, int value); -int linphone_call_params_get_up_bandwidth(const LinphoneCallParams *params); -void linphone_call_params_set_up_bandwidth(LinphoneCallParams *params, int value); -int linphone_call_params_get_down_ptime(const LinphoneCallParams *params); -void linphone_call_params_set_down_ptime(LinphoneCallParams *params, int value); -int linphone_call_params_get_up_ptime(const LinphoneCallParams *params); -void linphone_call_params_set_up_ptime(LinphoneCallParams *params, int value); -SalCustomHeader * linphone_call_params_get_custom_headers(const LinphoneCallParams *params); -SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_attributes(const LinphoneCallParams *params); -SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_media_attributes(const LinphoneCallParams *params, LinphoneStreamType type); -LinphoneCall * linphone_call_params_get_referer(const LinphoneCallParams *params); -void linphone_call_params_set_referer(LinphoneCallParams *params, LinphoneCall *referer); -bool_t linphone_call_params_get_update_call_when_ice_completed(const LinphoneCallParams *params); -void linphone_call_params_set_update_call_when_ice_completed(LinphoneCallParams *params, bool_t value); -void linphone_call_params_set_sent_vsize(LinphoneCallParams *params, MSVideoSize vsize); -void linphone_call_params_set_recv_vsize(LinphoneCallParams *params, MSVideoSize vsize); -void linphone_call_params_set_sent_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef); -void linphone_call_params_set_received_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef); -void linphone_call_params_set_sent_fps(LinphoneCallParams *params, float value); -void linphone_call_params_set_received_fps(LinphoneCallParams *params, float value); -void linphone_call_params_set_used_audio_codec(LinphoneCallParams *params, OrtpPayloadType *codec); -void linphone_call_params_set_used_video_codec(LinphoneCallParams *params, OrtpPayloadType *codec); -void linphone_call_params_set_used_text_codec(LinphoneCallParams *params, OrtpPayloadType *codec); -bool_t linphone_call_params_get_no_user_consent(const LinphoneCallParams *params); -void linphone_call_params_set_no_user_consent(LinphoneCallParams *params, bool_t value); - -void linphone_auth_info_write_config(LinphoneConfig *config, LinphoneAuthInfo *obj, int pos); -LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos); -void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai); -const LinphoneAuthInfo *_linphone_core_find_tls_auth_info(LinphoneCore *lc); -const LinphoneAuthInfo *_linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *domain, bool_t ignore_realm); - -void linphone_core_update_proxy_register(LinphoneCore *lc); -const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc); - -int linphone_proxy_config_send_publish(LinphoneProxyConfig *cfg, LinphonePresenceModel *presence); -void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState rstate, const char *message); -void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig *obj); -void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc); -void _linphone_proxy_config_release(LinphoneProxyConfig *cfg); -void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj); -void linphone_proxy_config_notify_publish_state_changed(LinphoneProxyConfig *cfg, LinphonePublishState state); -LinphoneEvent *linphone_proxy_config_create_publish(LinphoneProxyConfig *cfg, const char *event, int expires); -/* - * returns service route as defined in as defined by rfc3608, might be a list instead of just one. - * Can be NULL - * */ -const LinphoneAddress* linphone_proxy_config_get_service_route(const LinphoneProxyConfig* cfg); -const LinphoneAddress *_linphone_proxy_config_get_contact_without_params (const LinphoneProxyConfig *cfg); - -void linphone_friend_list_invalidate_subscriptions(LinphoneFriendList *list); -void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, LinphoneEvent *lev, const LinphoneContent *body); -void linphone_friend_list_subscription_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state); -void _linphone_friend_list_release(LinphoneFriendList *list); -/*get rls either from list or core if any*/ -const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFriendList *list); - -LINPHONE_PUBLIC void linphone_friend_invalidate_subscription(LinphoneFriend *lf); -void linphone_friend_close_subscriptions(LinphoneFriend *lf); -void _linphone_friend_release(LinphoneFriend *lf); -LINPHONE_PUBLIC void linphone_friend_update_subscribes(LinphoneFriend *fr, bool_t only_when_registered); -void linphone_friend_notify(LinphoneFriend *lf, LinphonePresenceModel *presence); -void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc); -void linphone_friend_add_incoming_subscription(LinphoneFriend *lf, LinphonePrivate::SalOp *op); -void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, LinphonePrivate::SalOp *op); -const char * linphone_friend_phone_number_to_sip_uri(LinphoneFriend *lf, const char *phone_number); -const char * linphone_friend_sip_uri_to_phone_number(LinphoneFriend *lf, const char *uri); -void linphone_friend_clear_presence_models(LinphoneFriend *lf); -LinphoneFriend *linphone_friend_list_find_friend_by_inc_subscribe(const LinphoneFriendList *list, LinphonePrivate::SalOp *op); -LinphoneFriend *linphone_friend_list_find_friend_by_out_subscribe(const LinphoneFriendList *list, LinphonePrivate::SalOp *op); -LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *lc, LinphonePrivate::SalOp *op); -LinphoneFriend *linphone_core_find_friend_by_inc_subscribe(const LinphoneCore *lc, LinphonePrivate::SalOp *op); -MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf); -bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc); -void linphone_core_update_friends_subscriptions(LinphoneCore *lc); -void _linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered); -void linphone_core_friends_storage_init(LinphoneCore *lc); -void linphone_core_friends_storage_close(LinphoneCore *lc); -void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf); -void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf); -void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList *list); -void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendList *list); -LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list); -LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc); -LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize); - -int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port); -int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen, int default_port); - -bool_t host_has_ipv6_network(void); -bool_t lp_spawn_command_line_sync(const char *command, char **result,int *command_ret); - -static MS2_INLINE void set_string(char **dest, const char *src, bool_t lowercase){ - if (*dest){ - ms_free(*dest); - *dest=NULL; - } - if (src) { - *dest=ms_strdup(src); - if (lowercase) { - char *cur = *dest; - for (; *cur; cur++) *cur = (char)tolower(*cur); - } - } -} - -void linphone_process_authentication(LinphoneCore* lc, LinphonePrivate::SalOp *op); -void linphone_authentication_ok(LinphoneCore *lc, LinphonePrivate::SalOp *op); -void linphone_subscription_new(LinphoneCore *lc, LinphonePrivate::SalSubscribeOp *op, const char *from); -void linphone_core_send_presence(LinphoneCore *lc, LinphonePresenceModel *presence); -void linphone_notify_parse_presence(const char *content_type, const char *content_subtype, const char *body, SalPresenceModel **result); -void linphone_notify_convert_presence_to_xml(LinphonePrivate::SalOp *op, SalPresenceModel *presence, const char *contact, char **content); -void linphone_notify_recv(LinphoneCore *lc, LinphonePrivate::SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model); -void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, LinphonePrivate::SalOp *op); -void linphone_core_soundcard_hint_check(LinphoneCore* lc); - - -void linphone_subscription_answered(LinphoneCore *lc, LinphonePrivate::SalOp *op); -void linphone_subscription_closed(LinphoneCore *lc, LinphonePrivate::SalOp *op); - -void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); - -LINPHONE_PUBLIC int linphone_run_stun_tests(LinphoneCore *lc, int audioPort, int videoPort, int textPort, - char *audioCandidateAddr, int *audioCandidatePort, char *videoCandidateAddr, int *videoCandidatePort, char *textCandidateAddr, int *textCandidatePort); -void linphone_core_resolve_stun_server(LinphoneCore *lc); -LINPHONE_PUBLIC const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc); -LINPHONE_PUBLIC void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable); -LINPHONE_PUBLIC void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable); -void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call); -LINPHONE_PUBLIC void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev); -void linphone_call_stats_update(LinphoneCallStats *stats, MediaStream *stream); -LinphoneCallStats *_linphone_call_stats_new(void); -void _linphone_call_stats_uninit(LinphoneCallStats *stats); -void _linphone_call_stats_clone(LinphoneCallStats *dst, const LinphoneCallStats *src); -void _linphone_call_stats_set_ice_state (LinphoneCallStats *stats, LinphoneIceState state); -void _linphone_call_stats_set_type (LinphoneCallStats *stats, LinphoneStreamType type); -mblk_t *_linphone_call_stats_get_received_rtcp (const LinphoneCallStats *stats); -void _linphone_call_stats_set_received_rtcp (LinphoneCallStats *stats, mblk_t *m); -void _linphone_call_stats_set_sent_rtcp (LinphoneCallStats *stats, mblk_t *m); -int _linphone_call_stats_get_updated (const LinphoneCallStats *stats); -void _linphone_call_stats_set_updated (LinphoneCallStats *stats, int updated); -void _linphone_call_stats_set_rtp_stats (LinphoneCallStats *stats, const rtp_stats_t *rtpStats); -void _linphone_call_stats_set_download_bandwidth (LinphoneCallStats *stats, float bandwidth); -void _linphone_call_stats_set_upload_bandwidth (LinphoneCallStats *stats, float bandwidth); -void _linphone_call_stats_set_rtcp_download_bandwidth (LinphoneCallStats *stats, float bandwidth); -void _linphone_call_stats_set_rtcp_upload_bandwidth (LinphoneCallStats *stats, float bandwidth); -void _linphone_call_stats_set_ip_family_of_remote (LinphoneCallStats *stats, LinphoneAddressFamily family); -bool_t _linphone_call_stats_rtcp_received_via_mux (const LinphoneCallStats *stats); -void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call); -void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer); -void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md); -bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md); - -void linphone_core_send_initial_subscribes(LinphoneCore *lc); -void linphone_core_write_friends_config(LinphoneCore* lc); -void linphone_friend_write_to_config_file(LinphoneConfig *config, LinphoneFriend *lf, int index); -LinphoneFriend * linphone_friend_new_from_config_file(struct _LinphoneCore *lc, int index); - -void linphone_proxy_config_update(LinphoneProxyConfig *cfg); -LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneAddress *uri); -const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAddress *to); -int linphone_core_get_local_ip_for(int type, const char *dest, char *result); -LINPHONE_PUBLIC void linphone_core_get_local_ip(LinphoneCore *lc, int af, const char *dest, char *result); - -LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore *lc, int index); -void linphone_proxy_config_write_to_config_file(LinphoneConfig* config,LinphoneProxyConfig *obj, int index); - -int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *msg); -void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call); - -void linphone_call_init_media_streams(LinphoneCall *call); -void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); -void linphone_call_stop_media_streams(LinphoneCall *call); -void linphone_call_delete_upnp_session(LinphoneCall *call); -int _linphone_core_apply_transports(LinphoneCore *lc); - -void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose); -void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses); -void linphone_core_stop_waiting(LinphoneCore *lc); - -int linphone_call_proceed_with_invite_if_ready(LinphoneCall *call, LinphoneProxyConfig *dest_proxy); -int linphone_call_start_invite(LinphoneCall *call, const LinphoneAddress *destination/* = NULL if to be taken from the call log */); -/* - * param automatic_offering aims is to take into account previous answer for video in case of automatic re-invite. - * Purpose is to avoid to re-ask video previously declined */ -int linphone_call_start_update(LinphoneCall *call); -int linphone_call_start_accept_update(LinphoneCall *call, LinphoneCallState next_state, const char *state_info); -void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call); -bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md); -extern LinphonePrivate::Sal::Callbacks linphone_sal_callbacks; -LINPHONE_PUBLIC bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc); -LINPHONE_PUBLIC bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc); -bool_t _linphone_core_is_conference_creation (const LinphoneCore *lc, const LinphoneAddress *addr); -LinphoneChatRoom *_linphone_core_create_server_group_chat_room (LinphoneCore *lc, LinphonePrivate::SalCallOp *op); - -void linphone_core_queue_task(LinphoneCore *lc, belle_sip_source_func_t task_fun, void *data, const char *task_description); - - -LINPHONE_PUBLIC LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_address_equal(const LinphoneAddress *a, const LinphoneAddress *b); -LINPHONE_PUBLIC LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_config_changed(const LinphoneProxyConfig* obj); -/** - * unregister without moving the register_enable flag - */ -void _linphone_proxy_config_unregister(LinphoneProxyConfig *obj); -void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj); - -/*chat*/ -LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, const char *uri, const char *subject); -LinphoneChatRoom *_linphone_server_group_chat_room_new (LinphoneCore *core, LinphonePrivate::SalCallOp *op); -void linphone_chat_room_release(LinphoneChatRoom *cr); -void linphone_chat_room_set_call(LinphoneChatRoom *cr, LinphoneCall *call); -LinphoneChatRoomCbs * linphone_chat_room_cbs_new (void); -/**/ - -struct _LinphoneProxyConfig -{ - belle_sip_object_t base; - void *user_data; - struct _LinphoneCore *lc; - LinphoneErrorInfo *ei; - char *reg_proxy; - char *reg_identity; - LinphoneAddress* identity_address; - LinphoneAddress *contact_address; - LinphoneAddress *contact_address_without_params; - char *reg_route; - char *quality_reporting_collector; - char *realm; - char *contact_params; - char *contact_uri_params; - int expires; - int publish_expires; - LinphonePrivate::SalRegisterOp *op; - SalCustomHeader *sent_headers; - char *type; - struct _SipSetupContext *ssctx; - int auth_failures; - char *dial_prefix; - LinphoneRegistrationState state; - LinphoneAVPFMode avpf_mode; - LinphoneNatPolicy *nat_policy; - - bool_t commit; - bool_t reg_sendregister; - bool_t publish; - bool_t dial_escape_plus; - - bool_t send_publish; - bool_t quality_reporting_enabled; - uint8_t avpf_rr_interval; - uint8_t quality_reporting_interval; - - time_t deletion_date; - LinphonePrivacyMask privacy; - /*use to check if server config has changed between edit() and done()*/ - LinphoneAddress *saved_proxy; - LinphoneAddress *saved_identity; - bool_t register_changed; - bool_t unused[3]; - /*---*/ - LinphoneAddress *pending_contact; /*use to store previous contact in case of network failure*/ - LinphoneEvent *presence_publish_event; - unsigned long long previous_publish_config_hash[2]; - - char *refkey; - char *sip_etag; /*publish context*/ -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneProxyConfig); - -struct _LinphoneAuthInfo -{ - belle_sip_object_t base; - char *username; - char *realm; - char *userid; - char *passwd; - char *ha1; - char *domain; - char *tls_cert; - char *tls_key; - char *tls_cert_path; - char *tls_key_path; - char *algorithm; -}; - -typedef enum _LinphoneIsComposingState { - LinphoneIsComposingIdle, - LinphoneIsComposingActive -} LinphoneIsComposingState; - -typedef struct _LinphoneChatMessageCharacter { - uint32_t value; - bool_t has_been_read; -} LinphoneChatMessageCharacter; - - -typedef struct _LinphoneFriendPresence { - char *uri_or_tel; - LinphonePresenceModel *presence; -} LinphoneFriendPresence; - -typedef struct _LinphoneFriendPhoneNumberSipUri { - char *number; - char *uri; -} LinphoneFriendPhoneNumberSipUri; - -struct _LinphoneFriend{ - belle_sip_object_t base; - void *user_data; - LinphoneAddress *uri; - MSList *insubs; /*list of SalOp. There can be multiple instances of a same Friend that subscribe to our presence*/ - LinphonePrivate::SalPresenceOp *outsub; - LinphoneSubscribePolicy pol; - MSList *presence_models; /* list of LinphoneFriendPresence. It associates SIP URIs and phone numbers with their respective presence models. */ - MSList *phone_number_sip_uri_map; /* list of LinphoneFriendPhoneNumberSipUri. It associates phone numbers with their corresponding SIP URIs. */ - struct _LinphoneCore *lc; - BuddyInfo *info; - char *refkey; - bool_t subscribe; - bool_t subscribe_active; - bool_t inc_subscribe_pending; - bool_t commit; - bool_t initial_subscribes_sent; /*used to know if initial subscribe message was sent or not*/ - bool_t presence_received; - LinphoneVcard *vcard; - unsigned int storage_id; - LinphoneFriendList *friend_list; - LinphoneSubscriptionState out_sub_state; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneFriend); - -struct _LinphoneFriendListCbs { - belle_sip_object_t base; - void *user_data; - LinphoneFriendListCbsContactCreatedCb contact_created_cb; - LinphoneFriendListCbsContactDeletedCb contact_deleted_cb; - LinphoneFriendListCbsContactUpdatedCb contact_updated_cb; - LinphoneFriendListCbsSyncStateChangedCb sync_state_changed_cb; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneFriendListCbs); - -struct _LinphoneFriendList { - belle_sip_object_t base; - void *user_data; - LinphoneCore *lc; - LinphoneEvent *event; - char *display_name; - char *rls_uri; /*this field is take in sync with rls_addr*/ - LinphoneAddress *rls_addr; - MSList *friends; - bctbx_map_t *friends_map; - bctbx_map_t *friends_map_uri; - unsigned char *content_digest; - int expected_notification_version; - unsigned int storage_id; - char *uri; - MSList *dirty_friends_to_update; - int revision; - LinphoneFriendListCbs *cbs; - bool_t enable_subscriptions; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneFriendList); - - - -typedef struct sip_config -{ - char *contact; - char *guessed_contact; - MSList *proxies; - MSList *deleted_proxies; - int inc_timeout; /*timeout after an un-answered incoming call is rejected*/ - int in_call_timeout; /*timeout after a call is hangup */ - int delayed_timeout; /*timeout after a delayed call is resumed */ - unsigned int keepalive_period; /* interval in ms between keep alive messages sent to the proxy server*/ - LinphoneSipTransports transports; - bool_t guess_hostname; - bool_t loopback_only; - bool_t ipv6_enabled; - bool_t sdp_200_ack; - bool_t register_only_when_network_is_up; - bool_t register_only_when_upnp_is_ok; - bool_t ping_with_options; - bool_t auto_net_state_mon; - bool_t tcp_tls_keepalive; - bool_t vfu_with_info; /*use to enable vfu request using sip info*/ - bool_t save_auth_info; // if true, auth infos will be write in the config file when they are added to the list -} sip_config_t; - -typedef struct rtp_config -{ - int audio_rtp_min_port; - int audio_rtp_max_port; - int video_rtp_min_port; - int video_rtp_max_port; - int audio_jitt_comp; /*jitter compensation*/ - int video_jitt_comp; /*jitter compensation*/ - int nortp_timeout; - int disable_upnp; - MSCryptoSuite *srtp_suites; - LinphoneAVPFMode avpf_mode; - bool_t rtp_no_xmit_on_audio_mute; - /* stop rtp xmit when audio muted */ - bool_t audio_adaptive_jitt_comp_enabled; - bool_t video_adaptive_jitt_comp_enabled; - bool_t pad; - char* audio_multicast_addr; - bool_t audio_multicast_enabled; - int audio_multicast_ttl; - char* video_multicast_addr; - int video_multicast_ttl; - bool_t video_multicast_enabled; - int text_rtp_min_port; - int text_rtp_max_port; -}rtp_config_t; - - - -typedef struct net_config -{ - char *nat_address; /* may be IP or host name */ - char *nat_address_ip; /* ip translated from nat_address */ - struct addrinfo *stun_addrinfo; - int download_bw; - int upload_bw; - int mtu; - OrtpNetworkSimulatorParams netsim_params; - bool_t nat_sdp_only; -}net_config_t; - - -typedef struct sound_config -{ - struct _MSSndCard * ring_sndcard; /* the playback sndcard currently used */ - struct _MSSndCard * play_sndcard; /* the playback sndcard currently used */ - struct _MSSndCard * capt_sndcard; /* the capture sndcard currently used */ - struct _MSSndCard * lsd_card; /* dummy playback card for Linphone Sound Daemon extension */ - const char **cards; - int latency; /* latency in samples of the current used sound device */ - float soft_play_lev; /*playback gain in db.*/ - float soft_mic_lev; /*mic gain in db.*/ - char rec_lev; - char play_lev; - char ring_lev; - char source; - char *local_ring; - char *remote_ring; - char *ringback_tone; - bool_t ec; - bool_t ea; - bool_t agc; -} sound_config_t; - -typedef struct codecs_config -{ - MSList *audio_codecs; /* list of audio codecs in order of preference*/ - MSList *video_codecs; - MSList *text_codecs; - int dyn_pt; - int telephone_event_pt; -}codecs_config_t; - -typedef struct video_config{ - struct _MSWebCam *device; - const char **cams; - MSVideoSize vsize; - MSVideoSize preview_vsize; /*is 0,0 if no forced preview size is set, in which case vsize field above is used.*/ - LinphoneVideoDefinition *vdef; - LinphoneVideoDefinition *preview_vdef; - float fps; - bool_t capture; - bool_t show_local; - bool_t display; - bool_t selfview; /*during calls*/ - bool_t reuse_preview_source; -}video_config_t; - -typedef struct text_config{ - bool_t enabled; -}text_config_t; - -typedef struct ui_config -{ - int is_daemon; - int is_applet; - unsigned int timer_id; /* the timer id for registration */ -}ui_config_t; - - - -typedef struct autoreplier_config -{ - int enabled; - int after_seconds; /* accept the call after x seconds*/ - int max_users; /* maximum number of user that can call simultaneously */ - int max_rec_time; /* the max time of incoming voice recorded */ - int max_rec_msg; /* maximum number of recorded messages */ - const char *message; /* the path of the file to be played */ -}autoreplier_config_t; - - -typedef struct _LinphoneToneDescription{ - LinphoneReason reason; /*the call error code*/ - LinphoneToneID toneid; /*A tone type to play when this error arrives. This is played using tone generator*/ - char *audiofile; /*An override audio file to play instead, when this error arrives*/ - /*Note that some tones are not affected to any error, in which case it is affected LinphoneReasonNone*/ -}LinphoneToneDescription; - -LinphoneToneDescription * linphone_tone_description_new(LinphoneReason reason, LinphoneToneID id, const char *audiofile); -void linphone_tone_description_destroy(LinphoneToneDescription *obj); -LinphoneToneDescription *linphone_core_get_call_error_tone(const LinphoneCore *lc, LinphoneReason reason); -void linphone_core_play_call_error_tone(LinphoneCore *lc, LinphoneReason reason); -void _linphone_core_set_tone(LinphoneCore *lc, LinphoneReason reason, LinphoneToneID id, const char *audiofile); -LINPHONE_PUBLIC const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID id); - -typedef struct _LinphoneTaskList{ - MSList *hooks; -}LinphoneTaskList; - -void linphone_task_list_init(LinphoneTaskList *t); -void linphone_task_list_add(LinphoneTaskList *t, LinphoneCoreIterateHook hook, void *hook_data); -void linphone_task_list_remove(LinphoneTaskList *t, LinphoneCoreIterateHook hook, void *hook_data); -void linphone_task_list_run(LinphoneTaskList *t); -void linphone_task_list_free(LinphoneTaskList *t); - - -struct _LinphoneCoreCbs { - belle_sip_object_t base; - LinphoneCoreVTable *vtable; - bool_t autorelease; -}; - -LinphoneCoreCbs * _linphone_core_cbs_new(void); -void _linphone_core_cbs_set_v_table(LinphoneCoreCbs *cbs, LinphoneCoreVTable *vtable, bool_t autorelease); - -typedef struct _LCCallbackObj { - LinphoneCoreCbFunc _func; - void *_user_data; -} LCCallbackObj; - -namespace LinphonePrivate { - class Core; -}; - -struct _LinphoneCore -{ - belle_sip_object_t base; - MSFactory* factory; - MSList* vtable_refs; - int vtable_notify_recursion; - LinphonePrivate::Sal *sal; - - // For migration purposes - std::shared_ptr cppCore; - - void *platform_helper; /*is a LinphonePrivate::PlatformHelpers but cannot be used as is because private.h is compiled as C in testers.*/ - - LinphoneGlobalState state; - struct _LpConfig *config; - MSList *default_audio_codecs; - MSList *default_video_codecs; - MSList *default_text_codecs; - net_config_t net_conf; - sip_config_t sip_conf; - rtp_config_t rtp_conf; - sound_config_t sound_conf; - video_config_t video_conf; - text_config_t text_conf; - codecs_config_t codecs_conf; - ui_config_t ui_conf; - autoreplier_config_t autoreplier_conf; - LinphoneProxyConfig *default_proxy; - MSList *friends_lists; - MSList *auth_info; - struct _RingStream *ringstream; - time_t dmfs_playing_start_time; - LCCallbackObj preview_finished_cb; - LinphoneCall *current_call; /* the current call */ - MSList *calls; /* all the processed calls */ - MSList *queued_calls; /* used by the autoreplier */ - MSList *call_logs; - int max_call_logs; - int missed_calls; - VideoPreview *previewstream; - struct _MSEventQueue *msevq; - LinphoneRtpTransportFactories *rtptf; - MSList *bl_reqs; - MSList *subscribers; /* unknown subscribers */ - int minutes_away; - LinphonePresenceModel *presence_model; - void *data; - char *play_file; - char *rec_file; - uint64_t prevtime_ms; - int audio_bw; /*IP bw consumed by audio codec, set as soon as used codec is known, its purpose is to know the remaining bw for video*/ - LinphoneCoreWaitingCallback wait_cb; - void *wait_ctx; - void *video_window_id; - void *preview_window_id; - time_t netup_time; /*time when network went reachable */ - struct _EcCalibrator *ecc; - struct _EchoTester *ect; - LinphoneTaskList hooks; /*tasks periodically executed in linphone_core_iterate()*/ - LinphoneConference *conf_ctx; - char* zrtp_secrets_cache; /**< zrtp cache filename */ - char* user_certificates_path; - LinphoneVideoPolicy video_policy; - time_t network_last_check; - LinphoneNatPolicy *nat_policy; - LinphoneImNotifPolicy *im_notif_policy; - - bool_t use_files; - bool_t apply_nat_settings; - bool_t initial_subscribes_sent; - bool_t bl_refresh; - - bool_t preview_finished; - bool_t auto_net_state_mon; - bool_t sip_network_reachable; - bool_t media_network_reachable; - - bool_t network_reachable_to_be_notified; /*set to true when state must be notified in next iterate*/ - bool_t use_preview_window; - bool_t network_last_status; - bool_t ringstream_autorelease; - - bool_t vtables_running; - bool_t send_call_stats_periodical_updates; - bool_t forced_ice_relay; - bool_t short_turn_refresh; - - char localip[LINPHONE_IPADDR_SIZE]; - int device_rotation; - int max_calls; - LinphoneTunnel *tunnel; - char* device_id; - char *logs_db_file; - char *friends_db_file; -#ifdef SQLITE_STORAGE_ENABLED - sqlite3 *zrtp_cache_db; /**< zrtp sqlite cache, used by both zrtp and lime */ - sqlite3 *logs_db; - sqlite3 *friends_db; - bool_t debug_storage; -#endif - belle_http_provider_t *http_provider; - belle_tls_crypto_config_t *http_crypto_config; - belle_http_request_listener_t *provisioning_http_listener; -#ifdef ENABLE_UPDATE_CHECK - belle_http_request_listener_t *update_check_http_listener; - char *update_check_current_version; -#endif - MSList *tones; - LinphoneReason chat_deny_code; - char *file_transfer_server; - const char **supported_formats; - LinphoneContent *log_collection_upload_information; - LinphoneCoreCbs *current_cbs; // the latest LinphoneCoreCbs object to call a callback, see linphone_core_get_current_cbs() - LinphoneRingtonePlayer *ringtoneplayer; - LinphoneVcardContext *vcard_context; - - /*for tests only*/ - bool_t zrtp_not_available_simulation; - - /* string for TLS auth instead of path to files */ - char *tls_cert; - char *tls_key; - - LinphoneAddress *default_rls_addr; /*default resource list server*/ - LinphoneImEncryptionEngine *im_encryption_engine; - struct _LinphoneAccountCreatorService *default_ac_service; - MSBandwidthController *bw_controller; - - // For migration purpose. - bctbx_list_t *chat_rooms; -}; - #ifdef __cplusplus #define getPlatformHelpers(lc) static_cast(lc->platform_helper) #endif -struct _LinphoneEvent{ - belle_sip_object_t base; - LinphoneErrorInfo *ei; - LinphoneSubscriptionDir dir; - LinphoneCore *lc; - LinphonePrivate::SalEventOp *op; - SalCustomHeader *send_custom_headers; - LinphoneSubscriptionState subscription_state; - LinphonePublishState publish_state; - void *userdata; - char *name; - int expires; - bool_t terminating; - bool_t is_out_of_dialog_op; /*used for out of dialog notify*/ - bool_t internal; - bool_t oneshot; - - // For migration purpose. (Do not use directly!) - // Cache. - LinphoneAddress *to_address; - LinphoneAddress *from_address; - LinphoneAddress *remote_contact_address; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneEvent); - -LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc); -void linphone_tunnel_configure(LinphoneTunnel *tunnel); -void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler); - -/** - * Check if we do not have exceed the number of simultaneous call - * - * @ingroup call_control -**/ -bool_t linphone_core_can_we_add_call(LinphoneCore *lc); - -int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call); -int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call); -int linphone_core_get_calls_nb(const LinphoneCore *lc); - -void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message); -void linphone_call_update_biggest_desc(LinphoneCall *call, SalMediaDescription *md); -void linphone_call_make_local_media_description(LinphoneCall *call); -void linphone_call_make_local_media_description_with_params(LinphoneCore *lc, LinphoneCall *call, LinphoneCallParams *params); - -bool_t linphone_core_is_payload_type_usable_for_bandwidth(const LinphoneCore *lc, const PayloadType *pt, int bandwidth_limit); - -#define linphone_core_ready(lc) ((lc)->state==LinphoneGlobalOn || (lc)->state==LinphoneGlobalShutdown) -void _linphone_core_configure_resolver(void); - -void linphone_core_initialize_supported_content_types(LinphoneCore *lc); - -struct _EcCalibrator{ - MSFactory *factory; - ms_thread_t thread; - MSSndCard *play_card,*capt_card; - MSFilter *sndread,*det,*rec; - MSFilter *play, *gen, *sndwrite; - MSFilter *read_resampler,*write_resampler; - MSTicker *ticker; -#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic push -#endif -#ifdef _MSC_VER -#pragma warning(disable : 4996) -#else -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - LinphoneEcCalibrationCallback cb; - void *cb_data; - LinphoneEcCalibrationAudioInit audio_init_cb; - LinphoneEcCalibrationAudioUninit audio_uninit_cb; -#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) -#pragma GCC diagnostic pop -#endif - int64_t acc; - int delay; - unsigned int rate; - LinphoneEcCalibratorStatus status; - bool_t freq1,freq2,freq3; - bool_t play_cool_tones; -}; - -typedef struct _EcCalibrator EcCalibrator; - -LinphoneEcCalibratorStatus ec_calibrator_get_status(EcCalibrator *ecc); - -void ec_calibrator_destroy(EcCalibrator *ecc); - -struct _EchoTester { - MSFactory *factory; - MSFilter *in,*out; - MSSndCard *capture_card; - MSSndCard *playback_card; - MSTicker *ticker; - unsigned int rate; -}; - -typedef struct _EchoTester EchoTester; - -void linphone_call_set_broken(LinphoneCall *call); -void linphone_call_repair_if_broken(LinphoneCall *call); -void linphone_core_repair_calls(LinphoneCore *lc); -int linphone_core_preempt_sound_resources(LinphoneCore *lc); -int _linphone_call_pause(LinphoneCall *call); - -/*conferencing subsystem*/ -void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted); -bool_t linphone_core_sound_resources_available(LinphoneCore *lc); -void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall); -LINPHONE_PUBLIC unsigned int linphone_core_get_audio_features(LinphoneCore *lc); - -void _linphone_core_codec_config_write(LinphoneCore *lc); - #define HOLD_OFF (0) #define HOLD_ON (1) @@ -1093,503 +149,6 @@ void _linphone_core_codec_config_write(LinphoneCore *lc); #endif #endif -LINPHONE_PUBLIC bctbx_list_t * linphone_core_read_call_logs_from_config_file(LinphoneCore *lc); -void call_logs_write_to_config_file(LinphoneCore *lc); -void linphone_core_call_log_storage_init(LinphoneCore *lc); -void linphone_core_call_log_storage_close(LinphoneCore *lc); -void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log); -LINPHONE_PUBLIC const MSList *linphone_core_get_call_history(LinphoneCore *lc); -LINPHONE_PUBLIC void linphone_core_delete_call_history(LinphoneCore *lc); -LINPHONE_PUBLIC void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log); -LINPHONE_PUBLIC int linphone_core_get_call_history_size(LinphoneCore *lc); - -int linphone_core_get_edge_bw(LinphoneCore *lc); -int linphone_core_get_edge_ptime(LinphoneCore *lc); - -LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata, void *system_context); - -int linphone_upnp_init(LinphoneCore *lc); -void linphone_upnp_destroy(LinphoneCore *lc); - -#ifdef SQLITE_STORAGE_ENABLED -int _linphone_sqlite3_open(const char *db_file, sqlite3 **db); -#endif - -void linphone_chat_message_set_time(LinphoneChatMessage* msg, time_t time); -void linphone_chat_message_set_incoming(LinphoneChatMessage *msg); -void linphone_chat_message_set_outgoing(LinphoneChatMessage *msg); -LinphoneChatMessageStateChangedCb linphone_chat_message_get_message_state_changed_cb(LinphoneChatMessage* msg); -void linphone_chat_message_set_message_state_changed_cb(LinphoneChatMessage* msg, LinphoneChatMessageStateChangedCb cb); -void linphone_chat_message_set_message_state_changed_cb_user_data(LinphoneChatMessage* msg, void *user_data); -void * linphone_chat_message_get_message_state_changed_cb_user_data(LinphoneChatMessage* msg); -void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state); -void linphone_chat_message_set_message_id(LinphoneChatMessage *msg, char *id); -void linphone_chat_message_set_storage_id(LinphoneChatMessage *msg, unsigned int id); -SalCustomHeader * linphone_chat_message_get_sal_custom_headers(const LinphoneChatMessage *msg); -void linphone_chat_message_set_sal_custom_headers(LinphoneChatMessage *msg, SalCustomHeader *header); -belle_http_request_t * linphone_chat_message_get_http_request(const LinphoneChatMessage *msg); -void linphone_chat_message_set_http_request(LinphoneChatMessage *msg, belle_http_request_t *request); -void linphone_chat_message_set_file_transfer_information(LinphoneChatMessage *msg, LinphoneContent *content); -LinphoneChatMessageDir linphone_chat_message_get_direction(const LinphoneChatMessage *msg); -LinphonePrivate::SalOp * linphone_chat_message_get_sal_op(const LinphoneChatMessage *msg); -void linphone_chat_message_set_sal_op(LinphoneChatMessage *msg, LinphonePrivate::SalOp *op); -void linphone_chat_message_destroy(LinphoneChatMessage* msg); -void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state); -void linphone_chat_message_set_is_secured(LinphoneChatMessage *msg, bool_t secured); -void linphone_chat_message_send_delivery_notification(LinphoneChatMessage *cm, LinphoneReason reason); -void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm); -void _linphone_chat_message_cancel_file_transfer(LinphoneChatMessage *msg, bool_t unref); -int linphone_chat_room_upload_file(LinphoneChatMessage *msg); -LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call); -void linphone_chat_room_remove_transient_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg); -void linphone_chat_message_deactivate(LinphoneChatMessage *msg); -void linphone_chat_message_release(LinphoneChatMessage *msg); -void linphone_chat_message_fetch_content_from_database(sqlite3 *db, LinphoneChatMessage *message, int content_id); - -void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID id); -bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc); -const char *linphone_core_create_uuid(LinphoneCore *lc); -void linphone_configure_op(LinphoneCore *lc, LinphonePrivate::SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact); -void linphone_configure_op_with_proxy(LinphoneCore *lc, LinphonePrivate::SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact, LinphoneProxyConfig *proxy); -void linphone_call_create_op(LinphoneCall *call); -LinphoneContent * linphone_content_new(void); -LinphoneContent * linphone_content_copy(const LinphoneContent *ref); -SalBodyHandler *sal_body_handler_from_content(const LinphoneContent *content); -SalReason linphone_reason_to_sal(LinphoneReason reason); -LinphoneReason linphone_reason_from_sal(SalReason reason); -void linphone_error_info_to_sal(const LinphoneErrorInfo* ei, SalErrorInfo* sei); -LinphoneEvent *linphone_event_new(LinphoneCore *lc, LinphoneSubscriptionDir dir, const char *name, int expires); -LinphoneEvent *linphone_event_new_with_op(LinphoneCore *lc, LinphonePrivate::SalEventOp *op, LinphoneSubscriptionDir dir, const char *name); -void linphone_event_unpublish(LinphoneEvent *lev); -/** - * Useful for out of dialog notify - * */ -LinphoneEvent *linphone_event_new_with_out_of_dialog_op(LinphoneCore *lc, LinphonePrivate::SalEventOp *op, LinphoneSubscriptionDir dir, const char *name); -void linphone_event_set_internal(LinphoneEvent *lev, bool_t internal); -bool_t linphone_event_is_internal(LinphoneEvent *lev); -void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState state); -void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState state); -LinphoneSubscriptionState linphone_subscription_state_from_sal(SalSubscribeStatus ss); -LinphoneContent *linphone_content_from_sal_body_handler(SalBodyHandler *ref); -void linphone_core_invalidate_friend_subscriptions(LinphoneCore *lc); -void linphone_core_register_offer_answer_providers(LinphoneCore *lc); - - -struct _LinphoneContent { - belle_sip_object_t base; - void *user_data; - SalBodyHandler *body_handler; - char *name; /**< used by RCS File transfer messages to store the original filename of the file to be downloaded from server */ - char *key; /**< used by RCS File transfer messages to store the key to encrypt file if needed */ - size_t keyLength; /**< Length of key in bytes */ - void *cryptoContext; /**< crypto context used to encrypt file for RCS file transfer */ - bool_t owned_fields; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneContent); - -struct _LinphoneBuffer { - belle_sip_object_t base; - void *user_data; - uint8_t *content; /**< A pointer to the buffer content */ - size_t size; /**< The size of the buffer content */ -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneBuffer); - -struct _LinphoneNatPolicy { - belle_sip_object_t base; - void *user_data; - LinphoneCore *lc; - belle_sip_resolver_context_t *stun_resolver_context; - struct addrinfo *stun_addrinfo; - char *stun_server; - char *stun_server_username; - char *ref; - bool_t stun_enabled; - bool_t turn_enabled; - bool_t ice_enabled; - bool_t upnp_enabled; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneNatPolicy); - -bool_t linphone_nat_policy_stun_server_activated(LinphoneNatPolicy *policy); -void linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy); - -struct _LinphoneImNotifPolicy { - belle_sip_object_t base; - void *user_data; - LinphoneCore *lc; - bool_t send_is_composing; - bool_t recv_is_composing; - bool_t send_imdn_delivered; - bool_t recv_imdn_delivered; - bool_t send_imdn_displayed; - bool_t recv_imdn_displayed; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneImNotifPolicy); - -void linphone_core_create_im_notif_policy(LinphoneCore *lc); - - -/***************************************************************************** - * XML-RPC interface * - ****************************************************************************/ - -typedef struct _LinphoneXmlRpcArg { - LinphoneXmlRpcArgType type; - union { - int i; - char *s; - } data; -} LinphoneXmlRpcArg; - -struct _LinphoneXmlRpcRequestCbs { - belle_sip_object_t base; - void *user_data; - LinphoneXmlRpcRequestCbsResponseCb response; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneXmlRpcRequestCbs); - -struct _LinphoneXmlRpcRequest { - belle_sip_object_t base; - void *user_data; - LinphoneXmlRpcRequestCbs *callbacks; - belle_sip_list_t *arg_list; - char *content; /**< The string representation of the XML-RPC request */ - char *method; - LinphoneXmlRpcStatus status; - LinphoneXmlRpcArg response; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneXmlRpcRequest); - -struct _LinphoneXmlRpcSession { - belle_sip_object_t base; - void *user_data; - LinphoneCore *core; - char *url; - bool_t released; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneXmlRpcSession); - - - -/***************************************************************************** - * CardDAV interface * - ****************************************************************************/ - -struct _LinphoneCardDavContext { - LinphoneFriendList *friend_list; - int ctag; - void *user_data; - LinphoneCardDavContactCreatedCb contact_created_cb; - LinphoneCardDavContactUpdatedCb contact_updated_cb; - LinphoneCardDavContactRemovedCb contact_removed_cb; - LinphoneCardDavSynchronizationDoneCb sync_done_cb; - LinphoneAuthInfo *auth_info; -}; - -struct _LinphoneCardDavQuery { - LinphoneCardDavContext *context; - char *url; - const char *method; - char *body; - const char *depth; - const char *ifmatch; - belle_http_request_listener_t *http_request_listener; - void *user_data; - LinphoneCardDavQueryType type; -}; - -struct _LinphoneCardDavResponse { - char *etag; - char *url; - char *vcard; -}; - -/***************************************************************************** - * REMOTE PROVISIONING FUNCTIONS * - ****************************************************************************/ - -void linphone_configuring_terminated(LinphoneCore *lc, LinphoneConfiguringState state, const char *message); -int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char *remote_provisioning_uri); -LINPHONE_PUBLIC int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char* file_path); - -/***************************************************************************** - * Player interface * - ****************************************************************************/ - -struct _LinphonePlayerCbs { - belle_sip_object_t base; - void *user_data; - LinphonePlayerCbsEofReachedCb eof; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphonePlayerCbs); - -LinphonePlayerCbs *linphone_player_cbs_new(void); - -struct _LinphonePlayer{ - belle_sip_object_t base; - void *user_data; - int (*open)(LinphonePlayer* player, const char *filename); - int (*start)(LinphonePlayer* player); - int (*pause)(LinphonePlayer* player); - int (*seek)(LinphonePlayer* player, int time_ms); - MSPlayerState (*get_state)(LinphonePlayer* player); - int (*get_duration)(LinphonePlayer *player); - int (*get_position)(LinphonePlayer *player); - void (*close)(LinphonePlayer* player); - void (*destroy)(LinphonePlayer *player); - void *impl; - LinphonePlayerCbs *callbacks; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphonePlayer); - -LinphonePlayer * linphone_player_new(void); -void _linphone_player_destroy(LinphonePlayer *player); - - -/***************************************************************************** - * XML UTILITY FUNCTIONS * - ****************************************************************************/ - -#define XMLPARSING_BUFFER_LEN 2048 -#define MAX_XPATH_LENGTH 256 - -typedef struct _xmlparsing_context { - xmlDoc *doc; - xmlXPathContextPtr xpath_ctx; - char errorBuffer[XMLPARSING_BUFFER_LEN]; - char warningBuffer[XMLPARSING_BUFFER_LEN]; -} xmlparsing_context_t; - -xmlparsing_context_t * linphone_xmlparsing_context_new(void); -void linphone_xmlparsing_context_destroy(xmlparsing_context_t *ctx); -void linphone_xmlparsing_genericxml_error(void *ctx, const char *fmt, ...); -int linphone_create_xml_xpath_context(xmlparsing_context_t *xml_ctx); -void linphone_xml_xpath_context_set_node(xmlparsing_context_t *xml_ctx, xmlNodePtr node); -char * linphone_get_xml_text_content(xmlparsing_context_t *xml_ctx, const char *xpath_expression); -char * linphone_get_xml_attribute_text_content(xmlparsing_context_t *xml_ctx, const char *xpath_expression, const char *attribute_name); -void linphone_free_xml_text_content(char *text); -xmlXPathObjectPtr linphone_get_xml_xpath_object_for_node_list(xmlparsing_context_t *xml_ctx, const char *xpath_expression); -void linphone_xml_xpath_context_init_carddav_ns(xmlparsing_context_t *xml_ctx); - -/***************************************************************************** - * OTHER UTILITY FUNCTIONS * - ****************************************************************************/ -char * linphone_timestamp_to_rfc3339_string(time_t timestamp); - - -void linphone_error_info_from_sal_op(LinphoneErrorInfo *ei, const LinphonePrivate::SalOp *op); - -void payload_type_set_enable(OrtpPayloadType *pt, bool_t value); -bool_t payload_type_enabled(const OrtpPayloadType *pt); - -LinphonePayloadType *linphone_payload_type_new(LinphoneCore *lc, OrtpPayloadType *ortp_pt); -bool_t _linphone_core_check_payload_type_usability(const LinphoneCore *lc, const OrtpPayloadType *pt); -OrtpPayloadType *linphone_payload_type_get_ortp_pt(const LinphonePayloadType *pt); - - -const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc); -MsZrtpCryptoTypesCount linphone_core_get_zrtp_key_agreement_suites(LinphoneCore *lc, MSZrtpKeyAgreement keyAgreements[MS_MAX_ZRTP_CRYPTO_TYPES]); -MsZrtpCryptoTypesCount linphone_core_get_zrtp_cipher_suites(LinphoneCore *lc, MSZrtpCipher ciphers[MS_MAX_ZRTP_CRYPTO_TYPES]); -MsZrtpCryptoTypesCount linphone_core_get_zrtp_hash_suites(LinphoneCore *lc, MSZrtpHash hashes[MS_MAX_ZRTP_CRYPTO_TYPES]); -MsZrtpCryptoTypesCount linphone_core_get_zrtp_auth_suites(LinphoneCore *lc, MSZrtpAuthTag authTags[MS_MAX_ZRTP_CRYPTO_TYPES]); -MsZrtpCryptoTypesCount linphone_core_get_zrtp_sas_suites(LinphoneCore *lc, MSZrtpSasType sasTypes[MS_MAX_ZRTP_CRYPTO_TYPES]); - -struct _LinphoneImEncryptionEngineCbs { - belle_sip_object_t base; - void *user_data; - LinphoneImEncryptionEngineCbsIncomingMessageCb process_incoming_message; - LinphoneImEncryptionEngineCbsOutgoingMessageCb process_outgoing_message; - LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb is_encryption_enabled_for_file_transfer; - LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb generate_file_transfer_key; - LinphoneImEncryptionEngineCbsDownloadingFileCb process_downlading_file; - LinphoneImEncryptionEngineCbsUploadingFileCb process_uploading_file; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneImEncryptionEngineCbs); - -LinphoneImEncryptionEngineCbs * linphone_im_encryption_engine_cbs_new(void); - -struct _LinphoneImEncryptionEngine { - belle_sip_object_t base; - void *user_data; - LinphoneCore *lc; - LinphoneImEncryptionEngineCbs *callbacks; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneImEncryptionEngine); - -struct _LinphoneRange { - belle_sip_object_t base; - void *user_data; - int min; - int max; -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneRange); - -LinphoneRange *linphone_range_new(void); - -struct _LinphoneTransports { - belle_sip_object_t base; - void *user_data; - int udp_port; /**< SIP/UDP port */ - int tcp_port; /**< SIP/TCP port */ - int dtls_port; /**< SIP/DTLS port */ - int tls_port; /**< SIP/TLS port */ -}; - -BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneTransports); - -LINPHONE_PUBLIC LinphoneTransports *linphone_transports_new(void); - -struct _LinphoneVideoActivationPolicy { - belle_sip_object_t base; - void *user_data; - bool_t automatically_initiate; /** +#include +#include +#include + +#include "private_types.h" +#include "tester_utils.h" +#include "sal/op.h" +#include "sal/event-op.h" + +#include "linphone/core_utils.h" + +#ifdef __cplusplus +extern "C" { +#endif + +LinphoneCallCbs *_linphone_call_cbs_new(void); + +void linphone_call_notify_state_changed(LinphoneCall *call, LinphoneCallState cstate, const char *message); +void linphone_call_notify_dtmf_received(LinphoneCall *call, int dtmf); +void linphone_call_notify_encryption_changed(LinphoneCall *call, bool_t on, const char *authentication_token); +void linphone_call_notify_transfer_state_changed(LinphoneCall *call, LinphoneCallState cstate); +void linphone_call_notify_stats_updated(LinphoneCall *call, const LinphoneCallStats *stats); +void linphone_call_notify_info_message_received(LinphoneCall *call, const LinphoneInfoMessage *msg); +void linphone_call_notify_ack_processing(LinphoneCall *call, LinphoneHeaders *msg, bool_t is_received); + +LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg); +LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to, LinphonePrivate::SalCallOp *op); +void _linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams *params); +void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const char *message); +/* private: */ +LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress * to); +void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state); +LinphonePlayer *linphone_call_build_player(LinphoneCall*call); +void linphone_call_refresh_sockets(LinphoneCall *call); +void linphone_call_replace_op(LinphoneCall *call, LinphonePrivate::SalOp *op); +void linphone_call_reinvite_to_recover_from_connection_loss(LinphoneCall *call); + +LinphonePrivate::SalCallOp *linphone_call_get_op(const LinphoneCall *call); +LinphoneProxyConfig * linphone_call_get_dest_proxy(const LinphoneCall *call); +LINPHONE_PUBLIC MediaStream * linphone_call_get_stream(LinphoneCall *call, LinphoneStreamType type); +LinphoneCallLog * linphone_call_get_log(const LinphoneCall *call); +IceSession * linphone_call_get_ice_session(const LinphoneCall *call); +bool_t linphone_call_get_audio_muted(const LinphoneCall *call); +void linphone_call_set_audio_muted(LinphoneCall *call, bool_t value); +bool_t linphone_call_get_all_muted(const LinphoneCall *call); + +LinphoneCallParams * linphone_call_params_new(LinphoneCore *core); +SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params); +SalStreamDir get_audio_dir_from_call_params(const LinphoneCallParams *params); +SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params); +void linphone_call_params_set_custom_headers(LinphoneCallParams *params, const SalCustomHeader *ch); +void linphone_call_params_set_custom_sdp_attributes(LinphoneCallParams *params, const SalCustomSdpAttribute *csa); +void linphone_call_params_set_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type, const SalCustomSdpAttribute *csa); +bool_t linphone_call_params_get_in_conference(const LinphoneCallParams *params); +void linphone_call_params_set_in_conference(LinphoneCallParams *params, bool_t value); +bool_t linphone_call_params_get_internal_call_update(const LinphoneCallParams *params); +void linphone_call_params_set_internal_call_update(LinphoneCallParams *params, bool_t value); +bool_t linphone_call_params_implicit_rtcp_fb_enabled(const LinphoneCallParams *params); +void linphone_call_params_enable_implicit_rtcp_fb(LinphoneCallParams *params, bool_t value); +int linphone_call_params_get_down_bandwidth(const LinphoneCallParams *params); +void linphone_call_params_set_down_bandwidth(LinphoneCallParams *params, int value); +int linphone_call_params_get_up_bandwidth(const LinphoneCallParams *params); +void linphone_call_params_set_up_bandwidth(LinphoneCallParams *params, int value); +int linphone_call_params_get_down_ptime(const LinphoneCallParams *params); +void linphone_call_params_set_down_ptime(LinphoneCallParams *params, int value); +int linphone_call_params_get_up_ptime(const LinphoneCallParams *params); +void linphone_call_params_set_up_ptime(LinphoneCallParams *params, int value); +SalCustomHeader * linphone_call_params_get_custom_headers(const LinphoneCallParams *params); +SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_attributes(const LinphoneCallParams *params); +SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_media_attributes(const LinphoneCallParams *params, LinphoneStreamType type); +LinphoneCall * linphone_call_params_get_referer(const LinphoneCallParams *params); +void linphone_call_params_set_referer(LinphoneCallParams *params, LinphoneCall *referer); +bool_t linphone_call_params_get_update_call_when_ice_completed(const LinphoneCallParams *params); +void linphone_call_params_set_update_call_when_ice_completed(LinphoneCallParams *params, bool_t value); +void linphone_call_params_set_sent_vsize(LinphoneCallParams *params, MSVideoSize vsize); +void linphone_call_params_set_recv_vsize(LinphoneCallParams *params, MSVideoSize vsize); +void linphone_call_params_set_sent_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef); +void linphone_call_params_set_received_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef); +void linphone_call_params_set_sent_fps(LinphoneCallParams *params, float value); +void linphone_call_params_set_received_fps(LinphoneCallParams *params, float value); +void linphone_call_params_set_used_audio_codec(LinphoneCallParams *params, OrtpPayloadType *codec); +void linphone_call_params_set_used_video_codec(LinphoneCallParams *params, OrtpPayloadType *codec); +void linphone_call_params_set_used_text_codec(LinphoneCallParams *params, OrtpPayloadType *codec); +bool_t linphone_call_params_get_no_user_consent(const LinphoneCallParams *params); +void linphone_call_params_set_no_user_consent(LinphoneCallParams *params, bool_t value); + +void linphone_auth_info_write_config(LinphoneConfig *config, LinphoneAuthInfo *obj, int pos); +LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos); +void _linphone_core_uninit(LinphoneCore *lc); +void linphone_core_write_auth_info(LinphoneCore *lc, LinphoneAuthInfo *ai); +const LinphoneAuthInfo *_linphone_core_find_tls_auth_info(LinphoneCore *lc); +const LinphoneAuthInfo *_linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *domain, bool_t ignore_realm); + +void linphone_core_update_proxy_register(LinphoneCore *lc); +const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc); + +int linphone_proxy_config_send_publish(LinphoneProxyConfig *cfg, LinphonePresenceModel *presence); +void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrationState rstate, const char *message); +void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig *obj); +void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc); +void _linphone_proxy_config_release(LinphoneProxyConfig *cfg); +void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj); +void linphone_proxy_config_notify_publish_state_changed(LinphoneProxyConfig *cfg, LinphonePublishState state); +LinphoneEvent *linphone_proxy_config_create_publish(LinphoneProxyConfig *cfg, const char *event, int expires); +/* + * returns service route as defined in as defined by rfc3608, might be a list instead of just one. + * Can be NULL + * */ +const LinphoneAddress* linphone_proxy_config_get_service_route(const LinphoneProxyConfig* cfg); +const LinphoneAddress *_linphone_proxy_config_get_contact_without_params (const LinphoneProxyConfig *cfg); + +void linphone_friend_list_invalidate_subscriptions(LinphoneFriendList *list); +void linphone_friend_list_notify_presence_received(LinphoneFriendList *list, LinphoneEvent *lev, const LinphoneContent *body); +void linphone_friend_list_subscription_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state); +void _linphone_friend_list_release(LinphoneFriendList *list); +/*get rls either from list or core if any*/ +const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFriendList *list); + +LINPHONE_PUBLIC void linphone_friend_invalidate_subscription(LinphoneFriend *lf); +void linphone_friend_close_subscriptions(LinphoneFriend *lf); +void _linphone_friend_release(LinphoneFriend *lf); +LINPHONE_PUBLIC void linphone_friend_update_subscribes(LinphoneFriend *fr, bool_t only_when_registered); +void linphone_friend_notify(LinphoneFriend *lf, LinphonePresenceModel *presence); +void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc); +void linphone_friend_add_incoming_subscription(LinphoneFriend *lf, LinphonePrivate::SalOp *op); +void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, LinphonePrivate::SalOp *op); +const char * linphone_friend_phone_number_to_sip_uri(LinphoneFriend *lf, const char *phone_number); +const char * linphone_friend_sip_uri_to_phone_number(LinphoneFriend *lf, const char *uri); +void linphone_friend_clear_presence_models(LinphoneFriend *lf); +LinphoneFriend *linphone_friend_list_find_friend_by_inc_subscribe(const LinphoneFriendList *list, LinphonePrivate::SalOp *op); +LinphoneFriend *linphone_friend_list_find_friend_by_out_subscribe(const LinphoneFriendList *list, LinphonePrivate::SalOp *op); +LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *lc, LinphonePrivate::SalOp *op); +LinphoneFriend *linphone_core_find_friend_by_inc_subscribe(const LinphoneCore *lc, LinphonePrivate::SalOp *op); +MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf); +bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc); +void linphone_core_update_friends_subscriptions(LinphoneCore *lc); +void _linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered); +void linphone_core_friends_storage_init(LinphoneCore *lc); +void linphone_core_friends_storage_close(LinphoneCore *lc); +void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf); +void linphone_core_remove_friend_from_db(LinphoneCore *lc, LinphoneFriend *lf); +void linphone_core_store_friends_list_in_db(LinphoneCore *lc, LinphoneFriendList *list); +void linphone_core_remove_friends_list_from_db(LinphoneCore *lc, LinphoneFriendList *list); +LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_from_db(LinphoneCore *lc, LinphoneFriendList *list); +LINPHONE_PUBLIC MSList* linphone_core_fetch_friends_lists_from_db(LinphoneCore *lc); +LINPHONE_PUBLIC LinphoneFriendListStatus linphone_friend_list_import_friend(LinphoneFriendList *list, LinphoneFriend *lf, bool_t synchronize); + +int linphone_parse_host_port(const char *input, char *host, size_t hostlen, int *port); +int parse_hostname_to_addr(const char *server, struct sockaddr_storage *ss, socklen_t *socklen, int default_port); + +bool_t host_has_ipv6_network(void); +bool_t lp_spawn_command_line_sync(const char *command, char **result,int *command_ret); + +static MS2_INLINE void set_string(char **dest, const char *src, bool_t lowercase){ + if (*dest){ + ms_free(*dest); + *dest=NULL; + } + if (src) { + *dest=ms_strdup(src); + if (lowercase) { + char *cur = *dest; + for (; *cur; cur++) *cur = (char)tolower(*cur); + } + } +} + +void linphone_process_authentication(LinphoneCore* lc, LinphonePrivate::SalOp *op); +void linphone_authentication_ok(LinphoneCore *lc, LinphonePrivate::SalOp *op); +void linphone_subscription_new(LinphoneCore *lc, LinphonePrivate::SalSubscribeOp *op, const char *from); +void linphone_core_send_presence(LinphoneCore *lc, LinphonePresenceModel *presence); +void linphone_notify_parse_presence(const char *content_type, const char *content_subtype, const char *body, SalPresenceModel **result); +void linphone_notify_convert_presence_to_xml(LinphonePrivate::SalOp *op, SalPresenceModel *presence, const char *contact, char **content); +void linphone_notify_recv(LinphoneCore *lc, LinphonePrivate::SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model); +void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, LinphonePrivate::SalOp *op); +void linphone_core_soundcard_hint_check(LinphoneCore* lc); + + +void linphone_subscription_answered(LinphoneCore *lc, LinphonePrivate::SalOp *op); +void linphone_subscription_closed(LinphoneCore *lc, LinphonePrivate::SalOp *op); + +void linphone_core_update_allocated_audio_bandwidth(LinphoneCore *lc); + +LINPHONE_PUBLIC int linphone_run_stun_tests(LinphoneCore *lc, int audioPort, int videoPort, int textPort, + char *audioCandidateAddr, int *audioCandidatePort, char *videoCandidateAddr, int *videoCandidatePort, char *textCandidateAddr, int *textCandidatePort); +void linphone_core_resolve_stun_server(LinphoneCore *lc); +LINPHONE_PUBLIC const struct addrinfo *linphone_core_get_stun_server_addrinfo(LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable); +LINPHONE_PUBLIC void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable); +void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call); +LINPHONE_PUBLIC void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev); +void linphone_call_stats_update(LinphoneCallStats *stats, MediaStream *stream); +LinphoneCallStats *_linphone_call_stats_new(void); +void _linphone_call_stats_uninit(LinphoneCallStats *stats); +void _linphone_call_stats_clone(LinphoneCallStats *dst, const LinphoneCallStats *src); +void _linphone_call_stats_set_ice_state (LinphoneCallStats *stats, LinphoneIceState state); +void _linphone_call_stats_set_type (LinphoneCallStats *stats, LinphoneStreamType type); +mblk_t *_linphone_call_stats_get_received_rtcp (const LinphoneCallStats *stats); +void _linphone_call_stats_set_received_rtcp (LinphoneCallStats *stats, mblk_t *m); +void _linphone_call_stats_set_sent_rtcp (LinphoneCallStats *stats, mblk_t *m); +int _linphone_call_stats_get_updated (const LinphoneCallStats *stats); +void _linphone_call_stats_set_updated (LinphoneCallStats *stats, int updated); +void _linphone_call_stats_set_rtp_stats (LinphoneCallStats *stats, const rtp_stats_t *rtpStats); +void _linphone_call_stats_set_download_bandwidth (LinphoneCallStats *stats, float bandwidth); +void _linphone_call_stats_set_upload_bandwidth (LinphoneCallStats *stats, float bandwidth); +void _linphone_call_stats_set_rtcp_download_bandwidth (LinphoneCallStats *stats, float bandwidth); +void _linphone_call_stats_set_rtcp_upload_bandwidth (LinphoneCallStats *stats, float bandwidth); +void _linphone_call_stats_set_ip_family_of_remote (LinphoneCallStats *stats, LinphoneAddressFamily family); +bool_t _linphone_call_stats_rtcp_received_via_mux (const LinphoneCallStats *stats); +void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call); +void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer); +void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md); +bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md); + +void linphone_core_send_initial_subscribes(LinphoneCore *lc); +void linphone_core_write_friends_config(LinphoneCore* lc); +void linphone_friend_write_to_config_file(LinphoneConfig *config, LinphoneFriend *lf, int index); +LinphoneFriend * linphone_friend_new_from_config_file(struct _LinphoneCore *lc, int index); + +void linphone_proxy_config_update(LinphoneProxyConfig *cfg); +LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const LinphoneAddress *uri); +const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAddress *to); +int linphone_core_get_local_ip_for(int type, const char *dest, char *result); +LINPHONE_PUBLIC void linphone_core_get_local_ip(LinphoneCore *lc, int af, const char *dest, char *result); + +LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore *lc, int index); +void linphone_proxy_config_write_to_config_file(LinphoneConfig* config,LinphoneProxyConfig *obj, int index); + +int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op, const SalMessage *msg); +void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call); + +void linphone_call_init_media_streams(LinphoneCall *call); +void linphone_call_start_media_streams_for_ice_gathering(LinphoneCall *call); +void linphone_call_stop_media_streams(LinphoneCall *call); +void linphone_call_delete_upnp_session(LinphoneCall *call); +int _linphone_core_apply_transports(LinphoneCore *lc); + +void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose); +void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses); +void linphone_core_stop_waiting(LinphoneCore *lc); + +int linphone_call_proceed_with_invite_if_ready(LinphoneCall *call, LinphoneProxyConfig *dest_proxy); +int linphone_call_start_invite(LinphoneCall *call, const LinphoneAddress *destination/* = NULL if to be taken from the call log */); +/* + * param automatic_offering aims is to take into account previous answer for video in case of automatic re-invite. + * Purpose is to avoid to re-ask video previously declined */ +int linphone_call_start_update(LinphoneCall *call); +int linphone_call_start_accept_update(LinphoneCall *call, LinphoneCallState next_state, const char *state_info); +void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call); +bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md); +extern LinphonePrivate::Sal::Callbacks linphone_sal_callbacks; +LINPHONE_PUBLIC bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc); +LINPHONE_PUBLIC bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc); +bool_t _linphone_core_is_conference_creation (const LinphoneCore *lc, const LinphoneAddress *addr); +LinphoneChatRoom *_linphone_core_create_server_group_chat_room (LinphoneCore *lc, LinphonePrivate::SalCallOp *op); + +void linphone_core_queue_task(LinphoneCore *lc, belle_sip_source_func_t task_fun, void *data, const char *task_description); + + +LINPHONE_PUBLIC LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_address_equal(const LinphoneAddress *a, const LinphoneAddress *b); +LINPHONE_PUBLIC LinphoneProxyConfigAddressComparisonResult linphone_proxy_config_is_server_config_changed(const LinphoneProxyConfig* obj); +/** + * unregister without moving the register_enable flag + */ +void _linphone_proxy_config_unregister(LinphoneProxyConfig *obj); +void _linphone_proxy_config_release_ops(LinphoneProxyConfig *obj); + +/*chat*/ +LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, const char *uri, const char *subject); +LinphoneChatRoom *_linphone_server_group_chat_room_new (LinphoneCore *core, LinphonePrivate::SalCallOp *op); +void linphone_chat_room_release(LinphoneChatRoom *cr); +void linphone_chat_room_set_call(LinphoneChatRoom *cr, LinphoneCall *call); +LinphoneChatRoomCbs * linphone_chat_room_cbs_new (void); +/**/ + +LinphoneToneDescription * linphone_tone_description_new(LinphoneReason reason, LinphoneToneID id, const char *audiofile); +void linphone_tone_description_destroy(LinphoneToneDescription *obj); +LinphoneToneDescription *linphone_core_get_call_error_tone(const LinphoneCore *lc, LinphoneReason reason); +void linphone_core_play_call_error_tone(LinphoneCore *lc, LinphoneReason reason); +void _linphone_core_set_tone(LinphoneCore *lc, LinphoneReason reason, LinphoneToneID id, const char *audiofile); +LINPHONE_PUBLIC const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID id); + +void linphone_task_list_init(LinphoneTaskList *t); +void linphone_task_list_add(LinphoneTaskList *t, LinphoneCoreIterateHook hook, void *hook_data); +void linphone_task_list_remove(LinphoneTaskList *t, LinphoneCoreIterateHook hook, void *hook_data); +void linphone_task_list_run(LinphoneTaskList *t); +void linphone_task_list_free(LinphoneTaskList *t); + +LinphoneCoreCbs * _linphone_core_cbs_new(void); +void _linphone_core_cbs_set_v_table(LinphoneCoreCbs *cbs, LinphoneCoreVTable *vtable, bool_t autorelease); + + +LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc); +void linphone_tunnel_configure(LinphoneTunnel *tunnel); +void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler); + +int linphone_core_get_calls_nb(const LinphoneCore *lc); + +void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message); +void linphone_call_update_biggest_desc(LinphoneCall *call, SalMediaDescription *md); +void linphone_call_make_local_media_description(LinphoneCall *call); +void linphone_call_make_local_media_description_with_params(LinphoneCore *lc, LinphoneCall *call, LinphoneCallParams *params); + +bool_t linphone_core_is_payload_type_usable_for_bandwidth(const LinphoneCore *lc, const PayloadType *pt, int bandwidth_limit); + +#define linphone_core_ready(lc) ((lc)->state==LinphoneGlobalOn || (lc)->state==LinphoneGlobalShutdown) +void _linphone_core_configure_resolver(void); + +void linphone_core_initialize_supported_content_types(LinphoneCore *lc); + +LinphoneEcCalibratorStatus ec_calibrator_get_status(EcCalibrator *ecc); + +void ec_calibrator_destroy(EcCalibrator *ecc); + +void linphone_call_set_broken(LinphoneCall *call); +void linphone_call_repair_if_broken(LinphoneCall *call); +void linphone_core_repair_calls(LinphoneCore *lc); +int linphone_core_preempt_sound_resources(LinphoneCore *lc); +int _linphone_call_pause(LinphoneCall *call); + +/*conferencing subsystem*/ +void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted); +bool_t linphone_core_sound_resources_available(LinphoneCore *lc); +void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall); +LINPHONE_PUBLIC unsigned int linphone_core_get_audio_features(LinphoneCore *lc); + +void _linphone_core_codec_config_write(LinphoneCore *lc); + +LINPHONE_PUBLIC bctbx_list_t * linphone_core_read_call_logs_from_config_file(LinphoneCore *lc); +void call_logs_write_to_config_file(LinphoneCore *lc); +void linphone_core_call_log_storage_init(LinphoneCore *lc); +void linphone_core_call_log_storage_close(LinphoneCore *lc); +void linphone_core_store_call_log(LinphoneCore *lc, LinphoneCallLog *log); +LINPHONE_PUBLIC const MSList *linphone_core_get_call_history(LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_delete_call_history(LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_delete_call_log(LinphoneCore *lc, LinphoneCallLog *log); +LINPHONE_PUBLIC int linphone_core_get_call_history_size(LinphoneCore *lc); + +int linphone_core_get_edge_bw(LinphoneCore *lc); +int linphone_core_get_edge_ptime(LinphoneCore *lc); + +LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata, void *system_context); + +int linphone_upnp_init(LinphoneCore *lc); +void linphone_upnp_destroy(LinphoneCore *lc); + +#ifdef SQLITE_STORAGE_ENABLED +int _linphone_sqlite3_open(const char *db_file, sqlite3 **db); +#endif + +void linphone_chat_message_set_time(LinphoneChatMessage* msg, time_t time); +void linphone_chat_message_set_incoming(LinphoneChatMessage *msg); +void linphone_chat_message_set_outgoing(LinphoneChatMessage *msg); +LinphoneChatMessageStateChangedCb linphone_chat_message_get_message_state_changed_cb(LinphoneChatMessage* msg); +void linphone_chat_message_set_message_state_changed_cb(LinphoneChatMessage* msg, LinphoneChatMessageStateChangedCb cb); +void linphone_chat_message_set_message_state_changed_cb_user_data(LinphoneChatMessage* msg, void *user_data); +void * linphone_chat_message_get_message_state_changed_cb_user_data(LinphoneChatMessage* msg); +void linphone_chat_message_set_state(LinphoneChatMessage *msg, LinphoneChatMessageState state); +void linphone_chat_message_set_message_id(LinphoneChatMessage *msg, char *id); +void linphone_chat_message_set_storage_id(LinphoneChatMessage *msg, unsigned int id); +SalCustomHeader * linphone_chat_message_get_sal_custom_headers(const LinphoneChatMessage *msg); +void linphone_chat_message_set_sal_custom_headers(LinphoneChatMessage *msg, SalCustomHeader *header); +belle_http_request_t * linphone_chat_message_get_http_request(const LinphoneChatMessage *msg); +void linphone_chat_message_set_http_request(LinphoneChatMessage *msg, belle_http_request_t *request); +void linphone_chat_message_set_file_transfer_information(LinphoneChatMessage *msg, LinphoneContent *content); +LinphoneChatMessageDir linphone_chat_message_get_direction(const LinphoneChatMessage *msg); +LinphonePrivate::SalOp * linphone_chat_message_get_sal_op(const LinphoneChatMessage *msg); +void linphone_chat_message_set_sal_op(LinphoneChatMessage *msg, LinphonePrivate::SalOp *op); +void linphone_chat_message_destroy(LinphoneChatMessage* msg); +void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMessageState new_state); +void linphone_chat_message_set_is_secured(LinphoneChatMessage *msg, bool_t secured); +void linphone_chat_message_send_delivery_notification(LinphoneChatMessage *cm, LinphoneReason reason); +void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm); +void _linphone_chat_message_cancel_file_transfer(LinphoneChatMessage *msg, bool_t unref); +int linphone_chat_room_upload_file(LinphoneChatMessage *msg); +LinphoneChatRoom *_linphone_core_create_chat_room_from_call(LinphoneCall *call); +void linphone_chat_room_remove_transient_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg); +void linphone_chat_message_deactivate(LinphoneChatMessage *msg); +void linphone_chat_message_release(LinphoneChatMessage *msg); +void linphone_chat_message_fetch_content_from_database(sqlite3 *db, LinphoneChatMessage *message, int content_id); + +void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID id); +bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc); +const char *linphone_core_create_uuid(LinphoneCore *lc); +void linphone_configure_op(LinphoneCore *lc, LinphonePrivate::SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact); +void linphone_configure_op_with_proxy(LinphoneCore *lc, LinphonePrivate::SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact, LinphoneProxyConfig *proxy); +void linphone_call_create_op(LinphoneCall *call); +LinphoneContent * linphone_content_new(void); +LinphoneContent * linphone_content_copy(const LinphoneContent *ref); +SalBodyHandler *sal_body_handler_from_content(const LinphoneContent *content); +SalReason linphone_reason_to_sal(LinphoneReason reason); +LinphoneReason linphone_reason_from_sal(SalReason reason); +void linphone_error_info_to_sal(const LinphoneErrorInfo* ei, SalErrorInfo* sei); +LinphoneEvent *linphone_event_new(LinphoneCore *lc, LinphoneSubscriptionDir dir, const char *name, int expires); +LinphoneEvent *linphone_event_new_with_op(LinphoneCore *lc, LinphonePrivate::SalEventOp *op, LinphoneSubscriptionDir dir, const char *name); +void linphone_event_unpublish(LinphoneEvent *lev); +/** + * Useful for out of dialog notify + * */ +LinphoneEvent *linphone_event_new_with_out_of_dialog_op(LinphoneCore *lc, LinphonePrivate::SalEventOp *op, LinphoneSubscriptionDir dir, const char *name); +void linphone_event_set_internal(LinphoneEvent *lev, bool_t internal); +bool_t linphone_event_is_internal(LinphoneEvent *lev); +void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState state); +void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState state); +LinphoneSubscriptionState linphone_subscription_state_from_sal(SalSubscribeStatus ss); +LinphoneContent *linphone_content_from_sal_body_handler(SalBodyHandler *ref); +void linphone_core_invalidate_friend_subscriptions(LinphoneCore *lc); +void linphone_core_register_offer_answer_providers(LinphoneCore *lc); + +bool_t linphone_nat_policy_stun_server_activated(LinphoneNatPolicy *policy); +void linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy); + +void linphone_core_create_im_notif_policy(LinphoneCore *lc); + + +/***************************************************************************** + * REMOTE PROVISIONING FUNCTIONS * + ****************************************************************************/ + +void linphone_configuring_terminated(LinphoneCore *lc, LinphoneConfiguringState state, const char *message); +int linphone_remote_provisioning_download_and_apply(LinphoneCore *lc, const char *remote_provisioning_uri); +LINPHONE_PUBLIC int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char* file_path); + + +/***************************************************************************** + * Player interface * + ****************************************************************************/ + +LinphonePlayerCbs *linphone_player_cbs_new(void); +LinphonePlayer * linphone_player_new(void); +void _linphone_player_destroy(LinphonePlayer *player); + + +/***************************************************************************** + * XML UTILITY FUNCTIONS * + ****************************************************************************/ + +xmlparsing_context_t * linphone_xmlparsing_context_new(void); +void linphone_xmlparsing_context_destroy(xmlparsing_context_t *ctx); +void linphone_xmlparsing_genericxml_error(void *ctx, const char *fmt, ...); +int linphone_create_xml_xpath_context(xmlparsing_context_t *xml_ctx); +void linphone_xml_xpath_context_set_node(xmlparsing_context_t *xml_ctx, xmlNodePtr node); +char * linphone_get_xml_text_content(xmlparsing_context_t *xml_ctx, const char *xpath_expression); +char * linphone_get_xml_attribute_text_content(xmlparsing_context_t *xml_ctx, const char *xpath_expression, const char *attribute_name); +void linphone_free_xml_text_content(char *text); +xmlXPathObjectPtr linphone_get_xml_xpath_object_for_node_list(xmlparsing_context_t *xml_ctx, const char *xpath_expression); +void linphone_xml_xpath_context_init_carddav_ns(xmlparsing_context_t *xml_ctx); + +/***************************************************************************** + * OTHER UTILITY FUNCTIONS * + ****************************************************************************/ + +char * linphone_timestamp_to_rfc3339_string(time_t timestamp); + +void linphone_error_info_from_sal_op(LinphoneErrorInfo *ei, const LinphonePrivate::SalOp *op); + +void payload_type_set_enable(OrtpPayloadType *pt, bool_t value); +bool_t payload_type_enabled(const OrtpPayloadType *pt); + +LinphonePayloadType *linphone_payload_type_new(LinphoneCore *lc, OrtpPayloadType *ortp_pt); +bool_t _linphone_core_check_payload_type_usability(const LinphoneCore *lc, const OrtpPayloadType *pt); +OrtpPayloadType *linphone_payload_type_get_ortp_pt(const LinphonePayloadType *pt); + + +const MSCryptoSuite * linphone_core_get_srtp_crypto_suites(LinphoneCore *lc); +MsZrtpCryptoTypesCount linphone_core_get_zrtp_key_agreement_suites(LinphoneCore *lc, MSZrtpKeyAgreement keyAgreements[MS_MAX_ZRTP_CRYPTO_TYPES]); +MsZrtpCryptoTypesCount linphone_core_get_zrtp_cipher_suites(LinphoneCore *lc, MSZrtpCipher ciphers[MS_MAX_ZRTP_CRYPTO_TYPES]); +MsZrtpCryptoTypesCount linphone_core_get_zrtp_hash_suites(LinphoneCore *lc, MSZrtpHash hashes[MS_MAX_ZRTP_CRYPTO_TYPES]); +MsZrtpCryptoTypesCount linphone_core_get_zrtp_auth_suites(LinphoneCore *lc, MSZrtpAuthTag authTags[MS_MAX_ZRTP_CRYPTO_TYPES]); +MsZrtpCryptoTypesCount linphone_core_get_zrtp_sas_suites(LinphoneCore *lc, MSZrtpSasType sasTypes[MS_MAX_ZRTP_CRYPTO_TYPES]); + +LinphoneImEncryptionEngineCbs * linphone_im_encryption_engine_cbs_new(void); + +LinphoneRange *linphone_range_new(void); + +LINPHONE_PUBLIC LinphoneTransports *linphone_transports_new(void); + +LINPHONE_PUBLIC LinphoneVideoActivationPolicy *linphone_video_activation_policy_new(void); + +void linphone_core_notify_global_state_changed(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message); +void linphone_core_notify_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message); +void linphone_core_notify_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token); +void linphone_core_notify_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message); +void linphone_core_notify_new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char *url); +void linphone_core_notify_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain); +void linphone_core_notify_authentication_requested(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method); +void linphone_core_notify_call_log_updated(LinphoneCore *lc, LinphoneCallLog *newcl); +void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message); +void linphone_core_notify_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message); +void linphone_core_notify_message_received_unable_decrypt(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message); +void linphone_core_notify_file_transfer_recv(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, const char* buff, size_t size); +void linphone_core_notify_file_transfer_send(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, char* buff, size_t* size); +void linphone_core_notify_file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total); +void linphone_core_notify_is_composing_received(LinphoneCore *lc, LinphoneChatRoom *room); +void linphone_core_notify_dtmf_received(LinphoneCore* lc, LinphoneCall *call, int dtmf); +/* + * return true if at least a registered vtable has a cb for dtmf received*/ +bool_t linphone_core_dtmf_received_has_listener(const LinphoneCore* lc); +void linphone_core_notify_refer_received(LinphoneCore *lc, const char *refer_to); +void linphone_core_notify_buddy_info_updated(LinphoneCore *lc, LinphoneFriend *lf); +void linphone_core_notify_transfer_state_changed(LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state); +void linphone_core_notify_call_stats_updated(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *stats); +void linphone_core_notify_info_received(LinphoneCore *lc, LinphoneCall *call, const LinphoneInfoMessage *msg); +void linphone_core_notify_configuring_status(LinphoneCore *lc, LinphoneConfiguringState status, const char *message); +void linphone_core_notify_network_reachable(LinphoneCore *lc, bool_t reachable); + +void linphone_core_notify_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event, const LinphoneContent *body); +void linphone_core_notify_subscription_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state); +void linphone_core_notify_publish_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphonePublishState state); +void linphone_core_notify_log_collection_upload_state_changed(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info); +void linphone_core_notify_log_collection_upload_progress_indication(LinphoneCore *lc, size_t offset, size_t total); +void linphone_core_notify_friend_list_created(LinphoneCore *lc, LinphoneFriendList *list); +void linphone_core_notify_friend_list_removed(LinphoneCore *lc, LinphoneFriendList *list); +void linphone_core_notify_call_created(LinphoneCore *lc, LinphoneCall *call); +void linphone_core_notify_version_update_check_result_received(LinphoneCore *lc, LinphoneVersionUpdateCheckResult result, const char *version, const char *url); +void linphone_core_notify_chat_room_instantiated (LinphoneCore *lc, LinphoneChatRoom *cr); + +void linphone_core_notify_ec_calibration_result(LinphoneCore *lc, LinphoneEcCalibratorStatus status, int delay_ms); +void linphone_core_notify_ec_calibration_audio_init(LinphoneCore *lc); +void linphone_core_notify_ec_calibration_audio_uninit(LinphoneCore *lc); + +void set_playback_gain_db(AudioStream *st, float gain); + +LinphoneMediaDirection media_direction_from_sal_stream_dir(SalStreamDir dir); +SalStreamDir sal_dir_from_call_params_dir(LinphoneMediaDirection cpdir); + +/***************************************************************************** + * LINPHONE CONTENT PRIVATE ACCESSORS * + ****************************************************************************/ + +/** + * Get the address of the crypto context associated with a RCS file transfer message if encrypted + * @param[in] content LinphoneContent object. + * @return The address of the pointer to the crypto context. Crypto context is managed(alloc/free) + * by the encryption/decryption functions, so we give the address to store/retrieve the pointer + */ +void ** linphone_content_get_cryptoContext_address(LinphoneContent *content); + +void v_table_reference_destroy(VTableReference *ref); + +LINPHONE_PUBLIC void _linphone_core_add_callbacks(LinphoneCore *lc, LinphoneCoreCbs *vtable, bool_t internal); + +MSWebCam *get_nowebcam_device(MSFactory *f); + +LinphoneLimeState linphone_core_lime_for_file_sharing_enabled(const LinphoneCore *lc); + +int linphone_core_get_default_proxy_config_index(LinphoneCore *lc); + +char *linphone_presence_model_to_xml(LinphonePresenceModel *model) ; + +bool_t linphone_call_state_is_early(LinphoneCallState state); + +void linphone_core_report_call_log(LinphoneCore *lc, LinphoneCallLog *call_log); +void linphone_core_report_early_failed_call(LinphoneCore *lc, LinphoneCallDir dir, LinphoneAddress *from, LinphoneAddress *to, LinphoneErrorInfo *ei); + +LinphoneVideoDefinition * linphone_video_definition_new(unsigned int width, unsigned int height, const char *name); + +LinphoneVideoDefinition * linphone_factory_find_supported_video_definition(const LinphoneFactory *factory, unsigned int width, unsigned int height); +LinphoneVideoDefinition * linphone_factory_find_supported_video_definition_by_name(const LinphoneFactory *factory, const char *name); + +const char* _linphone_config_load_from_xml_string(LpConfig *lpc, const char *buffer); +LinphoneNatPolicy * linphone_config_create_nat_policy_from_section(const LinphoneConfig *config, const char* section); + +SalCustomHeader *linphone_info_message_get_headers (const LinphoneInfoMessage *im); +void linphone_info_message_set_headers (LinphoneInfoMessage *im, const SalCustomHeader *headers); + +#ifdef __cplusplus +} +#endif + +#endif /* _PRIVATE_FUNCTIONS_H_ */ diff --git a/coreapi/private_structs.h b/coreapi/private_structs.h new file mode 100644 index 000000000..40ca4ac56 --- /dev/null +++ b/coreapi/private_structs.h @@ -0,0 +1,834 @@ +/* + * private_structs.h + * Copyright (C) 2010-2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _PRIVATE_STRUCTS_H_ +#define _PRIVATE_STRUCTS_H_ + +#include +#include +#include +#include +#include + +#include "carddav.h" +#include "sal/register-op.h" + +struct _LinphoneQualityReporting{ + reporting_session_report_t * reports[3]; /**Store information on audio and video media streams (RFC 6035) */ + bool_t was_video_running; /*Keep video state since last check in order to detect its (de)activation*/ + LinphoneQualityReportingReportSendCb on_report_sent; +}; + +struct _LinphoneCallLog{ + belle_sip_object_t base; + void *user_data; + struct _LinphoneCore *lc; + LinphoneCallDir dir; /**< The direction of the call*/ + LinphoneCallStatus status; /**< The status of the call*/ + LinphoneAddress *from; /**= 6) || __GNUC__ > 4) +#pragma GCC diagnostic push +#endif +#ifdef _MSC_VER +#pragma warning(disable : 4996) +#else +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + LinphoneEcCalibrationCallback cb; + void *cb_data; + LinphoneEcCalibrationAudioInit audio_init_cb; + LinphoneEcCalibrationAudioUninit audio_uninit_cb; +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic pop +#endif + int64_t acc; + int delay; + unsigned int rate; + LinphoneEcCalibratorStatus status; + bool_t freq1,freq2,freq3; + bool_t play_cool_tones; +}; + +struct _EchoTester { + MSFactory *factory; + MSFilter *in,*out; + MSSndCard *capture_card; + MSSndCard *playback_card; + MSTicker *ticker; + unsigned int rate; +}; + +struct _LinphoneContent { + belle_sip_object_t base; + void *user_data; + SalBodyHandler *body_handler; + char *name; /**< used by RCS File transfer messages to store the original filename of the file to be downloaded from server */ + char *key; /**< used by RCS File transfer messages to store the key to encrypt file if needed */ + size_t keyLength; /**< Length of key in bytes */ + void *cryptoContext; /**< crypto context used to encrypt file for RCS file transfer */ + bool_t owned_fields; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneContent); + +struct _LinphoneBuffer { + belle_sip_object_t base; + void *user_data; + uint8_t *content; /**< A pointer to the buffer content */ + size_t size; /**< The size of the buffer content */ +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneBuffer); + +struct _LinphoneNatPolicy { + belle_sip_object_t base; + void *user_data; + LinphoneCore *lc; + belle_sip_resolver_context_t *stun_resolver_context; + struct addrinfo *stun_addrinfo; + char *stun_server; + char *stun_server_username; + char *ref; + bool_t stun_enabled; + bool_t turn_enabled; + bool_t ice_enabled; + bool_t upnp_enabled; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneNatPolicy); + +struct _LinphoneImNotifPolicy { + belle_sip_object_t base; + void *user_data; + LinphoneCore *lc; + bool_t send_is_composing; + bool_t recv_is_composing; + bool_t send_imdn_delivered; + bool_t recv_imdn_delivered; + bool_t send_imdn_displayed; + bool_t recv_imdn_displayed; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneImNotifPolicy); + + +/***************************************************************************** + * XML-RPC interface * + ****************************************************************************/ + +struct _LinphoneXmlRpcArg { + LinphoneXmlRpcArgType type; + union { + int i; + char *s; + } data; +}; + +struct _LinphoneXmlRpcRequestCbs { + belle_sip_object_t base; + void *user_data; + LinphoneXmlRpcRequestCbsResponseCb response; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneXmlRpcRequestCbs); + +struct _LinphoneXmlRpcRequest { + belle_sip_object_t base; + void *user_data; + LinphoneXmlRpcRequestCbs *callbacks; + belle_sip_list_t *arg_list; + char *content; /**< The string representation of the XML-RPC request */ + char *method; + LinphoneXmlRpcStatus status; + struct _LinphoneXmlRpcArg response; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneXmlRpcRequest); + +struct _LinphoneXmlRpcSession { + belle_sip_object_t base; + void *user_data; + LinphoneCore *core; + char *url; + bool_t released; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneXmlRpcSession); + + +/***************************************************************************** + * CardDAV interface * + ****************************************************************************/ + +struct _LinphoneCardDavContext { + LinphoneFriendList *friend_list; + int ctag; + void *user_data; + LinphoneCardDavContactCreatedCb contact_created_cb; + LinphoneCardDavContactUpdatedCb contact_updated_cb; + LinphoneCardDavContactRemovedCb contact_removed_cb; + LinphoneCardDavSynchronizationDoneCb sync_done_cb; + LinphoneAuthInfo *auth_info; +}; + +struct _LinphoneCardDavQuery { + LinphoneCardDavContext *context; + char *url; + const char *method; + char *body; + const char *depth; + const char *ifmatch; + belle_http_request_listener_t *http_request_listener; + void *user_data; + LinphoneCardDavQueryType type; +}; + +struct _LinphoneCardDavResponse { + char *etag; + char *url; + char *vcard; +}; + + +/***************************************************************************** + * Player interface * + ****************************************************************************/ + +struct _LinphonePlayerCbs { + belle_sip_object_t base; + void *user_data; + LinphonePlayerCbsEofReachedCb eof; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphonePlayerCbs); + +struct _LinphonePlayer{ + belle_sip_object_t base; + void *user_data; + int (*open)(LinphonePlayer* player, const char *filename); + int (*start)(LinphonePlayer* player); + int (*pause)(LinphonePlayer* player); + int (*seek)(LinphonePlayer* player, int time_ms); + MSPlayerState (*get_state)(LinphonePlayer* player); + int (*get_duration)(LinphonePlayer *player); + int (*get_position)(LinphonePlayer *player); + void (*close)(LinphonePlayer* player); + void (*destroy)(LinphonePlayer *player); + void *impl; + LinphonePlayerCbs *callbacks; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphonePlayer); + + +/***************************************************************************** + * XML UTILITY FUNCTIONS * + ****************************************************************************/ + +#define XMLPARSING_BUFFER_LEN 2048 +#define MAX_XPATH_LENGTH 256 + +struct _xmlparsing_context { + xmlDoc *doc; + xmlXPathContextPtr xpath_ctx; + char errorBuffer[XMLPARSING_BUFFER_LEN]; + char warningBuffer[XMLPARSING_BUFFER_LEN]; +}; + + +/***************************************************************************** + * OTHER UTILITY FUNCTIONS * + ****************************************************************************/ + +struct _LinphoneImEncryptionEngineCbs { + belle_sip_object_t base; + void *user_data; + LinphoneImEncryptionEngineCbsIncomingMessageCb process_incoming_message; + LinphoneImEncryptionEngineCbsOutgoingMessageCb process_outgoing_message; + LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb is_encryption_enabled_for_file_transfer; + LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb generate_file_transfer_key; + LinphoneImEncryptionEngineCbsDownloadingFileCb process_downlading_file; + LinphoneImEncryptionEngineCbsUploadingFileCb process_uploading_file; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneImEncryptionEngineCbs); + +struct _LinphoneImEncryptionEngine { + belle_sip_object_t base; + void *user_data; + LinphoneCore *lc; + LinphoneImEncryptionEngineCbs *callbacks; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneImEncryptionEngine); + +struct _LinphoneRange { + belle_sip_object_t base; + void *user_data; + int min; + int max; +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneRange); + +struct _LinphoneTransports { + belle_sip_object_t base; + void *user_data; + int udp_port; /**< SIP/UDP port */ + int tcp_port; /**< SIP/TCP port */ + int dtls_port; /**< SIP/DTLS port */ + int tls_port; /**< SIP/TLS port */ +}; + +BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneTransports); + +struct _LinphoneVideoActivationPolicy { + belle_sip_object_t base; + void *user_data; + bool_t automatically_initiate; /**name) bctbx_free(vdef->name); } diff --git a/coreapi/xmlrpc.c b/coreapi/xmlrpc.c index 368e6c622..459494a9a 100644 --- a/coreapi/xmlrpc.c +++ b/coreapi/xmlrpc.c @@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "c-wrapper/c-wrapper.h" +// TODO: From coreapi. Remove me later. +#include "private.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneXmlRpcRequestCbs); BELLE_SIP_INSTANCIATE_VPTR(LinphoneXmlRpcRequestCbs, belle_sip_object_t, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 443273c1e..a901d93a3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -159,6 +159,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES c-wrapper/api/c-chat-message.cpp c-wrapper/api/c-chat-room-cbs.cpp c-wrapper/api/c-chat-room.cpp + c-wrapper/api/c-core.cpp c-wrapper/api/c-dial-plan.cpp c-wrapper/api/c-event-log.cpp c-wrapper/api/c-participant.cpp @@ -202,6 +203,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES content/file-content.cpp content/file-transfer-content.cpp core/core-accessor.cpp + core/core-call.cpp core/core-chat-room.cpp core/core.cpp core/paths/paths.cpp diff --git a/src/address/address.cpp b/src/address/address.cpp index 228bf53ef..eaaf13545 100644 --- a/src/address/address.cpp +++ b/src/address/address.cpp @@ -22,6 +22,7 @@ #include "address-p.h" #include "address/identity-address.h" #include "c-wrapper/c-wrapper.h" +#include "c-wrapper/internal/c-sal.h" #include "logger/logger.h" // ============================================================================= diff --git a/src/address/identity-address.cpp b/src/address/identity-address.cpp index 2c8800896..86dcdee93 100644 --- a/src/address/identity-address.cpp +++ b/src/address/identity-address.cpp @@ -17,6 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "linphone/utils/utils.h" + +#include "address.h" +#include "identity-address-p.h" #include "c-wrapper/c-wrapper.h" #include "identity-address-p.h" #include "logger/logger.h" diff --git a/src/c-wrapper/api/c-call-params.cpp b/src/c-wrapper/api/c-call-params.cpp index 4aa6e5006..062f5ee2c 100644 --- a/src/c-wrapper/api/c-call-params.cpp +++ b/src/c-wrapper/api/c-call-params.cpp @@ -18,9 +18,12 @@ */ #include "c-wrapper/c-wrapper.h" +#include "core/core.h" #include "conference/params/call-session-params-p.h" #include "conference/params/media-session-params-p.h" +#include "linphone/call_params.h" + // ============================================================================= L_DECLARE_C_CLONABLE_OBJECT_IMPL(CallParams) @@ -502,7 +505,7 @@ LinphoneCallParams *linphone_call_params_new (LinphoneCore *core) { LinphoneCallParams *params = _linphone_CallParams_init(); auto mediaSessionParams = new LinphonePrivate::MediaSessionParams(); L_SET_CPP_PTR_FROM_C_OBJECT(params, mediaSessionParams); - L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(core->cppCore); + L_GET_CPP_PTR_FROM_C_OBJECT(params)->initDefault(L_GET_CPP_PTR_FROM_C_OBJECT(core)); delete mediaSessionParams; return params; } diff --git a/src/c-wrapper/api/c-call.cpp b/src/c-wrapper/api/c-call.cpp index 6d890e89d..274f7e97f 100644 --- a/src/c-wrapper/api/c-call.cpp +++ b/src/c-wrapper/api/c-call.cpp @@ -1140,11 +1140,11 @@ LinphoneCall *linphone_call_new_outgoing (LinphoneCore *lc, const LinphoneAddres shared_ptr call; string confType = lp_config_get_string(linphone_core_get_config(lc), "misc", "conference_type", "local"); if (confType == "remote") { - call = make_shared(lc->cppCore, LinphoneCallOutgoing, + call = make_shared(L_GET_CPP_PTR_FROM_C_OBJECT(lc), LinphoneCallOutgoing, *L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to), cfg, nullptr, L_GET_CPP_PTR_FROM_C_OBJECT(params)); } else { - call = make_shared(lc->cppCore, LinphoneCallOutgoing, + call = make_shared(L_GET_CPP_PTR_FROM_C_OBJECT(lc), LinphoneCallOutgoing, *L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to), cfg, nullptr, L_GET_CPP_PTR_FROM_C_OBJECT(params)); } @@ -1161,11 +1161,11 @@ LinphoneCall *linphone_call_new_incoming (LinphoneCore *lc, const LinphoneAddres shared_ptr call; string confType = lp_config_get_string(linphone_core_get_config(lc), "misc", "conference_type", "local"); if (confType == "remote") { - call = make_shared(lc->cppCore, LinphoneCallIncoming, + call = make_shared(L_GET_CPP_PTR_FROM_C_OBJECT(lc), LinphoneCallIncoming, *L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to), nullptr, op, nullptr); } else { - call = make_shared(lc->cppCore, LinphoneCallIncoming, + call = make_shared(L_GET_CPP_PTR_FROM_C_OBJECT(lc), LinphoneCallIncoming, *L_GET_CPP_PTR_FROM_C_OBJECT(from), *L_GET_CPP_PTR_FROM_C_OBJECT(to), nullptr, op, nullptr); } diff --git a/src/c-wrapper/api/c-chat-room.cpp b/src/c-wrapper/api/c-chat-room.cpp index 093ec5750..ecae6ba28 100644 --- a/src/c-wrapper/api/c-chat-room.cpp +++ b/src/c-wrapper/api/c-chat-room.cpp @@ -379,7 +379,7 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, cons LinphonePrivate::IdentityAddress me(from); LinphoneChatRoom *cr = L_INIT(ChatRoom); L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared( - core->cppCore, L_C_TO_STRING(uri), me, L_C_TO_STRING(subject)) + L_GET_CPP_PTR_FROM_C_OBJECT(core), L_C_TO_STRING(uri), me, L_C_TO_STRING(subject)) ); L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Instantiated); return cr; @@ -388,7 +388,7 @@ LinphoneChatRoom *_linphone_client_group_chat_room_new (LinphoneCore *core, cons LinphoneChatRoom *_linphone_server_group_chat_room_new (LinphoneCore *core, LinphonePrivate::SalCallOp *op) { LinphoneChatRoom *cr = L_INIT(ChatRoom); L_SET_CPP_PTR_FROM_C_OBJECT(cr, make_shared( - core->cppCore, + L_GET_CPP_PTR_FROM_C_OBJECT(core), op )); L_GET_PRIVATE_FROM_C_OBJECT(cr)->setState(LinphonePrivate::ChatRoom::State::Instantiated); diff --git a/src/c-wrapper/api/c-core.cpp b/src/c-wrapper/api/c-core.cpp new file mode 100644 index 000000000..54e42d7c2 --- /dev/null +++ b/src/c-wrapper/api/c-core.cpp @@ -0,0 +1,47 @@ +/* + * c-core.cpp + * Copyright (C) 2010-2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "linphone/wrapper_utils.h" + +#include "c-wrapper/c-wrapper.h" +#include "core/core.h" + +#include "private_structs.h" + +// ============================================================================= + +using namespace std; + +static void _linphone_core_constructor (LinphoneCore *lc); +static void _linphone_core_destructor (LinphoneCore *lc); + +L_DECLARE_C_OBJECT_IMPL_WITH_XTORS( + Core, + _linphone_core_constructor, _linphone_core_destructor, + LINPHONE_CORE_STRUCT_FIELDS +) + +static void _linphone_core_constructor (LinphoneCore *lc) { +} + +static void _linphone_core_destructor (LinphoneCore *lc) { + if (lc->callsCache) + bctbx_list_free(lc->callsCache); + _linphone_core_uninit(lc); +} diff --git a/src/c-wrapper/api/c-participant.cpp b/src/c-wrapper/api/c-participant.cpp index af6fc1815..f09603300 100644 --- a/src/c-wrapper/api/c-participant.cpp +++ b/src/c-wrapper/api/c-participant.cpp @@ -19,6 +19,7 @@ #include "linphone/api/c-participant.h" +#include "address/address.h" #include "c-wrapper/c-wrapper.h" #include "conference/participant.h" diff --git a/src/c-wrapper/c-wrapper.h b/src/c-wrapper/c-wrapper.h index 41df151db..86045002e 100644 --- a/src/c-wrapper/c-wrapper.h +++ b/src/c-wrapper/c-wrapper.h @@ -25,7 +25,7 @@ #include "internal/c-tools.h" // TODO: From coreapi. Remove me later. -#include "private.h" +#include "private_functions.h" // ============================================================================= // Declare exported C types. @@ -36,12 +36,15 @@ F(Call, Call) \ F(ChatMessage, ChatMessage) \ F(ChatRoom, ChatRoom) \ + F(Core, Core) \ F(DialPlan, DialPlan) \ F(EventLog, EventLog) \ F(MediaSessionParams, CallParams) \ F(Participant, Participant) #define L_REGISTER_SUBTYPES(F) \ + F(Call, LocalConferenceCall) \ + F(Call, RemoteConferenceCall) \ F(ChatRoom, BasicChatRoom) \ F(ChatRoom, ClientGroupChatRoom) \ F(ChatRoom, RealTimeTextChatRoom) \ @@ -78,7 +81,6 @@ BELLE_SIP_TYPE_ID(LinphoneConfig), BELLE_SIP_TYPE_ID(LinphoneContactProvider), BELLE_SIP_TYPE_ID(LinphoneContactSearch), BELLE_SIP_TYPE_ID(LinphoneContent), -BELLE_SIP_TYPE_ID(LinphoneCore), BELLE_SIP_TYPE_ID(LinphoneCoreCbs), BELLE_SIP_TYPE_ID(LinphoneErrorInfo), BELLE_SIP_TYPE_ID(LinphoneEvent), diff --git a/src/call/call-p.h b/src/call/call-p.h index c2f5ec9a5..73f985ee2 100644 --- a/src/call/call-p.h +++ b/src/call/call-p.h @@ -50,7 +50,7 @@ public: LinphoneProxyConfig *getDestProxy () const; IceSession *getIceSession () const; MediaStream *getMediaStream (LinphoneStreamType type) const; - SalCallOp *getOp () const; + SalCallOp *getOp () const; void setAudioMuted (bool value); void createPlayer () const; diff --git a/src/call/call.cpp b/src/call/call.cpp index 7f82b6d01..10367dae7 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -21,6 +21,7 @@ #include "call-p.h" #include "conference/session/call-session-p.h" #include "conference/session/media-session-p.h" +#include "core/core-p.h" #include "logger/logger.h" // ============================================================================= @@ -101,28 +102,25 @@ void CallPrivate::onCallSetReleased () { void CallPrivate::onCallSetTerminated () { L_Q(); - LinphoneCall *lcall = L_GET_C_BACK_PTR(q); LinphoneCore *core = q->getCore()->getCCore(); - if (lcall) { - if (lcall == core->current_call) { - lInfo() << "Resetting the current call"; - core->current_call = nullptr; - } - if (linphone_core_del_call(core, lcall) != 0) - lError() << "Could not remove the call from the list!!!"; - #if 0 - if (core->conf_ctx) - linphone_conference_on_call_terminating(core->conf_ctx, lcall); - if (lcall->ringing_beep) { - linphone_core_stop_dtmf(core); - lcall->ringing_beep = false; - } - if (lcall->chat_room) - linphone_chat_room_set_call(lcall->chat_room, nullptr); - #endif // if 0 - if (!core->calls) - ms_bandwidth_controller_reset_state(core->bw_controller); + if (q->getSharedFromThis() == q->getCore()->getCurrentCall()) { + lInfo() << "Resetting the current call"; + q->getCore()->getPrivate()->setCurrentCall(nullptr); } + if (q->getCore()->getPrivate()->removeCall(q->getSharedFromThis()) != 0) + lError() << "Could not remove the call from the list!!!"; +#if 0 + if (core->conf_ctx) + linphone_conference_on_call_terminating(core->conf_ctx, lcall); + if (lcall->ringing_beep) { + linphone_core_stop_dtmf(core); + lcall->ringing_beep = false; + } + if (lcall->chat_room) + linphone_chat_room_set_call(lcall->chat_room, nullptr); +#endif // if 0 + if (!q->getCore()->getPrivate()->hasCalls()) + ms_bandwidth_controller_reset_state(core->bw_controller); } void CallPrivate::onCallStateChanged (LinphoneCallState state, const string &message) { @@ -161,7 +159,7 @@ void CallPrivate::onIncomingCallStarted () { void CallPrivate::onIncomingCallToBeAdded () { L_Q(); /* The call is acceptable so we can now add it to our list */ - linphone_core_add_call(q->getCore()->getCCore(), L_GET_C_BACK_PTR(q)); + q->getCore()->getPrivate()->addCall(q->getSharedFromThis()); } void CallPrivate::onInfoReceived (const LinphoneInfoMessage *im) { @@ -181,12 +179,12 @@ void CallPrivate::onStatsUpdated (const LinphoneCallStats *stats) { void CallPrivate::onResetCurrentCall () { L_Q(); - q->getCore()->getCCore()->current_call = nullptr; + q->getCore()->getPrivate()->setCurrentCall(nullptr); } void CallPrivate::onSetCurrentCall () { L_Q(); - q->getCore()->getCCore()->current_call = L_GET_C_BACK_PTR(q); + q->getCore()->getPrivate()->setCurrentCall(q->getSharedFromThis()); } void CallPrivate::onFirstVideoFrameDecoded () { diff --git a/src/call/call.h b/src/call/call.h index 980d46d20..755cb29cb 100644 --- a/src/call/call.h +++ b/src/call/call.h @@ -35,9 +35,12 @@ class MediaSessionPrivate; class Call : public Object, public CoreAccessor { friend class CallSessionPrivate; + friend class CorePrivate; friend class MediaSessionPrivate; public: + L_OVERRIDE_SHARED_FROM_THIS(Call); + LinphoneStatus accept (const MediaSessionParams *msp = nullptr); LinphoneStatus acceptEarlyMedia (const MediaSessionParams *msp = nullptr); LinphoneStatus acceptUpdate (const MediaSessionParams *msp); diff --git a/src/chat/modifier/encryption-chat-message-modifier.cpp b/src/chat/modifier/encryption-chat-message-modifier.cpp index cd9193490..75d755f19 100644 --- a/src/chat/modifier/encryption-chat-message-modifier.cpp +++ b/src/chat/modifier/encryption-chat-message-modifier.cpp @@ -38,7 +38,7 @@ ChatMessageModifier::Result EncryptionChatMessageModifier::encode ( int &errorCode ) { shared_ptr chatRoom = message->getChatRoom(); - LinphoneImEncryptionEngine *imee = chatRoom->getCore()->getCCore()->im_encryption_engine; + LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(chatRoom->getCore()->getCCore()); if (!imee) return ChatMessageModifier::Result::Skipped; @@ -71,7 +71,7 @@ ChatMessageModifier::Result EncryptionChatMessageModifier::decode ( int &errorCode ) { shared_ptr chatRoom = message->getChatRoom(); - LinphoneImEncryptionEngine *imee = chatRoom->getCore()->getCCore()->im_encryption_engine; + LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(chatRoom->getCore()->getCCore()); if (!imee) return ChatMessageModifier::Result::Skipped; diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 6cdbb1561..2257b88b6 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -3210,7 +3210,7 @@ void MediaSessionPrivate::updateStreams (SalMediaDescription *newMd, LinphoneCal if (getParams()->earlyMediaSendingEnabled() && (state == LinphoneCallOutgoingEarlyMedia)) prepareEarlyMediaForking(); startStreams(targetState); - if ((state == LinphoneCallPausing) && pausedByApp && (bctbx_list_size(q->getCore()->getCCore()->calls) == 1)) + if ((state == LinphoneCallPausing) && pausedByApp && (q->getCore()->getCallsNb() == 1)) linphone_core_play_named_tone(q->getCore()->getCCore(), LinphoneToneCallOnHold); updateFrozenPayloads(newMd); diff --git a/src/core/core-call.cpp b/src/core/core-call.cpp new file mode 100644 index 000000000..918faf9ca --- /dev/null +++ b/src/core/core-call.cpp @@ -0,0 +1,192 @@ +/* + * core-call.cpp + * Copyright (C) 2010-2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include + +#include "core-p.h" +#include "call/call-p.h" +#include "logger/logger.h" + +// TODO: Remove me later. +#include "c-wrapper/c-wrapper.h" + +// ============================================================================= + +using namespace std; + +LINPHONE_BEGIN_NAMESPACE + +int CorePrivate::addCall (const shared_ptr &call) { + L_Q(); + L_ASSERT(call); + if (!canWeAddCall()) + return -1; + if (!hasCalls()) + notifySoundcardUsage(true); + calls.push_back(call); + linphone_core_notify_call_created(q->getCCore(), L_GET_C_BACK_PTR(call)); + return 0; +} + +bool CorePrivate::isAlreadyInCallWithAddress (const Address &addr) const { + for (const auto &call : calls) { + if (call->getRemoteAddress().weakEqual(addr)) + return true; + } + return false; +} + +void CorePrivate::iterateCalls (time_t currentRealTime, bool oneSecondElapsed) const { + for (const auto &call : calls) { + call->getPrivate()->iterate(currentRealTime, oneSecondElapsed); + } +} + +bool CorePrivate::canWeAddCall () const { + L_Q(); + if (q->getCallsNb() < static_cast(q->getCCore()->max_calls)) + return true; + lInfo() << "Maximum amount of simultaneous calls reached!"; + return false; +} + +void CorePrivate::notifySoundcardUsage (bool used) { + L_Q(); + MSSndCard *card = q->getCCore()->sound_conf.capt_sndcard; + if (card && (ms_snd_card_get_capabilities(card) & MS_SND_CARD_CAP_IS_SLOW)) + ms_snd_card_set_usage_hint(card, used); +} + +int CorePrivate::removeCall (const shared_ptr &call) { + L_ASSERT(call); + auto iter = find(calls.begin(), calls.end(), call); + if (iter == calls.end()) { + lWarning() << "Could not find the call to remove"; + return -1; + } + calls.erase(iter); + return 0; +} + +void CorePrivate::unsetVideoWindowId (bool preview, void *id) { +#ifdef VIDEO_ENABLED + for (const auto &call : calls) { + VideoStream *vstream = reinterpret_cast(call->getPrivate()->getMediaStream(LinphoneStreamTypeVideo)); + if (vstream) { + if (preview) + video_stream_set_native_preview_window_id(vstream, id); + else + video_stream_set_native_window_id(vstream, id); + } + } +#endif +} + +// ============================================================================= + +bool Core::areSoundResourcesLocked () const { + L_D(); + for (const auto &call : d->calls) { + if (call->mediaInProgress()) + return true; + switch (call->getState()) { + case LinphoneCallOutgoingInit: + case LinphoneCallOutgoingProgress: + case LinphoneCallOutgoingRinging: + case LinphoneCallOutgoingEarlyMedia: + case LinphoneCallConnected: + case LinphoneCallRefered: + case LinphoneCallIncomingEarlyMedia: + case LinphoneCallUpdating: + lInfo() << "Call " << call << " is locking sound resources"; + return true; + default: + break; + } + } + return false; +} + +shared_ptr Core::getCallByRemoteAddress (const Address &addr) const { + L_D(); + for (const auto &call : d->calls) { + if (call->getRemoteAddress().weakEqual(addr)) + return call; + } + return nullptr; +} + +const list> &Core::getCalls () const { + L_D(); + return d->calls; +} + +unsigned int Core::getCallsNb () const { + L_D(); + return static_cast(d->calls.size()); +} + +shared_ptr Core::getCurrentCall () const { + L_D(); + return d->currentCall; +} + +LinphoneStatus Core::pauseAllCalls () { + L_D(); + for (const auto &call : d->calls) { + if ((call->getState() == LinphoneCallStreamsRunning) || (call->getState() == LinphoneCallPausedByRemote)) + call->pause(); + } + return 0; +} + +void Core::soundcardHintCheck () { + L_D(); + bool noNeedForSound = true; + // Check if the remaining calls are paused + for (const auto &call : d->calls) { + if ((call->getState() != LinphoneCallPausing) + && (call->getState() != LinphoneCallPaused) + && (call->getState() != LinphoneCallEnd) + && (call->getState() != LinphoneCallError)) { + noNeedForSound = false; + break; + } + } + // If no more calls or all calls are paused, we can free the soundcard + LinphoneConfig *config = linphone_core_get_config(L_GET_C_BACK_PTR(this)); + bool useRtpIo = !!lp_config_get_int(config, "sound", "rtp_io", FALSE); + bool useRtpIoEnableLocalOutput = !!lp_config_get_int(config, "sound", "rtp_io_enable_local_output", FALSE); + bool useFiles = L_GET_C_BACK_PTR(getSharedFromThis())->use_files; + if ((!d->hasCalls() || noNeedForSound) + && (!useFiles && (!useRtpIo || (useRtpIo && useRtpIoEnableLocalOutput)))) { + lInfo() << "Notifying soundcard that we don't need it anymore for calls"; + d->notifySoundcardUsage(false); + } +} + +LinphoneStatus Core::terminateAllCalls () { + L_D(); + while (!d->calls.empty()) { + d->calls.front()->terminate(); + } + return 0; +} + +LINPHONE_END_NAMESPACE diff --git a/src/core/core-chat-room.cpp b/src/core/core-chat-room.cpp index 76bdcda8f..3c86e1f03 100644 --- a/src/core/core-chat-room.cpp +++ b/src/core/core-chat-room.cpp @@ -131,7 +131,7 @@ list> Core::findChatRooms (const IdentityAddress &peerAddre shared_ptr Core::findOneToOneChatRoom ( const IdentityAddress &localAddress, const IdentityAddress &participantAddress -) { +) const { L_D(); for (const auto &chatRoom : d->chatRooms) { if ( diff --git a/src/core/core-p.h b/src/core/core-p.h index da7569d7e..3b79cbf58 100644 --- a/src/core/core-p.h +++ b/src/core/core-p.h @@ -30,6 +30,19 @@ LINPHONE_BEGIN_NAMESPACE class CorePrivate : public ObjectPrivate { public: + void init(); + void uninit(); + + int addCall (const std::shared_ptr &call); + bool canWeAddCall () const; + bool hasCalls () const { return !calls.empty(); } + bool isAlreadyInCallWithAddress (const Address &addr) const; + void iterateCalls (time_t currentRealTime, bool oneSecondElapsed) const; + void notifySoundcardUsage (bool used); + int removeCall (const std::shared_ptr &call); + void setCurrentCall (const std::shared_ptr &call) { currentCall = call; } + void unsetVideoWindowId (bool preview, void *id); + void insertChatRoom (const std::shared_ptr &chatRoom); void insertChatRoomWithDb (const std::shared_ptr &chatRoom); std::shared_ptr createBasicChatRoom (const ChatRoomId &chatRoomId, bool isRtt); @@ -38,6 +51,9 @@ public: LinphoneCore *cCore = nullptr; private: + std::list> calls; + std::shared_ptr currentCall; + std::list> chatRooms; std::unordered_map> chatRoomsById; diff --git a/src/core/core.cpp b/src/core/core.cpp index 906b135d7..8977573dd 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -17,12 +17,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include + +#include "call/call.h" #include "core-p.h" #include "logger/logger.h" #include "paths/paths.h" // TODO: Remove me later. #include "c-wrapper/c-wrapper.h" +#include "private.h" #define LINPHONE_DB "linphone.db" @@ -32,6 +36,40 @@ using namespace std; LINPHONE_BEGIN_NAMESPACE +void CorePrivate::init () { + L_Q(); + mainDb.reset(new MainDb(q->getSharedFromThis())); + + AbstractDb::Backend backend; + string uri = L_C_TO_STRING(lp_config_get_string(linphone_core_get_config(L_GET_C_BACK_PTR(q)), "storage", "uri", nullptr)); + if (!uri.empty()) + backend = strcmp(lp_config_get_string(linphone_core_get_config(L_GET_C_BACK_PTR(q)), "storage", "backend", nullptr), "mysql") == 0 + ? MainDb::Mysql + : MainDb::Sqlite3; + else { + backend = AbstractDb::Sqlite3; + uri = q->getDataPath() + LINPHONE_DB; + } + + lInfo() << "Opening " LINPHONE_DB " at: " << uri; + if (!mainDb->connect(backend, uri)) + lFatal() << "Unable to open linphone database."; + + for (auto &chatRoom : mainDb->getChatRooms()) + insertChatRoom(chatRoom); +} + +void CorePrivate::uninit () { + L_Q(); + while (!calls.empty()) { + calls.front()->terminate(); + linphone_core_iterate(L_GET_C_BACK_PTR(q)); + ms_usleep(10000); + } +} + +// ============================================================================= + Core::Core () : Object(*new CorePrivate) {} Core::~Core () { @@ -41,36 +79,12 @@ Core::~Core () { shared_ptr Core::create (LinphoneCore *cCore) { // Do not use `make_shared` => Private constructor. shared_ptr core = shared_ptr(new Core); - - CorePrivate *const d = core->getPrivate(); - - d->cCore = cCore; - d->mainDb.reset(new MainDb(core->getSharedFromThis())); - - AbstractDb::Backend backend; - string uri = L_C_TO_STRING(lp_config_get_string(linphone_core_get_config(d->cCore), "storage", "uri", nullptr)); - if (!uri.empty()) - backend = strcmp(lp_config_get_string(linphone_core_get_config(d->cCore), "storage", "backend", nullptr), "mysql") == 0 - ? MainDb::Mysql - : MainDb::Sqlite3; - else { - backend = AbstractDb::Sqlite3; - uri = core->getDataPath() + LINPHONE_DB; - } - - lInfo() << "Opening " LINPHONE_DB " at: " << uri; - if (!d->mainDb->connect(backend, uri)) - lFatal() << "Unable to open linphone database."; - - for (auto &chatRoom : d->mainDb->getChatRooms()) - d->insertChatRoom(chatRoom); - + L_SET_CPP_PTR_FROM_C_OBJECT(cCore, core); return core; } LinphoneCore *Core::getCCore () const { - L_D(); - return d->cCore; + return L_GET_C_BACK_PTR(this); } // ----------------------------------------------------------------------------- @@ -78,13 +92,11 @@ LinphoneCore *Core::getCCore () const { // ----------------------------------------------------------------------------- string Core::getDataPath() const { - L_D(); - return Paths::getPath(Paths::Data, static_cast(d->cCore->platform_helper)); + return Paths::getPath(Paths::Data, static_cast(L_GET_C_BACK_PTR(this)->platform_helper)); } string Core::getConfigPath() const { - L_D(); - return Paths::getPath(Paths::Config, static_cast(d->cCore->platform_helper)); + return Paths::getPath(Paths::Config, static_cast(L_GET_C_BACK_PTR(this)->platform_helper)); } LINPHONE_END_NAMESPACE diff --git a/src/core/core.h b/src/core/core.h index f88c7251d..b74330ac6 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -24,18 +24,23 @@ #include "object/object.h" +#include "linphone/types.h" + // ============================================================================= L_DECL_C_STRUCT(LinphoneCore); LINPHONE_BEGIN_NAMESPACE +class Address; +class Call; class ChatRoom; class ChatRoomId; class CorePrivate; class IdentityAddress; class LINPHONE_PUBLIC Core : public Object { + friend class CallPrivate; friend class ChatMessagePrivate; friend class ChatRoom; friend class ChatRoomPrivate; @@ -61,6 +66,19 @@ public: // TODO: Remove me later. LinphoneCore *getCCore () const; + // --------------------------------------------------------------------------- + // Call. + // --------------------------------------------------------------------------- + + bool areSoundResourcesLocked () const; + std::shared_ptr getCallByRemoteAddress (const Address &addr) const; + const std::list> &getCalls () const; + unsigned int getCallsNb () const; + std::shared_ptr getCurrentCall () const; + LinphoneStatus pauseAllCalls (); + void soundcardHintCheck (); + LinphoneStatus terminateAllCalls (); + // --------------------------------------------------------------------------- // ChatRoom. // --------------------------------------------------------------------------- @@ -73,7 +91,7 @@ public: std::shared_ptr findOneToOneChatRoom ( const IdentityAddress &localAddress, const IdentityAddress &participantAddress - ); + ) const; std::shared_ptr createClientGroupChatRoom (const std::string &subject); std::shared_ptr createClientGroupChatRoom (const std::string &subject, const IdentityAddress &localAddress); diff --git a/tester/call_single_tester.c b/tester/call_single_tester.c index 5e79fdd79..f0e5dc34e 100644 --- a/tester/call_single_tester.c +++ b/tester/call_single_tester.c @@ -2541,7 +2541,7 @@ static void call_with_privacy(void) { BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(c2)),LinphonePrivacyId, int, "%d"); } - + liblinphone_tester_check_rtcp(pauline, marie); end_call(pauline, marie); /*test proxy config privacy*/ diff --git a/tester/conference-event-tester.cpp b/tester/conference-event-tester.cpp index 5cb142c5b..6f84d5bf6 100644 --- a/tester/conference-event-tester.cpp +++ b/tester/conference-event-tester.cpp @@ -465,7 +465,7 @@ public: string confSubject; }; -ConferenceEventTester::ConferenceEventTester (LinphoneCore *core, const Address &confAddr) : RemoteConference(core->cppCore, confAddr) { +ConferenceEventTester::ConferenceEventTester (LinphoneCore *core, const Address &confAddr) : RemoteConference(core->cppPtr, confAddr) { handler = new RemoteConferenceEventHandler(this); } @@ -806,7 +806,7 @@ void send_first_notify() { Address addr(identityStr); bctbx_free(identityStr); ConferenceEventTester tester(marie->lc, addr); - LocalConference localConf(pauline->lc->cppCore, addr); + LocalConference localConf(pauline->lc->cppPtr, addr); LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri); char *bobAddrStr = linphone_address_as_string(cBobAddr); Address bobAddr(bobAddrStr); @@ -851,7 +851,7 @@ void send_added_notify() { Address addr(identityStr); bctbx_free(identityStr); ConferenceEventTester tester(marie->lc, addr); - LocalConference localConf(pauline->lc->cppCore, addr); + LocalConference localConf(pauline->lc->cppPtr, addr); LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri); char *bobAddrStr = linphone_address_as_string(cBobAddr); Address bobAddr(bobAddrStr); @@ -912,7 +912,7 @@ void send_removed_notify() { Address addr(identityStr); bctbx_free(identityStr); ConferenceEventTester tester(marie->lc, addr); - LocalConference localConf(pauline->lc->cppCore, addr); + LocalConference localConf(pauline->lc->cppPtr, addr); LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri); char *bobAddrStr = linphone_address_as_string(cBobAddr); Address bobAddr(bobAddrStr); @@ -965,7 +965,7 @@ void send_admined_notify() { Address addr(identityStr); bctbx_free(identityStr); ConferenceEventTester tester(marie->lc, addr); - LocalConference localConf(pauline->lc->cppCore, addr); + LocalConference localConf(pauline->lc->cppPtr, addr); LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri); char *bobAddrStr = linphone_address_as_string(cBobAddr); Address bobAddr(bobAddrStr); @@ -1017,7 +1017,7 @@ void send_unadmined_notify() { Address addr(identityStr); bctbx_free(identityStr); ConferenceEventTester tester(marie->lc, addr); - LocalConference localConf(pauline->lc->cppCore, addr); + LocalConference localConf(pauline->lc->cppPtr, addr); LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri); char *bobAddrStr = linphone_address_as_string(cBobAddr); Address bobAddr(bobAddrStr); @@ -1070,7 +1070,7 @@ void send_subject_changed_notify () { Address addr(identityStr); bctbx_free(identityStr); ConferenceEventTester tester(marie->lc, addr); - LocalConference localConf(pauline->lc->cppCore, addr); + LocalConference localConf(pauline->lc->cppPtr, addr); LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri); char *bobAddrStr = linphone_address_as_string(cBobAddr); Address bobAddr(bobAddrStr); @@ -1130,7 +1130,7 @@ void send_device_added_notify() { Address addr(identityStr); bctbx_free(identityStr); ConferenceEventTester tester(marie->lc, addr); - LocalConference localConf(pauline->lc->cppCore, addr); + LocalConference localConf(pauline->lc->cppPtr, addr); LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri); char *bobAddrStr = linphone_address_as_string(cBobAddr); Address bobAddr(bobAddrStr); @@ -1182,7 +1182,7 @@ void send_device_removed_notify() { Address addr(identityStr); bctbx_free(identityStr); ConferenceEventTester tester(marie->lc, addr); - LocalConference localConf(pauline->lc->cppCore, addr); + LocalConference localConf(pauline->lc->cppPtr, addr); LinphoneAddress *cBobAddr = linphone_core_interpret_url(marie->lc, bobUri); char *bobAddrStr = linphone_address_as_string(cBobAddr); Address bobAddr(bobAddrStr); diff --git a/tester/cpim-tester.cpp b/tester/cpim-tester.cpp index 4653bc7f4..710289a12 100644 --- a/tester/cpim-tester.cpp +++ b/tester/cpim-tester.cpp @@ -396,7 +396,7 @@ static void cpim_chat_message_modifier_base(bool_t use_multipart) { lp_config_set_int(config, "sip", "use_cpim", 1); IdentityAddress paulineAddress(linphone_address_as_string_uri_only(pauline->identity)); - shared_ptr marieRoom = marie->lc->cppCore->getOrCreateBasicChatRoom(paulineAddress); + shared_ptr marieRoom = marie->lc->cppPtr->getOrCreateBasicChatRoom(paulineAddress); shared_ptr marieMessage = marieRoom->createMessage("Hello CPIM"); if (use_multipart) { diff --git a/tester/main-db-tester.cpp b/tester/main-db-tester.cpp index e6ee22ba8..ca041b279 100644 --- a/tester/main-db-tester.cpp +++ b/tester/main-db-tester.cpp @@ -45,7 +45,7 @@ class MainDbProvider { public: MainDbProvider () { mCoreManager = linphone_core_manager_new("marie_rc"); - mMainDb = new MainDb(mCoreManager->lc->cppCore->getSharedFromThis()); + mMainDb = new MainDb(mCoreManager->lc->cppPtr->getSharedFromThis()); mMainDb->connect(MainDb::Sqlite3, getDatabasePath()); } diff --git a/tester/multipart-tester.cpp b/tester/multipart-tester.cpp index 9f1c628e5..840058540 100644 --- a/tester/multipart-tester.cpp +++ b/tester/multipart-tester.cpp @@ -41,7 +41,7 @@ static void chat_message_multipart_modifier_base(bool first_file_transfer, bool LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_tcp_rc"); IdentityAddress paulineAddress(linphone_address_as_string_uri_only(pauline->identity)); - shared_ptr marieRoom = pauline->lc->cppCore->getOrCreateBasicChatRoom(paulineAddress); + shared_ptr marieRoom = pauline->lc->cppPtr->getOrCreateBasicChatRoom(paulineAddress); shared_ptr marieMessage = marieRoom->createMessage(); if (first_file_transfer) { diff --git a/tools/python/apixml2python.py b/tools/python/apixml2python.py index e0aac85b4..e998d5c65 100755 --- a/tools/python/apixml2python.py +++ b/tools/python/apixml2python.py @@ -52,7 +52,6 @@ blacklisted_functions = [ 'linphone_config_load_dict_to_section', # missing LinphoneDictionary 'linphone_config_section_to_dict', # missing LinphoneDictionary 'linphone_core_add_listener', - 'linphone_core_can_we_add_call', # private function 'linphone_core_enable_log_collection', # need to handle class properties 'linphone_core_enable_logs', # unhandled argument type FILE 'linphone_core_enable_logs_with_cb', # callback function in parameter