mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-11-03 04:17:20 -05: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:
parent
dd9da9ddb2
commit
315259ae9f
@ -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;
|
||||
|
13
net/sock.c
13
net/sock.c
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user