mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 07:08:11 +00:00
feat(c-tools): remove C_TYPE parameter of L_GET_CPP_PTR_FROM_C_STRUCT
This commit is contained in:
parent
f966995975
commit
5e4cb463db
14 changed files with 85 additions and 76 deletions
|
|
@ -100,7 +100,7 @@ static LinphoneChatRoom *_linphone_core_create_chat_room_from_url(LinphoneCore *
|
|||
}
|
||||
|
||||
static bool_t linphone_chat_room_matches(LinphoneChatRoom *cr, const LinphoneAddress *from) {
|
||||
LinphoneAddress *addr = linphone_address_new(L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)->getPeerAddress().asString().c_str());
|
||||
LinphoneAddress *addr = linphone_address_new(L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom)->getPeerAddress().asString().c_str());
|
||||
bool_t result = linphone_address_weak_equal(addr, from);
|
||||
linphone_address_unref(addr);
|
||||
return result;
|
||||
|
|
@ -166,7 +166,7 @@ void linphone_chat_message_update_state(LinphoneChatMessage *msg, LinphoneChatMe
|
|||
linphone_chat_message_store_state(msg);
|
||||
|
||||
if (msg->state == LinphoneChatMessageStateDelivered || msg->state == LinphoneChatMessageStateNotDelivered) {
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(msg->chat_room, ChatRoom, ChatRoom)->moveTransientMessageToWeakMessages(msg);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(msg->chat_room, ChatRoom)->moveTransientMessageToWeakMessages(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ int linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage
|
|||
LinphoneAddress *addr = linphone_address_new(sal_msg->from);
|
||||
linphone_address_clean(addr);
|
||||
LinphoneChatRoom *cr = linphone_core_get_chat_room(lc, addr);
|
||||
LinphoneReason reason = L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)->messageReceived(op, sal_msg);
|
||||
LinphoneReason reason = L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->messageReceived(op, sal_msg);
|
||||
linphone_address_unref(addr);
|
||||
return reason;
|
||||
}
|
||||
|
|
@ -269,7 +269,7 @@ void _linphone_chat_message_resend(LinphoneChatMessage *msg, bool_t ref_msg) {
|
|||
|
||||
cr = linphone_chat_message_get_chat_room(msg);
|
||||
if (ref_msg) linphone_chat_message_ref(msg);
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)->sendMessage(msg);
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom)->sendMessage(msg);
|
||||
}
|
||||
|
||||
void linphone_chat_message_resend(LinphoneChatMessage *msg) {
|
||||
|
|
@ -385,7 +385,7 @@ static char *linphone_chat_message_create_imdn_xml(LinphoneChatMessage *cm, Imdn
|
|||
void linphone_chat_message_send_imdn(LinphoneChatMessage *cm, ImdnType imdn_type, LinphoneReason reason) {
|
||||
char *content = linphone_chat_message_create_imdn_xml(cm, imdn_type, reason);
|
||||
if (content) {
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(linphone_chat_message_get_chat_room(cm), ChatRoom, ChatRoom)->sendImdn(content, reason);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(linphone_chat_message_get_chat_room(cm), ChatRoom)->sendImdn(content, reason);
|
||||
ms_free(content);
|
||||
}
|
||||
}
|
||||
|
|
@ -411,7 +411,7 @@ void linphone_chat_message_send_display_notification(LinphoneChatMessage *cm) {
|
|||
void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *cr, uint32_t character, LinphoneCall *call) {
|
||||
if (linphone_core_realtime_text_enabled(lc)) {
|
||||
std::shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr =
|
||||
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom, ChatRoom));
|
||||
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom));
|
||||
L_GET_PRIVATE(rttcr)->realtimeTextReceived(character, call);
|
||||
//L_GET_PRIVATE(std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)))->realtimeTextReceived(character, call);
|
||||
}
|
||||
|
|
@ -421,7 +421,7 @@ LinphoneStatus linphone_chat_message_put_char(LinphoneChatMessage *msg, uint32_t
|
|||
LinphoneChatRoom *cr = linphone_chat_message_get_chat_room(msg);
|
||||
if (linphone_core_realtime_text_enabled(linphone_chat_room_get_core(cr))) {
|
||||
std::shared_ptr<LinphonePrivate::RealTimeTextChatRoom> rttcr =
|
||||
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom, ChatRoom));
|
||||
std::static_pointer_cast<LinphonePrivate::RealTimeTextChatRoom>(L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom));
|
||||
LinphoneCall *call = rttcr->getCall();
|
||||
LinphoneCore *lc = rttcr->getCore();
|
||||
const uint32_t new_line = 0x2028;
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
|
|||
linphone_core_notify_file_transfer_send(lc, msg, msg->file_transfer_information, (char *)buffer, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
imee = linphone_core_get_im_encryption_engine(lc);
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
|
|
@ -158,7 +158,7 @@ static void on_send_end(belle_sip_user_body_handler_t *bh, void *data) {
|
|||
LinphoneChatMessage *msg = (LinphoneChatMessage *)data;
|
||||
LinphoneCore *lc = linphone_chat_room_get_core(msg->chat_room);
|
||||
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(lc);
|
||||
|
||||
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineCbsUploadingFileCb cb_process_uploading_file = linphone_im_encryption_engine_cbs_get_process_uploading_file(imee_cbs);
|
||||
|
|
@ -210,7 +210,7 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
|
|||
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(linphone_chat_room_get_core(msg->chat_room));
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb is_encryption_enabled_for_file_transfer_cb =
|
||||
LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb is_encryption_enabled_for_file_transfer_cb =
|
||||
linphone_im_encryption_engine_cbs_get_is_encryption_enabled_for_file_transfer(imee_cbs);
|
||||
if (is_encryption_enabled_for_file_transfer_cb) {
|
||||
is_file_encryption_enabled = is_encryption_enabled_for_file_transfer_cb(imee, msg->chat_room);
|
||||
|
|
@ -219,7 +219,7 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
|
|||
/* shall we encrypt the file */
|
||||
if (is_file_encryption_enabled) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb generate_file_transfer_key_cb =
|
||||
LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb generate_file_transfer_key_cb =
|
||||
linphone_im_encryption_engine_cbs_get_generate_file_transfer_key(imee_cbs);
|
||||
if (generate_file_transfer_key_cb) {
|
||||
generate_file_transfer_key_cb(imee, msg->chat_room, msg);
|
||||
|
|
@ -237,12 +237,12 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
|
|||
/* create a user body handler to take care of the file and add the content disposition and content-type
|
||||
* headers */
|
||||
first_part_bh = (belle_sip_body_handler_t *)belle_sip_user_body_handler_new(
|
||||
linphone_content_get_size(msg->file_transfer_information),
|
||||
linphone_content_get_size(msg->file_transfer_information),
|
||||
linphone_chat_message_file_transfer_on_progress, NULL, NULL,
|
||||
on_send_body, on_send_end, msg);
|
||||
if (msg->file_transfer_filepath != NULL) {
|
||||
belle_sip_user_body_handler_t *body_handler = (belle_sip_user_body_handler_t *)first_part_bh;
|
||||
first_part_bh = (belle_sip_body_handler_t *)belle_sip_file_body_handler_new(msg->file_transfer_filepath,
|
||||
first_part_bh = (belle_sip_body_handler_t *)belle_sip_file_body_handler_new(msg->file_transfer_filepath,
|
||||
NULL, msg); // No need to add again the callback for progression, otherwise it will be called twice
|
||||
linphone_content_set_size(msg->file_transfer_information, belle_sip_file_body_handler_get_file_size((belle_sip_file_body_handler_t *)first_part_bh));
|
||||
belle_sip_file_body_handler_set_user_body_handler((belle_sip_file_body_handler_t *)first_part_bh, body_handler);
|
||||
|
|
@ -251,7 +251,7 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
|
|||
linphone_content_get_buffer(msg->file_transfer_information),
|
||||
linphone_content_get_size(msg->file_transfer_information), linphone_chat_message_file_transfer_on_progress, msg);
|
||||
}
|
||||
|
||||
|
||||
belle_sip_body_handler_add_header(first_part_bh,
|
||||
belle_sip_header_create("Content-disposition", first_part_header));
|
||||
belle_sip_free(first_part_header);
|
||||
|
|
@ -341,7 +341,7 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
|
|||
linphone_chat_message_ref(msg);
|
||||
linphone_chat_message_set_state(msg, LinphoneChatMessageStateFileTransferDone);
|
||||
_release_http_request(msg);
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(msg->chat_room, ChatRoom, ChatRoom)->sendMessage(msg);
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(msg->chat_room, ChatRoom)->sendMessage(msg);
|
||||
file_upload_end_background_task(msg);
|
||||
linphone_chat_message_unref(msg);
|
||||
} else {
|
||||
|
|
@ -391,7 +391,7 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
|
|||
if (size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
decrypted_buffer = (uint8_t *)ms_malloc0(size);
|
||||
imee = linphone_core_get_im_encryption_engine(lc);
|
||||
if (imee) {
|
||||
|
|
@ -405,7 +405,7 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
|
|||
}
|
||||
}
|
||||
ms_free(decrypted_buffer);
|
||||
|
||||
|
||||
if (retval <= 0) {
|
||||
if (msg->file_transfer_filepath == NULL) {
|
||||
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) {
|
||||
|
|
@ -430,7 +430,7 @@ static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) {
|
|||
LinphoneCore *lc = linphone_chat_room_get_core(msg->chat_room);
|
||||
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(lc);
|
||||
int retval = -1;
|
||||
|
||||
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineCbsDownloadingFileCb cb_process_downloading_file = linphone_im_encryption_engine_cbs_get_process_downloading_file(imee_cbs);
|
||||
|
|
@ -438,7 +438,7 @@ static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) {
|
|||
retval = cb_process_downloading_file(imee, msg, 0, NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (retval <= 0) {
|
||||
if (msg->file_transfer_filepath == NULL) {
|
||||
if (linphone_chat_message_cbs_get_file_transfer_recv(msg->callbacks)) {
|
||||
|
|
@ -504,7 +504,7 @@ static void linphone_chat_process_response_headers_from_get_file(void *data, con
|
|||
body_size = linphone_content_get_size(msg->file_transfer_information);
|
||||
}
|
||||
|
||||
|
||||
|
||||
body_handler = (belle_sip_body_handler_t *)belle_sip_user_body_handler_new(body_size, linphone_chat_message_file_transfer_on_progress, NULL, on_recv_body, NULL, on_recv_end, msg);
|
||||
if (msg->file_transfer_filepath != NULL) {
|
||||
belle_sip_user_body_handler_t *bh = (belle_sip_user_body_handler_t *)body_handler;
|
||||
|
|
@ -657,5 +657,5 @@ const char *linphone_chat_message_get_file_transfer_filepath(LinphoneChatMessage
|
|||
}
|
||||
|
||||
LinphoneChatMessage *linphone_chat_room_create_file_transfer_message(LinphoneChatRoom *cr, const LinphoneContent *initial_content) {
|
||||
return L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)->createFileTransferMessage(initial_content);
|
||||
return L_GET_CPP_PTR_FROM_C_STRUCT(cr, ChatRoom)->createFileTransferMessage(initial_content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,8 +289,8 @@ LinphoneCall * linphone_call_new_outgoing(LinphoneCore *lc, const LinphoneAddres
|
|||
call->remoteParamsCache = linphone_call_params_new_for_wrapper();
|
||||
call->remoteAddressCache = linphone_address_new(nullptr);
|
||||
call->call = std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallOutgoing,
|
||||
*L_GET_CPP_PTR_FROM_C_STRUCT(from, Address, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address, Address),
|
||||
cfg, nullptr, L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams));
|
||||
*L_GET_CPP_PTR_FROM_C_STRUCT(from, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address),
|
||||
cfg, nullptr, L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams));
|
||||
return call;
|
||||
}
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, const LinphoneAddres
|
|||
call->remoteParamsCache = linphone_call_params_new_for_wrapper();
|
||||
call->remoteAddressCache = linphone_address_new(nullptr);
|
||||
call->call = std::make_shared<LinphonePrivate::Call>(call, lc, LinphoneCallIncoming,
|
||||
*L_GET_CPP_PTR_FROM_C_STRUCT(from, Address, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address, Address),
|
||||
*L_GET_CPP_PTR_FROM_C_STRUCT(from, Address), *L_GET_CPP_PTR_FROM_C_STRUCT(to, Address),
|
||||
nullptr, op, nullptr);
|
||||
L_GET_PRIVATE(linphone_call_get_cpp_obj(call).get())->initiateIncoming();
|
||||
return call;
|
||||
|
|
@ -1284,7 +1284,7 @@ LinphoneStatus linphone_call_accept(LinphoneCall *call) {
|
|||
}
|
||||
|
||||
LinphoneStatus linphone_call_accept_with_params(LinphoneCall *call, const LinphoneCallParams *params) {
|
||||
return linphone_call_get_cpp_obj(call)->accept(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr);
|
||||
return linphone_call_get_cpp_obj(call)->accept(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams) : nullptr);
|
||||
}
|
||||
|
||||
LinphoneStatus linphone_call_accept_early_media(LinphoneCall* call) {
|
||||
|
|
@ -1292,11 +1292,11 @@ LinphoneStatus linphone_call_accept_early_media(LinphoneCall* call) {
|
|||
}
|
||||
|
||||
LinphoneStatus linphone_call_accept_early_media_with_params(LinphoneCall *call, const LinphoneCallParams *params) {
|
||||
return linphone_call_get_cpp_obj(call)->acceptEarlyMedia(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr);
|
||||
return linphone_call_get_cpp_obj(call)->acceptEarlyMedia(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams) : nullptr);
|
||||
}
|
||||
|
||||
LinphoneStatus linphone_call_update(LinphoneCall *call, const LinphoneCallParams *params) {
|
||||
return linphone_call_get_cpp_obj(call)->update(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr);
|
||||
return linphone_call_get_cpp_obj(call)->update(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams) : nullptr);
|
||||
}
|
||||
|
||||
int linphone_call_start_update(LinphoneCall *call) {
|
||||
|
|
@ -1327,7 +1327,7 @@ int linphone_call_start_accept_update(LinphoneCall *call, LinphoneCallState next
|
|||
}
|
||||
|
||||
LinphoneStatus linphone_call_accept_update(LinphoneCall *call, const LinphoneCallParams *params) {
|
||||
return linphone_call_get_cpp_obj(call)->acceptUpdate(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams, CallParams) : nullptr);
|
||||
return linphone_call_get_cpp_obj(call)->acceptUpdate(params ? L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams) : nullptr);
|
||||
}
|
||||
|
||||
LinphoneStatus linphone_call_transfer(LinphoneCall *call, const char *refer_to) {
|
||||
|
|
|
|||
|
|
@ -3368,7 +3368,7 @@ static bctbx_list_t *make_routes_for_proxy(LinphoneProxyConfig *proxy, const Lin
|
|||
ret=bctbx_list_append(ret,sal_address_new(local_route));
|
||||
}
|
||||
if (srv_route){
|
||||
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_STRUCT(srv_route, Address, Address)->getInternalAddress()));
|
||||
ret=bctbx_list_append(ret,sal_address_clone(L_GET_PRIVATE_FROM_C_STRUCT(srv_route, Address)->getInternalAddress()));
|
||||
}
|
||||
if (ret==NULL){
|
||||
/*if the proxy address matches the domain part of the destination, then use the same transport
|
||||
|
|
@ -6681,7 +6681,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_STRUCT(params, MediaSessionParams, CallParams)->initDefault(lc);
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(params, MediaSessionParams)->initDefault(lc);
|
||||
}
|
||||
|
||||
void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) {
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
|
|||
linphone_configure_op(cfg->lc, cfg->op, cfg->identity_address, cfg->sent_headers, FALSE);
|
||||
|
||||
if ((contact=guess_contact_for_register(cfg))) {
|
||||
sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_STRUCT(contact, Address, Address)->getInternalAddress());
|
||||
sal_op_set_contact_address(cfg->op, L_GET_PRIVATE_FROM_C_STRUCT(contact, Address)->getInternalAddress());
|
||||
linphone_address_unref(contact);
|
||||
}
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
|
|||
proxy_string,
|
||||
cfg->reg_identity,
|
||||
cfg->expires,
|
||||
cfg->pending_contact ? L_GET_PRIVATE_FROM_C_STRUCT(cfg->pending_contact, Address, Address)->getInternalAddress() : NULL
|
||||
cfg->pending_contact ? L_GET_PRIVATE_FROM_C_STRUCT(cfg->pending_contact, Address)->getInternalAddress() : NULL
|
||||
)==0) {
|
||||
if (cfg->pending_contact) {
|
||||
linphone_address_unref(cfg->pending_contact);
|
||||
|
|
@ -1393,7 +1393,7 @@ const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg)
|
|||
bool_t destroy_route_addr = FALSE;
|
||||
|
||||
if (linphone_proxy_config_get_service_route(cfg)) {
|
||||
route_addr = L_GET_PRIVATE_FROM_C_STRUCT(linphone_proxy_config_get_service_route(cfg), Address, Address)->getInternalAddress();
|
||||
route_addr = L_GET_PRIVATE_FROM_C_STRUCT(linphone_proxy_config_get_service_route(cfg), Address)->getInternalAddress();
|
||||
} else if (linphone_proxy_config_get_route(cfg)) {
|
||||
addr=linphone_proxy_config_get_route(cfg);
|
||||
} else if(linphone_proxy_config_get_addr(cfg)) {
|
||||
|
|
|
|||
|
|
@ -29,9 +29,9 @@
|
|||
// =============================================================================
|
||||
|
||||
#define GET_CALL_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, CallSessionParams, CallParams)
|
||||
#define GET_CALL_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, CallSessionParams, CallParams)
|
||||
#define GET_MEDIA_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, MediaSessionParams, CallParams)
|
||||
#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, MediaSessionParams, CallParams)
|
||||
#define GET_CALL_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, CallSessionParams)
|
||||
#define GET_MEDIA_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, MediaSessionParams)
|
||||
#define GET_MEDIA_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, MediaSessionParams)
|
||||
|
||||
L_DECLARE_C_CLONABLE_STRUCT_IMPL(MediaSessionParams, CallParams, call_params)
|
||||
|
||||
|
|
@ -493,11 +493,11 @@ void linphone_call_params_set_no_user_consent (LinphoneCallParams *params, bool_
|
|||
// =============================================================================
|
||||
|
||||
void *linphone_call_params_get_user_data (const LinphoneCallParams *cp) {
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(cp, MediaSessionParams, CallParams);
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(cp, MediaSessionParams);
|
||||
}
|
||||
|
||||
void linphone_call_params_set_user_data (LinphoneCallParams *cp, void *ud) {
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(cp, ud, MediaSessionParams, CallParams);
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(cp, ud, MediaSessionParams);
|
||||
}
|
||||
|
||||
LinphoneCallParams *linphone_call_params_ref (LinphoneCallParams *cp) {
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ void linphone_chat_message_unref (LinphoneChatMessage *msg) {
|
|||
}
|
||||
|
||||
void * linphone_chat_message_get_user_data (const LinphoneChatMessage *msg) {
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(msg, ChatMessage, ChatMessage);
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(msg, ChatMessage);
|
||||
}
|
||||
|
||||
void linphone_chat_message_set_user_data (LinphoneChatMessage *msg, void *ud) {
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(msg, ud, ChatMessage, ChatMessage);
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(msg, ud, ChatMessage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
// =============================================================================
|
||||
|
||||
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, ChatRoom, ChatRoom)
|
||||
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, ChatRoom, ChatRoom)
|
||||
#define GET_CPP_PTR(obj) L_GET_CPP_PTR_FROM_C_STRUCT(obj, ChatRoom)
|
||||
#define GET_CPP_PRIVATE_PTR(obj) L_GET_PRIVATE_FROM_C_STRUCT(obj, ChatRoom)
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ LinphoneChatRoomCbs *linphone_chat_room_get_callbacks (const LinphoneChatRoom *c
|
|||
|
||||
LinphoneParticipant *linphone_chat_room_add_participant (LinphoneChatRoom *cr, const LinphoneAddress *addr) {
|
||||
return L_GET_C_BACK_PTR(GET_CPP_PTR(cr)->addParticipant(
|
||||
*L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address), nullptr, false),
|
||||
*L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address), nullptr, false),
|
||||
Participant, participant);
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +237,7 @@ bctbx_list_t *linphone_chat_room_get_participants (const LinphoneChatRoom *cr) {
|
|||
}
|
||||
|
||||
void linphone_chat_room_remove_participant (LinphoneChatRoom *cr, LinphoneParticipant *participant) {
|
||||
GET_CPP_PTR(cr)->removeParticipant(L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant));
|
||||
GET_CPP_PTR(cr)->removeParticipant(L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant));
|
||||
}
|
||||
|
||||
void linphone_chat_room_remove_participants (LinphoneChatRoom *cr, const bctbx_list_t *participants) {
|
||||
|
|
@ -258,11 +258,11 @@ void linphone_chat_room_unref (LinphoneChatRoom *cr) {
|
|||
}
|
||||
|
||||
void *linphone_chat_room_get_user_data (const LinphoneChatRoom *cr) {
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(cr, ChatRoom, ChatRoom);
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(cr, ChatRoom);
|
||||
}
|
||||
|
||||
void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(cr, ud, ChatRoom, ChatRoom);
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(cr, ud, ChatRoom);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -272,12 +272,12 @@ void linphone_chat_room_set_user_data (LinphoneChatRoom *cr, void *ud) {
|
|||
LinphoneChatRoom *linphone_chat_room_new (LinphoneCore *core, const LinphoneAddress *addr) {
|
||||
LinphoneChatRoom *cr = _linphone_chat_room_init();
|
||||
if (linphone_core_realtime_text_enabled(core))
|
||||
L_SET_CPP_PTR_FROM_C_STRUCT(cr, std::make_shared<LinphonePrivate::RealTimeTextChatRoom>(core, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address)));
|
||||
L_SET_CPP_PTR_FROM_C_STRUCT(cr, std::make_shared<LinphonePrivate::RealTimeTextChatRoom>(core, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address)));
|
||||
else
|
||||
L_SET_CPP_PTR_FROM_C_STRUCT(cr, std::make_shared<LinphonePrivate::BasicChatRoom>(core, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address, Address)));
|
||||
L_SET_CPP_PTR_FROM_C_STRUCT(cr, std::make_shared<LinphonePrivate::BasicChatRoom>(core, *L_GET_CPP_PTR_FROM_C_STRUCT(addr, Address)));
|
||||
linphone_core_notify_chat_room_instantiated(core, cr);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Created);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Created);
|
||||
return cr;
|
||||
}
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ LinphoneChatRoom *linphone_client_group_chat_room_new (LinphoneCore *core, const
|
|||
linphone_address_unref(factoryAddr);
|
||||
std::string from;
|
||||
if (proxy)
|
||||
from = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy), Address, Address)->asString();
|
||||
from = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy), Address)->asString();
|
||||
if (from.empty())
|
||||
from = linphone_core_get_primary_contact(core);
|
||||
LinphonePrivate::Address me(from);
|
||||
|
|
@ -298,8 +298,8 @@ LinphoneChatRoom *linphone_client_group_chat_room_new (LinphoneCore *core, const
|
|||
LinphoneChatRoom *cr = _linphone_chat_room_init();
|
||||
L_SET_CPP_PTR_FROM_C_STRUCT(cr, make_shared<LinphonePrivate::ClientGroupChatRoom>(core, me, l));
|
||||
linphone_core_notify_chat_room_instantiated(core, cr);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::CreationPending);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::Instantiated);
|
||||
L_GET_PRIVATE_FROM_C_STRUCT(cr, ChatRoom)->setState(LinphonePrivate::ChatRoom::State::CreationPending);
|
||||
return cr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ LinphoneEventLog *linphone_event_log_ref (LinphoneEventLog *event_log) {
|
|||
|
||||
LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_log) {
|
||||
return static_cast<LinphoneEventLogType>(
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(event_log, EventLog, EventLog)->getType()
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(event_log, EventLog)->getType()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ LinphoneCallEvent *linphone_call_event_new (LinphoneEventLogType type, LinphoneC
|
|||
call_event,
|
||||
new LINPHONE_NAMESPACE::CallEvent(
|
||||
static_cast<LINPHONE_NAMESPACE::EventLog::Type>(type),
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(call, Call, Call)
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(call, Call)
|
||||
)
|
||||
);
|
||||
return call_event;
|
||||
|
|
@ -79,7 +79,7 @@ extern LinphoneCall *_linphone_call_init ();
|
|||
LinphoneCall *linphone_call_event_get_call (const LinphoneCallEvent *call_event) {
|
||||
return L_GET_C_BACK_PTR(
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(
|
||||
call_event, CallEvent, CallEvent
|
||||
call_event, CallEvent
|
||||
)->getCall(),
|
||||
Call,
|
||||
call
|
||||
|
|
@ -132,7 +132,7 @@ LinphoneChatMessageEvent *linphone_chat_message_event_new (LinphoneChatMessage *
|
|||
L_SET_CPP_PTR_FROM_C_STRUCT(
|
||||
chat_message_event,
|
||||
new LINPHONE_NAMESPACE::ChatMessageEvent(
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(chat_message, ChatMessage, ChatMessage)
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(chat_message, ChatMessage)
|
||||
)
|
||||
);
|
||||
return chat_message_event;
|
||||
|
|
@ -144,7 +144,7 @@ extern LinphoneChatMessage *_linphone_chat_message_init ();
|
|||
LinphoneChatMessage *linphone_chat_message_event_get_chat_message (const LinphoneChatMessageEvent *chat_message_event) {
|
||||
return L_GET_C_BACK_PTR(
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(
|
||||
chat_message_event, ChatMessageEvent, ChatMessageEvent
|
||||
chat_message_event, ChatMessageEvent
|
||||
)->getChatMessage(),
|
||||
ChatMessage,
|
||||
chat_message
|
||||
|
|
|
|||
|
|
@ -39,15 +39,15 @@ void linphone_participant_unref (LinphoneParticipant *participant) {
|
|||
}
|
||||
|
||||
void *linphone_participant_get_user_data(const LinphoneParticipant *participant) {
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(participant, Participant, Participant);
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(participant, Participant);
|
||||
}
|
||||
|
||||
void linphone_participant_set_user_data(LinphoneParticipant *participant, void *ud) {
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(participant, ud, Participant, Participant);
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(participant, ud, Participant);
|
||||
}
|
||||
|
||||
const LinphoneAddress *linphone_participant_get_address (const LinphoneParticipant *participant) {
|
||||
LinphonePrivate::Address addr = L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant)->getAddress();
|
||||
LinphonePrivate::Address addr = L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant)->getAddress();
|
||||
if (participant->addressCache)
|
||||
linphone_address_unref(participant->addressCache);
|
||||
participant->addressCache = linphone_address_new(addr.asString().c_str());
|
||||
|
|
@ -55,9 +55,9 @@ const LinphoneAddress *linphone_participant_get_address (const LinphoneParticipa
|
|||
}
|
||||
|
||||
bool_t linphone_participant_is_admin (const LinphoneParticipant *participant) {
|
||||
return L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant)->isAdmin();
|
||||
return L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant)->isAdmin();
|
||||
}
|
||||
|
||||
void linphone_participant_set_admin (LinphoneParticipant *participant, bool_t value) {
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant)->setAdmin(value);
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant)->setAdmin(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,11 +339,16 @@ LINPHONE_END_NAMESPACE
|
|||
return object; \
|
||||
}
|
||||
|
||||
// String conversions between C/C++.
|
||||
#define L_STRING_TO_C(STR) ((STR).empty() ? NULL : (STR).c_str())
|
||||
#define L_C_TO_STRING(STR) ((STR) == NULL ? std::string() : (STR))
|
||||
|
||||
#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC<LINPHONE_NAMESPACE::CPP_TYPE, Linphone ## C_TYPE>(OBJECT)
|
||||
// Get the cpp-ptr from a wrapped C object.
|
||||
#define L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getCppPtrFromC< \
|
||||
LINPHONE_NAMESPACE::CPP_TYPE, \
|
||||
std::remove_pointer<decltype(OBJECT)>::type \
|
||||
>(OBJECT)
|
||||
|
||||
#define L_SET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_PTR) \
|
||||
LINPHONE_NAMESPACE::Wrapper::setCppPtrFromC(OBJECT, CPP_PTR)
|
||||
|
|
@ -351,21 +356,21 @@ LINPHONE_END_NAMESPACE
|
|||
#define L_GET_PRIVATE(OBJECT) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getPrivate(OBJECT)
|
||||
|
||||
#define L_GET_PRIVATE_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \
|
||||
#define L_GET_PRIVATE_FROM_C_STRUCT(OBJECT, CPP_TYPE) \
|
||||
L_GET_PRIVATE(LINPHONE_NAMESPACE::Wrapper::getCppPtr( \
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE) \
|
||||
))
|
||||
|
||||
#define L_GET_C_BACK_PTR(OBJECT, C_TYPE, C_NAME) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getCBackPtr<Linphone ## C_TYPE>(OBJECT, _linphone_ ## C_NAME ## _init)
|
||||
|
||||
#define L_GET_USER_DATA_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \
|
||||
#define L_GET_USER_DATA_FROM_C_STRUCT(OBJECT, CPP_TYPE) \
|
||||
LINPHONE_NAMESPACE::Wrapper::getUserData( \
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE) \
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE) \
|
||||
)
|
||||
#define L_SET_USER_DATA_FROM_C_STRUCT(OBJECT, VALUE, CPP_TYPE, C_TYPE) \
|
||||
#define L_SET_USER_DATA_FROM_C_STRUCT(OBJECT, VALUE, CPP_TYPE) \
|
||||
LINPHONE_NAMESPACE::Wrapper::setUserData( \
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE, C_TYPE), \
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(OBJECT, CPP_TYPE), \
|
||||
VALUE \
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -832,7 +832,7 @@ void ChatRoom::sendMessage (LinphoneChatMessage *msg) {
|
|||
if (identity.empty()) {
|
||||
LinphoneProxyConfig *proxy = linphone_core_lookup_known_proxy(d->core, peer);
|
||||
if (proxy) {
|
||||
identity = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy), Address, Address)->asString();
|
||||
identity = L_GET_CPP_PTR_FROM_C_STRUCT(linphone_proxy_config_get_identity_address(proxy), Address)->asString();
|
||||
} else {
|
||||
identity = linphone_core_get_primary_contact(d->core);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ void CallSessionPrivate::setContactOp () {
|
|||
SalAddress *salAddress = nullptr;
|
||||
LinphoneAddress *contact = getFixedContact();
|
||||
if (contact) {
|
||||
salAddress = const_cast<SalAddress *>(L_GET_PRIVATE_FROM_C_STRUCT(contact, Address, Address)->getInternalAddress());
|
||||
salAddress = const_cast<SalAddress *>(L_GET_PRIVATE_FROM_C_STRUCT(contact, Address)->getInternalAddress());
|
||||
sal_address_ref(salAddress);
|
||||
linphone_address_unref(contact);
|
||||
}
|
||||
|
|
@ -1042,7 +1042,7 @@ const Address& CallSession::getRemoteAddress () const {
|
|||
L_D(const CallSession);
|
||||
return *L_GET_CPP_PTR_FROM_C_STRUCT((d->direction == LinphoneCallIncoming)
|
||||
? linphone_call_log_get_from(d->log) : linphone_call_log_get_to(d->log),
|
||||
Address, Address);
|
||||
Address);
|
||||
}
|
||||
|
||||
string CallSession::getRemoteAddressAsString () const {
|
||||
|
|
|
|||
|
|
@ -1120,7 +1120,7 @@ void MediaSessionPrivate::selectOutgoingIpVersion () {
|
|||
}
|
||||
|
||||
const LinphoneAddress *to = linphone_call_log_get_to_address(log);
|
||||
if (sal_address_is_ipv6(L_GET_PRIVATE_FROM_C_STRUCT(to, Address, Address)->getInternalAddress()))
|
||||
if (sal_address_is_ipv6(L_GET_PRIVATE_FROM_C_STRUCT(to, Address)->getInternalAddress()))
|
||||
af = AF_INET6;
|
||||
else if (destProxy && destProxy->op)
|
||||
af = sal_op_get_address_family(destProxy->op);
|
||||
|
|
@ -1232,7 +1232,11 @@ void MediaSessionPrivate::makeLocalMediaDescription () {
|
|||
md->nb_streams = (biggestDesc ? biggestDesc->nb_streams : 1);
|
||||
|
||||
/* Re-check local ip address each time we make a new offer, because it may change in case of network reconnection */
|
||||
getLocalIp(*L_GET_CPP_PTR_FROM_C_STRUCT((direction == LinphoneCallOutgoing) ? log->to : log->from, Address, Address));
|
||||
{
|
||||
LinphoneAddress *address = (direction == LinphoneCallOutgoing ? log->to : log->from);
|
||||
getLocalIp(*L_GET_CPP_PTR_FROM_C_STRUCT(address, Address));
|
||||
}
|
||||
|
||||
strncpy(md->addr, mediaLocalIp.c_str(), sizeof(md->addr));
|
||||
LinphoneAddress *addr = nullptr;
|
||||
if (destProxy) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue