* Added support for the Basic Device
(http://www.upnp.org/standardizeddcps/basic.asp) as suggested by Titus Winters. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@202 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
13ebb40e08
commit
d9de9a486c
@ -2,6 +2,11 @@
|
|||||||
Version 1.4.7
|
Version 1.4.7
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2007-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* Added support for the Basic Device
|
||||||
|
(http://www.upnp.org/standardizeddcps/basic.asp) as suggested by
|
||||||
|
Titus Winters.
|
||||||
|
|
||||||
2007-05-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-05-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* Fixed the file libupnp.pc.in to generate a correct path for the
|
* Fixed the file libupnp.pc.in to generate a correct path for the
|
||||||
include files.
|
include files.
|
||||||
|
1
THANKS
1
THANKS
@ -30,4 +30,5 @@ exempt of errors.
|
|||||||
- Paul Vixie
|
- Paul Vixie
|
||||||
- Siva Chandran
|
- Siva Chandran
|
||||||
- Timothy Redaelli
|
- Timothy Redaelli
|
||||||
|
- Titus Winters
|
||||||
|
|
||||||
|
@ -591,9 +591,9 @@ UpnpRegisterRootDevice( IN const char *DescUrl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Inside UpnpRegisterRootDevice \n" );
|
"Inside UpnpRegisterRootDevice\n" );
|
||||||
|
|
||||||
HandleLock();
|
HandleLock();
|
||||||
|
|
||||||
if( UpnpSdkDeviceRegistered ) {
|
if( UpnpSdkDeviceRegistered ) {
|
||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
return UPNP_E_ALREADY_REGISTERED;
|
return UPNP_E_ALREADY_REGISTERED;
|
||||||
@ -651,7 +651,7 @@ UpnpRegisterRootDevice( IN const char *DescUrl,
|
|||||||
|
|
||||||
HInfo->DeviceList =
|
HInfo->DeviceList =
|
||||||
ixmlDocument_getElementsByTagName( HInfo->DescDocument, "device" );
|
ixmlDocument_getElementsByTagName( HInfo->DescDocument, "device" );
|
||||||
if( HInfo->DeviceList == NULL ) {
|
if( !HInfo->DeviceList ) {
|
||||||
CLIENTONLY( ListDestroy( &HInfo->SsdpSearchList, 0 ) );
|
CLIENTONLY( ListDestroy( &HInfo->SsdpSearchList, 0 ) );
|
||||||
ixmlDocument_free( HInfo->DescDocument );
|
ixmlDocument_free( HInfo->DescDocument );
|
||||||
FreeHandle( *Hnd );
|
FreeHandle( *Hnd );
|
||||||
@ -661,18 +661,11 @@ UpnpRegisterRootDevice( IN const char *DescUrl,
|
|||||||
return UPNP_E_INVALID_DESC;
|
return UPNP_E_INVALID_DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
HInfo->ServiceList =
|
HInfo->ServiceList = ixmlDocument_getElementsByTagName(
|
||||||
ixmlDocument_getElementsByTagName( HInfo->DescDocument,
|
HInfo->DescDocument, "serviceList" );
|
||||||
"serviceList" );
|
if( !HInfo->ServiceList ) {
|
||||||
if( HInfo->ServiceList == NULL ) {
|
|
||||||
CLIENTONLY( ListDestroy( &HInfo->SsdpSearchList, 0 ) );
|
|
||||||
ixmlNodeList_free( HInfo->DeviceList );
|
|
||||||
ixmlDocument_free( HInfo->DescDocument );
|
|
||||||
FreeHandle( *Hnd );
|
|
||||||
HandleUnlock();
|
|
||||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
||||||
"UpnpRegisterRootDevice: No services found for RootDevice\n" );
|
"UpnpRegisterRootDevice: No services found for RootDevice\n" );
|
||||||
return UPNP_E_INVALID_DESC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
@ -680,31 +673,25 @@ UpnpRegisterRootDevice( IN const char *DescUrl,
|
|||||||
//*******************************
|
//*******************************
|
||||||
// GENA SET UP
|
// GENA SET UP
|
||||||
//*******************************
|
//*******************************
|
||||||
if( getServiceTable( ( IXML_Node * ) HInfo->DescDocument,
|
if( getServiceTable( ( IXML_Node * ) HInfo->DescDocument,
|
||||||
&HInfo->ServiceTable, HInfo->DescURL ) ) {
|
&HInfo->ServiceTable, HInfo->DescURL ) ) {
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"UpnpRegisterRootDevice: GENA Service Table \n" );
|
"UpnpRegisterRootDevice: GENA Service Table \n" );
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Here are the known services: \n" );
|
"Here are the known services: \n" );
|
||||||
printServiceTable( &HInfo->ServiceTable, UPNP_INFO, API );
|
printServiceTable( &HInfo->ServiceTable, UPNP_INFO, API );
|
||||||
} else {
|
} else {
|
||||||
CLIENTONLY( ListDestroy( &HInfo->SsdpSearchList, 0 ); )
|
|
||||||
FreeHandle( *Hnd );
|
|
||||||
HandleUnlock();
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"\nUpnpRegisterRootDevice: Errors retrieving service table \n" );
|
"\nUpnpRegisterRootDevice2: Empty service table\n" );
|
||||||
return UPNP_E_INVALID_DESC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpSdkDeviceRegistered = 1;
|
UpnpSdkDeviceRegistered = 1;
|
||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Exiting RegisterRootDevice Successfully\n" );
|
"Exiting RegisterRootDevice Successfully\n" );
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
|
}
|
||||||
} /****************** End of UpnpRegisterRootDevice *********************/
|
|
||||||
|
|
||||||
#endif // INCLUDE_DEVICE_APIS
|
#endif // INCLUDE_DEVICE_APIS
|
||||||
|
|
||||||
@ -1158,20 +1145,18 @@ UpnpRegisterRootDevice2( IN Upnp_DescType descriptionType,
|
|||||||
struct Handle_Info *HInfo;
|
struct Handle_Info *HInfo;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
char *description = ( char * )description_const;
|
char *description = ( char * )description_const;
|
||||||
|
|
||||||
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 UpnpRegisterRootDevice2 \n" );
|
"Inside UpnpRegisterRootDevice2\n" );
|
||||||
|
|
||||||
if( Hnd == NULL || Fun == NULL ) {
|
if( Hnd == NULL || Fun == NULL ) {
|
||||||
return UPNP_E_INVALID_PARAM;
|
return UPNP_E_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleLock();
|
HandleLock();
|
||||||
|
|
||||||
if( UpnpSdkDeviceRegistered ) {
|
if( UpnpSdkDeviceRegistered ) {
|
||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
return UPNP_E_ALREADY_REGISTERED;
|
return UPNP_E_ALREADY_REGISTERED;
|
||||||
@ -1192,9 +1177,9 @@ UpnpRegisterRootDevice2( IN Upnp_DescType descriptionType,
|
|||||||
// prevent accidental removal of a non-existent alias
|
// prevent accidental removal of a non-existent alias
|
||||||
HInfo->aliasInstalled = 0;
|
HInfo->aliasInstalled = 0;
|
||||||
|
|
||||||
retVal = GetDescDocumentAndURL( descriptionType, description,
|
retVal = GetDescDocumentAndURL(
|
||||||
bufferLen, config_baseURL,
|
descriptionType, description, bufferLen,
|
||||||
&HInfo->DescDocument, HInfo->DescURL );
|
config_baseURL, &HInfo->DescDocument, HInfo->DescURL );
|
||||||
|
|
||||||
if( retVal != UPNP_E_SUCCESS ) {
|
if( retVal != UPNP_E_SUCCESS ) {
|
||||||
FreeHandle( *Hnd );
|
FreeHandle( *Hnd );
|
||||||
@ -1203,15 +1188,16 @@ UpnpRegisterRootDevice2( IN Upnp_DescType descriptionType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
HInfo->aliasInstalled = ( config_baseURL != 0 );
|
HInfo->aliasInstalled = ( config_baseURL != 0 );
|
||||||
|
|
||||||
HInfo->HType = HND_DEVICE;
|
HInfo->HType = HND_DEVICE;
|
||||||
|
|
||||||
HInfo->Callback = Fun;
|
HInfo->Callback = Fun;
|
||||||
HInfo->Cookie = ( void * )Cookie;
|
HInfo->Cookie = ( void * )Cookie;
|
||||||
HInfo->MaxAge = DEFAULT_MAXAGE;
|
HInfo->MaxAge = DEFAULT_MAXAGE;
|
||||||
HInfo->DeviceList = NULL;
|
HInfo->DeviceList = NULL;
|
||||||
HInfo->ServiceList = NULL;
|
HInfo->ServiceList = NULL;
|
||||||
CLIENTONLY( HInfo->ClientSubList = NULL; )
|
|
||||||
CLIENTONLY( ListInit( &HInfo->SsdpSearchList, NULL, NULL ); )
|
CLIENTONLY( ListInit( &HInfo->SsdpSearchList, NULL, NULL ); )
|
||||||
|
CLIENTONLY( HInfo->ClientSubList = NULL; )
|
||||||
HInfo->MaxSubscriptions = UPNP_INFINITE;
|
HInfo->MaxSubscriptions = UPNP_INFINITE;
|
||||||
HInfo->MaxSubscriptionTimeOut = UPNP_INFINITE;
|
HInfo->MaxSubscriptionTimeOut = UPNP_INFINITE;
|
||||||
|
|
||||||
@ -1224,7 +1210,7 @@ UpnpRegisterRootDevice2( IN Upnp_DescType descriptionType,
|
|||||||
HInfo->DeviceList =
|
HInfo->DeviceList =
|
||||||
ixmlDocument_getElementsByTagName( HInfo->DescDocument, "device" );
|
ixmlDocument_getElementsByTagName( HInfo->DescDocument, "device" );
|
||||||
|
|
||||||
if( HInfo->DeviceList == NULL ) {
|
if( !HInfo->DeviceList ) {
|
||||||
CLIENTONLY( ListDestroy( &HInfo->SsdpSearchList, 0 ); )
|
CLIENTONLY( ListDestroy( &HInfo->SsdpSearchList, 0 ); )
|
||||||
ixmlDocument_free( HInfo->DescDocument );
|
ixmlDocument_free( HInfo->DescDocument );
|
||||||
FreeHandle( *Hnd );
|
FreeHandle( *Hnd );
|
||||||
@ -1234,47 +1220,39 @@ UpnpRegisterRootDevice2( IN Upnp_DescType descriptionType,
|
|||||||
return UPNP_E_INVALID_DESC;
|
return UPNP_E_INVALID_DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
HInfo->ServiceList =
|
HInfo->ServiceList = ixmlDocument_getElementsByTagName(
|
||||||
ixmlDocument_getElementsByTagName( HInfo->DescDocument,
|
HInfo->DescDocument, "serviceList" );
|
||||||
"serviceList" );
|
if( !HInfo->ServiceList ) {
|
||||||
|
|
||||||
if( HInfo->ServiceList == NULL ) {
|
|
||||||
CLIENTONLY( ListDestroy( &HInfo->SsdpSearchList, 0 ); )
|
|
||||||
ixmlNodeList_free( HInfo->DeviceList );
|
|
||||||
ixmlDocument_free( HInfo->DescDocument );
|
|
||||||
FreeHandle( *Hnd );
|
|
||||||
HandleUnlock();
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"UpnpRegisterRootDevice2: No services found for RootDevice\n" );
|
"UpnpRegisterRootDevice2: No services found for RootDevice\n" );
|
||||||
return UPNP_E_INVALID_DESC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"UpnpRegisterRootDevice2: Gena Check\n" );
|
"UpnpRegisterRootDevice2: Gena Check\n" );
|
||||||
//*******************************
|
//*******************************
|
||||||
//GENA SET UP
|
// GENA SET UP
|
||||||
//*******************************
|
//*******************************
|
||||||
if( getServiceTable( ( IXML_Node * ) HInfo->DescDocument,
|
if( getServiceTable( ( IXML_Node * ) HInfo->DescDocument,
|
||||||
&HInfo->ServiceTable, HInfo->DescURL ) ) {
|
&HInfo->ServiceTable, HInfo->DescURL ) ) {
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"UpnpRegisterRootDevice2: GENA Service Table \n" );
|
"UpnpRegisterRootDevice2: GENA Service Table\n" );
|
||||||
} else {
|
|
||||||
CLIENTONLY( ListDestroy( &HInfo->SsdpSearchList, 0 ); )
|
|
||||||
FreeHandle( *Hnd );
|
|
||||||
HandleUnlock();
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"\nUpnpRegisterRootDevice: Errors retrieving service table \n" );
|
"Here are the known services: \n" );
|
||||||
return UPNP_E_INVALID_DESC;
|
printServiceTable( &HInfo->ServiceTable, UPNP_INFO, API );
|
||||||
|
} else {
|
||||||
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
|
"\nUpnpRegisterRootDevice2: Empty service table\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpSdkDeviceRegistered = 1;
|
UpnpSdkDeviceRegistered = 1;
|
||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Exiting RegisterRootDevice2 Successfully\n" );
|
"Exiting RegisterRootDevice2 Successfully\n" );
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
} /****************** End of UpnpRegisterRootDevice2 *********************/
|
#endif // INCLUDE_DEVICE_APIS
|
||||||
|
|
||||||
#endif //INCLUDE_DEVICE_APIS
|
|
||||||
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
|
|
||||||
|
@ -935,20 +935,20 @@ getServiceList( IXML_Node * node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : getAllServiceList
|
* Function : getAllServiceList
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* IXML_Node *node ; XML node information
|
* IXML_Node *node ; XML node information
|
||||||
* char * URLBase ; provides Base URL to resolve relative URL
|
* char * URLBase ; provides Base URL to resolve relative URL
|
||||||
* service_info **out_end ; service added is returned to the output
|
* service_info **out_end ; service added is returned to the output
|
||||||
* parameter
|
* parameter
|
||||||
*
|
*
|
||||||
* Description : Returns pointer to service info after getting the
|
* Description : Returns pointer to service info after getting the
|
||||||
* sub-elements of the service info.
|
* sub-elements of the service info.
|
||||||
*
|
*
|
||||||
* Return : service_info * ;
|
* Return : service_info * ;
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
service_info *
|
service_info *
|
||||||
getAllServiceList( IXML_Node * node,
|
getAllServiceList( IXML_Node * node,
|
||||||
@ -1119,20 +1119,20 @@ addServiceTable( IXML_Node * node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : getServiceTable
|
* Function : getServiceTable
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* IXML_Node *node ; XML node information
|
* IXML_Node *node ; XML node information
|
||||||
* service_table *out ; output parameter which will contain the
|
* service_table *out ; output parameter which will contain the
|
||||||
* service list and URL
|
* service list and URL
|
||||||
* const char *DefaultURLBase ; Default base URL on which the URL
|
* const char *DefaultURLBase ; Default base URL on which the URL
|
||||||
* will be returned.
|
* will be returned.
|
||||||
*
|
*
|
||||||
* Description : Retrieve service from the table
|
* Description : Retrieve service from the table
|
||||||
*
|
*
|
||||||
* Return : int ;
|
* Return : int ;
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int
|
int
|
||||||
getServiceTable( IXML_Node * node,
|
getServiceTable( IXML_Node * node,
|
||||||
@ -1153,9 +1153,8 @@ getServiceTable( IXML_Node * node,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( out->serviceList = getAllServiceList( root, out->URLBase,
|
if( ( out->serviceList = getAllServiceList(
|
||||||
&out->
|
root, out->URLBase, &out->endServiceList ) ) ) {
|
||||||
endServiceList ) ) ) {
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,18 +61,19 @@ typedef struct SUBSCRIPTION {
|
|||||||
|
|
||||||
|
|
||||||
typedef struct SERVICE_INFO {
|
typedef struct SERVICE_INFO {
|
||||||
DOMString serviceType;
|
DOMString serviceType;
|
||||||
DOMString serviceId;
|
DOMString serviceId;
|
||||||
char *SCPDURL ;
|
char *SCPDURL ;
|
||||||
char *controlURL;
|
char *controlURL;
|
||||||
char *eventURL;
|
char *eventURL;
|
||||||
DOMString UDN;
|
DOMString UDN;
|
||||||
int active;
|
int active;
|
||||||
int TotalSubscriptions;
|
int TotalSubscriptions;
|
||||||
subscription *subscriptionList;
|
subscription *subscriptionList;
|
||||||
struct SERVICE_INFO *next;
|
struct SERVICE_INFO *next;
|
||||||
} service_info;
|
} service_info;
|
||||||
|
|
||||||
|
|
||||||
typedef struct SERVICE_TABLE {
|
typedef struct SERVICE_TABLE {
|
||||||
DOMString URLBase;
|
DOMString URLBase;
|
||||||
service_info *serviceList;
|
service_info *serviceList;
|
||||||
@ -80,7 +81,7 @@ typedef struct SERVICE_TABLE {
|
|||||||
} service_table;
|
} service_table;
|
||||||
|
|
||||||
|
|
||||||
/* Functions for Subscriptions */
|
/* Functions for Subscriptions */
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : copy_subscription
|
* Function : copy_subscription
|
||||||
|
Loading…
x
Reference in New Issue
Block a user