summaryrefslogtreecommitdiffstats
path: root/tinySDP/test
diff options
context:
space:
mode:
Diffstat (limited to 'tinySDP/test')
-rw-r--r--tinySDP/test/droid-makefile28
-rw-r--r--tinySDP/test/stdafx.c26
-rw-r--r--tinySDP/test/stdafx.h41
-rw-r--r--tinySDP/test/targetver.h36
-rw-r--r--tinySDP/test/test.c61
-rw-r--r--tinySDP/test/test.vcproj219
-rw-r--r--tinySDP/test/test_parser.h264
-rw-r--r--tinySDP/test/test_soa.h110
8 files changed, 785 insertions, 0 deletions
diff --git a/tinySDP/test/droid-makefile b/tinySDP/test/droid-makefile
new file mode 100644
index 0000000..76e5f0c
--- /dev/null
+++ b/tinySDP/test/droid-makefile
@@ -0,0 +1,28 @@
+APP := test
+
+CFLAGS := $(CFLAGS_COMMON) -I../include -I../../tinySAK/src
+LDFLAGS := $(LDFLAGS_COMMON) -Wl,-Bsymbolic,--whole-archive -l$(PROJECT) -ltinySAK -Wl,--entry=main
+
+all: $(APP)
+
+OBJS += $(APP).o
+
+$(APP): $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $^
+
+%.o: %.c
+ $(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@
+
+install: $(APP)
+ $(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(EXEC_DIR)/$(APP)
+ $(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(EXEC_DIR)/$(APP)
+
+run:
+ $(ANDROID_SDK_ROOT)/tools/adb shell $(EXEC_DIR)/$(APP)
+
+#dbg:
+# $(MAKE) $(MAKEFILE) DEBUG="-g -DDEBUG"
+# $(MAKE) $(MAKEFILE) install
+
+clean:
+ @rm -f $(OBJS) $(APP) \ No newline at end of file
diff --git a/tinySDP/test/stdafx.c b/tinySDP/test/stdafx.c
new file mode 100644
index 0000000..59df1b5
--- /dev/null
+++ b/tinySDP/test/stdafx.c
@@ -0,0 +1,26 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* 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.
+*
+*/
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/tinySDP/test/stdafx.h b/tinySDP/test/stdafx.h
new file mode 100644
index 0000000..9c53841
--- /dev/null
+++ b/tinySDP/test/stdafx.h
@@ -0,0 +1,41 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* 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.
+*
+*/
+
+#ifndef TEST_TSDP_STDAFX_H
+#define TEST_TSDP_STDAFX_H
+
+#ifdef WIN32
+#include "targetver.h"
+#endif
+
+#include <stdio.h>
+
+#if (defined(_WIN32) || defined(WIN32) || defined(_WIN32_WCE)) && !defined(__SYMBIAN32__)
+#include <tchar.h>
+#endif
+
+
+
+// TODO: reference additional headers your program requires here
+#include <string.h>
+
+#endif /* TEST_TSDP_STDAFX_H */
diff --git a/tinySDP/test/targetver.h b/tinySDP/test/targetver.h
new file mode 100644
index 0000000..a5c9fb4
--- /dev/null
+++ b/tinySDP/test/targetver.h
@@ -0,0 +1,36 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* 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.
+*
+*/
+
+#ifndef TSDP_TEST_TARGETVER_H
+#define TSDP_TEST_TARGETVER_H
+// The following macros define the minimum required platform. The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
+// your application. The macros work by enabling all features available on platform versions up to and
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#endif /* TSDP_TEST_TARGETVER_H */
diff --git a/tinySDP/test/test.c b/tinySDP/test/test.c
new file mode 100644
index 0000000..eed829f
--- /dev/null
+++ b/tinySDP/test/test.c
@@ -0,0 +1,61 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* 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.
+*
+*/
+
+#include "stdafx.h"
+
+#include "tsk.h"
+
+#include "tsdp.h"
+#include "tinysdp/parsers/tsdp_parser_message.h"
+
+#include "test_parser.h"
+#include "test_soa.h"
+
+
+#define RUN_TEST_LOOP 1
+
+#define RUN_TEST_ALL 0
+#define RUN_TEST_PARSER 1
+#define RUN_TEST_SOA 0
+
+
+#ifdef _WIN32_WCE
+int _tmain(int argc, _TCHAR* argv[])
+#else
+int main()
+#endif
+{
+ do
+ {
+ /* Print copyright information */
+ printf("Doubango Project\nCopyright (C) 2009 - 2010 Mamadou Diop \n\n");
+
+#if RUN_TEST_ALL || RUN_TEST_PARSER
+ test_parser();
+#endif
+
+#if RUN_TEST_ALL || RUN_TEST_SOA
+ test_soa();
+#endif
+
+ } while(RUN_TEST_LOOP);
+}
diff --git a/tinySDP/test/test.vcproj b/tinySDP/test/test.vcproj
new file mode 100644
index 0000000..c6eff23
--- /dev/null
+++ b/tinySDP/test/test.vcproj
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="test"
+ ProjectGUID="{4555F4A7-6DC7-4844-9F3F-6AAB4443D4E9}"
+ RootNamespace="test"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(DOUBANGO_HOME)\thirdparties\win32\include&quot;;&quot;$(SolutionDir)\include&quot;;&quot;$(DOUBANGO_HOME)\tinySAK\src&quot;"
+ PreprocessorDefinitions="DEBUG_LEVEL=DEBUG_LEVEL_INFO;WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="true"
+ DebugInformationFormat="4"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="$(OutDir)\tinySAK.lib $(OutDir)\tinySDP.lib"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ WarnAsError="true"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="sources"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\stdafx.c"
+ >
+ </File>
+ <File
+ RelativePath=".\test.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="include"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath=".\targetver.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="tests"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\test_parser.h"
+ >
+ </File>
+ <File
+ RelativePath=".\test_soa.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/tinySDP/test/test_parser.h b/tinySDP/test/test_parser.h
new file mode 100644
index 0000000..9086547
--- /dev/null
+++ b/tinySDP/test/test_parser.h
@@ -0,0 +1,264 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* 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.
+*
+*/
+#ifndef _TEST_SDPPARSER_H
+#define _TEST_SDPPARSER_H
+
+#include "tinysdp/headers/tsdp_header_Dummy.h"
+#include "tinysdp/headers/tsdp_header_A.h"
+#include "tinysdp/headers/tsdp_header_C.h"
+#include "tinysdp/headers/tsdp_header_E.h"
+#include "tinysdp/headers/tsdp_header_I.h"
+#include "tinysdp/headers/tsdp_header_P.h"
+
+#define SDP_MSG1 \
+ "v=0\r\n" \
+ "o=alice 2890844526 2890844526 IN IP4 host.atlanta.example.com\r\n" \
+ "s=\r\n" \
+ "i=A Seminar on the session description protocol\r\n" \
+ "u=http://www.example.com/seminars/sdp.pdf\r\n" \
+ "e=j.doe@example.com (Jane Doe)\r\n" \
+ "p=+1 617 555-6011\r\n" \
+ "c=IN IP4 host.atlanta.example.com\r\n" \
+ "b=X-YZ:128\r\n" \
+ "z=2882844526 -1h 2898848070 0\r\n" \
+ "k=base64:ZWFzdXJlLg==\r\n" \
+ "t=3034423619 3042462419\r\n" \
+ "r=7d 1h 0 25h\r\n" \
+ "r=604800 3600 0 90000\r\n" \
+ "w=my dummy header\r\n" \
+ "m=audio 49170 RTP/AVP 0 8 97 98\r\n" \
+ "i=Audio line\r\n" \
+ "c=IN IP4 otherhost.biloxi.example.com\r\n" \
+ "k=base64:ZWFzdXJlLgdddddddddddddddddddddd==\r\n" \
+ "a=rtpmap:0 PCMU/8000\r\n" \
+ "a=rtpmap:8 PCMA/8000\r\n" \
+ "a=rtpmap:97 iLBC/8000\r\n" \
+ "a=rtpmap:98 AMR-WB/16000\r\n" \
+ "a=fmtp:98 octet-align=1\r\n" \
+ "m=video 51372 RTP/AVP 31 32\r\n" \
+ "i=Video line\r\n" \
+ "b=A-YZ:92\r\n" \
+ "b=B-YZ:256\r\n" \
+ "a=rtpmap:31 H261/90000\r\n" \
+ "a=rtpmap:32 MPV/90000\r\n" \
+ "a=recvonly\r\n"
+
+#define SDP_MSG2 \
+ "v=0\r\n"
+
+
+#define SDP_MSG_TO_TEST SDP_MSG1
+
+void test_caps();
+void test_holdresume();
+void test_M();
+
+void test_parser()
+{
+ tsdp_message_t *message = tsk_null;
+ char* str;
+
+ test_caps();
+ test_holdresume();
+ test_M();
+
+ //
+ // deserialize/serialize the message
+ //
+ if((message = tsdp_message_parse(SDP_MSG_TO_TEST, strlen(SDP_MSG_TO_TEST)))){
+
+ /* serialize the message */
+ if((str = tsdp_message_tostring(message))){
+ TSK_DEBUG_INFO("SDP Message=\n%s", str);
+ TSK_FREE(str);
+ }
+
+ TSK_OBJECT_SAFE_FREE(message);
+ }
+ else{
+ TSK_DEBUG_ERROR("Failed to parse SDP message.");
+ }
+
+ //
+ // create empty message
+ //
+ if((message = tsdp_message_create_empty("127.0.0.1", tsk_false))){
+
+ /* add media */
+ tsdp_message_add_media(message, "audio", 8956, "RTP/AVP",
+ TSDP_HEADER_I_VA_ARGS("this is the information line"),
+
+ // pcmu
+ TSDP_FMT_VA_ARGS("0"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "0 pcmu/8000"),
+ TSDP_HEADER_A_VA_ARGS("3gpp_sync_info", "No Sync"),
+
+ // pcma
+ TSDP_FMT_VA_ARGS("8"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "8 pcma/8000"),
+
+ // telephone event
+ TSDP_FMT_VA_ARGS("101"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "101 telephone-event/8000"),
+ TSDP_HEADER_A_VA_ARGS("fmtp", "101 0-11"),
+
+
+ // common values
+ TSDP_HEADER_A_VA_ARGS("sendrecv", tsk_null),
+ TSDP_HEADER_A_VA_ARGS("ptime", "20"),
+
+ tsk_null);
+
+ //tsdp_message_remove_media(message, "video");
+ //tsdp_message_remove_media(message, "audio");
+
+ /* serialize the message */
+ if((str = tsdp_message_tostring(message))){
+ TSK_DEBUG_INFO("\n\nEmpty SDP Message=\n%s", str);
+ TSK_FREE(str);
+ }
+
+ TSK_OBJECT_SAFE_FREE(message);
+ }
+}
+
+void test_caps()
+{
+ tsdp_message_t *message = tsk_null;
+ char* str;
+
+ if((message = tsdp_message_create_empty("100.3.6.6", tsk_false))){
+
+ tsdp_message_add_headers(message,
+ TSDP_HEADER_C_VA_ARGS("IN", "IP4", "192.0.2.4"),
+ TSDP_HEADER_E_VA_ARGS("j.doe@example.com (Jane Doe)"),
+ TSDP_HEADER_P_VA_ARGS("+44 (123)456789"),
+
+ tsk_null);
+
+ /* add (audio) media */
+ tsdp_message_add_media(message, "audio", 0, "RTP/AVP",
+ TSDP_HEADER_I_VA_ARGS("this is the (audio)information line"),
+
+ // PCMU
+ TSDP_FMT_VA_ARGS("0"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "0 PCMU/8000"),
+
+ // 1016
+ TSDP_FMT_VA_ARGS("1"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "1 1016/8000"),
+
+ // GSM
+ TSDP_FMT_VA_ARGS("3"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "3 GSM/8000"),
+
+ tsk_null);
+
+ /* add (video) media */
+ tsdp_message_add_media(message, "video", 0, "RTP/AVP",
+ TSDP_HEADER_I_VA_ARGS("this is the (video)information line"),
+
+ // H261
+ TSDP_FMT_VA_ARGS("31"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "31 H261/90000"),
+
+ // H263
+ TSDP_FMT_VA_ARGS("34"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "34 H263/90000"),
+
+ tsk_null);
+
+ /* serialize the message */
+ if((str = tsdp_message_tostring(message))){
+ TSK_DEBUG_INFO("\n\nCapabilities SDP Message=\n%s", str);
+ TSK_FREE(str);
+ }
+
+ TSK_OBJECT_SAFE_FREE(message);
+ }
+}
+
+
+void test_holdresume()
+{
+ tsdp_message_t *message = tsk_null;
+ char* str;
+
+ if((message = tsdp_message_parse(SDP_MSG_TO_TEST, strlen(SDP_MSG_TO_TEST)))){
+
+ // hold audio
+ tsdp_message_hold(message, "audio");
+ tsdp_message_hold(message, "audio");
+ tsdp_message_hold(message, "video");
+ tsdp_message_resume(message, "video");
+
+ /* serialize the message */
+ if((str = tsdp_message_tostring(message))){
+ TSK_DEBUG_INFO("SDP Message=\n%s", str);
+ TSK_FREE(str);
+ }
+
+ TSK_OBJECT_SAFE_FREE(message);
+ }
+ else{
+ TSK_DEBUG_ERROR("Failed to parse SDP message.");
+ }
+}
+
+void test_M()
+{
+ char* rtpmap, *fmtp;
+ const tsk_list_item_t* item;
+ const tsdp_header_M_t* M;
+
+ tsdp_message_t *message = tsk_null;
+
+ if((message = tsdp_message_parse(SDP_MSG_TO_TEST, strlen(SDP_MSG_TO_TEST)))){
+
+ tsk_list_foreach(item, message->headers){
+ if(!(item->data) || (TSDP_HEADER(item->data)->type != tsdp_htype_M)){
+ continue;
+ }
+ M = (const tsdp_header_M_t*)(item->data);
+
+ /* get rtpmap */
+ if((rtpmap = tsdp_header_M_get_rtpmap(M, "98"))){
+ TSK_DEBUG_INFO("RTPMAP=%s", rtpmap);
+ TSK_FREE(rtpmap);
+ }
+
+ /* get fmtp */
+ if((fmtp = tsdp_header_M_get_fmtp(M, "98"))){
+ TSK_DEBUG_INFO("FMTP=%s", fmtp);
+ TSK_FREE(fmtp);
+ }
+ }
+
+ TSK_OBJECT_SAFE_FREE(message);
+ }
+ else{
+ TSK_DEBUG_ERROR("Failed to parse SDP message.");
+ }
+
+}
+
+#endif /* _TEST_SDPPARSER_H */
diff --git a/tinySDP/test/test_soa.h b/tinySDP/test/test_soa.h
new file mode 100644
index 0000000..0e1a333
--- /dev/null
+++ b/tinySDP/test/test_soa.h
@@ -0,0 +1,110 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+#ifndef _TEST_SOA_H
+#define _TEST_SOA_H
+
+#define SDP \
+ "v=0\r\n" \
+ "o=carol 28908764872 28908764872 IN IP4 100.3.6.6\r\n" \
+ "s=-\r\n" \
+ "t=0 0\r\n" \
+ "c=IN IP4 192.0.2.4\r\n" \
+ "m=video 0 RTP/AVP 31 34\r\n" \
+ "a=rtpmap:31 H261/90000\r\n" \
+ "a=rtpmap:34 H263/90000\r\n"
+
+
+void test_create_sdp()
+{
+ tsdp_ctx_handle_t* ctx = TSDP_CTX_CREATE();
+ const tsdp_message_t* sdp;
+ char* str;
+
+ // Create local SDP from string
+ tsdp_ctx_local_create_sdp_2(ctx, SDP, strlen(SDP));
+ if((sdp = tsdp_ctx_local_get_sdp(ctx))){
+ if((str = tsdp_message_tostring(sdp))){
+ TSK_DEBUG_INFO("Local SDP (2)=\n%s", str);
+ TSK_FREE(str);
+ }
+ }
+
+ // Create local SDP from object
+ tsdp_ctx_local_create_sdp(ctx, sdp);
+ if((sdp = tsdp_ctx_local_get_sdp(ctx))){
+ if((str = tsdp_message_tostring(sdp))){
+ TSK_DEBUG_INFO("Local SDP (1)=\n%s", str);
+ TSK_FREE(str);
+ }
+ }
+
+ // Add media to the local sdp
+ tsdp_ctx_local_add_media_2(ctx, "audio", 0, "RTP/AVP",
+ TSDP_HEADER_I_VA_ARGS("this is the (audio)information line"),
+
+ // PCMU
+ TSDP_FMT_VA_ARGS("0"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "0 PCMU/8000"),
+
+ // 1016
+ TSDP_FMT_VA_ARGS("1"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "1 1016/8000"),
+
+ // GSM
+ TSDP_FMT_VA_ARGS("3"),
+ TSDP_HEADER_A_VA_ARGS("rtpmap", "3 GSM/8000"),
+
+ tsk_null);
+ if((str = tsdp_message_tostring(sdp))){
+ TSK_DEBUG_INFO("Local SDP (audio)=\n%s", str);
+ TSK_FREE(str);
+ }
+
+ // Add headers to the local sdp
+ tsdp_ctx_local_add_headers(ctx,
+ TSDP_HEADER_E_VA_ARGS("j.doe@example.com (Jane Doe)"),
+ TSDP_HEADER_P_VA_ARGS("+44 (123)456789"),
+
+ tsk_null);
+ if((str = tsdp_message_tostring(sdp))){
+ TSK_DEBUG_INFO("Local SDP (headers)=\n%s", str);
+ TSK_FREE(str);
+ }
+
+
+ TSK_OBJECT_SAFE_FREE(ctx);
+}
+
+void test_soa()
+{
+ test_create_sdp();
+}
+
+
+
+
+
+
+
+
+
+#endif /* _TEST_SOA_H */
OpenPOWER on IntegriCloud