diff options
Diffstat (limited to 'pjlib')
-rw-r--r-- | pjlib/build/Makefile | 8 | ||||
-rw-r--r-- | pjlib/build/pjlib.dsp | 36 | ||||
-rw-r--r-- | pjlib/build/pjlib.vcproj | 197 | ||||
-rw-r--r-- | pjlib/build/pjlib_test.dsp | 4 | ||||
-rw-r--r-- | pjlib/build/pjlib_test.vcproj | 47 | ||||
-rw-r--r-- | pjlib/include/pjlib.h | 6 | ||||
-rw-r--r-- | pjlib/src/pj/symbols.c | 62 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/file.c | 7 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_perf.c | 2 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_tcp.c | 142 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/ioq_udp.c | 72 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/test.c | 4 | ||||
-rw-r--r-- | pjlib/src/pjlib-test/test.h | 3 |
13 files changed, 197 insertions, 393 deletions
diff --git a/pjlib/build/Makefile b/pjlib/build/Makefile index 4a0db783..595cce88 100644 --- a/pjlib/build/Makefile +++ b/pjlib/build/Makefile @@ -75,9 +75,9 @@ export PJLIB_SRCDIR = ../src/pj export PJLIB_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \ array.o config.o errno.o except.o fifobuf.o guid.o \ hash.o list.o lock.o log.o \ - md5.o pool.o pool_caching.o rand.o \ - rbtree.o scanner.o string.o stun.o stun_client.o timer.o \ - types.o xml.o symbols.o + pool.o pool_caching.o rand.o \ + rbtree.o string.o timer.o \ + types.o symbols.o export PJLIB_CFLAGS += $(_CFLAGS) ############################################################################### @@ -91,7 +91,7 @@ export TEST_OBJS += atomic.o echo_clt.o errno.o exception.o \ select.o sleep.o sock.o sock_perf.o \ string.o test.o thread.o timer.o timestamp.o \ udp_echo_srv_sync.o udp_echo_srv_ioqueue.o \ - util.o xml.o + util.o export TEST_CFLAGS += $(_CFLAGS) export TEST_LDFLAGS += $(_LDFLAGS) export TEST_EXE := ../bin/pjlib-test-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(HOST_EXE) diff --git a/pjlib/build/pjlib.dsp b/pjlib/build/pjlib.dsp index 69881e22..8b95515a 100644 --- a/pjlib/build/pjlib.dsp +++ b/pjlib/build/pjlib.dsp @@ -253,10 +253,6 @@ SOURCE=..\src\pj\log_writer_stdout.c # End Source File
# Begin Source File
-SOURCE=..\src\pj\md5.c
-# End Source File
-# Begin Source File
-
SOURCE=..\src\pj\os_core_win32.c
# End Source File
# Begin Source File
@@ -301,10 +297,6 @@ SOURCE=..\src\pj\rbtree.c # End Source File
# Begin Source File
-SOURCE=..\src\pj\scanner.c
-# End Source File
-# Begin Source File
-
SOURCE=..\src\pj\sock_bsd.c
# End Source File
# Begin Source File
@@ -317,24 +309,12 @@ SOURCE=..\src\pj\string.c # End Source File
# Begin Source File
-SOURCE=..\src\pj\stun.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pj\stun_client.c
-# End Source File
-# Begin Source File
-
SOURCE=..\src\pj\timer.c
# End Source File
# Begin Source File
SOURCE=..\src\pj\types.c
# End Source File
-# Begin Source File
-
-SOURCE=..\src\pj\xml.c
-# End Source File
# End Group
# Begin Group "Header Files"
@@ -521,10 +501,6 @@ SOURCE=..\include\pj\log.h # End Source File
# Begin Source File
-SOURCE=..\include\pj\md5.h
-# End Source File
-# Begin Source File
-
SOURCE=..\include\pj\os.h
# End Source File
# Begin Source File
@@ -545,10 +521,6 @@ SOURCE=..\include\pj\rbtree.h # End Source File
# Begin Source File
-SOURCE=..\include\pj\scanner.h
-# End Source File
-# Begin Source File
-
SOURCE=..\include\pj\sock.h
# End Source File
# Begin Source File
@@ -561,20 +533,12 @@ SOURCE=..\include\pj\string.h # End Source File
# Begin Source File
-SOURCE=..\include\pj\stun.h
-# End Source File
-# Begin Source File
-
SOURCE=..\include\pj\timer.h
# End Source File
# Begin Source File
SOURCE=..\include\pj\types.h
# End Source File
-# Begin Source File
-
-SOURCE=..\include\pj\xml.h
-# End Source File
# End Group
# Begin Group "Inline Files"
diff --git a/pjlib/build/pjlib.vcproj b/pjlib/build/pjlib.vcproj index 9e06efef..3acfbf5f 100644 --- a/pjlib/build/pjlib.vcproj +++ b/pjlib/build/pjlib.vcproj @@ -278,6 +278,12 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\src\pj\file_access_win32.c">
+ </File>
+ <File
+ RelativePath="..\src\pj\file_io_win32.c">
+ </File>
+ <File
RelativePath="..\src\pj\guid.c">
<FileConfiguration
Name="Debug|Win32">
@@ -344,6 +350,24 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\src\pj\ioqueue_common_abs.c">
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\pj\ioqueue_common_abs.h">
+ </File>
+ <File
RelativePath="..\src\pj\ioqueue_select.c">
<FileConfiguration
Name="Debug|Win32">
@@ -478,28 +502,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\src\pj\md5.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
RelativePath="..\src\pj\os_core_win32.c">
<FileConfiguration
Name="Debug|Win32">
@@ -742,28 +744,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\src\pj\scanner.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
RelativePath="..\src\pj\sock_bsd.c">
<FileConfiguration
Name="Debug|Win32">
@@ -830,50 +810,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\src\pj\stun.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\src\pj\stun_client.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
RelativePath="..\src\pj\timer.c">
<FileConfiguration
Name="Debug|Win32">
@@ -917,28 +853,6 @@ BrowseInformation="1"/>
</FileConfiguration>
</File>
- <File
- RelativePath="..\src\pj\xml.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
<Filter
Name="Other Targets"
Filter="">
@@ -967,6 +881,36 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\src\pj\file_access_unistd.c">
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\src\pj\file_io_ansi.c">
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\pj\guid_simple.c">
<FileConfiguration
Name="Debug|Win32"
@@ -1039,6 +983,21 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\src\pj\ioqueue_linux_kernel.c">
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\src\pj\log_writer_printk.c">
<FileConfiguration
Name="Debug|Win32"
@@ -1341,6 +1300,12 @@ RelativePath="..\include\pj\fifobuf.h">
</File>
<File
+ RelativePath="..\include\pj\file_access.h">
+ </File>
+ <File
+ RelativePath="..\include\pj\file_io.h">
+ </File>
+ <File
RelativePath="..\include\pj\guid.h">
</File>
<File
@@ -1359,9 +1324,6 @@ RelativePath="..\include\pj\log.h">
</File>
<File
- RelativePath="..\include\pj\md5.h">
- </File>
- <File
RelativePath="..\include\pj\os.h">
</File>
<File
@@ -1377,9 +1339,6 @@ RelativePath="..\include\pj\rbtree.h">
</File>
<File
- RelativePath="..\include\pj\scanner.h">
- </File>
- <File
RelativePath="..\include\pj\sock.h">
</File>
<File
@@ -1389,17 +1348,11 @@ RelativePath="..\include\pj\string.h">
</File>
<File
- RelativePath="..\include\pj\stun.h">
- </File>
- <File
RelativePath="..\include\pj\timer.h">
</File>
<File
RelativePath="..\include\pj\types.h">
</File>
- <File
- RelativePath="..\include\pj\xml.h">
- </File>
<Filter
Name="compat"
Filter="">
diff --git a/pjlib/build/pjlib_test.dsp b/pjlib/build/pjlib_test.dsp index c2dc04ab..ca88fb43 100644 --- a/pjlib/build/pjlib_test.dsp +++ b/pjlib/build/pjlib_test.dsp @@ -206,10 +206,6 @@ SOURCE="..\src\pjlib-test\udp_echo_srv_sync.c" SOURCE="..\src\pjlib-test\util.c"
# End Source File
-# Begin Source File
-
-SOURCE="..\src\pjlib-test\xml.c"
-# End Source File
# End Group
# Begin Group "Header Files"
diff --git a/pjlib/build/pjlib_test.vcproj b/pjlib/build/pjlib_test.vcproj index 1cafa218..8fc0d8e8 100644 --- a/pjlib/build/pjlib_test.vcproj +++ b/pjlib/build/pjlib_test.vcproj @@ -190,28 +190,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\src\pjlib-test\echo_srv.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
RelativePath="..\src\pjlib-test\errno.c">
<FileConfiguration
Name="Debug|Win32">
@@ -278,6 +256,9 @@ </FileConfiguration>
</File>
<File
+ RelativePath="..\src\pjlib-test\file.c">
+ </File>
+ <File
RelativePath="..\src\pjlib-test\ioq_perf.c">
<FileConfiguration
Name="Debug|Win32">
@@ -785,28 +766,6 @@ BrowseInformation="1"/>
</FileConfiguration>
</File>
- <File
- RelativePath="..\src\pjlib-test\xml.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"
- BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BrowseInformation="1"/>
- </FileConfiguration>
- </File>
</Filter>
<Filter
Name="Header Files"
diff --git a/pjlib/include/pjlib.h b/pjlib/include/pjlib.h index 76d61d90..7e4bf362 100644 --- a/pjlib/include/pjlib.h +++ b/pjlib/include/pjlib.h @@ -15,7 +15,7 @@ #include <pj/ctype.h> #include <pj/errno.h> #include <pj/except.h> -#include <pj/fifobuf.h>
+#include <pj/fifobuf.h> #include <pj/file_access.h> #include <pj/file_io.h> #include <pj/guid.h> @@ -24,18 +24,14 @@ #include <pj/list.h> #include <pj/lock.h> #include <pj/log.h> -#include <pj/md5.h> #include <pj/os.h> #include <pj/pool.h> #include <pj/rand.h> #include <pj/rbtree.h> -#include <pj/scanner.h> #include <pj/sock.h> #include <pj/sock_select.h> #include <pj/string.h> -#include <pj/stun.h> #include <pj/timer.h> -#include <pj/xml.h> #include <pj/compat/high_precision.h> diff --git a/pjlib/src/pj/symbols.c b/pjlib/src/pj/symbols.c index 781b8a56..fc434adb 100644 --- a/pjlib/src/pj/symbols.c +++ b/pjlib/src/pj/symbols.c @@ -1,5 +1,4 @@ /* $Id$ - * */ #include <pjlib.h> @@ -134,14 +133,6 @@ PJ_EXPORT_SYMBOL(pj_log_6) #endif /* - * md5.h - */ -PJ_EXPORT_SYMBOL(md5_init) -PJ_EXPORT_SYMBOL(md5_append) -PJ_EXPORT_SYMBOL(md5_finish) - - -/* * os.h */ PJ_EXPORT_SYMBOL(pj_init) @@ -237,38 +228,6 @@ PJ_EXPORT_SYMBOL(pj_rbtree_max_height) PJ_EXPORT_SYMBOL(pj_rbtree_min_height) /* - * scanner.h - */ -PJ_EXPORT_SYMBOL(pj_cs_init) -PJ_EXPORT_SYMBOL(pj_cs_set) -PJ_EXPORT_SYMBOL(pj_cs_add_range) -PJ_EXPORT_SYMBOL(pj_cs_add_alpha) -PJ_EXPORT_SYMBOL(pj_cs_add_num) -PJ_EXPORT_SYMBOL(pj_cs_add_str) -PJ_EXPORT_SYMBOL(pj_cs_del_range) -PJ_EXPORT_SYMBOL(pj_cs_del_str) -PJ_EXPORT_SYMBOL(pj_cs_invert) -PJ_EXPORT_SYMBOL(pj_scan_init) -PJ_EXPORT_SYMBOL(pj_scan_fini) -PJ_EXPORT_SYMBOL(pj_scan_peek) -PJ_EXPORT_SYMBOL(pj_scan_peek_n) -PJ_EXPORT_SYMBOL(pj_scan_peek_until) -PJ_EXPORT_SYMBOL(pj_scan_get) -PJ_EXPORT_SYMBOL(pj_scan_get_quote) -PJ_EXPORT_SYMBOL(pj_scan_get_n) -PJ_EXPORT_SYMBOL(pj_scan_get_char) -PJ_EXPORT_SYMBOL(pj_scan_get_newline) -PJ_EXPORT_SYMBOL(pj_scan_get_until) -PJ_EXPORT_SYMBOL(pj_scan_get_until_ch) -PJ_EXPORT_SYMBOL(pj_scan_get_until_chr) -PJ_EXPORT_SYMBOL(pj_scan_advance_n) -PJ_EXPORT_SYMBOL(pj_scan_strcmp) -PJ_EXPORT_SYMBOL(pj_scan_stricmp) -PJ_EXPORT_SYMBOL(pj_scan_skip_whitespace) -PJ_EXPORT_SYMBOL(pj_scan_save_state) -PJ_EXPORT_SYMBOL(pj_scan_restore_state) - -/* * sock.h */ PJ_EXPORT_SYMBOL(PJ_AF_UNIX) @@ -353,15 +312,6 @@ PJ_EXPORT_SYMBOL(pj_utoa) PJ_EXPORT_SYMBOL(pj_utoa_pad) /* - * stun.h - */ -PJ_EXPORT_SYMBOL(pj_stun_create_bind_req) -PJ_EXPORT_SYMBOL(pj_stun_parse_msg) -PJ_EXPORT_SYMBOL(pj_stun_msg_find_attr) -PJ_EXPORT_SYMBOL(pj_stun_get_mapped_addr) -PJ_EXPORT_SYMBOL(pj_stun_get_err_msg) - -/* * timer.h */ PJ_EXPORT_SYMBOL(pj_timer_heap_mem_size) @@ -378,15 +328,3 @@ PJ_EXPORT_SYMBOL(pj_timer_heap_poll) */ PJ_EXPORT_SYMBOL(pj_time_val_normalize) -/* - * xml.h - */ -PJ_EXPORT_SYMBOL(pj_xml_parse) -PJ_EXPORT_SYMBOL(pj_xml_print) -PJ_EXPORT_SYMBOL(pj_xml_add_node) -PJ_EXPORT_SYMBOL(pj_xml_add_attr) -PJ_EXPORT_SYMBOL(pj_xml_find_node) -PJ_EXPORT_SYMBOL(pj_xml_find_next_node) -PJ_EXPORT_SYMBOL(pj_xml_find_attr) -PJ_EXPORT_SYMBOL(pj_xml_find) - diff --git a/pjlib/src/pjlib-test/file.c b/pjlib/src/pjlib-test/file.c index aa863506..b3ab6e32 100644 --- a/pjlib/src/pjlib-test/file.c +++ b/pjlib/src/pjlib-test/file.c @@ -8,7 +8,8 @@ #define NEWNAME "testfil2.txt"
#define INCLUDE_FILE_TIME_TEST 0
-static char buffer[11] = "Hello world";
+static char buffer[11] = {'H', 'e', 'l', 'l', 'o', ' ',
+ 'W', 'o', 'r', 'l', 'd' };
int file_test(void)
{
@@ -112,7 +113,9 @@ int file_test(void) read = 1;
status = pj_file_read(fd, &readbuf[size], &read);
if (status != PJ_SUCCESS) {
- app_perror("...file_read() error", status);
+ PJ_LOG(3,("", "...error reading file after %d bytes (error follows)",
+ size));
+ app_perror("...error", status);
return -110;
}
if (read == 0) {
diff --git a/pjlib/src/pjlib-test/ioq_perf.c b/pjlib/src/pjlib-test/ioq_perf.c index a4ee005c..cfeaab76 100644 --- a/pjlib/src/pjlib-test/ioq_perf.c +++ b/pjlib/src/pjlib-test/ioq_perf.c @@ -440,7 +440,7 @@ int ioqueue_perf_test(void) pj_size_t best_bandwidth; int best_index = 0; - PJ_LOG(3,(THIS_FILE, " Benchmarking ioqueue:")); + PJ_LOG(3,(THIS_FILE, " Benchmarking %s ioqueue:", pj_ioqueue_name())); PJ_LOG(3,(THIS_FILE, " ===============================================")); PJ_LOG(3,(THIS_FILE, " Type Threads Skt.Pairs Avg.Time Bandwidth")); PJ_LOG(3,(THIS_FILE, " ===============================================")); diff --git a/pjlib/src/pjlib-test/ioq_tcp.c b/pjlib/src/pjlib-test/ioq_tcp.c index 14813c79..22827942 100644 --- a/pjlib/src/pjlib-test/ioq_tcp.c +++ b/pjlib/src/pjlib-test/ioq_tcp.c @@ -38,37 +38,37 @@ static pj_ssize_t callback_read_size, static pj_ioqueue_key_t *callback_read_key, *callback_write_key, *callback_accept_key, - *callback_connect_key;
-static pj_ioqueue_op_key_t *callback_read_op,
- *callback_write_op,
+ *callback_connect_key; +static pj_ioqueue_op_key_t *callback_read_op, + *callback_write_op, *callback_accept_op; -static void on_ioqueue_read(pj_ioqueue_key_t *key,
- pj_ioqueue_op_key_t *op_key,
+static void on_ioqueue_read(pj_ioqueue_key_t *key, + pj_ioqueue_op_key_t *op_key, pj_ssize_t bytes_read) { - callback_read_key = key;
+ callback_read_key = key; callback_read_op = op_key; callback_read_size = bytes_read; } -static void on_ioqueue_write(pj_ioqueue_key_t *key,
- pj_ioqueue_op_key_t *op_key,
+static void on_ioqueue_write(pj_ioqueue_key_t *key, + pj_ioqueue_op_key_t *op_key, pj_ssize_t bytes_written) { - callback_write_key = key;
+ callback_write_key = key; callback_write_op = op_key; callback_write_size = bytes_written; } -static void on_ioqueue_accept(pj_ioqueue_key_t *key,
- pj_ioqueue_op_key_t *op_key,
+static void on_ioqueue_accept(pj_ioqueue_key_t *key, + pj_ioqueue_op_key_t *op_key, pj_sock_t sock, int status) { PJ_UNUSED_ARG(sock); - callback_accept_key = key;
+ callback_accept_key = key; callback_accept_op = op_key; callback_accept_status = status; } @@ -96,31 +96,31 @@ static int send_recv_test(pj_ioqueue_t *ioque, pj_timestamp *t_elapsed) { pj_status_t status; - pj_ssize_t bytes;
+ pj_ssize_t bytes; pj_time_val timeout; pj_timestamp t1, t2; - int pending_op = 0;
+ int pending_op = 0; pj_ioqueue_op_key_t read_op, write_op; - // Start reading on the server side.
+ // Start reading on the server side. bytes = bufsize; status = pj_ioqueue_recv(skey, &read_op, recv_buf, &bytes, 0); - if (status != PJ_SUCCESS && status != PJ_EPENDING) {
+ if (status != PJ_SUCCESS && status != PJ_EPENDING) { app_perror("...pj_ioqueue_recv error", status); return -100; } -
+ if (status == PJ_EPENDING) - ++pending_op;
- else {
- /* Does not expect to return error or immediate data. */
- return -115;
+ ++pending_op; + else { + /* Does not expect to return error or immediate data. */ + return -115; } // Randomize send buffer. pj_create_random_string((char*)send_buf, bufsize); - // Starts send on the client side.
+ // Starts send on the client side. bytes = bufsize; status = pj_ioqueue_send(ckey, &write_op, send_buf, &bytes, 0); if (status != PJ_SUCCESS && bytes != PJ_EPENDING) { @@ -135,12 +135,12 @@ static int send_recv_test(pj_ioqueue_t *ioque, // Reset indicators callback_read_size = callback_write_size = 0; - callback_read_key = callback_write_key = NULL;
+ callback_read_key = callback_write_key = NULL; callback_read_op = callback_write_op = NULL; // Poll the queue until we've got completion event in the server side. status = 0; - while (pending_op > 0) {
+ while (pending_op > 0) { timeout.sec = 1; timeout.msec = 0; status = pj_ioqueue_poll(ioque, &timeout); if (status > 0) { @@ -148,32 +148,32 @@ static int send_recv_test(pj_ioqueue_t *ioque, if (callback_read_size != bufsize) return -160; if (callback_read_key != skey) - return -161;
- if (callback_read_op != &read_op)
+ return -161; + if (callback_read_op != &read_op) return -162; } if (callback_write_size) { if (callback_write_key != ckey) - return -163;
- if (callback_write_op != &write_op)
+ return -163; + if (callback_write_op != &write_op) return -164; } pending_op -= status; - }
- if (status == 0) {
- PJ_LOG(3,("", "...error: timed out"));
+ } + if (status == 0) { + PJ_LOG(3,("", "...error: timed out")); } if (status < 0) { return -170; } } -
- // Pending op is zero.
- // Subsequent poll should yield zero too.
- timeout.sec = timeout.msec = 0;
- status = pj_ioqueue_poll(ioque, &timeout);
- if (status != 0)
- return -173;
+ + // Pending op is zero. + // Subsequent poll should yield zero too. + timeout.sec = timeout.msec = 0; + status = pj_ioqueue_poll(ioque, &timeout); + if (status != 0) + return -173; // End time. pj_get_timestamp(&t2); @@ -200,7 +200,7 @@ static int compliance_test_0(void) pj_pool_t *pool = NULL; char *send_buf, *recv_buf; pj_ioqueue_t *ioque = NULL; - pj_ioqueue_key_t *skey, *ckey0, *ckey1;
+ pj_ioqueue_key_t *skey, *ckey0, *ckey1; pj_ioqueue_op_key_t accept_op; int bufsize = BUF_MIN_SIZE; pj_ssize_t status = -1; @@ -265,7 +265,7 @@ static int compliance_test_0(void) // Server socket accept() client_addr_len = sizeof(pj_sockaddr_in); - status = pj_ioqueue_accept(skey, &accept_op, &csock0,
+ status = pj_ioqueue_accept(skey, &accept_op, &csock0, &client_addr, &rmt_addr, &client_addr_len); if (status != PJ_EPENDING) { app_perror("...ERROR in pj_ioqueue_accept()", rc); @@ -297,7 +297,7 @@ static int compliance_test_0(void) callback_read_key = callback_write_key = callback_accept_key = callback_connect_key = NULL; - callback_accept_op = callback_read_op = callback_write_op = NULL;
+ callback_accept_op = callback_read_op = callback_write_op = NULL; while (pending_op) { pj_time_val timeout = {1, 0}; @@ -310,10 +310,10 @@ static int compliance_test_0(void) } if (callback_accept_key != skey) { status=-42; goto on_error; - }
- if (callback_accept_op != &accept_op) {
- status=-43; goto on_error;
- }
+ } + if (callback_accept_op != &accept_op) { + status=-43; goto on_error; + } callback_accept_status = -2; } @@ -323,7 +323,7 @@ static int compliance_test_0(void) } if (callback_connect_key != ckey1) { status=-51; goto on_error; - }
+ } callback_connect_status = -2; } @@ -334,16 +334,16 @@ static int compliance_test_0(void) } } } -
- // There's no pending operation.
- // When we poll the ioqueue, there must not be events.
- if (pending_op == 0) {
- pj_time_val timeout = {1, 0};
- status = pj_ioqueue_poll(ioque, &timeout);
- if (status != 0) {
- status=-60; goto on_error;
- }
- }
+ + // There's no pending operation. + // When we poll the ioqueue, there must not be events. + if (pending_op == 0) { + pj_time_val timeout = {1, 0}; + status = pj_ioqueue_poll(ioque, &timeout); + if (status != 0) { + status=-60; goto on_error; + } + } // Check accepted socket. if (csock0 == PJ_INVALID_SOCKET) { @@ -363,7 +363,7 @@ static int compliance_test_0(void) // Test send and receive. t_elapsed.u32.lo = 0; - status = send_recv_test(ioque, ckey0, ckey1, send_buf,
+ status = send_recv_test(ioque, ckey0, ckey1, send_buf, recv_buf, bufsize, &t_elapsed); if (status != 0) { goto on_error; @@ -468,17 +468,17 @@ static int compliance_test_1(void) } } } -
- // There's no pending operation.
- // When we poll the ioqueue, there must not be events.
- if (pending_op == 0) {
- pj_time_val timeout = {1, 0};
- status = pj_ioqueue_poll(ioque, &timeout);
- if (status != 0) {
- status=-60; goto on_error;
- }
- }
-
+ + // There's no pending operation. + // When we poll the ioqueue, there must not be events. + if (pending_op == 0) { + pj_time_val timeout = {1, 0}; + status = pj_ioqueue_poll(ioque, &timeout); + if (status != 0) { + status=-60; goto on_error; + } + } + // Success status = 0; @@ -495,12 +495,14 @@ int tcp_ioqueue_test() { int status; - PJ_LOG(3, (THIS_FILE, "..compliance test 0 (success scenario)")); + PJ_LOG(3, (THIS_FILE, "..%s compliance test 0 (success scenario)", + pj_ioqueue_name())); if ((status=compliance_test_0()) != 0) { PJ_LOG(1, (THIS_FILE, "....FAILED (status=%d)\n", status)); return status; } - PJ_LOG(3, (THIS_FILE, "..compliance test 1 (failed scenario)")); + PJ_LOG(3, (THIS_FILE, "..%s compliance test 1 (failed scenario)", + pj_ioqueue_name())); if ((status=compliance_test_1()) != 0) { PJ_LOG(1, (THIS_FILE, "....FAILED (status=%d)\n", status)); return status; diff --git a/pjlib/src/pjlib-test/ioq_udp.c b/pjlib/src/pjlib-test/ioq_udp.c index 6ee90e42..c6a5c5f0 100644 --- a/pjlib/src/pjlib-test/ioq_udp.c +++ b/pjlib/src/pjlib-test/ioq_udp.c @@ -42,34 +42,34 @@ static pj_ioqueue_key_t *callback_read_key, *callback_write_key, *callback_accept_key, *callback_connect_key; -static pj_ioqueue_op_key_t *callback_read_op,
- *callback_write_op,
- *callback_accept_op;
+static pj_ioqueue_op_key_t *callback_read_op, + *callback_write_op, + *callback_accept_op; -static void on_ioqueue_read(pj_ioqueue_key_t *key,
- pj_ioqueue_op_key_t *op_key,
+static void on_ioqueue_read(pj_ioqueue_key_t *key, + pj_ioqueue_op_key_t *op_key, pj_ssize_t bytes_read) { - callback_read_key = key;
+ callback_read_key = key; callback_read_op = op_key; callback_read_size = bytes_read; } -static void on_ioqueue_write(pj_ioqueue_key_t *key,
- pj_ioqueue_op_key_t *op_key,
+static void on_ioqueue_write(pj_ioqueue_key_t *key, + pj_ioqueue_op_key_t *op_key, pj_ssize_t bytes_written) { - callback_write_key = key;
+ callback_write_key = key; callback_write_op = op_key; callback_write_size = bytes_written; } -static void on_ioqueue_accept(pj_ioqueue_key_t *key,
- pj_ioqueue_op_key_t *op_key,
+static void on_ioqueue_accept(pj_ioqueue_key_t *key, + pj_ioqueue_op_key_t *op_key, pj_sock_t sock, int status) { PJ_UNUSED_ARG(sock); - callback_accept_key = key;
+ callback_accept_key = key; callback_accept_op = op_key; callback_accept_status = status; } @@ -107,7 +107,7 @@ static int compliance_test(void) pj_pool_t *pool = NULL; char *send_buf, *recv_buf; pj_ioqueue_t *ioque = NULL; - pj_ioqueue_key_t *skey, *ckey;
+ pj_ioqueue_key_t *skey, *ckey; pj_ioqueue_op_key_t read_op, write_op; int bufsize = BUF_MIN_SIZE; pj_ssize_t bytes, status = -1; @@ -183,11 +183,11 @@ static int compliance_test(void) // Register reading from ioqueue. TRACE_("start recvfrom..."); - addrlen = sizeof(addr);
+ addrlen = sizeof(addr); bytes = bufsize; rc = pj_ioqueue_recvfrom(skey, &read_op, recv_buf, &bytes, 0, &addr, &addrlen); - if (rc != PJ_SUCCESS && rc != PJ_EPENDING) {
+ if (rc != PJ_SUCCESS && rc != PJ_EPENDING) { app_perror("...error: pj_ioqueue_recvfrom", rc); status=-28; goto on_error; } else if (rc == PJ_EPENDING) { @@ -201,11 +201,11 @@ static int compliance_test(void) } // Write must return the number of bytes. - TRACE_("start sendto...");
+ TRACE_("start sendto..."); bytes = bufsize; rc = pj_ioqueue_sendto(ckey, &write_op, send_buf, &bytes, 0, &addr, sizeof(addr)); - if (rc != PJ_SUCCESS && rc != PJ_EPENDING) {
+ if (rc != PJ_SUCCESS && rc != PJ_EPENDING) { app_perror("...error: pj_ioqueue_sendto", rc); status=-30; goto on_error; } else if (rc == PJ_EPENDING) { @@ -223,7 +223,7 @@ static int compliance_test(void) callback_accept_status = callback_connect_status = -2; callback_read_key = callback_write_key = callback_accept_key = callback_connect_key = NULL; - callback_read_op = callback_write_op = NULL;
+ callback_read_op = callback_write_op = NULL; // Poll if pending. while (send_pending || recv_pending) { @@ -247,9 +247,9 @@ static int compliance_test(void) } if (callback_read_key != skey) { status=-65; goto on_error; - }
- if (callback_read_op != &read_op) {
- status=-66; goto on_error;
+ } + if (callback_read_op != &read_op) { + status=-66; goto on_error; } if (memcmp(send_buf, recv_buf, bufsize) != 0) { @@ -266,9 +266,9 @@ static int compliance_test(void) } if (callback_write_key != ckey) { status=-75; goto on_error; - }
- if (callback_write_op != &write_op) {
- status=-76; goto on_error;
+ } + if (callback_write_op != &write_op) { + status=-76; goto on_error; } send_pending = 0; @@ -386,7 +386,7 @@ static int bench_test(int bufsize, int inactive_sock_count) pj_sock_t ssock=-1, csock=-1; pj_sockaddr_in addr; pj_pool_t *pool = NULL; - pj_sock_t *inactive_sock=NULL;
+ pj_sock_t *inactive_sock=NULL; pj_ioqueue_op_key_t *inactive_read_op; char *send_buf, *recv_buf; pj_ioqueue_t *ioque = NULL; @@ -433,13 +433,13 @@ static int bench_test(int bufsize, int inactive_sock_count) // Allocate inactive sockets, and bind them to some arbitrary address. // Then register them to the I/O queue, and start a read operation. inactive_sock = (pj_sock_t*)pj_pool_alloc(pool, - inactive_sock_count*sizeof(pj_sock_t));
- inactive_read_op = (pj_ioqueue_op_key_t*)pj_pool_alloc(pool,
+ inactive_sock_count*sizeof(pj_sock_t)); + inactive_read_op = (pj_ioqueue_op_key_t*)pj_pool_alloc(pool, inactive_sock_count*sizeof(pj_ioqueue_op_key_t)); memset(&addr, 0, sizeof(addr)); addr.sin_family = PJ_AF_INET; - for (i=0; i<inactive_sock_count; ++i) {
- pj_ssize_t bytes;
+ for (i=0; i<inactive_sock_count; ++i) { + pj_ssize_t bytes; rc = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &inactive_sock[i]); if (rc != PJ_SUCCESS || inactive_sock[i] < 0) { @@ -460,7 +460,7 @@ static int bench_test(int bufsize, int inactive_sock_count) app_perror("...error(1): pj_ioqueue_register_sock()", rc); PJ_LOG(3,(THIS_FILE, "....i=%d", i)); goto on_error; - }
+ } bytes = bufsize; rc = pj_ioqueue_recv(key, &inactive_read_op[i], recv_buf, &bytes, 0); if ( rc < 0 && rc != PJ_EPENDING) { @@ -494,13 +494,13 @@ static int bench_test(int bufsize, int inactive_sock_count) // Test loop. t_elapsed.u64 = 0; for (i=0; i<LOOP; ++i) { - pj_ssize_t bytes;
+ pj_ssize_t bytes; pj_ioqueue_op_key_t read_op, write_op; // Randomize send buffer. pj_create_random_string(send_buf, bufsize); - // Start reading on the server side.
+ // Start reading on the server side. bytes = bufsize; rc = pj_ioqueue_recv(skey, &read_op, recv_buf, &bytes, 0); if (rc < 0 && rc != PJ_EPENDING) { @@ -508,7 +508,7 @@ static int bench_test(int bufsize, int inactive_sock_count) break; } - // Starts send on the client side.
+ // Starts send on the client side. bytes = bufsize; rc = pj_ioqueue_sendto(ckey, &write_op, send_buf, &bytes, 0, &addr, sizeof(addr)); @@ -587,7 +587,7 @@ on_error: pj_sock_close(csock); for (i=0; i<inactive_sock_count && inactive_sock && inactive_sock[i]!=PJ_INVALID_SOCKET; ++i) - {
+ { pj_sock_close(inactive_sock[i]); } if (ioque != NULL) @@ -601,7 +601,7 @@ int udp_ioqueue_test() int status; int bufsize, sock_count; - PJ_LOG(3, (THIS_FILE, "...compliance test")); + PJ_LOG(3, (THIS_FILE, "...compliance test (%s)", pj_ioqueue_name())); if ((status=compliance_test()) != 0) { return status; } @@ -615,7 +615,7 @@ int udp_ioqueue_test() PJ_LOG(4, (THIS_FILE, "... note: buf=bytes sent, fds=# of fds, " "elapsed=in timer ticks")); - PJ_LOG(3, (THIS_FILE, "...Benchmarking poll times:")); + PJ_LOG(3, (THIS_FILE, "...Benchmarking poll times for %s:", pj_ioqueue_name())); PJ_LOG(3, (THIS_FILE, "...=====================================")); PJ_LOG(3, (THIS_FILE, "...Buf.size #inactive-socks Time/poll")); PJ_LOG(3, (THIS_FILE, "... (bytes) (nanosec)")); diff --git a/pjlib/src/pjlib-test/test.c b/pjlib/src/pjlib-test/test.c index 52ed0617..c9349a21 100644 --- a/pjlib/src/pjlib-test/test.c +++ b/pjlib/src/pjlib-test/test.c @@ -132,10 +132,6 @@ int test_inner(void) DO_TEST( file_test() ); #endif -#if INCLUDE_XML_TEST - DO_TEST( xml_test() ); -#endif - #if INCLUDE_ECHO_SERVER //echo_server(); //echo_srv_sync(); diff --git a/pjlib/src/pjlib-test/test.h b/pjlib/src/pjlib-test/test.h index cf78f4f4..17592908 100644 --- a/pjlib/src/pjlib-test/test.h +++ b/pjlib/src/pjlib-test/test.h @@ -10,7 +10,6 @@ #define GROUP_DATA_STRUCTURE 1 #define GROUP_NETWORK 1 #define GROUP_FILE 1 -#define GROUP_EXTRA 0 #define INCLUDE_ERRNO_TEST GROUP_LIBC #define INCLUDE_TIMESTAMP_TEST GROUP_OS @@ -34,7 +33,6 @@ #define INCLUDE_TCP_IOQUEUE_TEST GROUP_NETWORK #define INCLUDE_IOQUEUE_PERF_TEST GROUP_NETWORK #define INCLUDE_FILE_TEST GROUP_FILE -#define INCLUDE_XML_TEST GROUP_EXTRA #define INCLUDE_ECHO_SERVER 0 #define INCLUDE_ECHO_CLIENT 0 @@ -71,7 +69,6 @@ extern int udp_ioqueue_test(void); extern int tcp_ioqueue_test(void); extern int ioqueue_perf_test(void); extern int file_test(void); -extern int xml_test(void); extern int echo_server(void); extern int echo_client(int sock_type, const char *server, int port); |