Commit 5f403118 authored by Martti Mela's avatar Martti Mela
Browse files

rest of win32 defs, compiles and installs in mingw environment

darcs-hash:20060313132534-1b897-d65285e0ca28093cac3bdc3e496a4d2ea8ab7f97.gz
parent 39c3ced9
......@@ -85,6 +85,10 @@ char *argv0;
#include <sofia-sip/tstdef.h>
#if defined(_WIN32)
#include <fcntl.h>
#endif
char const name[] = "test_auth_digest";
/* Fake su_time() implementation */
......@@ -932,6 +936,8 @@ int test_digest_client()
char tmppasswd[] = "/tmp/test_auth_digest.XXXXXX";
#include <unistd.h>
static void rmtmp(void)
{
if (tmppasswd[0])
......@@ -958,7 +964,11 @@ int test_module_io()
BEGIN();
#ifndef _WIN32
tmpfd = mkstemp(tmppasswd); TEST_1(tmpfd != -1);
#else
tmpfd = open(tmppasswd, O_WRONLY); TEST_1(tmpfd != -1);
#endif
atexit(rmtmp); /* Make sure temp file is unlinked */
TEST(write(tmpfd, passwd, strlen(passwd)), strlen(passwd));
......
......@@ -142,9 +142,12 @@ int main(int argc, char *argv[])
server_break, 0);
signal(SIGINT, server_intr_handler);
#ifndef _WIN32
signal(SIGPIPE, server_intr_handler);
signal(SIGQUIT, server_intr_handler);
signal(SIGHUP, server_intr_handler);
#endif
if (context->c_root) {
context->c_site =
......
......@@ -41,6 +41,10 @@
#include <sofia-sip/string0.h>
#if !defined(EALREADY) && defined(_WIN32)
#define EALREADY WSAEALREADY
#endif
typedef struct server_s server_t;
/** @internal SU timer argument pointer type */
......
......@@ -51,6 +51,10 @@
#include <sigcomp.h>
#endif
#if !defined(random) && defined(_WIN32)
#define random rand
#endif
/* ====================================================================== */
/* Register usage */
......
......@@ -52,6 +52,10 @@
#include "nua_stack.h"
#include <sofia-sip/soa.h>
#if !defined(random) && defined(_WIN32)
#define random rand
#endif
#ifndef SDP_H
typedef struct sdp_session_s sdp_session_t;
#endif
......
......@@ -49,6 +49,10 @@
#include "nua_stack.h"
#if !defined(random) && defined(_WIN32)
#define random rand
#endif
/* ---------------------------------------------------------------------- */
/* Subcribe event usage */
......
......@@ -54,6 +54,11 @@ struct binding;
#include <stdlib.h>
#include <assert.h>
#if !defined(EADDRNOTAVAIL) && defined(_WIN32)
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
#endif
#define LIST_PROTOS(STORAGE, PREFIX, T) \
STORAGE void PREFIX ##_insert(T **list, T *node), \
PREFIX ##_remove(T *node)
......
......@@ -64,6 +64,10 @@ struct call;
#include <signal.h>
#endif
#if defined(_WIN32)
#include <fcntl.h>
#endif
extern su_log_t nua_log[];
extern su_log_t soa_log[];
extern su_log_t nea_log[];
......@@ -1133,7 +1137,11 @@ int test_init(struct context *ctx,
if (print_headings)
printf("TEST NUA-2.1.1: init proxy P\n");
#ifndef _WIN32
temp = mkstemp(passwd_name); TEST_1(temp != -1);
#else
temp = open(passwd_name, O_WRONLY); TEST_1(temp != -1);
#endif
atexit(remove_tmp); /* Make sure temp file is unlinked */
TEST(write(temp, passwd, strlen(passwd)), strlen(passwd));
......@@ -1171,8 +1179,10 @@ int test_init(struct context *ctx,
/* Try to use different family than proxy. */
if (p_uri->url_host[0] == '[')
family = AF_INET;
#if defined(SU_HAVE_IN6)
else
family = AF_INET6;
#endif
ctx->nat = test_nat_create(ctx->root, family, TAG_END());
......@@ -1180,6 +1190,8 @@ int test_init(struct context *ctx,
printf("%s:%u: NUA-2.1.2: failed to get private NAT address\n",
__FILE__, __LINE__);
}
#if defined(SU_HAVE_IN6)
else if (su->su_family == AF_INET6) {
a_uri = (void *)
su_sprintf(ctx->home, "sip:[%s]:%u",
......@@ -1187,6 +1199,7 @@ int test_init(struct context *ctx,
ntohs(su->su_port));
a_bind = "sip:[::]:*";
}
#endif
else if (su->su_family == AF_INET) {
a_uri = (void *)
su_sprintf(ctx->home, "sip:%s:%u",
......@@ -1195,6 +1208,7 @@ int test_init(struct context *ctx,
a_bind = "sip:0.0.0.0:*";
}
#if defined(SU_HAVE_IN6)
if (p_uri->url_host[0] == '[') {
su->su_len = sulen = (sizeof su->su_sin6), su->su_family = AF_INET6;
len = strcspn(p_uri->url_host + 1, "]"); assert(len < sizeof b);
......@@ -1205,6 +1219,10 @@ int test_init(struct context *ctx,
su->su_len = sulen = (sizeof su->su_sin), su->su_family = AF_INET;
inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
}
#else
su->su_len = sulen = (sizeof su->su_sin), su->su_family = AF_INET;
inet_pton(su->su_family, p_uri->url_host, SU_ADDR(su));
#endif
su->su_port = htons(strtoul(url_port(p_uri), NULL, 10));
......
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