diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index 03600de80..76a35259c 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -64,7 +64,6 @@ set(LINPHONE_SOURCE_FILES_C carddav.c chat.c contactprovider.c - content.c dial_plan.c dict.c ec-calibrator.c diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 4e63d8879..c2b2ee53b 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -39,7 +39,6 @@ liblinphone_la_SOURCES=\ chat_file_transfer.c \ conference.cc conference_private.h \ contactprovider.c contact_providers_priv.h \ - content.c \ dial_plan.c \ dict.c \ ec-calibrator.c \ diff --git a/coreapi/private_structs.h b/coreapi/private_structs.h index 449609ba9..f7c6faba0 100644 --- a/coreapi/private_structs.h +++ b/coreapi/private_structs.h @@ -444,17 +444,6 @@ struct _EchoTester { unsigned int rate; }; -struct _LinphoneContent { - belle_sip_object_t base; - void *user_data; - SalBodyHandler *body_handler; - char *name; /**< used by RCS File transfer messages to store the original filename of the file to be downloaded from server */ - char *key; /**< used by RCS File transfer messages to store the key to encrypt file if needed */ - size_t keyLength; /**< Length of key in bytes */ - void *cryptoContext; /**< crypto context used to encrypt file for RCS file transfer */ - bool_t owned_fields; -}; - BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneContent); struct _LinphoneBuffer { diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 055f1840d..90cba8715 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -33,7 +33,6 @@ set(ROOT_HEADER_FILES chat.h conference.h contactprovider.h - content.h core_utils.h core.h defs.h @@ -84,6 +83,7 @@ set(C_API_HEADER_FILES c-chat-message.h c-chat-room-cbs.h c-chat-room.h + c-content.h c-dial-plan.h c-event-log.h c-participant.h diff --git a/include/linphone/Makefile.am b/include/linphone/Makefile.am index dc9488e0b..56c2c3dda 100644 --- a/include/linphone/Makefile.am +++ b/include/linphone/Makefile.am @@ -14,7 +14,6 @@ linphone_include_HEADERS=\ chat.h \ conference.h \ contactprovider.h \ - content.h \ core.h \ core_utils.h \ defs.h \ diff --git a/include/linphone/content.h b/include/linphone/api/c-content.h similarity index 87% rename from include/linphone/content.h rename to include/linphone/api/c-content.h index 78ebc3114..fa030a309 100644 --- a/include/linphone/content.h +++ b/include/linphone/api/c-content.h @@ -1,33 +1,32 @@ /* -content.h -Copyright (C) 2010-2014 Belledonne Communications SARL + * c-content.h + * Copyright (C) 2010-2018 Belledonne Communications SARL + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +#ifndef _L_C_CONTENT_H_ +#define _L_C_CONTENT_H_ -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#ifndef LINPHONE_CONTENT_H_ -#define LINPHONE_CONTENT_H_ - - -#include "linphone/types.h" +#include "linphone/api/c-types.h" +// ============================================================================= #ifdef __cplusplus -extern "C" { -#endif - + extern "C" { +#endif // ifdef __cplusplus /** * @addtogroup misc @@ -218,9 +217,8 @@ LINPHONE_PUBLIC void linphone_content_set_key(LinphoneContent *content, const ch * @} */ - #ifdef __cplusplus -} -#endif + } +#endif // ifdef __cplusplus -#endif /* LINPHONE_CONTENT_H_ */ +#endif // ifndef _L_C_CONTENT_H_ \ No newline at end of file diff --git a/include/linphone/api/c-types.h b/include/linphone/api/c-types.h index 6c109375f..30594f8ab 100644 --- a/include/linphone/api/c-types.h +++ b/include/linphone/api/c-types.h @@ -156,6 +156,12 @@ typedef struct _LinphoneDialPlan LinphoneDialPlan; **/ typedef struct _LinphoneParticipant LinphoneParticipant; +/** + * The LinphoneContent object holds data that can be embedded in a signaling message. + * @ingroup misc +**/ +typedef struct _LinphoneContent LinphoneContent; + // ============================================================================= // C Enums. // ============================================================================= diff --git a/include/linphone/types.h b/include/linphone/types.h index d3b03ce25..90a48c1ca 100644 --- a/include/linphone/types.h +++ b/include/linphone/types.h @@ -367,12 +367,6 @@ typedef unsigned int LinphoneContactSearchID; */ LINPHONE_DEPRECATED typedef LinphoneContactSearchID ContactSearchID; -/** - * The LinphoneContent object holds data that can be embedded in a signaling message. - * @ingroup misc -**/ -typedef struct _LinphoneContent LinphoneContent; - /** * Linphone core main object created by function linphone_core_new() . * @ingroup initializing diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 59ddaffc1..35634fd09 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -164,6 +164,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES c-wrapper/api/c-chat-room-cbs.cpp c-wrapper/api/c-chat-room.cpp c-wrapper/api/c-core.cpp + c-wrapper/api/c-content.cpp c-wrapper/api/c-dial-plan.cpp c-wrapper/api/c-event-log.cpp c-wrapper/api/c-participant.cpp diff --git a/src/c-wrapper/api/c-content.cpp b/src/c-wrapper/api/c-content.cpp new file mode 100644 index 000000000..cfb569732 --- /dev/null +++ b/src/c-wrapper/api/c-content.cpp @@ -0,0 +1,177 @@ +/* + * c-content.cpp + * Copyright (C) 2010-2018 Belledonne Communications SARL + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "linphone/api/c-content.h" +#include "linphone/wrapper_utils.h" + +#include "c-wrapper/c-wrapper.h" + +#include "content/content.h" + +// ============================================================================= + +using namespace std; + +L_DECLARE_C_CLONABLE_OBJECT_IMPL(Content, + SalBodyHandler *body_handler; + void *cryptoContext; /**< crypto context used to encrypt file for RCS file transfer */ +) + +// ============================================================================= +// Reference and user data handling functions. +// ============================================================================= + +LinphoneContent * linphone_content_ref(LinphoneContent *content) { + belle_sip_object_ref(content); + return content; +} + +void linphone_content_unref(LinphoneContent *content) { + belle_sip_object_unref(content); +} + +void *linphone_content_get_user_data(const LinphoneContent *content) { + return L_GET_USER_DATA_FROM_C_OBJECT(content); +} + +void linphone_content_set_user_data(LinphoneContent *content, void *ud) { + return L_SET_USER_DATA_FROM_C_OBJECT(content, ud); +} + +// ============================================================================= + +const char * linphone_content_get_type(const LinphoneContent *content) { + return NULL; +} + +void linphone_content_set_type(LinphoneContent *content, const char *type) { + +} + +const char * linphone_content_get_subtype(const LinphoneContent *content) { + return NULL; +} + +void linphone_content_set_subtype(LinphoneContent *content, const char *subtype) { + +} + +uint8_t * linphone_content_get_buffer(const LinphoneContent *content) { + return NULL; +} + +void linphone_content_set_buffer(LinphoneContent *content, const uint8_t *buffer, size_t size) { + +} + +const char * linphone_content_get_string_buffer(const LinphoneContent *content) { + return NULL; +} + +void linphone_content_set_string_buffer(LinphoneContent *content, const char *buffer) { + +} + +size_t linphone_content_get_size(const LinphoneContent *content) { + return 0; +} + +void linphone_content_set_size(LinphoneContent *content, size_t size) { + +} + +const char * linphone_content_get_encoding(const LinphoneContent *content) { + return NULL; +} + +void linphone_content_set_encoding(LinphoneContent *content, const char *encoding) { + +} + +const char * linphone_content_get_name(const LinphoneContent *content) { + return NULL; +} + +void linphone_content_set_name(LinphoneContent *content, const char *name) { + +} + +bool_t linphone_content_is_multipart(const LinphoneContent *content) { + return FALSE; +} + +LinphoneContent * linphone_content_get_part(const LinphoneContent *content, int idx) { + return NULL; +} + +LinphoneContent * linphone_content_find_part_by_header(const LinphoneContent *content, const char *header_name, const char *header_value) { + return NULL; +} + +const char * linphone_content_get_custom_header(const LinphoneContent *content, const char *header_name) { + return NULL; +} + +const char *linphone_content_get_key(const LinphoneContent *content) { + return NULL; +} + +size_t linphone_content_get_key_size(const LinphoneContent *content) { + return 0; +} + +void linphone_content_set_key(LinphoneContent *content, const char *key, const size_t keyLength) { + +} + +// ============================================================================= +// Private functions. +// ============================================================================= + +LinphoneContent * linphone_content_new(void) { + return NULL; +} + +LinphoneContent * linphone_content_copy(const LinphoneContent *ref) { + return NULL; +} + +static LinphoneContent * linphone_content_new_with_body_handler(SalBodyHandler *body_handler) { + return NULL; +} + +LinphoneContent * linphone_core_create_content(LinphoneCore *lc) { + return NULL; +} + +/* crypto context is managed(allocated/freed) by the encryption function, so provide the address of field in the private structure */ +void ** linphone_content_get_cryptoContext_address(LinphoneContent *content) { + return &(content->cryptoContext);; +} + +LinphoneContent * linphone_content_from_sal_body_handler(SalBodyHandler *body_handler) { + if (body_handler) { + return linphone_content_new_with_body_handler(body_handler); + } + return NULL; +} + +SalBodyHandler * sal_body_handler_from_content(const LinphoneContent *content) { + return NULL; +} \ No newline at end of file diff --git a/src/c-wrapper/c-wrapper.h b/src/c-wrapper/c-wrapper.h index 2e1260e5e..b3bf0c8e0 100644 --- a/src/c-wrapper/c-wrapper.h +++ b/src/c-wrapper/c-wrapper.h @@ -37,6 +37,7 @@ F(ChatMessage, ChatMessage) \ F(AbstractChatRoom, ChatRoom) \ F(Core, Core) \ + F(Content, Content) \ F(DialPlan, DialPlan) \ F(EventLog, EventLog) \ F(MediaSessionParams, CallParams) \ @@ -83,7 +84,6 @@ 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(LinphoneCoreCbs), BELLE_SIP_TYPE_ID(LinphoneErrorInfo), BELLE_SIP_TYPE_ID(LinphoneEvent),