Doxygen and include file reorganization.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@430 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2008-06-09 23:19:00 +00:00
parent b78f27dd3e
commit f00752efbd
20 changed files with 369 additions and 451 deletions

View File

@ -4,7 +4,7 @@
#define IXMLDEBUG_H #define IXMLDEBUG_H
#include "ixml.h" #include "UpnpGlobal.h"
/*! /*!

View File

@ -39,6 +39,7 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> /* for free() */
#include <string.h> #include <string.h>

View File

@ -42,7 +42,7 @@
#include "ixml.h" #include "ixml.h"
#include <stdlib.h> #include <stdlib.h> /* for size_t */
#define MINVAL(a, b) ( (a) < (b) ? (a) : (b) ) #define MINVAL(a, b) ( (a) < (b) ? (a) : (b) )

View File

@ -40,6 +40,7 @@
#include "ixmlparser.h" #include "ixmlparser.h"
#include <stdlib.h> /* for free() */
#include <string.h> #include <string.h>

View File

@ -43,6 +43,7 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> /* for free(), malloc() */
#include <string.h> #include <string.h>

View File

@ -39,6 +39,7 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> /* for free(), malloc() */
#include <string.h> #include <string.h>

View File

@ -39,6 +39,7 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> /* for free(), malloc() */
#include <string.h> #include <string.h>

View File

@ -85,7 +85,7 @@ EXPORT_SPEC void UpnpActionComplete_set_ErrCode(
/*! /*!
* \brief Control URL getter. * \brief Control URL getter.
* *
* \retrun The control URL string. * \return The control URL string.
*/ */
EXPORT_SPEC const UpnpString *UpnpActionComplete_get_CtrlUrl( EXPORT_SPEC const UpnpString *UpnpActionComplete_get_CtrlUrl(
/*! [in] \b this pointer. */ /*! [in] \b this pointer. */

View File

@ -50,7 +50,7 @@ EXPORT_SPEC void UpnpEventSubscribe_set_TimeOut(UpnpEventSubscribe *p, int n);
/** The SID for this subscription. For subscriptions, this only /** The SID for this subscription. For subscriptions, this only
* contains a valid SID if the \b Upnp_EventSubscribe.result field * contains a valid SID if the \b Upnp_EventSubscribe.result field
* contains a {\tt UPNP_E_SUCCESS} result code. For unsubscriptions, * contains a \b UPNP_E_SUCCESS result code. For unsubscriptions,
* this contains the SID from which the subscription is being * this contains the SID from which the subscription is being
* unsubscribed. */ * unsubscribed. */
EXPORT_SPEC const UpnpString *UpnpEventSubscribe_get_SID(const UpnpEventSubscribe *p); EXPORT_SPEC const UpnpString *UpnpEventSubscribe_get_SID(const UpnpEventSubscribe *p);

View File

@ -54,7 +54,7 @@ EXPORT_SPEC void UpnpFileInfo_set_FileLength(UpnpFileInfo *p, off_t l);
EXPORT_SPEC const time_t *UpnpFileInfo_get_LastModified(const UpnpFileInfo *p); EXPORT_SPEC const time_t *UpnpFileInfo_get_LastModified(const UpnpFileInfo *p);
EXPORT_SPEC void UpnpFileInfo_set_LastModified(UpnpFileInfo *p, const time_t *t); EXPORT_SPEC void UpnpFileInfo_set_LastModified(UpnpFileInfo *p, const time_t *t);
/** If the file is a directory, {\bf is_directory} contains /** If the file is a directory, \b is_directory contains
* a non-zero value. For a regular file, it should be 0. */ * a non-zero value. For a regular file, it should be 0. */
EXPORT_SPEC int UpnpFileInfo_get_IsDirectory(const UpnpFileInfo *p); EXPORT_SPEC int UpnpFileInfo_get_IsDirectory(const UpnpFileInfo *p);
EXPORT_SPEC void UpnpFileInfo_set_IsDirectory(UpnpFileInfo *p, int b); EXPORT_SPEC void UpnpFileInfo_set_IsDirectory(UpnpFileInfo *p, int b);

View File

@ -56,7 +56,7 @@ EXPORT_SPEC void UpnpStateVarComplete_set_StateVarName(UpnpStateVarComplete *p,
EXPORT_SPEC void UpnpStateVarComplete_strcpy_StateVarName(UpnpStateVarComplete *p, const char *s); EXPORT_SPEC void UpnpStateVarComplete_strcpy_StateVarName(UpnpStateVarComplete *p, const char *s);
/** The current value of the variable. This needs to be allocated by /** The current value of the variable. This needs to be allocated by
* the caller. When finished with it, the SDK frees this {\bf DOMString}. */ * the caller. When finished with it, the SDK frees this \b DOMString. */
EXPORT_SPEC const DOMString UpnpStateVarComplete_get_CurrentVal(const UpnpStateVarComplete *p); EXPORT_SPEC const DOMString UpnpStateVarComplete_get_CurrentVal(const UpnpStateVarComplete *p);
EXPORT_SPEC void UpnpStateVarComplete_set_CurrentVal(UpnpStateVarComplete *p, const DOMString s); EXPORT_SPEC void UpnpStateVarComplete_set_CurrentVal(UpnpStateVarComplete *p, const DOMString s);

View File

@ -73,7 +73,7 @@ EXPORT_SPEC struct sockaddr *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStat
EXPORT_SPEC void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, struct sockaddr *sa); EXPORT_SPEC void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, struct sockaddr *sa);
/** The current value of the variable. This needs to be allocated by /** The current value of the variable. This needs to be allocated by
* the caller. When finished with it, the SDK frees this {\bf DOMString}. */ * the caller. When finished with it, the SDK frees this \b DOMString. */
EXPORT_SPEC const DOMString UpnpStateVarRequest_get_CurrentVal(const UpnpStateVarRequest *p); EXPORT_SPEC const DOMString UpnpStateVarRequest_get_CurrentVal(const UpnpStateVarRequest *p);
EXPORT_SPEC void UpnpStateVarRequest_set_CurrentVal(UpnpStateVarRequest *p, const DOMString s); EXPORT_SPEC void UpnpStateVarRequest_set_CurrentVal(UpnpStateVarRequest *p, const DOMString s);

View File

@ -418,9 +418,6 @@
#endif #endif
#include "upnpdebug.h"
/* /*
* Opaque data structures. The following includes are data structures that * Opaque data structures. The following includes are data structures that
* must be externally visible. Since version 1.8.0, only an opaque typedef * must be externally visible. Since version 1.8.0, only an opaque typedef

View File

@ -34,12 +34,14 @@
#define UPNP_DEBUG_H #define UPNP_DEBUG_H
/*! \file */ /*!
* \file
*/
#include "ThreadPool.h" #include "ThreadPool.h"
#include "upnp.h"
#include "upnpconfig.h" #include "upnpconfig.h"
#include "UpnpGlobal.h" /* for UPNP_INLINE */
#include <stdio.h> #include <stdio.h>
@ -72,7 +74,6 @@ extern "C" {
* \li \c UPNP_INFO [2] * \li \c UPNP_INFO [2]
* \li \c UPNP_ALL [3] * \li \c UPNP_ALL [3]
*/ */
typedef enum Upnp_Module { typedef enum Upnp_Module {
SSDP, SSDP,
SOAP, SOAP,
@ -84,6 +85,7 @@ typedef enum Upnp_Module {
HTTP HTTP
} Dbg_Module; } Dbg_Module;
/*@{*/ /*@{*/
typedef enum Upnp_LogLevel_e { typedef enum Upnp_LogLevel_e {
UPNP_CRITICAL, UPNP_CRITICAL,

View File

@ -34,6 +34,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#if !UPNP_HAVE_TOOLS #if !UPNP_HAVE_TOOLS

View File

@ -42,6 +42,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include "upnptools.h" #include "upnptools.h"

View File

@ -1,52 +1,65 @@
/////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// Copyright (c) 2000-2003 Intel Corporation * Copyright (c) 2000-2003 Intel Corporation
// All rights reserved. * All rights reserved.
// *
// Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
// *
// * Redistributions of source code must retain the above copyright notice, * - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, * - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
// * Neither name of Intel Corporation nor the names of its contributors * - Neither name of Intel Corporation nor the names of its contributors
// may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
// without specific prior written permission. * without specific prior written permission.
// *
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// *
/////////////////////////////////////////////////////////////////////////// ******************************************************************************/
/*
* \file
*
* \brief Contains functions for scanner and parser for http messages.
*/
/************************************************************************
* Purpose: This file contains functions for scanner and parser for http
* messages.
************************************************************************/
#define _GNU_SOURCE // For strcasestr() in string.h #define _GNU_SOURCE // For strcasestr() in string.h
#include "config.h" #include "config.h"
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include "strintmap.h" #include "strintmap.h"
#include "httpparser.h" #include "httpparser.h"
#include "statcodes.h" #include "statcodes.h"
#include "unixutil.h" #include "unixutil.h"
#include "upnpdebug.h"
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
/* entity positions */
// entity positions
#define NUM_HTTP_METHODS 9 #define NUM_HTTP_METHODS 9
static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = { static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
@ -122,8 +135,8 @@ str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES] = {
* Note : * Note :
************************************************************************/ ************************************************************************/
static UPNP_INLINE void static UPNP_INLINE void
scanner_init( OUT scanner_t * scanner, scanner_init( OUT scanner_t *scanner,
IN membuffer * bufptr ) IN membuffer *bufptr )
{ {
scanner->cursor = 0; scanner->cursor = 0;
scanner->msg = bufptr; scanner->msg = bufptr;

View File

@ -157,7 +157,7 @@ typedef struct NOTIFY_THREAD_STRUCT {
* \brief 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. * incoming GENA requests.
* *
* \Return UPNP_E_SUCCESS if successful, otherwise appropriate error code. * \return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
*/ */
EXTERN_C void genaCallback( EXTERN_C void genaCallback(
/*! [in] represents the parse state of the request */ /*! [in] represents the parse state of the request */

View File

@ -1,275 +1,231 @@
/////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// *
// 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 SERVICE_TABLE
#define SERVICE_TABLE
/*!
* \file
*/
#ifndef _SERVICE_TABLE
#define _SERVICE_TABLE
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "config.h" #include "config.h"
#include "uri.h" #include "uri.h"
#include "ixml.h" #include "ixml.h"
#include "upnp.h" #include "upnp.h"
#include "upnpdebug.h"
#include <stdio.h> #include <stdio.h>
//#include <malloc.h>
#include <time.h> #include <time.h>
#define SID_SIZE 41 #define SID_SIZE 41
#ifdef INCLUDE_DEVICE_APIS #ifdef INCLUDE_DEVICE_APIS
typedef struct SUBSCRIPTION { typedef struct SUBSCRIPTION {
Upnp_SID sid; Upnp_SID sid;
int eventKey; int eventKey;
int ToSendEventKey; int ToSendEventKey;
time_t expireTime; time_t expireTime;
int active; int active;
URL_list DeliveryURLs; URL_list DeliveryURLs;
struct SUBSCRIPTION *next; struct SUBSCRIPTION *next;
} subscription; } subscription;
typedef struct SERVICE_INFO { typedef struct SERVICE_INFO {
DOMString serviceType; DOMString serviceType;
DOMString serviceId; DOMString serviceId;
char *SCPDURL ; char *SCPDURL ;
char *controlURL; char *controlURL;
char *eventURL; char *eventURL;
DOMString UDN; DOMString UDN;
int active; int active;
int TotalSubscriptions; int TotalSubscriptions;
subscription *subscriptionList; subscription *subscriptionList;
struct SERVICE_INFO *next; struct SERVICE_INFO *next;
} service_info; } service_info;
typedef struct SERVICE_TABLE { typedef struct SERVICE_TABLE {
DOMString URLBase; DOMString URLBase;
service_info *serviceList; service_info *serviceList;
service_info *endServiceList; service_info *endServiceList;
} service_table; } service_table;
/* Functions for Subscriptions */ /* Functions for Subscriptions */
/************************************************************************
* Function : copy_subscription
*
* Parameters :
* subscription *in ; Source subscription
* subscription *out ; Destination subscription
*
* Description : Makes a copy of the subscription
*
* Return : int ;
* HTTP_SUCCESS - On Sucess
*
* Note :
************************************************************************/
int copy_subscription(subscription *in, subscription *out);
/************************************************************************ /*!
* Function : RemoveSubscriptionSID * \brief Makes a copy of the subscription.
* *
* Parameters : * \return HTTP_SUCCESS on Sucess.
* Upnp_SID sid ; subscription ID */
* service_info * service ; service object providing the list of int copy_subscription(
* subscriptions /*! [in] Source subscription. */
* subscription *in,
* Description : Remove the subscription represented by the /*! [in] Destination subscription. */
* const Upnp_SID sid parameter from the service table and update subscription *out);
* the service table.
*
* Return : void ;
*
* Note :
************************************************************************/
void RemoveSubscriptionSID(Upnp_SID sid, service_info * service);
/************************************************************************
* Function: GetSubscriptionSID /*
* \brief Remove the subscription represented by the const Upnp_SID sid parameter
* from the service table and update the service table.
*/
void RemoveSubscriptionSID(
/*! [in] Subscription ID. */
Upnp_SID sid,
/*! [in] Service object providing the list of subscriptions. */
service_info *service);
/*!
* \brief Return the subscription from the service table that matches
* const Upnp_SID sid value.
* *
* Parameters: * \return Pointer to the matching subscription node.
* const Upnp_SID sid: subscription ID */
* const service_info *service: service object providing the list of subscription *GetSubscriptionSID(
* subscriptions /*! [in] Subscription ID. */
* const Upnp_SID sid,
* Description : Return the subscription from the service table /*! [in] Service object providing the list of subscriptions. */
* that matches const Upnp_SID sid value. service_info *service);
*
* Return: subscription *: Pointer to the matching subscription node;
************************************************************************/
subscription *GetSubscriptionSID(const Upnp_SID sid, service_info *service);
/************************************************************************
* Function: GetFirstSubscription /*!
* \brief Gets pointer to the first subscription node in the service table.
* *
* Parameters: * \return Pointer to the first subscription node.
* service_info *service: service object providing the list of */
* subscriptions subscription *GetFirstSubscription(
/*! [in] Service object providing the list of subscriptions. */
service_info *service);
/*!
* \brief Get current and valid subscription from the service table.
* *
* Description: Gets pointer to the first subscription node in the * \return Pointer to the next subscription node.
* service table. */
subscription *GetNextSubscription(
/*! [in] Service object providing the list of subscriptions. */
service_info *service,
/*! [in] Current subscription object. */
subscription *current);
/*!
* \brief Free's the memory allocated for storing the URL of the subscription.
*/
void freeSubscription(
/*! [in] Subscription object to be freed. */
subscription *sub);
/*!
* \brief Free's memory allocated for all the subscriptions in the service table.
*/
void freeSubscriptionList(
/*! [in] Head of the subscription list. */
subscription * head);
/*!
* \brief Traverses through the service table and returns a pointer to the
* service node that matches a known service id and a known UDN.
* *
* Return: subscription *: pointer to the first subscription node * \return Pointer to the matching service_info node.
************************************************************************/ */
subscription *GetFirstSubscription(service_info *service); service_info *FindServiceId(
/*! [in] Service table. */
service_table *table,
/*! [in] String representing the service id to be found among those
* in the table. */
const char *serviceId,
/*! [in] String representing the UDN to be found among those in the
* table. */
const char *UDN);
/************************************************************************
* Function: GetNextSubscription /*!
* \brief Traverses the service table and finds the node whose event URL Path
* matches a know value.
* *
* Parameters: * \return Pointer to the service list node from the service table whose event
* service_info *service: service object providing the list of * URL matches a known event URL.
* subscriptions */
* subscription *current: current subscription object service_info *FindServiceEventURLPath(
/*! [in] Service table. */
service_table *table,
/*! [in] Event URL path used to find a service from the table. */
char *eventURLPath);
/*!
* \brief Traverses the service table and finds the node whose control URL Path
* matches a know value.
* *
* Description: Get current and valid subscription from the service * \return Pointer to the service list node from the service table whose control
* table. * URL Path matches a known value.
* */
* Return: subscription *: pointer to the next subscription node service_info * FindServiceControlURLPath(
************************************************************************/ /*! [in] Service table. */
subscription *GetNextSubscription(service_info *service, subscription *current); service_table *table,
/*! [in] Control URL path used to find a service from the table. */
const char *controlURLPath);
/************************************************************************
* Function : freeSubscription
*
* Parameters :
* subscription * sub ; subscription to be freed
*
* Description : Free's the memory allocated for storing the URL of
* the subscription.
*
* Return : void ;
*
* Note :
************************************************************************/
void freeSubscription(subscription *sub);
/************************************************************************ /*!
* Function : freeSubscriptionList * \brief For debugging purposes prints information from the service passed
* * into the function.
* Parameters : */
* subscription * head ; head of the subscription list
*
* Description : Free's memory allocated for all the subscriptions
* in the service table.
*
* Return : void ;
*
* Note :
************************************************************************/
void freeSubscriptionList(subscription * head);
/************************************************************************
* Function : FindServiceId
*
* Parameters :
* service_table *table ; service table
* const char * serviceId ;string representing the service id
* to be found among those in the table
* const char * UDN ; string representing the UDN
* to be found among those in the table
*
* Description : Traverses through the service table and returns a
* pointer to the service node that matches a known service id
* and a known UDN
*
* Return : service_info * - pointer to the matching service_info node;
*
* Note :
************************************************************************/
service_info *FindServiceId( service_table * table,
const char * serviceId, const char * UDN);
/************************************************************************
* Function : FindServiceEventURLPath
*
* Parameters :
* service_table *table ; service table
* char * eventURLPath ; event URL path used to find a service
* from the table
*
* Description : Traverses the service table and finds the node whose
* event URL Path matches a know value
*
* Return : service_info * - pointer to the service list node from the
* service table whose event URL matches a known event URL;
*
* Note :
************************************************************************/
service_info * FindServiceEventURLPath( service_table *table,
char * eventURLPath
);
/************************************************************************
* Function : FindServiceControlURLPath
*
* Parameters :
* service_table * table ; service table
* char * controlURLPath ; control URL path used to find a service
* from the table
*
* Description : Traverses the service table and finds the node whose
* control URL Path matches a know value
*
* Return : service_info * - pointer to the service list node from the
* service table whose control URL Path matches a known value;
*
* Note :
************************************************************************/
service_info * FindServiceControlURLPath( service_table *table,
const char * controlURLPath);
/************************************************************************
* Function : printService
*
* Parameters :
* service_info *service ;Service whose information is to be printed
* Upnp_LogLevel level ; Debug level specified to the print function
* Dbg_Module module ; Debug module specified to the print function
*
* Description : For debugging purposes prints information from the
* service passed into the function.
*
* Return : void ;
*
* Note :
************************************************************************/
#ifdef DEBUG #ifdef DEBUG
void printService( void printService(
/*! [in] Service whose information is to be printed. */
service_info *service, service_info *service,
/*! [in] Debug level specified to the print function. */
Upnp_LogLevel level, Upnp_LogLevel level,
/*! [in] Debug module specified to the print function. */
Dbg_Module module); Dbg_Module module);
#else #else
static UPNP_INLINE void printService( static UPNP_INLINE void printService(
@ -278,25 +234,18 @@ static UPNP_INLINE void printService(
Dbg_Module module) {} Dbg_Module module) {}
#endif #endif
/************************************************************************
* Function : printServiceList /*!
* * \brief For debugging purposes prints information of each service from the
* Parameters : * service table passed into the function.
* service_info *service ; Service whose information is to be printed */
* Upnp_LogLevel level ; Debug level specified to the print function
* Dbg_Module module ; Debug module specified to the print function
*
* Description : For debugging purposes prints information of each
* service from the service table passed into the function.
*
* Return : void ;
*
* Note :
************************************************************************/
#ifdef DEBUG #ifdef DEBUG
void printServiceList( void printServiceList(
/*! [in] Service whose information is to be printed. */
service_info *service, service_info *service,
/*! [in] Debug level specified to the print function. */
Upnp_LogLevel level, Upnp_LogLevel level,
/*! [in] Debug module specified to the print function. */
Dbg_Module module); Dbg_Module module);
#else #else
static UPNP_INLINE void printServiceList( static UPNP_INLINE void printServiceList(
@ -305,26 +254,18 @@ static UPNP_INLINE void printServiceList(
Dbg_Module module) {} Dbg_Module module) {}
#endif #endif
/************************************************************************
* Function : printServiceTable /*!
* * \brief For debugging purposes prints the URL base of the table and information
* Parameters : * of each service from the service table passed into the function.
* service_table * table ; Service table to be printed */
* Upnp_LogLevel level ; Debug level specified to the print function
* Dbg_Module module ; Debug module specified to the print function
*
* Description : For debugging purposes prints the URL base of the table
* and information of each service from the service table passed into
* the function.
*
* Return : void ;
*
* Note :
************************************************************************/
#ifdef DEBUG #ifdef DEBUG
void printServiceTable( void printServiceTable(
/*! [in] Service table to be printed. */
service_table *table, service_table *table,
/*! [in] Debug level specified to the print function. */
Upnp_LogLevel level, Upnp_LogLevel level,
/*! [in] Debug module specified to the print function. */
Dbg_Module module); Dbg_Module module);
#else #else
static UPNP_INLINE void printServiceTable( static UPNP_INLINE void printServiceTable(
@ -333,150 +274,106 @@ static UPNP_INLINE void printServiceTable(
Dbg_Module module) {} Dbg_Module module) {}
#endif #endif
/************************************************************************
* Function : freeService
*
* Parameters :
* service_info *in ; service information that is to be freed
*
* Description : Free's memory allocated for the various components
* of the service entry in the service table.
*
* Return : void ;
*
* Note :
************************************************************************/
void freeService(service_info * in);
/************************************************************************ /*!
* Function : freeServiceList * \brief Free's memory allocated for the various components of the service
* * entry in the service table.
* Parameters : */
* service_info * head ; Head of the service list to be freed void freeService(
* /*! [in] Service information that is to be freed. */
* Description : Free's memory allocated for the various components service_info *in);
* of each service entry in the service table.
*
* Return : void ;
*
* Note :
************************************************************************/
void freeServiceList(service_info * head);
/************************************************************************ /*!
* Function : freeServiceTable * \brief Free's memory allocated for the various components of each service
* * entry in the service table.
* Parameters : */
* service_table * table ; Service table whose memory needs to be void freeServiceList(
* freed /*! [in] Head of the service list to be freed. */
* service_info *head);
* Description : Free's dynamic memory in table.
* (does not free table, only memory within the structure)
*
* Return : void ;
*
* Note :
************************************************************************/
void freeServiceTable(service_table * table);
/************************************************************************
* Function : removeServiceTable
*
* Parameters :
* IXML_Node *node ; XML node information
* service_table *in ; service table from which services will be
* removed
*
* Description : This function assumes that services for a particular
* root device are placed linearly in the service table, and in the
* order in which they are found in the description document
* all services for this root device are removed from the list
*
* Return : int ;
*
* Note :
************************************************************************/
int removeServiceTable(IXML_Node *node,
service_table *in);
/************************************************************************ /*!
* Function : addServiceTable * \brief Free's dynamic memory in table (does not free table, only memory
* * within the structure).
* Parameters : */
* IXML_Node *node ; XML node information void freeServiceTable(
* service_table *in ; service table that will be initialized with /*! [in] Service table whose internal memory needs to be freed. */
* services service_table *table);
* const char *DefaultURLBase ; Default base URL on which the URL
* will be returned to the service list.
*
* Description : Add Service to the table.
*
* Return : int ;
*
* Note :
************************************************************************/
int addServiceTable(IXML_Node *node, service_table *in, const char *DefaultURLBase);
/************************************************************************
* Function : getServiceTable
*
* Parameters :
* IXML_Node *node ; XML node information
* service_table *out ; output parameter which will contain the
* service list and URL
* const char *DefaultURLBase ; Default base URL on which the URL
* will be returned.
*
* Description : Retrieve service from the table
*
* Return : int ;
*
* Note :
************************************************************************/
int getServiceTable(IXML_Node *node, service_table * out, const char * DefaultURLBase);
/* Misc helper functions */ /*!
* \brief This function assumes that services for a particular root device are
* placed linearly in the service table, and in the order in which they are
* found in the description document all services for this root device are
* removed from the list.
*
* \return An integer.
*/
int removeServiceTable(
/*! [in] XML node information. */
IXML_Node *node,
/*! [in] Service table from which services will be removed. */
service_table *in);
/************************************************************************ /*!
* Function : getElementValue * \brief Add Service to the table.
* */
* Parameters : int addServiceTable(
* IXML_Node *node ; Input node which provides the list of child /*! [in] XML node information. */
* nodes IXML_Node *node,
* /*! [in] Service table that will be initialized with services. */
* Description : Returns the clone of the element value service_table *in,
* /*! [in] Default base URL on which the URL will be returned to the
* Return : DOMString ; * service list. */
* const char *DefaultURLBase);
* Note : value must be freed with DOMString_free
************************************************************************/
DOMString getElementValue(IXML_Node *node);
/************************************************************************
* Function : getSubElement /*!
* * \brief Retrieve service from the table.
* Parameters : *
* const char *element_name ; sub element name to be searched for * \return An integer
* IXML_Node *node ; Input node which provides the list of child */
* nodes int getServiceTable(
* IXML_Node **out ; Ouput node to which the matched child node is /*! [in] XML node information. */
* returned. IXML_Node *node,
* /*! [in] Output parameter which will contain the service list and URL. */
* Description : Traverses through a list of XML nodes to find the service_table *out,
* node with the known element name. /*! [in] Default base URL on which the URL will be returned. */
* const char *DefaultURLBase);
* Return : int ;
* 1 - On Success
* 0 - On Failure /* Misc helper functions */
*
* Note :
************************************************************************/ /*!
int getSubElement(const char *element_name, IXML_Node *node, * \brief Returns the clone of the element value.
IXML_Node **out); *
* \note Value must be freed with DOMString_free.
*
* \return DOMString
*/
DOMString getElementValue(
/*! [in] Input node which provides the list of child nodes. */
IXML_Node *node);
/*!
* \brief Traverses through a list of XML nodes to find the node with the
* known element name.
*
* \return
* \li 1 - On Success
* \li 0 - On Failure
*/
int getSubElement(
/*! [in] Sub element name to be searched for. */
const char *element_name,
/*! [in] Input node which provides the list of child nodes. */
IXML_Node *node,
/*! [out] Ouput node to which the matched child node is returned. */
IXML_Node **out);
#endif /* INCLUDE_DEVICE_APIS */ #endif /* INCLUDE_DEVICE_APIS */
@ -485,5 +382,5 @@ int getSubElement(const char *element_name, IXML_Node *node,
} }
#endif #endif
#endif /* _SERVICE_TABLE */ #endif /* SERVICE_TABLE */

View File

@ -33,16 +33,18 @@
#include "config.h" #include "config.h"
#include "membuffer.h"
#include "unixutil.h"
#include "upnp.h" #include "upnp.h"
#include "upnpdebug.h"
#include "uri.h"
#include "urlconfig.h"
#include "util.h" #include "util.h"
#include "webserver.h" #include "webserver.h"
#include "uri.h"
#include "membuffer.h"
#include "urlconfig.h"
#include "unixutil.h"
#include <assert.h> #include <assert.h>
#include <stdio.h>
#ifdef WIN32 #ifdef WIN32