You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(3) |
Oct
(1) |
Nov
(3) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(15) |
Dec
(3) |
2010 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
(5) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(2) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(2) |
Apr
|
May
(3) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
(10) |
Nov
(14) |
Dec
|
2012 |
Jan
|
Feb
(4) |
Mar
(5) |
Apr
(4) |
May
(4) |
Jun
(2) |
Jul
(11) |
Aug
|
Sep
|
Oct
(6) |
Nov
(14) |
Dec
(4) |
2013 |
Jan
(6) |
Feb
|
Mar
(2) |
Apr
|
May
(3) |
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(3) |
2014 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <s-v...@us...> - 2016-01-27 17:39:21
|
Revision: 248 http://sourceforge.net/p/turnserver/code/248 Author: s-vincent Date: 2016-01-27 17:39:19 +0000 (Wed, 27 Jan 2016) Log Message: ----------- Use _DEFAULT_SOURCE instead of _SVID_SOURCE (which is deprecated). Modified Paths: -------------- trunk/src/Makefile.am Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2015-01-02 08:20:27 UTC (rev 247) +++ trunk/src/Makefile.am 2016-01-27 17:39:19 UTC (rev 248) @@ -1,4 +1,4 @@ -AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -Wstrict-prototypes -Wredundant-decls -Wshadow -pedantic -fno-strict-aliasing -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_SVID_SOURCE -O2 +AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -Wstrict-prototypes -Wredundant-decls -Wshadow -pedantic -fno-strict-aliasing -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE -O2 if ENABLE_DEBUG_BUILD AM_CFLAGS += -g This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2015-01-02 08:20:34
|
Revision: 247 http://sourceforge.net/p/turnserver/code/247 Author: s-vincent Date: 2015-01-02 08:20:27 +0000 (Fri, 02 Jan 2015) Log Message: ----------- Fixes something scary (patch from Chris West). Modified Paths: -------------- trunk/src/turnserver.c Modified: trunk/src/turnserver.c =================================================================== --- trunk/src/turnserver.c 2014-01-15 21:06:06 UTC (rev 246) +++ trunk/src/turnserver.c 2015-01-02 08:20:27 UTC (rev 247) @@ -957,7 +957,7 @@ struct list_head* n2 = NULL; if(tmp->relayed_transport_protocol != IPPROTO_TCP || - memcmp(tmp->key, account->key, sizeof(tmp->key) != 0)) + memcmp(tmp->key, account->key, sizeof(tmp->key)) != 0) { continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2014-01-15 21:06:09
|
Revision: 246 http://sourceforge.net/p/turnserver/code/246 Author: s-vincent Date: 2014-01-15 21:06:06 +0000 (Wed, 15 Jan 2014) Log Message: ----------- Rename configure.in to configure.ac. Modified Paths: -------------- trunk/ChangeLog Added Paths: ----------- trunk/configure.ac Removed Paths: ------------- trunk/configure.in Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2014-01-15 20:55:48 UTC (rev 245) +++ trunk/ChangeLog 2014-01-15 21:06:06 UTC (rev 246) @@ -1,4 +1,4 @@ -2013-xx-xx Sebastien Vincent <seb...@tu...> +2014-xx-xx Sebastien Vincent <seb...@tu...> * Version 0.8 - Move to a new vsutils source files (list, util_sys, ...). Copied: trunk/configure.ac (from rev 242, trunk/configure.in) =================================================================== --- trunk/configure.ac (rev 0) +++ trunk/configure.ac 2014-01-15 21:06:06 UTC (rev 246) @@ -0,0 +1,109 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.61) +AC_INIT([turnserver],[0.8],[http://www.turnserver.org/]) +AC_CONFIG_SRCDIR([src/turn.h]) +AC_CONFIG_HEADER([config.h]) + +# Unit tests with Check framework +PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],,[AC_MSG_RESULT([testing is disabled])]) + +# Checks for programs. +AC_PROG_CC +AM_PROG_CC_C_O +AC_CHECK_PROG(SED, sed, sed) + +# Checks for libraries. +AC_CHECK_LIB(rt, timer_create,,[echo -e "\tPlease install librt";exit]) +AC_CHECK_LIB(ssl, SSL_new,,[echo -e "\tPlease install libssl-dev";exit]) +AC_CHECK_LIB(crypto, ERR_reason_error_string,,[echo -e "\tPlease install libssl-dev";exit]) +AC_CHECK_LIB(confuse, cfg_init,,[echo -e "\tPlease install libconfuse-dev (version >= 2.6)";exit]) + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_UID_T +AC_C_INLINE +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_INT8_T +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_HEADER_TIME +AC_STRUCT_TM +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINT8_T +AC_C_VOLATILE + +# Doxygen +DX_HTML_FEATURE(ON) +DX_CHM_FEATURE(OFF) +DX_CHI_FEATURE(OFF) +DX_MAN_FEATURE(ON) +DX_RTF_FEATURE(OFF) +DX_XML_FEATURE(OFF) +DX_PDF_FEATURE(OFF) +DX_PS_FEATURE(OFF) +DX_INIT_DOXYGEN(turnserver, Doxyfile) + +AM_INIT_AUTOMAKE + +# Checks for library functions. +AC_FUNC_FORK +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_FUNC_SELECT_ARGTYPES +AC_TYPE_SIGNAL +AC_FUNC_STRERROR_R +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([dup2 gettimeofday memset select pselect socket strchr strdup strerror sigaction signal]) + +# Enable compilation in debug mode. +AC_ARG_ENABLE(debug-build, [ --enable-debug-build allow to compile with debug informations [default=no]], enable_debug_build=$enableval, enable_debug_build=no) +if test "$enable_debug_build" = "yes"; then + AC_DEFINE([DEBUG_BUILD], [1], [Enable debug build]) +fi +AM_CONDITIONAL(ENABLE_DEBUG_BUILD, test "$enable_debug_build" = "yes") + +# Enable setting FD_SETSIZE. +AC_ARG_ENABLE(fdsetsize, [ --enable-fdsetsize allow to preconfigure FD_SETSIZE macro (must be a number >=32) [default=no]], enable_fdsetsize=$enableval, enable_fdsetsize=0) +if test "$enable_fdsetsize" -ge "32"; then + AC_DEFINE_UNQUOTED([SFD_SETSIZE], $enable_fdsetsize, [Enable user-defined FD_SETSIZE]) +else + enable_fdsetsize="no" +fi + +# Enable setting XOR_PEER_ADDRESS_MAX. +AC_ARG_ENABLE(xor_peer_address_max, [ --enable-xor-peer-address-max allow to preconfigure XOR_PEER_ADDRESS_MAX macro (must be a number > 0) [default=5]], enable_xor_peer_address_max=$enableval, enable_xor_peer_address_max=5) +if test "$enable_xor_peer_address_max" -ge "1"; then + AC_DEFINE_UNQUOTED([XOR_PEER_ADDRESS_MAX], $enable_xor_peer_address_max, [Enable user-defined XOR_PEER_ADDRESS_MAX]) +else + enable_xor_peer_address_max=5 +fi + +AC_CONFIG_FILES([Makefile + Doxyfile + src/Makefile + man/Makefile + doc/Makefile + extra/Makefile + test/Makefile]) +AC_OUTPUT + +AC_MSG_NOTICE([Configuration + +AC_PACKAGE_NAME version AC_PACKAGE_VERSION + Enable debug build: .............. $enable_debug_build + User-defined FD_SETSIZE: ......... $enable_fdsetsize + User-defined XOR_PEER_ADDRESS_MAX: $enable_xor_peer_address_max +]) + Deleted: trunk/configure.in =================================================================== --- trunk/configure.in 2014-01-15 20:55:48 UTC (rev 245) +++ trunk/configure.in 2014-01-15 21:06:06 UTC (rev 246) @@ -1,109 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.61) -AC_INIT([turnserver],[0.8],[http://www.turnserver.org/]) -AC_CONFIG_SRCDIR([src/turn.h]) -AC_CONFIG_HEADER([config.h]) - -# Unit tests with Check framework -PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],,[AC_MSG_RESULT([testing is disabled])]) - -# Checks for programs. -AC_PROG_CC -AM_PROG_CC_C_O -AC_CHECK_PROG(SED, sed, sed) - -# Checks for libraries. -AC_CHECK_LIB(rt, timer_create,,[echo -e "\tPlease install librt";exit]) -AC_CHECK_LIB(ssl, SSL_new,,[echo -e "\tPlease install libssl-dev";exit]) -AC_CHECK_LIB(crypto, ERR_reason_error_string,,[echo -e "\tPlease install libssl-dev";exit]) -AC_CHECK_LIB(confuse, cfg_init,,[echo -e "\tPlease install libconfuse-dev (version >= 2.6)";exit]) - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_UID_T -AC_C_INLINE -AC_TYPE_INT16_T -AC_TYPE_INT32_T -AC_TYPE_INT64_T -AC_TYPE_INT8_T -AC_TYPE_MODE_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T -AC_HEADER_TIME -AC_STRUCT_TM -AC_TYPE_UINT16_T -AC_TYPE_UINT32_T -AC_TYPE_UINT64_T -AC_TYPE_UINT8_T -AC_C_VOLATILE - -# Doxygen -DX_HTML_FEATURE(ON) -DX_CHM_FEATURE(OFF) -DX_CHI_FEATURE(OFF) -DX_MAN_FEATURE(ON) -DX_RTF_FEATURE(OFF) -DX_XML_FEATURE(OFF) -DX_PDF_FEATURE(OFF) -DX_PS_FEATURE(OFF) -DX_INIT_DOXYGEN(turnserver, Doxyfile) - -AM_INIT_AUTOMAKE(turnserver, $PACKAGE_VERSION) - -# Checks for library functions. -AC_FUNC_FORK -AC_FUNC_MALLOC -AC_FUNC_MEMCMP -AC_FUNC_SELECT_ARGTYPES -AC_TYPE_SIGNAL -AC_FUNC_STRERROR_R -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([dup2 gettimeofday memset select pselect socket strchr strdup strerror sigaction signal]) - -# Enable compilation in debug mode. -AC_ARG_ENABLE(debug-build, [ --enable-debug-build allow to compile with debug informations [default=no]], enable_debug_build=$enableval, enable_debug_build=no) -if test "$enable_debug_build" = "yes"; then - AC_DEFINE([DEBUG_BUILD], [1], [Enable debug build]) -fi -AM_CONDITIONAL(ENABLE_DEBUG_BUILD, test "$enable_debug_build" = "yes") - -# Enable setting FD_SETSIZE. -AC_ARG_ENABLE(fdsetsize, [ --enable-fdsetsize allow to preconfigure FD_SETSIZE macro (must be a number >=32) [default=no]], enable_fdsetsize=$enableval, enable_fdsetsize=0) -if test "$enable_fdsetsize" -ge "32"; then - AC_DEFINE_UNQUOTED([SFD_SETSIZE], $enable_fdsetsize, [Enable user-defined FD_SETSIZE]) -else - enable_fdsetsize="no" -fi - -# Enable setting XOR_PEER_ADDRESS_MAX. -AC_ARG_ENABLE(xor_peer_address_max, [ --enable-xor-peer-address-max allow to preconfigure XOR_PEER_ADDRESS_MAX macro (must be a number > 0) [default=5]], enable_xor_peer_address_max=$enableval, enable_xor_peer_address_max=5) -if test "$enable_xor_peer_address_max" -ge "1"; then - AC_DEFINE_UNQUOTED([XOR_PEER_ADDRESS_MAX], $enable_xor_peer_address_max, [Enable user-defined XOR_PEER_ADDRESS_MAX]) -else - enable_xor_peer_address_max=5 -fi - -AC_CONFIG_FILES([Makefile - Doxyfile - src/Makefile - man/Makefile - doc/Makefile - extra/Makefile - test/Makefile]) -AC_OUTPUT - -AC_MSG_NOTICE([Configuration - -AC_PACKAGE_NAME version AC_PACKAGE_VERSION - Enable debug build: .............. $enable_debug_build - User-defined FD_SETSIZE: ......... $enable_fdsetsize - User-defined XOR_PEER_ADDRESS_MAX: $enable_xor_peer_address_max -]) - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2014-01-15 20:55:52
|
Revision: 245 http://sourceforge.net/p/turnserver/code/245 Author: s-vincent Date: 2014-01-15 20:55:48 +0000 (Wed, 15 Jan 2014) Log Message: ----------- Fixes tests compilation. Modified Paths: -------------- trunk/test/Makefile.am trunk/test/check_account.c trunk/test/check_allocation.c trunk/test/check_turn.c Modified: trunk/test/Makefile.am =================================================================== --- trunk/test/Makefile.am 2014-01-15 20:46:52 UTC (rev 244) +++ trunk/test/Makefile.am 2014-01-15 20:55:48 UTC (rev 245) @@ -8,6 +8,8 @@ $(top_builddir)/src/protocol.h \ $(top_builddir)/src/util_sys.h \ $(top_builddir)/src/util_sys.c \ + $(top_builddir)/src/util_net.h \ + $(top_builddir)/src/util_net.c \ $(top_builddir)/src/util_crypto.h \ $(top_builddir)/src/util_crypto.c \ $(top_builddir)/src/tls_peer.h \ @@ -31,10 +33,13 @@ $(top_builddir)/src/protocol.c \ $(top_builddir)/src/util_sys.h \ $(top_builddir)/src/util_sys.c \ + $(top_builddir)/src/util_net.h \ + $(top_builddir)/src/util_net.c \ $(top_builddir)/src/util_crypto.h \ $(top_builddir)/src/util_crypto.c \ $(top_builddir)/src/tls_peer.h \ $(top_builddir)/src/tls_peer.c + check_account_CFLAGS = @CHECK_CFLAGS@ check_account_LDADD = @CHECK_LIBS@ Modified: trunk/test/check_account.c =================================================================== --- trunk/test/check_account.c 2014-01-15 20:46:52 UTC (rev 244) +++ trunk/test/check_account.c 2014-01-15 20:55:48 UTC (rev 245) @@ -76,7 +76,7 @@ struct account_desc* ret2 = NULL; struct account_desc* ret3 = NULL; - INIT_LIST(account_list); + list_head_init(&account_list); /* create a valid account descriptor */ ret = account_desc_new("login", "password", "domain.org", AUTHORIZED); Modified: trunk/test/check_allocation.c =================================================================== --- trunk/test/check_allocation.c 2014-01-15 20:46:52 UTC (rev 244) +++ trunk/test/check_allocation.c 2014-01-15 20:55:48 UTC (rev 245) @@ -89,7 +89,7 @@ memcpy(&relayed_addr2, &server_addr, sizeof(server_addr)); relayed_addr2.sin_port = htons(48005); - INIT_LIST(allocation_list); + list_head_init(&allocation_list); /* create a valid allocation descriptor */ ret = allocation_desc_new(id, IPPROTO_UDP, "login", key, realm, nonce, Modified: trunk/test/check_turn.c =================================================================== --- trunk/test/check_turn.c 2014-01-15 20:46:52 UTC (rev 244) +++ trunk/test/check_turn.c 2014-01-15 20:55:48 UTC (rev 245) @@ -233,7 +233,7 @@ * HMAC-SHA1 */ /* index -1 because we do not take into account MESSAGE-INTEGRITY attribute */ - md5_generate(md_buf, "login:domain.org:password", + crypto_md5_generate(md_buf, "login:domain.org:password", strlen("login:domain.org:password")); turn_calculate_integrity_hmac_iov(iov, index - 1, md_buf, sizeof(md_buf), ((struct turn_attr_message_integrity*)attr)->turn_attr_hmac); @@ -248,7 +248,7 @@ strncpy(buf, "hello", 40); buf[39] = 0x00; - crc = crc32_generate(buf, strlen("hello"), 0); + crc = crypto_crc32_generate(buf, strlen("hello"), 0); nb = memcmp(&crc, &crc_hello, sizeof(uint32_t)); fail_unless(nb == 0, "CRC32 failed!"); } @@ -278,7 +278,7 @@ uint16_t len_save = hdr->turn_msg_len; /* store in big endian */ /* verify integrity with valid login/realm/password */ - md5_generate(md_buf, "login:domain.org:password", + crypto_md5_generate(md_buf, "login:domain.org:password", strlen("login:domain.org:password")); /* change length up to message integrity */ @@ -294,7 +294,7 @@ /* verify integrity with invalid login/realm/password */ memset(hashmac, 0x00, 20); - md5_generate(md_buf, "login2:domain.org:password", + crypto_md5_generate(md_buf, "login2:domain.org:password", strlen("login2:domain.org:password")); turn_calculate_integrity_hmac_iov(iov, index - 2, md_buf, sizeof(md_buf), hashmac); @@ -314,7 +314,7 @@ "Fingerprint check"); } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); close(sock); } END_TEST @@ -450,7 +450,7 @@ fail_unless(nb > 0, "sendmsg failed"); } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); close(sock); } END_TEST @@ -639,7 +639,7 @@ * HMAC-SHA1 */ /* index -1 because we do not take into account MESSAGE-INTEGRITY attribute */ - md5_generate(md_buf, "login:domain.org:password", + crypto_md5_generate(md_buf, "login:domain.org:password", strlen("login:domain.org:password")); turn_calculate_integrity_hmac_iov(iov, index - 1, md_buf, sizeof(md_buf), ((struct turn_attr_message_integrity*)attr)->turn_attr_hmac); @@ -685,7 +685,7 @@ fail_unless(message.software != NULL, "software must be present"); fail_unless(message.error_code != NULL, "error_code must be present"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); } END_TEST This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2014-01-15 20:46:56
|
Revision: 244 http://sourceforge.net/p/turnserver/code/244 Author: s-vincent Date: 2014-01-15 20:46:52 +0000 (Wed, 15 Jan 2014) Log Message: ----------- Fixes calls of list_head_add/remove (intervert arguments since refactoring). Modified Paths: -------------- trunk/src/account.c trunk/src/allocation.c trunk/src/conf.c trunk/src/mod_tmpuser.c trunk/src/turnserver.c Modified: trunk/src/account.c =================================================================== --- trunk/src/account.c 2014-01-15 20:28:10 UTC (rev 243) +++ trunk/src/account.c 2014-01-15 20:46:52 UTC (rev 244) @@ -72,7 +72,6 @@ ret->state = state; ret->allocations = 0; ret->is_tmp = 0; - list_head_init(&ret->list); turn_calculate_authentication_key(username, realm, password, ret->key, sizeof(ret->key)); @@ -130,7 +129,7 @@ void account_list_add(struct list_head* list, struct account_desc* desc) { - list_head_add(&desc->list, list); + list_head_add(list, &desc->list); } void account_list_remove(struct list_head* list, struct account_desc* desc) Modified: trunk/src/allocation.c =================================================================== --- trunk/src/allocation.c 2014-01-15 20:28:10 UTC (rev 243) +++ trunk/src/allocation.c 2014-01-15 20:46:52 UTC (rev 244) @@ -341,7 +341,7 @@ allocation_permission_set_timer(ret, lifetime); /* add to the list */ - list_head_add(&ret->list, &desc->peers_permissions); + list_head_add(&desc->peers_permissions, &ret->list); list_head_init(&ret->list2); return 0; } @@ -421,7 +421,7 @@ allocation_channel_set_timer(ret, lifetime); /* add to the list */ - list_head_add(&ret->list, &desc->peers_channels); + list_head_add(&desc->peers_channels, &ret->list); list_head_init(&ret->list2); return 0; } @@ -481,7 +481,7 @@ void allocation_list_add(struct list_head* list, struct allocation_desc* desc) { - list_head_add_tail(&desc->list, list); + list_head_add_tail(list, &desc->list); } void allocation_list_remove(struct list_head* list, @@ -642,7 +642,7 @@ allocation_tcp_relay_set_timer(ret, timeout); /* add to the list */ - list_head_add(&ret->list, &desc->tcp_relays); + list_head_add(&desc->tcp_relays, &ret->list); list_head_init(&ret->list2); return 0; } @@ -806,7 +806,7 @@ void allocation_token_list_add(struct list_head* list, struct allocation_token* token) { - list_head_add(&token->list, list); + list_head_add(list, &token->list); } void allocation_token_list_remove(struct list_head* list, Modified: trunk/src/conf.c =================================================================== --- trunk/src/conf.c 2014-01-15 20:28:10 UTC (rev 243) +++ trunk/src/conf.c 2014-01-15 20:46:52 UTC (rev 244) @@ -186,7 +186,6 @@ memset(denied, 0x00, sizeof(struct denied_address)); denied->mask = mask; denied->port = port; - list_head_init(&denied->list); if(inet_pton(AF_INET, addr, denied->addr) != 1) { @@ -219,7 +218,7 @@ } /* add to the list */ - list_head_add(&denied->list, denied_address_list); + list_head_add(denied_address_list, &denied->list); } return 0; Modified: trunk/src/mod_tmpuser.c =================================================================== --- trunk/src/mod_tmpuser.c 2014-01-15 20:28:10 UTC (rev 243) +++ trunk/src/mod_tmpuser.c 2014-01-15 20:46:52 UTC (rev 244) @@ -172,7 +172,7 @@ void tmpuser_add_tcp_client(struct socket_desc* desc) { struct list_head* l = (struct list_head*)&desc->list; - list_head_add(l, &g_tmpuser.client_list); + list_head_add(&g_tmpuser.client_list, l); } void tmpuser_remove_tcp_client(struct socket_desc* desc) Modified: trunk/src/turnserver.c =================================================================== --- trunk/src/turnserver.c 2014-01-15 20:28:10 UTC (rev 243) +++ trunk/src/turnserver.c 2014-01-15 20:46:52 UTC (rev 244) @@ -265,7 +265,7 @@ /* add it to the expired list, the next loop will * purge it */ - list_head_add(&desc->list2, &g_expired_allocation_list); + list_head_add(&g_expired_allocation_list, &desc->list2); } else if(signo == SIGRT_EXPIRE_PERMISSION) { @@ -278,7 +278,7 @@ debug(DBG_ATTR, "Permission expires: %p\n", desc); /* add it to the expired list */ - list_head_add(&desc->list2, &g_expired_permission_list); + list_head_add(&g_expired_permission_list, &desc->list2); } else if(signo == SIGRT_EXPIRE_CHANNEL) { @@ -291,7 +291,7 @@ debug(DBG_ATTR, "Channel expires: %p\n", desc); /* add it to the expired list */ - list_head_add(&desc->list2, &g_expired_channel_list); + list_head_add(&g_expired_channel_list, &desc->list2); } else if(signo == SIGRT_EXPIRE_TOKEN) { @@ -304,7 +304,7 @@ debug(DBG_ATTR, "Token expires: %p\n", desc); /* add it to the expired list */ - list_head_add(&desc->list2, &g_expired_token_list); + list_head_add(&g_expired_token_list, &desc->list2); } else if(signo == SIGRT_EXPIRE_TCP_RELAY) { @@ -317,7 +317,7 @@ /* remove relay from list */ debug(DBG_ATTR, "TCP relay expires: %p\n", desc); - list_head_add(&desc->list2, &g_expired_tcp_relay_list); + list_head_add(&g_expired_tcp_relay_list, &desc->list2); } } @@ -4249,7 +4249,7 @@ sdesc->sock = rsock; /* add it to the list */ - list_head_add(&sdesc->list, tcp_socket_list); + list_head_add(tcp_socket_list, &sdesc->list); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2014-01-15 20:28:12
|
Revision: 243 http://sourceforge.net/p/turnserver/code/243 Author: s-vincent Date: 2014-01-15 20:28:10 +0000 (Wed, 15 Jan 2014) Log Message: ----------- Initializes crypto seed for systems that do not have /dev/urandom (which is done transparently by OpenSSL). Initialize list elements due to change of list.h. Modified Paths: -------------- trunk/src/account.c trunk/src/conf.c trunk/src/turnserver.c Modified: trunk/src/account.c =================================================================== --- trunk/src/account.c 2013-12-21 20:36:38 UTC (rev 242) +++ trunk/src/account.c 2014-01-15 20:28:10 UTC (rev 243) @@ -72,6 +72,7 @@ ret->state = state; ret->allocations = 0; ret->is_tmp = 0; + list_head_init(&ret->list); turn_calculate_authentication_key(username, realm, password, ret->key, sizeof(ret->key)); Modified: trunk/src/conf.c =================================================================== --- trunk/src/conf.c 2013-12-21 20:36:38 UTC (rev 242) +++ trunk/src/conf.c 2014-01-15 20:28:10 UTC (rev 243) @@ -186,6 +186,7 @@ memset(denied, 0x00, sizeof(struct denied_address)); denied->mask = mask; denied->port = port; + list_head_init(&denied->list); if(inet_pton(AF_INET, addr, denied->addr) != 1) { Modified: trunk/src/turnserver.c =================================================================== --- trunk/src/turnserver.c 2013-12-21 20:36:38 UTC (rev 242) +++ trunk/src/turnserver.c 2014-01-15 20:28:10 UTC (rev 243) @@ -3484,8 +3484,8 @@ debug(DBG_ATTR, "Hash mismatch\n"); #ifndef NDEBUG /* print computed hash and the one from the message */ - digest_print(hash, 20); - digest_print(message.message_integrity->turn_attr_hmac, 20); + crypto_digest_print(hash, 20); + crypto_digest_print(message.message_integrity->turn_attr_hmac, 20); #endif turn_generate_nonce(nonce, sizeof(nonce), (unsigned char*)nonce_key, strlen(nonce_key)); @@ -5018,6 +5018,12 @@ char* listen_addr = NULL; struct sigaction sa; + /* initialize cryptographic seed for systems which do not have /dev/urandom */ + if(crypto_seed_prng_init() == -1) + { + debug(DBG_ATTR, "Warning cryptographic seed not strong\n"); + } + /* initialize lists */ list_head_init(&allocation_list); list_head_init(&account_list); @@ -5657,6 +5663,8 @@ /* free the configuration parser */ turnserver_cfg_free(); + crypto_seed_prng_cleanup(); + return EXIT_SUCCESS; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2013-12-21 20:36:40
|
Revision: 242 http://sourceforge.net/p/turnserver/code/242 Author: s-vincent Date: 2013-12-21 20:36:38 +0000 (Sat, 21 Dec 2013) Log Message: ----------- Adds again _SVID_SOURCE define. Modified Paths: -------------- trunk/src/Makefile.am Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2013-12-21 20:31:44 UTC (rev 241) +++ trunk/src/Makefile.am 2013-12-21 20:36:38 UTC (rev 242) @@ -1,4 +1,4 @@ -AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -Wstrict-prototypes -Wredundant-decls -Wshadow -pedantic -fno-strict-aliasing -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -O2 +AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -Wstrict-prototypes -Wredundant-decls -Wshadow -pedantic -fno-strict-aliasing -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_SVID_SOURCE -O2 if ENABLE_DEBUG_BUILD AM_CFLAGS += -g This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2013-12-21 20:31:46
|
Revision: 241 http://sourceforge.net/p/turnserver/code/241 Author: s-vincent Date: 2013-12-21 20:31:44 +0000 (Sat, 21 Dec 2013) Log Message: ----------- Fixes compilation on FreeBSD 9.x. Modified Paths: -------------- trunk/src/Makefile.am trunk/src/test_echo_server.c trunk/src/tls_peer.c Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2013-12-21 17:34:42 UTC (rev 240) +++ trunk/src/Makefile.am 2013-12-21 20:31:44 UTC (rev 241) @@ -1,4 +1,4 @@ -AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -Wstrict-prototypes -Wredundant-decls -Wshadow -pedantic -fno-strict-aliasing -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -O2 -D_SVID_SOURCE +AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -Wstrict-prototypes -Wredundant-decls -Wshadow -pedantic -fno-strict-aliasing -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -O2 if ENABLE_DEBUG_BUILD AM_CFLAGS += -g Modified: trunk/src/test_echo_server.c =================================================================== --- trunk/src/test_echo_server.c 2013-12-21 17:34:42 UTC (rev 240) +++ trunk/src/test_echo_server.c 2013-12-21 20:31:44 UTC (rev 241) @@ -132,15 +132,15 @@ while(g_run) { - fd_set fdsr; + sfd_set fdsr; int nsock = sock; - FD_ZERO(&fdsr); - FD_SET(sock, &fdsr); + NET_SFD_ZERO(&fdsr); + NET_SFD_SET(sock, &fdsr); nsock++; - if(select(nsock, &fdsr, NULL, NULL, NULL) > 0) + if(select(nsock, (fd_set*)(void*)&fdsr, NULL, NULL, NULL) > 0) { if(FD_ISSET(sock, &fdsr)) { Modified: trunk/src/tls_peer.c =================================================================== --- trunk/src/tls_peer.c 2013-12-21 17:34:42 UTC (rev 240) +++ trunk/src/tls_peer.c 2013-12-21 20:31:44 UTC (rev 241) @@ -491,10 +491,10 @@ while(!speer->handshake_complete) { - fd_set fdsr; + sfd_set fdsr; - FD_ZERO(&fdsr); - FD_SET(peer->sock, &fdsr); + NET_SFD_ZERO(&fdsr); + NET_SFD_SET(peer->sock, &fdsr); /* 5 seconds of timeout */ tv.tv_sec = 5; @@ -514,7 +514,7 @@ } } - ret = select(nsock, &fdsr, NULL, NULL, &tv); + ret = select(nsock, (fd_set*)(void*)&fdsr, NULL, NULL, &tv); if(ret > 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2013-12-21 17:34:44
|
Revision: 240 http://sourceforge.net/p/turnserver/code/240 Author: s-vincent Date: 2013-12-21 17:34:42 +0000 (Sat, 21 Dec 2013) Log Message: ----------- Fixes Debian/kFreeBSD compilation. Modified Paths: -------------- trunk/src/turnserver.c Modified: trunk/src/turnserver.c =================================================================== --- trunk/src/turnserver.c 2013-09-03 16:26:29 UTC (rev 239) +++ trunk/src/turnserver.c 2013-12-21 17:34:42 UTC (rev 240) @@ -1357,9 +1357,9 @@ } #else /* avoid compilation warning */ - optval = 0; - optlen = 0; - save_val = 0; + (void)optval; + (void)optlen; + (void)save_val; #endif } @@ -1551,9 +1551,9 @@ } #else /* avoid compilation warning */ - optval = 0; - optlen = 0; - save_val = 0; + (void)optval; + (void)optlen; + (void)save_val; if(message->dont_fragment) { @@ -3762,9 +3762,9 @@ } } #else - optlen = 0; - optval = 0; - save_val = 0; + (void)optlen; + (void)optval; + (void)save_val; #endif nb = turn_udp_send(desc->tuple_sock, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2013-09-03 16:26:33
|
Revision: 239 http://sourceforge.net/p/turnserver/code/239 Author: s-vincent Date: 2013-09-03 16:26:29 +0000 (Tue, 03 Sep 2013) Log Message: ----------- Move to new vsutils source files and change code accordingly. Modified Paths: -------------- trunk/ChangeLog trunk/extra/turnserver.debian.initd trunk/src/Makefile.am trunk/src/account.c trunk/src/allocation.c trunk/src/conf.c trunk/src/dbg.c trunk/src/dbg.h trunk/src/list.h trunk/src/mod_tmpuser.c trunk/src/protocol.c trunk/src/test_echo_server.c trunk/src/test_turn_client.c trunk/src/tls_peer.c trunk/src/tls_peer.h trunk/src/turnserver.c trunk/src/util_crypto.c trunk/src/util_crypto.h trunk/src/util_sys.c trunk/src/util_sys.h Added Paths: ----------- trunk/src/util_net.c trunk/src/util_net.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/ChangeLog 2013-09-03 16:26:29 UTC (rev 239) @@ -1,18 +1,18 @@ -2013-xx-xx Sebastien Vincent <seb...@tu...> +2013-xx-xx Sebastien Vincent <seb...@tu...> - * Version 0.8 - + * Version 0.8 - Move to a new vsutils source files (list, util_sys, ...). -2013-06-14 Sebastien Vincent <seb...@tu...> +2013-06-14 Sebastien Vincent <seb...@tu...> - * Version 0.7.3 - Minor fix to be able to compile with recent glibc. + * Version 0.7.3 - Minor fix to be able to compile with recent glibc. -2012-11-19 Daniel Pocock <da...@po...> +2012-11-19 Daniel Pocock <da...@po...> - * Version 0.7.2 - Further tweaks to autotools + * Version 0.7.2 - Further tweaks to autotools. -2012-10-17 Sebastien Vincent <seb...@tu...> +2012-10-17 Sebastien Vincent <seb...@tu...> - * Version 0.7.1 - Minor modifications to ease Debian package integration. + * Version 0.7.1 - Minor modifications to ease Debian package integration. 2012-10-01 Sebastien Vincent <seb...@tu...> Modified: trunk/extra/turnserver.debian.initd =================================================================== --- trunk/extra/turnserver.debian.initd 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/extra/turnserver.debian.initd 2013-09-03 16:26:29 UTC (rev 239) @@ -9,6 +9,8 @@ # Description: Enable service provided by turnserver. ### END INIT INFO +. /lib/lsb/init-functions + set -e DAEMON=/usr/local/sbin/turnserver @@ -17,8 +19,6 @@ test -x $DAEMON || exit 0 -. /lib/lsb/init-functions - case "$1" in start) echo "Starting $NAME" Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/Makefile.am 2013-09-03 16:26:29 UTC (rev 239) @@ -14,6 +14,7 @@ protocol.h \ dbg.h \ util_sys.h \ + util_net.h \ util_crypto.h \ list.h \ tls_peer.h \ @@ -26,6 +27,7 @@ protocol.c \ dbg.c \ util_sys.c \ + util_net.c \ util_crypto.c \ tls_peer.c \ allocation.c \ @@ -35,11 +37,13 @@ test_turn_client_SOURCES = test_turn_client.c \ protocol.c \ + util_net.c \ util_crypto.c \ tls_peer.c \ util_sys.c test_echo_server_SOURCES = test_echo_server.c \ + util_net.c \ tls_peer.c valgrind-run: Modified: trunk/src/account.c =================================================================== --- trunk/src/account.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/account.c 2013-09-03 16:26:29 UTC (rev 239) @@ -96,9 +96,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct account_desc* tmp = list_get(get, struct account_desc, list); + struct account_desc* tmp = list_head_get(get, struct account_desc, list); if(!strncmp(tmp->username, username, sizeof(tmp->username) - 1)) { @@ -119,25 +119,22 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct account_desc* tmp = list_get(get, struct account_desc, list); - LIST_DEL(&tmp->list); + struct account_desc* tmp = list_head_get(get, struct account_desc, list); + list_head_remove(list, &tmp->list); account_desc_free(&tmp); } } void account_list_add(struct list_head* list, struct account_desc* desc) { - LIST_ADD(&desc->list, list); + list_head_add(&desc->list, list); } void account_list_remove(struct list_head* list, struct account_desc* desc) { - /* to avoid compilation warning */ - (void)list; - - LIST_DEL(&desc->list); + list_head_remove(list, &desc->list); } int account_parse_file(struct list_head* list, const char* file) Modified: trunk/src/allocation.c =================================================================== --- trunk/src/allocation.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/allocation.c 2013-09-03 16:26:29 UTC (rev 239) @@ -116,17 +116,17 @@ ret->bucket_tokendown = 0; /* list of permissions */ - INIT_LIST(ret->peers_permissions); + list_head_init(&ret->peers_permissions); /* list of channels */ - INIT_LIST(ret->peers_channels); + list_head_init(&ret->peers_channels); /* list of TCP relays */ - INIT_LIST(ret->tcp_relays); + list_head_init(&ret->tcp_relays); /* linked lists, second ones used when timer has expired */ - INIT_LIST(ret->list); - INIT_LIST(ret->list2); + list_head_init(&ret->list); + list_head_init(&ret->list2); /* timer */ memset(&event, 0x00, sizeof(struct sigevent)); @@ -164,29 +164,29 @@ free(ret->username); /* free up the lists */ - list_iterate_safe(get, n, &ret->peers_channels) + list_head_iterate_safe(&ret->peers_channels, get, n) { - struct allocation_channel* tmp = list_get(get, struct allocation_channel, + struct allocation_channel* tmp = list_head_get(get, struct allocation_channel, list); timer_delete(tmp->expire_timer); - LIST_DEL(&tmp->list); - LIST_DEL(&tmp->list2); + list_head_remove(&tmp->list, &tmp->list); + list_head_remove(&tmp->list2, &tmp->list2); free(tmp); } - list_iterate_safe(get, n, &ret->peers_permissions) + list_head_iterate_safe(&ret->peers_permissions, get, n) { - struct allocation_permission* tmp = list_get(get, + struct allocation_permission* tmp = list_head_get(get, struct allocation_permission, list); timer_delete(tmp->expire_timer); - LIST_DEL(&tmp->list); - LIST_DEL(&tmp->list2); + list_head_remove(&tmp->list, &tmp->list); + list_head_remove(&tmp->list2, &tmp->list2); free(tmp); } - list_iterate_safe(get, n, &ret->tcp_relays) + list_head_iterate_safe(&ret->tcp_relays, get, n) { - struct allocation_tcp_relay* tmp = list_get(get, + struct allocation_tcp_relay* tmp = list_head_get(get, struct allocation_tcp_relay, list); allocation_tcp_relay_list_remove(&ret->tcp_relays, tmp); } @@ -241,9 +241,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, &desc->peers_permissions) + list_head_iterate_safe(&desc->peers_permissions, get, n) { - struct allocation_permission* tmp = list_get(get, + struct allocation_permission* tmp = list_head_get(get, struct allocation_permission, list); /* check only the network address (not the port) */ @@ -268,9 +268,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, &desc->peers_permissions) + list_head_iterate_safe(&desc->peers_permissions, get, n) { - struct allocation_permission* tmp = list_get(get, + struct allocation_permission* tmp = list_head_get(get, struct allocation_permission, list); /* check only the network address (not the port) */ @@ -341,8 +341,8 @@ allocation_permission_set_timer(ret, lifetime); /* add to the list */ - LIST_ADD(&ret->list, &desc->peers_permissions); - INIT_LIST(ret->list2); + list_head_add(&ret->list, &desc->peers_permissions); + list_head_init(&ret->list2); return 0; } @@ -352,9 +352,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, &desc->peers_channels) + list_head_iterate_safe(&desc->peers_channels, get, n) { - struct allocation_channel* tmp = list_get(get, struct allocation_channel, + struct allocation_channel* tmp = list_head_get(get, struct allocation_channel, list); if(tmp->family == family && !memcmp(&tmp->peer_addr, peer_addr, @@ -374,9 +374,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, &desc->peers_channels) + list_head_iterate_safe(&desc->peers_channels, get, n) { - struct allocation_channel* tmp = list_get(get, struct allocation_channel, + struct allocation_channel* tmp = list_head_get(get, struct allocation_channel, list); if(tmp->channel_number == channel) @@ -421,8 +421,8 @@ allocation_channel_set_timer(ret, lifetime); /* add to the list */ - LIST_ADD(&ret->list, &desc->peers_channels); - INIT_LIST(ret->list2); + list_head_add(&ret->list, &desc->peers_channels); + list_head_init(&ret->list2); return 0; } @@ -471,26 +471,23 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct allocation_desc* tmp = list_get(get, struct allocation_desc, list); - LIST_DEL(&tmp->list); + struct allocation_desc* tmp = list_head_get(get, struct allocation_desc, list); + list_head_remove(&tmp->list, &tmp->list); allocation_desc_free(&tmp); } } void allocation_list_add(struct list_head* list, struct allocation_desc* desc) { - LIST_ADD_TAIL(&desc->list, list); + list_head_add_tail(&desc->list, list); } void allocation_list_remove(struct list_head* list, struct allocation_desc* desc) { - /* to avoid compilation warning */ - (void)list; - - LIST_DEL(&desc->list); + list_head_remove(list, &desc->list); allocation_desc_free(&desc); } @@ -500,9 +497,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct allocation_desc* tmp = list_get(get, struct allocation_desc, list); + struct allocation_desc* tmp = list_head_get(get, struct allocation_desc, list); if(!strcmp(tmp->username, username) && !strcmp(tmp->realm, realm)) { return tmp; @@ -519,9 +516,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct allocation_desc* tmp = list_get(get, struct allocation_desc, list); + struct allocation_desc* tmp = list_head_get(get, struct allocation_desc, list); if(!memcmp(tmp->transaction_id, id, 12)) { return tmp; @@ -539,9 +536,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct allocation_desc* tmp = list_get(get, struct allocation_desc, list); + struct allocation_desc* tmp = list_head_get(get, struct allocation_desc, list); if(tmp->tuple.transport_protocol == transport_protocol && !memcmp(&tmp->tuple.server_addr, server_addr, addr_size) && @@ -561,9 +558,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct allocation_desc* tmp = list_get(get, struct allocation_desc, list); + struct allocation_desc* tmp = list_head_get(get, struct allocation_desc, list); if(!memcmp(&tmp->relayed_addr, relayed_addr, addr_size)) { @@ -645,19 +642,17 @@ allocation_tcp_relay_set_timer(ret, timeout); /* add to the list */ - LIST_ADD(&ret->list, &desc->tcp_relays); - INIT_LIST(ret->list2); + list_head_add(&ret->list, &desc->tcp_relays); + list_head_init(&ret->list2); return 0; } void allocation_tcp_relay_list_remove(struct list_head* list, struct allocation_tcp_relay* relay) { - (void)list; /* not used */ + list_head_remove(list, &relay->list); + list_head_remove(&relay->list2, &relay->list2); - LIST_DEL(&relay->list); - LIST_DEL(&relay->list2); - /* close socket */ if(relay->peer_sock > 0) { @@ -686,9 +681,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, &desc->tcp_relays) + list_head_iterate_safe(&desc->tcp_relays, get, n) { - struct allocation_tcp_relay* tmp = list_get(get, + struct allocation_tcp_relay* tmp = list_head_get(get, struct allocation_tcp_relay, list); if(tmp->connection_id == id) @@ -708,9 +703,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, &desc->tcp_relays) + list_head_iterate_safe(&desc->tcp_relays, get, n) { - struct allocation_tcp_relay* tmp = list_get(get, + struct allocation_tcp_relay* tmp = list_head_get(get, struct allocation_tcp_relay, list); if(tmp->family != family) @@ -775,8 +770,8 @@ allocation_token_set_timer(ret, lifetime); - INIT_LIST(ret->list); - INIT_LIST(ret->list2); + list_head_init(&ret->list); + list_head_init(&ret->list2); return ret; } @@ -784,8 +779,8 @@ void allocation_token_free(struct allocation_token** token) { timer_delete((*token)->expire_timer); - LIST_DEL(&(*token)->list); - LIST_DEL(&(*token)->list2); + list_head_remove(&(*token)->list, &(*token)->list); + list_head_remove(&(*token)->list2, &(*token)->list2); free(*token); *token = NULL; } @@ -811,15 +806,13 @@ void allocation_token_list_add(struct list_head* list, struct allocation_token* token) { - LIST_ADD(&token->list, list); + list_head_add(&token->list, list); } void allocation_token_list_remove(struct list_head* list, struct allocation_token* token) { - (void)list; /* not used */ - - LIST_DEL(&token->list); + list_head_remove(list, &token->list); allocation_token_free(&token); } @@ -829,9 +822,9 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct allocation_token* tmp = list_get(get, struct allocation_token, list); + struct allocation_token* tmp = list_head_get(get, struct allocation_token, list); if(!memcmp(tmp->id, id, 8)) { @@ -848,10 +841,10 @@ struct list_head* get = NULL; struct list_head* n = NULL; - list_iterate_safe(get, n, list) + list_head_iterate_safe(list, get, n) { - struct allocation_token* tmp = list_get(get, struct allocation_token, list); - LIST_DEL(&tmp->list); + struct allocation_token* tmp = list_head_get(get, struct allocation_token, list); + list_head_remove(&tmp->list, &tmp->list); /* this function will probably be a cleanup so close the relayed socket */ close(tmp->sock); allocation_token_free(&tmp); Modified: trunk/src/conf.c =================================================================== --- trunk/src/conf.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/conf.c 2013-09-03 16:26:29 UTC (rev 239) @@ -218,7 +218,7 @@ } /* add to the list */ - LIST_ADD(&denied->list, denied_address_list); + list_head_add(&denied->list, denied_address_list); } return 0; Modified: trunk/src/dbg.c =================================================================== --- trunk/src/dbg.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/dbg.c 2013-09-03 16:26:29 UTC (rev 239) @@ -1,6 +1,6 @@ /* * TurnServer - TURN server implementation. - * Copyright (C) 2008-2011 Sebastien Vincent <seb...@tu...> + * Copyright (C) 2008-2013 Sebastien Vincent <seb...@tu...> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ */ /* - * Copyright (C) 2006-2011 Sebastien Vincent. + * Copyright (C) 2006-2013 Sebastien Vincent. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -49,7 +49,7 @@ * \file dbg.c * \brief Some routines to print debug message. * \author Sebastien Vincent - * \date 2006-2011 + * \date 2006-2013 */ #ifdef HAVE_CONFIG_H @@ -60,19 +60,12 @@ #include <stdarg.h> #include <stdlib.h> +#include <stdint.h> + #ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN #include <windows.h> -/* replacement for stdint.h */ -typedef __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; #else -#include <stdint.h> #include <sys/time.h> #endif @@ -106,21 +99,8 @@ va_start(args, format); vfprintf(stderr, format, args); va_end(args); - - /* - fprintf(stderr, "%02d:%02d:%02d.%06u [%s:%d] %s", tlt->tm_hour, - tlt->tm_min, tlt->tm_sec, (uint32_t)lt.tv_usec, file, line, msg); - */ } -void dbg_print_null(const char* f, int line, const char* format, ...) -{ - /* to avoid compilation warnings */ - (void)f; - (void)line; - (void)format; -} - void dbg_print_hexa(const char* f, int line, const char* buf, size_t len, const char* format, ...) { Modified: trunk/src/dbg.h =================================================================== --- trunk/src/dbg.h 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/dbg.h 2013-09-03 16:26:29 UTC (rev 239) @@ -1,6 +1,6 @@ /* * TurnServer - TURN server implementation. - * Copyright (C) 2008-2011 Sebastien Vincent <seb...@tu...> + * Copyright (C) 2008-2013 Sebastien Vincent <seb...@tu...> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ */ /* - * Copyright (C) 2006-2011 Sebastien Vincent. + * Copyright (C) 2006-2013 Sebastien Vincent. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -49,11 +49,11 @@ * \file dbg.h * \brief Some routines to print debug message. * \author Sebastien Vincent - * \date 2006-2011 + * \date 2006-2013 */ -#ifndef DBG_H -#define DBG_H +#ifndef VSUTILS_DBG_H +#define VSUTILS_DBG_H #ifdef HAVE_CONFIG_H #include <config.h> @@ -67,39 +67,49 @@ #include <sys/types.h> /** + * \def DBG_ATTR_FILE + * \brief Current file and line seperated with a comma. + */ +#define DBG_ATTR_FILE __FILE__, __LINE__ + +#if __STDC_VERSION__ >= 199901L /* C99 */ +/** + * \def DBG_ATTR_FUNC + * \brief Current file and line seperated with a comma. + */ +#define DBG_ATTR_FUNC __func__, __LINE__ + +/** * \def DBG_ATTR * \brief Current file and line seperated with a comma. */ -#define DBG_ATTR __FILE__, __LINE__ +#define DBG_ATTR DBG_ATTR_FUNC +#else +/** + * \def DBG_ATTR + * \brief Current file and line seperated with a comma. + */ +#define DBG_ATTR DBG_ATTR_FILE +#endif /** * \brief Print a debug message on stderr. - * \param f filename - * \param line line number - * \param format format of the output (similary to printf param) - * \param ... list of arguments + * \param f filename. + * \param line line number. + * \param format format of the output (similary to printf param). + * \param ... list of arguments. * \author Sebastien Vincent */ void dbg_print(const char* f, int line, const char* format, ...); /** - * \brief Print nothing! - * \param f filename - * \param line line number - * \param format format of the output (similary to printf param) - * \param ... list of arguments - * \author Sebastien Vincent - */ -void dbg_print_null(const char* f, int line, const char* format, ...); - -/** * \brief Print the content of a buffer in hexadecimal. - * \param f filename - * \param line line number - * \param buf buffer to print - * \param len size of the buffer - * \param format format of the output (similary to printf param) - * \param ... list of arguments + * \param f filename. + * \param line line number. + * \param buf buffer to print. + * \param len size of the buffer. + * \param format format of the output (similary to printf param). + * \param ... list of arguments. * \author Sebastien Vincent * \warning Remember to pass pointer when you cast an integer for buf param. */ @@ -139,8 +149,8 @@ /** * \def pthread_mutex_lock * \brief Print a debug message when pthread_mutex_lock function is used. - * \param x thread id (pthread_t type) - * \return 0 if success, a non nul value otherwise + * \param x thread id (pthread_t type). + * \return 0 if success, a non nul value otherwise. */ #define pthread_mutex_lock(x) \ do \ @@ -152,8 +162,8 @@ /** * \def pthread_mutex_unlock * \brief Print a debug message when pthread_mutex_unlock function is used. - * \param x thread id (pthread_t type) - * \return 0 if success, a non nul value otherwise + * \param x thread id (pthread_t type). + * \return 0 if success, a non nul value otherwise. */ #define pthread_mutex_unlock(x) \ do \ @@ -165,9 +175,9 @@ /** * \def pthread_join * \brief Print a debug message when pthread_join function is used. - * \param x thread id (pthread_t type) - * \param r return value of thread is stored in r (void** type) - * \return 0 if success, a non nul value otherwise + * \param x thread id (pthread_t type). + * \param r return value of thread is stored in r (void** type). + * \return 0 if success, a non nul value otherwise. */ #define pthread_join(x, r) \ do \ @@ -180,7 +190,7 @@ /** * \def pthread_exit * \brief Print a debug message when pthread_exit function is used. - * \param x thread id (pthread_t type) + * \param x thread id (pthread_t type). */ #define pthread_exit(x) \ do \ @@ -192,8 +202,8 @@ /** * \def pthread_cancel * \brief Print a debug message when pthread_exit function is used. - * \param x thread id (pthread_t type) - * \return 0 if success, a non nul value otherwise + * \param x thread id (pthread_t type). + * \return 0 if success, a non nul value otherwise. */ #define pthread_cancel(x) \ do \ @@ -207,5 +217,5 @@ } #endif -#endif /* DBG_H */ +#endif /* VSUTILS_DBG_H */ Modified: trunk/src/list.h =================================================================== --- trunk/src/list.h 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/list.h 2013-09-03 16:26:29 UTC (rev 239) @@ -1,6 +1,6 @@ /* * TurnServer - TURN server implementation. - * Copyright (C) 2008-2010 Sebastien Vincent <seb...@tu...> + * Copyright (C) 2008-2013 Sebastien Vincent <seb...@tu...> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ */ /* - * Copyright (C) 2006-2010 Sebastien Vincent. + * Copyright (C) 2006-2013 Sebastien Vincent. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -49,20 +49,18 @@ * \file list.h * \brief Doubly linked list management. * \author Sebastien Vincent - * \date 2006-2010 + * \date 2006-2013 */ -#ifndef LIST_H -#define LIST_H +#ifndef VSUTILS_LIST_H +#define VSUTILS_LIST_H #ifdef HAVE_CONFIG_H #include <config.h> #endif #if defined(_MSC_VER) && !defined(__cplusplus) -/* Microsoft compiler does not know inline - * keyword in a pure C program - */ +/* Microsoft compiler does not know inline keyword in a pure C program */ #define inline __inline #endif @@ -73,130 +71,191 @@ * \brief Doubly linked list implementation. * * Simple doubly linked list implementation inspired by include/linux/list.h. - * \note To use it: LIST_HEAD(name_variable) to declare the variable - * then always do INIT_LIST(name_variable). + * \code + * struct element + * { + * int id; + * struct list_head list; + * } + * + * struct list_head list; + * struct list_head* tmp = NULL; + * struct list_head* pos = NULL; + * struct element* el = (struct element*)malloc(sizeof(struct element)); + * struct element* el2 = (struct element*)malloc(sizeof(struct element)); + * struct element* el3 = (struct element*)malloc(sizeof(struct element)); + * + * if(!el || !el2 || !el3) + * { + * free(el); + * free(el2); + * free(el3); + * return; + * } + * + * el->id = 1; + * el2->id = 2; + * el3->id = 3; + * + * list_head_init(&list); + * list_head_add_tail(&list, &el->list); + * list_head_add_tail(&list, &el2->list); + * list_head_add_tail(&list, &el3->list); + * + * fprintf(stdout, "Size: %u\n", list_head_size(&list)); + * list_head_iterate_safe(&list, pos, tmp) + * { + * struct element* e = list_head_get(pos, struct element, list); + * fprintf(stdout, "Id: %d\n", e->id); + * } + * + * list_head_remove(&list, &el->list); + * free(el); + * fprintf(stdout, "Size: %u\n", list_head_size(&list)); + * + * list_head_iterate_safe(&list, pos, tmp) + * { + * struct element* e = list_head_get(pos, struct element, list); + * fprintf(stdout, "Id: %d\n", e->id); + * list_head_remove(&list, &e->list); + * free(e); + * } + * \endcode + * \note To use it simply: VSUTILS_LIST_HEAD(name_variable) to declare the variable. */ -typedef struct list_head +struct list_head { - struct list_head *next; /**< Next element in the list */ - struct list_head *prev; /**< Previous element in the list */ -}list_head; + struct list_head *next; /**< Next element in the list. */ + struct list_head *prev; /**< Previous element in the list. */ +}; /** - * \def INIT_LIST - * \brief Initialize a list. - * \param name the list to initialize + * \def VSUTILS_LIST_HEAD + * \brief Static initializer for a list head. + * \param name the variable name to initialize. */ -#define INIT_LIST(name) do { \ - (name).prev = &(name); \ - (name).next = &(name); \ -}while(0); +#define VSUTILS_LIST_HEAD(name) struct list_head name = {&name, &name} /** - * \def LIST_HEAD - * \brief Used to declare a doubly linked list. - * \param name name of list_head struct + * \def list_head_get + * \brief Get the element. + * \param item the list_head pointer item. + * \param type the type of the struct this is embedded in. + * \param member the name of the list_head struct within the struct. + * \return pointer on the structure for this entry. */ -#define LIST_HEAD(name) struct list_head name +#define list_head_get(item, type, member) \ + (type *)((char *)(item) - offsetof(type, member)) /** - * \def LIST_ADD - * \brief Add a new entry after the specified head. - * \param new_entry new entry to be added - * \param head list head to add it after + * \def list_head_iterate + * \brief Iterate over a list. + * \param list the list. + * \param pos a struct list_head pointer to use as a loop counter. */ -#define LIST_ADD(new_entry, head) do { \ - struct list_head* next = (head)->next; \ - next->prev = (new_entry); \ - (new_entry)->next = next; \ - (new_entry)->prev = (head); \ - (head)->next = (new_entry); \ -}while(0); +#define list_head_iterate(list, pos) \ + for((pos) = (list)->next ; (pos) != (list) ; (pos) = (pos)->next) /** - * \def LIST_ADD_TAIL - * \brief Add a new entry before the specified head. - * \param new_entry new entry to be added - * \param head list head to add it before + * \def list_head_iterate_safe + * \brief Thread safe version to iterate over a list. + * \param list the list. + * \param pos a struct list_head pointer to use as loop counter. + * \param n temporary variable. */ -#define LIST_ADD_TAIL(new_entry, head) do { \ - struct list_head* prev = (head)->prev; \ - (head)->prev = (new_entry); \ - (new_entry)->next = (head); \ - (new_entry)->prev = prev; \ - prev->next = (new_entry); \ -}while(0); +#define list_head_iterate_safe(list, pos, n) \ + for((pos) = (list)->next, (n) = (pos)->next ; (pos) != (list) ; \ + (pos) = (n), (n) = (pos)->next) /** - * \def LIST_DEL - * \brief Delete entry from list. - * \param rem pointer of the element to delete from the list - * \note list_empty on entry does not return true after this, the entry is - * in an undefined state. + * \brief Initialize list. + * \param list The list to initialize. */ -#define LIST_DEL(rem) do { \ - (rem)->next->prev = (rem)->prev; \ - (rem)->prev->next = (rem)->next; \ - (rem)->next = (rem); \ - (rem)->prev = (rem); \ -}while(0); +static inline void list_head_init(struct list_head* list) +{ + list->prev = list; + list->next = list; +} /** - * \def LIST_EMPTY - * \brief Return whether or not the list is empty. - * \param head pointer on the list to test - * \return 1 if empty, 0 otherwise + * \brief Add a new entry after the specified list. + * \param list the list. + * \param item new entry to be added. + * \note in case several entries are added in the same list, they will + * be added in reverse order: 1, 2, 3 are added but iterate over the list will + * show 3, 2, 1. */ -#define LIST_EMPTY(head) \ - ((head)->next == (head)) +static inline void list_head_add(struct list_head* list, + struct list_head* item) +{ + struct list_head* next = list->next; + next->prev = item; + item->next = next; + item->prev = list; + list->next = item; +} /** - * \def list_get - * \brief Get the element. - * \param ptr the list_head pointer - * \param type the type of the struct this is embedded in - * \param member the name of the list_struct within the struct - * \return pointer on the structure for this entry + * \brief Add a new entry before the specified head. + * \param list the list. + * \param item new entry to be added. + * \note in case several entries are added in the same list, they will + * be added in same order: 1, 2, 3 are added and iterate over the list will + * show 1, 2, 3. */ -#define list_get(ptr, type, member) \ - (type *)((char *)(ptr) - offsetof(type, member)) +static inline void list_head_add_tail(struct list_head* list, + struct list_head* item) +{ + struct list_head* prev = list->prev; + list->prev = item; + item->next = list; + item->prev = prev; + prev->next = item; +} /** - * \def list_iterate - * \brief Iterate over a list. - * \param pos the &struct list_head to use as a loop counter - * \param head the head for your list + * \brief Remove entry from list. + * \param list the list. + * \param item pointer of the element to remove from the list. + * \note list_head_empty on item does not return true after this, the entry is + * in an undefined state. */ -#define list_iterate(pos, head) \ - for((pos) = (head)->next ; (pos) != (head) ; (pos) = (pos)->next) +static inline void list_head_remove(struct list_head* list, + struct list_head* item) +{ + (void)list; + item->next->prev = item->prev; + item->prev->next = item->next; + item->next = item; + item->prev = item; +} /** - * \def list_iterate_safe - * \brief Thread safe version to iterate over a list. - * \param pos pointer on a list_head struct - * \param n temporary variable - * \param head the list. + * \brief Return whether or not the list is empty. + * \param list the list. + * \return 1 if empty, 0 otherwise. */ -#define list_iterate_safe(pos, n, head) \ - for((pos) = (head)->next, (n) = (pos)->next ; (pos) != (head) ; \ - (pos) = (n), (n) = (pos)->next) +static inline int list_head_is_empty(struct list_head* list) +{ + return list->next == list; +} /** * \brief Get the number of element in the list. - * \param head the list + * \param list the list * \return size of the list */ -static inline unsigned int list_size(struct list_head* head) +static inline unsigned int list_head_size(struct list_head* list) { struct list_head* lp = NULL; unsigned int size = 0; - list_iterate(lp, head) + list_head_iterate(list, lp) { size++; } return size; } -#endif /* LIST_H */ +#endif /* VSUTILS_LIST_H */ Modified: trunk/src/mod_tmpuser.c =================================================================== --- trunk/src/mod_tmpuser.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/mod_tmpuser.c 2013-09-03 16:26:29 UTC (rev 239) @@ -137,10 +137,10 @@ int tmpuser_init(struct list_head* account_list) { - INIT_LIST(g_tmpuser.client_list); + list_head_init(&g_tmpuser.client_list); g_tmpuser.account_list = NULL; - g_tmpuser.sock = socket_create(TCP, "localhost", 8086, 0, 1); + g_tmpuser.sock = net_socket_create(TCP, "localhost", 8086, 0, 1); if(g_tmpuser.sock == -1) { @@ -172,13 +172,13 @@ void tmpuser_add_tcp_client(struct socket_desc* desc) { struct list_head* l = (struct list_head*)&desc->list; - LIST_ADD(l, &g_tmpuser.client_list); + list_head_add(l, &g_tmpuser.client_list); } void tmpuser_remove_tcp_client(struct socket_desc* desc) { struct list_head* l = (struct list_head*)&desc->list; - LIST_DEL(l); + list_head_remove(l, l); } int tmpuser_process_msg(const char* buf, ssize_t len) @@ -290,9 +290,9 @@ close(g_tmpuser.sock); } - list_iterate_safe(get, n, &g_tmpuser.client_list) + list_head_iterate_safe(&g_tmpuser.client_list, get, n) { - struct socket_desc* tmp = list_get(get, struct socket_desc, list); + struct socket_desc* tmp = list_head_get(get, struct socket_desc, list); if(tmp->sock) { @@ -308,6 +308,6 @@ */ g_tmpuser.account_list = NULL; - INIT_LIST(g_tmpuser.client_list); + list_head_init(&g_tmpuser.client_list); } Modified: trunk/src/protocol.c =================================================================== --- trunk/src/protocol.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/protocol.c 2013-09-03 16:26:29 UTC (rev 239) @@ -48,6 +48,7 @@ #include <openssl/hmac.h> #include "util_sys.h" +#include "util_net.h" #include "util_crypto.h" #include "protocol.h" @@ -520,7 +521,7 @@ ret->turn_attr_type = htons(STUN_ATTR_ERROR_CODE); ret->turn_attr_len = htons(4 + real_len); - if(is_little_endian()) + if(sys_is_little_endian()) { ret->turn_attr_reserved_class = class << 16; } @@ -945,7 +946,7 @@ /* error-code */ if(!(attr = turn_attr_error_create(400, STUN_ERROR_400, sizeof(STUN_ERROR_400), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -972,7 +973,7 @@ if(!(attr = turn_attr_error_create(401, STUN_ERROR_401, sizeof(STUN_ERROR_401), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -981,7 +982,7 @@ /* realm */ if(!(attr = turn_attr_realm_create(realm, strlen(realm), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -990,7 +991,7 @@ /* nonce */ if(!(attr = turn_attr_nonce_create(nonce, nonce_len, &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1017,7 +1018,7 @@ if(!(attr = turn_attr_error_create(420, STUN_ERROR_420, sizeof(STUN_ERROR_420), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1052,7 +1053,7 @@ if(!(attr = turn_attr_error_create(438, STUN_ERROR_438, sizeof(STUN_ERROR_438), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1061,7 +1062,7 @@ /* realm */ if(!(attr = turn_attr_realm_create(realm, strlen(realm), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1070,7 +1071,7 @@ /* nonce */ if(!(attr = turn_attr_nonce_create(nonce, nonce_len, &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1096,7 +1097,7 @@ if(!(attr = turn_attr_error_create(500, STUN_ERROR_500, sizeof(STUN_ERROR_500), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1122,7 +1123,7 @@ if(!(attr = turn_attr_error_create(403, TURN_ERROR_403, sizeof(TURN_ERROR_403), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1148,7 +1149,7 @@ if(!(attr = turn_attr_error_create(437, TURN_ERROR_437, sizeof(TURN_ERROR_437), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1174,7 +1175,7 @@ if(!(attr = turn_attr_error_create(440, TURN_ERROR_440, sizeof(TURN_ERROR_440), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1200,7 +1201,7 @@ if(!(attr = turn_attr_error_create(441, TURN_ERROR_441, sizeof(TURN_ERROR_441), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1226,7 +1227,7 @@ if(!(attr = turn_attr_error_create(442, TURN_ERROR_442, sizeof(TURN_ERROR_442), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1252,7 +1253,7 @@ if(!(attr = turn_attr_error_create(443, TURN_ERROR_443, sizeof(TURN_ERROR_443), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1278,7 +1279,7 @@ if(!(attr = turn_attr_error_create(446, TURN_ERROR_446, sizeof(TURN_ERROR_446), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1304,7 +1305,7 @@ if(!(attr = turn_attr_error_create(447, TURN_ERROR_447, sizeof(TURN_ERROR_447), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1330,7 +1331,7 @@ if(!(attr = turn_attr_error_create(486, TURN_ERROR_486, sizeof(TURN_ERROR_486), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1356,7 +1357,7 @@ if(!(attr = turn_attr_error_create(508, TURN_ERROR_508, sizeof(TURN_ERROR_508), &iov[*idx]))) { - iovec_free_data(iov, *idx); + net_iovec_free_data(iov, *idx); return NULL; } error->turn_msg_len += iov[*idx].iov_len; @@ -1456,7 +1457,7 @@ int turn_generate_transaction_id(uint8_t* id) { /* 96 bit transaction ID */ - return random_bytes_generate(id, 12); + return crypto_random_bytes_generate(id, 12); } int turn_calculate_authentication_key(const char* username, const char* realm, @@ -1541,7 +1542,7 @@ t += TURN_DEFAULT_NONCE_LIFETIME; t = (time_t)htonl((uint32_t)t); - hex_convert((unsigned char*)&t, sizeof(time_t), nonce, sizeof(time_t) * 2); + sys_convert_to_hex((unsigned char*)&t, sizeof(time_t), nonce, sizeof(time_t) * 2); if(sizeof(time_t) == 4) /* 32 bit */ { @@ -1554,7 +1555,7 @@ MD5_Final(md_buf, &ctx); /* add MD5 at the end of the nonce */ - hex_convert(md_buf, MD5_DIGEST_LENGTH, nonce + 16, len - 16); + sys_convert_to_hex(md_buf, MD5_DIGEST_LENGTH, nonce + 16, len - 16); return 0; } @@ -1577,12 +1578,12 @@ if(sizeof(time_t) == 4) /* 32 bits */ { - uint32_convert(nonce, sizeof(time_t) * 2, &ct); + sys_convert_to_uint32(nonce, sizeof(time_t) * 2, &ct); memcpy(&t, &ct, 4); } else { - uint64_convert(nonce, sizeof(time_t) * 2, &ct64); + sys_convert_to_uint64(nonce, sizeof(time_t) * 2, &ct64); memcpy(&t, &ct64, 8); } @@ -1592,7 +1593,7 @@ MD5_Update(&ctx, key, key_len); MD5_Final(md_buf, &ctx); - hex_convert(md_buf, MD5_DIGEST_LENGTH, md_txt, sizeof(md_txt)); + sys_convert_to_hex(md_buf, MD5_DIGEST_LENGTH, md_txt, sizeof(md_txt)); if(memcmp(md_txt, nonce + 16, (MD5_DIGEST_LENGTH * 2)) != 0) { @@ -1616,7 +1617,7 @@ for(i = 0 ; i < iovlen ; i++) { - crc = crc32_generate(iov[i].iov_base, iov[i].iov_len, crc); + crc = crypto_crc32_generate(iov[i].iov_base, iov[i].iov_len, crc); } return crc; Modified: trunk/src/test_echo_server.c =================================================================== --- trunk/src/test_echo_server.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/test_echo_server.c 2013-09-03 16:26:29 UTC (rev 239) @@ -45,6 +45,7 @@ #include <sys/socket.h> #include <sys/select.h> +#include "util_net.h" #include "tls_peer.h" /** @@ -107,13 +108,13 @@ } /* try to bind on all addresses (IPv6+IPv4 mode) */ - sock = socket_create(IPPROTO_UDP, "::", port, 0, 0); + sock = net_socket_create(IPPROTO_UDP, "::", port, 0, 0); if(sock == -1) { perror("socket"); fprintf(stderr, "Maybe IPv6 is not available, try IPv4 only mode\n"); - sock = socket_create(IPPROTO_UDP, "0.0.0.0", port, 0, 1); + sock = net_socket_create(IPPROTO_UDP, "0.0.0.0", port, 0, 1); } if(sock == -1) Modified: trunk/src/test_turn_client.c =================================================================== --- trunk/src/test_turn_client.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/test_turn_client.c 2013-09-03 16:26:29 UTC (rev 239) @@ -81,6 +81,7 @@ #include "util_sys.h" #include "util_crypto.h" +#include "util_net.h" #include "protocol.h" #include "tls_peer.h" @@ -332,7 +333,7 @@ } else if(sock) { - *sock = socket_create(transport_protocol, addr, port, 0, 1); + *sock = net_socket_create(transport_protocol, addr, port, 0, 1); return (*sock != -1) ? 0 : -1; } @@ -481,7 +482,7 @@ /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } } @@ -493,11 +494,11 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); nb = client_recv_message(transport_protocol, sock, speer, buf, sizeof(buf)); @@ -591,7 +592,7 @@ /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } @@ -601,11 +602,11 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); nb = client_recv_message(transport_protocol, sock, speer, buf, sizeof(buf)); @@ -692,7 +693,7 @@ /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } @@ -702,11 +703,11 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); nb = client_recv_message(transport_protocol, sock, speer, buf, sizeof(buf)); @@ -801,7 +802,7 @@ /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } @@ -811,11 +812,11 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); nb = client_recv_message(transport_protocol, sock, speer, buf, sizeof(buf)); @@ -914,7 +915,7 @@ /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } @@ -924,11 +925,11 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); nb = client_recv_message(transport_protocol, sock, speer, buf, sizeof(buf)); @@ -985,7 +986,7 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } @@ -1070,7 +1071,7 @@ /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } @@ -1080,11 +1081,11 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); index = 0; nb = client_recv_message(transport_protocol, sock, speer, buf, sizeof(buf)); @@ -1159,7 +1160,7 @@ /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } @@ -1169,10 +1170,10 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); nb = client_recv_message(transport_protocol, *sock_tcp, NULL, buf, sizeof(buf)); @@ -1229,8 +1230,8 @@ tv.tv_sec = 10; /* 10 seconds before timeout */ tv.tv_usec = 0; - SFD_ZERO(&fdsr); - SFD_SET(sock, &fdsr); + NET_SFD_ZERO(&fdsr); + NET_SFD_SET(sock, &fdsr); nsock = sock + 1; @@ -1317,7 +1318,7 @@ /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } @@ -1327,11 +1328,11 @@ { fprintf(stderr, "Send failed!\n"); perror("send"); - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return -1; } - iovec_free_data(iov, index); + net_iovec_free_data(iov, index); return 0; } @@ -1561,8 +1562,9 @@ exit(EXIT_FAILURE); } - snprintf((char*)userdomainpass, userdomainpass_len, "%s:%s:%s", user, domain, password); - md5_generate(md_buf, userdomainpass, userdomainpass_len - 1); + snprintf((char*)userdomainpass, userdomainpass_len, "%s:%s:%s", user, domain, + password); + crypto_md5_generate(md_buf, userdomainpass, userdomainpass_len - 1); /* client connected and can send TURN message */ fprintf(stdout, "sock: %d speer: %p connected!\n", sock, (void*)speer); Modified: trunk/src/tls_peer.c =================================================================== --- trunk/src/tls_peer.c 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/tls_peer.c 2013-09-03 16:26:29 UTC (rev 239) @@ -1,6 +1,6 @@ /* * TurnServer - TURN server implementation. - * Copyright (C) 2008-2011 Sebastien Vincent <seb...@tu...> + * Copyright (C) 2008-2013 Sebastien Vincent <seb...@tu...> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ */ /* - * Copyright (C) 2008-2011 Sebastien Vincent. + * Copyright (C) 2008-2013 Sebastien Vincent. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -52,7 +52,7 @@ * \file tls_peer.c * \brief TLS and DTLS peer implementation. * \author Sebastien Vincent - * \date 2008-2011 + * \date 2008-2013 */ #ifdef HAVE_CONFIG_H @@ -73,11 +73,6 @@ #include <arpa/inet.h> #include <netdb.h> -#elif defined(_MSC_VER) -/* Microsoft compiler does not want users - * to use snprintf directly... - */ -#define snprintf _snprintf #endif #include <openssl/evp.h> @@ -86,20 +81,9 @@ #include <openssl/pkcs7.h> #include <openssl/x509v3.h> +#include "util_net.h" #include "tls_peer.h" -/* macro should be declared in netinet/in.h even in POSIX compilation - * but it appeared that it is not defined on some BSD system - */ -#ifndef IPPROTO_IPV6 -#define IPPROTO_IPV6 41 -#endif - -/* MinGW does not define IPV6_V6ONLY */ -#ifndef IPV6_V6ONLY -#define IPV6_V6ONLY 27 -#endif - #ifdef __cplusplus extern "C" { /* } */ @@ -115,15 +99,15 @@ */ struct ssl_peer { - SSL* ssl; /**< The remote peer */ - int handshake_complete; /**< State of the handshake */ - struct sockaddr_storage addr; /**< Socket address */ - struct list_head list; /**< For list management */ + SSL* ssl; /**< The remote peer. */ + int handshake_complete; /**< State of the handshake. */ + struct sockaddr_storage addr; /**< Socket address. */ + struct list_head list; /**< For list management. */ }; /** * \brief Free a SSL peer. - * \param peer the SSL peer + * \param peer the SSL peer. */ static void ssl_peer_free(struct ssl_peer** peer) { @@ -138,10 +122,10 @@ /** * \brief Create a new SSL peer. - * \param addr socket address - * \param addrlen sizeof address + * \param addr socket address. + * \param addrlen sizeof address. * \param ssl SSL instance - * \return valid pointer on ssl_peer, NULL if failure + * \return valid pointer on ssl_peer, NULL if failure. */ static struct ssl_peer* ssl_peer_new(struct sockaddr* addr, socklen_t addrlen, SSL* ssl) @@ -163,10 +147,10 @@ /** * \brief Find the specified ssl_peer that match address. - * \param peer (D)TLS peer instance - * \param addr socket address client to find - * \param addrlen sizeof addr - * \return a valid ssl_peer pointer or NULL if not found + * \param peer (D)TLS peer instance. + * \param addr socket address client to find. + * \param addrlen sizeof addr. + * \return a valid ssl_peer pointer or NULL if not found. */ static struct ssl_peer* tls_peer_find_connection(struct tls_peer* peer, const struct sockaddr* addr, socklen_t addrlen) @@ -174,11 +158,11 @@ struct list_head* n = NULL; struct list_head* get = NULL; - list_iterate_safe(get, n, &peer->remote_peers) + list_head_iterate_safe(&peer->remote_peers, get, n) { struct ssl_peer* tmp = NULL; - tmp = list_get(get, struct ssl_peer, list); + tmp = list_head_get(get, struct ssl_peer, list); if(!memcmp(&tmp->addr, addr, addrlen)) { return tmp; @@ -189,13 +173,13 @@ /** * \brief Add a ssl_peer. - * \param peer (D)TLS peer - * \param speer ssl_peer client + * \param peer (D)TLS peer. + * \param speer ssl_peer client. */ static void tls_peer_add_connection(struct tls_peer* peer, struct ssl_peer* speer) { - LIST_ADD_TAIL(&speer->list, &peer->remote_peers); + list_head_add_tail(&peer->remote_peers, &speer->list); } /** @@ -206,26 +190,23 @@ static void tls_peer_remove_connection(struct tls_peer* peer, struct ssl_peer* ssl) { - /* to avoid compilation warnings */ - (void)peer; - - LIST_DEL(&ssl->list); + list_head_remove(&peer->remote_peers, &ssl->list); ssl_peer_free(&ssl); } /** * \brief Remove (and free) all connections from the peer. - * \param peer (D)TLS peer + * \param peer (D)TLS peer. */ static void tls_peer_clear_connection(struct tls_peer* peer) { struct list_head* n = NULL; struct list_head* get = NULL; - list_iterate_safe(get, n, &peer->remote_peers) + list_head_iterate_safe(&peer->remote_peers, get, n) { struct ssl_peer* tmp = NULL; - tmp = list_get(get, struct ssl_peer, list); + tmp = list_head_get(get, struct ssl_peer, list); tls_peer_remove_connection(peer, tmp); return; } @@ -233,9 +214,9 @@ /** * \brief Manage (D)TLS peer according to the error. - * \param peer (D)TLS peer - * \param ssl SSL peer concerned - * \param err the error number + * \param peer (D)TLS peer. + * \param ssl SSL peer concerned. + * \param err the error number. */ static void tls_peer_manage_error(struct tls_peer* peer, struct ssl_peer* ssl, int err) @@ -245,7 +226,7 @@ case SSL_ERROR_NONE: break; case SSL_ERROR_SSL: - fprintf(stderr, "SSL_ERROR_SSL: %s\n", + fprintf(stderr, "SSL_ERROR_SSL: %s\n", ERR_reason_error_string(ERR_get_error())); /* big problem, remove the connection */ tls_peer_remove_connection(peer, ssl); @@ -279,15 +260,15 @@ /** * \brief Load the certificates material in a context. - * \param ctx the context - * \param ca_file Certification Authority file - * \param cert_file certificate file - * \param key_file private key file - * \param verify_callback certificate verification callback - * \return 0 if success, -1 otherwise + * \param ctx the context. + * \param ca_file Certification Authority file. + * \param cert_file certificate file. + * \param key_file private key file. + * \param verify_callback certificate verification callback. + * \return 0 if success, -1 otherwise. */ static int tls_peer_load_certificates(SSL_CTX* ctx, const char* ca_file, - const char* cert_file, const char* key_file, + const char* cert_file, const char* key_file, int (*verify_callback)(int, X509_STORE_CTX *)) { if(SSL_CTX_set_cipher_list(ctx, "DEFAULT") != 1) @@ -320,16 +301,16 @@ /** * \brief Setup a (D)TLS peer. - * \param peer tls_peer instance to setup - * \param type UDP or TCP - * \param addr Network address - * \param port port - * \param ca_file certification authorities file - * \param cert_file certificate file - * \param key_file private key file - * \return 0 if success, -1 otherwise + * \param peer tls_peer instance to setup. + * \param type UDP or TCP. + * \param addr Network address. + * \param port port. + * \param ca_file certification authorities file. + * \param cert_file certificate file. + * \param key_file private key file. + * \return 0 if success, -1 otherwise. * \note If returns -1, the caller must call tls_peer_free() as some memory - * could be allocated + * could be allocated. */ static int tls_peer_setup(struct tls_peer* peer, enum protocol_type type, const char* addr, uint16_t port, const char* ca_file, const char* cert_file, @@ -340,7 +321,7 @@ SSL_METHOD* method_client = NULL; /* initialize list */ - INIT_LIST(peer->remote_peers); + list_head_init(&peer->remote_peers); if(type == UDP) { @@ -393,7 +374,7 @@ SSL_CTX_set_client_CA_list(peer->ctx_server, calist); } - peer->sock = socket_create(type, addr, port, 0, 0); + peer->sock = net_socket_create(type, addr, port, 0, 0); peer->type = type; return (peer->sock > 0) ? 0 : -1; @@ -401,13 +382,13 @@ /** * \brief Read a (D)TLS message. - * \param peer (D)TLS peer - * \param buf in buffer - * \param buflen in buffer length - * \param bufout out buffer - * \param bufoutlen out buffer length - * \param speer SSL peer - * \return number of bytes read or -1 if error or handshake not finalized + * \param peer (D)TLS peer. + * \param buf in buffer. + * \param buflen in buffer length. + * \param bufout out buffer. + * \param bufoutlen out buffer length. + * \param speer SSL peer. + * \return number of bytes read or -1 if error or handshake not finalized. */ static ssize_t tls_peer_read(struct tls_peer* peer, char* buf, ssize_t buflen, char* bufout, ssize_t bufoutlen, struct ssl_peer* speer) @@ -444,13 +425,13 @@ /** * \brief Verify certificate chain. - * \param ssl SSL pointer - * \return 1 if certificate verification is OK, 0 otherwise + * \param ssl SSL pointer. + * \return 1 if certificate verification is OK, 0 otherwise. */ static int verify_certificate(SSL* ssl) { X509* x509 = SSL_get_peer_certificate(ssl); - + if(x509) { if(SSL_get_verify_result(ssl) != X509_V_OK) @@ -461,7 +442,7 @@ return 1; } - + return 1; } @@ -471,12 +452,12 @@ struct list_head* get = NULL; char buf[INET6_ADDRSTRLEN]; - fprintf(stdout, "Current peer information (List size = %u)\n", - list_size(&peer->remote_peers)); + fprintf(stdout, "Current peer informations (List size = %u)\n", + list_head_size(&peer->remote_peers)); - list_iterate_safe(get, n, &peer->remote_peers) + list_head_iterate_safe(&peer->remote_peers, get, n) { - struct ssl_peer* tmp = list_get(get, struct ssl_peer, list); + struct ssl_peer* tmp = list_head_get(get, struct ssl_peer, list); if(getnameinfo((struct sockaddr*)&tmp->addr, sizeof(tmp->addr), buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST) != 0) @@ -515,8 +496,8 @@ FD_ZERO(&fdsr); FD_SET(peer->sock, &fdsr); - /* 4 seconds of timeout */ - tv.tv_sec = 4; + /* 5 seconds of timeout */ + tv.tv_sec = 5; tv.tv_usec = 0; nsock = peer->sock; @@ -692,7 +673,7 @@ SSL* ssl = SSL_new(peer->ctx_client); SSL_set_connect_state(ssl); - + if(!verify_certificate(ssl)) { SSL_free(ssl); @@ -778,70 +759,6 @@ return 0; } -int socket_create(enum protocol_type type, const char* addr, uint16_t port, - int reuse, int nodelay) -{ - int sock = -1; - struct addrinfo hints; - struct addrinfo* res = NULL; - struct addrinfo* p = NULL; - char service[8]; - - snprintf(service, sizeof(service), "%u", port); - service[sizeof(service)-1] = 0x00; - - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = (type == TCP ? SOCK_STREAM : SOCK_DGRAM); - hints.ai_protocol = (type == TCP ? IPPROTO_TCP : IPPROTO_UDP); - hints.ai_flags = AI_PASSIVE; - - if(getaddrinfo(addr, service, &hints, &res) != 0) - { - return -1; - } - - for(p = res ; p ; p = p->ai_next) - { - int on = 1; - - sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol); - if(sock == -1) - { - continue; - } - - if(reuse) - { - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(int)); - } - - if (type == TCP && nodelay) - { - setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(int)); - } - - /* accept IPv6 and IPv4 on the same socket */ - on = 0; - setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(int)); - - if(bind(sock, p->ai_addr, p->ai_addrlen) == -1) - { - close(sock); - sock = -1; - continue; - } - - /* socket bound, break the loop */ - break; - } - - freeaddrinfo(res); - p = NULL; - - return sock; -} - void tls_peer_free(struct tls_peer** peer) { struct tls_peer* ret = *peer; Modified: trunk/src/tls_peer.h =================================================================== --- trunk/src/tls_peer.h 2013-06-14 16:27:09 UTC (rev 238) +++ trunk/src/tls_peer.h 2013-09-03 16:26:29 UTC (rev 239) @@ -1,6 +1,6 @@ /* * TurnServer - TURN server implementation. - * Copyright (C) 2008-2011 Sebastien Vincent <seb...@tu...> + * Copyright (C) 2008-2013 Sebastien Vincent <seb...@tu...> * * This program is free software: you can redistribute it... [truncated message content] |
From: <s-v...@us...> - 2013-06-14 16:27:11
|
Revision: 238 http://sourceforge.net/p/turnserver/code/238 Author: s-vincent Date: 2013-06-14 16:27:09 +0000 (Fri, 14 Jun 2013) Log Message: ----------- Prepare for future release. Modified Paths: -------------- trunk/ChangeLog trunk/configure.in Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2013-06-14 16:24:38 UTC (rev 237) +++ trunk/ChangeLog 2013-06-14 16:27:09 UTC (rev 238) @@ -1,3 +1,7 @@ +2013-xx-xx Sebastien Vincent <seb...@tu...> + + * Version 0.8 - + 2013-06-14 Sebastien Vincent <seb...@tu...> * Version 0.7.3 - Minor fix to be able to compile with recent glibc. Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2013-06-14 16:24:38 UTC (rev 237) +++ trunk/configure.in 2013-06-14 16:27:09 UTC (rev 238) @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([turnserver],[0.7.3],[http://www.turnserver.org/]) +AC_INIT([turnserver],[0.8],[http://www.turnserver.org/]) AC_CONFIG_SRCDIR([src/turn.h]) AC_CONFIG_HEADER([config.h]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2013-06-14 16:22:09
|
Revision: 236 http://sourceforge.net/p/turnserver/code/236 Author: s-vincent Date: 2013-06-14 16:22:06 +0000 (Fri, 14 Jun 2013) Log Message: ----------- Prepare 0.7.3 release. Modified Paths: -------------- trunk/ChangeLog trunk/configure.in Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2013-05-29 16:39:45 UTC (rev 235) +++ trunk/ChangeLog 2013-06-14 16:22:06 UTC (rev 236) @@ -1,10 +1,10 @@ -2012-xx-xx Sebastien Vincent <seb...@tu...> +2013-06-14 Sebastien Vincent <seb...@tu...> - * Version 0.8 - + * Version 0.7.3 - Minor fix to be able to compile with recent glibc. -2012-11-19 Daniel Pocock <da...@po...> +2012-11-19 Daniel Pocock <da...@po...> - * Version 0.7.2 - Further tweaks to autotools + * Version 0.7.2 - Further tweaks to autotools 2012-10-17 Sebastien Vincent <seb...@tu...> Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2013-05-29 16:39:45 UTC (rev 235) +++ trunk/configure.in 2013-06-14 16:22:06 UTC (rev 236) @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([turnserver],[0.8],[http://www.turnserver.org/]) +AC_INIT([turnserver],[0.7.3],[http://www.turnserver.org/]) AC_CONFIG_SRCDIR([src/turn.h]) AC_CONFIG_HEADER([config.h]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2013-05-29 16:39:47
|
Revision: 235 http://sourceforge.net/p/turnserver/code/235 Author: s-vincent Date: 2013-05-29 16:39:45 +0000 (Wed, 29 May 2013) Log Message: ----------- Adds _SVID_SOURCE compilation flag as a temporary workaround for broken IN6_IS_ADDR* macro (with strict C99/POSIX compilation) in glibc >= 2.15. Modified Paths: -------------- trunk/src/Makefile.am Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2013-03-26 17:06:14 UTC (rev 234) +++ trunk/src/Makefile.am 2013-05-29 16:39:45 UTC (rev 235) @@ -1,4 +1,4 @@ -AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -Wstrict-prototypes -Wredundant-decls -Wshadow -pedantic -fno-strict-aliasing -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -O2 +AM_CFLAGS = -std=c99 -Wall -Wextra -Werror -Wstrict-prototypes -Wredundant-decls -Wshadow -pedantic -fno-strict-aliasing -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -O2 -D_SVID_SOURCE if ENABLE_DEBUG_BUILD AM_CFLAGS += -g This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Sebastien V. <se...@ji...> - 2013-05-06 11:09:19
|
Hi, It is not possible. RFC5766 requires usage of authentication. A solution can be to setup a user in TurnServer, named anonymous for example, and gives its credentials to clients. Regards, -- Seb Le lundi 6 mai 2013, Mr.Surender Reddy <gvs...@gm...> a écrit : > Hello > I would like to know if i can run Tuneserver without authentication as below > TURN Server with no-auth option allows anonymous access. > > Regards > Surender |
From: Mr.Surender R. <gvs...@gm...> - 2013-05-05 22:16:08
|
Hello I would like to know if i can run Tuneserver without authentication as below TURN Server with no-auth option allows anonymous access. Regards Surender |
From: <s-v...@us...> - 2013-03-26 17:06:16
|
Revision: 234 http://sourceforge.net/p/turnserver/code/234 Author: s-vincent Date: 2013-03-26 17:06:14 +0000 (Tue, 26 Mar 2013) Log Message: ----------- Rename index to idx (if we define _BSD_SOURCE it causes problem because of index() function). Modified Paths: -------------- trunk/src/protocol.c trunk/src/turnserver.c Modified: trunk/src/protocol.c =================================================================== --- trunk/src/protocol.c 2013-03-02 07:55:15 UTC (rev 233) +++ trunk/src/protocol.c 2013-03-26 17:06:14 UTC (rev 234) @@ -930,437 +930,437 @@ } struct turn_msg_hdr* turn_error_response_400(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ - if(!(attr = turn_attr_error_create(400, STUN_ERROR_400, sizeof(STUN_ERROR_400), &iov[*index]))) + if(!(attr = turn_attr_error_create(400, STUN_ERROR_400, sizeof(STUN_ERROR_400), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_401(int method, const uint8_t* id, const char* realm, const uint8_t* nonce, size_t nonce_len, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(401, STUN_ERROR_401, - sizeof(STUN_ERROR_401), &iov[*index]))) + sizeof(STUN_ERROR_401), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; /* realm */ - if(!(attr = turn_attr_realm_create(realm, strlen(realm), &iov[*index]))) + if(!(attr = turn_attr_realm_create(realm, strlen(realm), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; /* nonce */ - if(!(attr = turn_attr_nonce_create(nonce, nonce_len, &iov[*index]))) + if(!(attr = turn_attr_nonce_create(nonce, nonce_len, &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_420(int method, const uint8_t* id, const uint16_t* unknown, size_t unknown_size, struct iovec* iov, - size_t* index) + size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(420, STUN_ERROR_420, - sizeof(STUN_ERROR_420), &iov[*index]))) + sizeof(STUN_ERROR_420), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; if(!(attr = turn_attr_unknown_attributes_create(unknown, unknown_size, - &iov[*index]))) + &iov[*idx]))) { return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_438(int method, const uint8_t* id, const char* realm, const uint8_t* nonce, size_t nonce_len, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(438, STUN_ERROR_438, - sizeof(STUN_ERROR_438), &iov[*index]))) + sizeof(STUN_ERROR_438), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; /* realm */ - if(!(attr = turn_attr_realm_create(realm, strlen(realm), &iov[*index]))) + if(!(attr = turn_attr_realm_create(realm, strlen(realm), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; /* nonce */ - if(!(attr = turn_attr_nonce_create(nonce, nonce_len, &iov[*index]))) + if(!(attr = turn_attr_nonce_create(nonce, nonce_len, &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_500(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(500, STUN_ERROR_500, - sizeof(STUN_ERROR_500), &iov[*index]))) + sizeof(STUN_ERROR_500), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_403(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(403, TURN_ERROR_403, - sizeof(TURN_ERROR_403), &iov[*index]))) + sizeof(TURN_ERROR_403), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_437(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(437, TURN_ERROR_437, - sizeof(TURN_ERROR_437), &iov[*index]))) + sizeof(TURN_ERROR_437), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_440(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(440, TURN_ERROR_440, - sizeof(TURN_ERROR_440), &iov[*index]))) + sizeof(TURN_ERROR_440), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_441(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(441, TURN_ERROR_441, - sizeof(TURN_ERROR_441), &iov[*index]))) + sizeof(TURN_ERROR_441), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_442(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(442, TURN_ERROR_442, - sizeof(TURN_ERROR_442), &iov[*index]))) + sizeof(TURN_ERROR_442), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_443(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(443, TURN_ERROR_443, - sizeof(TURN_ERROR_443), &iov[*index]))) + sizeof(TURN_ERROR_443), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_446(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(446, TURN_ERROR_446, - sizeof(TURN_ERROR_446), &iov[*index]))) + sizeof(TURN_ERROR_446), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_447(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(447, TURN_ERROR_447, - sizeof(TURN_ERROR_447), &iov[*index]))) + sizeof(TURN_ERROR_447), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_486(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(486, TURN_ERROR_486, - sizeof(TURN_ERROR_486), &iov[*index]))) + sizeof(TURN_ERROR_486), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } struct turn_msg_hdr* turn_error_response_508(int method, const uint8_t* id, - struct iovec* iov, size_t* index) + struct iovec* iov, size_t* idx) { struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; /* header */ - if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*index]))) + if(!(error = turn_msg_create(method | STUN_ERROR_RESP, 0, id, &iov[*idx]))) { return NULL; } - (*index)++; + (*idx)++; /* error-code */ if(!(attr = turn_attr_error_create(508, TURN_ERROR_508, - sizeof(TURN_ERROR_508), &iov[*index]))) + sizeof(TURN_ERROR_508), &iov[*idx]))) { - iovec_free_data(iov, *index); + iovec_free_data(iov, *idx); return NULL; } - error->turn_msg_len += iov[*index].iov_len; - (*index)++; + error->turn_msg_len += iov[*idx].iov_len; + (*idx)++; return error; } @@ -1622,38 +1622,38 @@ return crc; } -int turn_add_message_integrity(struct iovec* iov, size_t* index, +int turn_add_message_integrity(struct iovec* iov, size_t* idx, const unsigned char* key, size_t key_len, int add_fingerprint) { struct turn_attr_hdr* attr = NULL; struct turn_msg_hdr* hdr = iov[0].iov_base; - if(*index == 0) + if(*idx == 0) { /* could not place message-integrity or fingerprint in first place */ return -1; } - if(!(attr = turn_attr_message_integrity_create(NULL, &iov[*index]))) + if(!(attr = turn_attr_message_integrity_create(NULL, &iov[*idx]))) { return -1; } - hdr->turn_msg_len += iov[(*index)].iov_len; - (*index)++; + hdr->turn_msg_len += iov[(*idx)].iov_len; + (*idx)++; /* compute HMAC */ /* convert length to big endian */ hdr->turn_msg_len = htons(hdr->turn_msg_len); /* do not take into account the attribute itself */ - turn_calculate_integrity_hmac_iov(iov, (*index) - 1, key, key_len, + turn_calculate_integrity_hmac_iov(iov, (*idx) - 1, key, key_len, ((struct turn_attr_message_integrity*)attr)->turn_attr_hmac); hdr->turn_msg_len = ntohs(hdr->turn_msg_len); if(add_fingerprint) { - turn_add_fingerprint(iov, index); + turn_add_fingerprint(iov, idx); } hdr->turn_msg_len = htons(hdr->turn_msg_len); @@ -1661,24 +1661,24 @@ return 0; } -int turn_add_fingerprint(struct iovec* iov, size_t* index) +int turn_add_fingerprint(struct iovec* iov, size_t* idx) { struct turn_attr_hdr* attr = NULL; struct turn_msg_hdr* hdr = iov[0].iov_base; - if(*index == 0) + if(*idx == 0) { /* could not place fingerprint in first place */ return -1; } /* add a fingerprint */ - if(!(attr = turn_attr_fingerprint_create(0, &iov[(*index)]))) + if(!(attr = turn_attr_fingerprint_create(0, &iov[(*idx)]))) { return -1; } - hdr->turn_msg_len += iov[(*index)].iov_len; - (*index)++; + hdr->turn_msg_len += iov[(*idx)].iov_len; + (*idx)++; /* compute fingerprint */ /* convert to big endian */ @@ -1686,7 +1686,7 @@ /* do not take into account the attribute itself */ ((struct turn_attr_fingerprint*)attr)->turn_attr_crc = htonl( - turn_calculate_fingerprint(iov, (*index) - 1)); + turn_calculate_fingerprint(iov, (*idx) - 1)); ((struct turn_attr_fingerprint*)attr)->turn_attr_crc ^= htonl( STUN_FINGERPRINT_XOR_VALUE); @@ -1738,7 +1738,7 @@ /* attributes length */ ssize_t len = 0; const char* ptr = msg; - size_t unknown_index = 0; + size_t unknown_idx = 0; /* count of XOR-PEER-ADDRESS attribute */ size_t xor_peer_address_nb = 0; @@ -1889,9 +1889,9 @@ { break; } - unknown[unknown_index] = htons(attr->turn_attr_type); + unknown[unknown_idx] = htons(attr->turn_attr_type); (*unknown_size)--; - unknown_index++; + unknown_idx++; } break; } @@ -1911,7 +1911,7 @@ } } - *unknown_size = unknown_index; + *unknown_size = unknown_idx; return 0; } Modified: trunk/src/turnserver.c =================================================================== --- trunk/src/turnserver.c 2013-03-02 07:55:15 UTC (rev 233) +++ trunk/src/turnserver.c 2013-03-26 17:06:14 UTC (rev 234) @@ -646,45 +646,45 @@ struct iovec iov[16]; /* should be sufficient */ struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; - size_t index = 0; + size_t idx = 0; switch(error) { case 400: /* Bad request */ - hdr = turn_error_response_400(method, id, &iov[index], &index); + hdr = turn_error_response_400(method, id, &iov[idx], &idx); break; case 403: /* Forbidden */ - hdr = turn_error_response_403(method, id, &iov[index], &index); + hdr = turn_error_response_403(method, id, &iov[idx], &idx); break; case 437: /* Alocation mismatch */ - hdr = turn_error_response_437(method, id, &iov[index], &index); + hdr = turn_error_response_437(method, id, &iov[idx], &idx); break; case 440: /* Address family not supported */ - hdr = turn_error_response_440(method, id, &iov[index], &index); + hdr = turn_error_response_440(method, id, &iov[idx], &idx); break; case 441: /* Wrong credentials */ - hdr = turn_error_response_441(method, id, &iov[index], &index); + hdr = turn_error_response_441(method, id, &iov[idx], &idx); break; case 442: /* Unsupported transport protocol */ - hdr = turn_error_response_442(method, id, &iov[index], &index); + hdr = turn_error_response_442(method, id, &iov[idx], &idx); break; case 443: /* Peer address family mismatch */ - hdr = turn_error_response_443(method, id, &iov[index], &index); + hdr = turn_error_response_443(method, id, &iov[idx], &idx); break; case 446: /* Connection already exists (RFC6062) */ - hdr = turn_error_response_446(method, id, &iov[index], &index); + hdr = turn_error_response_446(method, id, &iov[idx], &idx); break; case 447: /* Connection timeout or failure (RFC6062) */ - hdr = turn_error_response_447(method, id, &iov[index], &index); + hdr = turn_error_response_447(method, id, &iov[idx], &idx); break; case 486: /* Allocation quota reached */ - hdr = turn_error_response_486(method, id, &iov[index], &index); + hdr = turn_error_response_486(method, id, &iov[idx], &idx); break; case 500: /* Server error */ - hdr = turn_error_response_500(method, id, &iov[index], &index); + hdr = turn_error_response_500(method, id, &iov[idx], &idx); break; case 508: /* Insufficient port capacity */ - hdr = turn_error_response_508(method, id, &iov[index], &index); + hdr = turn_error_response_508(method, id, &iov[idx], &idx); break; default: break; @@ -697,27 +697,27 @@ /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } if(key) { - if(turn_add_message_integrity(iov, &index, key, 16, 1) == -1) + if(turn_add_message_integrity(iov, &idx, key, 16, 1) == -1) { /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return -1; } /* function above already set turn_msg_len field to big endian */ } else { - turn_add_fingerprint(iov, &index); /* not fatal if not successful */ + turn_add_fingerprint(iov, &idx); /* not fatal if not successful */ /* convert to big endian */ hdr->turn_msg_len = htons(hdr->turn_msg_len); @@ -725,13 +725,13 @@ /* finally send the response */ if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } @@ -936,7 +936,7 @@ struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; struct iovec iov[8]; - size_t index = 0; + size_t idx = 0; debug(DBG_ATTR, "ConnectionBind request received!\n"); @@ -1000,57 +1000,57 @@ /* ConnectionBind response */ if(!(hdr = turn_msg_connectionbind_response_create(0, - message->msg->turn_msg_id, &iov[index]))) + message->msg->turn_msg_id, &iov[idx]))) { turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, account->key); return -1; } - index++; + idx++; /* connection-id */ if(!(attr = turn_attr_connection_id_create( - message->connection_id->turn_attr_id, &iov[index]))) + message->connection_id->turn_attr_id, &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, account->key); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - strlen(SOFTWARE_DESCRIPTION), &iov[index]))) + strlen(SOFTWARE_DESCRIPTION), &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } - if(turn_add_message_integrity(iov, &index, desc->key, sizeof(desc->key), 1) + if(turn_add_message_integrity(iov, &idx, desc->key, sizeof(desc->key), 1) == -1) { /* MESSAGE-INTEGRITY option has to be in message, so * deallocate ressources and return */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, account->key); return -1; } if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return -1; } /* free message */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); /* initialized client socket */ tcp_relay->client_sock = sock; @@ -1137,51 +1137,51 @@ socklen_t saddr_size, struct tls_peer* speer) { struct iovec iov[4]; /* header, software, xor-address, fingerprint */ - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; debug(DBG_ATTR, "Binding request received!\n"); if(!(hdr = turn_msg_binding_response_create(0, message->msg->turn_msg_id, - &iov[index]))) + &iov[idx]))) { return -1; } - index++; + idx++; if(!(attr = turn_attr_xor_mapped_address_create(saddr, STUN_MAGIC_COOKIE, - message->msg->turn_msg_id, &iov[index]))) + message->msg->turn_msg_id, &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, STUN_METHOD_BINDING, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, NULL); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } /* NOTE: maybe add a configuration flag to enable/disable fingerprint in * output message */ /* add a fingerprint */ - if(!(attr = turn_attr_fingerprint_create(0, &iov[index]))) + if(!(attr = turn_attr_fingerprint_create(0, &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, STUN_METHOD_BINDING, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, NULL); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; /* compute fingerprint */ @@ -1190,18 +1190,18 @@ /* do not take into account the attribute itself */ ((struct turn_attr_fingerprint*)attr)->turn_attr_crc = - htonl(turn_calculate_fingerprint(iov, index - 1)); + htonl(turn_calculate_fingerprint(iov, idx - 1)); ((struct turn_attr_fingerprint*)attr)->turn_attr_crc ^= htonl(STUN_FINGERPRINT_XOR_VALUE); if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } @@ -1615,7 +1615,7 @@ struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; struct iovec iov[4]; /* header, software, integrity, fingerprint */ - size_t index = 0; + size_t idx = 0; char str[INET6_ADDRSTRLEN]; char str2[INET6_ADDRSTRLEN]; char str3[INET6_ADDRSTRLEN]; @@ -1777,26 +1777,26 @@ /* send a CreatePermission success response */ if(!(hdr = turn_msg_createpermission_response_create(0, - message->msg->turn_msg_id, &iov[index]))) + message->msg->turn_msg_id, &iov[idx]))) { turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; } - index++; + idx++; /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } - if(turn_add_message_integrity(iov, &index, desc->key, sizeof(desc->key), 1) + if(turn_add_message_integrity(iov, &idx, desc->key, sizeof(desc->key), 1) == -1) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; @@ -1808,13 +1808,13 @@ /* finally send the response */ if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } @@ -1837,7 +1837,7 @@ uint16_t hdr_msg_type = htons(message->msg->turn_msg_type); uint16_t method = STUN_GET_METHOD(hdr_msg_type); struct iovec iov[5]; /* header, lifetime, software, integrity, fingerprint */ - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; uint16_t channel = 0; @@ -2026,26 +2026,26 @@ /* finally send the response */ if(!(hdr = turn_msg_channelbind_response_create(0, message->msg->turn_msg_id, - &iov[index]))) + &iov[idx]))) { turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; } - index++; + idx++; /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } - if(turn_add_message_integrity(iov, &index, desc->key, sizeof(desc->key), 1) + if(turn_add_message_integrity(iov, &idx, desc->key, sizeof(desc->key), 1) == -1) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; @@ -2056,13 +2056,13 @@ /* finally send the response */ if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } @@ -2090,7 +2090,7 @@ uint16_t method = STUN_GET_METHOD(hdr_msg_type); uint32_t lifetime = 0; struct iovec iov[5]; /* header, lifetime, software, integrity, fingerprint */ - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; uint8_t key[16]; @@ -2207,35 +2207,35 @@ } if(!(hdr = turn_msg_refresh_response_create(0, message->msg->turn_msg_id, - &iov[index]))) + &iov[idx]))) { turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, key); return -1; } - index++; + idx++; - if(!(attr = turn_attr_lifetime_create(lifetime, &iov[index]))) + if(!(attr = turn_attr_lifetime_create(lifetime, &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, key); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } - if(turn_add_message_integrity(iov, &index, key, sizeof(key), 1) == -1) + if(turn_add_message_integrity(iov, &idx, key, sizeof(key), 1) == -1) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, key); return -1; @@ -2245,13 +2245,13 @@ /* finally send the response */ if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } @@ -2389,13 +2389,13 @@ uint16_t unknown[2]; struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; - size_t index = 0; + size_t idx = 0; /* send error 420 */ unknown[0] = TURN_ATTR_DONT_FRAGMENT; if(!(error = turn_error_response_420(method, message->msg->turn_msg_id, - unknown, 1, iov, &index))) + unknown, 1, iov, &idx))) { turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, @@ -2405,16 +2405,16 @@ /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - error->turn_msg_len += iov[index].iov_len; - index++; + error->turn_msg_len += iov[idx].iov_len; + idx++; } - if(turn_add_message_integrity(iov, &index, desc->key, sizeof(desc->key), 1) + if(turn_add_message_integrity(iov, &idx, desc->key, sizeof(desc->key), 1) == -1) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, account->key); @@ -2422,14 +2422,14 @@ } if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(error->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(error->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } /* free sent data */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } #endif @@ -2806,39 +2806,39 @@ struct iovec iov[12]; struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; - size_t index = 0; + size_t idx = 0; if(!(hdr = turn_msg_allocate_response_create(0, message->msg->turn_msg_id, - &iov[index]))) + &iov[idx]))) { turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; } - index++; + idx++; /* required attributes */ if(!(attr = turn_attr_xor_relayed_address_create( (struct sockaddr*)&relayed_addr, STUN_MAGIC_COOKIE, - message->msg->turn_msg_id, &iov[index]))) + message->msg->turn_msg_id, &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; - if(!(attr = turn_attr_lifetime_create(lifetime, &iov[index]))) + if(!(attr = turn_attr_lifetime_create(lifetime, &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500,saddr, saddr_size, speer, desc->key); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; switch(saddr->sa_family) { @@ -2849,51 +2849,51 @@ port = ntohs(((struct sockaddr_in6*)saddr)->sin6_port); break; default: - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return -1; break; } if(!(attr = turn_attr_xor_mapped_address_create(saddr, STUN_MAGIC_COOKIE, - message->msg->turn_msg_id, &iov[index]))) + message->msg->turn_msg_id, &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; if(reservation_port) { /* server has stored a socket/port */ debug(DBG_ATTR, "Send a reservation-token attribute\n"); if(!(attr = turn_attr_reservation_token_create(reservation_token, - &iov[index]))) + &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } - if(turn_add_message_integrity(iov, &index, desc->key, sizeof(desc->key), 1) + if(turn_add_message_integrity(iov, &idx, desc->key, sizeof(desc->key), 1) == -1) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); turnserver_send_error(transport_protocol, sock, method, message->msg->turn_msg_id, 500, saddr, saddr_size, speer, desc->key); return -1; @@ -2902,13 +2902,13 @@ debug(DBG_ATTR, "Allocation successful, send success allocate response\n"); if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } - iovec_free_data(iov, index); + iovec_free_data(iov, idx); } return 0; @@ -3267,7 +3267,7 @@ struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; char* key = NULL; - size_t index = 0; + size_t idx = 0; debug(DBG_ATTR, "No message integrity\n"); @@ -3276,7 +3276,7 @@ strlen(key)); if(!(error = turn_error_response_401(method, message.msg->turn_msg_id, - turnserver_cfg_realm(), nonce, sizeof(nonce), iov, &index))) + turnserver_cfg_realm(), nonce, sizeof(nonce), iov, &idx))) { turnserver_send_error(transport_protocol, sock, method, message.msg->turn_msg_id, 500, saddr, saddr_size, speer, NULL); @@ -3285,26 +3285,26 @@ /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - error->turn_msg_len += iov[index].iov_len; - index++; + error->turn_msg_len += iov[idx].iov_len; + idx++; } - turn_add_fingerprint(iov, &index); /* not fatal if not successful */ + turn_add_fingerprint(iov, &idx); /* not fatal if not successful */ /* convert to big endian */ error->turn_msg_len = htons(error->turn_msg_len); if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, ntohs(error->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, - index) == -1) + idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } /* free sent data */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } @@ -3324,7 +3324,7 @@ /* nonce staled => error 438 */ /* header, error-code, realm, nonce, software */ struct iovec iov[5]; - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; uint8_t nonce[48]; @@ -3333,10 +3333,10 @@ turn_generate_nonce(nonce, sizeof(nonce), (unsigned char*)key, strlen(key)); - index = 0; + idx = 0; if(!(error = turn_error_response_438(method, message.msg->turn_msg_id, - realm, nonce, sizeof(nonce), iov, &index))) + realm, nonce, sizeof(nonce), iov, &idx))) { turnserver_send_error(transport_protocol, sock, method, message.msg->turn_msg_id, 500, saddr, saddr_size, speer, NULL); @@ -3345,10 +3345,10 @@ /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - error->turn_msg_len += iov[index].iov_len; - index++; + error->turn_msg_len += iov[idx].iov_len; + idx++; } /* convert to big endian */ @@ -3356,13 +3356,13 @@ if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, ntohs(error->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, - index) == -1) + idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } /* free sent data */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } @@ -3394,7 +3394,7 @@ { /* not valid username => error 401 */ struct iovec iov[5]; /* header, error-code, realm, nonce, software */ - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; uint8_t nonce[48]; @@ -3405,10 +3405,10 @@ turn_generate_nonce(nonce, sizeof(nonce), (unsigned char*)key, strlen(key)); - index = 0; + idx = 0; if(!(error = turn_error_response_401(method, message.msg->turn_msg_id, - realm, nonce, sizeof(nonce), iov, &index))) + realm, nonce, sizeof(nonce), iov, &idx))) { turnserver_send_error(transport_protocol, sock, method, message.msg->turn_msg_id, 500, saddr, saddr_size, speer, NULL); @@ -3417,26 +3417,26 @@ /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - error->turn_msg_len += iov[index].iov_len; - index++; + error->turn_msg_len += iov[idx].iov_len; + idx++; } - turn_add_fingerprint(iov, &index); /* not fatal if not successful */ + turn_add_fingerprint(iov, &idx); /* not fatal if not successful */ /* convert to big endian */ error->turn_msg_len = htons(error->turn_msg_len); if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, ntohs(error->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, - index) == -1) + idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } /* free sent data */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } } @@ -3474,7 +3474,7 @@ { /* integrity does not match => error 401 */ struct iovec iov[5]; /* header, error-code, realm, nonce, software */ - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; uint8_t nonce[48]; @@ -3488,10 +3488,10 @@ #endif turn_generate_nonce(nonce, sizeof(nonce), (unsigned char*)nonce_key, strlen(nonce_key)); - index = 0; + idx = 0; if(!(error = turn_error_response_401(method, message.msg->turn_msg_id, - turnserver_cfg_realm(), nonce, sizeof(nonce), iov, &index))) + turnserver_cfg_realm(), nonce, sizeof(nonce), iov, &idx))) { turnserver_send_error(transport_protocol, sock, method, message.msg->turn_msg_id, 500, saddr, saddr_size, speer, NULL); @@ -3500,26 +3500,26 @@ /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - error->turn_msg_len += iov[index].iov_len; - index++; + error->turn_msg_len += iov[idx].iov_len; + idx++; } - turn_add_fingerprint(iov, &index); /* not fatal if not successful */ + turn_add_fingerprint(iov, &idx); /* not fatal if not successful */ /* convert to big endian */ error->turn_msg_len = htons(error->turn_msg_len); if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, ntohs(error->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, - index) == -1) + idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } /* free sent data */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } } @@ -3529,7 +3529,7 @@ if(unknown_size) { struct iovec iov[4]; /* header, error-code, unknown-attributes, software */ - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* error = NULL; struct turn_attr_hdr* attr = NULL; @@ -3543,7 +3543,7 @@ /* unknown attributes found => error 420 */ if(!(error = turn_error_response_420(method, message.msg->turn_msg_id, - unknown, unknown_size, iov, &index))) + unknown, unknown_size, iov, &idx))) { turnserver_send_error(transport_protocol, sock, method, message.msg->turn_msg_id, 500, saddr, saddr_size, speer, @@ -3553,24 +3553,24 @@ /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - error->turn_msg_len += iov[index].iov_len; - index++; + error->turn_msg_len += iov[idx].iov_len; + idx++; } /* convert to big endian */ error->turn_msg_len = htons(error->turn_msg_len); if(turn_send_message(transport_protocol, sock, speer, saddr, saddr_size, - ntohs(error->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(error->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } /* free sent data */ - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return 0; } @@ -3603,7 +3603,7 @@ uint16_t peer_port; uint32_t channel = 0; struct iovec iov[8]; /* header, peer-address, data */ - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; struct turn_channel_data channel_data; @@ -3663,25 +3663,25 @@ channel_data.turn_channel_number = htons(channel); channel_data.turn_channel_len = htons(buflen); /* big endian */ - iov[index].iov_base = &channel_data; - iov[index].iov_len = sizeof(struct turn_channel_data); - index++; + iov[idx].iov_base = &channel_data; + iov[idx].iov_len = sizeof(struct turn_channel_data); + idx++; if(buflen > 0) { - iov[index].iov_base = (void*)buf; - iov[index].iov_len = buflen; + iov[idx].iov_base = (void*)buf; + iov[idx].iov_len = buflen; len += buflen; - index++; + idx++; } /* add padding (MUST be included for TCP, MAY be included for UDP) */ if(buflen % 4) { - iov[index].iov_base = &padding; - iov[index].iov_len = 4 - (buflen % 4); - len += iov[index].iov_len; - index++; + iov[idx].iov_base = &padding; + iov[idx].iov_len = 4 - (buflen % 4); + len += iov[idx].iov_len; + idx++; } } else @@ -3690,28 +3690,28 @@ uint8_t id[12]; turn_generate_transaction_id(id); - if(!(hdr = turn_msg_data_indication_create(0, id, &iov[index]))) + if(!(hdr = turn_msg_data_indication_create(0, id, &iov[idx]))) { return -1; } - index++; + idx++; if(!(attr = turn_attr_xor_peer_address_create(saddr, STUN_MAGIC_COOKIE, id, - &iov[index]))) + &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; - if(!(attr = turn_attr_data_create(buf, buflen, &iov[index]))) + if(!(attr = turn_attr_data_create(buf, buflen, &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return -1; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; len = hdr->turn_msg_len + sizeof(struct turn_msg_hdr); hdr->turn_msg_len = htons(hdr->turn_msg_len); @@ -3723,7 +3723,7 @@ if(speer) /* TLS */ { nb = turn_tls_send(speer, (struct sockaddr*)&desc->tuple.client_addr, - sockaddr_get_size(&desc->tuple.client_addr), len, iov, index); + sockaddr_get_size(&desc->tuple.client_addr), len, iov, idx); } else if(desc->tuple.transport_protocol == IPPROTO_UDP) /* UDP */ { @@ -3768,7 +3768,7 @@ nb = turn_udp_send(desc->tuple_sock, (struct sockaddr*)&desc->tuple.client_addr, - sockaddr_get_size(&desc->tuple.client_addr), iov, index); + sockaddr_get_size(&desc->tuple.client_addr), iov, idx); /* if not an IPv4-IPv4 relay, optlen keep its default value 0 */ #ifdef OS_SET_DF_SUPPORT @@ -3782,7 +3782,7 @@ } else /* TCP */ { - nb = turn_tcp_send(desc->tuple_sock, iov, index); + nb = turn_tcp_send(desc->tuple_sock, iov, idx); } if(nb == -1) @@ -3793,7 +3793,7 @@ /* if use a channel, do not used dynamic allocation */ if(!channel) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); } return 0; @@ -3988,7 +3988,7 @@ int err = 0; socklen_t err_size = sizeof(int); struct iovec iov[8]; - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; struct sockaddr* saddr = (struct sockaddr*)&desc->tuple.client_addr; @@ -4007,42 +4007,42 @@ } if(!(hdr = turn_msg_connect_response_create(0, relay->connect_msg_id, - &iov[index]))) + &iov[idx]))) { return -2; } - index++; + idx++; /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } if(!(attr = turn_attr_connection_id_create(relay->connection_id, - &iov[index]))) + &iov[idx]))) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return -2; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; - if(turn_add_message_integrity(iov, &index, desc->key, sizeof(desc->key), 1) + if(turn_add_message_integrity(iov, &idx, desc->key, sizeof(desc->key), 1) == -1) { - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return -2; } /* send message */ ret = turn_send_message(IPPROTO_TCP, desc->tuple_sock, speer, saddr, saddr_size, ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, - index); + idx); - iovec_free_data(iov, index); + iovec_free_data(iov, idx); if(ret == -1) { @@ -4085,7 +4085,7 @@ uint16_t peer_port = 0; uint32_t id = 0; uint8_t msg_id[12]; /* for ConnectionAttempt message ID */ - size_t index = 0; + size_t idx = 0; struct turn_msg_hdr* hdr = NULL; struct turn_attr_hdr* attr = NULL; struct iovec iov[8]; @@ -4143,46 +4143,46 @@ /* now send ConnectionAttempt to client */ if(!(hdr = turn_msg_connectionattempt_indication_create(0, msg_id, - &iov[index]))) + &iov[idx]))) { /* ignore ? */ close(rsock); return; } - index++; + idx++; /* software (not fatal if it cannot be allocated) */ if((attr = turn_attr_software_create(SOFTWARE_DESCRIPTION, - sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[index]))) + sizeof(SOFTWARE_DESCRIPTION) - 1, &iov[idx]))) { - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; } - if(!(attr = turn_attr_connection_id_create(id, &iov[index]))) + if(!(attr = turn_attr_connection_id_create(id, &iov[idx]))) { close(rsock); - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; if(!(attr = turn_attr_xor_peer_address_create((struct sockaddr*)&saddr, - STUN_MAGIC_COOKIE, msg_id, &iov[index]))) + STUN_MAGIC_COOKIE, msg_id, &iov[idx]))) { close(rsock); - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return; } - hdr->turn_msg_len += iov[index].iov_len; - index++; + hdr->turn_msg_len += iov[idx].iov_len; + idx++; - if(turn_add_message_integrity(iov, &index, desc->key, sizeof(desc->key), 1) + if(turn_add_message_integrity(iov, &idx, desc->key, sizeof(desc->key), 1) == -1) { close(rsock); - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return; } @@ -4190,13 +4190,13 @@ if(turn_send_message(IPPROTO_TCP, desc->tuple_sock, speer, (struct sockaddr*)&desc->tuple.client_addr, sockaddr_get_size(&desc->tuple.client_addr), - ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, index) + ntohs(hdr->turn_msg_len) + sizeof(struct turn_msg_hdr), iov, idx) == -1) { debug(DBG_ATTR, "turn_send_message failed\n"); } - iovec_free_data(iov, index); + iovec_free_data(iov, idx); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <s-v...@us...> - 2013-03-02 07:55:22
|
Revision: 233 http://sourceforge.net/p/turnserver/code/233 Author: s-vincent Date: 2013-03-02 07:55:15 +0000 (Sat, 02 Mar 2013) Log Message: ----------- Fixes some GCC 4.8 compilation warnings. Modified Paths: -------------- trunk/src/util_sys.c Modified: trunk/src/util_sys.c =================================================================== --- trunk/src/util_sys.c 2012-11-19 19:14:52 UTC (rev 232) +++ trunk/src/util_sys.c 2013-03-02 07:55:15 UTC (rev 233) @@ -413,11 +413,17 @@ } #ifdef _POSIX_SAVED_IDS - setegid(gid_real); + if(setegid(gid_real) == -1) + { + return -1; + } return seteuid(uid_real); #else /* i.e. for *BSD */ - setregid(-1, gid_real); + if(setregid(-1, gid_real) == -1) + { + return -1; + } return setreuid(-1, uid_real); #endif } @@ -425,7 +431,10 @@ /* get user_name information (UID and GID) */ if(getpwnam_r(user_name, tmpUser, buf, sizeof(buf), &tmp) == 0) { - setegid(user.pw_gid); + if(setegid(user.pw_gid) == -1) + { + return -1; + } return seteuid(user.pw_uid); } else @@ -447,11 +456,17 @@ #else /* Unix */ #ifdef _POSIX_SAVED_IDS - setegid(gid_eff); + if(setegid(gid_eff) == -1) + { + return -1; + } return seteuid(uid_eff); #else /* i.e for *BSD */ - setregid(-1, gid_eff); + if(setregid(-1, gid_eff) == -1) + { + return -1; + } return setreuid(-1, uid_eff); #endif #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Sebastien V. <se...@ji...> - 2013-01-30 19:14:38
|
Hi Lee, The configuration file requires a valid users and does not support wildcard. So you have to have a valid username:password:domain:authorize line. TURN RFC requires authentication, From RFC5766: " [RFC5389] specifies an authentication mechanism called the long-term credential mechanism. TURN servers and clients MUST implement this mechanism. The server MUST demand that all requests from the client be authenticated using this mechanism, or that a equally strong or stronger mechanism for client authentication is used. " As TurnServer does not implement any other "strong mechanism for client authentication" (for example SSL/TLS client certificate authentication), it is not possible to disable authentication. For your issue, you can simply add a valid user and configure all your client to use its credentials. Regards, Le 28/01/2013 09:13, Lee Sylvester a écrit : > Hey guys, > > So, I've got my turnserver up and running. What I can't figure out is authentication. I'd like to be able to allow anyone to use this server. Could someone explain how to do this? > > So far, I've tried setting *:*:*:authorize and :::authorize, but those don't seem to work. > > Thanks loads, > Lee > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnnow-d2d > _______________________________________________ > Turnserver-devel mailing list > Tur...@li... > https://lists.sourceforge.net/lists/listinfo/turnserver-devel |
From: Lee S. <lee...@gm...> - 2013-01-28 08:13:38
|
Hey guys, So, I've got my turnserver up and running. What I can't figure out is authentication. I'd like to be able to allow anyone to use this server. Could someone explain how to do this? So far, I've tried setting *:*:*:authorize and :::authorize, but those don't seem to work. Thanks loads, Lee |
From: Sebastien V. <se...@ji...> - 2013-01-25 18:21:18
|
Just for information, TurnServer does not compile on Mac OS X since Mac OS X does not provide POSIX realtime extension. We may add in the future some kind of abstraction or redesign the way to handle TURN allocation expiration to make it available to Mac OS X users. Regards, -- Seb Le 25/01/2013 17:12, Lee Sylvester a écrit : > Hahaha. Typical me :-) > > Actually, I'm trying out both, but obviously hit the wrong link. I > may post again if I have trouble (given up on reTurnServer). > > Thanks :-) > Lee > > > > > On 25 Jan 2013, at 15:43, Sebastien Vincent <se...@ji... > <mailto:se...@ji...>> wrote: > >> Hi, >> >> You try to compile... reTurn server which is not TurnServer.org >> <http://TurnServer.org>. >> >> Regards, >> -- >> Seb >> >> Le vendredi 25 janvier 2013, Lee Sylvester <lee...@gm... >> <mailto:lee...@gm...>> a écrit : >> > Hey guys, >> > >> > I'm trying to compile the server on a Mac OSX machine running >> Mountain Lion, but I'm having issues with libdb. I've installed >> libdb 4.2 using the --enable-cxx flag, but when I then configure and >> build the server, I get the output: >> > >> > [snip] >> > In file included from ../repro/PersistentMessageQueue.hxx:8, >> > from PersistentMessageQueue.cxx:13: >> > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file >> or directory >> > In file included from ../repro/BerkeleyDb.hxx:8, >> > from BerkeleyDb.cxx:14: >> > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file >> or directory >> > In file included from ../repro/PersistentMessageQueue.hxx:8, >> > from AccountingCollector.cxx:15: >> > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file >> or directory >> > In file included from ../repro/BerkeleyDb.hxx:8, >> > from ReproRunner.cxx:31: >> > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file >> or directory >> > In file included from ../repro/PersistentMessageQueue.hxx:8, >> > from PersistentMessageQueue.cxx:13: >> > /usr/local/include/db_cxx.h:1395: error: expected class-name before >> '{' token >> > In file included from ../repro/BerkeleyDb.hxx:8, >> > from BerkeleyDb.cxx:14: >> > /usr/local/include/db_cxx.h:1395: error: expected class-name before >> '{' token >> > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but >> not used >> > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but >> not used >> > make[3]: *** [PersistentMessageQueue.lo] Error 1 >> > make[3]: *** [BerkeleyDb.lo] Error 1 >> > In file included from ../repro/PersistentMessageQueue.hxx:8, >> > from AccountingCollector.cxx:15: >> > /usr/local/include/db_cxx.h:1395: error: expected class-name before >> '{' token >> > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but >> not used >> > ../resip/stack/SdpContents.hxx:1044: warning: >> 'resip::invokeSdpContentsInit' defined but not used >> > make[3]: *** [AccountingCollector.lo] Error 1 >> > In file included from ../repro/BerkeleyDb.hxx:8, >> > from ReproRunner.cxx:31: >> > /usr/local/include/db_cxx.h:1395: error: expected class-name before >> '{' token >> > ReproRunner.cxx: In member function 'virtual bool >> repro::ReproRunner::createSipStack()': >> > ReproRunner.cxx:450: warning: unused variable 'useV6' >> > ../rutil/Data.hxx: At global scope: >> > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but >> not used >> > ../resip/stack/SdpContents.hxx:1044: warning: >> 'resip::invokeSdpContentsInit' defined but not used >> > make[3]: *** [ReproRunner.lo] Error 1 >> > make[2]: *** [all-recursive] Error 1 >> > make[1]: *** [all-recursive] Error 1 >> > make: *** [all] Error 2 >> > >> > >> > Can anyone see what I might be doing wrong? >> > >> > Thanks, >> > Lee >> > >> ------------------------------------------------------------------------------ >> > Master Visual Studio, SharePoint, SQL, ASP.NET <http://asp.net/>, >> C# 2012, HTML5, CSS, >> > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >> > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >> > MVPs and experts. ON SALE this month only -- learn more at: >> > http://p.sf.net/sfu/learnnow-d2d >> > _______________________________________________ >> > Turnserver-devel mailing list >> > Tur...@li... >> <mailto:Tur...@li...> >> > https://lists.sourceforge.net/lists/listinfo/turnserver-devel >> > > |
From: Sebastien V. <se...@ji...> - 2013-01-25 16:14:49
|
Hi, You try to compile... reTurn server which is not TurnServer.org. Regards, -- Seb Le vendredi 25 janvier 2013, Lee Sylvester <lee...@gm...> a écrit : > Hey guys, > > I'm trying to compile the server on a Mac OSX machine running Mountain Lion, but I'm having issues with libdb. I've installed libdb 4.2 using the --enable-cxx flag, but when I then configure and build the server, I get the output: > > [snip] > In file included from ../repro/PersistentMessageQueue.hxx:8, > from PersistentMessageQueue.cxx:13: > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory > In file included from ../repro/BerkeleyDb.hxx:8, > from BerkeleyDb.cxx:14: > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory > In file included from ../repro/PersistentMessageQueue.hxx:8, > from AccountingCollector.cxx:15: > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory > In file included from ../repro/BerkeleyDb.hxx:8, > from ReproRunner.cxx:31: > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory > In file included from ../repro/PersistentMessageQueue.hxx:8, > from PersistentMessageQueue.cxx:13: > /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token > In file included from ../repro/BerkeleyDb.hxx:8, > from BerkeleyDb.cxx:14: > /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used > make[3]: *** [PersistentMessageQueue.lo] Error 1 > make[3]: *** [BerkeleyDb.lo] Error 1 > In file included from ../repro/PersistentMessageQueue.hxx:8, > from AccountingCollector.cxx:15: > /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used > ../resip/stack/SdpContents.hxx:1044: warning: 'resip::invokeSdpContentsInit' defined but not used > make[3]: *** [AccountingCollector.lo] Error 1 > In file included from ../repro/BerkeleyDb.hxx:8, > from ReproRunner.cxx:31: > /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token > ReproRunner.cxx: In member function 'virtual bool repro::ReproRunner::createSipStack()': > ReproRunner.cxx:450: warning: unused variable 'useV6' > ../rutil/Data.hxx: At global scope: > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used > ../resip/stack/SdpContents.hxx:1044: warning: 'resip::invokeSdpContentsInit' defined but not used > make[3]: *** [ReproRunner.lo] Error 1 > make[2]: *** [all-recursive] Error 1 > make[1]: *** [all-recursive] Error 1 > make: *** [all] Error 2 > > > Can anyone see what I might be doing wrong? > > Thanks, > Lee > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnnow-d2d > _______________________________________________ > Turnserver-devel mailing list > Tur...@li... > https://lists.sourceforge.net/lists/listinfo/turnserver-devel > |
From: Lee S. <lee...@gm...> - 2013-01-25 16:12:29
|
Hahaha. Typical me :-) Actually, I'm trying out both, but obviously hit the wrong link. I may post again if I have trouble (given up on reTurnServer). Thanks :-) Lee On 25 Jan 2013, at 15:43, Sebastien Vincent <se...@ji...> wrote: > Hi, > > You try to compile... reTurn server which is not TurnServer.org. > > Regards, > -- > Seb > > Le vendredi 25 janvier 2013, Lee Sylvester <lee...@gm...> a écrit : > > Hey guys, > > > > I'm trying to compile the server on a Mac OSX machine running Mountain Lion, but I'm having issues with libdb. I've installed libdb 4.2 using the --enable-cxx flag, but when I then configure and build the server, I get the output: > > > > [snip] > > In file included from ../repro/PersistentMessageQueue.hxx:8, > > from PersistentMessageQueue.cxx:13: > > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory > > In file included from ../repro/BerkeleyDb.hxx:8, > > from BerkeleyDb.cxx:14: > > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory > > In file included from ../repro/PersistentMessageQueue.hxx:8, > > from AccountingCollector.cxx:15: > > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory > > In file included from ../repro/BerkeleyDb.hxx:8, > > from ReproRunner.cxx:31: > > /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory > > In file included from ../repro/PersistentMessageQueue.hxx:8, > > from PersistentMessageQueue.cxx:13: > > /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token > > In file included from ../repro/BerkeleyDb.hxx:8, > > from BerkeleyDb.cxx:14: > > /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token > > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used > > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used > > make[3]: *** [PersistentMessageQueue.lo] Error 1 > > make[3]: *** [BerkeleyDb.lo] Error 1 > > In file included from ../repro/PersistentMessageQueue.hxx:8, > > from AccountingCollector.cxx:15: > > /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token > > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used > > ../resip/stack/SdpContents.hxx:1044: warning: 'resip::invokeSdpContentsInit' defined but not used > > make[3]: *** [AccountingCollector.lo] Error 1 > > In file included from ../repro/BerkeleyDb.hxx:8, > > from ReproRunner.cxx:31: > > /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token > > ReproRunner.cxx: In member function 'virtual bool repro::ReproRunner::createSipStack()': > > ReproRunner.cxx:450: warning: unused variable 'useV6' > > ../rutil/Data.hxx: At global scope: > > ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used > > ../resip/stack/SdpContents.hxx:1044: warning: 'resip::invokeSdpContentsInit' defined but not used > > make[3]: *** [ReproRunner.lo] Error 1 > > make[2]: *** [all-recursive] Error 1 > > make[1]: *** [all-recursive] Error 1 > > make: *** [all] Error 2 > > > > > > Can anyone see what I might be doing wrong? > > > > Thanks, > > Lee > > ------------------------------------------------------------------------------ > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > > MVPs and experts. ON SALE this month only -- learn more at: > > http://p.sf.net/sfu/learnnow-d2d > > _______________________________________________ > > Turnserver-devel mailing list > > Tur...@li... > > https://lists.sourceforge.net/lists/listinfo/turnserver-devel > > |
From: Lee S. <lee...@gm...> - 2013-01-25 12:44:23
|
Hey guys, I'm trying to compile the server on a Mac OSX machine running Mountain Lion, but I'm having issues with libdb. I've installed libdb 4.2 using the --enable-cxx flag, but when I then configure and build the server, I get the output: [snip] In file included from ../repro/PersistentMessageQueue.hxx:8, from PersistentMessageQueue.cxx:13: /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory In file included from ../repro/BerkeleyDb.hxx:8, from BerkeleyDb.cxx:14: /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory In file included from ../repro/PersistentMessageQueue.hxx:8, from AccountingCollector.cxx:15: /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory In file included from ../repro/BerkeleyDb.hxx:8, from ReproRunner.cxx:31: /usr/local/include/db_cxx.h:60:23: error: exception.h: No such file or directory In file included from ../repro/PersistentMessageQueue.hxx:8, from PersistentMessageQueue.cxx:13: /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token In file included from ../repro/BerkeleyDb.hxx:8, from BerkeleyDb.cxx:14: /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used make[3]: *** [PersistentMessageQueue.lo] Error 1 make[3]: *** [BerkeleyDb.lo] Error 1 In file included from ../repro/PersistentMessageQueue.hxx:8, from AccountingCollector.cxx:15: /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used ../resip/stack/SdpContents.hxx:1044: warning: 'resip::invokeSdpContentsInit' defined but not used make[3]: *** [AccountingCollector.lo] Error 1 In file included from ../repro/BerkeleyDb.hxx:8, from ReproRunner.cxx:31: /usr/local/include/db_cxx.h:1395: error: expected class-name before '{' token ReproRunner.cxx: In member function 'virtual bool repro::ReproRunner::createSipStack()': ReproRunner.cxx:450: warning: unused variable 'useV6' ../rutil/Data.hxx: At global scope: ../rutil/Data.hxx:993: warning: 'resip::invokeDataInit' defined but not used ../resip/stack/SdpContents.hxx:1044: warning: 'resip::invokeSdpContentsInit' defined but not used make[3]: *** [ReproRunner.lo] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 Can anyone see what I might be doing wrong? Thanks, Lee |
From: Sebastien V. <seb...@cp...> - 2012-12-11 18:59:42
|
Hi all, Due to sourceforge changes, the SVN repository has moved to this place: svn://svn.code.sf.net/p/turnserver/code/trunk. Regards, -- Seb |
From: Sebastien V. <se...@ji...> - 2012-12-04 09:55:58
|
As I said it maybe scalability issue with select(). -- Seb Le lundi 3 décembre 2012, John Nash <joh...@gm...> a écrit : > OK. That means implementation is correct. When calls reach 30-40 on client I start getting Timeout to Allocate requests. I am able to connect to Turn port though (I used Telnet to that port and it connected without delay). At this point no new allocation is success all time out . It keeps timing out even if existing realy stop (As calls are disconnected) untill only few active relays are there ..then after around 10 mins again allocation is successful. > > Is there any User memory limitation may be there? > > Regards > > John > > On Tue, Dec 4, 2012 at 12:34 AM, Sebastien Vincent <se...@ji...> wrote: > > Hi, > > See inline. > > Le 30/11/2012 23:17, John Nash a écrit : > > Dear Seb, > > Did you get time to go over my mail? > > John > > On Sat, Nov 24, 2012 at 8:24 PM, John Nash <joh...@gm...> wrote: > > Hello Sebastien, > > Thank you for the reply. I am not much of a programmer but I am trying learn your code and will see if anything I can do to improve. But for this issue I am not too sure if it is because of some problem in the code (I could see one thread where Bill Clark tested it with test client in this post). I will share some of the details before you invest time in code. Perhaps this could be implementation issue or issue in client. > > I am using pjsip as SIP client and it has a Turn-client module. As i explained in previous mail my desired network is... > > Turn Client <------------------>TCP Control Messages<--------------->Turnserver > Turn Client<-------------------->TCP Relay Data<-----------------------> TurnServer<-------------->UDP Relay to Peer<------------>UDP Based RTP Server > > I expect that STUN control requests will go to turnserver TCP port 5743 and turnserver will respond back with relay IP and port. I assumed it will provide us 1 TCP IP:port and 1 UDP IP:port where End peer will be informed with UDP IP:port so that it can send UDP data to turn server. While the TCP IP:port will be used by Turn client to relay RTP data over TCP to turnserver which in turn will relay to end RTP Server over UDP. > > No, TURN will allow you to allocate one IP:port (by allocate request of course) for the remote peer only. > > > But when I test, I see different flow .... > > 1- Client send Allocation requests on control socket 5743 (Allocation Request > STUN Allocate request > Hdr: length=128, magic=2112a442, tsx_id=000012442cd672ae00294825 > Attributes: > REQUESTED-TRANSPORT: length=4, value=285212672 (0x11000000) > SOFTWARE: length=12, value="pjnath-2.0.1" > USERNAME: length=5, value="Test" > REALM: length=10, value="domain.org" > NONCE: length=48, value="50b0e8610000000081e88b59fb4a98fb6595134f97372287" > MESSAGE-INTEGRITY: length=20, data=4f3282e29c6681f1a284d3bdb9e0b43cf86d8d65 > > 2- Receives two back to back Allocation success responses > --- begin STUN message --- > STUN Allocate success response > Hdr: length=84, magic=2112a442, tsx_id=000012442cd672ae00294825 > Attributes: > XOR-RELAYED-ADDRESS: length=8, IPv4 addr=31.193.168.4:21193 > LIFETIME: length=4, value=1800 (0x708) > XOR-MAPPED-ADDRESS: length=8, IPv4 addr=117.199.208.17:3971 > SOFTWARE: length=14, value="TurnServer 0.7" > MESSAGE-INTEGRITY: length=20, data=ff7ceb2f630845d012532703302e1eface20159e > FINGERPRINT: length=4, value=3828074744 (0xe42bc8f8) > --- end of STUN message --- > and > --- begin STUN message --- > STUN Allocate success response > Hdr: length=84, magic=2112a442, tsx_id=000012 |