Commit 80d298e5 authored by Martti Mela's avatar Martti Mela

stun: works on WINDOWS!

darcs-hash:20060114034526-1b897-736ec4710d8c04f0e38027f92610bc0110af0973.gz
parent 44ebd7a2
This diff is collapsed.
......@@ -178,7 +178,7 @@ int stun_handle_set_uname_pwd(stun_handle_t *sh,
const char *pwd,
int len_pwd);
su_localinfo_t *stun_request_get_localinfo(stun_request_t *req);
su_sockaddr_t *stun_discovery_get_address(stun_discovery_t *sd);
/** Determine length of STUN message (0 if not stun). */
int stun_message_length(void *data, int len, int end_of_message);
......
......@@ -135,7 +135,10 @@ int stun_parse_attribute(stun_msg_t *msg, unsigned char *p) {
case TURN_DESTINATION_ADDRESS:
case TURN_SOURCE_ADDRESS:
#endif
if(stun_parse_attr_address(attr, p, len) < 0) { free(attr); return -1; }
if (stun_parse_attr_address(attr, p, len) < 0) {
free(attr);
return -1;
}
break;
case ERROR_CODE:
if(stun_parse_attr_error_code(attr, p, len) <0) { free(attr); return -1; }
......
......@@ -62,9 +62,9 @@ extern char const STUN_DEBUG[]; /* dummy declaration for Doxygen */
/* XXX -- mela: note that this are 100 times too small */
#if 1
#define STUN_LIFETIME_EST 350 /**< 6 min? */
#define STUN_LIFETIME_MAX 1800 /**< 30 min? */
#define STUN_LIFETIME_CI 5 /**< 5 sec confidence interval */
#define STUN_LIFETIME_EST 3500 /**< 6 min? */
#define STUN_LIFETIME_MAX 18000 /**< 30 min? */
#define STUN_LIFETIME_CI 50 /**< 5 sec confidence interval */
#else
#define STUN_LIFETIME_EST 350 /**< 6 min? */
#define STUN_LIFETIME_MAX 1800 /**< 30 min? */
......
......@@ -73,7 +73,7 @@ void stunc_callback(stunc_t *stunc, stun_handle_t *sh,
stun_action_t action,
stun_state_t event)
{
su_localinfo_t *li = NULL;
su_sockaddr_t *sa = NULL;
char ipaddr[48];
char const *nattype;
int lifetime;
......@@ -105,10 +105,11 @@ void stunc_callback(stunc_t *stunc, stun_handle_t *sh,
break;
case stun_bind_done:
li = stun_request_get_localinfo(req);
inet_ntop(li->li_family, SU_ADDR(li->li_addr), ipaddr, sizeof(ipaddr)),
SU_DEBUG_0(("%s: local address NATed as %s:%u\n", __func__,
ipaddr, (unsigned) ntohs(li->li_addr->su_port)));
sa = stun_discovery_get_address(sd);
SU_DEBUG_0(("%s: local address NATed as %s:%u\n", __func__,
inet_ntop(sa->su_family, SU_ADDR(sa),
ipaddr, sizeof(ipaddr)),
(unsigned) ntohs(sa->su_port)));
/* su_root_break(stun_handle_root(sh)); */
if (stun_handle_get_nattype(sh, STUNTAG_SOCKET(s), TAG_NULL()) < 0) {
......
......@@ -184,7 +184,7 @@ void torture_callback(torture_t *t,
SU_DEBUG_3(("%s: called by event \"%s\"\n", __func__, stun_str_state(event)));
if (event == stun_bind_done) {
li = stun_request_get_localinfo(req);
li = stun_discovery_get_address(sd);
/* s = stun_handle_get_bind_socket(sh); */
inet_ntop(li->li_family, SU_ADDR(li->li_addr), ipaddr, sizeof(ipaddr)),
......
......@@ -35,16 +35,13 @@
* @date Created: Thu Mar 18 19:40:51 1999 pessi
*/
#ifndef _WIN32
#if !defined(_WIN32) || defined(__CYGWIN)
# include <su_configure.h>
# define SU_DLL
#else
# include <su_configure_win32.h>
# ifndef SU_DLL
# define SU_DLL __declspec(dllimport)
# endif
#endif
#define SU_DLL
#if defined(__GNUC__)
#if __GNUC__ < 3 && (!defined(__GNUC_MINOR__) || __GNUC_MINOR__ < 96)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment