White spaces and comments.
This commit is contained in:
@@ -153,31 +153,15 @@ subscription *GetSubscriptionSID(const Upnp_SID sid, service_info *service)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : GetNextSubscription
|
subscription *GetNextSubscription(service_info *service, subscription *current)
|
||||||
*
|
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
time_t current_time;
|
time_t current_time;
|
||||||
subscription *next = NULL;
|
subscription *next = NULL;
|
||||||
subscription *previous = NULL;
|
subscription *previous = NULL;
|
||||||
int notDone = 1;
|
int notDone = 1;
|
||||||
|
|
||||||
//get the current_time
|
// get the current_time
|
||||||
time( ¤t_time );
|
time( ¤t_time );
|
||||||
while( ( notDone ) && ( current ) ) {
|
while( ( notDone ) && ( current ) ) {
|
||||||
previous = current;
|
previous = current;
|
||||||
@@ -202,52 +186,26 @@ GetNextSubscription( service_info * service,
|
|||||||
return next;
|
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;
|
subscription *GetFirstSubscription(service_info *service)
|
||||||
next = GetNextSubscription( service, &temp );
|
{
|
||||||
service->subscriptionList = temp.next;
|
subscription temp;
|
||||||
// service->subscriptionList=next;
|
subscription *next = NULL;
|
||||||
return next;
|
|
||||||
|
temp.next = service->subscriptionList;
|
||||||
|
next = GetNextSubscription(service, &temp);
|
||||||
|
service->subscriptionList = temp.next;
|
||||||
|
// service->subscriptionList = next;
|
||||||
|
|
||||||
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : freeSubscription
|
void freeSubscription(subscription *sub)
|
||||||
*
|
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
if( sub ) {
|
if (sub) {
|
||||||
free_URL_list( &sub->DeliveryURLs );
|
free_URL_list(&sub->DeliveryURLs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@@ -1,65 +1,59 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \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 "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_timeout.h"
|
#include "upnp_timeout.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/************************************************************************
|
#include <stdlib.h> /* for free() */
|
||||||
* Function : free_upnp_timeout
|
|
||||||
*
|
|
||||||
* Parameters :
|
void free_upnp_timeout(upnp_timeout *event)
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
|
if (event) {
|
||||||
if( event ) {
|
if (event->Event) {
|
||||||
if( event->Event )
|
free(event->Event);
|
||||||
free( event->Event );
|
}
|
||||||
free( event );
|
free(event);
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,52 +1,64 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GENA_CTRLPT_H
|
||||||
|
#define GENA_CTRLPT_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : gena_process_notification_event
|
/*!
|
||||||
*
|
* \brief This function processes NOTIFY events that are sent by devices.
|
||||||
* Parameters:
|
*
|
||||||
* IN SOCKINFO *info: Socket structure containing the device socket
|
* Parameters:
|
||||||
* information
|
* IN SOCKINFO *info: Socket structure containing the device socket
|
||||||
* IN http_message_t* event: The http message contains the GENA
|
* information
|
||||||
* notification
|
* IN http_message_t *event: The http message contains the GENA
|
||||||
*
|
* notification
|
||||||
* Description:
|
*
|
||||||
* This function processes NOTIFY events that are sent by devices.
|
* \note called by genacallback()
|
||||||
* called by genacallback()
|
*/
|
||||||
*
|
void gena_process_notification_event(
|
||||||
* Returns: void
|
/*! [in] Socket info of the device. */
|
||||||
*
|
SOCKINFO *info,
|
||||||
* Note : called by genacallback()
|
/*! [in] The http message contains the GENA notification. */
|
||||||
****************************************************************************/
|
http_message_t *event);
|
||||||
void gena_process_notification_event( INOUT SOCKINFO *info,
|
|
||||||
IN http_message_t* request );
|
|
||||||
|
#endif /* GENA_CTRLPT_H */
|
||||||
|
|
||||||
|
@@ -1,88 +1,79 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GENA_DEVICE_H
|
||||||
|
#define GENA_DEVICE_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function : gena_process_subscription_request
|
/*!
|
||||||
*
|
* \brief Handles a subscription request from a ctrl point. The socket is not
|
||||||
* Parameters :
|
* closed on return.
|
||||||
* IN SOCKINFO *info : socket info of the device
|
*/
|
||||||
* IN http_message_t* request : SUBSCRIPTION request from the control
|
void gena_process_subscription_request(
|
||||||
* point
|
/*! [in] Socket info of the device. */
|
||||||
*
|
SOCKINFO *info,
|
||||||
* Description : This function handles a subscription request from a
|
/*! [in] Subscription request from the control point. */
|
||||||
* ctrl point. The socket is not closed on return.
|
http_message_t *request);
|
||||||
*
|
|
||||||
* Return : void
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
****************************************************************************/
|
|
||||||
void gena_process_subscription_request( IN SOCKINFO *info,
|
|
||||||
IN http_message_t* request );
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function : gena_process_subscription_renewal_request
|
* \brief Handles a subscription renewal request from a ctrl point.
|
||||||
*
|
* The connection is not destroyed on return.
|
||||||
* Parameters :
|
*/
|
||||||
* IN SOCKINFO *info : socket info of the device
|
void gena_process_subscription_renewal_request(
|
||||||
* IN http_message_t* request : subscription renewal request from the
|
/*! [in] Socket info of the device. */
|
||||||
* control point
|
SOCKINFO *info,
|
||||||
*
|
/*! [in] Subscription renewal request from the control point. */
|
||||||
* Description : This function handles a subscription renewal request
|
http_message_t *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 );
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function : gena_process_unsubscribe_request
|
* \brief Handles a subscription cancellation request from a ctrl point.
|
||||||
*
|
* The connection is not destroyed on return.
|
||||||
* Parameters :
|
*/
|
||||||
* IN SOCKINFO *info : socket info of the device
|
void gena_process_unsubscribe_request(
|
||||||
* IN http_message_t* request : UNSUBSCRIBE request from the control
|
/*! [in] Socket info of the device. */
|
||||||
* point
|
SOCKINFO *info,
|
||||||
*
|
/*! [in] UNSUBSCRIBE request from the control point. */
|
||||||
* Description : This function Handles a subscription cancellation request
|
http_message_t *request);
|
||||||
* from a ctrl point. The connection is not destroyed on return.
|
|
||||||
*
|
|
||||||
* Return : void
|
#endif /* GENA_DEVICE_H */
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
****************************************************************************/
|
|
||||||
void gena_process_unsubscribe_request( IN SOCKINFO *info,
|
|
||||||
IN http_message_t* request );
|
|
||||||
|
@@ -1,42 +1,49 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef GENLIB_NET_HTTP_HTTPPARSER_H
|
#ifndef GENLIB_NET_HTTP_HTTPPARSER_H
|
||||||
#define 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 "LinkedList.h"
|
||||||
|
#include "membuffer.h"
|
||||||
|
#include "uri.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
////// private types ////////////
|
////// 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 );
|
const char* method_to_str( IN http_method_t method );
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: print_http_headers
|
/*!
|
||||||
*
|
* \brief Print the HTTP headers.
|
||||||
* Parameters:
|
*/
|
||||||
* http_message_t* hmsg ; HTTP Message object
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* void
|
|
||||||
************************************************************************/
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void print_http_headers( IN http_message_t *hmsg );
|
void print_http_headers(
|
||||||
|
/*! [in] HTTP Message object. */
|
||||||
|
http_message_t *hmsg );
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} /* extern "C" */
|
||||||
#endif // __cplusplus
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
#endif // GENLIB_NET_HTTP_HTTPPARSER_H
|
#endif /* GENLIB_NET_HTTP_HTTPPARSER_H */
|
||||||
|
|
||||||
|
@@ -140,12 +140,12 @@ typedef void (* SsdpFunPtr)(Event *);
|
|||||||
|
|
||||||
typedef Event SsdpEvent ;
|
typedef Event SsdpEvent ;
|
||||||
|
|
||||||
//Structure to contain Discovery response
|
// Structure to contain Discovery response
|
||||||
typedef struct resultData
|
typedef struct resultData
|
||||||
{
|
{
|
||||||
struct Upnp_Discovery param;
|
struct Upnp_Discovery param;
|
||||||
void *cookie;
|
void *cookie;
|
||||||
Upnp_FunPtr ctrlpt_callback;
|
Upnp_FunPtr ctrlpt_callback;
|
||||||
}ResultData;
|
}ResultData;
|
||||||
|
|
||||||
|
|
||||||
@@ -224,12 +224,12 @@ int Make_Socket_NoBlocking (int sock);
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
void ssdp_handle_device_request(
|
void ssdp_handle_device_request(
|
||||||
IN http_message_t* hmsg,
|
IN http_message_t *hmsg,
|
||||||
IN struct sockaddr* dest_addr );
|
IN struct sockaddr *dest_addr);
|
||||||
#else
|
#else
|
||||||
static inline void ssdp_handle_device_request(
|
static inline void ssdp_handle_device_request(
|
||||||
IN http_message_t* hmsg,
|
IN http_message_t *hmsg,
|
||||||
IN struct sockaddr* dest_addr ) {}
|
IN struct sockaddr* dest_addr) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -253,10 +253,10 @@ static inline void ssdp_handle_device_request(
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ssdp_handle_ctrlpt_msg(
|
void ssdp_handle_ctrlpt_msg(
|
||||||
IN http_message_t* hmsg,
|
IN http_message_t *hmsg,
|
||||||
IN struct sockaddr* dest_addr,
|
IN struct sockaddr *dest_addr,
|
||||||
IN xboolean timeout,
|
IN xboolean timeout,
|
||||||
IN void* cookie );
|
IN void *cookie);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : unique_service_name
|
* Function : unique_service_name
|
||||||
|
@@ -1,58 +1,62 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef _UPNPTIMEOUTH_
|
|
||||||
#define _UPNPTIMEOUTH_
|
|
||||||
|
|
||||||
|
#ifndef UPNPTIMEOUT_H
|
||||||
|
#define UPNPTIMEOUT_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* The upnp_timeout structure definition.
|
||||||
|
*/
|
||||||
typedef struct UPNP_TIMEOUT {
|
typedef struct UPNP_TIMEOUT {
|
||||||
int EventType;
|
int EventType;
|
||||||
int handle;
|
int handle;
|
||||||
int eventId;
|
int eventId;
|
||||||
void *Event;
|
void *Event;
|
||||||
} upnp_timeout;
|
} upnp_timeout;
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function : free_upnp_timeout
|
* \brief Free memory associated with event and memory for any sub-elements.
|
||||||
*
|
*/
|
||||||
* Parameters :
|
void free_upnp_timeout(
|
||||||
* upnp_timeout *event ; Event which needs to be freed
|
/*! [in] Event which needs to be freed. */
|
||||||
*
|
upnp_timeout *event);
|
||||||
* Description : Free memory associated with event and memory for any
|
|
||||||
* sub-elements
|
|
||||||
*
|
#endif /* UPNPTIMEOUT_H */
|
||||||
* Return : void ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
void free_upnp_timeout(upnp_timeout *event);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@@ -57,90 +57,91 @@ struct SendInstruction
|
|||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: web_server_init
|
* Function: web_server_init
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* none
|
* none
|
||||||
*
|
*
|
||||||
* Description: Initilialize the different documents. Initialize the
|
* Description: Initilialize the different documents. Initialize the
|
||||||
* memory for root directory for web server. Call to initialize global
|
* memory for root directory for web server. Call to initialize global
|
||||||
* XML document. Sets bWebServerState to WEB_SERVER_ENABLED
|
* XML document. Sets bWebServerState to WEB_SERVER_ENABLED
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 - OK
|
* 0 - OK
|
||||||
* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here
|
* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int web_server_init( void );
|
int web_server_init(void);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: web_server_destroy
|
* Function: web_server_destroy
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* none
|
* none
|
||||||
*
|
*
|
||||||
* Description: Release memory allocated for the global web server root
|
* Description: Release memory allocated for the global web server root
|
||||||
* directory and the global XML document
|
* directory and the global XML document
|
||||||
* Resets the flag bWebServerState to WEB_SERVER_DISABLED
|
* Resets the flag bWebServerState to WEB_SERVER_DISABLED
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
void web_server_destroy( void );
|
void web_server_destroy(void);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: web_server_set_alias
|
* Function: web_server_set_alias
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* alias_name: webserver name of alias; created by caller and freed by
|
* alias_name: webserver name of alias; created by caller and freed by
|
||||||
* caller (doesn't even have to be malloc()d .)
|
* caller (doesn't even have to be malloc()d .)
|
||||||
* alias_content: the xml doc; this is allocated by the caller; and
|
* alias_content: the xml doc; this is allocated by the caller; and
|
||||||
* freed by the web server
|
* freed by the web server
|
||||||
* alias_content_length: length of alias body in bytes
|
* alias_content_length: length of alias body in bytes
|
||||||
* last_modified: time when the contents of alias were last
|
* last_modified: time when the contents of alias were last
|
||||||
* changed (local time)
|
* changed (local time)
|
||||||
*
|
*
|
||||||
* Description: Replaces current alias with the given alias. To remove
|
* Description: Replaces current alias with the given alias. To remove
|
||||||
* the current alias, set alias_name to NULL.
|
* the current alias, set alias_name to NULL.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 - OK
|
* 0 - OK
|
||||||
* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here
|
* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int web_server_set_alias( IN const char* alias_name,
|
int web_server_set_alias(
|
||||||
IN const char* alias_content, IN size_t alias_content_length,
|
IN const char* alias_name,
|
||||||
IN time_t last_modified );
|
IN const char* alias_content, IN size_t alias_content_length,
|
||||||
|
IN time_t last_modified);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: web_server_set_root_dir
|
* Function: web_server_set_root_dir
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN const char* root_dir ; String having the root directory for the
|
* IN const char* root_dir ; String having the root directory for the
|
||||||
* document
|
* document
|
||||||
*
|
*
|
||||||
* Description: Assign the path specfied by the IN const char* root_dir
|
* Description: Assign the path specfied by the IN const char* root_dir
|
||||||
* parameter to the global Document root directory. Also check for
|
* parameter to the global Document root directory. Also check for
|
||||||
* path names ending in '/'
|
* path names ending in '/'
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* int
|
* int
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int web_server_set_root_dir( IN const char* root_dir );
|
int web_server_set_root_dir(IN const char* root_dir);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: web_server_callback
|
* Function: web_server_callback
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN http_parser_t *parser,
|
* IN http_parser_t *parser,
|
||||||
* INOUT http_message_t* req,
|
* INOUT http_message_t* req,
|
||||||
* IN SOCKINFO *info
|
* IN SOCKINFO *info
|
||||||
*
|
*
|
||||||
* Description: main entry point into web server;
|
* Description: main entry point into web server;
|
||||||
* handles HTTP GET and HEAD requests
|
* handles HTTP GET and HEAD requests
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
void web_server_callback( IN http_parser_t *parser, IN http_message_t* req, INOUT SOCKINFO *info );
|
void web_server_callback(IN http_parser_t *parser, IN http_message_t *req, INOUT SOCKINFO *info);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -74,11 +74,10 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void send_search_result(IN void *data)
|
void send_search_result(IN void *data)
|
||||||
{
|
{
|
||||||
ResultData *temp = ( ResultData * ) data;
|
ResultData *temp = ( ResultData * ) data;
|
||||||
|
|
||||||
temp->ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT,
|
temp->ctrlpt_callback(UPNP_DISCOVERY_SEARCH_RESULT, &temp->param, temp->cookie);
|
||||||
&temp->param, temp->cookie );
|
free(temp);
|
||||||
free( temp );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -127,7 +126,7 @@ void ssdp_handle_ctrlpt_msg(
|
|||||||
ListNode *node = NULL;
|
ListNode *node = NULL;
|
||||||
SsdpSearchArg *searchArg = NULL;
|
SsdpSearchArg *searchArg = NULL;
|
||||||
int matched = 0;
|
int matched = 0;
|
||||||
ResultData *threadData;
|
ResultData *threadData = NULL;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
// we are assuming that there can be only one client supported at a time
|
// 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 ) {
|
if ( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// copy
|
// copy
|
||||||
ctrlpt_callback = ctrlpt_info->Callback;
|
ctrlpt_callback = ctrlpt_info->Callback;
|
||||||
@@ -146,14 +145,15 @@ void ssdp_handle_ctrlpt_msg(
|
|||||||
// search timeout
|
// search timeout
|
||||||
if ( timeout ) {
|
if ( timeout ) {
|
||||||
ctrlpt_callback( UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie );
|
ctrlpt_callback( UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
param.ErrCode = UPNP_E_SUCCESS;
|
param.ErrCode = UPNP_E_SUCCESS;
|
||||||
|
|
||||||
// MAX-AGE
|
// MAX-AGE
|
||||||
param.Expires = -1; // assume error
|
// assume error
|
||||||
if( httpmsg_find_hdr( hmsg, HDR_CACHE_CONTROL, &hdr_value ) != NULL ) {
|
param.Expires = -1;
|
||||||
|
if ( httpmsg_find_hdr( hmsg, HDR_CACHE_CONTROL, &hdr_value ) != NULL ) {
|
||||||
if( matchstr( hdr_value.buf, hdr_value.length,
|
if( matchstr( hdr_value.buf, hdr_value.length,
|
||||||
"%imax-age = %d%0", ¶m.Expires ) != PARSE_OK )
|
"%imax-age = %d%0", ¶m.Expires ) != PARSE_OK )
|
||||||
return;
|
return;
|
||||||
@@ -161,7 +161,7 @@ void ssdp_handle_ctrlpt_msg(
|
|||||||
|
|
||||||
// DATE
|
// DATE
|
||||||
param.Date[0] = '\0';
|
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 );
|
linecopylen( param.Date, hdr_value.buf, hdr_value.length );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,17 +170,17 @@ void ssdp_handle_ctrlpt_msg(
|
|||||||
|
|
||||||
// EXT
|
// EXT
|
||||||
param.Ext[0] = '\0';
|
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 );
|
linecopylen( param.Ext, hdr_value.buf, hdr_value.length );
|
||||||
}
|
}
|
||||||
// LOCATION
|
// LOCATION
|
||||||
param.Location[0] = '\0';
|
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 );
|
linecopylen( param.Location, hdr_value.buf, hdr_value.length );
|
||||||
}
|
}
|
||||||
// SERVER / USER-AGENT
|
// SERVER / USER-AGENT
|
||||||
param.Os[0] = '\0';
|
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 ) {
|
httpmsg_find_hdr( hmsg, HDR_USER_AGENT, &hdr_value ) != NULL ) {
|
||||||
linecopylen( param.Os, hdr_value.buf, hdr_value.length );
|
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,
|
TPJobInit( &job, ( start_routine ) send_search_result,
|
||||||
threadData );
|
threadData );
|
||||||
TPJobSetPriority(&job, MED_PRIORITY);
|
TPJobSetPriority(&job, MED_PRIORITY);
|
||||||
TPJobSetFreeFunction( &job, ( free_routine ) free );
|
TPJobSetFreeFunction(&job, (free_routine)free);
|
||||||
ThreadPoolAdd(&gRecvThreadPool, &job, NULL);
|
ThreadPoolAdd(&gRecvThreadPool, &job, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -102,9 +102,9 @@ advertiseAndReplyThread( IN void *data )
|
|||||||
* 1 if successful else appropriate error
|
* 1 if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
void
|
void ssdp_handle_device_request(
|
||||||
ssdp_handle_device_request( IN http_message_t *hmsg,
|
IN http_message_t *hmsg,
|
||||||
IN struct sockaddr *dest_addr )
|
IN struct sockaddr *dest_addr)
|
||||||
{
|
{
|
||||||
#define MX_FUDGE_FACTOR 10
|
#define MX_FUDGE_FACTOR 10
|
||||||
|
|
||||||
|
@@ -743,7 +743,7 @@ start_event_handler( void *Data )
|
|||||||
* Returns: void
|
* 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;
|
ssdp_thread_data *data = (ssdp_thread_data *)the_data;
|
||||||
http_message_t *hmsg = &data->parser.msg;
|
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 ||
|
if (hmsg->method == HTTPMETHOD_NOTIFY ||
|
||||||
hmsg->request_method == HTTPMETHOD_MSEARCH) {
|
hmsg->request_method == HTTPMETHOD_MSEARCH) {
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#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 */
|
#endif /* INCLUDE_CLIENT_APIS */
|
||||||
} else {
|
} else {
|
||||||
ssdp_handle_device_request(hmsg, (struct sockaddr*)&data->dest_addr);
|
ssdp_handle_device_request(hmsg, (struct sockaddr *)&data->dest_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free data */
|
/* free data */
|
||||||
|
Reference in New Issue
Block a user