Commit c5ceb2e7 authored by Martti Mela's avatar Martti Mela
Browse files

added win32 defs

darcs-hash:20060311111451-1b897-abcb1cf580069eedd221a34377eee06a9f79b640.gz
parent 7a4d9a82
...@@ -53,6 +53,12 @@ ...@@ -53,6 +53,12 @@
#include <sofia-sip/su_uniqueid.h> #include <sofia-sip/su_uniqueid.h>
#ifndef EBADMSG
/*xxx -- mela: check the number */
#define EBADMSG 71
#endif
#if !HAVE_MEMMEM #if !HAVE_MEMMEM
void *memmem(const void *haystack, size_t haystacklen, void *memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen); const void *needle, size_t needlelen);
......
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
#include "sofia-sip/msg_mclass_hash.h" #include "sofia-sip/msg_mclass_hash.h"
#include "sofia-sip/msg_mime.h" #include "sofia-sip/msg_mime.h"
#if !defined(ENOBUFS) || defined(_WIN32)
#define ENOBUFS WSAENOBUFS
#endif
#if HAVE_FUNC #if HAVE_FUNC
#elif HAVE_FUNCTION #elif HAVE_FUNCTION
#define __func__ __FUNCTION__ #define __func__ __FUNCTION__
......
...@@ -42,9 +42,12 @@ ...@@ -42,9 +42,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifndef _WIN32
#include <sys/mman.h> #include <sys/mman.h>
#endif
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include <sofia-sip/su_types.h> #include <sofia-sip/su_types.h>
#include <sofia-sip/su_alloc_stat.h> #include <sofia-sip/su_alloc_stat.h>
...@@ -270,15 +273,23 @@ int validate_file(int fd, char const *name, context_t *ctx) ...@@ -270,15 +273,23 @@ int validate_file(int fd, char const *name, context_t *ctx)
return -1; return -1;
} }
#ifndef _WIN32
p = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0L); p = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0L);
if (p == NULL) { if (p == NULL) {
perror("mmap"); perror("mmap");
return -1; return -1;
} }
retval = validate_dump(p, size, ctx); retval = validate_dump(p, size, ctx);
munmap(p, size); munmap(p, size);
return retval; return retval;
#else
errno = EINVAL;
perror("mmap not implemented");
return -1;
#endif
} }
static inline static inline
......
...@@ -49,12 +49,14 @@ ...@@ -49,12 +49,14 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#if defined(HAVE_OPENSSL)
/* avoid krb5-related build failures */ /* avoid krb5-related build failures */
#define OPENSSL_NO_KRB5 #define OPENSSL_NO_KRB5
#include <openssl/sha.h> #include <openssl/sha.h>
#include <openssl/hmac.h> #include <openssl/hmac.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/x509.h> #include <openssl/x509.h>
#endif
#include <sofia-sip/su.h> #include <sofia-sip/su.h>
#include <sofia-sip/su_localinfo.h> #include <sofia-sip/su_localinfo.h>
......
...@@ -678,7 +678,7 @@ int assign_socket(stun_discovery_t *sd, su_socket_t s) ...@@ -678,7 +678,7 @@ int assign_socket(stun_discovery_t *sd, su_socket_t s)
/* Register receiving function with events specified above */ /* Register receiving function with events specified above */
if ((sd->sd_index = su_root_register(sh->sh_root, if ((sd->sd_index = su_root_register(sh->sh_root,
wait, stun_bind_callback, wait, stun_bind_callback,
(su_wakeup_arg_t *) sh, 0)) < 0) { (su_wakeup_arg_t *) sd, 0)) < 0) {
STUN_ERROR(errno, su_root_register); STUN_ERROR(errno, su_root_register);
return -1; return -1;
} }
...@@ -1380,7 +1380,8 @@ stun_request_t *find_request(stun_handle_t *self, uint16_t *id) ...@@ -1380,7 +1380,8 @@ stun_request_t *find_request(stun_handle_t *self, uint16_t *id)
/** Process socket event */ /** Process socket event */
int stun_bind_callback(stun_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg) int stun_bind_callback(stun_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
{ {
stun_handle_t *self = arg; stun_discovery_t *sd = arg;
stun_handle_t *self = sd->sd_handle;
int retval = -1, err = -1, dgram_len; int retval = -1, err = -1, dgram_len;
char ipaddr[SU_ADDRSIZE + 2]; char ipaddr[SU_ADDRSIZE + 2];
...@@ -1388,7 +1389,7 @@ int stun_bind_callback(stun_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg) ...@@ -1388,7 +1389,7 @@ int stun_bind_callback(stun_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
unsigned char dgram[512] = { 0 }; unsigned char dgram[512] = { 0 };
su_sockaddr_t recv; su_sockaddr_t recv;
socklen_t recv_len; socklen_t recv_len;
su_socket_t s = su_wait_socket(w); su_socket_t s = sd->sd_socket;
int events = su_wait_events(w, s); int events = su_wait_events(w, s);
enter; enter;
...@@ -2593,7 +2594,7 @@ int stun_process_request(su_socket_t s, stun_msg_t *req, ...@@ -2593,7 +2594,7 @@ int stun_process_request(su_socket_t s, stun_msg_t *req,
int from_len) int from_len)
{ {
stun_msg_t resp; stun_msg_t resp;
su_sockaddr_t m_addr[1] = {{ 0 }}, s_addr[1] = {{ 0 }}, c_addr[1] = {{ 0 }}; su_sockaddr_t mod_addr[1] = {{ 0 }}, src_addr[1] = {{ 0 }}, chg_addr[1] = {{ 0 }};
stun_attr_t *tmp, m_attr[1], s_attr[1], c_attr[1], **p; stun_attr_t *tmp, m_attr[1], s_attr[1], c_attr[1], **p;
su_sockaddr_t to_addr; su_sockaddr_t to_addr;
int c, i; int c, i;
...@@ -2620,8 +2621,8 @@ int stun_process_request(su_socket_t s, stun_msg_t *req, ...@@ -2620,8 +2621,8 @@ int stun_process_request(su_socket_t s, stun_msg_t *req,
/* MAPPED-ADDRESS */ /* MAPPED-ADDRESS */
tmp = m_attr; tmp = m_attr;
tmp->attr_type = MAPPED_ADDRESS; tmp->attr_type = MAPPED_ADDRESS;
memcpy(m_addr, from_addr, sizeof(*m_addr)); memcpy(mod_addr, from_addr, sizeof(*mod_addr));
tmp->pattr = m_addr; tmp->pattr = mod_addr;
tmp->next = NULL; tmp->next = NULL;
*p = tmp; p = &(tmp->next); *p = tmp; p = &(tmp->next);
...@@ -2652,16 +2653,16 @@ int stun_process_request(su_socket_t s, stun_msg_t *req, ...@@ -2652,16 +2653,16 @@ int stun_process_request(su_socket_t s, stun_msg_t *req,
tmp = s_attr; tmp = s_attr;
tmp->attr_type = SOURCE_ADDRESS; tmp->attr_type = SOURCE_ADDRESS;
/* memcpy(s_addr, &stun_change_map[c][sid], sizeof(*s_addr)); */ /* memcpy(src_addr, &stun_change_map[c][sid], sizeof(*src_addr)); */
tmp->pattr = s_addr; tmp->pattr = src_addr;
tmp->next = NULL; tmp->next = NULL;
*p = tmp; p = &(tmp->next); *p = tmp; p = &(tmp->next);
/* CHANGED-ADDRESS */ /* depends on sid */ /* CHANGED-ADDRESS */ /* depends on sid */
tmp = c_attr; tmp = c_attr;
tmp->attr_type = CHANGED_ADDRESS; tmp->attr_type = CHANGED_ADDRESS;
/* memcpy(c_addr, &stun_change_map[3][sid], sizeof(*c_addr)); */ /* memcpy(chg_addr, &stun_change_map[3][sid], sizeof(*chg_addr)); */
tmp->pattr = c_addr; tmp->pattr = chg_addr;
tmp->next = NULL; tmp->next = NULL;
*p = tmp; p = &(tmp->next); *p = tmp; p = &(tmp->next);
......
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