obfuscate all email addresses
Add MSRP config and complete the sender.
This commit is contained in:
parent
14ff73598f
commit
97e8a179e7
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -46,6 +46,18 @@ TMEDIA_BEGIN_DECLS
|
|||
|
||||
#define TMEDIA(self) ((tmedia_t*)(self))
|
||||
|
||||
typedef enum tmedia_action_e
|
||||
{
|
||||
// MSRP
|
||||
tma_msrp_send_data,
|
||||
tma_msrp_send_file,
|
||||
|
||||
// Audio / Video
|
||||
|
||||
// T.38
|
||||
}
|
||||
tmedia_action_t;
|
||||
|
||||
typedef struct tmedia_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
@ -67,15 +79,15 @@ typedef struct tmedia_plugin_def_s
|
|||
const char* name;
|
||||
const char* media;
|
||||
|
||||
int (* set_params) (tmedia_t* , const tsk_params_L_t* );
|
||||
|
||||
int (* start) (tmedia_t* );
|
||||
int (* pause) (tmedia_t* );
|
||||
int (* stop) (tmedia_t* );
|
||||
|
||||
const tsdp_header_M_t* (* get_local_offer) (tmedia_t* );
|
||||
const tsdp_header_M_t* (* get_negotiated_offer) (tmedia_t* );
|
||||
int (* set_remote_offer) (tmedia_t* , const tsdp_message_t* );
|
||||
int (* set_remote_offer) (tmedia_t* , const tsdp_message_t* );
|
||||
|
||||
int (* perform) (tmedia_t* , tmedia_action_t action, const tsk_params_L_t* );
|
||||
}
|
||||
tmedia_plugin_def_t;
|
||||
|
||||
|
@ -85,8 +97,6 @@ TINYMEDIA_API int tmedia_deinit(tmedia_t* self);
|
|||
TINYMEDIA_API int tmedia_plugin_register(const tmedia_plugin_def_t* def);
|
||||
TINYMEDIA_API tmedia_t* tmedia_factory_create(const char* name, const char* host, tnet_socket_type_t socket_type);
|
||||
|
||||
TINYMEDIA_API int tmedia_set_params(tmedia_t* , const tsk_params_L_t* );
|
||||
|
||||
TINYMEDIA_API int tmedia_start(tmedia_t* );
|
||||
TINYMEDIA_API int tmedia_pause(tmedia_t* );
|
||||
TINYMEDIA_API int tmedia_stop(tmedia_t* );
|
||||
|
@ -95,6 +105,8 @@ TINYMEDIA_API const tsdp_header_M_t* tmedia_get_local_offer(tmedia_t* );
|
|||
TINYMEDIA_API const tsdp_header_M_t* tmedia_get_negotiated_offer(tmedia_t* );
|
||||
TINYMEDIA_API int tmedia_set_remote_offer(tmedia_t* , const tsdp_message_t* );
|
||||
|
||||
TINYMEDIA_API int tmedia_perform(tmedia_t* , tmedia_action_t, ... );
|
||||
|
||||
TINYMEDIA_GEXTERN const void *tmedia_def_t;
|
||||
|
||||
TMEDIA_END_DECLS
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -68,7 +68,7 @@ int tmedia_plugin_register(const tmedia_plugin_def_t* plugin)
|
|||
}
|
||||
|
||||
for(i=0; i<TMED_MAX_PLUGINS; i++){
|
||||
if(!__tmedia_plugins[i]){
|
||||
if(!__tmedia_plugins[i] || __tmedia_plugins[i] == plugin){
|
||||
__tmedia_plugins[i] = plugin;
|
||||
return 0;
|
||||
}
|
||||
|
@ -96,21 +96,6 @@ tmedia_t* tmedia_factory_create(const char* name, const char* host, tnet_socket_
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int tmedia_set_params(tmedia_t* self, const tsk_params_L_t* params)
|
||||
{
|
||||
if(!self || !self->plugin){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!self->plugin->set_params){
|
||||
return -2;
|
||||
}
|
||||
else{
|
||||
return self->plugin->set_params(self, params);
|
||||
}
|
||||
}
|
||||
|
||||
int tmedia_start(tmedia_t* self)
|
||||
{
|
||||
if(!self || !self->plugin){
|
||||
|
@ -193,6 +178,44 @@ int tmedia_set_remote_offer(tmedia_t* self, const tsdp_message_t* offer)
|
|||
}
|
||||
}
|
||||
|
||||
int tmedia_perform(tmedia_t* self, tmedia_action_t action, ... )
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if(!self || !self->plugin){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!self->plugin->perform){
|
||||
return -2;
|
||||
}
|
||||
else{
|
||||
const tsk_object_def_t* objdef;
|
||||
tsk_param_t *param;
|
||||
tsk_params_L_t* params;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, action);
|
||||
params = TSK_LIST_CREATE();
|
||||
while((objdef = va_arg(ap, const tsk_object_def_t*))){
|
||||
if(objdef != tsk_param_def_t){ // sanity check
|
||||
continue;
|
||||
}
|
||||
if((param = tsk_object_new2(objdef, &ap))){
|
||||
tsk_params_add_param_2(¶ms, param);
|
||||
TSK_OBJECT_SAFE_FREE(param);
|
||||
}
|
||||
}
|
||||
|
||||
// Perform
|
||||
ret = self->plugin->perform(self, action, params);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(params);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
//========================================================
|
||||
// Media object definition
|
||||
|
|
|
@ -23,17 +23,7 @@
|
|||
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
|
||||
|
||||
int dummy_set_params(tmedia_t* self, const tsk_params_L_t* params)
|
||||
{
|
||||
dummy_t *dummy = DUMMY(self);
|
||||
TSK_DEBUG_INFO("dummy_set_params");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include "tsk_debug.h"
|
||||
|
||||
int dummy_start(tmedia_t* self)
|
||||
{
|
||||
|
@ -83,7 +73,21 @@ int dummy_set_remote_offer(tmedia_t* self, const tsdp_message_t* offer)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int dummy_perform(tmedia_t* self, tmedia_action_t action, const tsk_params_L_t* params)
|
||||
{
|
||||
dummy_t *dummy = DUMMY(self);
|
||||
const tsk_list_item_t* item;
|
||||
const tsk_param_t* param;
|
||||
|
||||
TSK_DEBUG_INFO("dummy_perform");
|
||||
|
||||
tsk_list_foreach(item, params){
|
||||
param = item->data;
|
||||
TSK_DEBUG_INFO("name=%s/value=%s", param->name, param->value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//========================================================
|
||||
|
@ -148,15 +152,15 @@ static const tmedia_plugin_def_t dummy_plugin_def_s =
|
|||
"dummy plugin",
|
||||
"audio",
|
||||
|
||||
dummy_set_params,
|
||||
|
||||
dummy_start,
|
||||
dummy_pause,
|
||||
dummy_stop,
|
||||
|
||||
dummy_get_local_offer,
|
||||
dummy_get_negotiated_offer,
|
||||
dummy_set_remote_offer
|
||||
dummy_set_remote_offer,
|
||||
|
||||
dummy_perform
|
||||
};
|
||||
const tmedia_plugin_def_t *dummy_plugin_def_t = &dummy_plugin_def_s;
|
||||
|
||||
|
|
|
@ -45,10 +45,17 @@ int main()
|
|||
|
||||
tmedia_get_local_offer(dummy);
|
||||
tmedia_get_negotiated_offer(dummy);
|
||||
tmedia_set_remote_offer(dummy, tsk_null);
|
||||
|
||||
tmedia_set_remote_offer(dummy, tsk_null);
|
||||
|
||||
tmedia_start(dummy);
|
||||
tmedia_pause(dummy);
|
||||
|
||||
tmedia_perform(dummy, tma_msrp_send_data,
|
||||
TSK_PARAM_VA_ARGS("content", "hello world!"),
|
||||
TSK_PARAM_VA_ARGS("content-type", "text/plain"),
|
||||
|
||||
tsk_null);
|
||||
|
||||
tmedia_stop(dummy);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(dummy);
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(DOUBANGO_HOME)\thirdparties\win32\include";"$(SolutionDir)\include";"$(DOUBANGO_HOME)\tinySAK\src""
|
||||
AdditionalIncludeDirectories=""$(DOUBANGO_HOME)\thirdparties\win32\include";"$(SolutionDir)\include";"$(DOUBANGO_HOME)\tinyNET\src";"$(DOUBANGO_HOME)\tinySAK\src";"$(DOUBANGO_HOME)\tinySDP\include""
|
||||
PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
|
|
@ -7,6 +7,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySAK", "..\tinySAK\tinyS
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcproj", "{6ED4F246-C3B7-4DD5-9434-3A3F69CC0AD6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySDP", "..\tinySDP\tinySDP.vcproj", "{E45DB518-6562-4033-80E8-60030F0B169F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyNET", "..\tinyNET\tinyNET.vcproj", "{7522A458-92F4-4259-B906-E84C2A65D9F1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -37,6 +41,22 @@ Global
|
|||
{6ED4F246-C3B7-4DD5-9434-3A3F69CC0AD6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6ED4F246-C3B7-4DD5-9434-3A3F69CC0AD6}.Release|Win32.Build.0 = Release|Win32
|
||||
{6ED4F246-C3B7-4DD5-9434-3A3F69CC0AD6}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
|
||||
{E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Win32
|
||||
{E45DB518-6562-4033-80E8-60030F0B169F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E45DB518-6562-4033-80E8-60030F0B169F}.Release|Win32.Build.0 = Release|Win32
|
||||
{E45DB518-6562-4033-80E8-60030F0B169F}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Win32
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Win32.Build.0 = Release|Win32
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
||||
{7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -39,7 +39,7 @@ TMSRP_BEGIN_DECLS
|
|||
* Creates new msrp Success-Report header. You must call @ref TSK_OBJECT_SAFE_FREE to free the header.
|
||||
* @sa TSK_OBJECT_SAFE_FREE.
|
||||
*/
|
||||
#define TMSRP_HEADER_SUCCESS_REPORT_VA_ARGS(isSuccess) tmsrp_header_Success_Report_def_t, (unsigned)isSuccess
|
||||
#define TMSRP_HEADER_SUCCESS_REPORT_VA_ARGS(isSuccess) tmsrp_header_Success_Report_def_t, (tsk_bool_t)isSuccess
|
||||
#define TMSRP_HEADER_SUCCESS_REPORT_CREATE(isSuccess) tsk_object_new(TMSRP_HEADER_SUCCESS_REPORT_VA_ARGS(isSuccess))
|
||||
#define TMSRP_HEADER_SUCCESS_REPORT_CREATE_NULL() TMSRP_HEADER_SUCCESS_REPORT_CREATE(0)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO 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 DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tmsrp_media.h
|
||||
* @brief MSRP Session config.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#ifndef TINYMSRP_CONFIG_H
|
||||
#define TINYMSRP_CONFIG_H
|
||||
|
||||
#include "tinyMSRP_config.h"
|
||||
|
||||
#include "tinyMSRP/headers/tmsrp_header_From-Path.h"
|
||||
#include "tinyMSRP/headers/tmsrp_header_To-Path.h"
|
||||
|
||||
#include "tsk_object.h"
|
||||
|
||||
TMSRP_BEGIN_DECLS
|
||||
|
||||
#define TMSRP_CONFIG_CREATE() tsk_object_new(tmsrp_config_def_t)
|
||||
|
||||
#define TMSRP_MAX_CHUNK_SIZE 2
|
||||
|
||||
typedef struct tmsrp_config_s
|
||||
{
|
||||
TSK_DECLARE_OBJECT;
|
||||
|
||||
tmsrp_header_To_Path_t* To_Path;
|
||||
tmsrp_header_From_Path_t* From_Path;
|
||||
|
||||
tsk_bool_t Failure_Report;
|
||||
tsk_bool_t Success_Report;
|
||||
tsk_bool_t OMA_Final_Report;
|
||||
}
|
||||
tmsrp_config_t;
|
||||
|
||||
TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_config_def_t;
|
||||
|
||||
TMSRP_END_DECLS
|
||||
|
||||
#endif /* TINYMSRP_CONFIG_H */
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -60,7 +60,6 @@ typedef struct tmsrp_data_s
|
|||
|
||||
char* id;
|
||||
char* ctype;
|
||||
size_t start;
|
||||
FILE* file;
|
||||
tsk_buffer_t* buffer;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -55,6 +55,7 @@ typedef struct tmsrp_media_s
|
|||
{
|
||||
TMED_DECLARE_MEDIA;
|
||||
|
||||
tmsrp_config_t* config;
|
||||
tmsrp_session_setup_t setup;
|
||||
tnet_fd_t connectedFD; // FullDuplex Socket
|
||||
tmsrp_sender_t* sender;
|
||||
|
@ -76,7 +77,7 @@ typedef struct tmsrp_media_s
|
|||
tmsrp_media_t;
|
||||
|
||||
int tmsrp_send_file(tmsrp_media_t* self, const char* path);
|
||||
int tmsrp_send_text(tmsrp_media_t* self, const char* text, const char* ctype);
|
||||
int tmsrp_send_data(tmsrp_media_t* self, const void* data, size_t size, const char* ctype);
|
||||
|
||||
TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_media_def_t;
|
||||
TINYMSRP_GEXTERN const tmedia_plugin_def_t *tmsrp_media_plugin_def_t;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -33,23 +33,28 @@
|
|||
#include "tinyMSRP_config.h"
|
||||
|
||||
#include "tinyMSRP/session/tmsrp_data.h"
|
||||
#include "tinyMSRP/session/tmsrp_config.h"
|
||||
|
||||
#include "tnet_types.h"
|
||||
|
||||
#include "tsk_runnable.h"
|
||||
|
||||
TMSRP_BEGIN_DECLS
|
||||
|
||||
#define TMSRP_SENDER_CREATE(destIP, port) tsk_object_new(tmsrp_sender_def_t, (const char*)destIP, (unsigned)port)
|
||||
#define TMSRP_SENDER_CREATE(config, fd) tsk_object_new(tmsrp_sender_def_t, (tmsrp_config_t*)config, (tnet_fd_t) fd)
|
||||
|
||||
typedef struct tmsrp_sender_s
|
||||
{
|
||||
TSK_DECLARE_RUNNABLE;
|
||||
|
||||
tmsrp_datas_L_t* outputList;
|
||||
tmsrp_config_t* config;
|
||||
tnet_fd_t fd;
|
||||
}
|
||||
tmsrp_sender_t;
|
||||
|
||||
int tmsrp_sender_start(tmsrp_sender_t* self);
|
||||
int tsmrp_sender_send_message(tmsrp_sender_t* self, const void* pdata, size_t size);
|
||||
int tsmrp_sender_send_data(tmsrp_sender_t* self, const void* data, size_t size, const char* ctype);
|
||||
int tsmrp_sender_send_file(tmsrp_sender_t* self, const char* filepath);
|
||||
int tmsrp_sender_stop(tmsrp_sender_t* self);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -143,7 +143,7 @@ typedef tmsrp_message_t tmsrp_request_t; /**< MSRP request message. */
|
|||
typedef tmsrp_message_t tmsrp_response_t; /**< MSRP response message. */
|
||||
|
||||
TINYMSRP_API int tmsrp_message_add_header(tmsrp_message_t *self, const tmsrp_header_t *hdr);
|
||||
TINYMSRP_API int tmsrp_message_add_headers(tmsrp_message_t *self, const tmsrp_headers_L_t *headers);
|
||||
TINYMSRP_API int tmsrp_message_add_headers(tmsrp_message_t *self, ...);
|
||||
|
||||
#if !defined(_MSC_VER) || defined(__GNUC__)
|
||||
static void TMSRP_MESSAGE_ADD_HEADER(tmsrp_message_t *self, ...)
|
||||
|
@ -175,7 +175,8 @@ TINYMSRP_API const tmsrp_header_t *tmsrp_message_get_headerByName(const tmsrp_me
|
|||
|
||||
TINYMSRP_API int tmsrp_message_add_content(tmsrp_message_t *self, const char* content_type, const void* content, size_t size);
|
||||
|
||||
TINYMSRP_API int tmsrp_message_tostring(const tmsrp_message_t *self, tsk_buffer_t *output);
|
||||
TINYMSRP_API int tmsrp_message_serialize(const tmsrp_message_t *self, tsk_buffer_t *output);
|
||||
TINYMSRP_API char* tmsrp_message_tostring(const tmsrp_message_t *self);
|
||||
|
||||
|
||||
TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_message_def_t;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -81,8 +81,8 @@
|
|||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* FIXME */
|
||||
/* FIXME */
|
||||
#define TMSRP_NULL 0
|
||||
|
||||
#endif /* _TINYMSRP_H_ */
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -169,7 +169,7 @@ static void* tmsrp_header_Byte_Range_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Byte_Range_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Byte_Range_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -85,7 +85,7 @@ int tmsrp_header_Content_Type_tostring(const void* header, tsk_buffer_t* output)
|
|||
}
|
||||
// Params
|
||||
tsk_list_foreach(item, Content_Type->params){
|
||||
tsk_buffer_append(output, ";", 1);
|
||||
tsk_buffer_append(output, ";", 1);
|
||||
tsk_params_tostring(Content_Type->params, ';', output);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -140,7 +140,7 @@ static void* tmsrp_header_Dummy_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Dummy_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Dummy_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -133,7 +133,7 @@ static void* tmsrp_header_Expires_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Expires_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Expires_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -133,7 +133,7 @@ static void* tmsrp_header_Failure_Report_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Failure_Report_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Failure_Report_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -176,7 +176,7 @@ static void* tmsrp_header_From_Path_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_From_Path_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_From_Path_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -133,7 +133,7 @@ static void* tmsrp_header_Max_Expires_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Max_Expires_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Max_Expires_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -133,7 +133,7 @@ static void* tmsrp_header_Min_Expires_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Min_Expires_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Min_Expires_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -154,7 +154,7 @@ static void* tmsrp_header_Status_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Status_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Status_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -110,7 +110,7 @@ static void* tmsrp_header_Success_Report_create(void *self, va_list * app)
|
|||
TMSRP_HEADER(Success_Report)->type = tmsrp_htype_Success_Report;
|
||||
TMSRP_HEADER(Success_Report)->tostring = tmsrp_header_Success_Report_tostring;
|
||||
|
||||
Success_Report->yes = va_arg(*app, unsigned) ? 1 : 0;
|
||||
Success_Report->yes = va_arg(*app, tsk_bool_t) ? 1 : 0;
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to create new Success-Report header.");
|
||||
|
@ -129,7 +129,7 @@ static void* tmsrp_header_Success_Report_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Success_Report_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Success_Report_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -176,7 +176,7 @@ static void* tmsrp_header_To_Path_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_To_Path_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_To_Path_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -154,7 +154,7 @@ static void* tmsrp_header_Use_Path_destroy(void *self)
|
|||
|
||||
return self;
|
||||
}
|
||||
static int tmsrp_header_Use_Path_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
static int tmsrp_header_Use_Path_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -254,9 +254,9 @@ tmsrp_message_t* tmsrp_message_parse(const void *input, size_t size)
|
|||
tmsrp_header_t* header = TMSRP_NULL;
|
||||
|
||||
/* Ragel variables */
|
||||
int cs = 0;
|
||||
const char* p = input;
|
||||
const char* pe = p + size;
|
||||
int cs = 0;
|
||||
const char* p = input;
|
||||
const char* pe = p + size;
|
||||
const char* eof = TMSRP_NULL;
|
||||
|
||||
if(!input || !size){
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO 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 DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO 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 DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tmsrp_header.c
|
||||
* @brief Defines a MSRP header (hname ":" SP hval CRLF).
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinyMSRP/headers/tmsrp_header.h"
|
||||
|
||||
#include "tinyMSRP/headers/tmsrp_header_Dummy.h"
|
||||
|
||||
*/
|
||||
#include "tinyMSRP/headers/tmsrp_header.h"
|
||||
|
||||
#include "tinyMSRP/headers/tmsrp_header_Dummy.h"
|
||||
|
||||
/** Gets the name of the MSRP header with a type equal to @a type.
|
||||
* @param type The @a type of the header for which to retrieve the name.
|
||||
*
|
||||
* @return The name of the header.
|
||||
**/
|
||||
const char* tmsrp_header_get_name(tmsrp_header_type_t type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
const char* tmsrp_header_get_name(tmsrp_header_type_t type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case tmsrp_htype_Authentication_Info: return "Authentication-Info";
|
||||
case tmsrp_htype_Authorization: return "Authorization";
|
||||
case tmsrp_htype_Byte_Range: return "Byte-Range";
|
||||
|
@ -62,14 +62,14 @@ const char* tmsrp_header_get_name(tmsrp_header_type_t type)
|
|||
|
||||
const char* tmsrp_header_get_nameex(const tmsrp_header_t *self)
|
||||
{
|
||||
if(self){
|
||||
if(self->type == tmsrp_htype_Dummy){
|
||||
return ((tmsrp_header_Dummy_t*)(self))->name;
|
||||
}
|
||||
else{
|
||||
return tmsrp_header_get_name(self->type);
|
||||
}
|
||||
}
|
||||
if(self){
|
||||
if(self->type == tmsrp_htype_Dummy){
|
||||
return ((tmsrp_header_Dummy_t*)(self))->name;
|
||||
}
|
||||
else{
|
||||
return tmsrp_header_get_name(self->type);
|
||||
}
|
||||
}
|
||||
return "unknown-header";
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -310,7 +310,7 @@ static void* tmsrp_header_Success_Report_create(void *self, va_list * app)
|
|||
TMSRP_HEADER(Success_Report)->type = tmsrp_htype_Success_Report;
|
||||
TMSRP_HEADER(Success_Report)->tostring = tmsrp_header_Success_Report_tostring;
|
||||
|
||||
Success_Report->yes = va_arg(*app, unsigned) ? 1 : 0;
|
||||
Success_Report->yes = va_arg(*app, tsk_bool_t) ? 1 : 0;
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to create new Success-Report header.");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO 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 DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tmsrp_media.c
|
||||
* @brief MSRP Session config.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinyMSRP/session/tmsrp_config.h"
|
||||
|
||||
#include "tsk_memory.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// MSRP Session config object definition
|
||||
//
|
||||
static void* tmsrp_config_create(void * self, va_list * app)
|
||||
{
|
||||
tmsrp_config_t *config = self;
|
||||
if(config){
|
||||
config->Failure_Report = tsk_true;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_config_destroy(void * self)
|
||||
{
|
||||
tmsrp_config_t *config = self;
|
||||
if(config){
|
||||
TSK_OBJECT_SAFE_FREE(config->From_Path);
|
||||
TSK_OBJECT_SAFE_FREE(config->To_Path);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tmsrp_config_def_s =
|
||||
{
|
||||
sizeof(tmsrp_config_t),
|
||||
tmsrp_config_create,
|
||||
tmsrp_config_destroy,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_config_def_t = &tmsrp_config_def_s;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -28,6 +28,7 @@
|
|||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
#include "tinyMSRP/session/tmsrp_data.h"
|
||||
#include "tinyMSRP/session/tmsrp_config.h"
|
||||
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_memory.h"
|
||||
|
@ -39,12 +40,12 @@
|
|||
|
||||
int tmsrp_data_init(tmsrp_data_t* self, tsk_bool_t outgoing, const void* pdata, size_t size, tsk_bool_t isfilepath, const char* ctype)
|
||||
{
|
||||
tsk_istr_t id;
|
||||
|
||||
if(!self || !pdata || !size){
|
||||
return -1;
|
||||
}
|
||||
|
||||
self->start = 1;
|
||||
|
||||
if(isfilepath){
|
||||
if(self->file){
|
||||
fclose(self->file);
|
||||
|
@ -65,7 +66,11 @@ int tmsrp_data_init(tmsrp_data_t* self, tsk_bool_t outgoing, const void* pdata,
|
|||
else{
|
||||
self->buffer = TSK_BUFFER_CREATE(pdata, size);
|
||||
}
|
||||
// ctype
|
||||
tsk_strupdate(&self->ctype, ctype);
|
||||
// random id
|
||||
tsk_strrandom(&id);
|
||||
tsk_strupdate(&self->id, id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -121,11 +126,22 @@ tmsrp_request_t* tmsrp_data_in_get(tmsrp_data_in_t* self)
|
|||
tsk_buffer_t* tmsrp_data_out_get(tmsrp_data_out_t* self)
|
||||
{
|
||||
tsk_buffer_t* ret = tsk_null;
|
||||
size_t toread;
|
||||
|
||||
if(!self){
|
||||
return tsk_null;
|
||||
}
|
||||
|
||||
if(TMSRP_DATA_IS_DATA_TRANSFER(self)){
|
||||
if((toread = TSK_BUFFER_SIZE(TMSRP_DATA(self)->buffer) > TMSRP_MAX_CHUNK_SIZE ? TMSRP_MAX_CHUNK_SIZE : TSK_BUFFER_SIZE(TMSRP_DATA(self)->buffer))){
|
||||
ret = TSK_BUFFER_CREATE(TSK_BUFFER_DATA(TMSRP_DATA(self)->buffer), toread);
|
||||
tsk_buffer_remove(TMSRP_DATA(self)->buffer, 0, toread);
|
||||
}
|
||||
}
|
||||
else if(TMSRP_DATA_IS_FILE_TRANSFER(self)){
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -80,20 +80,6 @@ const char* setup_to_string(tmsrp_session_setup_t setup)
|
|||
|
||||
/* =========================== Plugin ============================= */
|
||||
|
||||
int tmsrp_media_set_params(tmedia_t* self, const tsk_params_L_t* params)
|
||||
{
|
||||
const tsk_param_t* param;
|
||||
tmsrp_media_t *msrp = TMSRP_MEDIA(self);
|
||||
TSK_DEBUG_INFO("tmsrp_media_set_params");
|
||||
|
||||
// setup
|
||||
if((param = tsk_params_get_param_by_name(params, "msrp/setup"))){
|
||||
msrp->setup = setup_from_string(param->value);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tmsrp_media_start(tmedia_t* self)
|
||||
{
|
||||
int ret = -1;
|
||||
|
@ -157,7 +143,7 @@ int tmsrp_media_start(tmedia_t* self)
|
|||
|
||||
// create and start the sender
|
||||
if(!msrp->sender){
|
||||
if((msrp->sender = TMSRP_SENDER_CREATE(msrp->remote.M->C->addr, msrp->remote.M->port))){
|
||||
if((msrp->sender = TMSRP_SENDER_CREATE(msrp->config, msrp->connectedFD))){
|
||||
if((ret = tmsrp_sender_start(msrp->sender))){
|
||||
goto bail;
|
||||
}
|
||||
|
@ -213,7 +199,7 @@ const tsdp_header_M_t* tmsrp_media_get_local_offer(tmedia_t* self)
|
|||
|
||||
if(!msrp->local.M){
|
||||
char* path = tsk_null;
|
||||
|
||||
tmsrp_uri_t* uri;
|
||||
tsk_strrandom(&sessionid);
|
||||
tsk_sprintf(&path, "%s://%s:%u/%s;tcp", sheme, msrp->local.socket->ip, msrp->local.socket->port, sessionid); //tcp is ok even if tls is used.
|
||||
|
||||
|
@ -228,6 +214,14 @@ const tsdp_header_M_t* tmsrp_media_get_local_offer(tmedia_t* self)
|
|||
|
||||
tsk_null
|
||||
);
|
||||
|
||||
if((uri = tmsrp_uri_parse(path, path?strlen(path):0))){
|
||||
if(msrp->config->From_Path){
|
||||
TSK_OBJECT_SAFE_FREE(msrp->config->From_Path);
|
||||
}
|
||||
msrp->config->From_Path = TMSRP_HEADER_FROM_PATH_CREATE(uri);
|
||||
TSK_OBJECT_SAFE_FREE(uri);
|
||||
}
|
||||
TSK_FREE(path);
|
||||
|
||||
if(answer){ /* We are about to send 2xx INVITE(sdp) */
|
||||
|
@ -331,6 +325,18 @@ int tmsrp_media_set_remote_offer(tmedia_t* self, const tsdp_message_t* offer)
|
|||
goto bail;
|
||||
}
|
||||
|
||||
/* To-Path */
|
||||
if((A = tsdp_header_M_findA(msrp->remote.M, "path"))){
|
||||
tmsrp_uri_t* uri;
|
||||
if((uri = tmsrp_uri_parse(A->value, A->value?strlen(A->value):0))){
|
||||
if(msrp->config->To_Path){
|
||||
TSK_OBJECT_SAFE_FREE(msrp->config->To_Path);
|
||||
}
|
||||
msrp->config->To_Path = TMSRP_HEADER_TO_PATH_CREATE(uri);
|
||||
TSK_OBJECT_SAFE_FREE(uri);
|
||||
}
|
||||
}
|
||||
|
||||
if(answer){ /* We are about to receive 2xx INVITE(sdp) */
|
||||
}
|
||||
else{ /* We are about to receive INVITE(sdp) */
|
||||
|
@ -353,6 +359,47 @@ int tmsrp_media_set_remote_offer(tmedia_t* self, const tsdp_message_t* offer)
|
|||
bail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int tmsrp_media_perform(tmedia_t* self, tmedia_action_t action, const tsk_params_L_t* params)
|
||||
{
|
||||
tmsrp_media_t *msrp = TMSRP_MEDIA(self);
|
||||
int ret = -1;
|
||||
|
||||
if(!msrp || !msrp->sender){
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(action){
|
||||
case tma_msrp_send_data:
|
||||
{
|
||||
const char* content = tsk_params_get_param_value(params, "content");
|
||||
const char* ctype = tsk_params_get_param_value(params, "content-type");
|
||||
if(content){
|
||||
tsmrp_sender_send_data(msrp->sender, content, strlen(content), ctype);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("%s param not found.", "content");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case tma_msrp_send_file:
|
||||
{
|
||||
const char* filepath = tsk_params_get_param_value(params, "path");
|
||||
const char* ctype = tsk_params_get_param_value(params, "content-type");
|
||||
if(filepath){
|
||||
tsmrp_sender_send_file(msrp->sender, filepath);
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("%s param not found.", "path");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ======================================================== */
|
||||
|
||||
|
||||
|
@ -370,13 +417,14 @@ int tmsrp_send_file(tmsrp_media_t* self, const char* path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int tmsrp_send_text(tmsrp_media_t* self, const char* text, const char* ctype)
|
||||
tmsrp_send_data(tmsrp_media_t* self, const void* data, size_t size, const char* ctype)
|
||||
{
|
||||
if(!self){
|
||||
if(!self || !data || !size || !self->sender){
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
else{
|
||||
return tsmrp_sender_send_data(self->sender, data, size, ctype);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -401,6 +449,7 @@ static void* tmsrp_media_create(tsk_object_t *self, va_list * app)
|
|||
// init base
|
||||
tmedia_init(TMEDIA(msrp), name);
|
||||
|
||||
msrp->config = TMSRP_CONFIG_CREATE();
|
||||
msrp->setup = setup_actpass; // draft-denis-simple-msrp-comedia-02 - 4.1.1. Sending the offer
|
||||
TMEDIA(msrp)->protocol = tsk_strdup("TCP/MSRP");
|
||||
|
||||
|
@ -427,6 +476,8 @@ static void* tmsrp_media_destroy(tsk_object_t *self)
|
|||
if(msrp){
|
||||
tsk_bool_t closeFD = (msrp->local.socket && msrp->local.socket->fd != msrp->connectedFD);
|
||||
tmedia_deinit(TMEDIA(msrp));
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(msrp->config);
|
||||
|
||||
// local
|
||||
TSK_OBJECT_SAFE_FREE(msrp->local.M);
|
||||
|
@ -474,15 +525,15 @@ static const tmedia_plugin_def_t tmsrp_media_plugin_def_s =
|
|||
"msrp",
|
||||
"message",
|
||||
|
||||
tmsrp_media_set_params,
|
||||
|
||||
tmsrp_media_start,
|
||||
tmsrp_media_pause,
|
||||
tmsrp_media_stop,
|
||||
|
||||
tmsrp_media_get_local_offer,
|
||||
tmsrp_media_get_negotiated_offer,
|
||||
tmsrp_media_set_remote_offer
|
||||
tmsrp_media_set_remote_offer,
|
||||
|
||||
tmsrp_media_perform
|
||||
};
|
||||
const tmedia_plugin_def_t *tmsrp_media_plugin_def_t = &tmsrp_media_plugin_def_s;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -29,8 +29,13 @@
|
|||
*/
|
||||
#include "tinyMSRP/session/tmsrp_sender.h"
|
||||
|
||||
#include "tnet_utils.h"
|
||||
|
||||
#include "tsk_memory.h"
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_debug.h"
|
||||
|
||||
|
||||
void *run(void* self);
|
||||
|
||||
int tmsrp_sender_start(tmsrp_sender_t* self)
|
||||
|
@ -50,7 +55,7 @@ bail:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int tsmrp_sender_send_message(tmsrp_sender_t* self, const void* pdata, size_t size)
|
||||
int tsmrp_sender_send_data(tmsrp_sender_t* self, const void* pdata, size_t size, const char* ctype)
|
||||
{
|
||||
tmsrp_data_out_t* data_out;
|
||||
|
||||
|
@ -103,6 +108,12 @@ void *run(void* self)
|
|||
{
|
||||
tsk_list_item_t *curr;
|
||||
tmsrp_sender_t *sender = self;
|
||||
tmsrp_data_out_t *data_out;
|
||||
tsk_buffer_t* chunck;
|
||||
char* str;
|
||||
size_t start = 1;
|
||||
size_t end;
|
||||
tsk_istr_t tid;
|
||||
|
||||
TSK_DEBUG_INFO("MSRP SENDER::run -- START");
|
||||
|
||||
|
@ -110,8 +121,44 @@ void *run(void* self)
|
|||
|
||||
if((curr = TSK_RUNNABLE_POP_FIRST(sender)))
|
||||
{
|
||||
tmsrp_data_out_t *data_out = (tmsrp_data_out_t*)curr->data;
|
||||
if(!(data_out = (tmsrp_data_out_t*)curr->data)){
|
||||
continue;
|
||||
}
|
||||
|
||||
while((chunck = tmsrp_data_out_get(data_out))){
|
||||
tmsrp_request_t* SEND;
|
||||
// set end
|
||||
end = start + chunck->size;
|
||||
// compute new transaction id
|
||||
tsk_strrandom(&tid);
|
||||
// create SEND request
|
||||
SEND = TMSRP_REQUEST_CREATE(tid, "SEND");
|
||||
// T-Path and From-Path (because of otherURIs)
|
||||
SEND->To = tsk_object_ref(sender->config->To_Path);
|
||||
SEND->From = tsk_object_ref(sender->config->From_Path);
|
||||
// add other headers
|
||||
tmsrp_message_add_headers(SEND,
|
||||
TMSRP_HEADER_MESSAGE_ID_VA_ARGS(TMSRP_DATA(data_out)->id),
|
||||
TMSRP_HEADER_BYTE_RANGE_VA_ARGS(start, end, -1),
|
||||
TMSRP_HEADER_FAILURE_REPORT_VA_ARGS(sender->config->Failure_Report ? freport_yes : freport_no),
|
||||
TMSRP_HEADER_SUCCESS_REPORT_VA_ARGS(sender->config->Success_Report),
|
||||
//TMSRP_HEADER_CONTENT_TYPE_VA_ARGS(TMSRP_DATA(data_out)->ctype),
|
||||
|
||||
tsk_null);
|
||||
// add data
|
||||
tmsrp_message_add_content(SEND, TMSRP_DATA(data_out)->ctype, chunck->data, chunck->size);
|
||||
// serialize and send
|
||||
if((str = tmsrp_message_tostring(SEND))){
|
||||
tnet_sockfd_send(sender->fd, str, strlen(str), 0);
|
||||
TSK_FREE(str);
|
||||
}
|
||||
|
||||
// set start
|
||||
start = end;
|
||||
// cleanup
|
||||
TSK_OBJECT_SAFE_FREE(chunck);
|
||||
TSK_OBJECT_SAFE_FREE(SEND);
|
||||
}
|
||||
|
||||
|
||||
tsk_object_unref(curr);
|
||||
|
@ -129,10 +176,13 @@ void *run(void* self)
|
|||
//=================================================================================================
|
||||
// MSRP sender object definition
|
||||
//
|
||||
static void* tmsrp_sender_create(void * self, va_list * app)
|
||||
static void* tmsrp_sender_create(void * self, va_list *app)
|
||||
{
|
||||
tmsrp_sender_t *sender = self;
|
||||
if(sender){
|
||||
sender->config = tsk_object_ref(va_arg(*app, tmsrp_config_t*));
|
||||
sender->fd = va_arg(*app, tnet_fd_t);
|
||||
|
||||
sender->outputList = TSK_LIST_CREATE();
|
||||
}
|
||||
return self;
|
||||
|
@ -145,7 +195,9 @@ static void* tmsrp_sender_destroy(void * self)
|
|||
/* Stop */
|
||||
tmsrp_sender_stop(sender);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(sender->config);
|
||||
TSK_OBJECT_SAFE_FREE(sender->outputList);
|
||||
// the FD is owned by the media ...do not close it
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -77,52 +77,52 @@ int tmsrp_session_stop(tmsrp_session_t* self)
|
|||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// MSRP session object definition
|
||||
//
|
||||
static void* tmsrp_session_create(tsk_object_t* self, va_list * app)
|
||||
{
|
||||
tmsrp_session_t *session = self;
|
||||
if(session){
|
||||
/*tmsrp_session_setup_t setup = va_arg(*app, tmsrp_session_setup_t);
|
||||
const char* host = va_arg(*app, const char*);
|
||||
tsk_bool_t useIPv6 = va_arg(*app, tsk_bool_t);
|
||||
tsk_bool_t useTLS = va_arg(*app, tsk_bool_t);
|
||||
|
||||
tnet_socket_type_t type = tnet_socket_type_tcp_ipv4;
|
||||
if(useIPv6){
|
||||
TNET_SOCKET_TYPE_SET_IPV6(type);
|
||||
}
|
||||
if(useTLS){
|
||||
TNET_SOCKET_TYPE_SET_TLS(type);
|
||||
}
|
||||
|
||||
session->setup = setup;
|
||||
|
||||
if(session->localSocket = TNET_SOCKET_CREATE(host, TNET_SOCKET_PORT_ANY, type)){
|
||||
if(session->setup != setup_active && session->setup != setup_actpass){
|
||||
tnet_sockfd_listen(session->localSocket->fd, 5);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_session_destroy(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_session_t *session = self;
|
||||
if(session){
|
||||
tnet_sockfd_close(&session->connectedFD);
|
||||
TSK_OBJECT_SAFE_FREE(session->localSocket);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tmsrp_session_def_s =
|
||||
{
|
||||
sizeof(tmsrp_session_t),
|
||||
tmsrp_session_create,
|
||||
tmsrp_session_destroy,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_session_def_t = &tmsrp_session_def_s;
|
||||
//=================================================================================================
|
||||
// MSRP session object definition
|
||||
//
|
||||
static void* tmsrp_session_create(tsk_object_t* self, va_list * app)
|
||||
{
|
||||
tmsrp_session_t *session = self;
|
||||
if(session){
|
||||
/*tmsrp_session_setup_t setup = va_arg(*app, tmsrp_session_setup_t);
|
||||
const char* host = va_arg(*app, const char*);
|
||||
tsk_bool_t useIPv6 = va_arg(*app, tsk_bool_t);
|
||||
tsk_bool_t useTLS = va_arg(*app, tsk_bool_t);
|
||||
|
||||
tnet_socket_type_t type = tnet_socket_type_tcp_ipv4;
|
||||
if(useIPv6){
|
||||
TNET_SOCKET_TYPE_SET_IPV6(type);
|
||||
}
|
||||
if(useTLS){
|
||||
TNET_SOCKET_TYPE_SET_TLS(type);
|
||||
}
|
||||
|
||||
session->setup = setup;
|
||||
|
||||
if(session->localSocket = TNET_SOCKET_CREATE(host, TNET_SOCKET_PORT_ANY, type)){
|
||||
if(session->setup != setup_active && session->setup != setup_actpass){
|
||||
tnet_sockfd_listen(session->localSocket->fd, 5);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static void* tmsrp_session_destroy(tsk_object_t * self)
|
||||
{
|
||||
tmsrp_session_t *session = self;
|
||||
if(session){
|
||||
tnet_sockfd_close(&session->connectedFD);
|
||||
TSK_OBJECT_SAFE_FREE(session->localSocket);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
static const tsk_object_def_t tmsrp_session_def_s =
|
||||
{
|
||||
sizeof(tmsrp_session_t),
|
||||
tmsrp_session_create,
|
||||
tmsrp_session_destroy,
|
||||
tsk_null,
|
||||
};
|
||||
const tsk_object_def_t *tmsrp_session_def_t = &tmsrp_session_def_s;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO 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 DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tmsrp_message.c
|
||||
* @brief MSRP message.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#include "tinyMSRP/tmsrp_message.h"
|
||||
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_memory.h"
|
||||
|
||||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
* DOUBANGO 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DOUBANGO 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 DOUBANGO.
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file tmsrp_message.c
|
||||
* @brief MSRP message.
|
||||
*
|
||||
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
|
||||
*/
|
||||
|
||||
#include "tinyMSRP/tmsrp_message.h"
|
||||
|
||||
#include "tsk_string.h"
|
||||
#include "tsk_memory.h"
|
||||
|
||||
/*== Predicate function to find tmsrp_header_t object by type. */
|
||||
static int pred_find_header_by_type(const tsk_list_item_t *item, const void *tmsrp_htype)
|
||||
{
|
||||
|
@ -54,9 +54,9 @@ static int pred_find_header_by_name(const tsk_list_item_t *item, const void *nam
|
|||
return tsk_stricmp(tmsrp_header_get_nameex(header), (const char*)name);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int tmsrp_message_add_header(tmsrp_message_t *self, const tmsrp_header_t *hdr)
|
||||
{
|
||||
#define ADD_HEADER(type, field) \
|
||||
|
@ -95,21 +95,30 @@ int tmsrp_message_add_header(tmsrp_message_t *self, const tmsrp_header_t *hdr)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int tmsrp_message_add_headers(tmsrp_message_t *self, const tmsrp_headers_L_t *headers)
|
||||
int tmsrp_message_add_headers(tmsrp_message_t *self, ...)
|
||||
{
|
||||
tsk_list_item_t *item = 0;
|
||||
if(self && headers)
|
||||
{
|
||||
tsk_list_foreach(item, headers){
|
||||
tmsrp_message_add_header(self, item->data);
|
||||
}
|
||||
return 0;
|
||||
const tsk_object_def_t* objdef;
|
||||
tmsrp_header_t *header;
|
||||
va_list ap;
|
||||
|
||||
if(!self){
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
|
||||
va_start(ap, self);
|
||||
while((objdef = va_arg(ap, const tsk_object_def_t*))){
|
||||
if((header = tsk_object_new2(objdef, &ap))){
|
||||
tmsrp_message_add_header(self, header);
|
||||
TSK_OBJECT_SAFE_FREE(header);
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const tmsrp_header_t *tmsrp_message_get_headerAt(const tmsrp_message_t *self, tmsrp_header_type_t type, size_t index)
|
||||
{
|
||||
|
||||
const tmsrp_header_t *tmsrp_message_get_headerAt(const tmsrp_message_t *self, tmsrp_header_type_t type, size_t index)
|
||||
{
|
||||
size_t pos = 0;
|
||||
tsk_list_item_t *item;
|
||||
const tmsrp_header_t* hdr = 0;
|
||||
|
@ -174,9 +183,9 @@ const tmsrp_header_t *tmsrp_message_get_headerAt(const tmsrp_message_t *self, tm
|
|||
}
|
||||
|
||||
bail:
|
||||
return hdr;
|
||||
}
|
||||
|
||||
return hdr;
|
||||
}
|
||||
|
||||
const tmsrp_header_t *tmsrp_message_get_header(const tmsrp_message_t *self, tmsrp_header_type_t type)
|
||||
{
|
||||
return tmsrp_message_get_headerAt(self, type, 0);
|
||||
|
@ -191,8 +200,8 @@ const tmsrp_header_t *tmsrp_message_get_headerByName(const tmsrp_message_t *self
|
|||
}
|
||||
}
|
||||
return TMSRP_NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int tmsrp_message_add_content(tmsrp_message_t *self, const char* content_type, const void* content, size_t size)
|
||||
{
|
||||
if(self)
|
||||
|
@ -210,9 +219,9 @@ int tmsrp_message_add_content(tmsrp_message_t *self, const char* content_type, c
|
|||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int tmsrp_message_tostring(const tmsrp_message_t *self, tsk_buffer_t *output)
|
||||
}
|
||||
|
||||
int tmsrp_message_serialize(const tmsrp_message_t *self, tsk_buffer_t *output)
|
||||
{
|
||||
if(!self || !output){
|
||||
return -1;
|
||||
|
@ -236,30 +245,30 @@ int tmsrp_message_tostring(const tmsrp_message_t *self, tsk_buffer_t *output)
|
|||
if(self->To){
|
||||
tmsrp_header_tostring(TMSRP_HEADER(self->To), output);
|
||||
}
|
||||
/* From-Path */
|
||||
/* From-Path */
|
||||
if(self->From){
|
||||
tmsrp_header_tostring(TMSRP_HEADER(self->From), output);
|
||||
}
|
||||
/* Message-Id */
|
||||
}
|
||||
/* Message-Id */
|
||||
if(self->MessageID){
|
||||
tmsrp_header_tostring(TMSRP_HEADER(self->MessageID), output);
|
||||
}
|
||||
/* Byte-Range */
|
||||
}
|
||||
/* Byte-Range */
|
||||
if(self->ByteRange){
|
||||
tmsrp_header_tostring(TMSRP_HEADER(self->ByteRange), output);
|
||||
}
|
||||
/* Failure-Report */
|
||||
}
|
||||
/* Failure-Report */
|
||||
if(self->FailureReport){
|
||||
tmsrp_header_tostring(TMSRP_HEADER(self->FailureReport), output);
|
||||
}
|
||||
/* Success-Report */
|
||||
}
|
||||
/* Success-Report */
|
||||
if(self->SuccessReport){
|
||||
tmsrp_header_tostring(TMSRP_HEADER(self->SuccessReport), output);
|
||||
}
|
||||
/* Status */
|
||||
}
|
||||
/* Status */
|
||||
if(self->Status){
|
||||
tmsrp_header_tostring(TMSRP_HEADER(self->Status), output);
|
||||
}
|
||||
}
|
||||
|
||||
/* All other headers (Other-Mime-headers)
|
||||
- Should be empty if no content is added (see below) but ...
|
||||
|
@ -273,14 +282,14 @@ int tmsrp_message_tostring(const tmsrp_message_t *self, tsk_buffer_t *output)
|
|||
}
|
||||
|
||||
/* RFC 4975 - 7.1. Constructing Requests
|
||||
A request with no body MUST NOT include a Content-Type or any other
|
||||
MIME-specific header fields. A request without a body MUST contain
|
||||
an end-line after the final header field. No extra CRLF will be
|
||||
A request with no body MUST NOT include a Content-Type or any other
|
||||
MIME-specific header fields. A request without a body MUST contain
|
||||
an end-line after the final header field. No extra CRLF will be
|
||||
present between the header section and the end-line.
|
||||
*/
|
||||
/* CONTENT */
|
||||
if(TMSRP_MESSAGE_HAS_CONTENT(self)){
|
||||
/* Content-Type */
|
||||
/* Content-Type */
|
||||
if(self->ContentType){
|
||||
tmsrp_header_tostring(TMSRP_HEADER(self->ContentType), output);
|
||||
}
|
||||
|
@ -290,40 +299,53 @@ int tmsrp_message_tostring(const tmsrp_message_t *self, tsk_buffer_t *output)
|
|||
}
|
||||
|
||||
/* END LINE */
|
||||
tsk_buffer_appendEx(output, "-------%s%c", self->end_line.tid, self->end_line.cflag);
|
||||
tsk_buffer_appendEx(output, "-------%s%c\r\n", self->end_line.tid, self->end_line.cflag);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char* tmsrp_message_tostring(const tmsrp_message_t *self)
|
||||
{
|
||||
tsk_buffer_t* output;
|
||||
char* ret = tsk_null;
|
||||
|
||||
if((output = TSK_BUFFER_CREATE_NULL())){
|
||||
if(!tmsrp_message_serialize(self, output)){
|
||||
ret = tsk_strndup(output->data, output->size);
|
||||
}
|
||||
TSK_OBJECT_SAFE_FREE(output);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// MSRP object definition
|
||||
//
|
||||
|
@ -354,33 +376,33 @@ static void* tmsrp_message_destroy(tsk_object_t * self)
|
|||
{
|
||||
tmsrp_message_t *message = self;
|
||||
if(message){
|
||||
TSK_FREE(message->tid);
|
||||
|
||||
// request
|
||||
//if(TMSRP_MESSAGE_IS_REQUEST(message)){
|
||||
TSK_FREE(message->line.request.method);
|
||||
//}
|
||||
// response
|
||||
//if(TMSRP_MESSAGE_IS_RESPONSE(message)){
|
||||
TSK_FREE(message->line.response.comment);
|
||||
//}
|
||||
|
||||
// Very common headers
|
||||
TSK_OBJECT_SAFE_FREE(message->To);
|
||||
TSK_OBJECT_SAFE_FREE(message->From);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(message->MessageID);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(message->ByteRange);
|
||||
TSK_OBJECT_SAFE_FREE(message->FailureReport);
|
||||
TSK_OBJECT_SAFE_FREE(message->SuccessReport);
|
||||
TSK_OBJECT_SAFE_FREE(message->Status);
|
||||
|
||||
// all other headers
|
||||
TSK_OBJECT_SAFE_FREE(message->headers);
|
||||
|
||||
// content
|
||||
TSK_OBJECT_SAFE_FREE(message->ContentType);
|
||||
TSK_FREE(message->tid);
|
||||
|
||||
// request
|
||||
//if(TMSRP_MESSAGE_IS_REQUEST(message)){
|
||||
TSK_FREE(message->line.request.method);
|
||||
//}
|
||||
// response
|
||||
//if(TMSRP_MESSAGE_IS_RESPONSE(message)){
|
||||
TSK_FREE(message->line.response.comment);
|
||||
//}
|
||||
|
||||
// Very common headers
|
||||
TSK_OBJECT_SAFE_FREE(message->To);
|
||||
TSK_OBJECT_SAFE_FREE(message->From);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(message->MessageID);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(message->ByteRange);
|
||||
TSK_OBJECT_SAFE_FREE(message->FailureReport);
|
||||
TSK_OBJECT_SAFE_FREE(message->SuccessReport);
|
||||
TSK_OBJECT_SAFE_FREE(message->Status);
|
||||
|
||||
// all other headers
|
||||
TSK_OBJECT_SAFE_FREE(message->headers);
|
||||
|
||||
// content
|
||||
TSK_OBJECT_SAFE_FREE(message->ContentType);
|
||||
TSK_OBJECT_SAFE_FREE(message->Content);
|
||||
|
||||
// end-line
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -60,19 +60,19 @@
|
|||
void test_parser()
|
||||
{
|
||||
tmsrp_message_t *message = 0;
|
||||
char* str;
|
||||
|
||||
//
|
||||
// Serialization / Deserialization
|
||||
//
|
||||
/* deserialize the message */
|
||||
if((message = tmsrp_message_parse(MSRP_MSG_TO_TEST, strlen(MSRP_MSG_TO_TEST)))){
|
||||
tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL();
|
||||
|
||||
|
||||
/* serialize the message */
|
||||
tmsrp_message_tostring(message, buffer);
|
||||
TSK_DEBUG_INFO("\nMSRP Message=\n%s\n\n", TSK_BUFFER_TO_STRING(buffer));
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(buffer);
|
||||
if((str = tmsrp_message_tostring(message))){
|
||||
TSK_DEBUG_INFO("\nMSRP Message=\n%s\n\n", str);
|
||||
TSK_FREE(str);
|
||||
}
|
||||
}
|
||||
else{
|
||||
TSK_DEBUG_ERROR("Failed to parse MSRP message(1).");
|
||||
|
@ -83,13 +83,13 @@ void test_parser()
|
|||
// Create Response from Request
|
||||
//
|
||||
if((message = tmsrp_message_parse(MSRP_MSG_REQUEST, strlen(MSRP_MSG_REQUEST)))){
|
||||
tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL();
|
||||
tmsrp_response_t* response = tmsrp_create_response(message, 202, "Accepted");
|
||||
|
||||
tmsrp_message_tostring(response, buffer);
|
||||
TSK_DEBUG_INFO("\nMSRP Response=\n%s\n\n", TSK_BUFFER_TO_STRING(buffer));
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(buffer);
|
||||
if((str = tmsrp_message_tostring(response))){
|
||||
TSK_DEBUG_INFO("\nMSRP Response=\n%s\n\n", str);
|
||||
TSK_FREE(str);
|
||||
}
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(response);
|
||||
}
|
||||
else{
|
||||
|
@ -101,13 +101,13 @@ void test_parser()
|
|||
// Create Report from Request
|
||||
//
|
||||
if((message = tmsrp_message_parse(MSRP_MSG_REQUEST, strlen(MSRP_MSG_REQUEST)))){
|
||||
tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL();
|
||||
tmsrp_request_t* report = tmsrp_create_report(message, 403, "Stop-sending-message");
|
||||
|
||||
tmsrp_message_tostring(report, buffer);
|
||||
TSK_DEBUG_INFO("\nMSRP Response=\n%s\n\n", TSK_BUFFER_TO_STRING(buffer));
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(buffer);
|
||||
if((str = tmsrp_message_tostring(report))){
|
||||
TSK_DEBUG_INFO("\nMSRP Response=\n%s\n\n", str);
|
||||
TSK_FREE(str);
|
||||
}
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(report);
|
||||
}
|
||||
else{
|
||||
|
@ -119,13 +119,13 @@ void test_parser()
|
|||
// Create bodiless Request
|
||||
//
|
||||
{
|
||||
tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL();
|
||||
tmsrp_request_t* bodiless = tmsrp_create_bodiless();
|
||||
|
||||
tmsrp_message_tostring(bodiless, buffer);
|
||||
TSK_DEBUG_INFO("\nMSRP Bodiless=\n%s\n\n", TSK_BUFFER_TO_STRING(buffer));
|
||||
if((str = tmsrp_message_tostring(bodiless))){
|
||||
TSK_DEBUG_INFO("\nMSRP Bodiless=\n%s\n\n", str);
|
||||
TSK_FREE(str);
|
||||
}
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(buffer);
|
||||
TSK_OBJECT_SAFE_FREE(bodiless);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -26,16 +26,16 @@
|
|||
#include "tinySDP/parsers/tsdp_parser_message.h"
|
||||
|
||||
#define REMOTE_SDP1 \
|
||||
"c=IN IP4 192.168.16.104\r\n" \
|
||||
"m=message 5060 TCP/MSRP *\r\n" \
|
||||
"c=IN IP4 192.168.0.15\r\n" \
|
||||
"m=message 2000 TCP/MSRP *\r\n" \
|
||||
"a=accept-types:text/plain\r\n" \
|
||||
"a=path:msrp://atlanta.example.com:7654/jshA7weztas;tcp\r\n" \
|
||||
"a=setup:passive\r\n" \
|
||||
"a=connection:new\r\n"
|
||||
|
||||
#define REMOTE_SDP2 \
|
||||
"m=message 5060 TCP/MSRP *\r\n" \
|
||||
"c=IN IP4 192.168.16.104\r\n" \
|
||||
"m=message 2000 TCP/MSRP *\r\n" \
|
||||
"c=IN IP4 192.168.0.15\r\n" \
|
||||
"a=accept-types:text/plain\r\n" \
|
||||
"a=path:msrp://atlanta.example.com:7654/jshA7weztas;tcp\r\n" \
|
||||
"a=setup:passive\r\n" \
|
||||
|
@ -73,7 +73,23 @@ void test_session()
|
|||
|
||||
tmedia_start(msrp);
|
||||
//tmedia_pause(msrp);
|
||||
tsk_thread_sleep(1);
|
||||
|
||||
tmedia_perform(msrp, tma_msrp_send_data,
|
||||
TSK_PARAM_VA_ARGS("content", "hello world!"),
|
||||
TSK_PARAM_VA_ARGS("content-type", "text/plain"),
|
||||
|
||||
tsk_null);
|
||||
|
||||
/*
|
||||
tmedia_perform(msrp, tma_msrp_send_file,
|
||||
TSK_PARAM_VA_ARGS("path", "C:\\ppppp"),
|
||||
TSK_PARAM_VA_ARGS("content-type", "text/plain"),
|
||||
|
||||
tsk_null);
|
||||
*/
|
||||
|
||||
getchar();
|
||||
|
||||
tmedia_stop(msrp);
|
||||
|
||||
TSK_OBJECT_SAFE_FREE(msrp);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -283,6 +283,14 @@
|
|||
<Filter
|
||||
Name="session"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\tinyMSRP\session\tmsrp_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\tinyMSRP\session\tmsrp_data.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\tinyMSRP\session\tmsrp_media.h"
|
||||
>
|
||||
|
@ -405,6 +413,14 @@
|
|||
<Filter
|
||||
Name="session"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\session\tmsrp_config.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\session\tmsrp_data.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\session\tmsrp_media.c"
|
||||
>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -31,8 +31,8 @@
|
|||
|
||||
#include "tsk_memory.h"
|
||||
|
||||
/**@defgroup tsk_base64_group Base64 encoder/decoder as per RFC 4648.
|
||||
* @brief Provides base64 encoder and decoder functions.
|
||||
/**@defgroup tsk_base64_group Base64 encoder/decoder as per RFC 4648.
|
||||
* @brief Provides base64 encoder and decoder functions.
|
||||
*/
|
||||
|
||||
/** Pad char.*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
@ -184,14 +184,13 @@ int tsk_buffer_realloc(tsk_buffer_t* self, size_t size)
|
|||
*/
|
||||
int tsk_buffer_remove(tsk_buffer_t* self, size_t position, size_t size)
|
||||
{
|
||||
if(self)
|
||||
if(self && self->data)
|
||||
{
|
||||
if((position == 0) && ((position + size) == self->size)){ /* Very common case. */
|
||||
if((position == 0) && ((position + size) >= self->size)){ /* Very common case. */
|
||||
return tsk_buffer_cleanup(self);
|
||||
}
|
||||
else if((position + size) < self->size)
|
||||
{
|
||||
size = self->size - position;
|
||||
memcpy(((uint8_t*)self->data) + position, ((uint8_t*)self->data) + position + size,
|
||||
self->size-(position+size));
|
||||
return tsk_buffer_realloc(self, (self->size-size));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Mamadou Diop.
|
||||
*
|
||||
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
|
||||
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
|
||||
*
|
||||
* This file is part of Open Source Doubango Framework.
|
||||
*
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue