|
|
|
@@ -592,8 +592,8 @@ UpnpRegisterRootDevice( IN const char *DescUrl,
|
|
|
|
|
|
|
|
|
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
|
|
|
|
"Inside UpnpRegisterRootDevice\n" );
|
|
|
|
|
HandleLock();
|
|
|
|
|
|
|
|
|
|
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__,
|
|
|
|
@@ -688,23 +681,17 @@ UpnpRegisterRootDevice( IN const char *DescUrl,
|
|
|
|
|
"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,7 +1145,6 @@ UpnpRegisterRootDevice2( IN Upnp_DescType descriptionType,
|
|
|
|
|
struct Handle_Info *HInfo;
|
|
|
|
|
int retVal = 0;
|
|
|
|
|
char *description = ( char * )description_const;
|
|
|
|
|
|
|
|
|
|
if( UpnpSdkInit != 1 ) {
|
|
|
|
|
return UPNP_E_FINISH;
|
|
|
|
|
}
|
|
|
|
@@ -1171,7 +1157,6 @@ UpnpRegisterRootDevice2( IN Upnp_DescType descriptionType,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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,19 +1220,11 @@ 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__,
|
|
|
|
@@ -1258,21 +1236,21 @@ UpnpRegisterRootDevice2( IN Upnp_DescType descriptionType,
|
|
|
|
|
&HInfo->ServiceTable, HInfo->DescURL ) ) {
|
|
|
|
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
|
|
|
|
"UpnpRegisterRootDevice2: GENA Service Table\n" );
|
|
|
|
|
} 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;
|
|
|
|
|
"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 *********************/
|
|
|
|
|
return UPNP_E_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // INCLUDE_DEVICE_APIS
|
|
|
|
|
|
|
|
|
|