Update directories structure.

This commit is contained in:
bossiel 2010-02-07 17:03:12 +00:00
parent 184d2211d1
commit 17dd87a6b0
12 changed files with 148 additions and 81 deletions

View File

@ -29,6 +29,7 @@
*/
#include "tnet_dhcp.h"
#include "tsk_thread.h"
#include "tsk_memory.h"
#include "tsk_time.h"
#include "tsk_debug.h"
@ -36,7 +37,8 @@
// Useful link: http://support.microsoft.com/?scid=kb%3Ben-us%3B169289&x=21&y=14
// Another one: http://www.iana.org/assignments/bootp-dhcp-parameters/
/* FIXME: USE retransmission mech (*2*2...)
*/
tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_request_t* request)
{
tsk_buffer_t *output;
@ -60,7 +62,7 @@ tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_reques
if(ctx->use_ipv6)
{
localsocket6 = TNET_SOCKET_CREATE("::", ctx->port_client, tnet_socket_type_udp_ipv6);
localsocket6 = TNET_SOCKET_CREATE(TNET_SOCKET_HOST_ANY, ctx->port_client, tnet_socket_type_udp_ipv6);
if(TNET_SOCKET_IS_VALID(localsocket6))
{
clientFD = localsocket6->fd;
@ -69,7 +71,7 @@ tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_reques
}
else
{
localsocket4 = TNET_SOCKET_CREATE("0.0.0.0", ctx->port_client, tnet_socket_type_udp_ipv4);
localsocket4 = TNET_SOCKET_CREATE(TNET_SOCKET_HOST_ANY, ctx->port_client, tnet_socket_type_udp_ipv4);
if(TNET_SOCKET_IS_VALID(localsocket4))
{
clientFD = localsocket4->fd;
@ -77,19 +79,13 @@ tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_reques
else goto bail;
}
/* Always wait for 300ms before retransmission */
/* Always wait for 500ms before retransmission */
tv.tv_sec = 0;
tv.tv_usec = (300 * 1000);
/* Set FD */
FD_ZERO(&set);
FD_SET(clientFD, &set);
tv.tv_usec = (500 * 1000);
if(tnet_sockaddr_init("255.255.255.255"/* FIXME: IPv6 */, ctx->server_port, (ctx->use_ipv6 ? tnet_socket_type_udp_ipv6 : tnet_socket_type_udp_ipv4), &server))
{
TSK_DEBUG_ERROR("Failed to connect to initialize the DHCP server address [errno=%d].", tnet_geterrno());
//TNET_PRINT_LAST_ERROR();
//continue;
TNET_PRINT_LAST_ERROR("Failed to initialize the DHCP server address.");
goto bail;
}
@ -107,11 +103,18 @@ tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_reques
}
}
/* Set timeout */
timeout = tsk_time_epoch() + ctx->timeout;
do
{
tsk_list_foreach(item, ctx->interfaces)
{
iface = item->data;
/* Set FD */
FD_ZERO(&set);
FD_SET(clientFD, &set);
/* chaddr */
memset(request->chaddr, 0, sizeof(request->chaddr));
@ -127,13 +130,16 @@ tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_reques
/* Send the request to the DHCP server */
if((ret =tnet_sockfd_sendto(clientFD, (const struct sockaddr*)&server, output->data, output->size))<0)
{
TSK_DEBUG_ERROR("Failed to send the DHCP request to the remote peer [%d] [errno=%d].", ret, tnet_geterrno());
//TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("Failed to send DHCP request.");
tsk_thread_sleep(150); // wait 150ms before trying the next iface.
goto next_iface;
}
/* wait for response */
if((ret = select(clientFD+1, &set, NULL, NULL, &tv))<0)
{ /* Error */
TNET_PRINT_LAST_ERROR("select have failed.");
tsk_thread_sleep(150); // wait 150ms before trying the next iface.
goto next_iface;
}
else if(ret == 0)
@ -156,7 +162,7 @@ tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_reques
{
TSK_FREE(data);
TSK_DEBUG_ERROR("Recving DHCP dgrams failed with error code:%d", tnet_geterrno());
TNET_PRINT_LAST_ERROR("Failed to receive DHCP dgrams.");
goto next_iface;
}
@ -179,11 +185,9 @@ tnet_dhcp_reply_t* tnet_dhcp_send_request(tnet_dhcp_ctx_t* ctx, tnet_dhcp_reques
goto bail;
}
}
/* First time? ==> set timeout value */
if(!timeout) timeout = tsk_time_epoch() + ctx->timeout;
break;//FIXME
}
while(timeout < tsk_time_epoch());
while(timeout > tsk_time_epoch());
bail:
TSK_OBJECT_SAFE_FREE(localsocket4);

View File

@ -223,7 +223,7 @@ tnet_dns_response_t *tnet_dns_resolve(tnet_dns_ctx_t* ctx, const char* qname, tn
}
}
}
while(timeout < tsk_time_epoch());
while(timeout > tsk_time_epoch());
done:
TSK_OBJECT_SAFE_FREE(localsocket4);

