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:
Marcelo Roberto Jimenez 2008-05-26 00:10:49 +00:00
parent 724700be0d
commit 494518b14b
7 changed files with 1208 additions and 1422 deletions

View File

@ -29,6 +29,7 @@
* *
******************************************************************************/ ******************************************************************************/
#ifndef UPNP_H #ifndef UPNP_H
#define UPNP_H #define UPNP_H

View File

@ -1,4 +1,4 @@
/************************************************************************** /*******************************************************************************
* *
* Copyright (c) 2000-2003 Intel Corporation * Copyright (c) 2000-2003 Intel Corporation
* All rights reserved. * All rights reserved.
@ -27,7 +27,7 @@
* 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.
* *
**************************************************************************/ ******************************************************************************/
#include "config.h" #include "config.h"
@ -2206,52 +2206,69 @@ int UpnpAcceptSubscription(
int cVariables, int cVariables,
IN const Upnp_SID SubsId) IN const Upnp_SID SubsId)
{ {
struct Handle_Info *SInfo = NULL; int ret = 0;
int retVal; int line = 0;
char *DevID = ( char * )DevID_const; struct Handle_Info *SInfo = NULL;
char *ServName = ( char * )ServName_const; char *DevID = (char *)DevID_const;
char **VarName = ( char ** )VarName_const; char *ServName = (char *)ServName_const;
char **NewVal = ( char ** )NewVal_const; char **VarName = (char **)VarName_const;
char **NewVal = (char **)NewVal_const;
if( UpnpSdkInit != 1 ) { UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
return UPNP_E_FINISH; "Inside UpnpAcceptSubscription\n");
}
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, if (UpnpSdkInit != 1) {
"Inside UpnpAcceptSubscription \n" ); line = __LINE__;
ret = UPNP_E_FINISH;
goto ExitFunction;
}
HandleReadLock(); 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;
}
HandleUnlock(); if (GetHandleInfo(Hnd, &SInfo) != HND_DEVICE) {
retVal = HandleUnlock();
genaInitNotify( Hnd, DevID, ServName, VarName, NewVal, cVariables, line = __LINE__;
SubsId ); 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__, HandleUnlock();
"Exiting UpnpAcceptSubscription \n" );
return retVal; 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 * Function: UpnpAcceptSubscriptionExt
@ -2277,57 +2294,73 @@ int UpnpAcceptSubscription(
* Return Values: int * Return Values: int
* UPNP_E_SUCCESS if successful else sends appropriate error. * UPNP_E_SUCCESS if successful else sends appropriate error.
***************************************************************************/ ***************************************************************************/
int int UpnpAcceptSubscriptionExt(
UpnpAcceptSubscriptionExt( IN UpnpDevice_Handle Hnd, IN UpnpDevice_Handle Hnd,
IN const char *DevID_const, IN const char *DevID_const,
IN const char *ServName_const, IN const char *ServName_const,
IN IXML_Document * PropSet, IN IXML_Document *PropSet,
IN Upnp_SID SubsId ) IN Upnp_SID SubsId)
{ {
struct Handle_Info *SInfo = NULL; int ret = 0;
int retVal; int line = 0;
char *DevID = ( char * )DevID_const; struct Handle_Info *SInfo = NULL;
char *ServName = ( char * )ServName_const; char *DevID = (char *)DevID_const;
char *ServName = (char *)ServName_const;
if( UpnpSdkInit != 1 ) { UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
return UPNP_E_FINISH; "Inside UpnpAcceptSubscription\n");
}
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, if (UpnpSdkInit != 1) {
"Inside UpnpAcceptSubscription \n" ); line = __LINE__;
ret = UPNP_E_FINISH;
goto ExitFunction;
}
HandleReadLock(); 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( PropSet == NULL ) { if (GetHandleInfo(Hnd, &SInfo) != HND_DEVICE) {
HandleUnlock(); HandleUnlock();
return UPNP_E_INVALID_PARAM; 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(); if (PropSet == NULL) {
retVal = genaInitNotifyExt( Hnd, DevID, ServName, PropSet, SubsId ); HandleUnlock();
line = __LINE__;
ret = UPNP_E_INVALID_PARAM;
goto ExitFunction;
}
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__, HandleUnlock();
"Exiting UpnpAcceptSubscription \n" );
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 // INCLUDE_DEVICE_APIS
#endif // EXCLUDE_GENA == 0 #endif // EXCLUDE_GENA == 0

View File

@ -1,33 +1,33 @@
/////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// 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.
// *
/////////////////////////////////////////////////////////////////////////// ******************************************************************************/
#include "config.h" #include "config.h"
@ -47,23 +47,17 @@
#include "uuid.h" #include "uuid.h"
#include "upnpapi.h" #include "upnpapi.h"
extern ithread_mutex_t GlobalClientSubscribeMutex; extern ithread_mutex_t GlobalClientSubscribeMutex;
/************************************************************************
* Function : GenaAutoRenewSubscription /*!
* * \brief This is a thread function to send the renewal just before the
* Parameters: * subscription times out.
* IN void *input: Thread data(upnp_timeout *) needed to send the renewal */
* static void GenaAutoRenewSubscription(
* Description: /*! [in] Thread data(upnp_timeout *) needed to send the renewal. */
* This is a thread function to send the renewal just before the IN void *input)
* subscription times out.
*
* Returns: VOID
*
***************************************************************************/
static void
GenaAutoRenewSubscription( IN void *input )
{ {
upnp_timeout *event = (upnp_timeout *) input; upnp_timeout *event = (upnp_timeout *) input;
UpnpEventSubscribe *sub_struct = (UpnpEventSubscribe *)event->Event; 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: * \return GENA_E_SUCCESS if successful, otherwise returns the appropriate
* IN int client_handle: Handle that also contains the subscription list * error code.
* 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
***************************************************************************/
static int ScheduleGenaAutoRenew( static int ScheduleGenaAutoRenew(
/*! [in] Handle that also contains the subscription list. */
IN int client_handle, IN int client_handle,
/*! [in] The time out value of the subscription. */
IN int TimeOut, IN int TimeOut,
/*! [in] Subscription being renewed. */
IN ClientSubscription *sub) IN ClientSubscription *sub)
{ {
UpnpEventSubscribe *RenewEventStruct = NULL; UpnpEventSubscribe *RenewEventStruct = NULL;
@ -190,24 +178,19 @@ static int ScheduleGenaAutoRenew(
return GENA_SUCCESS; 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: * \returns 0 if successful, otherwise returns the appropriate error code.
* 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
***************************************************************************/
static int gena_unsubscribe( static int gena_unsubscribe(
/*! [in] Event URL of the service. */
IN const UpnpString *url, IN const UpnpString *url,
/*! [in] The subcription ID. */
IN const UpnpString *sid, IN const UpnpString *sid,
/*! [out] The UNSUBCRIBE response from the device. */
OUT http_parser_t *response ) OUT http_parser_t *response )
{ {
int return_code; int return_code;
@ -256,27 +239,21 @@ static int gena_unsubscribe(
return return_code; return return_code;
} }
/************************************************************************
* Function: gena_subscribe /*!
* \brief Subscribes or renew subscription.
* *
* Parameters: * \return 0 if successful, otherwise returns the appropriate error code.
* 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
***************************************************************************/
static int gena_subscribe( static int gena_subscribe(
/*! [in] URL of service to subscribe. */
IN const UpnpString *url, IN const UpnpString *url,
/*! [in,out] Subscription time desired (in secs). */
INOUT int *timeout, 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, IN const UpnpString *renewal_sid,
/*! [out] SID returned by the subscription or renew msg. */
OUT UpnpString *sid) OUT UpnpString *sid)
{ {
int return_code; int return_code;
@ -400,21 +377,7 @@ static int gena_subscribe(
return UPNP_E_SUCCESS; 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) int genaUnregisterClient(IN UpnpClient_Handle client_handle)
{ {
ClientSubscription *sub_copy = UpnpClientSubscription_new(); 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 #ifdef INCLUDE_CLIENT_APIS
int genaUnSubscribe( int genaUnSubscribe(
IN UpnpClient_Handle client_handle, IN UpnpClient_Handle client_handle,
@ -528,28 +475,6 @@ exit_function:
#endif /* INCLUDE_CLIENT_APIS */ #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 #ifdef INCLUDE_CLIENT_APIS
int genaSubscribe( int genaSubscribe(
IN UpnpClient_Handle client_handle, IN UpnpClient_Handle client_handle,
@ -633,26 +558,6 @@ error_handler:
#endif /* INCLUDE_CLIENT_APIS */ #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( int genaRenewSubscription(
IN UpnpClient_Handle client_handle, IN UpnpClient_Handle client_handle,
IN const UpnpString *in_sid, IN const UpnpString *in_sid,
@ -751,24 +656,9 @@ exit_function:
} }
/************************************************************************ void gena_process_notification_event(
* Function: gena_process_notification_event IN SOCKINFO *info,
* IN http_message_t *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)
{ {
UpnpEvent *event_struct = UpnpEvent_new(); UpnpEvent *event_struct = UpnpEvent_new();
IXML_Document *ChangedVars = NULL; IXML_Document *ChangedVars = NULL;
@ -896,6 +786,7 @@ exit_function:
UpnpEvent_delete(event_struct); 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

View File

@ -1,38 +1,44 @@
/////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// 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_H #ifndef GENA_H
#define GENA_H #define GENA_H
/*!
* \file
*/
#include "config.h" #include "config.h"
@ -45,10 +51,10 @@
#include "miniserver.h" #include "miniserver.h"
#include "service_table.h" #include "service_table.h"
#include "sock.h" #include "sock.h"
#include "UpnpString.h"
#include "ThreadPool.h" #include "ThreadPool.h"
#include "uri.h"
#include "upnp.h" #include "upnp.h"
#include "UpnpString.h"
#include "uri.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -64,6 +70,7 @@
#define XML_PROPERTYSET_HEADER \ #define XML_PROPERTYSET_HEADER \
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">\n" "<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_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_UNKNOWN "HTTP/1.1 404 Not Found\r\n\r\n"
#define UNABLE_SERVICE_NOT_ACCEPT \ #define UNABLE_SERVICE_NOT_ACCEPT \
@ -83,6 +90,7 @@
#define MAX_EVENTS 20 #define MAX_EVENTS 20
#define MAX_PORT_SIZE 10 #define MAX_PORT_SIZE 10
#define GENA_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE #define GENA_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
#define GENA_E_BAD_SERVICE UPNP_E_INVALID_SERVICE #define GENA_E_BAD_SERVICE UPNP_E_INVALID_SERVICE
#define GENA_E_SUBSCRIPTION_UNACCEPTED UPNP_E_SUBSCRIBE_UNACCEPTED #define GENA_E_SUBSCRIPTION_UNACCEPTED UPNP_E_SUBSCRIBE_UNACCEPTED
@ -92,17 +100,22 @@
#define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB -9 #define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB -9
#define GENA_E_BAD_HANDLE UPNP_E_INVALID_HANDLE #define GENA_E_BAD_HANDLE UPNP_E_INVALID_HANDLE
#define XML_ERROR -5 #define XML_ERROR -5
#define XML_SUCCESS UPNP_E_SUCCESS #define XML_SUCCESS UPNP_E_SUCCESS
#define GENA_SUCCESS UPNP_E_SUCCESS #define GENA_SUCCESS UPNP_E_SUCCESS
#define CALLBACK_SUCCESS 0 #define CALLBACK_SUCCESS 0
#define DEFAULT_TIMEOUT 1801 #define DEFAULT_TIMEOUT 1801
extern ithread_mutex_t GlobalClientSubscribeMutex; extern ithread_mutex_t GlobalClientSubscribeMutex;
// Lock the subscription
/*!
* Lock the subscription
*/
#define SubscribeLock() \ #define SubscribeLock() \
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \ UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
"Trying Subscribe Lock"); \ "Trying Subscribe Lock"); \
@ -110,7 +123,10 @@ extern ithread_mutex_t GlobalClientSubscribeMutex;
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \ UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
"Subscribe Lock"); "Subscribe Lock");
// Unlock the subscription
/*!
* Unlock the subscription
*/
#define SubscribeUnlock() \ #define SubscribeUnlock() \
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \ UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
"Trying Subscribe UnLock"); \ "Trying Subscribe UnLock"); \
@ -119,7 +135,9 @@ extern ithread_mutex_t GlobalClientSubscribeMutex;
"Subscribe UnLock"); "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 { typedef struct NOTIFY_THREAD_STRUCT {
char *headers; char *headers;
DOMString propertySet; DOMString propertySet;
@ -132,279 +150,231 @@ typedef struct NOTIFY_THREAD_STRUCT {
} notify_thread_struct; } notify_thread_struct;
/************************************************************************ /*!
* Function : genaCallback * \brief This is the callback function called by the miniserver to handle
*
* 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
* incoming GENA requests. * incoming GENA requests.
* *
* Returns: int * \Return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
* UPNP_E_SUCCESS if successful else appropriate error */
***************************************************************************/
EXTERN_C void genaCallback( EXTERN_C void genaCallback(
/*! [in] represents the parse state of the request */
IN http_parser_t *parser, 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); IN SOCKINFO *info);
/************************************************************************ /*!
* Function: genaSubscribe * \brief This function subscribes to a PublisherURL (also mentioned as EventURL
* in some places).
* *
* Parameters: * It sends SUBSCRIBE http request to service processes request. Finally adds a
* IN UpnpClient_Handle client_handle: * Subscription to the clients subscription list, if service responds with OK.
* 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: * \return UPNP_E_SUCCESS if service response is OK, otherwise returns the
* This function subscribes to a PublisherURL ( also mentioned as EventURL * appropriate error code
* 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 #ifdef INCLUDE_CLIENT_APIS
EXTERN_C int genaSubscribe( EXTERN_C int genaSubscribe(
/*! [in] The client handle. */
IN UpnpClient_Handle client_handle, IN UpnpClient_Handle client_handle,
/*! [in] Of the form: "http://134.134.156.80:4000/RedBulb/Event */
IN const UpnpString *PublisherURL, 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, INOUT int *TimeOut,
/*! [out] sid of subscription, memory passed in by caller. */
OUT UpnpString *out_sid); OUT UpnpString *out_sid);
#endif /* INCLUDE_CLIENT_APIS */ #endif /* INCLUDE_CLIENT_APIS */
/************************************************************************ /*!
* Function: genaUnSubscribe * \brief Unsubscribes a SID.
* *
* Parameters: * It first validates the SID and client_handle,copies the subscription, sends
* IN UpnpClient_Handle client_handle: UPnP client handle * UNSUBSCRIBE http request to service processes request and finally removes
* IN const UpnpString *in_sid: The subscription ID * the subscription.
* *
* Description: * \return UPNP_E_SUCCESS if service response is OK, otherwise returns the
* This function unsubscribes a SID. It first validates the SID and * appropriate error code.
* 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 #ifdef INCLUDE_CLIENT_APIS
EXTERN_C int genaUnSubscribe( EXTERN_C int genaUnSubscribe(
/*! [in] UPnP client handle. */
IN UpnpClient_Handle client_handle, IN UpnpClient_Handle client_handle,
/*! [in] The subscription ID. */
IN const UpnpString *in_sid); IN const UpnpString *in_sid);
#endif /* INCLUDE_CLIENT_APIS */ #endif /* INCLUDE_CLIENT_APIS */
/************************************************************************
* Function : genaUnregisterClient /*!
* \brief Unsubcribes all the outstanding subscriptions and cleans the
* subscription list.
* *
* Parameters: * This function is called when control point unregisters.
* IN UpnpClient_Handle client_handle: Handle containing all the control
* point related information
* *
* Description: * \returns UPNP_E_SUCCESS if successful, otherwise returns the appropriate
* This function unsubcribes all the outstanding subscriptions and cleans * error code.
* the subscription list. This function is called when control point */
* unregisters.
*
* Returns: int
* return UPNP_E_SUCCESS if successful else returns appropriate error
***************************************************************************/
#ifdef INCLUDE_CLIENT_APIS #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 */ #endif /* INCLUDE_CLIENT_APIS */
//server
/************************************************************************ /*
* Function : genaUnregisterDevice * DEVICE
*/
/*!
* \brief Cleans the service table of the device.
* *
* Parameters: * \return UPNP_E_SUCCESS if successful, otherwise returns GENA_E_BAD_HANDLE
* 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
****************************************************************************/
#ifdef INCLUDE_DEVICE_APIS #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 */ #endif /* INCLUDE_CLIENT_APIS */
/************************************************************************ /*!
* Function : genaRenewSubscription * \brief Renews a SID.
* *
* Parameters: * It first validates the SID and client_handle and copies the subscription.
* IN UpnpClient_Handle client_handle: Client handle * It sends RENEW (modified SUBSCRIBE) http request to service and processes
* IN const UpnpString *in_sid: subscription ID * the response.
* INOUT int * TimeOut:
* requested Duration, if -1, then "infinite".
* in the OUT case: actual Duration granted by Service, -1 for infinite
* *
* Description: * \return UPNP_E_SUCCESS if service response is OK, otherwise the
* This function renews a SID. It first validates the SID and * appropriate error code.
* 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
***************************************************************************/
#ifdef INCLUDE_CLIENT_APIS #ifdef INCLUDE_CLIENT_APIS
EXTERN_C int genaRenewSubscription( EXTERN_C int genaRenewSubscription(
/*! [in] Client handle. */
IN UpnpClient_Handle client_handle, IN UpnpClient_Handle client_handle,
/*! [in] Subscription ID. */
IN const UpnpString *in_sid, 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); OUT int * TimeOut);
#endif /* INCLUDE_CLIENT_APIS */ #endif /* INCLUDE_CLIENT_APIS */
/****************************************************************************
* Function: genaNotifyAll /*!
* \brief Sends a notification to all the subscribed control points.
* *
* Parameters: * \return int
* 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
* *
* Description: This function sends a notification to all the subscribed * \note This function is similar to the genaNotifyAllExt. The only difference
* control points
*
* Return: int
*
* Note: This function is similar to the genaNotifyAllExt. The only difference
* is it takes event variable array instead of xml document. * is it takes event variable array instead of xml document.
****************************************************************************/ */
#ifdef INCLUDE_DEVICE_APIS #ifdef INCLUDE_DEVICE_APIS
EXTERN_C int genaNotifyAll( EXTERN_C int genaNotifyAll(
/*! [in] Device handle. */
UpnpDevice_Handle device_handle, UpnpDevice_Handle device_handle,
/*! [in] Device udn. */
char *UDN, char *UDN,
/*! [in] Service ID. */
char *servId, char *servId,
/*! [in] Array of varible names. */
char **VarNames, char **VarNames,
/*! [in] Array of variable values. */
char **VarValues, char **VarValues,
/*! [in] Number of variables. */
int var_count); int var_count);
#endif /* INCLUDE_DEVICE_APIS */ #endif /* INCLUDE_DEVICE_APIS */
/****************************************************************************
* Function: genaNotifyAllExt /*!
* \brief Sends a notification to all the subscribed control points.
* *
* Parameters: * \return int
* 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
* *
* Description : This function sends a notification to all the subscribed * \note This function is similar to the genaNotifyAll. the only difference
* control points * is it takes the document instead of event variable array.
* */
* Return: int
*
* 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 #ifdef INCLUDE_DEVICE_APIS
EXTERN_C int genaNotifyAllExt( EXTERN_C int genaNotifyAllExt(
/*! [in] Device handle. */
UpnpDevice_Handle device_handle, UpnpDevice_Handle device_handle,
/*! [in] Device udn. */
char *UDN, char *UDN,
/*! [in] Service ID. */
char *servId, char *servId,
/*! [in] XML document Event varible property set. */
IN IXML_Document *PropSet); IN IXML_Document *PropSet);
#endif /* INCLUDE_DEVICE_APIS */ #endif /* INCLUDE_DEVICE_APIS */
/**************************************************************************** /*!
* Function: genaInitNotify * \brief Sends the intial state table dump to newly subscribed control point.
* *
* Parameters: * \return GENA_E_SUCCESS if successful, otherwise the appropriate error code.
* 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
* *
* 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. * intial state table dump.
****************************************************************************/ */
#ifdef INCLUDE_DEVICE_APIS #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 char *UDN,
/*! [in] Service ID. */
IN char *servId, IN char *servId,
/*! [in] Array of variable names. */
IN char **VarNames, IN char **VarNames,
/*! [in] Array of variable values. */
IN char **VarValues, IN char **VarValues,
/*! [in] Array size. */
IN int var_count, IN int var_count,
/*! [in] Subscription ID. */
IN const Upnp_SID sid); IN const Upnp_SID sid);
#endif /* INCLUDE_DEVICE_APIS */ #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 : * \return GENA_E_SUCCESS if successful, otherwise the appropriate error code.
* 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
* *
* 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. * intial state table dump.
****************************************************************************/ */
#ifdef INCLUDE_DEVICE_APIS #ifdef INCLUDE_DEVICE_APIS
EXTERN_C int genaInitNotifyExt( EXTERN_C int genaInitNotifyExt(
/*! [in] Device handle. */
IN UpnpDevice_Handle device_handle, IN UpnpDevice_Handle device_handle,
/*! [in] Device udn. */
IN char *UDN, IN char *UDN,
/*! [in] Service ID. */
IN char *servId, IN char *servId,
/*! [in] Document of the state table. */
IN IXML_Document *PropSet, IN IXML_Document *PropSet,
/*! [in] subscription ID. */
IN const Upnp_SID sid); IN const Upnp_SID sid);
#endif /* INCLUDE_DEVICE_APIS */ #endif /* INCLUDE_DEVICE_APIS */
/************************************************************************ /*!
* Function : error_respond * \brief Sends an error message to the control point in the case of incorrect
* GENA requests.
* *
* Parameters: * \return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
* 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
***************************************************************************/
void error_respond( void error_respond(
/*! [in] Structure containing information about the socket. */
IN SOCKINFO *info, IN SOCKINFO *info,
/*! [in] error code that will be in the GENA response. */
IN int error_code, IN int error_code,
/*! [in] GENA request Packet. */
IN http_message_t* hmsg); IN http_message_t* hmsg);

View File

@ -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. */
* IN SOCKINFO *info,
* Note : called by genacallback() /*! [in] The http message contains the GENA notification. */
****************************************************************************/ IN http_message_t *event);
void gena_process_notification_event( INOUT SOCKINFO *info,
IN http_message_t* request );
#endif /* GENA_CTRLPT_H */

View File

@ -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. */
* IN 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. IN 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 IN SOCKINFO *info,
* /*! [in] Subscription renewal request from the control point. */
* Description : This function handles a subscription renewal request IN 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 IN SOCKINFO *info,
* /*! [in] UNSUBSCRIBE request from the control point. */
* Description : This function Handles a subscription cancellation request IN 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 );