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