View File

@ -97,6 +97,12 @@
# define TNET_HAVE_SS_LEN 0
#endif
#if 0 /* __APPLE__? */
# define HAVE_IFADDRS_H 1
#else
# define HAVE_IFADDRS_H 0
#endif
/* Used in TURN/STUN2 attributes.
*/
#define TNET_SOFTWARE "IM-client/OMA1.0 doubango/v0.0.0"

View File

@ -79,7 +79,7 @@ int tnet_socket_stream_connectto(tnet_socket_tcp_t *sock, const char* host, tnet
if((status = tnet_getaddrinfo(host, _port, &hints, &result)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("getaddrinfo have failed.");
goto bail;
}
@ -89,7 +89,7 @@ int tnet_socket_stream_connectto(tnet_socket_tcp_t *sock, const char* host, tnet
{
if((status = connect(sock->fd, ptr->ai_addr, ptr->ai_addrlen)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("connect have failed.");
goto bail;
}
@ -152,7 +152,7 @@ static void* tnet_socket_create(void * self, va_list * app)
{
if((status = tnet_gethostname(&local_hostname)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("gethostname have failed.");
goto bail;
}
}
@ -167,7 +167,7 @@ static void* tnet_socket_create(void * self, va_list * app)
/* Performs getaddrinfo */
if((status = tnet_getaddrinfo(local_hostname, port, &hints, &result)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("getaddrinfo have failed.");
goto bail;
}
@ -180,7 +180,7 @@ static void* tnet_socket_create(void * self, va_list * app)
/* Get local IP string. */
if((status = tnet_getnameinfo(ptr->ai_addr, ptr->ai_addrlen, sock->ip, sizeof(sock->ip), 0, 0, NI_NUMERICHOST)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("getnameinfo have failed");
tnet_socket_close(sock);
continue;
}
@ -188,7 +188,7 @@ static void* tnet_socket_create(void * self, va_list * app)
{
if((status = bind(sock->fd, ptr->ai_addr, ptr->ai_addrlen)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("bind have failed.");
tnet_socket_close(sock);
continue;
}
@ -196,7 +196,7 @@ static void* tnet_socket_create(void * self, va_list * app)
{
if(sock->port == TNET_SOCKET_PORT_ANY && (status = tnet_get_port(sock->fd, &(sock->port))))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("Failed to retrieve IP and Port.");
tnet_socket_close(sock);
continue;
}
@ -209,7 +209,7 @@ static void* tnet_socket_create(void * self, va_list * app)
/* Check socket validity. */
if(!TNET_SOCKET_IS_VALID(sock))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("Invalid socket.");
goto bail;
}
@ -222,7 +222,7 @@ static void* tnet_socket_create(void * self, va_list * app)
#endif
if(setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(int)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("setsockopt(SO_REUSEADDR) have failed.");
}
}

View File

@ -153,7 +153,7 @@ tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const
/* Add the socket */
if((status = tnet_transport_add_socket(handle, fd)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR(Failed to add new socket.");
tnet_sockfd_close(&fd);
goto bail;
@ -177,7 +177,7 @@ tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const
}
else
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("connect have failed.");
//--tnet_sockfd_close(&fd);
goto bail;
@ -204,7 +204,7 @@ size_t tnet_transport_send(const tnet_transport_handle_t *handle, tnet_fd_t from
if((numberOfBytesSent = send(from, buf, size, 0)) <= 0)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("send have failed.");
//tnet_sockfd_close(&from);
goto bail;
@ -233,7 +233,7 @@ size_t tnet_transport_sendto(const tnet_transport_handle_t *handle, tnet_fd_t fr
if((numberOfBytesSent = sendto(from, buf, size, 0, to, sizeof(*to))) <= 0)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("sendto have failed.");
goto bail;
}
@ -365,7 +365,7 @@ void *tnet_transport_mainthread(void *param)
{
if(listen(transport->master->fd, TNET_MAX_FDS))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("listen have failed.");
goto bail;
}
}
@ -373,7 +373,7 @@ void *tnet_transport_mainthread(void *param)
/* Create and add pipes to the fd_set */
if((ret = pipe(pipes)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("Failed to create new pipes.");
goto bail;
}
transport_socket_add(pipes[0], context); // Add pipeR
@ -392,7 +392,7 @@ void *tnet_transport_mainthread(void *param)
if((ret = tnet_poll(context->ufds, context->count, -1)) < 0)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("poll have failed.");
goto bail;
}
@ -426,8 +426,7 @@ void *tnet_transport_mainthread(void *param)
*/
if(tnet_ioctlt(active_socket->fd, FIONREAD, &len) < 0)
{
TSK_DEBUG_ERROR("IOCTLT FAILED.");
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("IOCTLT FAILED.");
continue;
}
if(!(buffer = tsk_calloc(len, sizeof(uint8_t))))
@ -447,7 +446,7 @@ void *tnet_transport_mainthread(void *param)
//else
{
transport_socket_remove(i, context);
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("recv have failed.");
continue;
}
}

View File

@ -127,7 +127,7 @@ int tnet_transport_add_socket(const tnet_transport_handle_t *handle, tnet_fd_t f
if(WSAEventSelect(fd, context->events[context->count - 1], FD_ALL_EVENTS) == SOCKET_ERROR)
{
transport_socket_remove((context->count - 1), context);
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSAEventSelect have failed.");
return -1;
}
@ -183,7 +183,7 @@ tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const
/* Add the socket */
if(status = tnet_transport_add_socket(handle, fd))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("Failed to add new socket.");
tnet_sockfd_close(&fd);
goto bail;
@ -203,7 +203,7 @@ tnet_fd_t tnet_transport_connectto(const tnet_transport_handle_t *handle, const
}
else
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSAConnect have failed.");
tnet_sockfd_close(&fd);
goto bail;
@ -242,7 +242,7 @@ size_t tnet_transport_send(const tnet_transport_handle_t *handle, tnet_fd_t from
}
else
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSASend have failed.");
//tnet_sockfd_close(&from);
goto bail;
@ -288,7 +288,7 @@ size_t tnet_transport_sendto(const tnet_transport_handle_t *handle, tnet_fd_t fr
}
else
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSASendTo have failed.");
return ret;
}
} else ret = 0;
@ -387,7 +387,7 @@ void *tnet_transport_mainthread(void *param)
{
if(listen(transport->master->fd, WSA_MAXIMUM_WAIT_EVENTS))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("listen have failed.");
goto bail;
}
}
@ -396,7 +396,7 @@ void *tnet_transport_mainthread(void *param)
transport_socket_add(transport->master->fd, context);
if(ret = WSAEventSelect(transport->master->fd, context->events[context->count - 1], TNET_SOCKET_TYPE_IS_DGRAM(transport->master->type) ? FD_READ : FD_ALL_EVENTS/*FD_ACCEPT | FD_READ | FD_CONNECT | FD_CLOSE*/) == SOCKET_ERROR)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSAEventSelect have failed.");
goto bail;
}
@ -410,7 +410,7 @@ void *tnet_transport_mainthread(void *param)
/* Wait for multiple events */
if((evt = WSAWaitForMultipleEvents(context->count, context->events, FALSE, WSA_INFINITE, FALSE)) == WSA_WAIT_FAILED)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSAWaitForMultipleEvents have failed.");
goto bail;
}
@ -427,7 +427,7 @@ void *tnet_transport_mainthread(void *param)
/* Get the network events flags */
if (WSAEnumNetworkEvents(active_socket->fd, active_event, &networkEvents) == SOCKET_ERROR)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSAEnumNetworkEvents have failed.");
goto bail;
}
@ -440,8 +440,7 @@ void *tnet_transport_mainthread(void *param)
if(networkEvents.iErrorCode[FD_ACCEPT_BIT])
{
TSK_DEBUG_ERROR("ACCEPT FAILED.");
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("ACCEPT FAILED.");
continue;
}
@ -453,14 +452,13 @@ void *tnet_transport_mainthread(void *param)
if(WSAEventSelect(fd, context->events[context->count - 1], FD_READ | FD_WRITE | FD_CLOSE) == SOCKET_ERROR)
{
transport_socket_remove((context->count - 1), context);
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSAEventSelect have failed.");
continue;
}
}
else
{
TSK_DEBUG_ERROR("ACCEPT FAILED.");
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("ACCEPT FAILED.");
continue;
}
@ -478,8 +476,7 @@ void *tnet_transport_mainthread(void *param)
if(networkEvents.iErrorCode[FD_CONNECT_BIT])
{
TSK_DEBUG_ERROR("CONNECT FAILED.");
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("CONNECT FAILED.");
continue;
}
else
@ -499,16 +496,14 @@ void *tnet_transport_mainthread(void *param)
if(networkEvents.iErrorCode[FD_READ_BIT])
{
TSK_DEBUG_ERROR("READ FAILED.");
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("READ FAILED.");
continue;
}
/* Retrieve the amount of pending data */
if(tnet_ioctlt(active_socket->fd, FIONREAD, &(wsaBuffer.len)) < 0)
{
TSK_DEBUG_ERROR("IOCTLT FAILED.");
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("IOCTLT FAILED.");
continue;
}
/* Alloc data */
@ -530,7 +525,7 @@ void *tnet_transport_mainthread(void *param)
TSK_FREE(wsaBuffer.buf);
transport_socket_remove(index, context);
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WSARecv have failed.");
continue;
}
}
@ -554,8 +549,7 @@ void *tnet_transport_mainthread(void *param)
if(networkEvents.iErrorCode[FD_WRITE_BIT])
{
TSK_DEBUG_ERROR("WRITE FAILED.");
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("WRITE FAILED.");
continue;
}
}

