mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 23:28:09 +00:00
Convert LinphoneContent from a simple struct to a belle-sip object to ease generation of wrappers.
This commit is contained in:
parent
2e515642f0
commit
35189535a7
20 changed files with 723 additions and 347 deletions
|
|
@ -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 \
|
||||
conference.c \
|
||||
ec-calibrator.c \
|
||||
linphone_tunnel_config.c \
|
||||
message_storage.c \
|
||||
info.c \
|
||||
event.c \
|
||||
xml.c \
|
||||
xml2lpc.c \
|
||||
lpc2xml.c \
|
||||
remote_provisioning.c \
|
||||
quality_reporting.c \
|
||||
call_log.c \
|
||||
call_params.c \
|
||||
chat.c \
|
||||
conference.c \
|
||||
content.c \
|
||||
ec-calibrator.c \
|
||||
enum.c \
|
||||
event.c \
|
||||
friend.c \
|
||||
info.c \
|
||||
linphonecall.c \
|
||||
linphonecore.c \
|
||||
linphonecore_jni.cc \
|
||||
linphone_tunnel_config.c \
|
||||
localplayer.c \
|
||||
lpc2xml.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 \
|
||||
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 \
|
||||
dict.c \
|
||||
xml.c \
|
||||
xml2lpc.c \
|
||||
lpc2xml.c \
|
||||
remote_provisioning.c \
|
||||
quality_reporting.c quality_reporting.h\
|
||||
callbacks.c \
|
||||
call_log.c \
|
||||
call_params.c \
|
||||
player.c \
|
||||
chat.c \
|
||||
conference.c \
|
||||
contactprovider.c contactprovider.h contact_providers_priv.h \
|
||||
content.c \
|
||||
dict.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 \
|
||||
lpconfig.c lpconfig.h \
|
||||
lsd.c \
|
||||
message_storage.c \
|
||||
misc.c \
|
||||
offeranswer.c offeranswer.h\
|
||||
player.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)));
|
||||
|
|
|
|||
205
coreapi/content.c
Normal file
205
coreapi/content.c
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
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;
|
||||
}
|
||||
213
coreapi/content.h
Normal file
213
coreapi/content.h
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
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.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_content_set_size(LinphoneContent *content, size_t size);
|
||||
|
||||
/**
|
||||
* Get the encoding of the data buffer, for example "gzip".
|
||||
* @param[in] content LinphoneContent object.
|
||||
* @return The encoding of the data buffer.
|
||||
*/
|
||||
LINPHONE_PUBLIC const char * linphone_content_get_encoding(const LinphoneContent *content);
|
||||
|
||||
/**
|
||||
* Set the encoding of the data buffer, for example "gzip".
|
||||
* @param[in] content LinphoneContent object.
|
||||
* @param[in] encoding The encoding of the data buffer.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_content_set_encoding(LinphoneContent *content, const char *encoding);
|
||||
|
||||
/**
|
||||
* Get the name associated with a RCS file transfer message. It is used to store the original filename of the file to be downloaded from server.
|
||||
* @param[in] content LinphoneContent object.
|
||||
* @return The name of the content.
|
||||
*/
|
||||
LINPHONE_PUBLIC const char * linphone_content_get_name(const LinphoneContent *content);
|
||||
|
||||
/**
|
||||
* Set the name associated with a RCS file transfer message. It is used to store the original filename of the file to be downloaded from server.
|
||||
* @param[in] content LinphoneContent object.
|
||||
* @param[in] name The name of the content.
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_content_set_name(LinphoneContent *content, const char *name);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LINPHONE_CONTENT_H_ */
|
||||
|
|
@ -54,8 +54,8 @@ static void file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMess
|
|||
char *address = linphone_chat_message_is_outgoing(message)?linphone_address_as_string(to_address):linphone_address_as_string(from_address);
|
||||
printf(" File transfer [%d%%] %s of type [%s/%s] %s [%s] \n", (int)((offset *100)/total)
|
||||
,(linphone_chat_message_is_outgoing(message)?"sent":"received")
|
||||
, content->type
|
||||
, content->subtype
|
||||
, linphone_content_get_type(content)
|
||||
, linphone_content_get_subtype(content)
|
||||
,(linphone_chat_message_is_outgoing(message)?"to":"from")
|
||||
, address);
|
||||
free(address);
|
||||
|
|
@ -131,7 +131,7 @@ static void linphone_file_transfer_state_changed(LinphoneChatMessage* msg,Linpho
|
|||
*/
|
||||
static void message_received(LinphoneCore *lc, LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
|
||||
const LinphoneContent *file_transfer_info = linphone_chat_message_get_file_transfer_information(msg);
|
||||
printf ("Do you really want to download %s (size %ld)?[Y/n]\nOk, let's go\n", file_transfer_info->name, (long int)file_transfer_info->size);
|
||||
printf ("Do you really want to download %s (size %ld)?[Y/n]\nOk, let's go\n", linphone_content_get_name(file_transfer_info), (long int)linphone_content_get_size(file_transfer_info));
|
||||
|
||||
linphone_chat_message_start_file_download(msg, linphone_file_transfer_state_changed, NULL);
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ int main(int argc, char *argv[]){
|
|||
int i;
|
||||
const char* big_file_content="big file";
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneContent content;
|
||||
LinphoneContent* content;
|
||||
LinphoneChatMessage* chat_message;
|
||||
|
||||
/*seting dummy file content to something*/
|
||||
|
|
@ -189,14 +189,14 @@ int main(int argc, char *argv[]){
|
|||
/*Next step is to create a chat room*/
|
||||
chat_room = linphone_core_create_chat_room(lc,dest_friend);
|
||||
|
||||
memset(&content,0,sizeof(content));
|
||||
content.type="text";
|
||||
content.subtype="plain";
|
||||
content.size=sizeof(big_file); /*total size to be transfered*/
|
||||
content.name = "bigfile.txt";
|
||||
content = linphone_core_create_content(lc);
|
||||
linphone_content_set_type(content,"text");
|
||||
linphone_content_set_subtype(content,"plain");
|
||||
linphone_content_set_size(content,sizeof(big_file)); /*total size to be transfered*/
|
||||
linphone_content_set_name(content,"bigfile.txt");
|
||||
|
||||
/*now create a chat message with custom content*/
|
||||
chat_message = linphone_chat_room_create_file_transfer_message(chat_room,&content);
|
||||
chat_message = linphone_chat_room_create_file_transfer_message(chat_room,content);
|
||||
if (chat_message == NULL) {
|
||||
printf("returned message is null\n");
|
||||
}
|
||||
|
|
@ -212,6 +212,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
|
||||
printf("Shutting down...\n");
|
||||
linphone_content_unref(content);
|
||||
linphone_chat_room_destroy(chat_room);
|
||||
linphone_core_destroy(lc);
|
||||
printf("Exited\n");
|
||||
|
|
|
|||
|
|
@ -152,12 +152,12 @@ int main(int argc, char *argv[]){
|
|||
ms_usleep(50000);
|
||||
++i;
|
||||
if (data->ev && i%100==0){
|
||||
LinphoneContent content;
|
||||
LinphoneContentPrivate content;
|
||||
content.type="application";
|
||||
content.subtype="goodxml";
|
||||
content.data="really cool";
|
||||
content.size=strlen((const char*)content.data);
|
||||
linphone_event_notify(data->ev,&content);
|
||||
linphone_event_notify(data->ev,LINPHONE_CONTENT(&content));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,98 +29,23 @@
|
|||
|
||||
|
||||
struct _LinphoneInfoMessage{
|
||||
LinphoneContent content;
|
||||
LinphoneContent *content;
|
||||
SalCustomHeader *headers;
|
||||
};
|
||||
|
||||
#define SET_STRING(ptr,field,val) \
|
||||
if (ptr->field) { \
|
||||
ms_free(ptr->field); \
|
||||
ptr->field=NULL; \
|
||||
} \
|
||||
if (val){ \
|
||||
ptr->field=ms_strdup(val); \
|
||||
}
|
||||
|
||||
void linphone_content_copy(LinphoneContent *obj, const LinphoneContent *ref){
|
||||
SET_STRING(obj,type,ref->type);
|
||||
SET_STRING(obj,subtype,ref->subtype);
|
||||
SET_STRING(obj,encoding,ref->encoding);
|
||||
SET_STRING(obj,name,ref->name);
|
||||
if (obj->data) {
|
||||
ms_free(obj->data);
|
||||
obj->data=NULL;
|
||||
}
|
||||
if (ref->data){
|
||||
obj->data=ms_malloc(ref->size+1);
|
||||
memcpy(obj->data, ref->data, ref->size);
|
||||
((char*)obj->data)[ref->size]='\0';
|
||||
}
|
||||
obj->size=ref->size;
|
||||
}
|
||||
|
||||
void linphone_content_uninit(LinphoneContent * obj){
|
||||
if (obj->type) ms_free(obj->type);
|
||||
if (obj->subtype) ms_free(obj->subtype);
|
||||
if (obj->data) ms_free(obj->data);
|
||||
if (obj->encoding) ms_free(obj->encoding);
|
||||
if (obj->name) ms_free(obj->name);
|
||||
}
|
||||
|
||||
LinphoneContent *linphone_content_copy_from_sal_body(LinphoneContent *obj, const SalBody *ref){
|
||||
SET_STRING(obj,type,ref->type);
|
||||
SET_STRING(obj,subtype,ref->subtype);
|
||||
SET_STRING(obj,encoding,ref->encoding);
|
||||
if (obj->data) {
|
||||
ms_free(obj->data);
|
||||
obj->data=NULL;
|
||||
}
|
||||
if (ref->data){
|
||||
obj->data=ms_malloc(ref->size+1);
|
||||
memcpy(obj->data, ref->data, ref->size);
|
||||
((char*)obj->data)[ref->size]='\0';
|
||||
}
|
||||
obj->size=ref->size;
|
||||
return obj;
|
||||
}
|
||||
|
||||
const LinphoneContent *linphone_content_from_sal_body(LinphoneContent *obj, const SalBody *ref){
|
||||
if (ref && ref->type){
|
||||
obj->type=(char*)ref->type;
|
||||
obj->subtype=(char*)ref->subtype;
|
||||
obj->data=(void*)ref->data;
|
||||
obj->encoding=(char*)ref->encoding;
|
||||
obj->size=ref->size;
|
||||
return obj;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SalBody *sal_body_from_content(SalBody *body, const LinphoneContent *lc){
|
||||
if (lc && lc->type){
|
||||
body->type=lc->type;
|
||||
body->subtype=lc->subtype;
|
||||
body->data=lc->data;
|
||||
body->size=lc->size;
|
||||
body->encoding=lc->encoding;
|
||||
return body;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a LinphoneInfoMessage
|
||||
**/
|
||||
void linphone_info_message_destroy(LinphoneInfoMessage *im){
|
||||
linphone_content_uninit(&im->content);
|
||||
sal_custom_header_free(im->headers);
|
||||
if (im->content) linphone_content_unref(im->content);
|
||||
if (im->headers) sal_custom_header_free(im->headers);
|
||||
ms_free(im);
|
||||
}
|
||||
|
||||
|
||||
LinphoneInfoMessage *linphone_info_message_copy(const LinphoneInfoMessage *orig){
|
||||
LinphoneInfoMessage *im=ms_new0(LinphoneInfoMessage,1);
|
||||
linphone_content_copy(&im->content,&orig->content);
|
||||
if (orig->content) im->content=linphone_content_copy(orig->content);
|
||||
if (orig->headers) im->headers=sal_custom_header_clone(orig->headers);
|
||||
return im;
|
||||
}
|
||||
|
|
@ -146,7 +71,7 @@ LinphoneInfoMessage *linphone_core_create_info_message(LinphoneCore *lc){
|
|||
int linphone_call_send_info_message(LinphoneCall *call, const LinphoneInfoMessage *info){
|
||||
SalBody body;
|
||||
sal_op_set_sent_custom_header(call->op,info->headers);
|
||||
return sal_send_info(call->op,NULL, NULL, sal_body_from_content(&body,&info->content));
|
||||
return sal_send_info(call->op,NULL, NULL, sal_body_from_content(&body,info->content));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -176,14 +101,14 @@ const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, cons
|
|||
* All fields of the LinphoneContent are copied, thus the application can destroy/modify/recycloe the content object freely ater the function returns.
|
||||
**/
|
||||
void linphone_info_message_set_content(LinphoneInfoMessage *im, const LinphoneContent *content){
|
||||
linphone_content_copy(&im->content,content);
|
||||
im->content=linphone_content_copy(content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the info message's content as a #LinphoneContent structure.
|
||||
**/
|
||||
const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im){
|
||||
return im->content.type ? &im->content : NULL;
|
||||
return (im->content && linphone_content_get_type(im->content)) ? im->content : NULL;
|
||||
}
|
||||
|
||||
void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, const SalBody *body){
|
||||
|
|
@ -191,7 +116,7 @@ void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, const SalBody
|
|||
if (call){
|
||||
LinphoneInfoMessage *info=ms_new0(LinphoneInfoMessage,1);
|
||||
info->headers=sal_custom_header_clone(sal_op_get_recv_custom_header(op));
|
||||
if (body) linphone_content_copy_from_sal_body(&info->content,body);
|
||||
if (body) info->content=linphone_content_from_sal_body(body);
|
||||
linphone_core_notify_info_received(lc,call,info);
|
||||
linphone_info_message_destroy(info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ static int log_collection_upload_on_send_body(belle_sip_user_body_handler_t *bh,
|
|||
LinphoneCore *core = (LinphoneCore *)data;
|
||||
|
||||
/* If we've not reach the end of file yet, fill the buffer with more data */
|
||||
if (offset < core->log_collection_upload_information->size) {
|
||||
if (offset < linphone_content_get_size(core->log_collection_upload_information)) {
|
||||
char *log_filename = ms_strdup_printf("%s/%s_log.%s",
|
||||
liblinphone_log_collection_path ? liblinphone_log_collection_path : LOG_COLLECTION_DEFAULT_PATH,
|
||||
liblinphone_log_collection_prefix ? liblinphone_log_collection_prefix : LOG_COLLECTION_DEFAULT_PREFIX,
|
||||
|
|
@ -410,13 +410,14 @@ static void process_response_from_post_file_log_collection(void *data, const bel
|
|||
linphone_core_notify_log_collection_upload_state_changed(core, LinphoneCoreLogCollectionUploadStateInProgress, NULL);
|
||||
|
||||
/* Temporary storage for the Content-disposition header value */
|
||||
first_part_header = belle_sip_strdup_printf("form-data; name=\"File\"; filename=\"%s\"", core->log_collection_upload_information->name);
|
||||
first_part_header = belle_sip_strdup_printf("form-data; name=\"File\"; filename=\"%s\"", linphone_content_get_name(core->log_collection_upload_information));
|
||||
|
||||
/* 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_user_body_handler_new(core->log_collection_upload_information->size, NULL, NULL, log_collection_upload_on_send_body, core);
|
||||
first_part_bh = belle_sip_user_body_handler_new(linphone_content_get_size(core->log_collection_upload_information), NULL, NULL, log_collection_upload_on_send_body, core);
|
||||
belle_sip_body_handler_add_header((belle_sip_body_handler_t *)first_part_bh, belle_sip_header_create("Content-disposition", first_part_header));
|
||||
belle_sip_free(first_part_header);
|
||||
belle_sip_body_handler_add_header((belle_sip_body_handler_t *)first_part_bh, (belle_sip_header_t *)belle_sip_header_content_type_create(core->log_collection_upload_information->type, core->log_collection_upload_information->subtype));
|
||||
belle_sip_body_handler_add_header((belle_sip_body_handler_t *)first_part_bh,
|
||||
(belle_sip_header_t *)belle_sip_header_content_type_create(linphone_content_get_type(core->log_collection_upload_information), linphone_content_get_subtype(core->log_collection_upload_information)));
|
||||
|
||||
/* Insert it in a multipart body handler which will manage the boundaries of multipart message */
|
||||
bh = belle_sip_multipart_body_handler_new(log_collection_upload_on_progress, core, (belle_sip_body_handler_t *)first_part_bh);
|
||||
|
|
@ -553,6 +554,7 @@ void linphone_core_upload_log_collection(LinphoneCore *core) {
|
|||
belle_http_request_listener_t *l;
|
||||
belle_generic_uri_t *uri;
|
||||
belle_http_request_t *req;
|
||||
char *name;
|
||||
|
||||
core->log_collection_upload_information = (LinphoneContent *)malloc(sizeof(LinphoneContent));
|
||||
memset(core->log_collection_upload_information, 0, sizeof(LinphoneContent));
|
||||
|
|
@ -560,14 +562,15 @@ void linphone_core_upload_log_collection(LinphoneCore *core) {
|
|||
core->log_collection_upload_information->type = "application";
|
||||
core->log_collection_upload_information->subtype = "gzip";
|
||||
#else
|
||||
core->log_collection_upload_information->type = "text";
|
||||
core->log_collection_upload_information->subtype = "plain";
|
||||
linphone_content_set_type(core->log_collection_upload_information, "text");
|
||||
linphone_content_set_subtype(core->log_collection_upload_information,"plain");
|
||||
#endif
|
||||
core->log_collection_upload_information->name = ms_strdup_printf("%s_log.%s",
|
||||
name = ms_strdup_printf("%s_log.%s",
|
||||
liblinphone_log_collection_prefix ? liblinphone_log_collection_prefix : LOG_COLLECTION_DEFAULT_PREFIX,
|
||||
COMPRESSED_LOG_COLLECTION_EXTENSION);
|
||||
if (prepare_log_collection_file_to_upload(core->log_collection_upload_information->name) < 0) return;
|
||||
core->log_collection_upload_information->size = get_size_of_file_to_upload(core->log_collection_upload_information->name);
|
||||
linphone_content_set_name(core->log_collection_upload_information, name);
|
||||
if (prepare_log_collection_file_to_upload(name) < 0) return;
|
||||
linphone_content_set_size(core->log_collection_upload_information, get_size_of_file_to_upload(name));
|
||||
uri = belle_generic_uri_parse(linphone_core_get_log_collection_upload_server_url(core));
|
||||
req = belle_http_request_create("POST", uri, NULL, NULL, NULL);
|
||||
cbs.process_response = process_response_from_post_file_log_collection;
|
||||
|
|
@ -575,6 +578,7 @@ void linphone_core_upload_log_collection(LinphoneCore *core) {
|
|||
cbs.process_auth_requested = process_auth_requested_upload_log_collection;
|
||||
l = belle_http_request_listener_create_from_callbacks(&cbs, core);
|
||||
belle_http_provider_send_request(core->http_provider, req, l);
|
||||
ms_free(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,26 +126,6 @@ typedef struct SalAddress LinphoneAddress;
|
|||
|
||||
typedef struct belle_sip_dict LinphoneDictionary;
|
||||
|
||||
/**
|
||||
* The LinphoneContent struct holds data that can be embedded in a signaling message.
|
||||
* @ingroup misc
|
||||
**/
|
||||
struct _LinphoneContent{
|
||||
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 LinphoneContent struct.
|
||||
* @ingroup misc
|
||||
**/
|
||||
typedef struct _LinphoneContent LinphoneContent;
|
||||
|
||||
/**
|
||||
* The LinphoneCall object represents a call issued or received by the LinphoneCore
|
||||
* @ingroup call_control
|
||||
|
|
@ -386,15 +366,17 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
|
|||
|
||||
|
||||
#ifdef IN_LINPHONE
|
||||
#include "linphonefriend.h"
|
||||
#include "event.h"
|
||||
#include "call_log.h"
|
||||
#include "call_params.h"
|
||||
#include "content.h"
|
||||
#include "event.h"
|
||||
#include "linphonefriend.h"
|
||||
#else
|
||||
#include "linphone/linphonefriend.h"
|
||||
#include "linphone/event.h"
|
||||
#include "linphone/call_log.h"
|
||||
#include "linphone/call_params.h"
|
||||
#include "linphone/content.h"
|
||||
#include "linphone/event.h"
|
||||
#include "linphone/linphonefriend.h"
|
||||
#endif
|
||||
|
||||
LINPHONE_PUBLIC LinphoneAddress * linphone_address_new(const char *addr);
|
||||
|
|
|
|||
|
|
@ -54,18 +54,15 @@ static int callback_content(void *data, int argc, char **argv, char **colName) {
|
|||
LinphoneChatMessage *message = (LinphoneChatMessage *)data;
|
||||
|
||||
if (message->file_transfer_information) {
|
||||
linphone_content_uninit(message->file_transfer_information);
|
||||
ms_free(message->file_transfer_information);
|
||||
linphone_content_unref(message->file_transfer_information);
|
||||
message->file_transfer_information = NULL;
|
||||
}
|
||||
message->file_transfer_information = (LinphoneContent *)malloc(sizeof(LinphoneContent));
|
||||
memset(message->file_transfer_information, 0, sizeof(*(message->file_transfer_information)));
|
||||
|
||||
message->file_transfer_information->type = argv[1] ? ms_strdup(argv[1]) : NULL;
|
||||
message->file_transfer_information->subtype = argv[2] ? ms_strdup(argv[2]) : NULL;
|
||||
message->file_transfer_information->name = argv[3] ? ms_strdup(argv[3]) : NULL;
|
||||
message->file_transfer_information->encoding = argv[4] ? ms_strdup(argv[4]) : NULL;
|
||||
message->file_transfer_information->size = (size_t) atoi(argv[5]);
|
||||
message->file_transfer_information = linphone_content_new();
|
||||
if (argv[1]) linphone_content_set_type(message->file_transfer_information, argv[1]);
|
||||
if (argv[2]) linphone_content_set_subtype(message->file_transfer_information, argv[2]);
|
||||
if (argv[3]) linphone_content_set_name(message->file_transfer_information, argv[3]);
|
||||
if (argv[4]) linphone_content_set_encoding(message->file_transfer_information, argv[4]);
|
||||
linphone_content_set_size(message->file_transfer_information, (size_t)atoi(argv[5]));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -199,11 +196,11 @@ static int linphone_chat_message_store_content(LinphoneChatMessage *msg) {
|
|||
if (lc->db) {
|
||||
LinphoneContent *content = msg->file_transfer_information;
|
||||
char *buf = sqlite3_mprintf("INSERT INTO content VALUES(NULL,%Q,%Q,%Q,%Q,%i,%Q);",
|
||||
content->type,
|
||||
content->subtype,
|
||||
content->name,
|
||||
content->encoding,
|
||||
content->size,
|
||||
linphone_content_get_type(content),
|
||||
linphone_content_get_subtype(content),
|
||||
linphone_content_get_name(content),
|
||||
linphone_content_get_encoding(content),
|
||||
linphone_content_get_size(content),
|
||||
NULL
|
||||
);
|
||||
linphone_sql_request(lc->db, buf);
|
||||
|
|
|
|||
|
|
@ -887,10 +887,9 @@ void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *d
|
|||
void linphone_call_create_op(LinphoneCall *call);
|
||||
int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer);
|
||||
void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, const SalBody *body);
|
||||
void linphone_content_uninit(LinphoneContent * obj);
|
||||
void linphone_content_copy(LinphoneContent *obj, const LinphoneContent *ref);
|
||||
LinphoneContent *linphone_content_copy_from_sal_body(LinphoneContent *obj, const SalBody *ref);
|
||||
SalBody *sal_body_from_content(SalBody *body, const LinphoneContent *lc);
|
||||
LinphoneContent * linphone_content_new(void);
|
||||
LinphoneContent * linphone_content_copy(const LinphoneContent *ref);
|
||||
SalBody *sal_body_from_content(SalBody *body, const LinphoneContent *content);
|
||||
SalReason linphone_reason_to_sal(LinphoneReason reason);
|
||||
LinphoneReason linphone_reason_from_sal(SalReason reason);
|
||||
LinphoneEvent *linphone_event_new(LinphoneCore *lc, LinphoneSubscriptionDir dir, const char *name, int expires);
|
||||
|
|
@ -902,9 +901,20 @@ LinphoneEvent *linphone_event_new_with_out_of_dialog_op(LinphoneCore *lc, SalOp
|
|||
void linphone_event_set_state(LinphoneEvent *lev, LinphoneSubscriptionState state);
|
||||
void linphone_event_set_publish_state(LinphoneEvent *lev, LinphonePublishState state);
|
||||
LinphoneSubscriptionState linphone_subscription_state_from_sal(SalSubscribeStatus ss);
|
||||
const LinphoneContent *linphone_content_from_sal_body(LinphoneContent *obj, const SalBody *ref);
|
||||
LinphoneContent *linphone_content_from_sal_body(const SalBody *ref);
|
||||
void linphone_core_invalidate_friend_subscriptions(LinphoneCore *lc);
|
||||
|
||||
|
||||
struct _LinphoneContent {
|
||||
belle_sip_object_t base;
|
||||
void *user_data;
|
||||
struct _LinphoneContentPrivate lcp;
|
||||
};
|
||||
|
||||
BELLE_SIP_DECLARE_VPTR(LinphoneContent);
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* REMOTE PROVISIONING FUNCTIONS *
|
||||
****************************************************************************/
|
||||
|
|
@ -986,6 +996,7 @@ BELLE_SIP_TYPE_ID(LinphoneCallLog),
|
|||
BELLE_SIP_TYPE_ID(LinphoneCallParams),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatMessage),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatRoom),
|
||||
BELLE_SIP_TYPE_ID(LinphoneContent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider),
|
||||
BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch),
|
||||
BELLE_SIP_TYPE_ID(LinphoneProxyConfig)
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ static void append_metrics_to_buffer(char ** buffer, size_t * size, size_t * off
|
|||
}
|
||||
|
||||
static int send_report(LinphoneCall* call, reporting_session_report_t * report, const char * report_event) {
|
||||
LinphoneContent content = {0};
|
||||
LinphoneContent *content = linphone_content_new();
|
||||
LinphoneAddress *addr;
|
||||
int expires = -1;
|
||||
size_t offset = 0;
|
||||
|
|
@ -294,9 +294,9 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
|
|||
goto end;
|
||||
}
|
||||
|
||||
buffer = (char *) ms_malloc(size);
|
||||
content.type = ms_strdup("application");
|
||||
content.subtype = ms_strdup("vq-rtcpxr");
|
||||
buffer = (char *) belle_sip_malloc(size);
|
||||
linphone_content_set_type(content, "application");
|
||||
linphone_content_set_subtype(content, "vq-rtcpxr");
|
||||
|
||||
append_to_buffer(&buffer, &size, &offset, "%s\r\n", report_event);
|
||||
append_to_buffer(&buffer, &size, &offset, "CallID: %s\r\n", report->info.call_id);
|
||||
|
|
@ -331,17 +331,17 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
|
|||
append_to_buffer(&buffer, &size, &offset, "\r\n");
|
||||
}
|
||||
|
||||
content.data = buffer;
|
||||
content.size = strlen(buffer);
|
||||
linphone_content_set_data(content, buffer);
|
||||
linphone_content_set_size(content, strlen(buffer));
|
||||
|
||||
if (call->log->reporting.on_report_sent != NULL){
|
||||
call->log->reporting.on_report_sent(
|
||||
call,
|
||||
(report==call->log->reporting.reports[0])?LINPHONE_CALL_STATS_AUDIO:LINPHONE_CALL_STATS_VIDEO,
|
||||
&content);
|
||||
content);
|
||||
}
|
||||
|
||||
if (! linphone_core_publish(call->core, addr, "vq-rtcpxr", expires, &content)){
|
||||
if (! linphone_core_publish(call->core, addr, "vq-rtcpxr", expires, content)){
|
||||
ret=4;
|
||||
} else {
|
||||
reset_avg_metrics(report);
|
||||
|
|
@ -354,7 +354,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
|
|||
|
||||
linphone_address_destroy(addr);
|
||||
|
||||
linphone_content_uninit(&content);
|
||||
linphone_content_unref(content);
|
||||
|
||||
end:
|
||||
ms_message("QualityReporting[%p]: Send '%s' with status %d",
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ const char *liblinphone_tester_get_notify_content(void){
|
|||
void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content){
|
||||
LinphoneCoreManager *mgr;
|
||||
CU_ASSERT_PTR_NOT_NULL_FATAL(content);
|
||||
CU_ASSERT_TRUE(strcmp(notify_content,(const char*)content->data)==0);
|
||||
CU_ASSERT_TRUE(strcmp(notify_content,(const char*)linphone_content_get_data(content))==0);
|
||||
mgr=get_manager(lc);
|
||||
mgr->stat.number_of_NotifyReceived++;
|
||||
}
|
||||
|
|
@ -48,13 +48,14 @@ void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *
|
|||
void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state) {
|
||||
stats* counters = get_stats(lc);
|
||||
LinphoneCoreManager *mgr=get_manager(lc);
|
||||
LinphoneContent content={0};
|
||||
LinphoneContent* content;
|
||||
const LinphoneAddress* from_addr = linphone_event_get_from(lev);
|
||||
char* from = linphone_address_as_string(from_addr);
|
||||
content.type="application";
|
||||
content.subtype="somexml2";
|
||||
content.data=(void*)notify_content;
|
||||
content.size=strlen(notify_content);
|
||||
content = linphone_core_create_content(lc);
|
||||
linphone_content_set_type(content,"application");
|
||||
linphone_content_set_subtype(content,"somexml2");
|
||||
linphone_content_set_data(content,belle_sip_strdup(notify_content));
|
||||
linphone_content_set_size(content,strlen(notify_content));
|
||||
|
||||
ms_message("Subscription state [%s] from [%s]",linphone_subscription_state_to_string(state),from);
|
||||
ms_free(from);
|
||||
|
|
@ -80,7 +81,7 @@ void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, Li
|
|||
counters->number_of_LinphoneSubscriptionActive++;
|
||||
if (linphone_event_get_subscription_dir(lev)==LinphoneSubscriptionIncoming){
|
||||
mgr->lev=lev;
|
||||
linphone_event_notify(lev,&content);
|
||||
linphone_event_notify(lev,content);
|
||||
}
|
||||
break;
|
||||
case LinphoneSubscriptionTerminated:
|
||||
|
|
@ -96,6 +97,7 @@ void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, Li
|
|||
mgr->lev=NULL;
|
||||
break;
|
||||
}
|
||||
linphone_content_unref(content);
|
||||
}
|
||||
|
||||
void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, LinphonePublishState state){
|
||||
|
|
@ -123,23 +125,23 @@ void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, Linphon
|
|||
static void subscribe_test_declined(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneContent content={0};
|
||||
LinphoneContent* content;
|
||||
LinphoneEvent *lev;
|
||||
const LinphoneErrorInfo *ei;
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
|
||||
content = linphone_core_create_content(marie->lc);
|
||||
linphone_content_set_type(content,"application");
|
||||
linphone_content_set_subtype(content,"somexml");
|
||||
linphone_content_set_data(content,belle_sip_strdup(subscribe_content));
|
||||
linphone_content_set_size(content,strlen(subscribe_content));
|
||||
|
||||
content.type="application";
|
||||
content.subtype="somexml";
|
||||
content.data=(char*)subscribe_content;
|
||||
content.size=strlen(subscribe_content);
|
||||
|
||||
pauline->decline_subscribe=TRUE;
|
||||
|
||||
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,&content);
|
||||
|
||||
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,content);
|
||||
linphone_event_ref(lev);
|
||||
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionError,1,21000));/*yes flexisip may wait 20 secs in case of forking*/
|
||||
|
|
@ -150,7 +152,8 @@ static void subscribe_test_declined(void) {
|
|||
CU_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei));
|
||||
}
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
|
||||
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_event_unref(lev);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
|
|
@ -165,23 +168,24 @@ typedef enum RefreshTestType{
|
|||
static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTestType refresh_type) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneContent content={0};
|
||||
LinphoneContent* content;
|
||||
LinphoneEvent *lev;
|
||||
int expires= refresh_type!=NoRefresh ? 4 : 600;
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
|
||||
|
||||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
|
||||
if (refresh_type==ManualRefresh){
|
||||
lp_config_set_int(marie->lc->config,"sip","refresh_generic_subscribe",0);
|
||||
}
|
||||
|
||||
content.type="application";
|
||||
content.subtype="somexml";
|
||||
content.data=(char*)subscribe_content;
|
||||
content.size=strlen(subscribe_content);
|
||||
|
||||
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,&content);
|
||||
content = linphone_core_create_content(marie->lc);
|
||||
linphone_content_set_type(content,"application");
|
||||
linphone_content_set_subtype(content,"somexml");
|
||||
linphone_content_set_data(content,belle_sip_strdup(subscribe_content));
|
||||
linphone_content_set_size(content,strlen(subscribe_content));
|
||||
|
||||
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,content);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
|
||||
|
|
@ -190,7 +194,7 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
|
|||
|
||||
/*make sure marie receives first notification before terminating*/
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000));
|
||||
|
||||
|
||||
if (refresh_type==AutoRefresh){
|
||||
wait_for_list(lcs,NULL,0,6000);
|
||||
CU_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive);
|
||||
|
|
@ -206,10 +210,11 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
|
|||
CU_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev);
|
||||
linphone_event_terminate(pauline->lev);
|
||||
}
|
||||
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
|
||||
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
|
@ -217,7 +222,7 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
|
|||
static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTestType refresh_type) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneContent content={0};
|
||||
LinphoneContent* content;
|
||||
LinphoneEvent *lev;
|
||||
int expires= refresh_type!=NoRefresh ? 4 : 600;
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
|
|
@ -228,19 +233,20 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe
|
|||
lp_config_set_int(marie->lc->config,"sip","refresh_generic_subscribe",0);
|
||||
}
|
||||
|
||||
content.type="application";
|
||||
content.subtype="somexml";
|
||||
content.data=(char*)subscribe_content;
|
||||
content.size=strlen(subscribe_content);
|
||||
|
||||
content = linphone_core_create_content(marie->lc);
|
||||
linphone_content_set_type(content,"application");
|
||||
linphone_content_set_subtype(content,"somexml");
|
||||
linphone_content_set_data(content,belle_sip_strdup(subscribe_content));
|
||||
linphone_content_set_size(content,strlen(subscribe_content));
|
||||
|
||||
lev=linphone_core_create_subscribe(marie->lc,pauline->identity,"dodo",expires);
|
||||
linphone_event_add_custom_header(lev,"My-Header","pouet");
|
||||
linphone_event_add_custom_header(lev,"My-Header2","pimpon");
|
||||
linphone_event_send_subscribe(lev,&content);
|
||||
|
||||
linphone_event_send_subscribe(lev,content);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
|
||||
|
||||
|
||||
/*check good receipt of custom headers*/
|
||||
CU_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header"),"pouet");
|
||||
CU_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header2"),"pimpon");
|
||||
|
|
@ -266,10 +272,11 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe
|
|||
CU_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev);
|
||||
linphone_event_terminate(pauline->lev);
|
||||
}
|
||||
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
|
||||
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
|
@ -300,30 +307,30 @@ static void subscribe_test_manually_refreshed(void){
|
|||
static void publish_test_with_args(bool_t refresh, int expires){
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneContent content={0};
|
||||
LinphoneContent* content;
|
||||
LinphoneEvent *lev;
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
|
||||
content = linphone_core_create_content(marie->lc);
|
||||
linphone_content_set_type(content,"application");
|
||||
linphone_content_set_subtype(content,"somexml");
|
||||
linphone_content_set_data(content,belle_sip_strdup(subscribe_content));
|
||||
linphone_content_set_size(content,strlen(subscribe_content));
|
||||
|
||||
content.type="application";
|
||||
content.subtype="somexml";
|
||||
content.data=(char*)subscribe_content;
|
||||
content.size=strlen(subscribe_content);
|
||||
|
||||
lp_config_set_int(marie->lc->config,"sip","refresh_generic_publish",refresh);
|
||||
|
||||
lev=linphone_core_create_publish(marie->lc,pauline->identity,"dodo",expires);
|
||||
linphone_event_add_custom_header(lev,"CustomHeader","someValue");
|
||||
linphone_event_send_publish(lev,&content);
|
||||
linphone_event_send_publish(lev,content);
|
||||
linphone_event_ref(lev);
|
||||
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
|
||||
|
||||
|
||||
if (!refresh){
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishExpiring,1,5000));
|
||||
linphone_event_update_publish(lev,&content);
|
||||
linphone_event_update_publish(lev,content);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
|
||||
}else{
|
||||
|
|
@ -331,11 +338,12 @@ static void publish_test_with_args(bool_t refresh, int expires){
|
|||
}
|
||||
|
||||
linphone_event_terminate(lev);
|
||||
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishCleared,1,3000));
|
||||
|
||||
|
||||
linphone_event_unref(lev);
|
||||
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ static void subscribe_forking(void) {
|
|||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneCoreManager* pauline2 = linphone_core_manager_new( "pauline_tcp_rc");
|
||||
LinphoneContent content={0};
|
||||
LinphoneContent* content;
|
||||
LinphoneEvent *lev;
|
||||
int expires= 600;
|
||||
MSList* lcs=ms_list_append(NULL,marie->lc);
|
||||
|
|
@ -35,12 +35,13 @@ static void subscribe_forking(void) {
|
|||
lcs=ms_list_append(lcs,pauline->lc);
|
||||
lcs=ms_list_append(lcs,pauline2->lc);
|
||||
|
||||
content.type="application";
|
||||
content.subtype="somexml";
|
||||
content.data=(char*)liblinphone_tester_get_subscribe_content();
|
||||
content.size=strlen(liblinphone_tester_get_subscribe_content());
|
||||
content = linphone_core_create_content(marie->lc);
|
||||
linphone_content_set_type(content,"application");
|
||||
linphone_content_set_subtype(content,"somexml");
|
||||
linphone_content_set_data(content, belle_sip_strdup(liblinphone_tester_get_subscribe_content()));
|
||||
linphone_content_set_size(content, strlen(liblinphone_tester_get_subscribe_content()));
|
||||
|
||||
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,&content);
|
||||
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,content);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
|
||||
|
|
@ -51,7 +52,8 @@ static void subscribe_forking(void) {
|
|||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000));
|
||||
|
||||
linphone_event_terminate(lev);
|
||||
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
linphone_core_manager_destroy(pauline2);
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ void file_transfer_progress_indication(LinphoneCore *lc, LinphoneChatMessage *me
|
|||
int progress = (int)((offset * 100)/total);
|
||||
ms_message(" File transfer [%d%%] %s of type [%s/%s] %s [%s] \n", progress
|
||||
,(linphone_chat_message_is_outgoing(message)?"sent":"received")
|
||||
, content->type
|
||||
, content->subtype
|
||||
, linphone_content_get_type(content)
|
||||
, linphone_content_get_subtype(content)
|
||||
,(linphone_chat_message_is_outgoing(message)?"to":"from")
|
||||
, address);
|
||||
counters->progress_of_LinphoneFileTransfer = progress;
|
||||
|
|
@ -396,7 +396,7 @@ static void file_transfer_message(void) {
|
|||
char* to;
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneChatMessage* message;
|
||||
LinphoneContent content;
|
||||
LinphoneContent* content;
|
||||
const char* big_file_content="big file"; /* setting dummy file content to something */
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
|
|
@ -417,12 +417,12 @@ static void file_transfer_message(void) {
|
|||
chat_room = linphone_core_create_chat_room(pauline->lc,to);
|
||||
ms_free(to);
|
||||
/* create a file transfer message */
|
||||
memset(&content,0,sizeof(content));
|
||||
content.type="text";
|
||||
content.subtype="plain";
|
||||
content.size=sizeof(big_file); /*total size to be transfered*/
|
||||
content.name = "bigfile.txt";
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, &content);
|
||||
content = linphone_core_create_content(pauline->lc);
|
||||
linphone_content_set_type(content,"text");
|
||||
linphone_content_set_subtype(content,"plain");
|
||||
linphone_content_set_size(content,sizeof(big_file)); /*total size to be transfered*/
|
||||
linphone_content_set_name(content,"bigfile.txt");
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, content);
|
||||
{
|
||||
int dummy=0;
|
||||
wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/
|
||||
|
|
@ -440,6 +440,7 @@ static void file_transfer_message(void) {
|
|||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1);
|
||||
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1);
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
|
@ -451,7 +452,7 @@ static void small_file_transfer_message(void) {
|
|||
char* to;
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneChatMessage* message;
|
||||
LinphoneContent content;
|
||||
LinphoneContent* content;
|
||||
const char* big_file_content="big file"; /* setting dummy file content to something */
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
|
|
@ -472,12 +473,12 @@ static void small_file_transfer_message(void) {
|
|||
chat_room = linphone_core_create_chat_room(pauline->lc,to);
|
||||
ms_free(to);
|
||||
/* create a file transfer message */
|
||||
memset(&content,0,sizeof(content));
|
||||
content.type="text";
|
||||
content.subtype="plain";
|
||||
content.size=SMALL_FILE_SIZE; /*total size to be transfered*/
|
||||
content.name = "bigfile.txt";
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, &content);
|
||||
content = linphone_core_create_content(pauline->lc);
|
||||
linphone_content_set_type(content,"text");
|
||||
linphone_content_set_subtype(content,"plain");
|
||||
linphone_content_set_size(content,SMALL_FILE_SIZE); /*total size to be transfered*/
|
||||
linphone_content_set_name(content,"bigfile.txt");
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, content);
|
||||
{
|
||||
int dummy=0;
|
||||
wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/
|
||||
|
|
@ -495,6 +496,7 @@ static void small_file_transfer_message(void) {
|
|||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1);
|
||||
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1);
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
|
@ -504,7 +506,7 @@ static void file_transfer_message_io_error_upload(void) {
|
|||
char* to;
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneChatMessage* message;
|
||||
LinphoneContent content;
|
||||
LinphoneContent* content;
|
||||
const char* big_file_content="big file"; /* setting dummy file content to something */
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
|
|
@ -526,12 +528,12 @@ static void file_transfer_message_io_error_upload(void) {
|
|||
chat_room = linphone_core_create_chat_room(pauline->lc,to);
|
||||
|
||||
/* create a file transfer message */
|
||||
memset(&content,0,sizeof(content));
|
||||
content.type="text";
|
||||
content.subtype="plain";
|
||||
content.size=sizeof(big_file); /*total size to be transfered*/
|
||||
content.name = "bigfile.txt";
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, &content);
|
||||
content = linphone_core_create_content(pauline->lc);
|
||||
linphone_content_set_type(content,"text");
|
||||
linphone_content_set_subtype(content,"plain");
|
||||
linphone_content_set_size(content,sizeof(big_file)); /*total size to be transfered*/
|
||||
linphone_content_set_name(content,"bigfile.txt");
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, content);
|
||||
{
|
||||
int dummy=0;
|
||||
wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/
|
||||
|
|
@ -554,6 +556,7 @@ static void file_transfer_message_io_error_upload(void) {
|
|||
linphone_core_refresh_registers(pauline->lc); /*to make sure registration is back in registered and so it can be later unregistered*/
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneRegistrationOk,pauline->stat.number_of_LinphoneRegistrationOk+1));
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
|
@ -629,7 +632,7 @@ static void file_transfer_message_upload_cancelled(void) {
|
|||
char* to;
|
||||
LinphoneChatRoom* chat_room;
|
||||
LinphoneChatMessage* message;
|
||||
LinphoneContent content;
|
||||
LinphoneContent* content;
|
||||
const char* big_file_content="big file"; /* setting dummy file content to something */
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
|
|
@ -651,12 +654,12 @@ static void file_transfer_message_upload_cancelled(void) {
|
|||
chat_room = linphone_core_create_chat_room(pauline->lc,to);
|
||||
|
||||
/* create a file transfer message */
|
||||
memset(&content,0,sizeof(content));
|
||||
content.type="text";
|
||||
content.subtype="plain";
|
||||
content.size=sizeof(big_file); /*total size to be transfered*/
|
||||
content.name = "bigfile.txt";
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, &content);
|
||||
content = linphone_core_create_content(pauline->lc);
|
||||
linphone_content_set_type(content,"text");
|
||||
linphone_content_set_subtype(content,"plain");
|
||||
linphone_content_set_size(content,sizeof(big_file)); /*total size to be transfered*/
|
||||
linphone_content_set_name(content,"bigfile.txt");
|
||||
message = linphone_chat_room_create_file_transfer_message(chat_room, content);
|
||||
{
|
||||
int dummy=0;
|
||||
wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/
|
||||
|
|
@ -674,6 +677,7 @@ static void file_transfer_message_upload_cancelled(void) {
|
|||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1);
|
||||
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,0);
|
||||
|
||||
linphone_content_unref(content);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
|
@ -829,12 +833,13 @@ static void info_message_with_args(bool_t with_content) {
|
|||
info=linphone_core_create_info_message(marie->lc);
|
||||
linphone_info_message_add_header(info,"Weather","still bad");
|
||||
if (with_content) {
|
||||
LinphoneContent ct={0};
|
||||
ct.type="application";
|
||||
ct.subtype="somexml";
|
||||
ct.data=(void*)info_content;
|
||||
ct.size=strlen(info_content);
|
||||
linphone_info_message_set_content(info,&ct);
|
||||
LinphoneContent* ct=linphone_core_create_content(marie->lc);
|
||||
linphone_content_set_type(ct,"application");
|
||||
linphone_content_set_subtype(ct,"somexml");
|
||||
linphone_content_set_data(ct,belle_sip_strdup(info_content));
|
||||
linphone_content_set_size(ct,strlen(info_content));
|
||||
linphone_info_message_set_content(info,ct);
|
||||
linphone_content_unref(ct);
|
||||
}
|
||||
{
|
||||
int dummy=0;
|
||||
|
|
@ -858,13 +863,13 @@ static void info_message_with_args(bool_t with_content) {
|
|||
if (with_content){
|
||||
CU_ASSERT_PTR_NOT_NULL(content);
|
||||
if (content) {
|
||||
CU_ASSERT_PTR_NOT_NULL(content->data);
|
||||
CU_ASSERT_PTR_NOT_NULL(content->type);
|
||||
CU_ASSERT_PTR_NOT_NULL(content->subtype);
|
||||
if (content->type) CU_ASSERT_TRUE(strcmp(content->type,"application")==0);
|
||||
if (content->subtype) CU_ASSERT_TRUE(strcmp(content->subtype,"somexml")==0);
|
||||
if (content->data)CU_ASSERT_TRUE(strcmp((const char*)content->data,info_content)==0);
|
||||
CU_ASSERT_EQUAL(content->size,strlen(info_content));
|
||||
CU_ASSERT_PTR_NOT_NULL(linphone_content_get_data(content));
|
||||
CU_ASSERT_PTR_NOT_NULL(linphone_content_get_type(content));
|
||||
CU_ASSERT_PTR_NOT_NULL(linphone_content_get_subtype(content));
|
||||
if (linphone_content_get_type(content)) CU_ASSERT_TRUE(strcmp(linphone_content_get_type(content),"application")==0);
|
||||
if (linphone_content_get_subtype(content)) CU_ASSERT_TRUE(strcmp(linphone_content_get_subtype(content),"somexml")==0);
|
||||
if (linphone_content_get_data(content))CU_ASSERT_TRUE(strcmp((const char*)linphone_content_get_data(content),info_content)==0);
|
||||
CU_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content));
|
||||
}
|
||||
}
|
||||
linphone_core_manager_destroy(marie);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#define __strstr(x, y) ((x==NULL)?NULL:strstr(x,y))
|
||||
|
||||
void on_report_send_mandatory(const LinphoneCall *call, int stream_type, const LinphoneContent *content){
|
||||
char * body = (char *)content->data;
|
||||
char * body = (char *)linphone_content_get_data(content);
|
||||
char * remote_metrics_start = __strstr(body, "RemoteMetrics:");
|
||||
reporting_session_report_t * report = call->log->reporting.reports[stream_type];
|
||||
MediaStream * ms;
|
||||
|
|
@ -91,7 +91,7 @@ char * on_report_send_verify_metrics(const reporting_content_metrics_t *metrics,
|
|||
}
|
||||
|
||||
void on_report_send_with_rtcp_xr_local(const LinphoneCall *call, int stream_type, const LinphoneContent *content){
|
||||
char * body = (char*)content->data;
|
||||
char * body = (char*)linphone_content_get_data(content);
|
||||
char * remote_metrics_start = __strstr(body, "RemoteMetrics:");
|
||||
reporting_session_report_t * report = call->log->reporting.reports[stream_type];
|
||||
on_report_send_mandatory(call,stream_type,content);
|
||||
|
|
@ -99,7 +99,7 @@ void on_report_send_with_rtcp_xr_local(const LinphoneCall *call, int stream_type
|
|||
CU_ASSERT_TRUE(!remote_metrics_start || on_report_send_verify_metrics(&report->local_metrics,body) < remote_metrics_start);
|
||||
}
|
||||
void on_report_send_with_rtcp_xr_remote(const LinphoneCall *call, int stream_type, const LinphoneContent *content){
|
||||
char * body = (char*)content->data;
|
||||
char * body = (char*)linphone_content_get_data(content);
|
||||
reporting_session_report_t * report = call->log->reporting.reports[stream_type];
|
||||
|
||||
on_report_send_mandatory(call,stream_type,content);
|
||||
|
|
@ -214,7 +214,7 @@ static void quality_reporting_not_sent_if_low_bandwidth() {
|
|||
}
|
||||
|
||||
void on_report_send_remove_fields(const LinphoneCall *call, int stream_type, const LinphoneContent *content){
|
||||
char *body = (char*)content->data;
|
||||
char *body = (char*)linphone_content_get_data(content);
|
||||
/*corrupt start of the report*/
|
||||
strncpy(body, "corrupted report is corrupted", strlen("corrupted report is corrupted"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue