diff --git a/upnp/src/genlib/service_table/service_table.c b/upnp/src/genlib/service_table/service_table.c index 5d41974..47ccf4f 100644 --- a/upnp/src/genlib/service_table/service_table.c +++ b/upnp/src/genlib/service_table/service_table.c @@ -153,31 +153,15 @@ subscription *GetSubscriptionSID(const Upnp_SID sid, service_info *service) } -/************************************************************************ -* Function : GetNextSubscription -* -* Parameters : -* service_info * service ; service object providing the list of -* subscriptions -* subscription *current ; current subscription object -* -* Description : Get current and valid subscription from the service -* table. -* -* Return : subscription * - Pointer to the next subscription node; -* -* Note : -************************************************************************/ -subscription * -GetNextSubscription( service_info * service, - subscription * current ) + +subscription *GetNextSubscription(service_info *service, subscription *current) { time_t current_time; subscription *next = NULL; subscription *previous = NULL; int notDone = 1; - //get the current_time + // get the current_time time( ¤t_time ); while( ( notDone ) && ( current ) ) { previous = current; @@ -202,52 +186,26 @@ GetNextSubscription( service_info * service, return next; } -/************************************************************************ -* Function : GetFirstSubscription -* -* Parameters : -* service_info *service ; service object providing the list of -* subscriptions -* -* Description : Gets pointer to the first subscription node in the -* service table. -* -* Return : subscription * - pointer to the first subscription node ; -* -* Note : -************************************************************************/ -subscription * -GetFirstSubscription( service_info * service ) -{ - subscription temp; - subscription *next = NULL; - temp.next = service->subscriptionList; - next = GetNextSubscription( service, &temp ); - service->subscriptionList = temp.next; - // service->subscriptionList=next; - return next; +subscription *GetFirstSubscription(service_info *service) +{ + subscription temp; + subscription *next = NULL; + + temp.next = service->subscriptionList; + next = GetNextSubscription(service, &temp); + service->subscriptionList = temp.next; + // service->subscriptionList = next; + + return next; } -/************************************************************************ -* Function : freeSubscription -* -* Parameters : -* subscription * sub ; subscription to be freed -* -* Description : Free's the memory allocated for storing the URL of -* the subscription. -* -* Return : void ; -* -* Note : -************************************************************************/ -void -freeSubscription( subscription * sub ) + +void freeSubscription(subscription *sub) { - if( sub ) { - free_URL_list( &sub->DeliveryURLs ); - } + if (sub) { + free_URL_list(&sub->DeliveryURLs); + } } /************************************************************************ diff --git a/upnp/src/genlib/util/upnp_timeout.c b/upnp/src/genlib/util/upnp_timeout.c index 2138c4b..e6320e4 100644 --- a/upnp/src/genlib/util/upnp_timeout.c +++ b/upnp/src/genlib/util/upnp_timeout.c @@ -1,65 +1,59 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2000-2003 Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither name of Intel Corporation nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// +/******************************************************************************* + * + * Copyright (c) 2000-2003 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************/ + + +/*! + * \file + * + * \brief Contains a function for freeing the memory associated with a upnp + * time out event. + */ -/************************************************************************ -* Purpose: This file contains a function for freeing the memory associated -* wuth a upnp time out event. -************************************************************************/ #include "config.h" + + #include "upnp_timeout.h" -#include -/************************************************************************ -* Function : free_upnp_timeout -* -* Parameters : -* upnp_timeout *event ; Event which needs to be freed -* -* Description : Free memory associated with event and memory for any -* sub-elements -* -* Return : void ; -* -* Note : -************************************************************************/ -void -free_upnp_timeout( upnp_timeout * event ) +#include /* for free() */ + + +void free_upnp_timeout(upnp_timeout *event) { - - if( event ) { - if( event->Event ) - free( event->Event ); - free( event ); - - } + if (event) { + if (event->Event) { + free(event->Event); + } + free(event); + } } + diff --git a/upnp/src/inc/gena_ctrlpt.h b/upnp/src/inc/gena_ctrlpt.h index 5896be2..ea2d630 100644 --- a/upnp/src/inc/gena_ctrlpt.h +++ b/upnp/src/inc/gena_ctrlpt.h @@ -1,52 +1,64 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2000-2003 Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither name of Intel Corporation nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// +/******************************************************************************* + * + * Copyright (c) 2000-2003 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************/ + + +#ifndef GENA_CTRLPT_H +#define GENA_CTRLPT_H + + +/*! + * \file + */ + #include "sock.h" -/************************************************************************ -* Function : gena_process_notification_event -* -* Parameters: -* IN SOCKINFO *info: Socket structure containing the device socket -* information -* IN http_message_t* event: The http message contains the GENA -* notification -* -* Description: -* This function processes NOTIFY events that are sent by devices. -* called by genacallback() -* -* Returns: void -* -* Note : called by genacallback() -****************************************************************************/ -void gena_process_notification_event( INOUT SOCKINFO *info, - IN http_message_t* request ); + +/*! + * \brief This function processes NOTIFY events that are sent by devices. + * + * Parameters: + * IN SOCKINFO *info: Socket structure containing the device socket + * information + * IN http_message_t *event: The http message contains the GENA + * notification + * + * \note called by genacallback() + */ +void gena_process_notification_event( + /*! [in] Socket info of the device. */ + SOCKINFO *info, + /*! [in] The http message contains the GENA notification. */ + http_message_t *event); + + +#endif /* GENA_CTRLPT_H */ + diff --git a/upnp/src/inc/gena_device.h b/upnp/src/inc/gena_device.h index 42077d0..4ffdb31 100644 --- a/upnp/src/inc/gena_device.h +++ b/upnp/src/inc/gena_device.h @@ -1,88 +1,79 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2000-2003 Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither name of Intel Corporation nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// +/******************************************************************************* + * + * Copyright (c) 2000-2003 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************/ + + +#ifndef GENA_DEVICE_H +#define GENA_DEVICE_H + + +/*! + * \file + */ + #include "sock.h" -/**************************************************************************** -* Function : gena_process_subscription_request -* -* Parameters : -* IN SOCKINFO *info : socket info of the device -* IN http_message_t* request : SUBSCRIPTION request from the control -* point -* -* Description : This function handles a subscription request from a -* ctrl point. The socket is not closed on return. -* -* Return : void -* -* Note : -****************************************************************************/ -void gena_process_subscription_request( IN SOCKINFO *info, - IN http_message_t* request ); + +/*! + * \brief Handles a subscription request from a ctrl point. The socket is not + * closed on return. + */ +void gena_process_subscription_request( + /*! [in] Socket info of the device. */ + SOCKINFO *info, + /*! [in] Subscription request from the control point. */ + http_message_t *request); -/**************************************************************************** -* Function : gena_process_subscription_renewal_request -* -* Parameters : -* IN SOCKINFO *info : socket info of the device -* IN http_message_t* request : subscription renewal request from the -* control point -* -* Description : This function handles a subscription renewal request -* from a ctrl point. The connection is not destroyed on return. -* -* Return : void -* -* Note : -****************************************************************************/ -void gena_process_subscription_renewal_request( IN SOCKINFO *info, - IN http_message_t* request ); +/*! + * \brief Handles a subscription renewal request from a ctrl point. + * The connection is not destroyed on return. + */ +void gena_process_subscription_renewal_request( + /*! [in] Socket info of the device. */ + SOCKINFO *info, + /*! [in] Subscription renewal request from the control point. */ + http_message_t *request); -/**************************************************************************** -* Function : gena_process_unsubscribe_request -* -* Parameters : -* IN SOCKINFO *info : socket info of the device -* IN http_message_t* request : UNSUBSCRIBE request from the control -* point -* -* Description : This function Handles a subscription cancellation request -* from a ctrl point. The connection is not destroyed on return. -* -* Return : void -* -* Note : -****************************************************************************/ -void gena_process_unsubscribe_request( IN SOCKINFO *info, - IN http_message_t* request ); +/*! + * \brief Handles a subscription cancellation request from a ctrl point. + * The connection is not destroyed on return. + */ +void gena_process_unsubscribe_request( + /*! [in] Socket info of the device. */ + SOCKINFO *info, + /*! [in] UNSUBSCRIBE request from the control point. */ + http_message_t *request); + + +#endif /* GENA_DEVICE_H */ + diff --git a/upnp/src/inc/httpparser.h b/upnp/src/inc/httpparser.h index a1bdb86..b41a805 100644 --- a/upnp/src/inc/httpparser.h +++ b/upnp/src/inc/httpparser.h @@ -1,42 +1,49 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2000-2003 Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither name of Intel Corporation nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// +/******************************************************************************* + * + * Copyright (c) 2000-2003 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************/ + #ifndef GENLIB_NET_HTTP_HTTPPARSER_H #define GENLIB_NET_HTTP_HTTPPARSER_H -#include "util.h" -#include "membuffer.h" -#include "uri.h" + +/*! + * \file + */ + #include "LinkedList.h" +#include "membuffer.h" +#include "uri.h" +#include "util.h" + ////// private types //////////// @@ -478,27 +485,22 @@ int raw_find_str( IN memptr* raw_value, IN const char* str ); ************************************************************************/ const char* method_to_str( IN http_method_t method ); -/************************************************************************ -* Function: print_http_headers -* -* Parameters: -* http_message_t* hmsg ; HTTP Message object -* -* Description: -* -* Returns: -* void -************************************************************************/ + +/*! + * \brief Print the HTTP headers. + */ #ifdef DEBUG -void print_http_headers( IN http_message_t *hmsg ); +void print_http_headers( + /*! [in] HTTP Message object. */ + http_message_t *hmsg ); #else -static UPNP_INLINE void print_http_headers( IN http_message_t *hmsg ) {} +static UPNP_INLINE void print_http_headers(http_message_t *hmsg) {} #endif #ifdef __cplusplus -} // extern "C" -#endif // __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ -#endif // GENLIB_NET_HTTP_HTTPPARSER_H +#endif /* GENLIB_NET_HTTP_HTTPPARSER_H */ diff --git a/upnp/src/inc/ssdplib.h b/upnp/src/inc/ssdplib.h index 94fecdd..15541fb 100644 --- a/upnp/src/inc/ssdplib.h +++ b/upnp/src/inc/ssdplib.h @@ -140,12 +140,12 @@ typedef void (* SsdpFunPtr)(Event *); typedef Event SsdpEvent ; -//Structure to contain Discovery response +// Structure to contain Discovery response typedef struct resultData { - struct Upnp_Discovery param; - void *cookie; - Upnp_FunPtr ctrlpt_callback; + struct Upnp_Discovery param; + void *cookie; + Upnp_FunPtr ctrlpt_callback; }ResultData; @@ -224,12 +224,12 @@ int Make_Socket_NoBlocking (int sock); ***************************************************************************/ #ifdef INCLUDE_DEVICE_APIS void ssdp_handle_device_request( - IN http_message_t* hmsg, - IN struct sockaddr* dest_addr ); + IN http_message_t *hmsg, + IN struct sockaddr *dest_addr); #else static inline void ssdp_handle_device_request( - IN http_message_t* hmsg, - IN struct sockaddr* dest_addr ) {} + IN http_message_t *hmsg, + IN struct sockaddr* dest_addr) {} #endif /************************************************************************ @@ -253,10 +253,10 @@ static inline void ssdp_handle_device_request( * ***************************************************************************/ void ssdp_handle_ctrlpt_msg( - IN http_message_t* hmsg, - IN struct sockaddr* dest_addr, + IN http_message_t *hmsg, + IN struct sockaddr *dest_addr, IN xboolean timeout, - IN void* cookie ); + IN void *cookie); /************************************************************************ * Function : unique_service_name diff --git a/upnp/src/inc/upnp_timeout.h b/upnp/src/inc/upnp_timeout.h index 65ab657..807c6d3 100644 --- a/upnp/src/inc/upnp_timeout.h +++ b/upnp/src/inc/upnp_timeout.h @@ -1,58 +1,62 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2000-2003 Intel Corporation -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither name of Intel Corporation nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// +/******************************************************************************* + * + * Copyright (c) 2000-2003 Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither name of Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************/ -#ifndef _UPNPTIMEOUTH_ -#define _UPNPTIMEOUTH_ +#ifndef UPNPTIMEOUT_H +#define UPNPTIMEOUT_H + + +/*! + * \file + */ + + +/*! + * The upnp_timeout structure definition. + */ typedef struct UPNP_TIMEOUT { - int EventType; - int handle; - int eventId; - void *Event; + int EventType; + int handle; + int eventId; + void *Event; } upnp_timeout; -/************************************************************************ -* Function : free_upnp_timeout -* -* Parameters : -* upnp_timeout *event ; Event which needs to be freed -* -* Description : Free memory associated with event and memory for any -* sub-elements -* -* Return : void ; -* -* Note : -************************************************************************/ -void free_upnp_timeout(upnp_timeout *event); +/*! + * \brief Free memory associated with event and memory for any sub-elements. + */ +void free_upnp_timeout( + /*! [in] Event which needs to be freed. */ + upnp_timeout *event); + + +#endif /* UPNPTIMEOUT_H */ -#endif diff --git a/upnp/src/inc/webserver.h b/upnp/src/inc/webserver.h index 4de1f7f..004c086 100644 --- a/upnp/src/inc/webserver.h +++ b/upnp/src/inc/webserver.h @@ -57,90 +57,91 @@ struct SendInstruction }; /************************************************************************ -* Function: web_server_init -* -* Parameters: -* none -* -* Description: Initilialize the different documents. Initialize the -* memory for root directory for web server. Call to initialize global -* XML document. Sets bWebServerState to WEB_SERVER_ENABLED -* -* Returns: -* 0 - OK -* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here -************************************************************************/ -int web_server_init( void ); + * Function: web_server_init + * + * Parameters: + * none + * + * Description: Initilialize the different documents. Initialize the + * memory for root directory for web server. Call to initialize global + * XML document. Sets bWebServerState to WEB_SERVER_ENABLED + * + * Returns: + * 0 - OK + * UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here + ************************************************************************/ +int web_server_init(void); /************************************************************************ -* Function: web_server_destroy -* -* Parameters: -* none -* -* Description: Release memory allocated for the global web server root -* directory and the global XML document -* Resets the flag bWebServerState to WEB_SERVER_DISABLED -* -* Returns: -* void -************************************************************************/ -void web_server_destroy( void ); + * Function: web_server_destroy + * + * Parameters: + * none + * + * Description: Release memory allocated for the global web server root + * directory and the global XML document + * Resets the flag bWebServerState to WEB_SERVER_DISABLED + * + * Returns: + * void + ************************************************************************/ +void web_server_destroy(void); /************************************************************************ -* Function: web_server_set_alias -* -* Parameters: -* alias_name: webserver name of alias; created by caller and freed by -* caller (doesn't even have to be malloc()d .) -* alias_content: the xml doc; this is allocated by the caller; and -* freed by the web server -* alias_content_length: length of alias body in bytes -* last_modified: time when the contents of alias were last -* changed (local time) -* -* Description: Replaces current alias with the given alias. To remove -* the current alias, set alias_name to NULL. -* -* Returns: -* 0 - OK -* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here -************************************************************************/ -int web_server_set_alias( IN const char* alias_name, - IN const char* alias_content, IN size_t alias_content_length, - IN time_t last_modified ); + * Function: web_server_set_alias + * + * Parameters: + * alias_name: webserver name of alias; created by caller and freed by + * caller (doesn't even have to be malloc()d .) + * alias_content: the xml doc; this is allocated by the caller; and + * freed by the web server + * alias_content_length: length of alias body in bytes + * last_modified: time when the contents of alias were last + * changed (local time) + * + * Description: Replaces current alias with the given alias. To remove + * the current alias, set alias_name to NULL. + * + * Returns: + * 0 - OK + * UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here + ************************************************************************/ +int web_server_set_alias( + IN const char* alias_name, + IN const char* alias_content, IN size_t alias_content_length, + IN time_t last_modified); /************************************************************************ -* Function: web_server_set_root_dir -* -* Parameters: -* IN const char* root_dir ; String having the root directory for the -* document -* -* Description: Assign the path specfied by the IN const char* root_dir -* parameter to the global Document root directory. Also check for -* path names ending in '/' -* -* Returns: -* int -************************************************************************/ -int web_server_set_root_dir( IN const char* root_dir ); + * Function: web_server_set_root_dir + * + * Parameters: + * IN const char* root_dir ; String having the root directory for the + * document + * + * Description: Assign the path specfied by the IN const char* root_dir + * parameter to the global Document root directory. Also check for + * path names ending in '/' + * + * Returns: + * int + ************************************************************************/ +int web_server_set_root_dir(IN const char* root_dir); /************************************************************************ -* Function: web_server_callback -* -* Parameters: -* IN http_parser_t *parser, -* INOUT http_message_t* req, -* IN SOCKINFO *info -* -* Description: main entry point into web server; -* handles HTTP GET and HEAD requests -* -* Returns: -* void -************************************************************************/ -void web_server_callback( IN http_parser_t *parser, IN http_message_t* req, INOUT SOCKINFO *info ); + * Function: web_server_callback + * + * Parameters: + * IN http_parser_t *parser, + * INOUT http_message_t* req, + * IN SOCKINFO *info + * + * Description: main entry point into web server; + * handles HTTP GET and HEAD requests + * + * Returns: + * void + ************************************************************************/ +void web_server_callback(IN http_parser_t *parser, IN http_message_t *req, INOUT SOCKINFO *info); #ifdef __cplusplus diff --git a/upnp/src/ssdp/ssdp_ctrlpt.c b/upnp/src/ssdp/ssdp_ctrlpt.c index 456ff0b..a3c611a 100644 --- a/upnp/src/ssdp/ssdp_ctrlpt.c +++ b/upnp/src/ssdp/ssdp_ctrlpt.c @@ -74,11 +74,10 @@ ***************************************************************************/ void send_search_result(IN void *data) { - ResultData *temp = ( ResultData * ) data; + ResultData *temp = ( ResultData * ) data; - temp->ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, - &temp->param, temp->cookie ); - free( temp ); + temp->ctrlpt_callback(UPNP_DISCOVERY_SEARCH_RESULT, &temp->param, temp->cookie); + free(temp); } /************************************************************************ @@ -127,7 +126,7 @@ void ssdp_handle_ctrlpt_msg( ListNode *node = NULL; SsdpSearchArg *searchArg = NULL; int matched = 0; - ResultData *threadData; + ResultData *threadData = NULL; ThreadPoolJob job; // we are assuming that there can be only one client supported at a time @@ -136,7 +135,7 @@ void ssdp_handle_ctrlpt_msg( if ( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) { HandleUnlock(); - return; + return; } // copy ctrlpt_callback = ctrlpt_info->Callback; @@ -146,14 +145,15 @@ void ssdp_handle_ctrlpt_msg( // search timeout if ( timeout ) { ctrlpt_callback( UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie ); - return; + return; } param.ErrCode = UPNP_E_SUCCESS; // MAX-AGE - param.Expires = -1; // assume error - if( httpmsg_find_hdr( hmsg, HDR_CACHE_CONTROL, &hdr_value ) != NULL ) { + // assume error + param.Expires = -1; + if ( httpmsg_find_hdr( hmsg, HDR_CACHE_CONTROL, &hdr_value ) != NULL ) { if( matchstr( hdr_value.buf, hdr_value.length, "%imax-age = %d%0", ¶m.Expires ) != PARSE_OK ) return; @@ -161,7 +161,7 @@ void ssdp_handle_ctrlpt_msg( // DATE param.Date[0] = '\0'; - if( httpmsg_find_hdr( hmsg, HDR_DATE, &hdr_value ) != NULL ) { + if ( httpmsg_find_hdr( hmsg, HDR_DATE, &hdr_value ) != NULL ) { linecopylen( param.Date, hdr_value.buf, hdr_value.length ); } @@ -170,17 +170,17 @@ void ssdp_handle_ctrlpt_msg( // EXT param.Ext[0] = '\0'; - if( httpmsg_find_hdr( hmsg, HDR_EXT, &hdr_value ) != NULL ) { + if ( httpmsg_find_hdr( hmsg, HDR_EXT, &hdr_value ) != NULL ) { linecopylen( param.Ext, hdr_value.buf, hdr_value.length ); } // LOCATION param.Location[0] = '\0'; - if( httpmsg_find_hdr( hmsg, HDR_LOCATION, &hdr_value ) != NULL ) { + if ( httpmsg_find_hdr( hmsg, HDR_LOCATION, &hdr_value ) != NULL ) { linecopylen( param.Location, hdr_value.buf, hdr_value.length ); } // SERVER / USER-AGENT param.Os[0] = '\0'; - if( httpmsg_find_hdr( hmsg, HDR_SERVER, &hdr_value ) != NULL || + if ( httpmsg_find_hdr( hmsg, HDR_SERVER, &hdr_value ) != NULL || httpmsg_find_hdr( hmsg, HDR_USER_AGENT, &hdr_value ) != NULL ) { linecopylen( param.Os, hdr_value.buf, hdr_value.length ); } @@ -327,7 +327,7 @@ void ssdp_handle_ctrlpt_msg( TPJobInit( &job, ( start_routine ) send_search_result, threadData ); TPJobSetPriority(&job, MED_PRIORITY); - TPJobSetFreeFunction( &job, ( free_routine ) free ); + TPJobSetFreeFunction(&job, (free_routine)free); ThreadPoolAdd(&gRecvThreadPool, &job, NULL); } } diff --git a/upnp/src/ssdp/ssdp_device.c b/upnp/src/ssdp/ssdp_device.c index 1e7dc1b..86dcb1e 100644 --- a/upnp/src/ssdp/ssdp_device.c +++ b/upnp/src/ssdp/ssdp_device.c @@ -102,9 +102,9 @@ advertiseAndReplyThread( IN void *data ) * 1 if successful else appropriate error ***************************************************************************/ #ifdef INCLUDE_DEVICE_APIS -void -ssdp_handle_device_request( IN http_message_t *hmsg, - IN struct sockaddr *dest_addr ) +void ssdp_handle_device_request( + IN http_message_t *hmsg, + IN struct sockaddr *dest_addr) { #define MX_FUDGE_FACTOR 10 diff --git a/upnp/src/ssdp/ssdp_server.c b/upnp/src/ssdp/ssdp_server.c index dba73b0..0ab3084 100644 --- a/upnp/src/ssdp/ssdp_server.c +++ b/upnp/src/ssdp/ssdp_server.c @@ -743,7 +743,7 @@ start_event_handler( void *Data ) * Returns: void * ***************************************************************************/ -static void ssdp_event_handler_thread(void * the_data) +static void ssdp_event_handler_thread(void *the_data) { ssdp_thread_data *data = (ssdp_thread_data *)the_data; http_message_t *hmsg = &data->parser.msg; @@ -755,10 +755,10 @@ static void ssdp_event_handler_thread(void * the_data) if (hmsg->method == HTTPMETHOD_NOTIFY || hmsg->request_method == HTTPMETHOD_MSEARCH) { #ifdef INCLUDE_CLIENT_APIS - ssdp_handle_ctrlpt_msg(hmsg, (struct sockaddr*)&data->dest_addr, FALSE, NULL); + ssdp_handle_ctrlpt_msg(hmsg, (struct sockaddr *)&data->dest_addr, FALSE, NULL); #endif /* INCLUDE_CLIENT_APIS */ } else { - ssdp_handle_device_request(hmsg, (struct sockaddr*)&data->dest_addr); + ssdp_handle_device_request(hmsg, (struct sockaddr *)&data->dest_addr); } /* free data */