summaryrefslogtreecommitdiffstats
path: root/tinyMSRP/test
diff options
context:
space:
mode:
Diffstat (limited to 'tinyMSRP/test')
-rwxr-xr-xtinyMSRP/test/test/stdafx.c6
-rwxr-xr-xtinyMSRP/test/test/stdafx.h6
-rwxr-xr-xtinyMSRP/test/test/targetver.h4
-rwxr-xr-xtinyMSRP/test/test/test.c28
-rwxr-xr-xtinyMSRP/test/test/test_parser.h178
-rwxr-xr-xtinyMSRP/test/test/test_session.h152
-rwxr-xr-xtinyMSRP/test/test/test_uri.h139
7 files changed, 255 insertions, 258 deletions
diff --git a/tinyMSRP/test/test/stdafx.c b/tinyMSRP/test/test/stdafx.c
index cc34b11..de4c0ec 100755
--- a/tinyMSRP/test/test/stdafx.c
+++ b/tinyMSRP/test/test/stdafx.c
@@ -2,19 +2,19 @@
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
diff --git a/tinyMSRP/test/test/stdafx.h b/tinyMSRP/test/test/stdafx.h
index 38723b5..05e1cee 100755
--- a/tinyMSRP/test/test/stdafx.h
+++ b/tinyMSRP/test/test/stdafx.h
@@ -2,19 +2,19 @@
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
diff --git a/tinyMSRP/test/test/targetver.h b/tinyMSRP/test/test/targetver.h
index 2ad5194..456a4fe 100755
--- a/tinyMSRP/test/test/targetver.h
+++ b/tinyMSRP/test/test/targetver.h
@@ -1,8 +1,8 @@
#ifndef TMSRP_TEST_TARGETVER_H
#define TMSRP_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
+// 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.
diff --git a/tinyMSRP/test/test/test.c b/tinyMSRP/test/test/test.c
index 9389936..bfdfab7 100755
--- a/tinyMSRP/test/test/test.c
+++ b/tinyMSRP/test/test/test.c
@@ -2,19 +2,19 @@
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -48,26 +48,26 @@ int main()
#endif
{
#if RUN_TEST_LOOP
- for(;;)
+ for(;;)
#endif
- {
- tnet_startup();
+ {
+ tnet_startup();
+
+ /* Print copyright information */
+ printf("Doubango Project\nCopyright (C) 2009 - 2010 Mamadou Diop \n\n");
- /* Print copyright information */
- printf("Doubango Project\nCopyright (C) 2009 - 2010 Mamadou Diop \n\n");
-
#if RUN_TEST_ALL || RUN_TEST_URI
- test_uri();
+ test_uri();
#endif
#if RUN_TEST_ALL || RUN_TEST_PARSER
- test_parser();
+ test_parser();
#endif
#if RUN_TEST_ALL || RUN_TEST_SESSION
- test_session();
+ test_session();
#endif
- tnet_cleanup();
- }
+ tnet_cleanup();
+ }
} \ No newline at end of file
diff --git a/tinyMSRP/test/test/test_parser.h b/tinyMSRP/test/test/test_parser.h
index 30eacfa..6a46e49 100755
--- a/tinyMSRP/test/test/test_parser.h
+++ b/tinyMSRP/test/test/test_parser.h
@@ -2,19 +2,19 @@
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -59,92 +59,92 @@
void test_parser()
{
- tmsrp_message_t *message;
- const tmsrp_header_Dummy_t* header;
- size_t msg_size;
- char* str;
-
- //
- // Serialization / Deserialization
- //
- /* deserialize the message */
- if((message = tmsrp_message_parse_2(MSRP_MSG_TO_TEST, strlen(MSRP_MSG_TO_TEST), &msg_size))){
-
- tmsrp_message_add_headers(message,
- TMSRP_HEADER_DUMMY_VA_ARGS("NS", "imdn <urn:ietf:params:imdn>"),
- TMSRP_HEADER_DUMMY_VA_ARGS("imdn.Message-ID", "MsgiQqFZqTYAA"),
- TMSRP_HEADER_DUMMY_VA_ARGS("DateTime", "2012-10-25T18:02:08.000Z"),
- TMSRP_HEADER_DUMMY_VA_ARGS("imdn.Disposition-Notification", "positive-delivery, display"),
-
- tsk_null);
-
- if((header = (const tmsrp_header_Dummy_t*)tmsrp_message_get_headerByName(message, "NS"))){
- TSK_DEBUG_INFO("NS=%s\n", header->value);
- }
- if((header = (const tmsrp_header_Dummy_t*)tmsrp_message_get_headerByName(message, "imdn.Message-ID"))){
- TSK_DEBUG_INFO("imdn.Message-ID=%s\n", header->value);
- }
-
- /* serialize the message */
- 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).");
- }
- TSK_OBJECT_SAFE_FREE(message);
-
- //
- // Create Response from Request
- //
- if((message = tmsrp_message_parse(MSRP_MSG_REQUEST, strlen(MSRP_MSG_REQUEST)))){
- tmsrp_response_t* response = tmsrp_create_response(message, 202, "Accepted");
-
- 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{
- TSK_DEBUG_ERROR("Failed to parse MSRP message(2).");
- }
- TSK_OBJECT_SAFE_FREE(message);
-
- //
- // Create Report from Request
- //
- if((message = tmsrp_message_parse(MSRP_MSG_REQUEST, strlen(MSRP_MSG_REQUEST)))){
- tmsrp_request_t* report = tmsrp_create_report(message, 403, "Stop-sending-message");
-
- 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{
- TSK_DEBUG_ERROR("Failed to parse MSRP message(2).");
- }
- TSK_OBJECT_SAFE_FREE(message);
-
- //
- // Create bodiless Request
- //
- {
- tmsrp_request_t* bodiless = tmsrp_create_bodiless(tsk_null, tsk_null);
-
- if((str = tmsrp_message_tostring(bodiless))){
- TSK_DEBUG_INFO("\nMSRP Bodiless=\n%s\n\n", str);
- TSK_FREE(str);
- }
-
- TSK_OBJECT_SAFE_FREE(bodiless);
- }
+ tmsrp_message_t *message;
+ const tmsrp_header_Dummy_t* header;
+ size_t msg_size;
+ char* str;
+
+ //
+ // Serialization / Deserialization
+ //
+ /* deserialize the message */
+ if((message = tmsrp_message_parse_2(MSRP_MSG_TO_TEST, strlen(MSRP_MSG_TO_TEST), &msg_size))) {
+
+ tmsrp_message_add_headers(message,
+ TMSRP_HEADER_DUMMY_VA_ARGS("NS", "imdn <urn:ietf:params:imdn>"),
+ TMSRP_HEADER_DUMMY_VA_ARGS("imdn.Message-ID", "MsgiQqFZqTYAA"),
+ TMSRP_HEADER_DUMMY_VA_ARGS("DateTime", "2012-10-25T18:02:08.000Z"),
+ TMSRP_HEADER_DUMMY_VA_ARGS("imdn.Disposition-Notification", "positive-delivery, display"),
+
+ tsk_null);
+
+ if((header = (const tmsrp_header_Dummy_t*)tmsrp_message_get_headerByName(message, "NS"))) {
+ TSK_DEBUG_INFO("NS=%s\n", header->value);
+ }
+ if((header = (const tmsrp_header_Dummy_t*)tmsrp_message_get_headerByName(message, "imdn.Message-ID"))) {
+ TSK_DEBUG_INFO("imdn.Message-ID=%s\n", header->value);
+ }
+
+ /* serialize the message */
+ 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).");
+ }
+ TSK_OBJECT_SAFE_FREE(message);
+
+ //
+ // Create Response from Request
+ //
+ if((message = tmsrp_message_parse(MSRP_MSG_REQUEST, strlen(MSRP_MSG_REQUEST)))) {
+ tmsrp_response_t* response = tmsrp_create_response(message, 202, "Accepted");
+
+ 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 {
+ TSK_DEBUG_ERROR("Failed to parse MSRP message(2).");
+ }
+ TSK_OBJECT_SAFE_FREE(message);
+
+ //
+ // Create Report from Request
+ //
+ if((message = tmsrp_message_parse(MSRP_MSG_REQUEST, strlen(MSRP_MSG_REQUEST)))) {
+ tmsrp_request_t* report = tmsrp_create_report(message, 403, "Stop-sending-message");
+
+ 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 {
+ TSK_DEBUG_ERROR("Failed to parse MSRP message(2).");
+ }
+ TSK_OBJECT_SAFE_FREE(message);
+
+ //
+ // Create bodiless Request
+ //
+ {
+ tmsrp_request_t* bodiless = tmsrp_create_bodiless(tsk_null, tsk_null);
+
+ if((str = tmsrp_message_tostring(bodiless))) {
+ TSK_DEBUG_INFO("\nMSRP Bodiless=\n%s\n\n", str);
+ TSK_FREE(str);
+ }
+
+ TSK_OBJECT_SAFE_FREE(bodiless);
+ }
}
#endif /* _TEST_MSRPPARSER_H */
diff --git a/tinyMSRP/test/test/test_session.h b/tinyMSRP/test/test/test_session.h
index 6ee1a56..5636865 100755
--- a/tinyMSRP/test/test/test_session.h
+++ b/tinyMSRP/test/test/test_session.h
@@ -2,19 +2,19 @@
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)yahoo.fr>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -47,79 +47,79 @@
void test_session()
{
- tmedia_t* msrp = tsk_null;
- char* str;
- const tsdp_header_M_t *m;
- tsdp_message_t* remote;
-
- // Register dummy media
- tmedia_plugin_register(tmsrp_media_plugin_def_t);
-
- if((msrp = tmedia_factory_create("msrp", TNET_SOCKET_HOST_ANY, tnet_socket_type_tcp_ipv4))){
-
- // Get offer
- if((m = tmedia_get_local_offer(msrp,
- TSDP_HEADER_I_VA_ARGS("This is my latest picture"),
- TSDP_HEADER_A_VA_ARGS("sendonly", tsk_null),
- TSDP_HEADER_A_VA_ARGS("file-selector", "\"My cool picture.jpg\" type:image/jpeg size:32349 hash:sha-1:72:24:5F:E8:65:3D:DA:F3:71:36:2F:86:D4:71:91:3E:E4:A2:CE:2E"),
- TSDP_HEADER_A_VA_ARGS("file-transfer-id", "vBnG916bdberum2fFEABR1FR3ExZMUrd"),
- TSDP_HEADER_A_VA_ARGS("file-disposition", "attachment"),
- TSDP_HEADER_A_VA_ARGS("file-date", "creation:\"Mon, 15 May 2006 15:01:31 +0300\""),
- TSDP_HEADER_A_VA_ARGS("file-icon", "cid:id2@alicepc.example.com"),
- TSDP_HEADER_A_VA_ARGS("file-range", "1-32349"),
-
- TSDP_HEADER_DUMMY_VA_ARGS("x", "007"),
-
- tsk_null
- ))){
- if((str = tsdp_header_tostring(TSDP_HEADER(m)))){
- TSK_DEBUG_INFO("m(offer)=%s", str);
- TSK_FREE(str);
- }
- }
-
- /*if((m = tmedia_get_local_offer(msrp,
- TSDP_HEADER_I_VA_ARGS("Message Transfer"),
- TSDP_HEADER_A_VA_ARGS("accept-types", "text/plain")
-
- tsk_null
- ))){
- if((str = tsdp_header_tostring(TSDP_HEADER(m)))){
- TSK_DEBUG_INFO("m(offer)=%s", str);
- TSK_FREE(str);
- }
- }*/
-
- // Set offer
- if((remote = tsdp_message_parse(REMOTE_SDP, strlen(REMOTE_SDP)))){
- tmedia_set_remote_offer(msrp, remote);
- TSK_OBJECT_SAFE_FREE(remote);
- }
-
- tmedia_get_negotiated_offer(msrp);
-
- tmedia_start(msrp);
- //tmedia_pause(msrp);
-
- /*
- tmedia_perform(msrp, tma_msrp_send_data,
- TSK_PARAM_VA_ARGS("Content", "hello world!"),
-
- tsk_null);
- */
-
- tmedia_perform(msrp, tma_msrp_send_file,
- TSK_PARAM_VA_ARGS("Path", "C:\\Projects\\Doubango\\doubango.ncb"),
-
- tsk_null);
-
-
- getchar();
-
- tmedia_stop(msrp);
-
- TSK_OBJECT_SAFE_FREE(msrp);
- }
+ tmedia_t* msrp = tsk_null;
+ char* str;
+ const tsdp_header_M_t *m;
+ tsdp_message_t* remote;
+
+ // Register dummy media
+ tmedia_plugin_register(tmsrp_media_plugin_def_t);
+
+ if((msrp = tmedia_factory_create("msrp", TNET_SOCKET_HOST_ANY, tnet_socket_type_tcp_ipv4))) {
+
+ // Get offer
+ if((m = tmedia_get_local_offer(msrp,
+ TSDP_HEADER_I_VA_ARGS("This is my latest picture"),
+ TSDP_HEADER_A_VA_ARGS("sendonly", tsk_null),
+ TSDP_HEADER_A_VA_ARGS("file-selector", "\"My cool picture.jpg\" type:image/jpeg size:32349 hash:sha-1:72:24:5F:E8:65:3D:DA:F3:71:36:2F:86:D4:71:91:3E:E4:A2:CE:2E"),
+ TSDP_HEADER_A_VA_ARGS("file-transfer-id", "vBnG916bdberum2fFEABR1FR3ExZMUrd"),
+ TSDP_HEADER_A_VA_ARGS("file-disposition", "attachment"),
+ TSDP_HEADER_A_VA_ARGS("file-date", "creation:\"Mon, 15 May 2006 15:01:31 +0300\""),
+ TSDP_HEADER_A_VA_ARGS("file-icon", "cid:id2@alicepc.example.com"),
+ TSDP_HEADER_A_VA_ARGS("file-range", "1-32349"),
+
+ TSDP_HEADER_DUMMY_VA_ARGS("x", "007"),
+
+ tsk_null
+ ))) {
+ if((str = tsdp_header_tostring(TSDP_HEADER(m)))) {
+ TSK_DEBUG_INFO("m(offer)=%s", str);
+ TSK_FREE(str);
+ }
+ }
+
+ /*if((m = tmedia_get_local_offer(msrp,
+ TSDP_HEADER_I_VA_ARGS("Message Transfer"),
+ TSDP_HEADER_A_VA_ARGS("accept-types", "text/plain")
+
+ tsk_null
+ ))){
+ if((str = tsdp_header_tostring(TSDP_HEADER(m)))){
+ TSK_DEBUG_INFO("m(offer)=%s", str);
+ TSK_FREE(str);
+ }
+ }*/
+
+ // Set offer
+ if((remote = tsdp_message_parse(REMOTE_SDP, strlen(REMOTE_SDP)))) {
+ tmedia_set_remote_offer(msrp, remote);
+ TSK_OBJECT_SAFE_FREE(remote);
+ }
+
+ tmedia_get_negotiated_offer(msrp);
+
+ tmedia_start(msrp);
+ //tmedia_pause(msrp);
+
+ /*
+ tmedia_perform(msrp, tma_msrp_send_data,
+ TSK_PARAM_VA_ARGS("Content", "hello world!"),
+
+ tsk_null);
+ */
+
+ tmedia_perform(msrp, tma_msrp_send_file,
+ TSK_PARAM_VA_ARGS("Path", "C:\\Projects\\Doubango\\doubango.ncb"),
+
+ tsk_null);
+
+
+ getchar();
+
+ tmedia_stop(msrp);
+
+ TSK_OBJECT_SAFE_FREE(msrp);
+ }
}
#endif /* _TEST_MSRPSESSION_H */
diff --git a/tinyMSRP/test/test/test_uri.h b/tinyMSRP/test/test/test_uri.h
index 1b4c1b3..f0d9544 100755
--- a/tinyMSRP/test/test/test_uri.h
+++ b/tinyMSRP/test/test/test_uri.h
@@ -24,90 +24,87 @@
#include "tinymsrp/parsers/tmsrp_parser_uri.h"
-const char* uris[] =
-{
- "msrp://atlanta.example.com:7654/jshA7weztas;tcp;p1=1;p2=2",
- "msrps://atlanta.example.com:7654/jshA7weztas;tcp",
-
- // hostname, IPv4 and IPv6 (without userinfo and with port)
- "msrp://biloxi.msrp.com:12763/kjhd37s2s20w2a;sctp",
- "msrps://192.168.0.10:7654/jshA7weztas;tcp;p3=4",
- "msrps://[::127]:7654/jshA7weztas;tcp;p=0",
-
- // hostname, IPv4 and IPv6 (without userinfo and without port)
- "msrp://biloxi.msrp.com/kjhd37s2s20w2a;sctp",
- "msrps://192.168.0.10/jshA7weztas;tcp;p3=4",
- "msrps://[::127]/jshA7weztas;tcp;p=0",
-
- // hostname, IPv4 and IPv6 (with userinfo and with port)
- "msrp://bob@biloxi.msrp.com:12763/kjhd37s2s20w2a;sctp",
- "msrps://alice@192.168.0.10:7654/jshA7weztas;tcp;p3=4",
- "msrps://carol@[::127]:7654/jshA7weztas;tcp;p=0",
-
- // hostname, IPv4 and IPv6 (with userinfo and without port)
- "msrp://bob@biloxi.msrp.com/kjhd37s2s20w2a;sctp",
- "msrps://alice@192.168.0.10/jshA7weztas;tcp;p3=4",
- "msrps://carol@[::127]/jshA7weztas;tcp;p=0",
-
- // without session_id
- "msrps://[::127]:7654;tcp;p=0",
+const char* uris[] = {
+ "msrp://atlanta.example.com:7654/jshA7weztas;tcp;p1=1;p2=2",
+ "msrps://atlanta.example.com:7654/jshA7weztas;tcp",
+
+ // hostname, IPv4 and IPv6 (without userinfo and with port)
+ "msrp://biloxi.msrp.com:12763/kjhd37s2s20w2a;sctp",
+ "msrps://192.168.0.10:7654/jshA7weztas;tcp;p3=4",
+ "msrps://[::127]:7654/jshA7weztas;tcp;p=0",
+
+ // hostname, IPv4 and IPv6 (without userinfo and without port)
+ "msrp://biloxi.msrp.com/kjhd37s2s20w2a;sctp",
+ "msrps://192.168.0.10/jshA7weztas;tcp;p3=4",
+ "msrps://[::127]/jshA7weztas;tcp;p=0",
+
+ // hostname, IPv4 and IPv6 (with userinfo and with port)
+ "msrp://bob@biloxi.msrp.com:12763/kjhd37s2s20w2a;sctp",
+ "msrps://alice@192.168.0.10:7654/jshA7weztas;tcp;p3=4",
+ "msrps://carol@[::127]:7654/jshA7weztas;tcp;p=0",
+
+ // hostname, IPv4 and IPv6 (with userinfo and without port)
+ "msrp://bob@biloxi.msrp.com/kjhd37s2s20w2a;sctp",
+ "msrps://alice@192.168.0.10/jshA7weztas;tcp;p3=4",
+ "msrps://carol@[::127]/jshA7weztas;tcp;p=0",
+
+ // without session_id
+ "msrps://[::127]:7654;tcp;p=0",
};
void test_uri_tostring(const tmsrp_uri_t *uri)
{
- char* ret = tmsrp_uri_tostring(uri);
- TSK_DEBUG_INFO("uri_to_string=%s", ret);
- TSK_FREE(ret);
+ char* ret = tmsrp_uri_tostring(uri);
+ TSK_DEBUG_INFO("uri_to_string=%s", ret);
+ TSK_FREE(ret);
}
void test_uri_parser()
{
- int i;
- tsk_list_item_t *item = 0;
-
- for(i=0; i<sizeof(uris)/sizeof(const char*); i++)
- {
- tmsrp_uri_t *uri = tmsrp_uri_parse(uris[i], strlen(uris[i]));
-
- printf("\n== Parsing {{ %s }} ==\n\n", uris[i]);
-
- if(uri)
- {
- printf("scheme: %s\n", uri->scheme);
- printf("userinfo: %s\n", uri->authority.userinfo);
- printf("host: %s\n", uri->authority.host);
- printf("port: %d\n", uri->authority.port);
- printf("host-type: %s\n", uri->authority.host_type == tmsrp_host_ipv4 ? "IPv4" : (uri->authority.host_type == tmsrp_host_ipv6 ? "IPv6" : (uri->authority.host_type == tmsrp_host_hostname ? "HOSTNAME" : "UNKNOWN")) );
- printf("session-id: %s\n", uri->session_id);
- printf("transport: %s\n", uri->transport);
-
- printf("---PARAMS---\n");
-
- /* dump all parameters */
- tsk_list_foreach(item, uri->params){
- tsk_param_t* param = item->data;
- printf("-->%s=%s\n", param->name, param->value);
- }
-
- printf("Is-secure: %s\n", TMSRP_URI_IS_SECURE(uri) ? "YES" : "NO");
-
- test_uri_tostring(uri);
- }
- else{
- printf("INVALID MSRP URI.\n");
- }
-
- printf("\n\n");
- getchar();
-
- TSK_OBJECT_SAFE_FREE(uri);
- }
+ int i;
+ tsk_list_item_t *item = 0;
+
+ for(i=0; i<sizeof(uris)/sizeof(const char*); i++) {
+ tmsrp_uri_t *uri = tmsrp_uri_parse(uris[i], strlen(uris[i]));
+
+ printf("\n== Parsing {{ %s }} ==\n\n", uris[i]);
+
+ if(uri) {
+ printf("scheme: %s\n", uri->scheme);
+ printf("userinfo: %s\n", uri->authority.userinfo);
+ printf("host: %s\n", uri->authority.host);
+ printf("port: %d\n", uri->authority.port);
+ printf("host-type: %s\n", uri->authority.host_type == tmsrp_host_ipv4 ? "IPv4" : (uri->authority.host_type == tmsrp_host_ipv6 ? "IPv6" : (uri->authority.host_type == tmsrp_host_hostname ? "HOSTNAME" : "UNKNOWN")) );
+ printf("session-id: %s\n", uri->session_id);
+ printf("transport: %s\n", uri->transport);
+
+ printf("---PARAMS---\n");
+
+ /* dump all parameters */
+ tsk_list_foreach(item, uri->params) {
+ tsk_param_t* param = item->data;
+ printf("-->%s=%s\n", param->name, param->value);
+ }
+
+ printf("Is-secure: %s\n", TMSRP_URI_IS_SECURE(uri) ? "YES" : "NO");
+
+ test_uri_tostring(uri);
+ }
+ else {
+ printf("INVALID MSRP URI.\n");
+ }
+
+ printf("\n\n");
+ getchar();
+
+ TSK_OBJECT_SAFE_FREE(uri);
+ }
}
void test_uri()
{
- test_uri_parser();
+ test_uri_parser();
}
#endif /* _TEST_MSRPURI_H */
OpenPOWER on IntegriCloud