1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-06-16 06:15:24 +00:00

Win32 updates. Mostly header fixes and defines for windows. Apparently

interface is a reserved word, so we've renamed one variable.  There's
also no sethostent on win32, and Oddsock seems to think we need
DeleteCriticalSection instead of DestroyCriticalSection.  I was unable
to figure out from msdn.microsoft.com why this was, but I'll trust
Oddsock's judgement.

svn path=/trunk/net/; revision=2194
This commit is contained in:
Jack Moffitt 2001-10-20 05:57:28 +00:00
parent dd9da9ddb2
commit 315259ae9f
3 changed files with 16 additions and 12 deletions

View File

@ -7,15 +7,18 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <string.h>
#ifndef _WIN32
#include <sys/socket.h>
#include <pthread.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#else
#include <winsock.h>
#define sethostent(x)
#endif
#include "resolver.h"
@ -156,7 +159,7 @@ void resolver_shutdown(void)
#ifndef _WIN32
pthread_mutex_destroy(&_resolver_mutex);
#else
DestroyCriticalSection(&_resolver_mutex);
DeleteCriticalSection(&_resolver_mutex);
#endif
_initialized = 0;

View File

@ -23,24 +23,25 @@
#include <stdlib.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/poll.h>
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#ifndef _WIN32
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <netdb.h>
#include <sys/poll.h>
#else
#include <winsock.h>
#include <winsock2.h>
#define vsnprintf _vsnprintf
#define EINPROGRESS WSAEINPROGRESS
#define ENOTSOCK WSAENOTSOCK
#define EWOULDBLOCK WSAEWOULDBLOCK
#endif
#include "sock.h"
@ -415,7 +416,7 @@ sock_t sock_connect_wto(const char *hostname, const int port, const int timeout)
** interface. if interface is null, listen on all interfaces.
** returns the socket, or SOCK_ERROR on failure
*/
sock_t sock_get_server_socket(const int port, char *interface)
sock_t sock_get_server_socket(const int port, char *sinterface)
{
#ifdef HAVE_IPV6
struct sockaddr_storage sa;
@ -435,8 +436,8 @@ sock_t sock_get_server_socket(const int port, char *interface)
sa_len = sizeof (struct sockaddr_in);
/* set the interface to bind to if specified */
if (interface != NULL) {
if (!resolver_getip(interface, ip, sizeof (ip)))
if (sinterface != NULL) {
if (!resolver_getip(sinterface, ip, sizeof (ip)))
return SOCK_ERROR;
#ifdef HAVE_IPV6

View File

@ -23,7 +23,7 @@
#define __SOCK_H
#ifdef _WIN32
#include <winsock.h>
#include <winsock2.h>
typedef SOCKET sock_t
#else
typedef int sock_t;
@ -59,7 +59,7 @@ int sock_read_bytes(sock_t sock, char *buff, const int len);
int sock_read_line(sock_t sock, char *string, const int len);
/* server socket functions */
sock_t sock_get_server_socket(const int port, char *interface);
sock_t sock_get_server_socket(const int port, char *sinterface);
int sock_listen(sock_t serversock, int backlog);
int sock_accept(sock_t serversock, char *ip, int len);