Removed all uses of the DEVICEONLY(x) macro.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@187 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
4e1240a0a8
commit
83fb96fbe2
@ -2,6 +2,9 @@
|
|||||||
Version 1.4.7
|
Version 1.4.7
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2007-05-18 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* Removed all uses of the DEVICEONLY(x) macro.
|
||||||
|
|
||||||
2007-05-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-05-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* Removed all uses of the DBGONLY(x) macro. A static inline empty
|
* Removed all uses of the DBGONLY(x) macro. A static inline empty
|
||||||
function now is used and the compiler takes care of optimizing it out.
|
function now is used and the compiler takes care of optimizing it out.
|
||||||
|
@ -338,12 +338,6 @@
|
|||||||
# define CLIENTONLY(x)
|
# define CLIENTONLY(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
|
||||||
# define DEVICEONLY(x) x
|
|
||||||
#else
|
|
||||||
# define DEVICEONLY(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//File upnpapi.c
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -37,22 +37,22 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#ifndef SPARC_SOLARIS
|
#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
|
#endif
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include "upnpapi.h"
|
#include "upnpapi.h"
|
||||||
#include "httpreadwrite.h"
|
#include "httpreadwrite.h"
|
||||||
@ -63,36 +63,30 @@
|
|||||||
|
|
||||||
#include "httpreadwrite.h"
|
#include "httpreadwrite.h"
|
||||||
|
|
||||||
//************************************
|
// Needed for GENA
|
||||||
//Needed for GENA
|
|
||||||
#include "gena.h"
|
#include "gena.h"
|
||||||
#include "service_table.h"
|
#include "service_table.h"
|
||||||
#include "miniserver.h"
|
#include "miniserver.h"
|
||||||
//*******************************************
|
|
||||||
|
|
||||||
/*
|
|
||||||
********************* */
|
|
||||||
#ifdef INTERNAL_WEB_SERVER
|
#ifdef INTERNAL_WEB_SERVER
|
||||||
#include "webserver.h"
|
#include "webserver.h"
|
||||||
#include "urlconfig.h"
|
#include "urlconfig.h"
|
||||||
#endif // INTERNAL_WEB_SERVER
|
#endif // INTERNAL_WEB_SERVER
|
||||||
/*
|
|
||||||
****************** */
|
|
||||||
|
|
||||||
//Mutex to synchronize the subscription handling at the client side
|
// Mutex to synchronize the subscription handling at the client side
|
||||||
CLIENTONLY( ithread_mutex_t GlobalClientSubscribeMutex;
|
CLIENTONLY( ithread_mutex_t GlobalClientSubscribeMutex; )
|
||||||
)
|
|
||||||
//Mutex to synchronize handles ( root device or control point handle)
|
|
||||||
ithread_mutex_t GlobalHndMutex;
|
|
||||||
|
|
||||||
//Mutex to synchronize the uuid creation process
|
//Mutex to synchronize handles ( root device or control point handle)
|
||||||
ithread_mutex_t gUUIDMutex;
|
ithread_mutex_t GlobalHndMutex;
|
||||||
|
|
||||||
TimerThread gTimerThread;
|
// Mutex to synchronize the uuid creation process
|
||||||
|
ithread_mutex_t gUUIDMutex;
|
||||||
|
|
||||||
ThreadPool gRecvThreadPool;
|
TimerThread gTimerThread;
|
||||||
|
|
||||||
ThreadPool gSendThreadPool;
|
ThreadPool gRecvThreadPool;
|
||||||
|
|
||||||
|
ThreadPool gSendThreadPool;
|
||||||
|
|
||||||
//Flag to indicate the state of web server
|
//Flag to indicate the state of web server
|
||||||
WebServerState bWebServerState = WEB_SERVER_DISABLED;
|
WebServerState bWebServerState = WEB_SERVER_DISABLED;
|
||||||
@ -264,8 +258,7 @@ int UpnpInit( IN const char *HostIP,
|
|||||||
|
|
||||||
UpnpSdkInit = 1;
|
UpnpSdkInit = 1;
|
||||||
#if EXCLUDE_SOAP == 0
|
#if EXCLUDE_SOAP == 0
|
||||||
DEVICEONLY( SetSoapCallback( soap_device_callback );
|
SetSoapCallback( soap_device_callback );
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
#if EXCLUDE_GENA == 0
|
#if EXCLUDE_GENA == 0
|
||||||
SetGenaCallback( genaCallback );
|
SetGenaCallback( genaCallback );
|
||||||
@ -357,10 +350,12 @@ PrintThreadPoolStats (const char* DbgFileName, int DbgLineNo,
|
|||||||
int
|
int
|
||||||
UpnpFinish()
|
UpnpFinish()
|
||||||
{
|
{
|
||||||
DEVICEONLY( UpnpDevice_Handle device_handle;
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
)
|
UpnpDevice_Handle device_handle;
|
||||||
CLIENTONLY( UpnpClient_Handle client_handle;
|
#endif
|
||||||
)
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
|
UpnpClient_Handle client_handle;
|
||||||
|
#endif
|
||||||
struct Handle_Info *temp;
|
struct Handle_Info *temp;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -371,8 +366,9 @@ UpnpFinish()
|
|||||||
// WSACleanup( );
|
// WSACleanup( );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( UpnpSdkInit != 1 )
|
if( UpnpSdkInit != 1 ) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Inside UpnpFinish : UpnpSdkInit is :%d:\n",
|
"Inside UpnpFinish : UpnpSdkInit is :%d:\n",
|
||||||
@ -1308,10 +1304,8 @@ UpnpRegisterClient( IN Upnp_FunPtr Fun,
|
|||||||
if( UpnpSdkInit != 1 ) {
|
if( UpnpSdkInit != 1 ) {
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Inside UpnpRegisterClient \n" );
|
"Inside UpnpRegisterClient \n" );
|
||||||
|
|
||||||
if( Fun == NULL || Hnd == NULL ) {
|
if( Fun == NULL || Hnd == NULL ) {
|
||||||
return UPNP_E_INVALID_PARAM;
|
return UPNP_E_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
@ -1322,7 +1316,6 @@ UpnpRegisterClient( IN Upnp_FunPtr Fun,
|
|||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
return UPNP_E_ALREADY_REGISTERED;
|
return UPNP_E_ALREADY_REGISTERED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( *Hnd = GetFreeHandle() ) == UPNP_E_OUTOF_HANDLE ) {
|
if( ( *Hnd = GetFreeHandle() ) == UPNP_E_OUTOF_HANDLE ) {
|
||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
@ -1336,17 +1329,15 @@ UpnpRegisterClient( IN Upnp_FunPtr Fun,
|
|||||||
HInfo->HType = HND_CLIENT;
|
HInfo->HType = HND_CLIENT;
|
||||||
HInfo->Callback = Fun;
|
HInfo->Callback = Fun;
|
||||||
HInfo->Cookie = ( void * )Cookie;
|
HInfo->Cookie = ( void * )Cookie;
|
||||||
DEVICEONLY( HInfo->MaxAge = 0;
|
|
||||||
)
|
|
||||||
HInfo->ClientSubList = NULL;
|
HInfo->ClientSubList = NULL;
|
||||||
ListInit( &HInfo->SsdpSearchList, NULL, NULL );
|
ListInit( &HInfo->SsdpSearchList, NULL, NULL );
|
||||||
DEVICEONLY( HInfo->MaxSubscriptions = UPNP_INFINITE;
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
)
|
HInfo->MaxAge = 0;
|
||||||
DEVICEONLY( HInfo->MaxSubscriptionTimeOut = UPNP_INFINITE;
|
HInfo->MaxSubscriptions = UPNP_INFINITE;
|
||||||
)
|
HInfo->MaxSubscriptionTimeOut = UPNP_INFINITE;
|
||||||
|
#endif
|
||||||
HandleTable[*Hnd] = HInfo;
|
|
||||||
|
|
||||||
|
HandleTable[*Hnd] = HInfo;
|
||||||
UpnpSdkClientRegistered = 1;
|
UpnpSdkClientRegistered = 1;
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
@ -3674,11 +3665,11 @@ int PrintHandleInfo( IN UpnpClient_Handle Hnd )
|
|||||||
"Printing information for Handle_%d\n", Hnd);
|
"Printing information for Handle_%d\n", Hnd);
|
||||||
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"HType_%d\n", HndInfo->HType);
|
"HType_%d\n", HndInfo->HType);
|
||||||
DEVICEONLY(
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
if(HndInfo->HType != HND_CLIENT)
|
if(HndInfo->HType != HND_CLIENT)
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"DescURL_%s\n", HndInfo->DescURL );
|
"DescURL_%s\n", HndInfo->DescURL );
|
||||||
)
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return UPNP_E_INVALID_HANDLE;
|
return UPNP_E_INVALID_HANDLE;
|
||||||
|
@ -93,36 +93,35 @@ genaCallback( IN http_parser_t * parser,
|
|||||||
xboolean found_function = FALSE;
|
xboolean found_function = FALSE;
|
||||||
|
|
||||||
if( request->method == HTTPMETHOD_SUBSCRIBE ) {
|
if( request->method == HTTPMETHOD_SUBSCRIBE ) {
|
||||||
DEVICEONLY( found_function = TRUE;
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL )
|
found_function = TRUE;
|
||||||
{
|
if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL ) {
|
||||||
// renew subscription
|
// renew subscription
|
||||||
gena_process_subscription_renewal_request
|
gena_process_subscription_renewal_request
|
||||||
( info, request );}
|
( info, request );
|
||||||
else
|
} else {
|
||||||
{
|
// subscribe
|
||||||
// subscribe
|
gena_process_subscription_request( info, request );
|
||||||
gena_process_subscription_request( info, request );}
|
}
|
||||||
|
UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__,
|
||||||
|
"got subscription request\n" );
|
||||||
|
} else if( request->method == HTTPMETHOD_UNSUBSCRIBE ) {
|
||||||
|
found_function = TRUE;
|
||||||
|
// unsubscribe
|
||||||
|
gena_process_unsubscribe_request( info, request );
|
||||||
|
#endif
|
||||||
|
} else if( request->method == HTTPMETHOD_NOTIFY ) {
|
||||||
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
|
found_function = TRUE;
|
||||||
|
// notify
|
||||||
|
gena_process_notification_event( info, request );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__,
|
if( !found_function ) {
|
||||||
"got subscription request\n" );
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( request->method == HTTPMETHOD_UNSUBSCRIBE ) {
|
|
||||||
DEVICEONLY( found_function = TRUE;
|
|
||||||
// unsubscribe
|
|
||||||
gena_process_unsubscribe_request( info,
|
|
||||||
request ); )
|
|
||||||
} else if( request->method == HTTPMETHOD_NOTIFY ) {
|
|
||||||
CLIENTONLY( found_function = TRUE;
|
|
||||||
// notify
|
|
||||||
gena_process_notification_event( info, request ); )
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !found_function ) {
|
|
||||||
// handle missing functions of device or ctrl pt
|
// handle missing functions of device or ctrl pt
|
||||||
error_respond( info, HTTP_NOT_IMPLEMENTED, request );
|
error_respond( info, HTTP_NOT_IMPLEMENTED, request );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif // EXCLUDE_GENA
|
#endif // EXCLUDE_GENA
|
||||||
|
|
||||||
|
@ -106,16 +106,16 @@ SetHTTPGetCallback( MiniServerCallback callback )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SetSoapCallback
|
* Function : SetSoapCallback
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* MiniServerCallback callback ; - SOAP Callback to be invoked
|
* MiniServerCallback callback ; - SOAP Callback to be invoked
|
||||||
*
|
*
|
||||||
* Description : Set SOAP Callback
|
* Description : Set SOAP Callback
|
||||||
*
|
*
|
||||||
* Return : void
|
* Return : void
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
void
|
void
|
||||||
SetSoapCallback( MiniServerCallback callback )
|
SetSoapCallback( MiniServerCallback callback )
|
||||||
|
@ -2505,7 +2505,7 @@ print_http_headers( http_message_t * hmsg )
|
|||||||
if( hmsg->is_request ) {
|
if( hmsg->is_request ) {
|
||||||
printf( "method = %d, version = %d.%d, url = %.*s\n",
|
printf( "method = %d, version = %d.%d, url = %.*s\n",
|
||||||
hmsg->method, hmsg->major_version, hmsg->minor_version,
|
hmsg->method, hmsg->major_version, hmsg->minor_version,
|
||||||
hmsg->uri.pathquery.size, hmsg->uri.pathquery.buff);
|
(int)hmsg->uri.pathquery.size, hmsg->uri.pathquery.buff);
|
||||||
} else {
|
} else {
|
||||||
printf( "resp status = %d, version = %d.%d, status msg = %.*s\n",
|
printf( "resp status = %d, version = %d.%d, status msg = %.*s\n",
|
||||||
hmsg->status_code, hmsg->major_version, hmsg->minor_version,
|
hmsg->status_code, hmsg->major_version, hmsg->minor_version,
|
||||||
|
@ -338,12 +338,6 @@
|
|||||||
# define CLIENTONLY(x)
|
# define CLIENTONLY(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
|
||||||
# define DEVICEONLY(x) x
|
|
||||||
#else
|
|
||||||
# define DEVICEONLY(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -219,8 +219,9 @@ CLIENTONLY(EXTERN_C int genaUnregisterClient(
|
|||||||
* Returns: int
|
* Returns: int
|
||||||
* returns UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE
|
* returns UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
DEVICEONLY(EXTERN_C int genaUnregisterDevice(
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
UpnpDevice_Handle device_handle);)
|
EXTERN_C int genaUnregisterDevice(UpnpDevice_Handle device_handle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -266,33 +267,40 @@ CLIENTONLY(EXTERN_C int genaRenewSubscription(
|
|||||||
* Note : This function is similar to the genaNotifyAllExt. The only difference
|
* Note : This function is similar to the genaNotifyAllExt. The only difference
|
||||||
* is it takes event variable array instead of xml document.
|
* is it takes event variable array instead of xml document.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
DEVICEONLY(EXTERN_C int genaNotifyAll(UpnpDevice_Handle device_handle,
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
char *UDN,
|
EXTERN_C int genaNotifyAll(
|
||||||
char *servId,
|
UpnpDevice_Handle device_handle,
|
||||||
char **VarNames,
|
char *UDN,
|
||||||
char **VarValues,
|
char *servId,
|
||||||
int var_count
|
char **VarNames,
|
||||||
);)
|
char **VarValues,
|
||||||
|
int var_count);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : genaNotifyAllExt
|
* Function : genaNotifyAllExt
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* IN UpnpDevice_Handle device_handle : Device handle
|
* IN UpnpDevice_Handle device_handle : Device handle
|
||||||
* IN char *UDN : Device udn
|
* IN char *UDN : Device udn
|
||||||
* IN char *servId : Service ID
|
* IN char *servId : Service ID
|
||||||
* IN IXML_Document *PropSet : XML document Event varible property set
|
* IN IXML_Document *PropSet : XML document Event varible property set
|
||||||
*
|
*
|
||||||
* Description : This function sends a notification to all the subscribed
|
* Description : This function sends a notification to all the subscribed
|
||||||
* control points
|
* control points
|
||||||
*
|
*
|
||||||
* Return : int
|
* Return : int
|
||||||
*
|
*
|
||||||
* Note : This function is similar to the genaNotifyAll. the only difference
|
* Note : This function is similar to the genaNotifyAll. the only difference
|
||||||
* is it takes the document instead of event variable array
|
* is it takes the document instead of event variable array
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
DEVICEONLY(EXTERN_C int genaNotifyAllExt(UpnpDevice_Handle device_handle,
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
char *UDN, char *servId,IN IXML_Document *PropSet);)
|
EXTERN_C int genaNotifyAllExt(
|
||||||
|
UpnpDevice_Handle device_handle,
|
||||||
|
char *UDN,
|
||||||
|
char *servId,
|
||||||
|
IN IXML_Document *PropSet);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : genaInitNotify
|
* Function : genaInitNotify
|
||||||
@ -315,13 +323,15 @@ DEVICEONLY(EXTERN_C int genaNotifyAllExt(UpnpDevice_Handle device_handle,
|
|||||||
* Note : No other event will be sent to this control point before the
|
* Note : No other event will be sent to this control point before the
|
||||||
* intial state table dump.
|
* intial state table dump.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
DEVICEONLY(EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
IN char *UDN,
|
EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
||||||
IN char *servId,
|
IN char *UDN,
|
||||||
IN char **VarNames,
|
IN char *servId,
|
||||||
IN char **VarValues,
|
IN char **VarNames,
|
||||||
IN int var_count,
|
IN char **VarValues,
|
||||||
IN Upnp_SID sid);)
|
IN int var_count,
|
||||||
|
IN Upnp_SID sid);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : genaInitNotifyExt
|
* Function : genaInitNotifyExt
|
||||||
@ -343,12 +353,14 @@ DEVICEONLY(EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
|||||||
* Note : No other event will be sent to this control point before the
|
* Note : No other event will be sent to this control point before the
|
||||||
* intial state table dump.
|
* intial state table dump.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
DEVICEONLY(EXTERN_C int genaInitNotifyExt(
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
IN UpnpDevice_Handle device_handle,
|
EXTERN_C int genaInitNotifyExt(
|
||||||
IN char *UDN,
|
IN UpnpDevice_Handle device_handle,
|
||||||
IN char *servId,
|
IN char *UDN,
|
||||||
IN IXML_Document *PropSet,
|
IN char *servId,
|
||||||
IN Upnp_SID sid);)
|
IN IXML_Document *PropSet,
|
||||||
|
IN Upnp_SID sid);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -88,7 +88,11 @@ void SetHTTPGetCallback( MiniServerCallback callback );
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
void SetSoapCallback( MiniServerCallback callback );
|
void SetSoapCallback( MiniServerCallback callback );
|
||||||
|
#else
|
||||||
|
static inline void SetSoapCallback( MiniServerCallback callback ) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SetGenaCallback
|
* Function : SetGenaCallback
|
||||||
|
@ -33,28 +33,28 @@
|
|||||||
#define SOAPLIB_H
|
#define SOAPLIB_H
|
||||||
|
|
||||||
|
|
||||||
//SOAP module API to be called in Upnp-Dk API
|
// SOAP module API to be called in Upnp-Dk API
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : soap_device_callback
|
* Function : soap_device_callback
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* IN http_parser_t *parser : Parsed request received by the device
|
* IN http_parser_t *parser : Parsed request received by the device
|
||||||
* IN http_message_t* request : HTTP request
|
* IN http_message_t* request : HTTP request
|
||||||
* INOUT SOCKINFO *info : socket info
|
* INOUT SOCKINFO *info : socket info
|
||||||
*
|
*
|
||||||
* Description : This is a callback called by minisever after receiving
|
* Description : This is a callback called by minisever after receiving
|
||||||
* the request from the control point. This function will start
|
* the request from the control point. This function will start
|
||||||
* processing the request. It calls handle_invoke_action to handle the
|
* processing the request. It calls handle_invoke_action to handle the
|
||||||
* SOAP action
|
* SOAP action
|
||||||
*
|
*
|
||||||
* Return : void
|
* Return : void
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void soap_device_callback(
|
void soap_device_callback(
|
||||||
IN http_parser_t *parser,
|
IN http_parser_t *parser,
|
||||||
IN http_message_t* request,
|
IN http_message_t* request,
|
||||||
INOUT SOCKINFO *info );
|
INOUT SOCKINFO *info );
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -211,8 +211,15 @@ int Make_Socket_NoBlocking (int sock);
|
|||||||
* Returns: void *
|
* Returns: void *
|
||||||
* 1 if successful else appropriate error
|
* 1 if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ssdp_handle_device_request( IN http_message_t* hmsg,
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
IN struct sockaddr_in* dest_addr );
|
void ssdp_handle_device_request(
|
||||||
|
IN http_message_t* hmsg,
|
||||||
|
IN struct sockaddr_in* dest_addr );
|
||||||
|
#else
|
||||||
|
static inline void ssdp_handle_device_request(
|
||||||
|
IN http_message_t* hmsg,
|
||||||
|
IN struct sockaddr_in* dest_addr ) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_handle_ctrlpt_msg
|
* Function : ssdp_handle_ctrlpt_msg
|
||||||
|
@ -71,27 +71,32 @@ struct Handle_Info
|
|||||||
Upnp_FunPtr Callback; // Callback function pointer.
|
Upnp_FunPtr Callback; // Callback function pointer.
|
||||||
char * Cookie;
|
char * Cookie;
|
||||||
|
|
||||||
DEVICEONLY(char DescURL[LINE_SIZE];) // URL for the use of SSDP
|
// Device Only
|
||||||
DEVICEONLY(char DescXML[LINE_SIZE];) // XML file path for device
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
//description
|
char DescURL[LINE_SIZE]; // URL for the use of SSDP
|
||||||
|
char DescXML[LINE_SIZE]; // XML file path for device
|
||||||
|
//description
|
||||||
|
|
||||||
DEVICEONLY(int MaxAge;) // Advertisement timeout
|
int MaxAge; // Advertisement timeout
|
||||||
DEVICEONLY(IXML_Document *DescDocument;) // Description parsed in
|
IXML_Document *DescDocument;// Description parsed in
|
||||||
//terms of DOM document
|
//terms of DOM document
|
||||||
DEVICEONLY(IXML_NodeList *DeviceList;) // List of devices in the
|
IXML_NodeList *DeviceList; // List of devices in the
|
||||||
//description document
|
//description document
|
||||||
DEVICEONLY(IXML_NodeList *ServiceList;) // List of services in the
|
IXML_NodeList *ServiceList; // List of services in the
|
||||||
// description document
|
// description document
|
||||||
DEVICEONLY(service_table ServiceTable;) //table holding subscriptions and
|
service_table ServiceTable; //table holding subscriptions and
|
||||||
//URL information
|
//URL information
|
||||||
DEVICEONLY(int MaxSubscriptions;)
|
int MaxSubscriptions;
|
||||||
DEVICEONLY(int MaxSubscriptionTimeOut;)
|
int MaxSubscriptionTimeOut;
|
||||||
|
#endif
|
||||||
|
|
||||||
//Client only
|
// Client only
|
||||||
CLIENTONLY(client_subscription * ClientSubList;) //client subscription list
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
CLIENTONLY(LinkedList SsdpSearchList;) // active ssdp searches
|
client_subscription *ClientSubList; //client subscription list
|
||||||
|
LinkedList SsdpSearchList; // active ssdp searches
|
||||||
|
#endif
|
||||||
int aliasInstalled; // 0 = not installed; otherwise installed
|
int aliasInstalled; // 0 = not installed; otherwise installed
|
||||||
} ;
|
};
|
||||||
|
|
||||||
extern ithread_mutex_t GlobalHndMutex;
|
extern ithread_mutex_t GlobalHndMutex;
|
||||||
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo);
|
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo);
|
||||||
|
@ -95,6 +95,7 @@ advertiseAndReplyThread( IN void *data )
|
|||||||
* Returns: void *
|
* Returns: void *
|
||||||
* 1 if successful else appropriate error
|
* 1 if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
void
|
void
|
||||||
ssdp_handle_device_request( IN http_message_t * hmsg,
|
ssdp_handle_device_request( IN http_message_t * hmsg,
|
||||||
IN struct sockaddr_in *dest_addr )
|
IN struct sockaddr_in *dest_addr )
|
||||||
@ -190,6 +191,7 @@ ssdp_handle_device_request( IN http_message_t * hmsg,
|
|||||||
TimerThreadSchedule( &gTimerThread, replyTime, REL_SEC, &job,
|
TimerThreadSchedule( &gTimerThread, replyTime, REL_SEC, &job,
|
||||||
SHORT_TERM, NULL );
|
SHORT_TERM, NULL );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : NewRequestHandler
|
* Function : NewRequestHandler
|
||||||
|
@ -746,14 +746,10 @@ ssdp_event_handler_thread( void *the_data )
|
|||||||
// send msg to device or ctrlpt
|
// send msg to device or ctrlpt
|
||||||
if( ( hmsg->method == HTTPMETHOD_NOTIFY ) ||
|
if( ( hmsg->method == HTTPMETHOD_NOTIFY ) ||
|
||||||
( hmsg->request_method == HTTPMETHOD_MSEARCH ) ) {
|
( hmsg->request_method == HTTPMETHOD_MSEARCH ) ) {
|
||||||
|
|
||||||
CLIENTONLY( ssdp_handle_ctrlpt_msg( hmsg, &data->dest_addr,
|
CLIENTONLY( ssdp_handle_ctrlpt_msg( hmsg, &data->dest_addr,
|
||||||
FALSE, NULL );
|
FALSE, NULL ););
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
|
ssdp_handle_device_request( hmsg, &data->dest_addr );
|
||||||
DEVICEONLY( ssdp_handle_device_request( hmsg, &data->dest_addr );
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// free data
|
// free data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user