modified to compile under Windows with WIN32 switch
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@19 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
40186d3e9c
commit
bc2941c2a7
@ -38,7 +38,9 @@
|
||||
#define MINVAL( a, b ) ( (a) < (b) ? (a) : (b) )
|
||||
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )
|
||||
|
||||
#define XINLINE inline
|
||||
#ifndef WIN32
|
||||
#define XINLINE inline
|
||||
#endif
|
||||
|
||||
#define MEMBUF_DEF_SIZE_INC 20
|
||||
|
||||
|
@ -32,6 +32,10 @@
|
||||
#include <string.h>
|
||||
#include "ixmlparser.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
|
||||
static char g_error_char = '\0';
|
||||
|
||||
static const char LESSTHAN = '<';
|
||||
|
@ -78,10 +78,12 @@ typedef enum priority {LOW_PRIORITY,
|
||||
#endif
|
||||
|
||||
//DEBUGGING
|
||||
#ifdef DEBUG
|
||||
#define DBGONLY(x) x
|
||||
#else
|
||||
#define DBGONLY(x)
|
||||
#ifndef WIN32
|
||||
#ifdef DEBUG
|
||||
#define DBGONLY(x) x
|
||||
#else
|
||||
#define DBGONLY(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "LinkedList.h"
|
||||
|
@ -43,7 +43,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
|
||||
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
|
||||
@ -524,10 +526,14 @@ extern "C" {
|
||||
*****************************************************************************/
|
||||
#define imillisleep(x) usleep(1000*x)
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define __DLLEXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define __DLLEXPORT
|
||||
#endif
|
||||
|
||||
//NK: Added for satisfying the gcc compiler
|
||||
int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||
__DLLEXPORT int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -92,11 +92,15 @@ FreeThreadPoolJob( ThreadPool * tp,
|
||||
static int
|
||||
SetPolicyType( PolicyType in )
|
||||
{
|
||||
struct sched_param current;
|
||||
#ifdef WIN32
|
||||
return sched_setscheduler( 0, in);
|
||||
#else
|
||||
struct sched_param current;
|
||||
|
||||
sched_getparam( 0, ¤t );
|
||||
current.sched_priority = DEFAULT_SCHED_PARAM;
|
||||
return sched_setscheduler( 0, in, ¤t );
|
||||
sched_getparam( 0, ¤t );
|
||||
current.sched_priority = DEFAULT_SCHED_PARAM;
|
||||
return sched_setscheduler( 0, in, ¤t );
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -341,7 +345,11 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
|
||||
struct timeb t;
|
||||
|
||||
ftime( &t );
|
||||
srand( ( unsigned int )t.millitm + ithread_get_current_thread_id( ) );
|
||||
srand( (unsigned int)t.millitm
|
||||
#ifndef WIN32
|
||||
+ ithread_get_current_thread_id()
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -39,6 +39,10 @@
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocates enough memory for the
|
||||
* Formatted string, up to max
|
||||
|
@ -43,12 +43,23 @@
|
||||
# include "upnpdebug.h"
|
||||
#endif
|
||||
|
||||
#define UpnpCloseSocket close
|
||||
#ifndef WIN32
|
||||
#define UpnpCloseSocket close
|
||||
#else
|
||||
#define UpnpCloseSocket closesocket
|
||||
#endif
|
||||
#define UPNP_SOCKETERROR -1
|
||||
#define UPNP_INVALID_SOCKET -1
|
||||
#define SOCKET int
|
||||
#ifndef WIN32
|
||||
#define SOCKET int
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#ifndef WIN32
|
||||
#include <netinet/in.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#define NUM_HANDLE 200
|
||||
#define LINE_SIZE 180
|
||||
|
@ -36,16 +36,23 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifndef SPARC_SOLARIS
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifndef SPARC_SOLARIS
|
||||
// #include <linux/if.h>
|
||||
#include <net/if.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <net/if.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "upnpapi.h"
|
||||
#include "httpreadwrite.h"
|
||||
@ -53,9 +60,6 @@
|
||||
#include "soaplib.h"
|
||||
#include "ThreadPool.h"
|
||||
#include "membuffer.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "httpreadwrite.h"
|
||||
|
||||
@ -3752,6 +3756,19 @@ DBGONLY(
|
||||
***************************************************************************/
|
||||
int getlocalhostname( OUT char *out ) {
|
||||
|
||||
#ifdef WIN32
|
||||
struct hostent *h=NULL;
|
||||
struct sockaddr_in LocalAddr;
|
||||
|
||||
gethostname(out,LINE_SIZE);
|
||||
h=gethostbyname(out);
|
||||
if (h!=NULL){
|
||||
memcpy(&LocalAddr.sin_addr,h->h_addr_list[0],4);
|
||||
strcpy( out, inet_ntoa(LocalAddr.sin_addr));
|
||||
}
|
||||
return UPNP_E_SUCCESS;
|
||||
#else
|
||||
|
||||
char szBuffer[MAX_INTERFACES * sizeof( struct ifreq )];
|
||||
struct ifconf ifConf;
|
||||
struct ifreq ifReq;
|
||||
@ -3828,6 +3845,7 @@ DBGONLY(
|
||||
out );
|
||||
)
|
||||
return UPNP_E_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
|
@ -35,18 +35,19 @@
|
||||
************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
|
||||
#define socklen_t int
|
||||
#define EAFNOSUPPORT 97
|
||||
#endif
|
||||
#include "unixutil.h"
|
||||
#include "ithread.h"
|
||||
|
||||
|
@ -40,15 +40,20 @@
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <fcntl.h>
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include "unixutil.h"
|
||||
#include "upnp.h"
|
||||
#include "upnpapi.h"
|
||||
@ -2383,6 +2388,15 @@ http_OpenHttpGetEx( IN const char *url_str,
|
||||
void
|
||||
get_sdk_info( OUT char *info )
|
||||
{
|
||||
#ifdef WIN32
|
||||
OSVERSIONINFO versioninfo;
|
||||
versioninfo.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
|
||||
if (GetVersionEx(&versioninfo)!=0)
|
||||
sprintf( info, "%d.%d.%d %d/%s, UPnP/1.0, Portable SDK for UPnP devices/"PACKAGE_VERSION"\r\n",
|
||||
versioninfo.dwMajorVersion, versioninfo.dwMinorVersion, versioninfo.dwBuildNumber, versioninfo.dwPlatformId, versioninfo.szCSDVersion );
|
||||
else
|
||||
*info = '\0';
|
||||
#else
|
||||
int ret_code;
|
||||
struct utsname sys_info;
|
||||
|
||||
@ -2394,4 +2408,5 @@ get_sdk_info( OUT char *info )
|
||||
sprintf( info, "%s/%s, UPnP/1.0, Portable SDK for UPnP devices/"
|
||||
PACKAGE_VERSION "\r\n",
|
||||
sys_info.sysname, sys_info.release );
|
||||
#endif
|
||||
}
|
||||
|
@ -40,6 +40,10 @@
|
||||
#include "util.h"
|
||||
#include "statcodes.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "unixutil.h"
|
||||
#endif
|
||||
|
||||
#define NUM_1XX_CODES 2
|
||||
static const char *Http1xxCodes[NUM_1XX_CODES];
|
||||
static const char *Http1xxStr = "Continue\0" "Switching Protocols\0";
|
||||
|
@ -48,7 +48,9 @@
|
||||
#include "upnpapi.h"
|
||||
#include "ssdplib.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include "ithread.h"
|
||||
#include "unixutil.h"
|
||||
|
@ -41,12 +41,16 @@
|
||||
|
||||
#include "sock.h"
|
||||
#include "upnp.h"
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#include "unixutil.h"
|
||||
|
||||
/************************************************************************
|
||||
|
@ -36,6 +36,11 @@
|
||||
#include "config.h"
|
||||
#include "uri.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "inet_pton.h"
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : is_reserved
|
||||
*
|
||||
@ -535,8 +540,10 @@ parse_hostport( char *in,
|
||||
int begin_port;
|
||||
int hostport_size = 0;
|
||||
int host_size = 0;
|
||||
struct hostent h_buf;
|
||||
#ifndef WIN32
|
||||
char temp_hostbyname_buff[BUFFER_SIZE];
|
||||
struct hostent h_buf;
|
||||
#endif
|
||||
struct hostent *h = NULL;
|
||||
int errcode = 0;
|
||||
char *temp_host_name = NULL;
|
||||
@ -601,16 +608,20 @@ parse_hostport( char *in,
|
||||
int errCode = 0;
|
||||
|
||||
//call gethostbyname_r (reentrant form of gethostbyname)
|
||||
#ifndef SPARC_SOLARIS
|
||||
errCode = gethostbyname_r( temp_host_name,
|
||||
&h_buf,
|
||||
temp_hostbyname_buff,
|
||||
BUFFER_SIZE, &h, &errcode );
|
||||
#ifdef WIN32
|
||||
h=gethostbyname(temp_host_name);
|
||||
#else
|
||||
errCode = gethostbyname_r( temp_host_name,
|
||||
&h,
|
||||
temp_hostbyname_buff,
|
||||
BUFFER_SIZE, &errcode );
|
||||
#ifndef SPARC_SOLARIS
|
||||
errCode = gethostbyname_r( temp_host_name,
|
||||
&h_buf,
|
||||
temp_hostbyname_buff,
|
||||
BUFFER_SIZE, &h, &errcode );
|
||||
#else
|
||||
errCode = gethostbyname_r( temp_host_name,
|
||||
&h,
|
||||
temp_hostbyname_buff,
|
||||
BUFFER_SIZE, &errcode );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if( errCode == 0 ) {
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <string.h>
|
||||
#include <membuffer.h>
|
||||
#include "upnp.h"
|
||||
#include "unixutil.h"
|
||||
|
||||
/************************************************************************
|
||||
* string *
|
||||
|
@ -47,7 +47,9 @@
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C extern "C"
|
||||
#else
|
||||
#define EXTERN_C
|
||||
#ifndef EXTERN_C
|
||||
#define EXTERN_C
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define XML_VERSION "<?xml version='1.0' encoding='ISO-8859-1' ?>\n"
|
||||
|
@ -34,7 +34,9 @@
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
#ifndef WIN32
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
//Following variable is not defined under winsock.h
|
||||
#ifndef SD_RECEIVE
|
||||
|
@ -40,14 +40,17 @@
|
||||
#include "httpparser.h"
|
||||
#include "httpreadwrite.h"
|
||||
#include "miniserver.h"
|
||||
#include <syslog.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <sys/time.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifndef WIN32
|
||||
#include <syslog.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_icmp.h>
|
||||
#include <sys/time.h>
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
#endif
|
||||
|
||||
//Enumeration to define all different types of ssdp searches
|
||||
typedef enum SsdpSearchType{
|
||||
|
@ -18,7 +18,9 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
//#include <sys/sysinfo.h>
|
||||
#include "ithread.h"
|
||||
|
||||
@ -45,8 +47,12 @@ typedef unsigned char unsigned8;
|
||||
typedef unsigned char byte;
|
||||
|
||||
/* Set this to what your compiler uses for 64 bit data type */
|
||||
#define unsigned64_t unsigned long long
|
||||
#define I64(C) C##LL
|
||||
#ifndef WIN32
|
||||
#define unsigned64_t unsigned long long
|
||||
#define I64(C) C##LL
|
||||
#else
|
||||
#define unsigned64_t __int64
|
||||
#endif
|
||||
|
||||
typedef unsigned64_t uuid_time_t;
|
||||
typedef struct {
|
||||
|
@ -35,6 +35,13 @@
|
||||
#define GENLIB_NET_UNIXUTIL_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
#else
|
||||
#define XINLINE
|
||||
|
||||
#define socklen_t int
|
||||
#define EAFNOSUPPORT 97
|
||||
#endif
|
||||
|
||||
#endif // GENLIB_NET_UNIXUTIL_H
|
||||
|
@ -44,12 +44,18 @@ extern "C" {
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/time.h>
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
|
||||
#define strncasecmp strnicmp
|
||||
#endif
|
||||
|
||||
#include "upnp.h"
|
||||
//#include <upnp_debug.h>
|
||||
@ -70,7 +76,9 @@ extern "C" {
|
||||
|
||||
enum hostType { HOSTNAME, IPv4address };
|
||||
enum pathType { ABS_PATH, REL_PATH, OPAQUE_PART };
|
||||
enum uriType { ABSOLUTE, RELATIVE };
|
||||
#ifndef WIN32
|
||||
enum uriType { ABSOLUTE, RELATIVE };
|
||||
#endif
|
||||
|
||||
/* Buffer used in parsinghttp messages, urls, etc. generally this simply
|
||||
* holds a pointer into a larger array */
|
||||
|
@ -31,9 +31,13 @@
|
||||
|
||||
#ifndef URLCONFIG_H
|
||||
#define URLCONFIG_H
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
// functions available only if the web server is included
|
||||
|
||||
|
@ -58,10 +58,10 @@
|
||||
#define EVENT_TERMINATE -3
|
||||
|
||||
|
||||
|
||||
#define max(a, b) (((a)>(b))? (a):(b))
|
||||
#define min(a, b) (((a)<(b))? (a):(b))
|
||||
|
||||
#ifndef WIN32
|
||||
#define max(a, b) (((a)>(b))? (a):(b))
|
||||
#define min(a, b) (((a)<(b))? (a):(b))
|
||||
#endif
|
||||
|
||||
|
||||
// boolean type in C
|
||||
@ -146,7 +146,26 @@ void linecopylen( OUT char dest[LINE_SIZE], IN const char* src, IN size_t srclen
|
||||
// C specific
|
||||
#ifndef __cplusplus
|
||||
|
||||
#define XINLINE inline
|
||||
#ifndef WIN32
|
||||
#define XINLINE inline
|
||||
#else
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#define EADDRINUSE WSAEADDRINUSE
|
||||
|
||||
#define strcasecmp stricmp
|
||||
#define strncasecmp strnicmp
|
||||
|
||||
#define sleep Sleep
|
||||
#define usleep(a) Sleep((a)/1000)
|
||||
#endif
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
@ -47,6 +47,10 @@
|
||||
#include "soaplib.h"
|
||||
#include "ssdplib.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
// timeout duration in secs for transmission/reception
|
||||
#define SOAP_TIMEOUT UPNP_TIMEOUT
|
||||
|
||||
|
@ -45,6 +45,15 @@
|
||||
|
||||
#include "unixutil.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#include <winsock2.h>
|
||||
#ifndef imillisleep
|
||||
#define imillisleep Sleep
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : send_search_result
|
||||
*
|
||||
|
@ -42,6 +42,11 @@
|
||||
#include "statcodes.h"
|
||||
#include "unixutil.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <ws2tcpip.h>
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#define MSGTYPE_SHUTDOWN 0
|
||||
#define MSGTYPE_ADVERTISEMENT 1
|
||||
#define MSGTYPE_REPLY 2
|
||||
|
@ -42,6 +42,12 @@
|
||||
#include "httpparser.h"
|
||||
#include "httpreadwrite.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include "unixutil.h"
|
||||
#endif
|
||||
|
||||
#define MAX_TIME_TOREAD 45
|
||||
|
||||
CLIENTONLY( SOCKET gSsdpReqSocket = 0;
|
||||
@ -455,14 +461,17 @@ CLIENTONLY( SOCKET gSsdpReqSocket = 0;
|
||||
int
|
||||
Make_Socket_NoBlocking( int sock )
|
||||
{
|
||||
|
||||
#ifdef WIN32
|
||||
u_long val=1;
|
||||
return ioctlsocket(sock, FIONBIO, &val);
|
||||
#else
|
||||
int val;
|
||||
|
||||
val = fcntl( sock, F_GETFL, 0 );
|
||||
if( fcntl( sock, F_SETFL, val | O_NONBLOCK ) == -1 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -31,15 +31,20 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <assert.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#include "upnp.h"
|
||||
#include "util.h"
|
||||
#include "webserver.h"
|
||||
#include "uri.h"
|
||||
#include "membuffer.h"
|
||||
#include "urlconfig.h"
|
||||
#include "unixutil.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : addrToString
|
||||
|
@ -18,7 +18,11 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <unistd.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "sysdep.h"
|
||||
|
@ -22,7 +22,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <netinet/in.h>
|
||||
#ifndef WIN32
|
||||
#include <netinet/in.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#include "sysdep.h"
|
||||
#include "uuid.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user