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