View File

@ -46,6 +46,11 @@
# include <fcntl.h>
# include <sys/ioctl.h>
# include <unistd.h>
# if HAVE_IFADDRS_H
# include <ifaddrs.h>
# else
# include <net/if.h>
# endif
# if TNET_HAVE_POLL
# include <poll.h>
# endif /* TNET_HAVE_POLL */

View File

@ -101,7 +101,7 @@ tnet_interfaces_L_t* tnet_get_interfaces()
{
tnet_interfaces_L_t * ifaces = TSK_LIST_CREATE();
#if TSK_UNDER_WINDOWS
#if TSK_UNDER_WINDOWS /*=== WINDOWS XP/VISTA/7/CE===*/
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
@ -152,9 +152,68 @@ tnet_interfaces_L_t* tnet_get_interfaces()
#undef FREE
#else /* !TSK_UNDER_WINDOWS */
#elif HAVE_IFADDRS_H /*=== Using getifaddrs ===*/
// see http://www.kernel.org/doc/man-pages/online/pages/man3/getifaddrs.3.html
struct ifaddrs *ifaddr, *ifa;
/* Get interfaces */
//if(getifaddrs(&ifaddr) == -1)
{
TSK_DEBUG_ERROR("getifaddrs failed and errno= [%d]", tnet_geterrno());
goto bail;
}
#else /*=== ANDROID,... --> Using SIOCGIFCONF and SIOCGIFHWADDR ===*/
tnet_fd_t fd = TNET_INVALID_FD;
char buffer[1024];
struct ifconf ifc;
struct sockaddr_in *sin;
struct ifreq *ifr;
if((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
{
TSK_DEBUG_ERROR("Failed to create new DGRAM socket and errno= [%d]", tnet_geterrno());
goto done;
}
ifc.ifc_len = sizeof(buffer);
ifc.ifc_buf = buffer;
if(ioctl(fd, SIOCGIFCONF, &ifc) < 0)
{
TSK_DEBUG_ERROR("ioctl(SIOCGIFCONF) failed and errno= [%d]", tnet_geterrno());
goto done;
}
for(ifr = ifc.ifc_req; ifr && !tsk_strempty(ifr->ifr_name); ifr++)
{
sin = (struct sockaddr_in *)&(ifr->ifr_addr);
// TODO: IPAddress if needed
if(/*ioctl(fd, SIOCGIFFLAGS, &ifr) == 0*/1)
{
if (!(ifr->ifr_flags & IFF_LOOPBACK))
{
if(/*ioctl(fd, SIOCGIFHWADDR, &ifr) == 0*/1)
{
tnet_interface_t *iface = TNET_INTERFACE_CREATE(ifr->ifr_name, ifr->ifr_hwaddr.sa_data, 6);
tsk_list_push_back_data(ifaces, (void**)&(iface));
}
}
}
else
{
TSK_DEBUG_ERROR("ioctl(SIOCGIFFLAGS) failed and errno= [%d]", tnet_geterrno());
}
}
done:
tnet_sockfd_close(&fd);
// use SIOCGIFCONF ioctl
#endif
@ -479,7 +538,7 @@ int tnet_sockaddrinfo_init(const char *host, tnet_port_t port, enum tnet_socket_
/* Performs getaddrinfo */
if((status = tnet_getaddrinfo(host, p, &hints, &result)))
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("getaddrinfo have failed.");
goto bail;
}
@ -541,7 +600,7 @@ int tnet_sockfd_init(const char *host, tnet_port_t port, enum tnet_socket_type_e
if((*fd = socket(ai_family, ai_socktype, ai_protocol)) == TNET_INVALID_SOCKET)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("Failed to create new socket.");
goto bail;
}
@ -558,7 +617,7 @@ int tnet_sockfd_init(const char *host, tnet_port_t port, enum tnet_socket_type_e
if((status = bind(*fd, (const struct sockaddr*)&ai_addr, sizeof(ai_addr))))
#endif
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("bind have failed.");
tnet_sockfd_close(fd);
goto bail;
@ -578,19 +637,19 @@ int tnet_sockfd_set_mode(tnet_fd_t fd, int nonBlocking)
if(ioctlsocket(fd, FIONBIO, &mode))
//if(WSAIoctl(fd, FIONBIO, &nonblocking, sizeof(nonblocking), NULL, 0, NULL, NULL, NULL) == SOCKET_ERROR)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("ioctlsocket(FIONBIO) have failed.");
return -1;
}
#else
int flags;
if((flags = fcntl(fd, F_GETFL, 0)) < 0)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("fcntl(F_GETFL) have failed.");
return -1;
}
if(fcntl(fd, F_SETFL, flags | (nonBlocking ? O_NONBLOCK : ~O_NONBLOCK)) < 0)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("fcntl(O_NONBLOCK/O_NONBLOCK) have failed.");
return -1;
}
#endif

View File

@ -117,11 +117,11 @@ TINYNET_API int tnet_sockfd_recv(tnet_fd_t fd, void* buf, size_t size, int flags
TINYNET_API int tnet_sockfd_close(tnet_fd_t *fd);
#define TNET_PRINT_LAST_ERROR() \
#define TNET_PRINT_LAST_ERROR(msg) \
{ \
tnet_error_t error; \
tnet_getlasterror(&error); \
TSK_DEBUG_ERROR("Network error --> %s", error); \
TSK_DEBUG_ERROR("[%s]\nNetwork error ==> %s", msg, error); \
}

View File

@ -498,7 +498,7 @@ int tnet_turn_channel_senddata(const struct tnet_nat_context_s* nat_context, con
if(tnet_sockfd_sendto(channel_bind->allocation->localFD, (struct sockaddr*)&channel_bind->allocation->server, output->data, output->size) <= 0)
{
TNET_PRINT_LAST_ERROR();
TNET_PRINT_LAST_ERROR("Failed to send TURN messsage.");
ret = -2;
goto bail;
}

View File

@ -371,6 +371,10 @@
RelativePath=".\test_auth.h"
>
</File>
<File
RelativePath=".\test_dhcp.h"
>
</File>
<File
RelativePath=".\test_dns.h"
>
@ -395,10 +399,6 @@
RelativePath=".\test_transport.h"
>
</File>
<File
RelativePath=".\tnet_dhcp.h"
>
</File>
</Filter>
<File
RelativePath=".\ReadMe.txt"

View File

@ -22,7 +22,7 @@
#ifndef TNET_TEST_TRANSPORT_H
#define TNET_TEST_TRANSPORT_H
#define REMOTE_IP4 "192.168.0.15"
#define REMOTE_IP4 "ekiga.net"//"192.168.0.15"
#define REMOTE_IP6 "2a01:e35:8632:7050:6122:2706:2124:32cb"
#define REMOTE_IP REMOTE_IP4
@ -33,8 +33,8 @@
#endif
#define LOCAL_IP6 TNET_SOCKET_HOST_ANY
#if /*defined(ANDROID)*/1
# define LOCAL_PORT TNET_SOCKET_PORT_ANY
#if defined(ANDROID)
# define LOCAL_PORT 5060
#else
# define LOCAL_PORT TNET_SOCKET_PORT_ANY
#endif