From 437f43665e1df73c7a478f82be6c88069fcbdb7b Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 25 Sep 2017 14:18:30 +0200 Subject: [PATCH] feat(c-wrapper): now belle-sip types are declared in this file --- coreapi/account_creator.c | 6 +- coreapi/account_creator_service.c | 3 +- coreapi/authentication.c | 3 +- coreapi/buffer.c | 3 +- coreapi/call_log.c | 23 +++---- coreapi/conference.cc | 16 +++-- coreapi/contact_providers_priv.h | 3 +- coreapi/contactprovider.c | 5 +- coreapi/content.c | 3 +- coreapi/error_info.c | 13 ++-- coreapi/event.c | 3 +- coreapi/factory.c | 9 +-- coreapi/friend.c | 27 ++++---- coreapi/friendlist.c | 29 ++++----- coreapi/im_encryption_engine.c | 3 +- coreapi/im_notif_policy.c | 3 +- coreapi/info.c | 4 +- coreapi/linphone_tunnel_config.c | 5 +- coreapi/lpconfig.c | 3 +- coreapi/misc.c | 3 +- coreapi/nat_policy.c | 6 +- coreapi/payload_type.c | 5 +- coreapi/player.c | 4 +- coreapi/presence.c | 5 +- coreapi/private.h | 70 --------------------- coreapi/vcard.cc | 13 ++-- coreapi/video_definition.c | 3 +- coreapi/xmlrpc.c | 6 +- src/c-wrapper/c-wrapper.h | 100 ++++++++++++++++++++++++++---- 29 files changed, 197 insertions(+), 182 deletions(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 791201466..46b947ff6 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -20,9 +20,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "linphone/account_creator.h" #include "linphone/core.h" #include "linphone/lpconfig.h" -#include "private.h" + +#include "c-wrapper/c-wrapper.h" + #if !_WIN32 -#include "regex.h" + #include "regex.h" #endif #include diff --git a/coreapi/account_creator_service.c b/coreapi/account_creator_service.c index cd090148f..3cf0bbff6 100644 --- a/coreapi/account_creator_service.c +++ b/coreapi/account_creator_service.c @@ -19,7 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "linphone/account_creator_service.h" #include "linphone/core.h" -#include "private.h" + +#include "c-wrapper/c-wrapper.h" BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneAccountCreatorService); diff --git a/coreapi/authentication.c b/coreapi/authentication.c index a280de6bf..8fdf050c4 100644 --- a/coreapi/authentication.c +++ b/coreapi/authentication.c @@ -23,9 +23,10 @@ */ #include "linphone/core.h" -#include "private.h" #include "linphone/lpconfig.h" +#include "c-wrapper/c-wrapper.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 d895b1357..ce28b271a 100644 --- a/coreapi/buffer.c +++ b/coreapi/buffer.c @@ -18,9 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/core.h" -#include "private.h" - +#include "c-wrapper/c-wrapper.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 b4ec345b4..499f3f582 100644 --- a/coreapi/call_log.c +++ b/coreapi/call_log.c @@ -20,23 +20,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define _XOPEN_SOURCE 700 /*required for strptime of GNU libc*/ #include -#include "private.h" #ifdef SQLITE_STORAGE_ENABLED -#ifndef _WIN32 -#if !defined(__ANDROID__) && !defined(__QNXNTO__) -# include -# include -# include -#endif + #ifndef _WIN32 + #if !defined(__ANDROID__) && !defined(__QNXNTO__) + #include + #include + #include + #endif #else -#include + #include #endif #define MAX_PATH_SIZE 1024 -#include "sqlite3.h" + #include "sqlite3.h" #endif +#include "c-wrapper/c-wrapper.h" + typedef struct _CallLogStorageResult { LinphoneCore *core; bctbx_list_t *result; @@ -316,7 +317,7 @@ LinphoneCallLog * linphone_call_log_new(LinphoneCallDir dir, LinphoneAddress *fr set_call_log_date(cl,cl->start_date_time); cl->from=from; - cl->to=to; + cl->to=to; cl->status=LinphoneCallAborted; /*default status*/ cl->quality=-1; @@ -561,7 +562,7 @@ const bctbx_list_t *linphone_core_get_call_history(LinphoneCore *lc) { CallLogStorageResult clsres; if (!lc || lc->logs_db == NULL) return NULL; - if (lc->call_logs != NULL) return lc->call_logs; + if (lc->call_logs != NULL) return lc->call_logs; if (lc->max_call_logs != LINPHONE_MAX_CALL_HISTORY_UNLIMITED){ buf = sqlite3_mprintf("SELECT * FROM call_history ORDER BY id DESC LIMIT %i", lc->max_call_logs); diff --git a/coreapi/conference.cc b/coreapi/conference.cc index 7934b3585..0acc08e8d 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -23,14 +23,18 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "linphone/core.h" -#include "private.h" -#include "conference_private.h" -#include -#include -#include #include +#include #include +#include + +#include + +#include "linphone/core.h" + +#include "conference_private.h" + +#include "c-wrapper/c-wrapper.h" using namespace std; diff --git a/coreapi/contact_providers_priv.h b/coreapi/contact_providers_priv.h index 6f24a18b0..5170ad7c9 100644 --- a/coreapi/contact_providers_priv.h +++ b/coreapi/contact_providers_priv.h @@ -17,9 +17,10 @@ #ifndef CONTACT_PROVIDERS_PRIV_H #define CONTACT_PROVIDERS_PRIV_H -#include "private.h" #include "linphone/core.h" +#include "c-wrapper/c-wrapper.h" + /* Base for contact search and contact provider */ struct _LinphoneContactSearch{ diff --git a/coreapi/contactprovider.c b/coreapi/contactprovider.c index 5c1a36b75..cad4875b8 100644 --- a/coreapi/contactprovider.c +++ b/coreapi/contactprovider.c @@ -14,9 +14,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "contact_providers_priv.h" #include "linphone/contactprovider.h" -#include +#include "linphone/core.h" + +#include "contact_providers_priv.h" /* ############################ * * LinphoneContactSearchRequest * diff --git a/coreapi/content.c b/coreapi/content.c index 7637b1c54..86d2cfbcc 100644 --- a/coreapi/content.c +++ b/coreapi/content.c @@ -18,9 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/core.h" -#include "private.h" - +#include "c-wrapper/c-wrapper.h" static void linphone_content_set_sal_body_handler(LinphoneContent *content, SalBodyHandler *body_handler) { if (content->body_handler != NULL) { diff --git a/coreapi/error_info.c b/coreapi/error_info.c index ffe29fed7..b70f96837 100644 --- a/coreapi/error_info.c +++ b/coreapi/error_info.c @@ -18,12 +18,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/core.h" -#include "private.h" + +#include "c-wrapper/c-wrapper.h" BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneErrorInfo); - - static void linphone_error_info_reset(LinphoneErrorInfo *ei); static void error_info_destroy(LinphoneErrorInfo *ei){ @@ -182,7 +181,7 @@ void linphone_error_info_from_sal_reason_ei(LinphoneErrorInfo *ei, const SalErro linphone_error_info_from_sal(ei, reason_ei); return; } - + if (ei->sub_ei){ if (reason_ei->reason == SalReasonNone){ linphone_error_info_unref(ei->sub_ei); @@ -220,12 +219,12 @@ void linphone_error_info_fields_to_sal(const LinphoneErrorInfo* ei, SalErrorInfo sei->protocol_code = ei->protocol_code; sei->protocol = bctbx_strdup(ei->protocol); } - + void linphone_error_info_to_sal(const LinphoneErrorInfo* ei, SalErrorInfo* sei){ - + linphone_error_info_fields_to_sal(ei, sei); if (ei->sub_ei !=NULL) { - + linphone_error_info_to_sal(ei->sub_ei, sei->sub_sei); } } diff --git a/coreapi/event.c b/coreapi/event.c index fb43c4a3d..d7a170822 100644 --- a/coreapi/event.c +++ b/coreapi/event.c @@ -18,9 +18,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/event.h" -#include "private.h" #include "linphone/lpconfig.h" +#include "c-wrapper/c-wrapper.h" + const char * linphone_subscription_dir_to_string(LinphoneSubscriptionDir dir){ switch(dir){ case LinphoneSubscriptionIncoming: diff --git a/coreapi/factory.c b/coreapi/factory.c index 65bc944e2..ee7cbc761 100644 --- a/coreapi/factory.c +++ b/coreapi/factory.c @@ -18,17 +18,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/factory.h" -#include "private.h" + +#include "c-wrapper/c-wrapper.h" #ifndef PACKAGE_SOUND_DIR -#define PACKAGE_SOUND_DIR "." + #define PACKAGE_SOUND_DIR "." #endif #ifndef PACKAGE_RING_DIR -#define PACKAGE_RING_DIR "." + #define PACKAGE_RING_DIR "." #endif #ifndef PACKAGE_DATA_DIR -#define PACKAGE_DATA_DIR "." + #define PACKAGE_DATA_DIR "." #endif extern LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata); diff --git a/coreapi/friend.c b/coreapi/friend.c index 523e0dc39..45f640072 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -23,24 +23,25 @@ */ #include "linphone/core.h" -#include "private.h" #include "linphone/lpconfig.h" #ifdef SQLITE_STORAGE_ENABLED -#ifndef _WIN32 -#if !defined(__ANDROID__) && !defined(__QNXNTO__) -# include -# include -# include -#endif + #ifndef _WIN32 + #if !defined(__ANDROID__) && !defined(__QNXNTO__) + #include + #include + #include + #endif #else -#include + #include #endif #define MAX_PATH_SIZE 1024 -#include "sqlite3.h" + #include "sqlite3.h" #endif +#include "c-wrapper/c-wrapper.h" + const char *linphone_online_status_to_string(LinphoneOnlineStatus ss){ const char *str=NULL; switch(ss){ @@ -1258,13 +1259,13 @@ static bool_t linphone_update_friends_table(sqlite3* db) { int database_user_version = -1; char *errmsg = NULL; - if (sqlite3_prepare_v2(db, "PRAGMA user_version;", -1, &stmt_version, NULL) == SQLITE_OK) { - while(sqlite3_step(stmt_version) == SQLITE_ROW) { - database_user_version = sqlite3_column_int(stmt_version, 0); + if (sqlite3_prepare_v2(db, "PRAGMA user_version;", -1, &stmt_version, NULL) == SQLITE_OK) { + while(sqlite3_step(stmt_version) == SQLITE_ROW) { + database_user_version = sqlite3_column_int(stmt_version, 0); ms_debug("friends database user version = %i", database_user_version); } } - sqlite3_finalize(stmt_version); + sqlite3_finalize(stmt_version); if (database_user_version != 3100) { // Linphone 3.10.0 int ret = sqlite3_exec(db, diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index f29b626ff..a03536994 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -17,11 +17,12 @@ 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/core.h" -#include "private.h" - #include +#include "linphone/core.h" + +#include "c-wrapper/c-wrapper.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFriendListCbs); BELLE_SIP_INSTANCIATE_VPTR(LinphoneFriendListCbs, belle_sip_object_t, @@ -461,14 +462,14 @@ const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFrie const char* rls_uri = lp_config_get_string(list->lc->config, "sip", "rls_uri", NULL); if (list->lc->default_rls_addr) linphone_address_unref(list->lc->default_rls_addr); - + list->lc->default_rls_addr=NULL; - + if (rls_uri) { /*to make sure changes in config are used if any*/ list->lc->default_rls_addr = linphone_address_new(rls_uri); } - + return list->lc->default_rls_addr; } else @@ -476,7 +477,7 @@ const LinphoneAddress * _linphone_friend_list_get_rls_address(const LinphoneFrie } void linphone_friend_list_set_rls_address(LinphoneFriendList *list, const LinphoneAddress *rls_addr){ LinphoneAddress *new_rls_addr = rls_addr ? linphone_address_clone(rls_addr) : NULL; - + if (list->rls_addr){ linphone_address_unref(list->rls_addr); } @@ -874,14 +875,14 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list){ const LinphoneAddress *address = _linphone_friend_list_get_rls_address(list); bool_t only_when_registered = FALSE; bool_t should_send_list_subscribe = FALSE; - + if (list->lc){ if (address) cfg = linphone_core_lookup_known_proxy(list->lc, address); only_when_registered = linphone_core_should_subscribe_friends_only_when_registered(list->lc); should_send_list_subscribe = (!only_when_registered || !cfg || cfg->state == LinphoneRegistrationOk); } - + if (address != NULL) { if (list->enable_subscriptions) { if (should_send_list_subscribe){ @@ -1008,7 +1009,7 @@ LinphoneCore* linphone_friend_list_get_core(const LinphoneFriendList *list) { static LinphoneStatus linphone_friend_list_import_friends_from_vcard4(LinphoneFriendList *list, bctbx_list_t *vcards) { bctbx_list_t *vcards_iterator = NULL; int count = 0; - + if (!linphone_core_vcard_supported()) { ms_error("vCard support wasn't enabled at compilation time"); return -1; @@ -1017,9 +1018,9 @@ static LinphoneStatus linphone_friend_list_import_friends_from_vcard4(LinphoneFr ms_error("Can't import into a NULL list"); return -1; } - + vcards_iterator = vcards; - + while (vcards_iterator != NULL && bctbx_list_get_data(vcards_iterator) != NULL) { LinphoneVcard *vcard = (LinphoneVcard *)bctbx_list_get_data(vcards_iterator); LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard); @@ -1036,7 +1037,7 @@ static LinphoneStatus linphone_friend_list_import_friends_from_vcard4(LinphoneFr bctbx_list_free(vcards); linphone_core_store_friends_list_in_db(list->lc, list); return count; - + } LinphoneStatus linphone_friend_list_import_friends_from_vcard4_file(LinphoneFriendList *list, const char *vcard_file) { bctbx_list_t *vcards = NULL; @@ -1115,7 +1116,7 @@ void linphone_friend_list_enable_subscriptions(LinphoneFriendList *list, bool_t } else { linphone_friend_list_close_subscriptions(list); } - + } } diff --git a/coreapi/im_encryption_engine.c b/coreapi/im_encryption_engine.c index 3363b1dfe..6e32f430e 100644 --- a/coreapi/im_encryption_engine.c +++ b/coreapi/im_encryption_engine.c @@ -18,9 +18,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/core.h" -#include "linphone/im_encryption_engine.h" #include "private.h" +#include "c-wrapper/c-wrapper.h" + BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneImEncryptionEngineCbs); BELLE_SIP_INSTANCIATE_VPTR(LinphoneImEncryptionEngineCbs, belle_sip_object_t, diff --git a/coreapi/im_notif_policy.c b/coreapi/im_notif_policy.c index 3502aa963..9b628a46c 100644 --- a/coreapi/im_notif_policy.c +++ b/coreapi/im_notif_policy.c @@ -18,8 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/core.h" -#include "private.h" +#include "c-wrapper/c-wrapper.h" BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneImNotifPolicy); @@ -30,7 +30,6 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneImNotifPolicy, belle_sip_object_t, FALSE ); - static void load_im_notif_policy_from_config(LinphoneImNotifPolicy *policy) { bctbx_list_t *default_list = bctbx_list_append(NULL, (void *)"all"); bctbx_list_t *values = lp_config_get_string_list(policy->lc->config, "sip", "im_notif_policy", default_list); diff --git a/coreapi/info.c b/coreapi/info.c index 364f5cfab..ad37a9a30 100644 --- a/coreapi/info.c +++ b/coreapi/info.c @@ -22,11 +22,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + #include "linphone/core.h" -#include "private.h" #include "linphone/lpconfig.h" +#include "c-wrapper/c-wrapper.h" struct _LinphoneInfoMessage{ belle_sip_object_t base; diff --git a/coreapi/linphone_tunnel_config.c b/coreapi/linphone_tunnel_config.c index b95d153fe..f51d9c8e6 100644 --- a/coreapi/linphone_tunnel_config.c +++ b/coreapi/linphone_tunnel_config.c @@ -21,8 +21,8 @@ */ #include "linphone/tunnel.h" -#include "private.h" +#include "c-wrapper/c-wrapper.h" struct _LinphoneTunnelConfig { belle_sip_object_t base; @@ -139,6 +139,3 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneTunnelConfig, belle_sip_object_t, NULL, // marshal FALSE ); - - - diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c index be86c9038..6e1b5cb60 100644 --- a/coreapi/lpconfig.c +++ b/coreapi/lpconfig.c @@ -24,7 +24,6 @@ #define MAX_LEN 16384 -#include "private.h" #include "bctoolbox/vfs.h" #include "belle-sip/object.h" #include "xml2lpc.h" @@ -61,6 +60,8 @@ #include "linphone/lpconfig.h" #include "lpc2xml.h" +#include "c-wrapper/c-wrapper.h" + typedef struct _LpItem{ char *key; char *value; diff --git a/coreapi/misc.c b/coreapi/misc.c index f7c0cb7bf..cf1bd497b 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "private.h" #include "linphone/lpconfig.h" #include "linphone/wrapper_utils.h" #include "mediastreamer2/mediastream.h" @@ -59,6 +58,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "nat/stun-client.h" #include "utils/payload-type-handler.h" +#include "c-wrapper/c-wrapper.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), diff --git a/coreapi/nat_policy.c b/coreapi/nat_policy.c index 3290011d8..4d96016df 100644 --- a/coreapi/nat_policy.c +++ b/coreapi/nat_policy.c @@ -18,8 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/core.h" -#include "private.h" +#include "c-wrapper/c-wrapper.h" static LinphoneNatPolicy * _linphone_nat_policy_new_with_ref(LinphoneCore *lc, const char *ref) { LinphoneNatPolicy *policy = belle_sip_object_new(LinphoneNatPolicy); @@ -274,7 +274,7 @@ LinphoneNatPolicy * linphone_config_create_nat_policy_from_section(const Linphon policy = _linphone_nat_policy_new_with_ref(NULL, config_ref); else policy = linphone_nat_policy_new(NULL); - + if (server != NULL) linphone_nat_policy_set_stun_server(policy, server); if (username != NULL) linphone_nat_policy_set_stun_server_username(policy, username); if (l != NULL) { @@ -298,7 +298,7 @@ LinphoneNatPolicy * linphone_core_create_nat_policy_from_config(LinphoneCore *lc char *section; int index; bool_t finished = FALSE; - + for (index = 0; finished != TRUE; index++) { section = belle_sip_strdup_printf("nat_policy_%i", index); if (lp_config_has_section(config, section)) { diff --git a/coreapi/payload_type.c b/coreapi/payload_type.c index a0d1ec800..b2b042181 100644 --- a/coreapi/payload_type.c +++ b/coreapi/payload_type.c @@ -19,9 +19,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include -#include "linphone/payload_type.h" -#include "private.h" +#include "linphone/payload_type.h" + +#include "c-wrapper/c-wrapper.h" #include "utils/payload-type-handler.h" struct _LinphonePayloadType { diff --git a/coreapi/player.c b/coreapi/player.c index 1f3b21e67..1bf49fd7f 100644 --- a/coreapi/player.c +++ b/coreapi/player.c @@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "private.h" +#include "c-wrapper/c-wrapper.h" BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphonePlayer); @@ -181,7 +181,7 @@ static void call_player_close(LinphonePlayer *player){ if (!call_player_check_state(player,TRUE)) return; AudioStream *astream = reinterpret_cast(linphone_call_get_stream(call, LinphoneStreamTypeAudio)); audio_stream_close_remote_play(astream); - + } static void on_call_destroy(void *obj, belle_sip_object_t *call_being_destroyed){ diff --git a/coreapi/presence.c b/coreapi/presence.c index e8e87f181..0ffa56d5d 100644 --- a/coreapi/presence.c +++ b/coreapi/presence.c @@ -18,16 +18,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "linphone/core.h" -#include "private.h" #include "linphone/lpconfig.h" #include "linphone/presence.h" - +#include "c-wrapper/c-wrapper.h" extern const char *__policy_enum_to_str(LinphoneSubscribePolicy pol); - - struct _LinphonePresenceNote { belle_sip_object_t base; void *user_data; diff --git a/coreapi/private.h b/coreapi/private.h index ecd503718..46a3d3813 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1602,76 +1602,6 @@ BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneVideoActivationPolicy); LINPHONE_PUBLIC LinphoneVideoActivationPolicy *linphone_video_activation_policy_new(void); - -/** Belle Sip-based objects need unique ids - */ - -BELLE_SIP_DECLARE_TYPES_BEGIN(linphone, 10000) -BELLE_SIP_TYPE_ID(LinphoneAccountCreator), -BELLE_SIP_TYPE_ID(LinphoneAccountCreatorCbs), -BELLE_SIP_TYPE_ID(LinphoneAccountCreatorService), -BELLE_SIP_TYPE_ID(LinphoneAddress), -BELLE_SIP_TYPE_ID(LinphoneAuthInfo), -BELLE_SIP_TYPE_ID(LinphoneBuffer), -BELLE_SIP_TYPE_ID(LinphoneCall), -BELLE_SIP_TYPE_ID(LinphoneCallCbs), -BELLE_SIP_TYPE_ID(LinphoneCallEvent), -BELLE_SIP_TYPE_ID(LinphoneCallLog), -BELLE_SIP_TYPE_ID(LinphoneCallParams), -BELLE_SIP_TYPE_ID(LinphoneCallStats), -BELLE_SIP_TYPE_ID(LinphoneChatMessage), -BELLE_SIP_TYPE_ID(LinphoneChatMessageCbs), -BELLE_SIP_TYPE_ID(LinphoneChatMessageEvent), -BELLE_SIP_TYPE_ID(LinphoneChatRoom), -BELLE_SIP_TYPE_ID(LinphoneChatRoomCbs), -BELLE_SIP_TYPE_ID(LinphoneConference), -BELLE_SIP_TYPE_ID(LinphoneConferenceEvent), -BELLE_SIP_TYPE_ID(LinphoneConferenceParams), -BELLE_SIP_TYPE_ID(LinphoneConferenceParticipantEvent), -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), -BELLE_SIP_TYPE_ID(LinphoneEventLog), -BELLE_SIP_TYPE_ID(LinphoneFactory), -BELLE_SIP_TYPE_ID(LinphoneFriend), -BELLE_SIP_TYPE_ID(LinphoneFriendList), -BELLE_SIP_TYPE_ID(LinphoneFriendListCbs), -BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngine), -BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngineCbs), -BELLE_SIP_TYPE_ID(LinphoneImNotifPolicy), -BELLE_SIP_TYPE_ID(LinphoneInfoMessage), -BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider), -BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch), -BELLE_SIP_TYPE_ID(LinphoneNatPolicy), -BELLE_SIP_TYPE_ID(LinphoneParticipant), -BELLE_SIP_TYPE_ID(LinphonePayloadType), -BELLE_SIP_TYPE_ID(LinphonePlayer), -BELLE_SIP_TYPE_ID(LinphonePlayerCbs), -BELLE_SIP_TYPE_ID(LinphonePresenceActivity), -BELLE_SIP_TYPE_ID(LinphonePresenceModel), -BELLE_SIP_TYPE_ID(LinphonePresenceNote), -BELLE_SIP_TYPE_ID(LinphonePresencePerson), -BELLE_SIP_TYPE_ID(LinphonePresenceService), -BELLE_SIP_TYPE_ID(LinphoneProxyConfig), -BELLE_SIP_TYPE_ID(LinphoneRange), -BELLE_SIP_TYPE_ID(LinphoneTransports), -BELLE_SIP_TYPE_ID(LinphoneTunnel), -BELLE_SIP_TYPE_ID(LinphoneTunnelConfig), -BELLE_SIP_TYPE_ID(LinphoneVcard), -BELLE_SIP_TYPE_ID(LinphoneVideoActivationPolicy), -BELLE_SIP_TYPE_ID(LinphoneVideoDefinition), -BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequest), -BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequestCbs), -BELLE_SIP_TYPE_ID(LinphoneXmlRpcSession) -BELLE_SIP_DECLARE_TYPES_END - - - 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); diff --git a/coreapi/vcard.cc b/coreapi/vcard.cc index d020c78dc..b002a28c6 100644 --- a/coreapi/vcard.cc +++ b/coreapi/vcard.cc @@ -17,15 +17,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "vcard_private.h" -#include "belcard/belcard.hpp" -#include "belcard/belcard_parser.hpp" -#include "sal/sal.h" #include -#include "private.h" + +#include +#include + #include "linphone/factory.h" #include "linphone/wrapper_utils.h" +#include "c-wrapper/c-wrapper.h" +#include "sal/sal.h" +#include "vcard_private.h" + #define VCARD_MD5_HASH_SIZE 16 using namespace std; diff --git a/coreapi/video_definition.c b/coreapi/video_definition.c index 717fdfd73..2a357824a 100644 --- a/coreapi/video_definition.c +++ b/coreapi/video_definition.c @@ -20,8 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "linphone/factory.h" #include "linphone/video_definition.h" -#include "private.h" - +#include "c-wrapper/c-wrapper.h" static void linphone_video_definition_destroy(LinphoneVideoDefinition *vdef) { if (vdef->name) bctbx_free(vdef->name); diff --git a/coreapi/xmlrpc.c b/coreapi/xmlrpc.c index 221876f15..9410ae309 100644 --- a/coreapi/xmlrpc.c +++ b/coreapi/xmlrpc.c @@ -17,14 +17,13 @@ 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/core.h" -#include "private.h" - #include #include #include +#include "linphone/core.h" +#include "c-wrapper/c-wrapper.h" BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneXmlRpcRequestCbs); @@ -423,4 +422,3 @@ void linphone_xml_rpc_session_release(LinphoneXmlRpcSession *session){ session->released = TRUE; belle_sip_object_unref(session); } - diff --git a/src/c-wrapper/c-wrapper.h b/src/c-wrapper/c-wrapper.h index 4deafac57..fde36fed1 100644 --- a/src/c-wrapper/c-wrapper.h +++ b/src/c-wrapper/c-wrapper.h @@ -23,20 +23,96 @@ #include "internal/c-tools.h" +// ============================================================================= +// Declare exported C types. // ============================================================================= -L_REGISTER_TYPE(Address, Address); -L_REGISTER_TYPE(Call, Call); -L_REGISTER_TYPE(CallEvent, CallEvent); -L_REGISTER_TYPE(ChatMessage, ChatMessage); -L_REGISTER_TYPE(ChatMessageEvent, ChatMessageEvent); -L_REGISTER_TYPE(ChatRoom, ChatRoom); -L_REGISTER_TYPE(ConferenceEvent, ConferenceEvent); -L_REGISTER_TYPE(ConferenceParticipantEvent, ConferenceParticipantEvent); -L_REGISTER_TYPE(EventLog, EventLog); -L_REGISTER_TYPE(MediaSessionParams, CallParams); -L_REGISTER_TYPE(Participant, Participant); +#define L_REGISTER_TYPES(F) \ + F(Address, Address) \ + F(Call, Call) \ + F(CallEvent, CallEvent) \ + F(ChatMessage, ChatMessage) \ + F(ChatMessageEvent, ChatMessageEvent) \ + F(ChatRoom, ChatRoom) \ + F(ConferenceEvent, ConferenceEvent) \ + F(ConferenceParticipantEvent, ConferenceParticipantEvent) \ + F(EventLog, EventLog) \ + F(MediaSessionParams, CallParams) \ + F(Participant, Participant) -L_REGISTER_SUBTYPE(ChatRoom, ClientGroupChatRoom); +#define L_REGISTER_SUBTYPES(F) \ + F(ChatRoom, ClientGroupChatRoom) + +// ============================================================================= +// Register belle-sip ID. +// ============================================================================= + +#define L_REGISTER_ID(CPP_TYPE, C_TYPE) BELLE_SIP_TYPE_ID(Linphone ## C_TYPE), + +BELLE_SIP_DECLARE_TYPES_BEGIN(linphone, 10000) +L_REGISTER_TYPES(L_REGISTER_ID) +BELLE_SIP_TYPE_ID(LinphoneAccountCreator), +BELLE_SIP_TYPE_ID(LinphoneAccountCreatorCbs), +BELLE_SIP_TYPE_ID(LinphoneAccountCreatorService), +BELLE_SIP_TYPE_ID(LinphoneAuthInfo), +BELLE_SIP_TYPE_ID(LinphoneBuffer), +BELLE_SIP_TYPE_ID(LinphoneCallCbs), +BELLE_SIP_TYPE_ID(LinphoneCallLog), +BELLE_SIP_TYPE_ID(LinphoneCallStats), +BELLE_SIP_TYPE_ID(LinphoneChatMessageCbs), +BELLE_SIP_TYPE_ID(LinphoneChatRoomCbs), +BELLE_SIP_TYPE_ID(LinphoneConference), +BELLE_SIP_TYPE_ID(LinphoneConferenceParams), +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), +BELLE_SIP_TYPE_ID(LinphoneFactory), +BELLE_SIP_TYPE_ID(LinphoneFriend), +BELLE_SIP_TYPE_ID(LinphoneFriendList), +BELLE_SIP_TYPE_ID(LinphoneFriendListCbs), +BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngine), +BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngineCbs), +BELLE_SIP_TYPE_ID(LinphoneImNotifPolicy), +BELLE_SIP_TYPE_ID(LinphoneInfoMessage), +BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider), +BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch), +BELLE_SIP_TYPE_ID(LinphoneNatPolicy), +BELLE_SIP_TYPE_ID(LinphonePayloadType), +BELLE_SIP_TYPE_ID(LinphonePlayer), +BELLE_SIP_TYPE_ID(LinphonePlayerCbs), +BELLE_SIP_TYPE_ID(LinphonePresenceActivity), +BELLE_SIP_TYPE_ID(LinphonePresenceModel), +BELLE_SIP_TYPE_ID(LinphonePresenceNote), +BELLE_SIP_TYPE_ID(LinphonePresencePerson), +BELLE_SIP_TYPE_ID(LinphonePresenceService), +BELLE_SIP_TYPE_ID(LinphoneProxyConfig), +BELLE_SIP_TYPE_ID(LinphoneRange), +BELLE_SIP_TYPE_ID(LinphoneTransports), +BELLE_SIP_TYPE_ID(LinphoneTunnel), +BELLE_SIP_TYPE_ID(LinphoneTunnelConfig), +BELLE_SIP_TYPE_ID(LinphoneVcard), +BELLE_SIP_TYPE_ID(LinphoneVideoActivationPolicy), +BELLE_SIP_TYPE_ID(LinphoneVideoDefinition), +BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequest), +BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequestCbs), +BELLE_SIP_TYPE_ID(LinphoneXmlRpcSession) +BELLE_SIP_DECLARE_TYPES_END + +#undef L_REGISTER_ID + +// ============================================================================= +// Register C types. +// ============================================================================= + +L_REGISTER_TYPES(L_REGISTER_TYPE); +L_REGISTER_SUBTYPES(L_REGISTER_SUBTYPE); + +#undef L_REGISTER_SUBTYPES +#undef L_REGISTER_TYPES #endif // ifndef _C_WRAPPER_H_