White spaces.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@226 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2007-11-05 12:06:52 +00:00
parent fd80e5a8ff
commit cb7e6b7472
2 changed files with 74 additions and 82 deletions

View File

@@ -1,30 +1,30 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2003 Intel Corporation // Copyright (c) 2000-2003 Intel Corporation
// All rights reserved. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met: // modification, are permitted provided that the following conditions are met:
// //
// * Redistributions of source code must retain the above copyright notice, // * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer. // this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, // * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation // this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution. // and/or other materials provided with the distribution.
// * Neither name of Intel Corporation nor the names of its contributors // * Neither name of Intel Corporation nor the names of its contributors
// may be used to endorse or promote products derived from this software // may be used to endorse or promote products derived from this software
// without specific prior written permission. // without specific prior written permission.
// //
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@@ -83,11 +83,11 @@ advertiseAndReplyThread( IN void *data )
/************************************************************************ /************************************************************************
* Function : ssdp_handle_device_request * Function : ssdp_handle_device_request
* *
* Parameters: * Parameters:
* IN http_message_t* hmsg: SSDP search request from the control point * IN http_message_t* hmsg: SSDP search request from the control point
* IN struct sockaddr_in* dest_addr: The address info of control point * IN struct sockaddr_in* dest_addr: The address info of control point
* *
* Description: * Description:
* This function handles the search request. It do the sanity checks of * This function handles the search request. It do the sanity checks of
* the request and then schedules a thread to send a random time reply ( * the request and then schedules a thread to send a random time reply (
* random within maximum time given by the control point to reply). * random within maximum time given by the control point to reply).
@@ -194,15 +194,15 @@ ssdp_handle_device_request( IN http_message_t * hmsg,
#endif #endif
/************************************************************************ /************************************************************************
* Function : NewRequestHandler * Function : NewRequestHandler
* *
* Parameters: * Parameters:
* IN struct sockaddr_in * DestAddr: Ip address, to send the reply. * IN struct sockaddr_in * DestAddr: Ip address, to send the reply.
* IN int NumPacket: Number of packet to be sent. * IN int NumPacket: Number of packet to be sent.
* IN char **RqPacket:Number of packet to be sent. * IN char **RqPacket:Number of packet to be sent.
* *
* Description: * Description:
* This function works as a request handler which passes the HTTP * This function works as a request handler which passes the HTTP
* request string to multicast channel then * request string to multicast channel then
* *
* Returns: void * * Returns: void *
@@ -266,24 +266,24 @@ NewRequestHandler( IN struct sockaddr_in *DestAddr,
} }
/************************************************************************ /************************************************************************
* Function : CreateServiceRequestPacket * Function : CreateServiceRequestPacket
* *
* Parameters: * Parameters:
* IN int msg_type : type of the message ( Search Reply, Advertisement * IN int msg_type : type of the message ( Search Reply, Advertisement
* or Shutdown ) * or Shutdown )
* IN char * nt : ssdp type * IN char * nt : ssdp type
* IN char * usn : unique service name ( go in the HTTP Header) * IN char * usn : unique service name ( go in the HTTP Header)
* IN char * location :Location URL. * IN char * location :Location URL.
* IN int duration :Service duration in sec. * IN int duration :Service duration in sec.
* OUT char** packet :Output buffer filled with HTTP statement. * OUT char** packet :Output buffer filled with HTTP statement.
* *
* Description: * Description:
* This function creates a HTTP request packet. Depending * This function creates a HTTP request packet. Depending
* on the input parameter it either creates a service advertisement * on the input parameter it either creates a service advertisement
* request or service shutdown request etc. * request or service shutdown request etc.
* *
* Returns: void * Returns: void
* *
***************************************************************************/ ***************************************************************************/
void void
CreateServicePacket( IN int msg_type, CreateServicePacket( IN int msg_type,
@@ -358,9 +358,9 @@ CreateServicePacket( IN int msg_type,
} }
/************************************************************************ /************************************************************************
* Function : DeviceAdvertisement * Function : DeviceAdvertisement
* *
* Parameters: * Parameters:
* IN char * DevType : type of the device * IN char * DevType : type of the device
* IN int RootDev: flag to indicate if the device is root device * IN int RootDev: flag to indicate if the device is root device
* IN char * nt : ssdp type * IN char * nt : ssdp type
@@ -368,7 +368,7 @@ CreateServicePacket( IN int msg_type,
* IN char * location :Location URL. * IN char * location :Location URL.
* IN int duration :Service duration in sec. * IN int duration :Service duration in sec.
* *
* Description: * Description:
* This function creates the device advertisement request based on * This function creates the device advertisement request based on
* the input parameter, and send it to the multicast channel. * the input parameter, and send it to the multicast channel.
* *
@@ -444,9 +444,9 @@ DeviceAdvertisement( IN char *DevType,
} }
/************************************************************************ /************************************************************************
* Function : SendReply * Function : SendReply
* *
* Parameters: * Parameters:
* IN struct sockaddr_in * DestAddr:destination IP address. * IN struct sockaddr_in * DestAddr:destination IP address.
* IN char *DevType: Device type * IN char *DevType: Device type
* IN int RootDev: 1 means root device 0 means embedded device. * IN int RootDev: 1 means root device 0 means embedded device.
@@ -455,7 +455,7 @@ DeviceAdvertisement( IN char *DevType,
* IN int Duration :Life time of this device. * IN int Duration :Life time of this device.
* IN int ByType: * IN int ByType:
* *
* Description: * Description:
* This function creates the reply packet based on the input parameter, * This function creates the reply packet based on the input parameter,
* and send it to the client addesss given in its input parameter DestAddr. * and send it to the client addesss given in its input parameter DestAddr.
* *
@@ -521,9 +521,9 @@ SendReply( IN struct sockaddr_in *DestAddr,
} }
/************************************************************************ /************************************************************************
* Function : DeviceReply * Function : DeviceReply
* *
* Parameters: * Parameters:
* IN struct sockaddr_in * DestAddr:destination IP address. * IN struct sockaddr_in * DestAddr:destination IP address.
* IN char *DevType: Device type * IN char *DevType: Device type
* IN int RootDev: 1 means root device 0 means embedded device. * IN int RootDev: 1 means root device 0 means embedded device.
@@ -531,7 +531,7 @@ SendReply( IN struct sockaddr_in *DestAddr,
* IN char * Location: Location of Device description document. * IN char * Location: Location of Device description document.
* IN int Duration :Life time of this device. * IN int Duration :Life time of this device.
* Description: * Description:
* This function creates the reply packet based on the input parameter, * This function creates the reply packet based on the input parameter,
* and send it to the client address given in its input parameter DestAddr. * and send it to the client address given in its input parameter DestAddr.
* *
@@ -600,18 +600,16 @@ DeviceReply( IN struct sockaddr_in *DestAddr,
} }
/************************************************************************ /************************************************************************
* Function : ServiceAdvertisement * Function : ServiceAdvertisement
* *
* Parameters: * Parameters:
* IN char * Udn: Device UDN * IN char * Udn: Device UDN
* IN char *ServType: Service Type. * IN char *ServType: Service Type.
* IN char * Location: Location of Device description document. * IN char * Location: Location of Device description document.
* IN int Duration :Life time of this device. * IN int Duration :Life time of this device.
* Description:
* Description: * This function creates the advertisement packet based
* This function creates the advertisement packet based
* on the input parameter, and send it to the multicast channel. * on the input parameter, and send it to the multicast channel.
* *
* Returns: int * Returns: int
* UPNP_E_SUCCESS if successful else appropriate error * UPNP_E_SUCCESS if successful else appropriate error
@@ -648,19 +646,17 @@ ServiceAdvertisement( IN char *Udn,
} }
/************************************************************************ /************************************************************************
* Function : ServiceReply * Function : ServiceReply
* *
* Parameters: * Parameters:
* IN struct sockaddr_in *DestAddr: * IN struct sockaddr_in *DestAddr:
* IN char * Udn: Device UDN * IN char * Udn: Device UDN
* IN char *ServType: Service Type. * IN char *ServType: Service Type.
* IN char * Location: Location of Device description document. * IN char * Location: Location of Device description document.
* IN int Duration :Life time of this device. * IN int Duration :Life time of this device.
* Description:
* Description:
* This function creates the advertisement packet based * This function creates the advertisement packet based
* on the input parameter, and send it to the multicast channel. * on the input parameter, and send it to the multicast channel.
* *
* Returns: int * Returns: int
* UPNP_E_SUCCESS if successful else appropriate error * UPNP_E_SUCCESS if successful else appropriate error
@@ -693,15 +689,14 @@ ServiceReply( IN struct sockaddr_in *DestAddr,
} }
/************************************************************************ /************************************************************************
* Function : ServiceShutdown * Function : ServiceShutdown
* *
* Parameters: * Parameters:
* IN char * Udn: Device UDN * IN char * Udn: Device UDN
* IN char *ServType: Service Type. * IN char *ServType: Service Type.
* IN char * Location: Location of Device description document. * IN char * Location: Location of Device description document.
* IN int Duration :Service duration in sec. * IN int Duration :Service duration in sec.
* Description:
* Description:
* This function creates a HTTP service shutdown request packet * This function creates a HTTP service shutdown request packet
* and sent it to the multicast channel through RequestHandler. * and sent it to the multicast channel through RequestHandler.
* *
@@ -739,16 +734,16 @@ ServiceShutdown( IN char *Udn,
} }
/************************************************************************ /************************************************************************
* Function : DeviceShutdown * Function : DeviceShutdown
* *
* Parameters: * Parameters:
* IN char *DevType: Device Type. * IN char *DevType: Device Type.
* IN int RootDev:1 means root device. * IN int RootDev:1 means root device.
* IN char * Udn: Device UDN * IN char * Udn: Device UDN
* IN char * Location: Location URL * IN char * Location: Location URL
* IN int Duration :Device duration in sec. * IN int Duration :Device duration in sec.
* *
* Description: * Description:
* This function creates a HTTP device shutdown request packet * This function creates a HTTP device shutdown request packet
* and sent it to the multicast channel through RequestHandler. * and sent it to the multicast channel through RequestHandler.
* *
@@ -821,3 +816,4 @@ DeviceShutdown( IN char *DevType,
#endif // EXCLUDE_SSDP #endif // EXCLUDE_SSDP
#endif // INCLUDE_DEVICE_APIS #endif // INCLUDE_DEVICE_APIS

View File

@@ -152,15 +152,13 @@ int AdvertiseAndReply( IN int AdFlag,
} }
dbgStr = ixmlNode_getNodeName( tmpNode ); dbgStr = ixmlNode_getNodeName( tmpNode );
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
"Extracting device type once for %s\n", "Extracting device type once for %s\n", dbgStr );
dbgStr ); // extract device type
// extract device type ixmlNodeList_free( nodeList );
ixmlNodeList_free( nodeList );
nodeList = NULL; nodeList = NULL;
nodeList = nodeList = ixmlElement_getElementsByTagName(
ixmlElement_getElementsByTagName( ( IXML_Element * ) tmpNode, ( IXML_Element * ) tmpNode, "deviceType" );
"deviceType" );
if( nodeList == NULL ) { if( nodeList == NULL ) {
continue; continue;
} }
@@ -168,7 +166,6 @@ int AdvertiseAndReply( IN int AdFlag,
dbgStr = ixmlNode_getNodeName( tmpNode ); dbgStr = ixmlNode_getNodeName( tmpNode );
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"Extracting UDN for %s\n", dbgStr ); "Extracting UDN for %s\n", dbgStr );
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"Extracting device type\n" ); "Extracting device type\n" );
@@ -238,13 +235,12 @@ int AdvertiseAndReply( IN int AdFlag,
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__, UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
"Sending UDNStr = %s \n", UDNstr ); "Sending UDNStr = %s \n", UDNstr );
if( AdFlag ) { if( AdFlag ) {
// send the device advertisement // send the device advertisement
if( AdFlag == 1 ) { if( AdFlag == 1 ) {
DeviceAdvertisement( devType, i == 0, DeviceAdvertisement( devType, i == 0,
UDNstr, SInfo->DescURL, Exp ); UDNstr, SInfo->DescURL, Exp );
} else // AdFlag == -1 } else { // AdFlag == -1
{
DeviceShutdown( devType, i == 0, UDNstr, DeviceShutdown( devType, i == 0, UDNstr,
SERVER, SInfo->DescURL, Exp ); SERVER, SInfo->DescURL, Exp );
} }
@@ -403,7 +399,7 @@ int AdvertiseAndReply( IN int AdFlag,
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"Exiting AdvertiseAndReply : \n" ); "Exiting AdvertiseAndReply : \n" );
HandleUnlock( ); HandleUnlock();
return UPNP_E_SUCCESS; return UPNP_E_SUCCESS;