Doxygenation and improove debugging in gena.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@392 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
724700be0d
commit
494518b14b
@ -29,6 +29,7 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef UPNP_H
|
||||
#define UPNP_H
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**************************************************************************
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000-2003 Intel Corporation
|
||||
* All rights reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
**************************************************************************/
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
@ -2206,52 +2206,69 @@ int UpnpAcceptSubscription(
|
||||
int cVariables,
|
||||
IN const Upnp_SID SubsId)
|
||||
{
|
||||
struct Handle_Info *SInfo = NULL;
|
||||
int retVal;
|
||||
char *DevID = ( char * )DevID_const;
|
||||
char *ServName = ( char * )ServName_const;
|
||||
char **VarName = ( char ** )VarName_const;
|
||||
char **NewVal = ( char ** )NewVal_const;
|
||||
int ret = 0;
|
||||
int line = 0;
|
||||
struct Handle_Info *SInfo = NULL;
|
||||
char *DevID = (char *)DevID_const;
|
||||
char *ServName = (char *)ServName_const;
|
||||
char **VarName = (char **)VarName_const;
|
||||
char **NewVal = (char **)NewVal_const;
|
||||
|
||||
if( UpnpSdkInit != 1 ) {
|
||||
return UPNP_E_FINISH;
|
||||
}
|
||||
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Inside UpnpAcceptSubscription\n");
|
||||
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Inside UpnpAcceptSubscription \n" );
|
||||
if (UpnpSdkInit != 1) {
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_FINISH;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
HandleReadLock();
|
||||
if( GetHandleInfo( Hnd, &SInfo ) != HND_DEVICE ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_HANDLE;
|
||||
}
|
||||
if( DevID == NULL ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
if( ServName == NULL ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
if( SubsId == NULL ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
if( VarName == NULL || NewVal == NULL || cVariables < 0 ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
HandleReadLock();
|
||||
|
||||
HandleUnlock();
|
||||
retVal =
|
||||
genaInitNotify( Hnd, DevID, ServName, VarName, NewVal, cVariables,
|
||||
SubsId );
|
||||
if (GetHandleInfo(Hnd, &SInfo) != HND_DEVICE) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_HANDLE;
|
||||
goto ExitFunction;
|
||||
}
|
||||
if (DevID == NULL) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
if (ServName == NULL) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
if (SubsId == NULL) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
if (VarName == NULL || NewVal == NULL || cVariables < 0) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Exiting UpnpAcceptSubscription \n" );
|
||||
return retVal;
|
||||
HandleUnlock();
|
||||
|
||||
line = __LINE__;
|
||||
ret = genaInitNotify(
|
||||
Hnd, DevID, ServName, VarName, NewVal, cVariables, SubsId);
|
||||
|
||||
ExitFunction:
|
||||
UpnpPrintf(UPNP_ALL, API, __FILE__, line,
|
||||
"Exiting UpnpAcceptSubscription, ret = %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} /***************** End of UpnpAcceptSubscription *********************/
|
||||
|
||||
/**************************************************************************
|
||||
* Function: UpnpAcceptSubscriptionExt
|
||||
@ -2277,57 +2294,73 @@ int UpnpAcceptSubscription(
|
||||
* Return Values: int
|
||||
* UPNP_E_SUCCESS if successful else sends appropriate error.
|
||||
***************************************************************************/
|
||||
int
|
||||
UpnpAcceptSubscriptionExt( IN UpnpDevice_Handle Hnd,
|
||||
IN const char *DevID_const,
|
||||
IN const char *ServName_const,
|
||||
IN IXML_Document * PropSet,
|
||||
IN Upnp_SID SubsId )
|
||||
int UpnpAcceptSubscriptionExt(
|
||||
IN UpnpDevice_Handle Hnd,
|
||||
IN const char *DevID_const,
|
||||
IN const char *ServName_const,
|
||||
IN IXML_Document *PropSet,
|
||||
IN Upnp_SID SubsId)
|
||||
{
|
||||
struct Handle_Info *SInfo = NULL;
|
||||
int retVal;
|
||||
char *DevID = ( char * )DevID_const;
|
||||
char *ServName = ( char * )ServName_const;
|
||||
int ret = 0;
|
||||
int line = 0;
|
||||
struct Handle_Info *SInfo = NULL;
|
||||
char *DevID = (char *)DevID_const;
|
||||
char *ServName = (char *)ServName_const;
|
||||
|
||||
if( UpnpSdkInit != 1 ) {
|
||||
return UPNP_E_FINISH;
|
||||
}
|
||||
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Inside UpnpAcceptSubscription\n");
|
||||
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Inside UpnpAcceptSubscription \n" );
|
||||
if (UpnpSdkInit != 1) {
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_FINISH;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
HandleReadLock();
|
||||
if( GetHandleInfo( Hnd, &SInfo ) != HND_DEVICE ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_HANDLE;
|
||||
}
|
||||
if( DevID == NULL ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
if( ServName == NULL ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
if( SubsId == NULL ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
HandleReadLock();
|
||||
|
||||
if( PropSet == NULL ) {
|
||||
HandleUnlock();
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
if (GetHandleInfo(Hnd, &SInfo) != HND_DEVICE) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_HANDLE;
|
||||
goto ExitFunction;
|
||||
}
|
||||
if (DevID == NULL) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
if (ServName == NULL) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
if (SubsId == NULL) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
HandleUnlock();
|
||||
retVal = genaInitNotifyExt( Hnd, DevID, ServName, PropSet, SubsId );
|
||||
if (PropSet == NULL) {
|
||||
HandleUnlock();
|
||||
line = __LINE__;
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Exiting UpnpAcceptSubscription \n" );
|
||||
HandleUnlock();
|
||||
|
||||
return retVal;
|
||||
line = __LINE__;
|
||||
ret = genaInitNotifyExt(Hnd, DevID, ServName, PropSet, SubsId);
|
||||
|
||||
} /****************** End of UpnpAcceptSubscription *********************/
|
||||
ExitFunction:
|
||||
UpnpPrintf(UPNP_ALL, API, __FILE__, line,
|
||||
"Exiting UpnpAcceptSubscription, ret = %d.\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // INCLUDE_DEVICE_APIS
|
||||
#endif // EXCLUDE_GENA == 0
|
||||
|
@ -1,33 +1,33 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
@ -47,23 +47,17 @@
|
||||
#include "uuid.h"
|
||||
#include "upnpapi.h"
|
||||
|
||||
|
||||
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
||||
|
||||
/************************************************************************
|
||||
* Function : GenaAutoRenewSubscription
|
||||
*
|
||||
* Parameters:
|
||||
* IN void *input: Thread data(upnp_timeout *) needed to send the renewal
|
||||
*
|
||||
* Description:
|
||||
* This is a thread function to send the renewal just before the
|
||||
* subscription times out.
|
||||
*
|
||||
* Returns: VOID
|
||||
*
|
||||
***************************************************************************/
|
||||
static void
|
||||
GenaAutoRenewSubscription( IN void *input )
|
||||
|
||||
/*!
|
||||
* \brief This is a thread function to send the renewal just before the
|
||||
* subscription times out.
|
||||
*/
|
||||
static void GenaAutoRenewSubscription(
|
||||
/*! [in] Thread data(upnp_timeout *) needed to send the renewal. */
|
||||
IN void *input)
|
||||
{
|
||||
upnp_timeout *event = (upnp_timeout *) input;
|
||||
UpnpEventSubscribe *sub_struct = (UpnpEventSubscribe *)event->Event;
|
||||
@ -117,24 +111,18 @@ GenaAutoRenewSubscription( IN void *input )
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : ScheduleGenaAutoRenew
|
||||
/*!
|
||||
* \brief Schedules a job to renew the subscription just before time out.
|
||||
*
|
||||
* Parameters:
|
||||
* IN int client_handle: Handle that also contains the subscription list
|
||||
* IN int TimeOut: The time out value of the subscription
|
||||
* IN client_subscription * sub: Subscription being renewed
|
||||
*
|
||||
* Description:
|
||||
* This function schedules a job to renew the subscription just before
|
||||
* time out.
|
||||
*
|
||||
* Returns: int
|
||||
* return GENA_E_SUCCESS if successful else returns appropriate error
|
||||
***************************************************************************/
|
||||
* \return GENA_E_SUCCESS if successful, otherwise returns the appropriate
|
||||
* error code.
|
||||
*/
|
||||
static int ScheduleGenaAutoRenew(
|
||||
/*! [in] Handle that also contains the subscription list. */
|
||||
IN int client_handle,
|
||||
/*! [in] The time out value of the subscription. */
|
||||
IN int TimeOut,
|
||||
/*! [in] Subscription being renewed. */
|
||||
IN ClientSubscription *sub)
|
||||
{
|
||||
UpnpEventSubscribe *RenewEventStruct = NULL;
|
||||
@ -190,24 +178,19 @@ static int ScheduleGenaAutoRenew(
|
||||
return GENA_SUCCESS;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : gena_unsubscribe
|
||||
|
||||
/*!
|
||||
* \brief Sends the UNSUBCRIBE gena request and recieves the response from the
|
||||
* device and returns it as a parameter.
|
||||
*
|
||||
* Parameters:
|
||||
* IN const UpnpString *url: Event URL of the service
|
||||
* IN const UpnpString *sid: The subcription ID.
|
||||
* OUT http_parser_t *response: The UNSUBCRIBE response from the device
|
||||
*
|
||||
* Description:
|
||||
* This function sends the UNSUBCRIBE gena request and recieves the
|
||||
* response from the device and returns it as a parameter
|
||||
*
|
||||
* Returns: int
|
||||
* return 0 if successful else returns appropriate error
|
||||
***************************************************************************/
|
||||
* \returns 0 if successful, otherwise returns the appropriate error code.
|
||||
*/
|
||||
static int gena_unsubscribe(
|
||||
/*! [in] Event URL of the service. */
|
||||
IN const UpnpString *url,
|
||||
/*! [in] The subcription ID. */
|
||||
IN const UpnpString *sid,
|
||||
/*! [out] The UNSUBCRIBE response from the device. */
|
||||
OUT http_parser_t *response )
|
||||
{
|
||||
int return_code;
|
||||
@ -256,27 +239,21 @@ static int gena_unsubscribe(
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: gena_subscribe
|
||||
|
||||
/*!
|
||||
* \brief Subscribes or renew subscription.
|
||||
*
|
||||
* Parameters:
|
||||
* IN const UpnpString *url: url of service to subscribe
|
||||
* INOUT int* timeout: subscription time desired (in secs)
|
||||
* IN const UpnpString *renewal_sid: for renewal, this contains a currently h
|
||||
* held subscription SID. For first time
|
||||
* subscription, this must be NULL
|
||||
* OUT UpnpString *sid: SID returned by the subscription or renew msg
|
||||
*
|
||||
* Description:
|
||||
* This function subscribes or renew subscription
|
||||
*
|
||||
* Returns: int
|
||||
* return 0 if successful else returns appropriate error
|
||||
***************************************************************************/
|
||||
* \return 0 if successful, otherwise returns the appropriate error code.
|
||||
*/
|
||||
static int gena_subscribe(
|
||||
/*! [in] URL of service to subscribe. */
|
||||
IN const UpnpString *url,
|
||||
/*! [in,out] Subscription time desired (in secs). */
|
||||
INOUT int *timeout,
|
||||
/*! [in] for renewal, this contains a currently held subscription SID.
|
||||
* For first time subscription, this must be NULL. */
|
||||
IN const UpnpString *renewal_sid,
|
||||
/*! [out] SID returned by the subscription or renew msg. */
|
||||
OUT UpnpString *sid)
|
||||
{
|
||||
int return_code;
|
||||
@ -400,21 +377,7 @@ static int gena_subscribe(
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: genaUnregisterClient
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle client_handle:
|
||||
* Handle containing all the control point related information
|
||||
*
|
||||
* Description:
|
||||
* This function unsubcribes all the outstanding subscriptions and cleans
|
||||
* the subscription list. This function is called when control point
|
||||
* unregisters.
|
||||
*
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if successful else returns appropriate error
|
||||
***************************************************************************/
|
||||
|
||||
int genaUnregisterClient(IN UpnpClient_Handle client_handle)
|
||||
{
|
||||
ClientSubscription *sub_copy = UpnpClientSubscription_new();
|
||||
@ -460,22 +423,6 @@ exit_function:
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: genaUnSubscribe
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle client_handle: UPnP client handle
|
||||
* IN const UpnpString *in_sid: The subscription ID
|
||||
*
|
||||
* Description:
|
||||
* This function unsubscribes a SID. It first validates the SID and
|
||||
* client_handle,copies the subscription, sends UNSUBSCRIBE http request
|
||||
* to service processes request and finally removes the subscription
|
||||
*
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
int genaUnSubscribe(
|
||||
IN UpnpClient_Handle client_handle,
|
||||
@ -528,28 +475,6 @@ exit_function:
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: genaSubscribe
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle client_handle:
|
||||
* IN const UpnpString *PublisherURL: Of the form:
|
||||
* "http://134.134.156.80:4000/RedBulb/Event"
|
||||
* INOUT int * TimeOut: requested Duration, if -1, then "infinite".
|
||||
* in the OUT case: actual Duration granted
|
||||
* by Service, -1 for infinite
|
||||
* OUT UpnpString *out_sid: sid of subscription, memory passed in by caller
|
||||
*
|
||||
* Description:
|
||||
* This function subscribes to a PublisherURL ( also mentioned as EventURL
|
||||
* some places). It sends SUBSCRIBE http request to service processes
|
||||
* request. Finally adds a Subscription to
|
||||
* the clients subscription list, if service responds with OK
|
||||
*
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
int genaSubscribe(
|
||||
IN UpnpClient_Handle client_handle,
|
||||
@ -633,26 +558,6 @@ error_handler:
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : genaRenewSubscription
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle client_handle: Client handle
|
||||
* IN const UpnpString *in_sid: subscription ID
|
||||
* INOUT int * TimeOut: requested Duration, if -1, then "infinite".
|
||||
* in the OUT case: actual Duration granted
|
||||
* by Service, -1 for infinite
|
||||
*
|
||||
* Description:
|
||||
* This function renews a SID. It first validates the SID and
|
||||
* client_handle and copies the subscription. It sends RENEW
|
||||
* (modified SUBSCRIBE) http request to service and processes
|
||||
* the response.
|
||||
*
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
int genaRenewSubscription(
|
||||
IN UpnpClient_Handle client_handle,
|
||||
IN const UpnpString *in_sid,
|
||||
@ -751,24 +656,9 @@ exit_function:
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* 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(IN SOCKINFO *info, IN http_message_t *event)
|
||||
void gena_process_notification_event(
|
||||
IN SOCKINFO *info,
|
||||
IN http_message_t *event)
|
||||
{
|
||||
UpnpEvent *event_struct = UpnpEvent_new();
|
||||
IXML_Document *ChangedVars = NULL;
|
||||
@ -896,6 +786,7 @@ exit_function:
|
||||
UpnpEvent_delete(event_struct);
|
||||
}
|
||||
|
||||
#endif // INCLUDE_CLIENT_APIS
|
||||
#endif // EXCLUDE_GENA
|
||||
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
#endif /* EXCLUDE_GENA */
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,38 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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_H
|
||||
#define GENA_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
@ -45,10 +51,10 @@
|
||||
#include "miniserver.h"
|
||||
#include "service_table.h"
|
||||
#include "sock.h"
|
||||
#include "UpnpString.h"
|
||||
#include "ThreadPool.h"
|
||||
#include "uri.h"
|
||||
#include "upnp.h"
|
||||
#include "UpnpString.h"
|
||||
#include "uri.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -64,6 +70,7 @@
|
||||
#define XML_PROPERTYSET_HEADER \
|
||||
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">\n"
|
||||
|
||||
|
||||
#define UNABLE_MEMORY "HTTP/1.1 500 Internal Server Error\r\n\r\n"
|
||||
#define UNABLE_SERVICE_UNKNOWN "HTTP/1.1 404 Not Found\r\n\r\n"
|
||||
#define UNABLE_SERVICE_NOT_ACCEPT \
|
||||
@ -83,6 +90,7 @@
|
||||
#define MAX_EVENTS 20
|
||||
#define MAX_PORT_SIZE 10
|
||||
|
||||
|
||||
#define GENA_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
|
||||
#define GENA_E_BAD_SERVICE UPNP_E_INVALID_SERVICE
|
||||
#define GENA_E_SUBSCRIPTION_UNACCEPTED UPNP_E_SUBSCRIBE_UNACCEPTED
|
||||
@ -92,17 +100,22 @@
|
||||
#define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB -9
|
||||
#define GENA_E_BAD_HANDLE UPNP_E_INVALID_HANDLE
|
||||
|
||||
|
||||
#define XML_ERROR -5
|
||||
#define XML_SUCCESS UPNP_E_SUCCESS
|
||||
#define GENA_SUCCESS UPNP_E_SUCCESS
|
||||
|
||||
|
||||
#define CALLBACK_SUCCESS 0
|
||||
#define DEFAULT_TIMEOUT 1801
|
||||
|
||||
|
||||
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
||||
|
||||
// Lock the subscription
|
||||
|
||||
/*!
|
||||
* Lock the subscription
|
||||
*/
|
||||
#define SubscribeLock() \
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||
"Trying Subscribe Lock"); \
|
||||
@ -110,7 +123,10 @@ extern ithread_mutex_t GlobalClientSubscribeMutex;
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||
"Subscribe Lock");
|
||||
|
||||
// Unlock the subscription
|
||||
|
||||
/*!
|
||||
* Unlock the subscription
|
||||
*/
|
||||
#define SubscribeUnlock() \
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||
"Trying Subscribe UnLock"); \
|
||||
@ -119,7 +135,9 @@ extern ithread_mutex_t GlobalClientSubscribeMutex;
|
||||
"Subscribe UnLock");
|
||||
|
||||
|
||||
// Structure to send NOTIFY message to all subscribed control points
|
||||
/*!
|
||||
* Structure to send NOTIFY message to all subscribed control points
|
||||
*/
|
||||
typedef struct NOTIFY_THREAD_STRUCT {
|
||||
char *headers;
|
||||
DOMString propertySet;
|
||||
@ -132,279 +150,231 @@ typedef struct NOTIFY_THREAD_STRUCT {
|
||||
} notify_thread_struct;
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : genaCallback
|
||||
*
|
||||
* Parameters:
|
||||
* IN http_parser_t *parser: represents the parse state of the request
|
||||
* IN http_message_t* request: HTTP message containing GENA request
|
||||
* INOUT SOCKINFO *info: Structure containing information about the socket
|
||||
*
|
||||
* Description:
|
||||
* This is the callback function called by the miniserver to handle
|
||||
/*!
|
||||
* \brief This is the callback function called by the miniserver to handle
|
||||
* incoming GENA requests.
|
||||
*
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
* \Return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
|
||||
*/
|
||||
EXTERN_C void genaCallback(
|
||||
/*! [in] represents the parse state of the request */
|
||||
IN http_parser_t *parser,
|
||||
IN http_message_t* request,
|
||||
/*! [in] HTTP message containing GENA request */
|
||||
IN http_message_t* request,
|
||||
/*! [in,out] Structure containing information about the socket */
|
||||
IN SOCKINFO *info);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: genaSubscribe
|
||||
/*!
|
||||
* \brief This function subscribes to a PublisherURL (also mentioned as EventURL
|
||||
* in some places).
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle client_handle:
|
||||
* IN const UpnpString *PublisherURL: Of the form:
|
||||
* "http://134.134.156.80:4000/RedBulb/Event"
|
||||
* INOUT int * TimeOut: requested Duration, if -1, then "infinite".
|
||||
* in the OUT case: actual Duration granted
|
||||
* by Service, -1 for infinite
|
||||
* OUT UpnpString *out_sid: sid of subscription, memory passed in by caller
|
||||
* It sends SUBSCRIBE http request to service processes request. Finally adds a
|
||||
* Subscription to the clients subscription list, if service responds with OK.
|
||||
*
|
||||
* Description:
|
||||
* This function subscribes to a PublisherURL ( also mentioned as EventURL
|
||||
* some places). It sends SUBSCRIBE http request to service processes
|
||||
* request. Finally adds a Subscription to
|
||||
* the clients subscription list, if service responds with OK
|
||||
*
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
* \return UPNP_E_SUCCESS if service response is OK, otherwise returns the
|
||||
* appropriate error code
|
||||
*/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
EXTERN_C int genaSubscribe(
|
||||
/*! [in] The client handle. */
|
||||
IN UpnpClient_Handle client_handle,
|
||||
/*! [in] Of the form: "http://134.134.156.80:4000/RedBulb/Event */
|
||||
IN const UpnpString *PublisherURL,
|
||||
/*! [in,out] requested Duration:
|
||||
* \li if -1, then "infinite".
|
||||
* \li in the OUT case: actual Duration granted by Service,
|
||||
* -1 for infinite. */
|
||||
INOUT int *TimeOut,
|
||||
/*! [out] sid of subscription, memory passed in by caller. */
|
||||
OUT UpnpString *out_sid);
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: genaUnSubscribe
|
||||
/*!
|
||||
* \brief Unsubscribes a SID.
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle client_handle: UPnP client handle
|
||||
* IN const UpnpString *in_sid: The subscription ID
|
||||
* It first validates the SID and client_handle,copies the subscription, sends
|
||||
* UNSUBSCRIBE http request to service processes request and finally removes
|
||||
* the subscription.
|
||||
*
|
||||
* Description:
|
||||
* This function unsubscribes a SID. It first validates the SID and
|
||||
* client_handle,copies the subscription, sends UNSUBSCRIBE http request
|
||||
* to service processes request and finally removes the subscription
|
||||
*
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
* \return UPNP_E_SUCCESS if service response is OK, otherwise returns the
|
||||
* appropriate error code.
|
||||
*/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
EXTERN_C int genaUnSubscribe(
|
||||
/*! [in] UPnP client handle. */
|
||||
IN UpnpClient_Handle client_handle,
|
||||
/*! [in] The subscription ID. */
|
||||
IN const UpnpString *in_sid);
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
/************************************************************************
|
||||
* Function : genaUnregisterClient
|
||||
|
||||
/*!
|
||||
* \brief Unsubcribes all the outstanding subscriptions and cleans the
|
||||
* subscription list.
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle client_handle: Handle containing all the control
|
||||
* point related information
|
||||
* This function is called when control point unregisters.
|
||||
*
|
||||
* Description:
|
||||
* This function unsubcribes all the outstanding subscriptions and cleans
|
||||
* the subscription list. This function is called when control point
|
||||
* unregisters.
|
||||
*
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if successful else returns appropriate error
|
||||
***************************************************************************/
|
||||
* \returns UPNP_E_SUCCESS if successful, otherwise returns the appropriate
|
||||
* error code.
|
||||
*/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
EXTERN_C int genaUnregisterClient(UpnpClient_Handle client_handle);
|
||||
EXTERN_C int genaUnregisterClient(
|
||||
/*! [in] Handle containing all the control point related information. */
|
||||
UpnpClient_Handle client_handle);
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
//server
|
||||
/************************************************************************
|
||||
* Function : genaUnregisterDevice
|
||||
|
||||
/*
|
||||
* DEVICE
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Cleans the service table of the device.
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpDevice_Handle device_handle: Handle of the root device
|
||||
*
|
||||
* Description:
|
||||
* This function cleans the service table of the device.
|
||||
*
|
||||
* Returns: int
|
||||
* returns UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE
|
||||
****************************************************************************/
|
||||
* \return UPNP_E_SUCCESS if successful, otherwise returns GENA_E_BAD_HANDLE
|
||||
*/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaUnregisterDevice(UpnpDevice_Handle device_handle);
|
||||
EXTERN_C int genaUnregisterDevice(
|
||||
/*! [in] Handle of the root device */
|
||||
UpnpDevice_Handle device_handle);
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : genaRenewSubscription
|
||||
/*!
|
||||
* \brief Renews a SID.
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle client_handle: Client handle
|
||||
* IN const UpnpString *in_sid: subscription ID
|
||||
* INOUT int * TimeOut:
|
||||
* requested Duration, if -1, then "infinite".
|
||||
* in the OUT case: actual Duration granted by Service, -1 for infinite
|
||||
* It first validates the SID and client_handle and copies the subscription.
|
||||
* It sends RENEW (modified SUBSCRIBE) http request to service and processes
|
||||
* the response.
|
||||
*
|
||||
* Description:
|
||||
* This function renews a SID. It first validates the SID and
|
||||
* client_handle and copies the subscription. It sends RENEW
|
||||
* (modified SUBSCRIBE) http request to service and processes
|
||||
* the response.
|
||||
*
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
* \return UPNP_E_SUCCESS if service response is OK, otherwise the
|
||||
* appropriate error code.
|
||||
*/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
EXTERN_C int genaRenewSubscription(
|
||||
/*! [in] Client handle. */
|
||||
IN UpnpClient_Handle client_handle,
|
||||
/*! [in] Subscription ID. */
|
||||
IN const UpnpString *in_sid,
|
||||
/*! [out] requested Duration, if -1, then "infinite". In the OUT case:
|
||||
* actual Duration granted by Service, -1 for infinite. */
|
||||
OUT int * TimeOut);
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
/****************************************************************************
|
||||
* Function: genaNotifyAll
|
||||
|
||||
/*!
|
||||
* \brief Sends a notification to all the subscribed control points.
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpDevice_Handle device_handle: Device handle
|
||||
* IN char *UDN: Device udn
|
||||
* IN char *servId: Service ID
|
||||
* IN char **VarNames: array of varible names
|
||||
* IN char **VarValues: array of variable values
|
||||
* IN int var_count: number of variables
|
||||
* \return int
|
||||
*
|
||||
* Description: This function sends a notification to all the subscribed
|
||||
* control points
|
||||
*
|
||||
* Return: int
|
||||
*
|
||||
* Note: This function is similar to the genaNotifyAllExt. The only difference
|
||||
* \note This function is similar to the genaNotifyAllExt. The only difference
|
||||
* is it takes event variable array instead of xml document.
|
||||
****************************************************************************/
|
||||
*/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaNotifyAll(
|
||||
/*! [in] Device handle. */
|
||||
UpnpDevice_Handle device_handle,
|
||||
/*! [in] Device udn. */
|
||||
char *UDN,
|
||||
/*! [in] Service ID. */
|
||||
char *servId,
|
||||
/*! [in] Array of varible names. */
|
||||
char **VarNames,
|
||||
/*! [in] Array of variable values. */
|
||||
char **VarValues,
|
||||
/*! [in] Number of variables. */
|
||||
int var_count);
|
||||
#endif /* INCLUDE_DEVICE_APIS */
|
||||
|
||||
/****************************************************************************
|
||||
* Function: genaNotifyAllExt
|
||||
|
||||
/*!
|
||||
* \brief Sends a notification to all the subscribed control points.
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpDevice_Handle device_handle: Device handle
|
||||
* IN char *UDN: Device udn
|
||||
* IN char *servId: Service ID
|
||||
* IN IXML_Document *PropSet: XML document Event varible property set
|
||||
* \return int
|
||||
*
|
||||
* Description : This function sends a notification to all the subscribed
|
||||
* control points
|
||||
*
|
||||
* Return: int
|
||||
*
|
||||
* Note: This function is similar to the genaNotifyAll. the only difference
|
||||
* is it takes the document instead of event variable array
|
||||
****************************************************************************/
|
||||
* \note This function is similar to the genaNotifyAll. the only difference
|
||||
* is it takes the document instead of event variable array.
|
||||
*/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaNotifyAllExt(
|
||||
/*! [in] Device handle. */
|
||||
UpnpDevice_Handle device_handle,
|
||||
/*! [in] Device udn. */
|
||||
char *UDN,
|
||||
/*! [in] Service ID. */
|
||||
char *servId,
|
||||
/*! [in] XML document Event varible property set. */
|
||||
IN IXML_Document *PropSet);
|
||||
#endif /* INCLUDE_DEVICE_APIS */
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: genaInitNotify
|
||||
/*!
|
||||
* \brief Sends the intial state table dump to newly subscribed control point.
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpDevice_Handle device_handle: Device handle
|
||||
* IN char *UDN: Device udn
|
||||
* IN char *servId: Service ID
|
||||
* IN char **VarNames: Array of variable names
|
||||
* IN char **VarValues: Array of variable values
|
||||
* IN int var_count: array size
|
||||
* IN Upnp_SID sid: subscription ID
|
||||
*
|
||||
* Description: This function sends the intial state table dump to
|
||||
* newly subscribed control point.
|
||||
*
|
||||
* Return: int
|
||||
* returns GENA_E_SUCCESS if successful else returns appropriate error
|
||||
* \return GENA_E_SUCCESS if successful, otherwise the appropriate error code.
|
||||
*
|
||||
* Note: No other event will be sent to this control point before the
|
||||
* \note No other event will be sent to this control point before the
|
||||
* intial state table dump.
|
||||
****************************************************************************/
|
||||
*/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
||||
EXTERN_C int genaInitNotify(
|
||||
/*! [in] Device handle. */
|
||||
IN UpnpDevice_Handle device_handle,
|
||||
/*! [in] Device udn. */
|
||||
IN char *UDN,
|
||||
/*! [in] Service ID. */
|
||||
IN char *servId,
|
||||
/*! [in] Array of variable names. */
|
||||
IN char **VarNames,
|
||||
/*! [in] Array of variable values. */
|
||||
IN char **VarValues,
|
||||
/*! [in] Array size. */
|
||||
IN int var_count,
|
||||
/*! [in] Subscription ID. */
|
||||
IN const Upnp_SID sid);
|
||||
#endif /* INCLUDE_DEVICE_APIS */
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: genaInitNotifyExt
|
||||
/*!
|
||||
* \brief Similar to the genaInitNofity. The only difference is that it
|
||||
* takes the xml document for the state table and sends the intial state
|
||||
* table dump to newly subscribed control point.
|
||||
*
|
||||
* Parameters :
|
||||
* IN UpnpDevice_Handle device_handle: Device handle
|
||||
* IN char *UDN: Device udn
|
||||
* IN char *servId: Service ID
|
||||
* IN IXML_Document *PropSet: Document of the state table
|
||||
* IN Upnp_SID sid: subscription ID
|
||||
*
|
||||
* Description:
|
||||
* This function is similar to the genaInitNofity. The only
|
||||
* difference is that it takes the xml document for the state table and
|
||||
* sends the intial state table dump to newly subscribed control point.
|
||||
*
|
||||
* Return: int
|
||||
* returns GENA_E_SUCCESS if successful else returns appropriate error
|
||||
* \return GENA_E_SUCCESS if successful, otherwise the appropriate error code.
|
||||
*
|
||||
* Note: No other event will be sent to this control point before the
|
||||
* \note No other event will be sent to this control point before the
|
||||
* intial state table dump.
|
||||
****************************************************************************/
|
||||
*/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaInitNotifyExt(
|
||||
/*! [in] Device handle. */
|
||||
IN UpnpDevice_Handle device_handle,
|
||||
/*! [in] Device udn. */
|
||||
IN char *UDN,
|
||||
/*! [in] Service ID. */
|
||||
IN char *servId,
|
||||
/*! [in] Document of the state table. */
|
||||
IN IXML_Document *PropSet,
|
||||
/*! [in] subscription ID. */
|
||||
IN const Upnp_SID sid);
|
||||
#endif /* INCLUDE_DEVICE_APIS */
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : error_respond
|
||||
/*!
|
||||
* \brief Sends an error message to the control point in the case of incorrect
|
||||
* GENA requests.
|
||||
*
|
||||
* Parameters:
|
||||
* IN SOCKINFO *info: Structure containing information about the socket
|
||||
* IN int error_code: error code that will be in the GENA response
|
||||
* IN http_message_t* hmsg: GENA request Packet
|
||||
*
|
||||
* Description:
|
||||
* This function send an error message to the control point in the case
|
||||
* incorrect GENA requests.
|
||||
*
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
* \return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
|
||||
*/
|
||||
void error_respond(
|
||||
/*! [in] Structure containing information about the socket. */
|
||||
IN SOCKINFO *info,
|
||||
/*! [in] error code that will be in the GENA response. */
|
||||
IN int error_code,
|
||||
/*! [in] GENA request Packet. */
|
||||
IN http_message_t* hmsg);
|
||||
|
||||
|
||||
|
@ -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. */
|
||||
IN SOCKINFO *info,
|
||||
/*! [in] The http message contains the GENA notification. */
|
||||
IN http_message_t *event);
|
||||
|
||||
|
||||
#endif /* GENA_CTRLPT_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. */
|
||||
IN SOCKINFO *info,
|
||||
/*! [in] Subscription request from the control point. */
|
||||
IN 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. */
|
||||
IN SOCKINFO *info,
|
||||
/*! [in] Subscription renewal request from the control point. */
|
||||
IN 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. */
|
||||
IN SOCKINFO *info,
|
||||
/*! [in] UNSUBSCRIBE request from the control point. */
|
||||
IN http_message_t *request);
|
||||
|
||||
|
||||
#endif /* GENA_DEVICE_H */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user