Commit 35189535 authored by Ghislain MARY's avatar Ghislain MARY

Convert LinphoneContent from a simple struct to a belle-sip object to ease generation of wrappers.

parent 2e515642
......@@ -26,50 +26,51 @@ include $(CLEAR_VARS)
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := \
linphonecore.c \
misc.c \
enum.c \
presence.c \
proxy.c \
friend.c \
authentication.c \
lpconfig.c \
chat.c \
sipsetup.c \
siplogin.c \
address.c \
linphonecore_jni.cc \
authentication.c \
bellesip_sal/sal_address_impl.c \
bellesip_sal/sal_impl.c \
bellesip_sal/sal_op_call.c \
bellesip_sal/sal_op_call_transfer.c \
bellesip_sal/sal_op_events.c \
bellesip_sal/sal_op_impl.c \
bellesip_sal/sal_op_info.c \
bellesip_sal/sal_op_message.c \
bellesip_sal/sal_op_presence.c \
bellesip_sal/sal_op_registration.c \
bellesip_sal/sal_op_publish.c \
bellesip_sal/sal_op_info.c \
bellesip_sal/sal_op_events.c \
bellesip_sal/sal_op_registration.c \
bellesip_sal/sal_sdp.c \
sal.c \
offeranswer.c \
callbacks.c \
linphonecall.c \
call_log.c \
call_params.c \
chat.c \
conference.c \
content.c \
ec-calibrator.c \
linphone_tunnel_config.c \
message_storage.c \
info.c \
enum.c \
event.c \
xml.c \
xml2lpc.c \
friend.c \
info.c \
linphonecall.c \
linphonecore.c \
linphonecore_jni.cc \
linphone_tunnel_config.c \
localplayer.c \
lpc2xml.c \
remote_provisioning.c \
quality_reporting.c \
call_log.c \
call_params.c \
lpconfig.c \
message_storage.c \
misc.c \
offeranswer.c \
player.c \
localplayer.c
presence.c \
proxy.c \
quality_reporting.c \
remote_provisioning.c \
sal.c \
siplogin.c \
sipsetup.c \
xml2lpc.c \
xml.c
ifndef LIBLINPHONE_VERSION
LIBLINPHONE_VERSION = "Devel"
......
......@@ -115,6 +115,7 @@
<ClCompile Include="..\..\coreapi\callbacks.c" />
<ClCompile Include="..\..\coreapi\chat.c" />
<ClCompile Include="..\..\coreapi\conference.c" />
<ClCompile Include="..\..\coreapi\content.c" />
<ClCompile Include="..\..\coreapi\ec-calibrator.c" />
<ClCompile Include="..\..\coreapi\enum.c" />
<ClCompile Include="..\..\coreapi\event.c" />
......@@ -144,6 +145,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\coreapi\bellesip_sal\sal_impl.h" />
<ClInclude Include="..\..\coreapi\content.h" />
<ClInclude Include="..\..\coreapi\enum.h" />
<ClInclude Include="..\..\coreapi\event.h" />
<ClInclude Include="..\..\coreapi\linphonecore.h" />
......
......@@ -46,6 +46,7 @@ set(SOURCE_FILES
call_params.c
chat.c
conference.c
content.c
ec-calibrator.c
enum.c
event.c
......@@ -152,6 +153,7 @@ install(TARGETS linphone
set(HEADER_FILES
call_log.h
call_params.h
content.h
event.h
linphonecore.h
linphonecore_utils.h
......
......@@ -24,45 +24,61 @@ CLEANFILES=$(GITVERSION_FILE)
## Process this file with automake to produce Makefile.in
linphone_includedir=$(includedir)/linphone
linphone_include_HEADERS=linphonecore.h linphonefriend.h linphonepresence.h linphonecore_utils.h lpconfig.h sipsetup.h event.h xml2lpc.h lpc2xml.h linphone_tunnel.h call_log.h call_params.h
linphone_include_HEADERS=\
call_log.h \
call_params.h \
content.h \
event.h \
linphonecore.h \
linphonecore_utils.h \
linphonefriend.h \
linphonepresence.h \
linphone_tunnel.h \
lpc2xml.h \
lpconfig.h \
sipsetup.h \
xml2lpc.h
lib_LTLIBRARIES=liblinphone.la
liblinphone_la_SOURCES=\
linphonecore.c linphonecore.h private.h\
offeranswer.c offeranswer.h\
sal.c \
callbacks.c \
misc.c \
address.c \
enum.c enum.h \
presence.c \
proxy.c \
friend.c \
authentication.c \
lpconfig.c lpconfig.h \
callbacks.c \
call_log.c \
call_params.c \
chat.c \
linphonecall.c \
sipsetup.c sipsetup.h \
siplogin.c \
lsd.c linphonecore_utils.h \
ec-calibrator.c \
conference.c \
message_storage.c \
info.c \
event.c event.h \
contactprovider.c contactprovider.h contact_providers_priv.h \
ldap/ldapprovider.c ldap/ldapprovider.h \
content.c \
dict.c \
xml.c \
xml2lpc.c \
ec-calibrator.c \
enum.c enum.h \
event.c event.h \
friend.c \
info.c \
ldap/ldapprovider.c ldap/ldapprovider.h \
linphonecall.c \
linphonecore.c linphonecore.h \
linphonecore_utils.h \
localplayer.c \
lpc2xml.c \
remote_provisioning.c \
quality_reporting.c quality_reporting.h\
call_log.c \
call_params.c \
lpconfig.c lpconfig.h \
lsd.c \
message_storage.c \
misc.c \
offeranswer.c offeranswer.h\
player.c \
localplayer.c \
presence.c \
private.h \
proxy.c \
quality_reporting.c quality_reporting.h\
remote_provisioning.c \
sal.c \
siplogin.c \
sipsetup.c sipsetup.h \
xml2lpc.c \
xml.c \
$(GITVERSION_FILE)
if BUILD_UPNP
......
......@@ -1208,14 +1208,13 @@ static void subscribe_response(SalOp *op, SalSubscribeStatus status){
static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, const SalBody *body){
LinphoneEvent *lev=(LinphoneEvent*)sal_op_get_user_pointer(op);
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneContent content={0};
if (lev==NULL) {
/*out of subscribe notify */
lev=linphone_event_new_with_out_of_dialog_op(lc,op,LinphoneSubscriptionOutgoing,eventname);
}
{
const LinphoneContent *ct=linphone_content_from_sal_body(&content,body);
LinphoneContent *ct=linphone_content_from_sal_body(body);
if (ct) linphone_core_notify_notify_received(lc,lev,eventname,ct);
}
if (st!=SalSubscribeNone){
......
......@@ -96,7 +96,7 @@ static int linphone_chat_message_file_transfer_on_send_body(belle_sip_user_body_
char *buf = (char *)buffer;
/* if we've not reach the end of file yet, ask for more data*/
if (offset<chatMsg->file_transfer_information->size){
if (offset<linphone_content_get_size(chatMsg->file_transfer_information)){
/* get data from call back */
linphone_core_notify_file_transfer_send(lc, chatMsg, chatMsg->file_transfer_information, buf, size);
}
......@@ -130,17 +130,17 @@ static void linphone_chat_message_process_response_from_post_file(void *data, co
belle_sip_body_handler_t *first_part_bh;
/* temporary storage for the Content-disposition header value */
first_part_header = belle_sip_strdup_printf("form-data; name=\"File\"; filename=\"%s\"", msg->file_transfer_information->name);
first_part_header = belle_sip_strdup_printf("form-data; name=\"File\"; filename=\"%s\"", linphone_content_get_name(msg->file_transfer_information));
/* create a user body handler to take care of the file and add the content disposition and content-type headers */
if (msg->file_transfer_filepath != NULL) {
first_part_bh=(belle_sip_body_handler_t *)belle_sip_file_body_handler_new(msg->file_transfer_filepath,NULL,msg);
} else {
first_part_bh=(belle_sip_body_handler_t *)belle_sip_user_body_handler_new(msg->file_transfer_information->size,NULL,NULL,linphone_chat_message_file_transfer_on_send_body,msg);
first_part_bh=(belle_sip_body_handler_t *)belle_sip_user_body_handler_new(linphone_content_get_size(msg->file_transfer_information),NULL,NULL,linphone_chat_message_file_transfer_on_send_body,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);
belle_sip_body_handler_add_header(first_part_bh, (belle_sip_header_t *)belle_sip_header_content_type_create(msg->file_transfer_information->type, msg->file_transfer_information->subtype));
belle_sip_body_handler_add_header(first_part_bh, (belle_sip_header_t *)belle_sip_header_content_type_create(linphone_content_get_type(msg->file_transfer_information), linphone_content_get_subtype(msg->file_transfer_information)));
/* insert it in a multipart body handler which will manage the boundaries of multipart message */
bh=belle_sip_multipart_body_handler_new(linphone_chat_message_file_transfer_on_progress, msg, first_part_bh);
......@@ -531,7 +531,7 @@ void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessag
msg = linphone_chat_room_create_message(cr, NULL); /* create a message with empty body */
msg->content_type = ms_strdup(sal_msg->content_type); /* add the content_type "application/vnd.gsma.rcs-ft-http+xml" */
msg->file_transfer_information = ms_new0(LinphoneContent,1);
msg->file_transfer_information = linphone_content_new();
/* parse the message body to get all informations from it */
xmlMessageBody = xmlParseDoc((const xmlChar *)sal_msg->text);
......@@ -547,21 +547,27 @@ void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessag
while (cur!=NULL) {
if (!xmlStrcmp(cur->name, (const xmlChar *)"file-size")) {
xmlChar *fileSizeString = xmlNodeListGetString(xmlMessageBody, cur->xmlChildrenNode, 1);
msg->file_transfer_information->size = strtol((const char*)fileSizeString, NULL, 10);
linphone_content_set_size(msg->file_transfer_information, strtol((const char*)fileSizeString, NULL, 10));
xmlFree(fileSizeString);
}
if (!xmlStrcmp(cur->name, (const xmlChar *)"file-name")) {
msg->file_transfer_information->name = (char *)xmlNodeListGetString(xmlMessageBody, cur->xmlChildrenNode, 1);
linphone_content_set_name(msg->file_transfer_information, (const char *)xmlNodeListGetString(xmlMessageBody, cur->xmlChildrenNode, 1));
}
if (!xmlStrcmp(cur->name, (const xmlChar *)"content-type")) {
xmlChar *contentType = xmlNodeListGetString(xmlMessageBody, cur->xmlChildrenNode, 1);
int contentTypeIndex = 0;
char *type;
char *subtype;
while (contentType[contentTypeIndex]!='/' && contentType[contentTypeIndex]!='\0') {
contentTypeIndex++;
}
msg->file_transfer_information->type = ms_strndup((char *)contentType, contentTypeIndex);
msg->file_transfer_information->subtype = ms_strdup(((char *)contentType+contentTypeIndex+1));
type = ms_strndup((char *)contentType, contentTypeIndex);
subtype = ms_strdup(((char *)contentType+contentTypeIndex+1));
linphone_content_set_type(msg->file_transfer_information, type);
linphone_content_set_subtype(msg->file_transfer_information, subtype);
ms_free(subtype);
ms_free(type);
xmlFree(contentType);
}
if (!xmlStrcmp(cur->name, (const xmlChar *)"data")) {
......@@ -1024,28 +1030,27 @@ static void on_recv_body(belle_sip_user_body_handler_t *bh, belle_sip_message_t
static LinphoneContent* linphone_chat_create_file_transfer_information_from_headers(const belle_sip_message_t* message ){
LinphoneContent *content = ms_new0(LinphoneContent,1);
LinphoneContent *content = linphone_content_new();
belle_sip_header_content_length_t* content_length_hdr = BELLE_SIP_HEADER_CONTENT_LENGTH(belle_sip_message_get_header(message, "Content-Length"));
belle_sip_header_content_type_t* content_type_hdr = BELLE_SIP_HEADER_CONTENT_TYPE(belle_sip_message_get_header(message, "Content-Type"));
const char* type = NULL,*subtype = NULL;
content->name = ms_strdup("");
linphone_content_set_name(content, "");
if( content_type_hdr ){
type = belle_sip_header_content_type_get_type(content_type_hdr);
subtype = belle_sip_header_content_type_get_subtype(content_type_hdr);
ms_message("Extracted content type %s / %s from header", type?type:"", subtype?subtype:"");
if( type ) content->type = ms_strdup(type);
if( subtype ) content->type = ms_strdup(subtype);
if( type ) linphone_content_set_type(content, type);
if( subtype ) linphone_content_set_subtype(content, subtype);
}
if( content_length_hdr ){
content->size = belle_sip_header_content_length_get_content_length(content_length_hdr);
ms_message("Extracted content length %i from header", (int)content->size);
linphone_content_set_size(content, belle_sip_header_content_length_get_content_length(content_length_hdr));
ms_message("Extracted content length %i from header", (int)linphone_content_get_size(content));
}
return content;
}
......@@ -1063,7 +1068,7 @@ static void linphone_chat_process_response_headers_from_get_file(void *data, con
}
if( message->file_transfer_information ){
body_size = message->file_transfer_information->size;
body_size = linphone_content_get_size(message->file_transfer_information);
}
if (message->file_transfer_filepath == NULL) {
......@@ -1318,8 +1323,7 @@ static void _linphone_chat_message_destroy(LinphoneChatMessage* msg) {
if (msg->custom_headers) sal_custom_header_free(msg->custom_headers);
if (msg->content_type) ms_free(msg->content_type);
if (msg->file_transfer_information) {
linphone_content_uninit(msg->file_transfer_information);
ms_free(msg->file_transfer_information);
linphone_content_unref(msg->file_transfer_information);
}
if (msg->file_transfer_filepath != NULL) {
ms_free(msg->file_transfer_filepath);
......@@ -1385,7 +1389,7 @@ const char * linphone_chat_message_get_file_transfer_filepath(LinphoneChatMessag
/**
* Create a message attached to a dedicated chat room with a particular content. Use #linphone_chat_room_send_message2 to initiate the transfer
* @param cr the chat room.
* @param a #LinphoneContent initial content. #LinphoneCoreVTable.file_transfer_send is invoked later to notify file transfer progress and collect next chunk of the message if #LinphoneContent.data is NULL.
* @param initial_content #LinphoneContent initial content. #LinphoneCoreVTable.file_transfer_send is invoked later to notify file transfer progress and collect next chunk of the message if #LinphoneContent.data is NULL.
* @return a new #LinphoneChatMessage
*/
......@@ -1393,8 +1397,7 @@ LinphoneChatMessage* linphone_chat_room_create_file_transfer_message(LinphoneCha
LinphoneChatMessage* msg = belle_sip_object_new(LinphoneChatMessage);
msg->chat_room=(LinphoneChatRoom*)cr;
msg->message = NULL;
msg->file_transfer_information = ms_new0(LinphoneContent,1);
linphone_content_copy(msg->file_transfer_information, initial_content);
msg->file_transfer_information = linphone_content_copy(initial_content);
msg->dir=LinphoneChatMessageOutgoing;
linphone_chat_message_set_to(msg, linphone_chat_room_get_peer_address(cr));
linphone_chat_message_set_from(msg, linphone_address_new(linphone_core_get_identity(cr->lc)));
......
/*
linphone
Copyright (C) 2010-2014 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphonecore.h"
#include "private.h"
static void linphone_content_destroy(LinphoneContent *content) {
if (content->lcp.type) belle_sip_free(content->lcp.type);
if (content->lcp.subtype) belle_sip_free(content->lcp.subtype);
if (content->lcp.data) belle_sip_free(content->lcp.data);
if (content->lcp.encoding) belle_sip_free(content->lcp.encoding);
if (content->lcp.name) belle_sip_free(content->lcp.name);
}
static void linphone_content_clone(LinphoneContent *obj, const LinphoneContent *ref) {
void *data;
linphone_content_set_type(obj, linphone_content_get_type(ref));
linphone_content_set_subtype(obj, linphone_content_get_subtype(ref));
linphone_content_set_encoding(obj, linphone_content_get_encoding(ref));
linphone_content_set_name(obj, linphone_content_get_name(ref));
linphone_content_set_size(obj, linphone_content_get_size(ref));
data = linphone_content_get_data(ref);
if (data != NULL) {
size_t size = linphone_content_get_size(ref);
void *objdata = belle_sip_malloc(size + 1);
memcpy(objdata, data, size);
((char *)objdata)[size] = '\0';
linphone_content_set_data(obj, objdata);
}
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneContent);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneContent, belle_sip_object_t,
(belle_sip_object_destroy_t)linphone_content_destroy,
(belle_sip_object_clone_t)linphone_content_clone,
NULL, // marshal
TRUE
);
LinphoneContent * linphone_core_create_content(LinphoneCore *lc) {
return linphone_content_new();
}
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 content->user_data;
}
void linphone_content_set_user_data(LinphoneContent *content, void *ud) {
content->user_data = ud;
}
const char * linphone_content_get_type(const LinphoneContent *content) {
return content->lcp.type;
}
void linphone_content_set_type(LinphoneContent *content, const char *type) {
if (content->lcp.type != NULL) {
belle_sip_free(content->lcp.type);
content->lcp.type = NULL;
}
if (type != NULL) {
content->lcp.type = belle_sip_strdup(type);
}
}
const char * linphone_content_get_subtype(const LinphoneContent *content) {
return content->lcp.subtype;
}
void linphone_content_set_subtype(LinphoneContent *content, const char *subtype) {
if (content->lcp.subtype != NULL) {
belle_sip_free(content->lcp.subtype);
content->lcp.subtype = NULL;
}
if (subtype != NULL) {
content->lcp.subtype = belle_sip_strdup(subtype);
}
}
void * linphone_content_get_data(const LinphoneContent *content) {
return content->lcp.data;
}
void linphone_content_set_data(LinphoneContent *content, void *data) {
content->lcp.data = data;
}
size_t linphone_content_get_size(const LinphoneContent *content) {
return content->lcp.size;
}
void linphone_content_set_size(LinphoneContent *content, size_t size) {
content->lcp.size = size;
}
const char * linphone_content_get_encoding(const LinphoneContent *content) {
return content->lcp.encoding;
}
void linphone_content_set_encoding(LinphoneContent *content, const char *encoding) {
if (content->lcp.encoding != NULL) {
belle_sip_free(content->lcp.encoding);
content->lcp.encoding = NULL;
}
if (encoding != NULL) {
content->lcp.encoding = belle_sip_strdup(encoding);
}
}
const char * linphone_content_get_name(const LinphoneContent *content) {
return content->lcp.name;
}
void linphone_content_set_name(LinphoneContent *content, const char *name) {
if (content->lcp.name != NULL) {
belle_sip_free(content->lcp.name);
content->lcp.name = NULL;
}
if (name != NULL) {
content->lcp.name = belle_sip_strdup(name);
}
}
LinphoneContent * linphone_content_new(void) {
LinphoneContent *content = belle_sip_object_new(LinphoneContent);
belle_sip_object_ref(content);
return content;
}
LinphoneContent * linphone_content_copy(const LinphoneContent *ref) {
return (LinphoneContent *)belle_sip_object_ref(belle_sip_object_clone(BELLE_SIP_OBJECT(ref)));
}
LinphoneContent * linphone_content_from_sal_body(const SalBody *ref) {
if (ref && ref->type) {
void *objdata;
LinphoneContent *content = linphone_content_new();
linphone_content_set_type(content, ref->type);
linphone_content_set_subtype(content, ref->subtype);
linphone_content_set_encoding(content, ref->encoding);
linphone_content_set_size(content, ref->size);
objdata = belle_sip_malloc(ref->size + 1);
memcpy(objdata, ref->data, ref->size);
((char *)objdata)[ref->size] = '\0';
linphone_content_set_data(content, objdata);
return content;
}
return NULL;
}
SalBody *sal_body_from_content(SalBody *body, const LinphoneContent *content) {
if (content && linphone_content_get_type(content)) {
body->type = linphone_content_get_type(content);
body->subtype = linphone_content_get_subtype(content);
body->data = linphone_content_get_data(content);
body->size = linphone_content_get_size(content);
body->encoding = linphone_content_get_encoding(content);
return body;
}
return NULL;
}
LinphoneContent * linphone_content_private_to_linphone_content(const LinphoneContentPrivate *lcp) {
LinphoneContent *content = belle_sip_object_new(LinphoneContent);
memcpy(&content->lcp, lcp, sizeof(LinphoneContentPrivate));
return content;
}
LinphoneContentPrivate * linphone_content_to_linphone_content_private(const LinphoneContent *content) {
return (LinphoneContentPrivate *)&content->lcp;
}
/*
content.h
Copyright (C) 2010-2014 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef LINPHONE_CONTENT_H_
#define LINPHONE_CONTENT_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup misc
* @{
*/
/**
* The LinphoneContent object holds data that can be embedded in a signaling message.
**/
struct _LinphoneContent;
/**
* The LinphoneContent object holds data that can be embedded in a signaling message.
**/
typedef struct _LinphoneContent LinphoneContent;
/**
* @deprecated Use LinphoneContent objects instead of this structure.
*/
struct _LinphoneContentPrivate{
char *type; /**<mime type for the data, for example "application"*/
char *subtype; /**<mime subtype for the data, for example "html"*/
void *data; /**<the actual data buffer, usually a string. Null when provided by callbacks #LinphoneCoreFileTransferSendCb or #LinphoneCoreFileTransferRecvCb*/
size_t size; /**<the size of the data buffer, excluding null character despite null character is always set for convenience.
When provided by callback #LinphoneCoreFileTransferSendCb or #LinphoneCoreFileTransferRecvCb, it states the total number of bytes of the transfered file*/
char *encoding; /**<The encoding of the data buffer, for example "gzip"*/
char *name; /**< used by RCS File transfer messages to store the original filename of the file to be downloaded from server */
};
/**
* Alias to the LinphoneContentPrivate struct.
* @deprecated
**/
typedef struct _LinphoneContentPrivate LinphoneContentPrivate;
/**
* Convert a LinphoneContentPrivate structure to a LinphoneContent object.
* @deprecated Utility macro to ease porting existing code from LinphoneContentPrivate structure (old LinphoneContent structure) to new LinphoneContent object.
*/
#define LINPHONE_CONTENT(lcp) linphone_content_private_to_linphone_content(lcp)
/**
* Convert a LinphoneContentPrivate structure to a LinphoneContent object.
* @deprecated Utility function to ease porting existing code from LinphoneContentPrivate structure (old LinphoneContent structure) to new LinphoneContent object.
*/
LINPHONE_PUBLIC LinphoneContent * linphone_content_private_to_linphone_content(const LinphoneContentPrivate *lcp);
/**
* Convert a LinphoneContent object to a LinphoneContentPrivate structure.
* @deprecated Utility macro to ease porting existing code from LinphoneContentPrivate structure (old LinphoneContent structure) to new LinphoneContent object.
*/
#define LINPHONE_CONTENT_PRIVATE(lc) linphone_content_to_linphone_content_private(lc)
/**
* Convert a LinphoneContent object to a LinphoneContentPrivate structure.
* @deprecated Utility function to ease porting existing code from LinphoneContentPrivate structure (old LinphoneContent structure) to new LinphoneContent object.
*/
LINPHONE_PUBLIC LinphoneContentPrivate * linphone_content_to_linphone_content_private(const LinphoneContent *content);
/**
* Create a content with default values from Linphone core.
* @param[in] lc LinphoneCore object
* @return LinphoneContent object with default values set
*/
LINPHONE_PUBLIC LinphoneContent * linphone_core_create_content(LinphoneCore *lc);
/**
* Acquire a reference to the content.
* @param[in] content LinphoneContent object.
* @return The same LinphoneContent object.
**/
LINPHONE_PUBLIC LinphoneContent * linphone_content_ref(LinphoneContent *content);
/**
* Release reference to the content.
* @param[in] content LinphoneContent object.
**/
LINPHONE_PUBLIC void linphone_content_unref(LinphoneContent *content);
/**
* Retrieve the user pointer associated with the content.
* @param[in] content LinphoneContent object.
* @return The user pointer associated with the content.
**/
LINPHONE_PUBLIC void *linphone_content_get_user_data(const LinphoneContent *content);
/**
* Assign a user pointer to the content.
* @param[in] content LinphoneContent object.
* @param[in] ud The user pointer to associate with the content.
**/
LINPHONE_PUBLIC void linphone_content_set_user_data(LinphoneContent *content, void *ud);
/**
* Get the mime type of the content data.
* @param[in] content LinphoneContent object.
* @return The mime type of the content data, for example "application".
*/
LINPHONE_PUBLIC const char * linphone_content_get_type(const LinphoneContent *content);
/**
* Set the mime type of the content data.
* @param[in] content LinphoneContent object.
* @param[in] type The mime type of the content data, for example "application".
*/
LINPHONE_PUBLIC void linphone_content_set_type(LinphoneContent *content, const char *type);
/**
* Get the mime subtype of the content data.
* @param[in] content LinphoneContent object.
* @return The mime subtype of the content data, for example "html".
*/
LINPHONE_PUBLIC const char * linphone_content_get_subtype(const LinphoneContent *content);
/**
* Set the mime subtype of the content data.
* @param[in] content LinphoneContent object.
* @param[in] subtype The mime subtype of the content data, for example "html".
*/
LINPHONE_PUBLIC void linphone_content_set_subtype(LinphoneContent *content, const char *subtype);
/**
* Get the content data buffer, usually a string.
* @param[in] content LinphoneContent object.
* @return The content data buffer.
*/
LINPHONE_PUBLIC void * linphone_content_get_data(const LinphoneContent *content);
/**
* Set the content data buffer, usually a string.
* @param[in] content LinphoneContent object.
* @param[in] data The content data buffer.
*/
LINPHONE_PUBLIC void linphone_content_set_data(LinphoneContent *content, void *data);
/**
* Get the content data size, excluding null character despite null character is always set for convenience.
* @param[in] content LinphoneContent object.
* @return The content data size.
*/
LINPHONE_PUBLIC size_t linphone_content_get_size(const LinphoneContent *content);
/**
* Set the content data size, excluding null character despite null character is always set for convenience.
* @param[in] content LinphoneContent object
* @param[in] size The content data size.
*/