diff --git a/trunk/tinyMEDIA/include/tinymedia/tmedia.h b/trunk/tinyMEDIA/include/tinymedia/tmedia.h index 42ba699b..01da82a1 100644 --- a/trunk/tinyMEDIA/include/tinymedia/tmedia.h +++ b/trunk/tinyMEDIA/include/tinymedia/tmedia.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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 diff --git a/trunk/tinyMEDIA/include/tinymedia_config.h b/trunk/tinyMEDIA/include/tinymedia_config.h index 8a58bd1b..08f2ea2d 100644 --- a/trunk/tinyMEDIA/include/tinymedia_config.h +++ b/trunk/tinyMEDIA/include/tinymedia_config.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMEDIA/src/tmedia.c b/trunk/tinyMEDIA/src/tmedia.c index 39d90e60..c73c13e7 100644 --- a/trunk/tinyMEDIA/src/tmedia.c +++ b/trunk/tinyMEDIA/src/tmedia.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; iplugin){ - 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 diff --git a/trunk/tinyMEDIA/test/dummy.c b/trunk/tinyMEDIA/test/dummy.c index 0a18a8e8..47b18f7a 100644 --- a/trunk/tinyMEDIA/test/dummy.c +++ b/trunk/tinyMEDIA/test/dummy.c @@ -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; diff --git a/trunk/tinyMEDIA/test/test.c b/trunk/tinyMEDIA/test/test.c index 69a27bcf..62c3091f 100644 --- a/trunk/tinyMEDIA/test/test.c +++ b/trunk/tinyMEDIA/test/test.c @@ -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); diff --git a/trunk/tinyMEDIA/test/test.vcproj b/trunk/tinyMEDIA/test/test.vcproj index f58c8c62..2fab9372 100644 --- a/trunk/tinyMEDIA/test/test.vcproj +++ b/trunk/tinyMEDIA/test/test.vcproj @@ -41,7 +41,7 @@ +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Authorization.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Authorization.h index a02560c7..16a93763 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Authorization.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Authorization.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Byte-Range.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Byte-Range.h index 3b419b90..6bc84e4d 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Byte-Range.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Byte-Range.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Content-Type.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Content-Type.h index d6d315a2..1d8ff65c 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Content-Type.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Content-Type.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Dummy.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Dummy.h index 660f9051..50417739 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Dummy.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Dummy.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Expires.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Expires.h index 0c0c20f2..74da19e0 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Expires.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Expires.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Failure-Report.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Failure-Report.h index ba6708cf..04220f03 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Failure-Report.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Failure-Report.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_From-Path.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_From-Path.h index 482223a0..f3cd2bb5 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_From-Path.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_From-Path.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Max-Expires.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Max-Expires.h index bffee3e6..ec94032a 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Max-Expires.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Max-Expires.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Message-ID.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Message-ID.h index 60cc6e9c..83d44edf 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Message-ID.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Message-ID.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Min-Expires.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Min-Expires.h index 915000dd..5f73b434 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Min-Expires.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Min-Expires.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Status.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Status.h index cdc5ea30..6a6495d2 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Status.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Status.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Success-Report.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Success-Report.h index 9ef0a92f..14f2a571 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Success-Report.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Success-Report.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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) diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_To-Path.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_To-Path.h index 43abc692..cb712684 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_To-Path.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_To-Path.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Use-Path.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Use-Path.h index 63309568..b7893dec 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Use-Path.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_Use-Path.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_WWW-Authenticate.h b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_WWW-Authenticate.h index cfeeee39..84fec8ab 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_WWW-Authenticate.h +++ b/trunk/tinyMSRP/include/tinyMSRP/headers/tmsrp_header_WWW-Authenticate.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/parsers/tmsrp_parser_message.h b/trunk/tinyMSRP/include/tinyMSRP/parsers/tmsrp_parser_message.h index 29c0c436..b826a456 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/parsers/tmsrp_parser_message.h +++ b/trunk/tinyMSRP/include/tinyMSRP/parsers/tmsrp_parser_message.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/parsers/tmsrp_parser_uri.h b/trunk/tinyMSRP/include/tinyMSRP/parsers/tmsrp_parser_uri.h index de00881a..dd35b2e5 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/parsers/tmsrp_parser_uri.h +++ b/trunk/tinyMSRP/include/tinyMSRP/parsers/tmsrp_parser_uri.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_config.h b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_config.h new file mode 100644 index 00000000..062a1a8a --- /dev/null +++ b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_config.h @@ -0,0 +1,63 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* 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 + * + * @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 */ diff --git a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_data.h b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_data.h index a3d3c429..329a3656 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_data.h +++ b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_data.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_media.h b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_media.h index e6aa6607..48458c42 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_media.h +++ b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_media.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; diff --git a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_sender.h b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_sender.h index 4e9096c6..794b62ce 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_sender.h +++ b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_sender.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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); diff --git a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_session.h b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_session.h index 48f47971..1fb45907 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_session.h +++ b/trunk/tinyMSRP/include/tinyMSRP/session/tmsrp_session.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP/tmsrp_message.h b/trunk/tinyMSRP/include/tinyMSRP/tmsrp_message.h index 260eed91..235ebc7e 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/tmsrp_message.h +++ b/trunk/tinyMSRP/include/tinyMSRP/tmsrp_message.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; diff --git a/trunk/tinyMSRP/include/tinyMSRP/tmsrp_uri.h b/trunk/tinyMSRP/include/tinyMSRP/tmsrp_uri.h index e834da18..e6480988 100644 --- a/trunk/tinyMSRP/include/tinyMSRP/tmsrp_uri.h +++ b/trunk/tinyMSRP/include/tinyMSRP/tmsrp_uri.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/include/tinyMSRP_config.h b/trunk/tinyMSRP/include/tinyMSRP_config.h index 813fc919..4ca0ec1b 100644 --- a/trunk/tinyMSRP/include/tinyMSRP_config.h +++ b/trunk/tinyMSRP/include/tinyMSRP_config.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * @@ -81,8 +81,8 @@ #include #include -/* FIXME */ +/* FIXME */ #define TMSRP_NULL 0 #endif /* _TINYMSRP_H_ */ - + diff --git a/trunk/tinyMSRP/include/tmsrp.h b/trunk/tinyMSRP/include/tmsrp.h index cba72e71..e999c66d 100644 --- a/trunk/tinyMSRP/include/tmsrp.h +++ b/trunk/tinyMSRP/include/tmsrp.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/ragel/tmsrp_machine_utils.rl b/trunk/tinyMSRP/ragel/tmsrp_machine_utils.rl index 767a816d..87d333f3 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_machine_utils.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_machine_utils.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Byte-Range.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Byte-Range.rl index f26ee733..64ae4d83 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Byte-Range.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Byte-Range.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Content-Type.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Content-Type.rl index 4a870749..8d66fcad 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Content-Type.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Content-Type.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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); } } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Dummy.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Dummy.rl index cf07e36e..3c413d6a 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Dummy.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Dummy.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Expires.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Expires.rl index fca45dd6..e94d97e2 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Expires.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Expires.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Failure-Report.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Failure-Report.rl index f3e6c2dc..19597f7e 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Failure-Report.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Failure-Report.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_From-Path.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_From-Path.rl index d7f1fa0a..4eec7870 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_From-Path.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_From-Path.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Max-Expires.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Max-Expires.rl index aaa51b03..d58dd0f7 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Max-Expires.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Max-Expires.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Message-ID.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Message-ID.rl index 42f385af..df798f17 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Message-ID.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Message-ID.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Min-Expires.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Min-Expires.rl index 2aff9e6f..15fd8368 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Min-Expires.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Min-Expires.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Status.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Status.rl index 29f5407c..7ba5a4c3 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Status.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Status.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Success-Report.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Success-Report.rl index e8c6881f..36477336 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Success-Report.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Success-Report.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_To-Path.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_To-Path.rl index 23053f9d..4c97b658 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_To-Path.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_To-Path.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Use-Path.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Use-Path.rl index 24e8439d..b81c3d07 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_header_Use-Path.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_header_Use-Path.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_message.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_message.rl index c354fabd..0dce3d5e 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_message.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_message.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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){ diff --git a/trunk/tinyMSRP/ragel/tmsrp_parser_uri.rl b/trunk/tinyMSRP/ragel/tmsrp_parser_uri.rl index 9dc5c715..7b77e591 100644 --- a/trunk/tinyMSRP/ragel/tmsrp_parser_uri.rl +++ b/trunk/tinyMSRP/ragel/tmsrp_parser_uri.rl @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header.c b/trunk/tinyMSRP/src/headers/tmsrp_header.c index 0e267d56..f6441cb6 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header.c @@ -1,45 +1,45 @@ -/* -* Copyright (C) 2009 Mamadou Diop. -* -* Contact: Mamadou Diop -* -* 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 +* +* 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 * * @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"; } diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Authorization.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Authorization.c index 762dacca..46f24068 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Authorization.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Authorization.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Byte-Range.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Byte-Range.c index 38ba9cc7..a1b72afd 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Byte-Range.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Byte-Range.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Content-Type.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Content-Type.c index ea93af0e..7e74ddcd 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Content-Type.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Content-Type.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Dummy.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Dummy.c index fb8ab976..d5b8cfff 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Dummy.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Dummy.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Expires.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Expires.c index f3fa2987..33e16d5f 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Expires.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Expires.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Failure-Report.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Failure-Report.c index a7fcf401..1950cdcb 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Failure-Report.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Failure-Report.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_From-Path.c b/trunk/tinyMSRP/src/headers/tmsrp_header_From-Path.c index 122f81cd..653d319d 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_From-Path.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_From-Path.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Max-Expires.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Max-Expires.c index eaa5ab87..969c567a 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Max-Expires.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Max-Expires.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Message-ID.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Message-ID.c index 39a386ac..fe2b0d40 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Message-ID.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Message-ID.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Min-Expires.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Min-Expires.c index cdf90b20..c4d18a3f 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Min-Expires.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Min-Expires.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Status.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Status.c index b3191945..b2b1bdcc 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Status.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Status.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Success-Report.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Success-Report.c index 245746a3..012f499f 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Success-Report.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Success-Report.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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."); diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_To-Path.c b/trunk/tinyMSRP/src/headers/tmsrp_header_To-Path.c index e93c8c58..e6dfa77d 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_To-Path.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_To-Path.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_Use-Path.c b/trunk/tinyMSRP/src/headers/tmsrp_header_Use-Path.c index 5a698a6e..e8e0a299 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_Use-Path.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_Use-Path.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/headers/tmsrp_header_WWW-Authenticate.c b/trunk/tinyMSRP/src/headers/tmsrp_header_WWW-Authenticate.c index 41812705..05996351 100644 --- a/trunk/tinyMSRP/src/headers/tmsrp_header_WWW-Authenticate.c +++ b/trunk/tinyMSRP/src/headers/tmsrp_header_WWW-Authenticate.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/parsers/tmsrp_parser_message.c b/trunk/tinyMSRP/src/parsers/tmsrp_parser_message.c index 76bea0bf..ad9b57d2 100644 --- a/trunk/tinyMSRP/src/parsers/tmsrp_parser_message.c +++ b/trunk/tinyMSRP/src/parsers/tmsrp_parser_message.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/parsers/tmsrp_parser_uri.c b/trunk/tinyMSRP/src/parsers/tmsrp_parser_uri.c index 7afaf91d..7aaf6c82 100644 --- a/trunk/tinyMSRP/src/parsers/tmsrp_parser_uri.c +++ b/trunk/tinyMSRP/src/parsers/tmsrp_parser_uri.c @@ -3,7 +3,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/session/tmsrp_config.c b/trunk/tinyMSRP/src/session/tmsrp_config.c new file mode 100644 index 00000000..219d767e --- /dev/null +++ b/trunk/tinyMSRP/src/session/tmsrp_config.c @@ -0,0 +1,79 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* 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 + * + * @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; + diff --git a/trunk/tinyMSRP/src/session/tmsrp_data.c b/trunk/tinyMSRP/src/session/tmsrp_data.c index 35a4b247..3983279f 100644 --- a/trunk/tinyMSRP/src/session/tmsrp_data.c +++ b/trunk/tinyMSRP/src/session/tmsrp_data.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/src/session/tmsrp_media.c b/trunk/tinyMSRP/src/session/tmsrp_media.c index 7e1d78bf..951e22da 100644 --- a/trunk/tinyMSRP/src/session/tmsrp_media.c +++ b/trunk/tinyMSRP/src/session/tmsrp_media.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; diff --git a/trunk/tinyMSRP/src/session/tmsrp_sender.c b/trunk/tinyMSRP/src/session/tmsrp_sender.c index 14f08913..8328c14a 100644 --- a/trunk/tinyMSRP/src/session/tmsrp_sender.c +++ b/trunk/tinyMSRP/src/session/tmsrp_sender.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; } diff --git a/trunk/tinyMSRP/src/session/tmsrp_session.c b/trunk/tinyMSRP/src/session/tmsrp_session.c index d15c1fdd..bd3ac91a 100644 --- a/trunk/tinyMSRP/src/session/tmsrp_session.c +++ b/trunk/tinyMSRP/src/session/tmsrp_session.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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; diff --git a/trunk/tinyMSRP/src/tmsrp.c b/trunk/tinyMSRP/src/tmsrp.c index e766e261..dff7e4b2 100644 --- a/trunk/tinyMSRP/src/tmsrp.c +++ b/trunk/tinyMSRP/src/tmsrp.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/src/tmsrp_message.c b/trunk/tinyMSRP/src/tmsrp_message.c index c89c4513..74f0bd9f 100644 --- a/trunk/tinyMSRP/src/tmsrp_message.c +++ b/trunk/tinyMSRP/src/tmsrp_message.c @@ -1,38 +1,38 @@ -/* -* Copyright (C) 2009 Mamadou Diop. -* -* Contact: Mamadou Diop -* -* 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 - * - * @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 +* +* 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 + * + * @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 diff --git a/trunk/tinyMSRP/src/tmsrp_uri.c b/trunk/tinyMSRP/src/tmsrp_uri.c index 9fe3090f..1b305357 100644 --- a/trunk/tinyMSRP/src/tmsrp_uri.c +++ b/trunk/tinyMSRP/src/tmsrp_uri.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/test/test/stdafx.c b/trunk/tinyMSRP/test/test/stdafx.c index d0955518..71926073 100644 --- a/trunk/tinyMSRP/test/test/stdafx.c +++ b/trunk/tinyMSRP/test/test/stdafx.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/test/test/stdafx.h b/trunk/tinyMSRP/test/test/stdafx.h index 7588f582..6eb90256 100644 --- a/trunk/tinyMSRP/test/test/stdafx.h +++ b/trunk/tinyMSRP/test/test/stdafx.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/test/test/test.c b/trunk/tinyMSRP/test/test/test.c index ac16724e..0b794a9a 100644 --- a/trunk/tinyMSRP/test/test/test.c +++ b/trunk/tinyMSRP/test/test/test.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/test/test/test_parser.h b/trunk/tinyMSRP/test/test/test_parser.h index 772df89b..07086bf8 100644 --- a/trunk/tinyMSRP/test/test/test_parser.h +++ b/trunk/tinyMSRP/test/test/test_parser.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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); } } diff --git a/trunk/tinyMSRP/test/test/test_session.h b/trunk/tinyMSRP/test/test/test_session.h index 974bc59e..6e814352 100644 --- a/trunk/tinyMSRP/test/test/test_session.h +++ b/trunk/tinyMSRP/test/test/test_session.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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); diff --git a/trunk/tinyMSRP/test/test/test_uri.h b/trunk/tinyMSRP/test/test/test_uri.h index 229fd1a1..d0df3751 100644 --- a/trunk/tinyMSRP/test/test/test_uri.h +++ b/trunk/tinyMSRP/test/test/test_uri.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinyMSRP/tinyMSRP.vcproj b/trunk/tinyMSRP/tinyMSRP.vcproj index 4085cb57..107f7327 100644 --- a/trunk/tinyMSRP/tinyMSRP.vcproj +++ b/trunk/tinyMSRP/tinyMSRP.vcproj @@ -283,6 +283,14 @@ + + + + @@ -405,6 +413,14 @@ + + + + diff --git a/trunk/tinySAK/src/tinySAK_config.h b/trunk/tinySAK/src/tinySAK_config.h index c58a7270..8d5a782a 100644 --- a/trunk/tinySAK/src/tinySAK_config.h +++ b/trunk/tinySAK/src/tinySAK_config.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk.h b/trunk/tinySAK/src/tsk.h index 34659591..0158b046 100644 --- a/trunk/tinySAK/src/tsk.h +++ b/trunk/tinySAK/src/tsk.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_base64.c b/trunk/tinySAK/src/tsk_base64.c index 22736fcb..2c1bb5ef 100644 --- a/trunk/tinySAK/src/tsk_base64.c +++ b/trunk/tinySAK/src/tsk_base64.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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.*/ diff --git a/trunk/tinySAK/src/tsk_base64.h b/trunk/tinySAK/src/tsk_base64.h index 25cf9da9..0c65824a 100644 --- a/trunk/tinySAK/src/tsk_base64.h +++ b/trunk/tinySAK/src/tsk_base64.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_binaryutils.c b/trunk/tinySAK/src/tsk_binaryutils.c index c055740b..f8e643e0 100644 --- a/trunk/tinySAK/src/tsk_binaryutils.c +++ b/trunk/tinySAK/src/tsk_binaryutils.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_binaryutils.h b/trunk/tinySAK/src/tsk_binaryutils.h index 844c9ec7..c26aed93 100644 --- a/trunk/tinySAK/src/tsk_binaryutils.h +++ b/trunk/tinySAK/src/tsk_binaryutils.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_buffer.c b/trunk/tinySAK/src/tsk_buffer.c index 67fabb5b..2a804f1d 100644 --- a/trunk/tinySAK/src/tsk_buffer.c +++ b/trunk/tinySAK/src/tsk_buffer.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * 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)); diff --git a/trunk/tinySAK/src/tsk_buffer.h b/trunk/tinySAK/src/tsk_buffer.h index 31619f29..84de7022 100644 --- a/trunk/tinySAK/src/tsk_buffer.h +++ b/trunk/tinySAK/src/tsk_buffer.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_common.h b/trunk/tinySAK/src/tsk_common.h index 931b7015..fcca623d 100644 --- a/trunk/tinySAK/src/tsk_common.h +++ b/trunk/tinySAK/src/tsk_common.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_condwait.c b/trunk/tinySAK/src/tsk_condwait.c index c2ecd591..3ac8e96b 100644 --- a/trunk/tinySAK/src/tsk_condwait.c +++ b/trunk/tinySAK/src/tsk_condwait.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_condwait.h b/trunk/tinySAK/src/tsk_condwait.h index f22fd0cf..c19fa953 100644 --- a/trunk/tinySAK/src/tsk_condwait.h +++ b/trunk/tinySAK/src/tsk_condwait.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_debug.c b/trunk/tinySAK/src/tsk_debug.c index 65075d7a..a394d868 100644 --- a/trunk/tinySAK/src/tsk_debug.c +++ b/trunk/tinySAK/src/tsk_debug.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_debug.h b/trunk/tinySAK/src/tsk_debug.h index db471480..9603bd37 100644 --- a/trunk/tinySAK/src/tsk_debug.h +++ b/trunk/tinySAK/src/tsk_debug.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_errno.h b/trunk/tinySAK/src/tsk_errno.h index 4852f70f..0350cdcc 100644 --- a/trunk/tinySAK/src/tsk_errno.h +++ b/trunk/tinySAK/src/tsk_errno.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_fsm.c b/trunk/tinySAK/src/tsk_fsm.c index 129fb1cb..06783d55 100644 --- a/trunk/tinySAK/src/tsk_fsm.c +++ b/trunk/tinySAK/src/tsk_fsm.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_fsm.h b/trunk/tinySAK/src/tsk_fsm.h index ea7b96ea..90cda600 100644 --- a/trunk/tinySAK/src/tsk_fsm.h +++ b/trunk/tinySAK/src/tsk_fsm.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_hmac.c b/trunk/tinySAK/src/tsk_hmac.c index 177dc4ff..42c9b7cd 100644 --- a/trunk/tinySAK/src/tsk_hmac.c +++ b/trunk/tinySAK/src/tsk_hmac.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_hmac.h b/trunk/tinySAK/src/tsk_hmac.h index 9fec3c8c..0e5545c5 100644 --- a/trunk/tinySAK/src/tsk_hmac.h +++ b/trunk/tinySAK/src/tsk_hmac.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_list.c b/trunk/tinySAK/src/tsk_list.c index 8fdc1957..954cd686 100644 --- a/trunk/tinySAK/src/tsk_list.c +++ b/trunk/tinySAK/src/tsk_list.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_list.h b/trunk/tinySAK/src/tsk_list.h index 8d72ddf7..11035e74 100644 --- a/trunk/tinySAK/src/tsk_list.h +++ b/trunk/tinySAK/src/tsk_list.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_md5.c b/trunk/tinySAK/src/tsk_md5.c index 6f5264ad..cf13871d 100644 --- a/trunk/tinySAK/src/tsk_md5.c +++ b/trunk/tinySAK/src/tsk_md5.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_md5.h b/trunk/tinySAK/src/tsk_md5.h index 51750bc0..20fa5e0b 100644 --- a/trunk/tinySAK/src/tsk_md5.h +++ b/trunk/tinySAK/src/tsk_md5.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_memory.c b/trunk/tinySAK/src/tsk_memory.c index 06601c71..c4b90f42 100644 --- a/trunk/tinySAK/src/tsk_memory.c +++ b/trunk/tinySAK/src/tsk_memory.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_memory.h b/trunk/tinySAK/src/tsk_memory.h index 2fdb8d40..fbc5ddac 100644 --- a/trunk/tinySAK/src/tsk_memory.h +++ b/trunk/tinySAK/src/tsk_memory.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_mutex.c b/trunk/tinySAK/src/tsk_mutex.c index f13b3086..c70daa83 100644 --- a/trunk/tinySAK/src/tsk_mutex.c +++ b/trunk/tinySAK/src/tsk_mutex.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_mutex.h b/trunk/tinySAK/src/tsk_mutex.h index d5e9077b..f217eafd 100644 --- a/trunk/tinySAK/src/tsk_mutex.h +++ b/trunk/tinySAK/src/tsk_mutex.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_object.c b/trunk/tinySAK/src/tsk_object.c index 7f0c3eff..ac119a4e 100644 --- a/trunk/tinySAK/src/tsk_object.c +++ b/trunk/tinySAK/src/tsk_object.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * @@ -37,7 +37,7 @@ */ #if defined (_DEBUG) || defined (DEBUG) -# define TSK_DEBUG_OBJECTS 1 +# define TSK_DEBUG_OBJECTS 0 static int tsk_objects_count = 0; #else # define TSK_DEBUG_OBJECTS 0 @@ -66,8 +66,7 @@ tsk_object_t* tsk_object_new(const tsk_object_def_t *objdef, ...) { (*(const tsk_object_def_t **) newobj) = objdef; TSK_OBJECT_HEADER_GET(newobj)->refCount = 1; - if(objdef->constructor) - { + if(objdef->constructor){ va_list ap; va_start(ap, objdef); newobj = objdef->constructor(newobj, &ap); @@ -104,6 +103,10 @@ tsk_object_t* tsk_object_new2(const tsk_object_def_t *objdef, va_list* ap) TSK_OBJECT_HEADER_GET(newobj)->refCount = 1; if(objdef->constructor){ newobj = objdef->constructor(newobj, ap); + +#if TSK_DEBUG_OBJECTS + TSK_DEBUG_INFO("N° objects:%d", ++tsk_objects_count); +#endif } else{ TSK_DEBUG_WARN("No constructor found."); diff --git a/trunk/tinySAK/src/tsk_object.h b/trunk/tinySAK/src/tsk_object.h index 76df7312..f43fb4c6 100644 --- a/trunk/tinySAK/src/tsk_object.h +++ b/trunk/tinySAK/src/tsk_object.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_params.c b/trunk/tinySAK/src/tsk_params.c index 3f1a81c6..d313fea0 100644 --- a/trunk/tinySAK/src/tsk_params.c +++ b/trunk/tinySAK/src/tsk_params.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * @@ -110,7 +110,7 @@ int tsk_params_add_param(tsk_params_L_t **self, const char* name, const char* va { tsk_param_t *param; - if(!name) { + if(!self || !name) { return -1; } @@ -129,6 +129,17 @@ int tsk_params_add_param(tsk_params_L_t **self, const char* name, const char* va return 0; } +int tsk_params_add_param_2(tsk_params_L_t **self, const tsk_param_t* param) +{ + int ret = -1; + if(!self || !param || !param){ + return ret; + } + + ret = tsk_params_add_param(self, param->name, param->value); + return ret; +} + /**@ingroup tsk_params_group * Removes a parameter from the list of parameters. * @param self The source list. diff --git a/trunk/tinySAK/src/tsk_params.h b/trunk/tinySAK/src/tsk_params.h index 2e5d33cb..987f8590 100644 --- a/trunk/tinySAK/src/tsk_params.h +++ b/trunk/tinySAK/src/tsk_params.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * @@ -45,7 +45,8 @@ */ TSK_BEGIN_DECLS -#define TSK_PARAM_CREATE(name, value) tsk_object_new(tsk_param_def_t, (const char*)name, (const char*)value) +#define TSK_PARAM_VA_ARGS(name, value) tsk_param_def_t, (const char*)name, (const char*)value +#define TSK_PARAM_CREATE(name, value) tsk_object_new(TSK_PARAM_VA_ARGS(name, value)) #define TSK_PARAM_CREATE_NULL() TSK_PARAM_CREATE(tsk_null, tsk_null) #define TSK_PARAM(self) ((tsk_param_t*)(self)) @@ -70,6 +71,7 @@ TINYSAK_API tsk_param_t *tsk_params_parse_param(const char* line, size_t size); TINYSAK_API int tsk_params_have_param(const tsk_params_L_t *self, const char* name); TINYSAK_API int tsk_params_add_param(tsk_params_L_t **self, const char* name, const char* value); +TINYSAK_API int tsk_params_add_param_2(tsk_params_L_t **self, const tsk_param_t* param); TINYSAK_API int tsk_params_remove_param(tsk_params_L_t *self, const char* name); TINYSAK_API const tsk_param_t *tsk_params_get_param_by_name(const tsk_params_L_t *self, const char* name); TINYSAK_API const char *tsk_params_get_param_value(const tsk_params_L_t *self, const char* name); diff --git a/trunk/tinySAK/src/tsk_ppfcs16.c b/trunk/tinySAK/src/tsk_ppfcs16.c index 07f138c4..38e509f7 100644 --- a/trunk/tinySAK/src/tsk_ppfcs16.c +++ b/trunk/tinySAK/src/tsk_ppfcs16.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_ppfcs16.h b/trunk/tinySAK/src/tsk_ppfcs16.h index eb882e0a..3e29ac7b 100644 --- a/trunk/tinySAK/src/tsk_ppfcs16.h +++ b/trunk/tinySAK/src/tsk_ppfcs16.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_ppfcs32.c b/trunk/tinySAK/src/tsk_ppfcs32.c index 7ac4e390..e3773fa8 100644 --- a/trunk/tinySAK/src/tsk_ppfcs32.c +++ b/trunk/tinySAK/src/tsk_ppfcs32.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * @@ -30,7 +30,7 @@ #include "tsk_ppfcs32.h" -/**@defgroup tsk_ppfcs32_group PPP in HDLC-like Framing (RFC 1662). +/**@defgroup tsk_ppfcs32_group PPP in HDLC-like Framing (RFC 1662). */ static uint32_t fcstab_32[256] = diff --git a/trunk/tinySAK/src/tsk_ppfcs32.h b/trunk/tinySAK/src/tsk_ppfcs32.h index ec42b67e..ed8312ee 100644 --- a/trunk/tinySAK/src/tsk_ppfcs32.h +++ b/trunk/tinySAK/src/tsk_ppfcs32.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_ragel_state.c b/trunk/tinySAK/src/tsk_ragel_state.c index 000f36c3..1280e4de 100644 --- a/trunk/tinySAK/src/tsk_ragel_state.c +++ b/trunk/tinySAK/src/tsk_ragel_state.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_ragel_state.h b/trunk/tinySAK/src/tsk_ragel_state.h index 10d21bf9..b0354183 100644 --- a/trunk/tinySAK/src/tsk_ragel_state.h +++ b/trunk/tinySAK/src/tsk_ragel_state.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_runnable.c b/trunk/tinySAK/src/tsk_runnable.c index 87250ed0..d596d6bf 100644 --- a/trunk/tinySAK/src/tsk_runnable.c +++ b/trunk/tinySAK/src/tsk_runnable.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * @@ -140,4 +140,4 @@ int tsk_runnable_stop(tsk_runnable_t *self) } return ret; } - + diff --git a/trunk/tinySAK/src/tsk_runnable.h b/trunk/tinySAK/src/tsk_runnable.h index db234221..286ac425 100644 --- a/trunk/tinySAK/src/tsk_runnable.h +++ b/trunk/tinySAK/src/tsk_runnable.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_safeobj.c b/trunk/tinySAK/src/tsk_safeobj.c index d7c6162f..f4454aca 100644 --- a/trunk/tinySAK/src/tsk_safeobj.c +++ b/trunk/tinySAK/src/tsk_safeobj.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_safeobj.h b/trunk/tinySAK/src/tsk_safeobj.h index f2772a46..061c6fd5 100644 --- a/trunk/tinySAK/src/tsk_safeobj.h +++ b/trunk/tinySAK/src/tsk_safeobj.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_semaphore.c b/trunk/tinySAK/src/tsk_semaphore.c index 10f49dc2..f6acf807 100644 --- a/trunk/tinySAK/src/tsk_semaphore.c +++ b/trunk/tinySAK/src/tsk_semaphore.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_semaphore.h b/trunk/tinySAK/src/tsk_semaphore.h index 7219dbca..7fd8d63c 100644 --- a/trunk/tinySAK/src/tsk_semaphore.h +++ b/trunk/tinySAK/src/tsk_semaphore.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_sha1.c b/trunk/tinySAK/src/tsk_sha1.c index cc6e82e0..a59d4b09 100644 --- a/trunk/tinySAK/src/tsk_sha1.c +++ b/trunk/tinySAK/src/tsk_sha1.c @@ -64,7 +64,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_sha1.h b/trunk/tinySAK/src/tsk_sha1.h index 164de216..62285de9 100644 --- a/trunk/tinySAK/src/tsk_sha1.h +++ b/trunk/tinySAK/src/tsk_sha1.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_string.c b/trunk/tinySAK/src/tsk_string.c index aa6a8955..ac7fd815 100644 --- a/trunk/tinySAK/src/tsk_string.c +++ b/trunk/tinySAK/src/tsk_string.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * @@ -232,7 +232,9 @@ int tsk_sprintf(char** str, const char* format, ...) va_start(list, format); /* free previous value */ - if(*str) tsk_free((void**)str); + if(*str){ + tsk_free((void**)str); + } /* compute destination len for windows mobile */ @@ -373,7 +375,7 @@ void tsk_itoa(int64_t i, tsk_istr_t *result) **/ void tsk_strrandom(tsk_istr_t *result) { - static uint64_t __counter = 1; + static uint64_t __counter = 1; tsk_itoa((tsk_time_epoch() ^ (tsk_urand())) ^ ++__counter, result); } diff --git a/trunk/tinySAK/src/tsk_string.h b/trunk/tinySAK/src/tsk_string.h index 5236a48b..6011364c 100644 --- a/trunk/tinySAK/src/tsk_string.h +++ b/trunk/tinySAK/src/tsk_string.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_thread.c b/trunk/tinySAK/src/tsk_thread.c index 25bd4cb7..82515f8f 100644 --- a/trunk/tinySAK/src/tsk_thread.c +++ b/trunk/tinySAK/src/tsk_thread.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_thread.h b/trunk/tinySAK/src/tsk_thread.h index 4b9e6f18..328c1e42 100644 --- a/trunk/tinySAK/src/tsk_thread.h +++ b/trunk/tinySAK/src/tsk_thread.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_time.c b/trunk/tinySAK/src/tsk_time.c index 795524c9..926e93f9 100644 --- a/trunk/tinySAK/src/tsk_time.c +++ b/trunk/tinySAK/src/tsk_time.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_time.h b/trunk/tinySAK/src/tsk_time.h index b89103e6..9bc5b1c9 100644 --- a/trunk/tinySAK/src/tsk_time.h +++ b/trunk/tinySAK/src/tsk_time.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_timer.c b/trunk/tinySAK/src/tsk_timer.c index e036fe28..d0966148 100644 --- a/trunk/tinySAK/src/tsk_timer.c +++ b/trunk/tinySAK/src/tsk_timer.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_timer.h b/trunk/tinySAK/src/tsk_timer.h index 717a1232..e03e8d42 100644 --- a/trunk/tinySAK/src/tsk_timer.h +++ b/trunk/tinySAK/src/tsk_timer.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_url.c b/trunk/tinySAK/src/tsk_url.c index 3e709cbe..e44e7d9b 100644 --- a/trunk/tinySAK/src/tsk_url.c +++ b/trunk/tinySAK/src/tsk_url.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_url.h b/trunk/tinySAK/src/tsk_url.h index fc629613..9f0a4aba 100644 --- a/trunk/tinySAK/src/tsk_url.h +++ b/trunk/tinySAK/src/tsk_url.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_uuid.c b/trunk/tinySAK/src/tsk_uuid.c index 64cd139c..1d6cb046 100644 --- a/trunk/tinySAK/src/tsk_uuid.c +++ b/trunk/tinySAK/src/tsk_uuid.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_uuid.h b/trunk/tinySAK/src/tsk_uuid.h index bbe1497d..99881a33 100644 --- a/trunk/tinySAK/src/tsk_uuid.h +++ b/trunk/tinySAK/src/tsk_uuid.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_xml.c b/trunk/tinySAK/src/tsk_xml.c index 000daca8..287042ed 100644 --- a/trunk/tinySAK/src/tsk_xml.c +++ b/trunk/tinySAK/src/tsk_xml.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. * diff --git a/trunk/tinySAK/src/tsk_xml.h b/trunk/tinySAK/src/tsk_xml.h index 80934644..adaf8cb4 100644 --- a/trunk/tinySAK/src/tsk_xml.h +++ b/trunk/tinySAK/src/tsk_xml.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Mamadou Diop. * -* Contact: Mamadou Diop +* Contact: Mamadou Diop * * This file is part of Open Source Doubango Framework. *