mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-26 07:38:09 +00:00
Fix IM encryption engine for automatic wrapper generation.
This commit is contained in:
parent
bd99fe6099
commit
563bb427b0
9 changed files with 244 additions and 172 deletions
|
|
@ -374,9 +374,9 @@ void _linphone_chat_room_send_message(LinphoneChatRoom *cr, LinphoneChatMessage
|
|||
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineOutgoingMessageCb cb_process_outgoing_message = linphone_im_encryption_engine_cbs_get_process_outgoing_message(imee_cbs);
|
||||
LinphoneImEncryptionEngineCbsOutgoingMessageCb cb_process_outgoing_message = linphone_im_encryption_engine_cbs_get_process_outgoing_message(imee_cbs);
|
||||
if (cb_process_outgoing_message) {
|
||||
retval = cb_process_outgoing_message(lc, cr, msg);
|
||||
retval = cb_process_outgoing_message(imee, cr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -520,9 +520,9 @@ LinphoneReason linphone_core_message_received(LinphoneCore *lc, SalOp *op, const
|
|||
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineIncomingMessageCb cb_process_incoming_message = linphone_im_encryption_engine_cbs_get_process_incoming_message(imee_cbs);
|
||||
LinphoneImEncryptionEngineCbsIncomingMessageCb cb_process_incoming_message = linphone_im_encryption_engine_cbs_get_process_incoming_message(imee_cbs);
|
||||
if (cb_process_incoming_message) {
|
||||
retval = cb_process_incoming_message(lc, cr, msg);
|
||||
retval = cb_process_incoming_message(imee, cr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -728,9 +728,9 @@ LinphoneReason linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op,
|
|||
msg->content_type = ms_strdup("application/im-iscomposing+xml");
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineIncomingMessageCb cb_process_incoming_message = linphone_im_encryption_engine_cbs_get_process_incoming_message(imee_cbs);
|
||||
LinphoneImEncryptionEngineCbsIncomingMessageCb cb_process_incoming_message = linphone_im_encryption_engine_cbs_get_process_incoming_message(imee_cbs);
|
||||
if (cb_process_incoming_message) {
|
||||
retval = cb_process_incoming_message(lc, cr, msg);
|
||||
retval = cb_process_incoming_message(imee, cr, msg);
|
||||
}
|
||||
}
|
||||
if (retval <= 0) {
|
||||
|
|
@ -894,9 +894,9 @@ static void linphone_chat_room_send_is_composing_notification(LinphoneChatRoom *
|
|||
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineOutgoingMessageCb cb_process_outgoing_message = linphone_im_encryption_engine_cbs_get_process_outgoing_message(imee_cbs);
|
||||
LinphoneImEncryptionEngineCbsOutgoingMessageCb cb_process_outgoing_message = linphone_im_encryption_engine_cbs_get_process_outgoing_message(imee_cbs);
|
||||
if (cb_process_outgoing_message) {
|
||||
retval = cb_process_outgoing_message(cr->lc, cr, msg);
|
||||
retval = cb_process_outgoing_message(imee, cr, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ static int on_send_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t *
|
|||
imee = linphone_core_get_im_encryption_engine(lc);
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineUploadingFileCb cb_process_uploading_file = linphone_im_encryption_engine_cbs_get_process_uploading_file(imee_cbs);
|
||||
LinphoneImEncryptionEngineCbsUploadingFileCb cb_process_uploading_file = linphone_im_encryption_engine_cbs_get_process_uploading_file(imee_cbs);
|
||||
if (cb_process_uploading_file) {
|
||||
char *encrypted_buffer = (char *)ms_malloc0(*size);
|
||||
retval = cb_process_uploading_file(lc, msg, offset, (char *)buffer, size, encrypted_buffer);
|
||||
retval = cb_process_uploading_file(imee, msg, offset, (char *)buffer, size, encrypted_buffer);
|
||||
if (retval == 0) {
|
||||
memcpy(buffer, encrypted_buffer, *size);
|
||||
}
|
||||
|
|
@ -151,9 +151,9 @@ static void on_send_end(belle_sip_user_body_handler_t *bh, void *data) {
|
|||
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineUploadingFileCb cb_process_uploading_file = linphone_im_encryption_engine_cbs_get_process_uploading_file(imee_cbs);
|
||||
LinphoneImEncryptionEngineCbsUploadingFileCb cb_process_uploading_file = linphone_im_encryption_engine_cbs_get_process_uploading_file(imee_cbs);
|
||||
if (cb_process_uploading_file) {
|
||||
cb_process_uploading_file(lc, msg, 0, NULL, NULL, NULL);
|
||||
cb_process_uploading_file(imee, msg, 0, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -181,19 +181,19 @@ static void linphone_chat_message_process_response_from_post_file(void *data,
|
|||
LinphoneImEncryptionEngine *imee = linphone_core_get_im_encryption_engine(msg->chat_room->lc);
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineIsEncryptionEnabledForFileTransferCb 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(msg->chat_room->lc, msg->chat_room);
|
||||
is_file_encryption_enabled = is_encryption_enabled_for_file_transfer_cb(imee, msg->chat_room);
|
||||
}
|
||||
}
|
||||
/* shall we encrypt the file */
|
||||
if (is_file_encryption_enabled) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineGenerateFileTransferKeyCb 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(msg->chat_room->lc, msg->chat_room, msg);
|
||||
generate_file_transfer_key_cb(imee, msg->chat_room, msg);
|
||||
}
|
||||
/* temporary storage for the Content-disposition header value : use a generic filename to not leak it
|
||||
* Actual filename stored in msg->file_transfer_information->name will be set in encrypted msg
|
||||
|
|
@ -362,9 +362,9 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
|
|||
imee = linphone_core_get_im_encryption_engine(lc);
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineDownloadingFileCb cb_process_downloading_file = linphone_im_encryption_engine_cbs_get_process_downloading_file(imee_cbs);
|
||||
LinphoneImEncryptionEngineCbsDownloadingFileCb cb_process_downloading_file = linphone_im_encryption_engine_cbs_get_process_downloading_file(imee_cbs);
|
||||
if (cb_process_downloading_file) {
|
||||
retval = cb_process_downloading_file(lc, msg, (const char *)buffer, size, decrypted_buffer);
|
||||
retval = cb_process_downloading_file(imee, msg, (const char *)buffer, size, decrypted_buffer);
|
||||
if (retval == 0) {
|
||||
memcpy(buffer, decrypted_buffer, size);
|
||||
}
|
||||
|
|
@ -397,9 +397,9 @@ static void on_recv_end(belle_sip_user_body_handler_t *bh, void *data) {
|
|||
|
||||
if (imee) {
|
||||
LinphoneImEncryptionEngineCbs *imee_cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
LinphoneImEncryptionEngineDownloadingFileCb cb_process_downloading_file = linphone_im_encryption_engine_cbs_get_process_downloading_file(imee_cbs);
|
||||
LinphoneImEncryptionEngineCbsDownloadingFileCb cb_process_downloading_file = linphone_im_encryption_engine_cbs_get_process_downloading_file(imee_cbs);
|
||||
if (cb_process_downloading_file) {
|
||||
retval = cb_process_downloading_file(lc, msg, NULL, 0, NULL);
|
||||
retval = cb_process_downloading_file(imee, msg, NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,29 +19,43 @@ 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"
|
||||
|
||||
struct _LinphoneImEncryptionEngineCbs {
|
||||
void *user_data;
|
||||
LinphoneImEncryptionEngineIncomingMessageCb process_incoming_message;
|
||||
LinphoneImEncryptionEngineOutgoingMessageCb process_outgoing_message;
|
||||
LinphoneImEncryptionEngineIsEncryptionEnabledForFileTransferCb is_encryption_enabled_for_file_transfer;
|
||||
LinphoneImEncryptionEngineGenerateFileTransferKeyCb generate_file_transfer_key;
|
||||
LinphoneImEncryptionEngineDownloadingFileCb process_downlading_file;
|
||||
LinphoneImEncryptionEngineUploadingFileCb process_uploading_file;
|
||||
};
|
||||
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneImEncryptionEngineCbs);
|
||||
|
||||
struct _LinphoneImEncryptionEngine {
|
||||
void *user_data;
|
||||
LinphoneImEncryptionEngineCbs *callbacks;
|
||||
};
|
||||
BELLE_SIP_INSTANCIATE_VPTR(LinphoneImEncryptionEngineCbs, belle_sip_object_t,
|
||||
NULL, // destroy
|
||||
NULL, // clone
|
||||
NULL, // marshal
|
||||
TRUE
|
||||
);
|
||||
|
||||
static void linphone_im_encryption_engine_destroy(LinphoneImEncryptionEngine *imee) {
|
||||
if (imee->callbacks) linphone_im_encryption_engine_cbs_unref(imee->callbacks);
|
||||
}
|
||||
|
||||
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneImEncryptionEngine);
|
||||
|
||||
BELLE_SIP_INSTANCIATE_VPTR(LinphoneImEncryptionEngine, belle_sip_object_t,
|
||||
(belle_sip_object_destroy_t)linphone_im_encryption_engine_destroy,
|
||||
NULL, // clone
|
||||
NULL, // marshal
|
||||
TRUE
|
||||
);
|
||||
|
||||
LinphoneImEncryptionEngineCbs *linphone_im_encryption_engine_cbs_new(void) {
|
||||
LinphoneImEncryptionEngineCbs *cbs = ms_new0(LinphoneImEncryptionEngineCbs, 1);
|
||||
LinphoneImEncryptionEngineCbs *cbs = belle_sip_object_new(LinphoneImEncryptionEngineCbs);
|
||||
belle_sip_object_ref(cbs);
|
||||
return cbs;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_cbs_destory(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
ms_free(cbs);
|
||||
LinphoneImEncryptionEngineCbs * linphone_im_encryption_engine_cbs_ref(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
belle_sip_object_ref(cbs);
|
||||
return cbs;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_cbs_unref(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
belle_sip_object_unref(cbs);
|
||||
}
|
||||
|
||||
void *linphone_im_encryption_engine_cbs_get_user_data(const LinphoneImEncryptionEngineCbs *cbs) {
|
||||
|
|
@ -52,15 +66,20 @@ void linphone_im_encryption_engine_cbs_set_user_data(LinphoneImEncryptionEngineC
|
|||
cbs->user_data = data;
|
||||
}
|
||||
|
||||
LinphoneImEncryptionEngine *linphone_im_encryption_engine_new(void) {
|
||||
LinphoneImEncryptionEngine *linphone_im_encryption_engine_new(LinphoneCore *lc) {
|
||||
LinphoneImEncryptionEngine *imee = ms_new0(LinphoneImEncryptionEngine, 1);
|
||||
imee->lc = lc;
|
||||
imee->callbacks = linphone_im_encryption_engine_cbs_new();
|
||||
return imee;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_destory(LinphoneImEncryptionEngine *imee) {
|
||||
if (imee->callbacks) linphone_im_encryption_engine_cbs_destory(imee->callbacks);
|
||||
ms_free(imee);
|
||||
LinphoneImEncryptionEngine * linphone_im_encryption_engine_ref(LinphoneImEncryptionEngine *imee) {
|
||||
belle_sip_object_ref(imee);
|
||||
return imee;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_unref(LinphoneImEncryptionEngine *imee) {
|
||||
belle_sip_object_unref(imee);
|
||||
}
|
||||
|
||||
void *linphone_im_encryption_engine_get_user_data(const LinphoneImEncryptionEngine *imee) {
|
||||
|
|
@ -75,50 +94,50 @@ LinphoneImEncryptionEngineCbs* linphone_im_encryption_engine_get_callbacks(const
|
|||
return imee->callbacks;
|
||||
}
|
||||
|
||||
LinphoneImEncryptionEngineIncomingMessageCb linphone_im_encryption_engine_cbs_get_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
LinphoneImEncryptionEngineCbsIncomingMessageCb linphone_im_encryption_engine_cbs_get_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
return cbs->process_incoming_message;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_cbs_set_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineIncomingMessageCb cb) {
|
||||
void linphone_im_encryption_engine_cbs_set_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsIncomingMessageCb cb) {
|
||||
cbs->process_incoming_message = cb;
|
||||
}
|
||||
|
||||
LinphoneImEncryptionEngineOutgoingMessageCb linphone_im_encryption_engine_cbs_get_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
LinphoneImEncryptionEngineCbsOutgoingMessageCb linphone_im_encryption_engine_cbs_get_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
return cbs->process_outgoing_message;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_cbs_set_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineOutgoingMessageCb cb) {
|
||||
void linphone_im_encryption_engine_cbs_set_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsOutgoingMessageCb cb) {
|
||||
cbs->process_outgoing_message = cb;
|
||||
}
|
||||
|
||||
LinphoneImEncryptionEngineDownloadingFileCb linphone_im_encryption_engine_cbs_get_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
LinphoneImEncryptionEngineCbsDownloadingFileCb linphone_im_encryption_engine_cbs_get_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
return cbs->process_downlading_file;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_cbs_set_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineDownloadingFileCb cb) {
|
||||
void linphone_im_encryption_engine_cbs_set_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsDownloadingFileCb cb) {
|
||||
cbs->process_downlading_file = cb;
|
||||
}
|
||||
|
||||
LinphoneImEncryptionEngineUploadingFileCb linphone_im_encryption_engine_cbs_get_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
LinphoneImEncryptionEngineCbsUploadingFileCb linphone_im_encryption_engine_cbs_get_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
return cbs->process_uploading_file;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_cbs_set_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineUploadingFileCb cb) {
|
||||
void linphone_im_encryption_engine_cbs_set_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsUploadingFileCb cb) {
|
||||
cbs->process_uploading_file = cb;
|
||||
}
|
||||
|
||||
LinphoneImEncryptionEngineIsEncryptionEnabledForFileTransferCb linphone_im_encryption_engine_cbs_get_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb linphone_im_encryption_engine_cbs_get_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
return cbs->is_encryption_enabled_for_file_transfer;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_cbs_set_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineIsEncryptionEnabledForFileTransferCb cb) {
|
||||
void linphone_im_encryption_engine_cbs_set_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb cb) {
|
||||
cbs->is_encryption_enabled_for_file_transfer = cb;
|
||||
}
|
||||
|
||||
LinphoneImEncryptionEngineGenerateFileTransferKeyCb linphone_im_encryption_engine_cbs_get_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb linphone_im_encryption_engine_cbs_get_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs) {
|
||||
return cbs->generate_file_transfer_key;
|
||||
}
|
||||
|
||||
void linphone_im_encryption_engine_cbs_set_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineGenerateFileTransferKeyCb cb) {
|
||||
void linphone_im_encryption_engine_cbs_set_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb cb) {
|
||||
cbs->generate_file_transfer_key = cb;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -858,7 +858,8 @@ bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
int lime_im_encryption_engine_process_incoming_message_cb(LinphoneCore* lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
int lime_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
LinphoneCore *lc = linphone_im_encryption_engine_get_core(engine);
|
||||
int errcode = -1;
|
||||
/* check if we have a xml/cipher message to be decrypted */
|
||||
if (msg->content_type && (strcmp("xml/cipher", msg->content_type) == 0 || strcmp("application/cipher.vnd.gsma.rcs-ft-http+xml", msg->content_type) == 0)) {
|
||||
|
|
@ -928,7 +929,8 @@ int lime_im_encryption_engine_process_incoming_message_cb(LinphoneCore* lc, Linp
|
|||
return errcode;
|
||||
}
|
||||
|
||||
int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneCore* lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
LinphoneCore *lc = linphone_im_encryption_engine_get_core(engine);
|
||||
int errcode = -1;
|
||||
char *content_type = "xml/cipher";
|
||||
|
||||
|
|
@ -1001,7 +1003,7 @@ int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneCore* lc, Linp
|
|||
return errcode;
|
||||
}
|
||||
|
||||
int lime_im_encryption_engine_process_downloading_file_cb(LinphoneCore *lc, LinphoneChatMessage *msg, const char *buffer, size_t size, char *decrypted_buffer) {
|
||||
int lime_im_encryption_engine_process_downloading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, const char *buffer, size_t size, char *decrypted_buffer) {
|
||||
if (linphone_content_get_key(msg->file_transfer_information) == NULL) return -1;
|
||||
|
||||
if (buffer == NULL || size == 0) {
|
||||
|
|
@ -1013,7 +1015,7 @@ int lime_im_encryption_engine_process_downloading_file_cb(LinphoneCore *lc, Linp
|
|||
(char *)buffer);
|
||||
}
|
||||
|
||||
int lime_im_encryption_engine_process_uploading_file_cb(LinphoneCore *lc, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer) {
|
||||
int lime_im_encryption_engine_process_uploading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer) {
|
||||
if (linphone_content_get_key(msg->file_transfer_information) == NULL) return -1;
|
||||
|
||||
if (buffer == NULL || *size == 0) {
|
||||
|
|
@ -1029,11 +1031,12 @@ int lime_im_encryption_engine_process_uploading_file_cb(LinphoneCore *lc, Linpho
|
|||
(char *)buffer, encrypted_buffer);
|
||||
}
|
||||
|
||||
bool_t lime_im_encryption_engine_is_file_encryption_enabled_cb(LinphoneCore *lc, LinphoneChatRoom *room) {
|
||||
bool_t lime_im_encryption_engine_is_file_encryption_enabled_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room) {
|
||||
LinphoneCore *lc = linphone_im_encryption_engine_get_core(engine);
|
||||
return linphone_chat_room_lime_available(room) && linphone_core_lime_for_file_sharing_enabled(lc);
|
||||
}
|
||||
|
||||
void lime_im_encryption_engine_generate_file_transfer_key_cb(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
void lime_im_encryption_engine_generate_file_transfer_key_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
char keyBuffer [FILE_TRANSFER_KEY_SIZE]; /* temporary storage of generated key: 192 bits of key + 64 bits of initial vector */
|
||||
/* generate a random 192 bits key + 64 bits of initial vector and store it into the
|
||||
* file_transfer_information->key field of the msg */
|
||||
|
|
@ -1068,22 +1071,22 @@ int lime_decryptMessage(limeKey_t *key, uint8_t *encryptedMessage, uint32_t mess
|
|||
bool_t linphone_chat_room_lime_available(LinphoneChatRoom *cr) {
|
||||
return FALSE;
|
||||
}
|
||||
int lime_im_encryption_engine_process_incoming_message_cb(LinphoneCore* lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
int lime_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
return 500;
|
||||
}
|
||||
int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneCore* lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
return 500;
|
||||
}
|
||||
int lime_im_encryption_engine_process_downloading_file_cb(LinphoneCore *lc, LinphoneChatMessage *msg, const char *buffer, size_t size, char *decrypted_buffer) {
|
||||
int lime_im_encryption_engine_process_downloading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, const char *buffer, size_t size, char *decrypted_buffer) {
|
||||
return 500;
|
||||
}
|
||||
int lime_im_encryption_engine_process_uploading_file_cb(LinphoneCore *lc, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer) {
|
||||
int lime_im_encryption_engine_process_uploading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer) {
|
||||
return 500;
|
||||
}
|
||||
bool_t lime_im_encryption_engine_is_file_encryption_enabled_cb(LinphoneCore *lc, LinphoneChatRoom *room) {
|
||||
bool_t lime_im_encryption_engine_is_file_encryption_enabled_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room) {
|
||||
return FALSE;
|
||||
}
|
||||
void lime_im_encryption_engine_generate_file_transfer_key_cb(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
void lime_im_encryption_engine_generate_file_transfer_key_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg) {
|
||||
|
||||
}
|
||||
#endif /* HAVE_LIME */
|
||||
|
|
|
|||
|
|
@ -205,16 +205,16 @@ LINPHONE_PUBLIC char *lime_error_code_to_string(int errorCode);
|
|||
*/
|
||||
LINPHONE_PUBLIC bool_t lime_is_available(void);
|
||||
|
||||
int lime_im_encryption_engine_process_incoming_message_cb(LinphoneCore* lc, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
int lime_im_encryption_engine_process_incoming_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
|
||||
int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneCore* lc, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
int lime_im_encryption_engine_process_outgoing_message_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
|
||||
int lime_im_encryption_engine_process_downloading_file_cb(LinphoneCore *lc, LinphoneChatMessage *msg, const char *buffer, size_t size, char *decrypted_buffer);
|
||||
int lime_im_encryption_engine_process_downloading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, const char *buffer, size_t size, char *decrypted_buffer);
|
||||
|
||||
int lime_im_encryption_engine_process_uploading_file_cb(LinphoneCore *lc, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer);
|
||||
int lime_im_encryption_engine_process_uploading_file_cb(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer);
|
||||
|
||||
bool_t lime_im_encryption_engine_is_file_encryption_enabled_cb(LinphoneCore *lc, LinphoneChatRoom *room);
|
||||
bool_t lime_im_encryption_engine_is_file_encryption_enabled_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room);
|
||||
|
||||
void lime_im_encryption_engine_generate_file_transfer_key_cb(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
void lime_im_encryption_engine_generate_file_transfer_key_cb(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
|
||||
#endif /* LIME_H */
|
||||
|
|
|
|||
|
|
@ -1965,7 +1965,7 @@ void linphone_core_enable_lime(LinphoneCore *lc, LinphoneLimeState val){
|
|||
}
|
||||
|
||||
if (val != LinphoneLimeDisabled) {
|
||||
LinphoneImEncryptionEngine *imee = linphone_im_encryption_engine_new();
|
||||
LinphoneImEncryptionEngine *imee = linphone_im_encryption_engine_new(lc);
|
||||
LinphoneImEncryptionEngineCbs *cbs = linphone_im_encryption_engine_get_callbacks(imee);
|
||||
linphone_im_encryption_engine_cbs_set_process_incoming_message(cbs, lime_im_encryption_engine_process_incoming_message_cb);
|
||||
linphone_im_encryption_engine_cbs_set_process_outgoing_message(cbs, lime_im_encryption_engine_process_outgoing_message_cb);
|
||||
|
|
@ -1976,7 +1976,7 @@ void linphone_core_enable_lime(LinphoneCore *lc, LinphoneLimeState val){
|
|||
lc->im_encryption_engine = imee;
|
||||
} else {
|
||||
if (lc->im_encryption_engine) {
|
||||
linphone_im_encryption_engine_destory(lc->im_encryption_engine);
|
||||
linphone_im_encryption_engine_unref(lc->im_encryption_engine);
|
||||
lc->im_encryption_engine = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1491,6 +1491,32 @@ MsZrtpCryptoTypesCount linphone_core_get_zrtp_hash_suites(LinphoneCore *lc, MSZr
|
|||
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(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(LinphoneImEncryptionEngine);
|
||||
|
||||
LinphoneImEncryptionEngine *linphone_im_encryption_engine_new(LinphoneCore *lc);
|
||||
|
||||
/** Belle Sip-based objects need unique ids
|
||||
*/
|
||||
|
||||
|
|
@ -1507,6 +1533,8 @@ BELLE_SIP_TYPE_ID(LinphoneChatMessage),
|
|||
BELLE_SIP_TYPE_ID(LinphoneChatMessageCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatRoom),
|
||||
BELLE_SIP_TYPE_ID(LinphoneContent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngine),
|
||||
BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngineCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider),
|
||||
BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch),
|
||||
BELLE_SIP_TYPE_ID(LinphoneProxyConfig),
|
||||
|
|
|
|||
|
|
@ -27,216 +27,231 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Callback to decrypt incoming LinphoneChatMessage
|
||||
* @param lc the LinphoneCore object
|
||||
* @param room the LinphoneChatRoom object
|
||||
* @param msg the LinphoneChatMessage object
|
||||
* @return -1 if nothing to be done, 0 on success or an integer > 0 for error
|
||||
*/
|
||||
typedef int (*LinphoneImEncryptionEngineIncomingMessageCb)(LinphoneCore* lc, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
* @addtogroup misc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Callback to encrypt outging LinphoneChatMessage
|
||||
* @param lc the LinphoneCore object
|
||||
* @param room the LinphoneChatRoom object
|
||||
* @param msg the LinphoneChatMessage object
|
||||
* IM encryption engine.
|
||||
*/
|
||||
typedef struct _LinphoneImEncryptionEngine LinphoneImEncryptionEngine;
|
||||
|
||||
/**
|
||||
* Callback to decrypt incoming LinphoneChatMessage
|
||||
* @param engine ImEncryptionEngine object
|
||||
* @param room LinphoneChatRoom object
|
||||
* @param msg LinphoneChatMessage object
|
||||
* @return -1 if nothing to be done, 0 on success or an integer > 0 for error
|
||||
*/
|
||||
typedef int (*LinphoneImEncryptionEngineOutgoingMessageCb)(LinphoneCore* lc, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
typedef int (*LinphoneImEncryptionEngineCbsIncomingMessageCb)(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
|
||||
/**
|
||||
* Callback to encrypt outgoing LinphoneChatMessage
|
||||
* @param engine LinphoneImEncryptionEngine object
|
||||
* @param room LinphoneChatRoom object
|
||||
* @param msg LinphoneChatMessage object
|
||||
* @return -1 if nothing to be done, 0 on success or an integer > 0 for error
|
||||
*/
|
||||
typedef int (*LinphoneImEncryptionEngineCbsOutgoingMessageCb)(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
|
||||
/**
|
||||
* Callback to know whether or not the engine will encrypt files before uploading them
|
||||
* @param lc the LinphoneCore object
|
||||
* @param room the LinphoneChatRoom object
|
||||
* @param engine LinphoneImEncryptionEngine object
|
||||
* @param room LinphoneChatRoom object
|
||||
* @return TRUE if files will be encrypted, FALSE otherwise
|
||||
*/
|
||||
typedef bool_t (*LinphoneImEncryptionEngineIsEncryptionEnabledForFileTransferCb)(LinphoneCore *lc, LinphoneChatRoom *room);
|
||||
typedef bool_t (*LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb)(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room);
|
||||
|
||||
/**
|
||||
* Callback to generate the key used to encrypt the files before uploading them
|
||||
* Key can be stored in the LinphoneContent object inside the LinphoneChatMessage using linphone_content_set_key
|
||||
* @param lc the LinphoneCore object
|
||||
* @param room the LinphoneChatRoom object
|
||||
* @param msg the LinphoneChatMessage object
|
||||
* @param engine LinphoneImEncryptionEngine object
|
||||
* @param room LinphoneChatRoom object
|
||||
* @param msg LinphoneChatMessage object
|
||||
*/
|
||||
typedef void (*LinphoneImEncryptionEngineGenerateFileTransferKeyCb)(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
typedef void (*LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb)(LinphoneImEncryptionEngine *engine, LinphoneChatRoom *room, LinphoneChatMessage *msg);
|
||||
|
||||
/**
|
||||
* Callback to decrypt downloading file
|
||||
* @param lc the LinphoneCore object
|
||||
* @param msg the LinphoneChatMessage object
|
||||
* @param buffer the encrypted data buffer
|
||||
* @param size the size of the encrypted data buffer
|
||||
* @param decrypted_buffer the buffer in which to write the decrypted data
|
||||
* @param engine LinphoneImEncryptionEngine object
|
||||
* @param msg LinphoneChatMessage object
|
||||
* @param buffer Encrypted data buffer
|
||||
* @param size Size of the encrypted data buffer
|
||||
* @param decrypted_buffer Buffer in which to write the decrypted data
|
||||
* @return -1 if nothing to be done, 0 on success or an integer > 0 for error
|
||||
*/
|
||||
typedef int (*LinphoneImEncryptionEngineDownloadingFileCb)(LinphoneCore *lc, LinphoneChatMessage *msg, const char *buffer, size_t size, char *decrypted_buffer);
|
||||
typedef int (*LinphoneImEncryptionEngineCbsDownloadingFileCb)(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, const char *buffer, size_t size, char *decrypted_buffer);
|
||||
|
||||
/**
|
||||
* Callback to encrypt uploading file
|
||||
* @param lc the LinphoneCore object
|
||||
* @param msg the LinphoneChatMessage object
|
||||
* @param buffer the encrypted data buffer
|
||||
* @param size the size of the plain data buffer and the size of the encrypted data buffer once encryption is done
|
||||
* @param encrypted_buffer the buffer in which to write the encrypted data
|
||||
* @param engine LinphoneImEncryptionEngine object
|
||||
* @param msg LinphoneChatMessage object
|
||||
* @param buffer Encrypted data buffer
|
||||
* @param size Size of the plain data buffer and the size of the encrypted data buffer once encryption is done
|
||||
* @param encrypted_buffer Buffer in which to write the encrypted data
|
||||
* @return -1 if nothing to be done, 0 on success or an integer > 0 for error
|
||||
*/
|
||||
typedef int (*LinphoneImEncryptionEngineUploadingFileCb)(LinphoneCore *lc, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer);
|
||||
typedef int (*LinphoneImEncryptionEngineCbsUploadingFileCb)(LinphoneImEncryptionEngine *engine, LinphoneChatMessage *msg, size_t offset, const char *buffer, size_t *size, char *encrypted_buffer);
|
||||
|
||||
/**
|
||||
* An object to handle the callbacks for the handling a LinphoneImEncryptionEngine object.
|
||||
*/
|
||||
typedef struct _LinphoneImEncryptionEngineCbs LinphoneImEncryptionEngineCbs;
|
||||
|
||||
typedef struct _LinphoneImEncryptionEngine LinphoneImEncryptionEngine;
|
||||
/**
|
||||
* Acquire a reference to the LinphoneImEncryptionEngineCbs.
|
||||
* @param[in] cbs LinphoneImEncryptionEngineCbs object.
|
||||
* @return The same LinphoneImEncryptionEngineCbs object.
|
||||
**/
|
||||
LinphoneImEncryptionEngineCbs * linphone_im_encryption_engine_cbs_ref(LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
LinphoneImEncryptionEngineCbs *linphone_im_encryption_engine_cbs_new(void);
|
||||
|
||||
void linphone_im_encryption_engine_cbs_destory(LinphoneImEncryptionEngineCbs *cbs);
|
||||
/**
|
||||
* Release reference to the LinphoneImEncryptionEngineCbs.
|
||||
* @param[in] cbs LinphoneImEncryptionEngineCbs object.
|
||||
**/
|
||||
void linphone_im_encryption_engine_cbs_unref(LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
/**
|
||||
* Gets the user data in the LinphoneImEncryptionEngineCbs object
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs
|
||||
* @return the user data
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC void *linphone_im_encryption_engine_cbs_get_user_data(const LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
/**
|
||||
* Sets the user data in the LinphoneImEncryptionEngineCbs object
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param data the user data
|
||||
* @ingroup misc
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] data the user data
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_user_data(LinphoneImEncryptionEngineCbs *cbs, void *data);
|
||||
|
||||
/**
|
||||
* Creates a LinphoneImEncryptionEngine object
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngine *linphone_im_encryption_engine_new(void);
|
||||
* Acquire a reference to the LinphoneImEncryptionEngine.
|
||||
* @param[in] imee LinphoneImEncryptionEngine object.
|
||||
* @return The same LinphoneImEncryptionEngine object.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngine * linphone_im_encryption_engine_ref(LinphoneImEncryptionEngine *imee);
|
||||
|
||||
/**
|
||||
* Destroys the LinphoneImEncryptionEngine
|
||||
* @param imee the LinphoneImEncryptionEngine object
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_destory(LinphoneImEncryptionEngine *imee);
|
||||
* Release reference to the LinphoneImEncryptionEngine.
|
||||
* @param[in] cbs LinphoneImEncryptionEngine object.
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_unref(LinphoneImEncryptionEngine *imee);
|
||||
|
||||
/**
|
||||
* Gets the user data in the LinphoneImEncryptionEngine object
|
||||
* @param imee the LinphoneImEncryptionEngine
|
||||
* @param[in] imee the LinphoneImEncryptionEngine
|
||||
* @return the user data
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC void *linphone_im_encryption_engine_get_user_data(const LinphoneImEncryptionEngine *imee);
|
||||
|
||||
/**
|
||||
* Sets the user data in the LinphoneImEncryptionEngine object
|
||||
* @param imee the LinphoneImEncryptionEngine object
|
||||
* @param data the user data
|
||||
* @ingroup misc
|
||||
* @param[in] imee the LinphoneImEncryptionEngine object
|
||||
* @param[in] data the user data
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_set_user_data(LinphoneImEncryptionEngine *imee, void *data);
|
||||
|
||||
/**
|
||||
* Gets the LinphoneCore object that created the IM encryption engine
|
||||
* @param[in] imee LinphoneImEncryptionEngine object
|
||||
* @return The LinphoneCore object that created the IM encryption engine
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneCore * linphone_im_encryption_engine_get_core(LinphoneImEncryptionEngine *imee);
|
||||
|
||||
/**
|
||||
* Gets the LinphoneImEncryptionEngineCbs object that holds the callbacks
|
||||
* @param imee the LinphoneImEncryptionEngine object
|
||||
* @param[in] imee the LinphoneImEncryptionEngine object
|
||||
* @return the LinphoneImEncryptionEngineCbs object
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineCbs* linphone_im_encryption_engine_get_callbacks(const LinphoneImEncryptionEngine *imee);
|
||||
|
||||
/**
|
||||
* Gets the callback that will decrypt the chat messages upon reception
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @return the callback
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineIncomingMessageCb linphone_im_encryption_engine_cbs_get_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs);
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsIncomingMessageCb linphone_im_encryption_engine_cbs_get_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
/**
|
||||
* Sets the callback that will decrypt the chat messages upon reception
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param cb the callback to call
|
||||
* @ingroup misc
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cb the callback to call
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineIncomingMessageCb cb);
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsIncomingMessageCb cb);
|
||||
|
||||
/**
|
||||
* Gets the callback that will encrypt the chat messages before sending them
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @return the callback
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineOutgoingMessageCb linphone_im_encryption_engine_cbs_get_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs);
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsOutgoingMessageCb linphone_im_encryption_engine_cbs_get_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
/**
|
||||
* Sets the callback that will encrypt the chat messages before sending them
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param cb the callback to call
|
||||
* @ingroup misc
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cb the callback to call
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineOutgoingMessageCb cb);
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsOutgoingMessageCb cb);
|
||||
|
||||
/**
|
||||
* Gets the callback that will decrypt the files while downloading them
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @return the callback
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineDownloadingFileCb linphone_im_encryption_engine_cbs_get_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs);
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsDownloadingFileCb linphone_im_encryption_engine_cbs_get_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
/**
|
||||
* Sets the callback that will decrypt the files while downloading them
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param cb the callback to call
|
||||
* @ingroup misc
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cb the callback to call
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineDownloadingFileCb cb);
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsDownloadingFileCb cb);
|
||||
|
||||
/**
|
||||
* Gets the callback that will will encrypt the files while uploading them
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @return the callback
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineUploadingFileCb linphone_im_encryption_engine_cbs_get_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs);
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsUploadingFileCb linphone_im_encryption_engine_cbs_get_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
/**
|
||||
* Sets the callback that will encrypt the files while uploading them
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param cb the callback to call
|
||||
* @ingroup misc
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cb the callback to call
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineUploadingFileCb cb);
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsUploadingFileCb cb);
|
||||
|
||||
/**
|
||||
* Gets the callback telling wheter or not to encrypt the files
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @return the callback
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineIsEncryptionEnabledForFileTransferCb linphone_im_encryption_engine_cbs_get_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs);
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb linphone_im_encryption_engine_cbs_get_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
/**
|
||||
* Sets the callback telling wheter or not to encrypt the files
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param cb the callback to call
|
||||
* @ingroup misc
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cb the callback to call
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineIsEncryptionEnabledForFileTransferCb cb);
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb cb);
|
||||
|
||||
/**
|
||||
* Gets the callback that will generate the key to encrypt the file before uploading it
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @return the callback
|
||||
* @ingroup misc
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineGenerateFileTransferKeyCb linphone_im_encryption_engine_cbs_get_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs);
|
||||
LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb linphone_im_encryption_engine_cbs_get_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs);
|
||||
|
||||
/**
|
||||
* Sets the callback that will generate the key to encrypt the file before uploading it
|
||||
* @param cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param cb the callback to call
|
||||
* @ingroup misc
|
||||
* @param[in] cbs the LinphoneImEncryptionEngineCbs object
|
||||
* @param[in] cb the callback to call
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineGenerateFileTransferKeyCb cb);
|
||||
LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb cb);
|
||||
|
||||
#endif /* IM_ENCRYPTION_ENGINE_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* IM_ENCRYPTION_ENGINE_H */
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ class ArgumentType:
|
|||
self.cnativefmt_str = '%p'
|
||||
self.use_native_pointer = False
|
||||
self.cast_convert_func_result = True
|
||||
self.is_linphone_object = False
|
||||
self.__compute()
|
||||
if (self.basic_type == 'MSList' or self.basic_type == 'bctbx_list_t') and self.contained_type is not None and self.contained_type != 'const char *':
|
||||
self.linphone_module.bctbxlist_types.add(self.contained_type)
|
||||
|
|
@ -263,8 +264,10 @@ class ArgumentType:
|
|||
elif '*' in splitted_type:
|
||||
self.type_str = 'linphone.' + strip_leading_linphone(self.basic_type)
|
||||
self.use_native_pointer = True
|
||||
self.is_linphone_object = True
|
||||
else:
|
||||
self.type_str = 'linphone.' + strip_leading_linphone(self.basic_type)
|
||||
self.is_linphone_object = True
|
||||
|
||||
|
||||
class MethodDefinition:
|
||||
|
|
@ -878,7 +881,11 @@ class EventCallbackMethodDefinition(MethodDefinition):
|
|||
|
||||
def format_arguments_parsing(self):
|
||||
return_str = ''
|
||||
if self.return_complete_type != 'void':
|
||||
if self.return_complete_type == 'int':
|
||||
return_str = '-1'
|
||||
elif self.return_complete_type == 'bool_t':
|
||||
return_str = 'FALSE'
|
||||
elif self.return_complete_type != 'void':
|
||||
argument_type = ArgumentType(self.return_type, self.return_complete_type, self.return_contained_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O':
|
||||
return_str = 'NULL'
|
||||
|
|
@ -938,7 +945,7 @@ class EventCallbackMethodDefinition(MethodDefinition):
|
|||
args=', '.join(args)
|
||||
if self.return_complete_type != 'void':
|
||||
argument_type = ArgumentType(self.return_type, self.return_complete_type, self.return_contained_type, self.linphone_module)
|
||||
if argument_type.fmt_str == 'O':
|
||||
if argument_type.is_linphone_object:
|
||||
convert_python_result_code = \
|
||||
""" if ((pyresult != Py_None) && !PyObject_IsInstance(pyresult, (PyObject *)&pylinphone_{class_name}Type)) {{
|
||||
PyErr_SetString(PyExc_TypeError, "The return value must be a linphone.{class_name} instance.");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue