Doxygenation.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@366 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
0fb20847a7
commit
9326b73d06
6
Doxyfile
6
Doxyfile
@ -31,7 +31,7 @@ PROJECT_NAME = libUPnP
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.4.7
|
||||
PROJECT_NUMBER = 1.8.0
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
@ -322,7 +322,7 @@ INLINE_INFO = YES
|
||||
# alphabetically by member name. If set to NO the members will appear in
|
||||
# declaration order.
|
||||
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
|
||||
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
|
||||
# brief documentation of file, namespace and class members alphabetically
|
||||
@ -1029,7 +1029,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# undefined via #undef or recursively expanded use the := operator
|
||||
# instead of the = operator.
|
||||
|
||||
PREDEFINED =
|
||||
PREDEFINED = DEBUG
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||
# this tag can be used to specify a list of macro names that should be expanded.
|
||||
|
@ -9,7 +9,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** Returned as part of a {\bf UPNP_CONTROL_ACTION_COMPLETE} callback. */
|
||||
/** Returned as part of a \b UPNP_CONTROL_ACTION_COMPLETE callback. */
|
||||
typedef struct {} UpnpActionRequest;
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** Returned in a {\bf UPNP_DISCOVERY_RESULT} callback. */
|
||||
/** Returned in a \b UPNP_DISCOVERY_RESULT callback. */
|
||||
typedef struct {} UpnpDiscovery;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ UpnpDiscovery *UpnpDiscovery_dup(const UpnpDiscovery *p);
|
||||
/** Assignment operator */
|
||||
void UpnpDiscovery_assign(UpnpDiscovery *q, const UpnpDiscovery *p);
|
||||
|
||||
/** The result code of the {\bf UpnpSearchAsync} call. */
|
||||
/** The result code of the \b UpnpSearchAsync call. */
|
||||
int UpnpDiscovery_get_ErrCode(const UpnpDiscovery *p);
|
||||
void UpnpDiscovery_set_ErrCode(UpnpDiscovery *p, int n);
|
||||
|
||||
|
@ -9,7 +9,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** Returned along with a {\bf UPNP_EVENT_RECEIVED} callback. */
|
||||
/** Returned along with a \b UPNP_EVENT_RECEIVED callback. */
|
||||
typedef struct {} UpnpEvent;
|
||||
|
||||
|
||||
|
@ -9,8 +9,8 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or
|
||||
* {\bf UPNP_EVENT_UNSUBSCRIBE_COMPLETE} callback. */
|
||||
/** Returned along with a \b UPNP_EVENT_SUBSCRIBE_COMPLETE or
|
||||
* \b UPNP_EVENT_UNSUBSCRIBE_COMPLETE callback. */
|
||||
typedef struct {} UpnpEventSubscribe;
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ int UpnpEventSubscribe_get_TimeOut(const UpnpEventSubscribe *p);
|
||||
void UpnpEventSubscribe_set_TimeOut(UpnpEventSubscribe *p, int n);
|
||||
|
||||
/** The SID for this subscription. For subscriptions, this only
|
||||
* contains a valid SID if the {\bf 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,
|
||||
* this contains the SID from which the subscription is being
|
||||
* unsubscribed. */
|
||||
|
@ -4,11 +4,15 @@
|
||||
#define STRING_H
|
||||
|
||||
|
||||
/** \file */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** Type of the string objects inside libupnp. */
|
||||
typedef struct {} UpnpString;
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIPTION_REQUEST} callback. */
|
||||
/** Returned along with a \b UPNP_EVENT_SUBSCRIPTION_REQUEST callback. */
|
||||
typedef struct {} UpnpSubscriptionRequest;
|
||||
|
||||
|
||||
|
2994
upnp/inc/upnp.h
2994
upnp/inc/upnp.h
File diff suppressed because it is too large
Load Diff
@ -33,11 +33,18 @@
|
||||
#ifndef UPNP_DEBUG_H
|
||||
#define UPNP_DEBUG_H
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
|
||||
#include "ThreadPool.h"
|
||||
#include "upnp.h"
|
||||
#include "upnpconfig.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -269,35 +276,6 @@ static UPNP_INLINE void UpnpPrintf(
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpDisplayBanner
|
||||
*
|
||||
* Parameters:
|
||||
* IN FILE *fd: file descriptor where the banner will be written
|
||||
* IN char **lines: The buffer that will be written
|
||||
* IN int size: Size of the buffer
|
||||
* IN int starLength: This parameter provides the width of the banner
|
||||
*
|
||||
* Description:
|
||||
* This functions takes the buffer and writes the buffer in the file as
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayBanner(
|
||||
FILE *fd,
|
||||
const char **lines,
|
||||
size_t size,
|
||||
int starlength);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpDisplayBanner(
|
||||
FILE *fd,
|
||||
const char **lines,
|
||||
size_t size,
|
||||
int starlength) {}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpDisplayFileAndLine
|
||||
*
|
||||
@ -324,6 +302,53 @@ static UPNP_INLINE void UpnpDisplayFileAndLine(
|
||||
int DbgLineNo) {}
|
||||
#endif
|
||||
|
||||
|
||||
/*! \brief Writes the buffer in the file as per the requested banner
|
||||
*
|
||||
* \param [in] fd file descriptor where the banner will be written
|
||||
* \param [in] lines: The buffer that will be written
|
||||
* \param [in] size: Size of the buffer
|
||||
* \param [in] starLength: This parameter provides the width of the banner
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayBanner(
|
||||
FILE *fd,
|
||||
const char **lines,
|
||||
size_t size,
|
||||
int starlength);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpDisplayBanner(
|
||||
FILE *fd,
|
||||
const char **lines,
|
||||
size_t size,
|
||||
int starlength) {}
|
||||
#endif
|
||||
|
||||
|
||||
/*! \brief Prints thread pool statistics.
|
||||
*
|
||||
* \param [in] tp The thread pool
|
||||
* \param [in] DbgFileName the file name that called this function, use the
|
||||
* macro __FILE__.
|
||||
* \param [in] DbgLineNo the line number that the function was called, use
|
||||
* the macro __LINE__.
|
||||
* \param [in] msg message.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void PrintThreadPoolStats(
|
||||
ThreadPool *tp,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char *msg);
|
||||
#else
|
||||
static UPNP_INLINE void PrintThreadPoolStats(
|
||||
ThreadPool *tp,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char *msg) {}
|
||||
#endif
|
||||
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -163,392 +163,236 @@ int UpnpSdkDeviceregisteredV6 = 0;
|
||||
Upnp_SID gUpnpSdkNLSuuid;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: UpnpInit2
|
||||
*
|
||||
* Parameters:
|
||||
* IN const char * IfName: Name of local interface.
|
||||
* IN short DestPort: Local Port to listen for incoming connections.
|
||||
*
|
||||
* Description:
|
||||
* - Initializes the UPnP SDK.
|
||||
* - Checks IfName interface. If NULL, we find a suitable interface for
|
||||
* operation.
|
||||
*
|
||||
* Returns:
|
||||
* UPNP_E_SUCCESS on success, nonzero on failure.
|
||||
* UPNP_E_INIT_FAILED if Initialization fails.
|
||||
* UPNP_E_INIT if UPnP is already initialized.
|
||||
* UPNP_E_INVALID_INTERFACE if interface provided is not configured with at
|
||||
* least one valid IP address.
|
||||
*****************************************************************************/
|
||||
int UpnpInit2( IN const char *IfName,
|
||||
IN unsigned short DestPort )
|
||||
/******************************************************************************/
|
||||
int UpnpInit(IN const char *HostIP, IN unsigned short DestPort)
|
||||
{
|
||||
int retVal;
|
||||
int retVal;
|
||||
|
||||
ithread_mutex_lock( &gSDKInitMutex );
|
||||
ithread_mutex_lock( &gSDKInitMutex );
|
||||
|
||||
// Check if we're already initialized.
|
||||
if( UpnpSdkInit == 1 ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return UPNP_E_INIT;
|
||||
}
|
||||
// Check if we're already initialized.
|
||||
if( UpnpSdkInit == 1 ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return UPNP_E_INIT;
|
||||
}
|
||||
|
||||
// Perform initialization preamble.
|
||||
retVal = UpnpInitPreamble();
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
// Perform initialization preamble.
|
||||
retVal = UpnpInitPreamble();
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"UpnpInit2 with IfName=%s, DestPort=%d.\n",
|
||||
IfName ? IfName : "", DestPort );
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"UpnpInit with HostIP=%s, DestPort=%d.\n",
|
||||
HostIP ? HostIP : "", DestPort );
|
||||
|
||||
// Retrieve interface information (Addresses, index, etc).
|
||||
retVal = UpnpGetIfInfo( IfName );
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
// Verify HostIP, if provided, or find it ourselves.
|
||||
if( HostIP != NULL ) {
|
||||
strncpy( gIF_IPV4, HostIP, sizeof(gIF_IPV4) );
|
||||
} else {
|
||||
if( getlocalhostname( gIF_IPV4, sizeof(gIF_IPV4) ) != UPNP_E_SUCCESS ) {
|
||||
return UPNP_E_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the UpnpSdkInit flag to 1 to indicate we're sucessfully initialized.
|
||||
UpnpSdkInit = 1;
|
||||
// Set the UpnpSdkInit flag to 1 to indicate we're sucessfully initialized.
|
||||
UpnpSdkInit = 1;
|
||||
|
||||
// Finish initializing the SDK.
|
||||
retVal = UpnpInitStartServers( DestPort );
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
UpnpSdkInit = 0;
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
// Finish initializing the SDK.
|
||||
retVal = UpnpInitStartServers( DestPort );
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
UpnpSdkInit = 0;
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Host Ip: %s Host Port: %d\n", gIF_IPV4,
|
||||
LOCAL_PORT_V4 );
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: UpnpInit
|
||||
*
|
||||
* Parameters:
|
||||
* IN const char * HostIP: Local IP Address
|
||||
* IN short DestPort: Local Port to listen for incoming connections.
|
||||
*
|
||||
* Description:
|
||||
* ** DEPRECATED: Kept for backwards compatibility. **
|
||||
* Use UpnpInit2 for new implementations.
|
||||
* - Initializes the UPnP SDK.
|
||||
* - Checks HostIP address. If NULL, we find a suitable IP for operation.
|
||||
*
|
||||
* Returns:
|
||||
* UPNP_E_SUCCESS on success, nonzero on failure.
|
||||
* UPNP_E_INIT_FAILED if Initialization fails.
|
||||
* UPNP_E_INIT if UPnP is already initialized.
|
||||
*****************************************************************************/
|
||||
int UpnpInit( IN const char *HostIP,
|
||||
IN unsigned short DestPort )
|
||||
/******************************************************************************/
|
||||
int UpnpInit2(IN const char *IfName, IN unsigned short DestPort)
|
||||
{
|
||||
int retVal;
|
||||
int retVal;
|
||||
|
||||
ithread_mutex_lock( &gSDKInitMutex );
|
||||
ithread_mutex_lock( &gSDKInitMutex );
|
||||
|
||||
// Check if we're already initialized.
|
||||
if( UpnpSdkInit == 1 ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return UPNP_E_INIT;
|
||||
}
|
||||
// Check if we're already initialized.
|
||||
if( UpnpSdkInit == 1 ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return UPNP_E_INIT;
|
||||
}
|
||||
|
||||
// Perform initialization preamble.
|
||||
retVal = UpnpInitPreamble();
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
// Perform initialization preamble.
|
||||
retVal = UpnpInitPreamble();
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"UpnpInit with HostIP=%s, DestPort=%d.\n",
|
||||
HostIP ? HostIP : "", DestPort );
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"UpnpInit2 with IfName=%s, DestPort=%d.\n",
|
||||
IfName ? IfName : "", DestPort );
|
||||
|
||||
// Verify HostIP, if provided, or find it ourselves.
|
||||
if( HostIP != NULL ) {
|
||||
strncpy( gIF_IPV4, HostIP, sizeof(gIF_IPV4) );
|
||||
} else {
|
||||
if( getlocalhostname( gIF_IPV4, sizeof(gIF_IPV4) ) != UPNP_E_SUCCESS ) {
|
||||
return UPNP_E_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
// Retrieve interface information (Addresses, index, etc).
|
||||
retVal = UpnpGetIfInfo( IfName );
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
// Set the UpnpSdkInit flag to 1 to indicate we're sucessfully initialized.
|
||||
UpnpSdkInit = 1;
|
||||
// Set the UpnpSdkInit flag to 1 to indicate we're sucessfully initialized.
|
||||
UpnpSdkInit = 1;
|
||||
|
||||
// Finish initializing the SDK.
|
||||
retVal = UpnpInitStartServers( DestPort );
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
UpnpSdkInit = 0;
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
// Finish initializing the SDK.
|
||||
retVal = UpnpInitStartServers( DestPort );
|
||||
if( retVal != UPNP_E_SUCCESS ) {
|
||||
UpnpSdkInit = 0;
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
return retVal;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Host Ip: %s Host Port: %d\n", gIF_IPV4,
|
||||
LOCAL_PORT_V4 );
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
|
||||
ithread_mutex_unlock( &gSDKInitMutex );
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: PrintThreadPoolStats
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Return Values: (none)
|
||||
*****************************************************************************/
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
PrintThreadPoolStats(
|
||||
ThreadPool *tp,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char *msg)
|
||||
{
|
||||
ThreadPoolStats stats;
|
||||
ThreadPoolGetStats(tp, &stats);
|
||||
UpnpPrintf(UPNP_INFO, API, DbgFileName, DbgLineNo,
|
||||
"%s\n"
|
||||
"High Jobs pending: %d\n"
|
||||
"Med Jobs Pending: %d\n"
|
||||
"Low Jobs Pending: %d\n"
|
||||
"Average wait in High Q in milliseconds: %lf\n"
|
||||
"Average wait in Med Q in milliseconds: %lf\n"
|
||||
"Average wait in Low Q in milliseconds: %lf\n"
|
||||
"Max Threads Used: %d\n"
|
||||
"Worker Threads: %d\n"
|
||||
"Persistent Threads: %d\n"
|
||||
"Idle Threads: %d\n"
|
||||
"Total Threads: %d\n"
|
||||
"Total Work Time: %lf\n"
|
||||
"Total Idle Time: %lf\n",
|
||||
msg,
|
||||
stats.currentJobsHQ,
|
||||
stats.currentJobsMQ,
|
||||
stats.currentJobsLQ,
|
||||
stats.avgWaitHQ,
|
||||
stats.avgWaitMQ,
|
||||
stats.avgWaitLQ,
|
||||
stats.maxThreads,
|
||||
stats.workerThreads,
|
||||
stats.persistentThreads,
|
||||
stats.idleThreads,
|
||||
stats.totalThreads,
|
||||
stats.totalWorkTime,
|
||||
stats.totalIdleTime);
|
||||
}
|
||||
#else /* DEBUG */
|
||||
static UPNP_INLINE void
|
||||
PrintThreadPoolStats(
|
||||
ThreadPool *tp,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char *msg)
|
||||
{
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: UpnpFinish
|
||||
*
|
||||
* Parameters: NONE
|
||||
*
|
||||
* Description:
|
||||
* Checks for pending jobs and threads
|
||||
* Unregisters either the client or device
|
||||
* Shuts down the Timer Thread
|
||||
* Stops the Mini Server
|
||||
* Uninitializes the Thread Pool
|
||||
* For Win32 cleans up Winsock Interface
|
||||
* Cleans up mutex objects
|
||||
*
|
||||
* Return Values:
|
||||
* UPNP_E_SUCCESS on success, nonzero on failure.
|
||||
*****************************************************************************/
|
||||
int
|
||||
UpnpFinish()
|
||||
/******************************************************************************/
|
||||
int UpnpFinish()
|
||||
{
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
UpnpDevice_Handle device_handle;
|
||||
UpnpDevice_Handle device_handle;
|
||||
#endif
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
UpnpClient_Handle client_handle;
|
||||
UpnpClient_Handle client_handle;
|
||||
#endif
|
||||
struct Handle_Info *temp;
|
||||
struct Handle_Info *temp;
|
||||
|
||||
#ifdef WIN32
|
||||
// WSACleanup();
|
||||
// WSACleanup();
|
||||
#endif
|
||||
|
||||
if( UpnpSdkInit != 1 ) {
|
||||
return UPNP_E_FINISH;
|
||||
}
|
||||
if( UpnpSdkInit != 1 ) {
|
||||
return UPNP_E_FINISH;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Inside UpnpFinish : UpnpSdkInit is :%d:\n", UpnpSdkInit );
|
||||
if( UpnpSdkInit == 1 ) {
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"UpnpFinish : UpnpSdkInit is ONE\n" );
|
||||
}
|
||||
PrintThreadPoolStats(&gSendThreadPool, __FILE__, __LINE__, "Send Thread Pool");
|
||||
PrintThreadPoolStats(&gRecvThreadPool, __FILE__, __LINE__, "Recv Thread Pool");
|
||||
PrintThreadPoolStats(&gMiniServerThreadPool, __FILE__, __LINE__, "MiniServer Thread Pool");
|
||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Inside UpnpFinish: UpnpSdkInit is %d\n", UpnpSdkInit);
|
||||
if (UpnpSdkInit == 1) {
|
||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"UpnpFinish: UpnpSdkInit is ONE\n");
|
||||
}
|
||||
PrintThreadPoolStats(&gSendThreadPool, __FILE__, __LINE__, "Send Thread Pool");
|
||||
PrintThreadPoolStats(&gRecvThreadPool, __FILE__, __LINE__, "Recv Thread Pool");
|
||||
PrintThreadPoolStats(&gMiniServerThreadPool, __FILE__, __LINE__, "MiniServer Thread Pool");
|
||||
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
if( GetDeviceHandleInfo( AF_INET, &device_handle, &temp ) == HND_DEVICE )
|
||||
UpnpUnRegisterRootDevice( device_handle );
|
||||
if( GetDeviceHandleInfo( AF_INET6, &device_handle, &temp ) == HND_DEVICE )
|
||||
UpnpUnRegisterRootDevice( device_handle );
|
||||
if (GetDeviceHandleInfo(AF_INET, &device_handle, &temp) == HND_DEVICE ) {
|
||||
UpnpUnRegisterRootDevice(device_handle);
|
||||
}
|
||||
if (GetDeviceHandleInfo(AF_INET6, &device_handle, &temp) == HND_DEVICE ) {
|
||||
UpnpUnRegisterRootDevice(device_handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
if( GetClientHandleInfo( &client_handle, &temp ) == HND_CLIENT )
|
||||
UpnpUnRegisterClient( client_handle );
|
||||
if (GetClientHandleInfo(&client_handle, &temp) == HND_CLIENT) {
|
||||
UpnpUnRegisterClient( client_handle );
|
||||
}
|
||||
#endif
|
||||
|
||||
TimerThreadShutdown( &gTimerThread );
|
||||
StopMiniServer();
|
||||
TimerThreadShutdown(&gTimerThread);
|
||||
StopMiniServer();
|
||||
|
||||
#if EXCLUDE_WEB_SERVER == 0
|
||||
web_server_destroy();
|
||||
web_server_destroy();
|
||||
#endif
|
||||
|
||||
ThreadPoolShutdown(&gMiniServerThreadPool);
|
||||
ThreadPoolShutdown(&gRecvThreadPool);
|
||||
ThreadPoolShutdown(&gSendThreadPool);
|
||||
ThreadPoolShutdown(&gMiniServerThreadPool);
|
||||
ThreadPoolShutdown(&gRecvThreadPool);
|
||||
ThreadPoolShutdown(&gSendThreadPool);
|
||||
|
||||
PrintThreadPoolStats(&gSendThreadPool, __FILE__, __LINE__, "Send Thread Pool");
|
||||
PrintThreadPoolStats(&gRecvThreadPool, __FILE__, __LINE__, "Recv Thread Pool");
|
||||
PrintThreadPoolStats(&gMiniServerThreadPool, __FILE__, __LINE__, "MiniServer Thread Pool");
|
||||
PrintThreadPoolStats(&gSendThreadPool, __FILE__, __LINE__, "Send Thread Pool");
|
||||
PrintThreadPoolStats(&gRecvThreadPool, __FILE__, __LINE__, "Recv Thread Pool");
|
||||
PrintThreadPoolStats(&gMiniServerThreadPool, __FILE__, __LINE__, "MiniServer Thread Pool");
|
||||
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
ithread_mutex_destroy(&GlobalClientSubscribeMutex);
|
||||
ithread_mutex_destroy(&GlobalClientSubscribeMutex);
|
||||
#endif
|
||||
ithread_rwlock_destroy(&GlobalHndRWLock);
|
||||
ithread_mutex_destroy(&gUUIDMutex);
|
||||
ithread_rwlock_destroy(&GlobalHndRWLock);
|
||||
ithread_mutex_destroy(&gUUIDMutex);
|
||||
|
||||
// remove all virtual dirs
|
||||
UpnpRemoveAllVirtualDirs();
|
||||
// remove all virtual dirs
|
||||
UpnpRemoveAllVirtualDirs();
|
||||
|
||||
// allow static linking
|
||||
// allow static linking
|
||||
#ifdef WIN32
|
||||
#ifdef PTW32_STATIC_LIB
|
||||
pthread_win32_thread_detach_np();
|
||||
pthread_win32_thread_detach_np();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
UpnpSdkInit = 0;
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Exiting UpnpFinish : UpnpSdkInit is :%d:\n", UpnpSdkInit);
|
||||
UpnpCloseLog();
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
UpnpSdkInit = 0;
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Exiting UpnpFinish : UpnpSdkInit is :%d:\n", UpnpSdkInit);
|
||||
UpnpCloseLog();
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
/*************************** End of UpnpFinish *****************************/
|
||||
|
||||
/******************************************************************************
|
||||
* Function: UpnpGetServerPort
|
||||
*
|
||||
* Parameters: NONE
|
||||
*
|
||||
* Description:
|
||||
* Gives back the IPv4 listening miniserver port.
|
||||
*
|
||||
* Return Values:
|
||||
* local port on success, zero on failure.
|
||||
*****************************************************************************/
|
||||
unsigned short
|
||||
UpnpGetServerPort( void )
|
||||
|
||||
/******************************************************************************/
|
||||
unsigned short UpnpGetServerPort()
|
||||
{
|
||||
if (UpnpSdkInit != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( UpnpSdkInit != 1 )
|
||||
return 0;
|
||||
|
||||
return LOCAL_PORT_V4;
|
||||
return LOCAL_PORT_V4;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Function: UpnpGetServerPort6
|
||||
*
|
||||
* Parameters: NONE
|
||||
*
|
||||
* Description:
|
||||
* Gives back the IPv6 listening miniserver port.
|
||||
*
|
||||
* Return Values:
|
||||
* local port on success, zero on failure.
|
||||
*****************************************************************************/
|
||||
unsigned short
|
||||
UpnpGetServerPort6( void )
|
||||
/******************************************************************************/
|
||||
unsigned short UpnpGetServerPort6()
|
||||
{
|
||||
if (UpnpSdkInit != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( UpnpSdkInit != 1 )
|
||||
return 0;
|
||||
|
||||
return LOCAL_PORT_V6;
|
||||
return LOCAL_PORT_V6;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Function: UpnpGetServerIpAddress
|
||||
*
|
||||
* Parameters: NONE
|
||||
*
|
||||
* Description:
|
||||
* Gives back the local IPv4 ipaddress.
|
||||
*
|
||||
* Return Values: char *
|
||||
* return the IPv4 address string on success else NULL of failure
|
||||
***************************************************************************/
|
||||
char *
|
||||
UpnpGetServerIpAddress( void )
|
||||
/*****************************************************************************/
|
||||
char *UpnpGetServerIpAddress()
|
||||
{
|
||||
if (UpnpSdkInit != 1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( UpnpSdkInit != 1 )
|
||||
return NULL;
|
||||
|
||||
return gIF_IPV4;
|
||||
return gIF_IPV4;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Function: UpnpGetServerIp6Address
|
||||
*
|
||||
* Parameters: NONE
|
||||
*
|
||||
* Description:
|
||||
* Gives back the local IPv6 ipaddress.
|
||||
*
|
||||
* Return Values: char *
|
||||
* return the IPv6 address string on success else NULL of failure
|
||||
***************************************************************************/
|
||||
char *
|
||||
UpnpGetServerIp6Address( void )
|
||||
/*****************************************************************************/
|
||||
char *UpnpGetServerIp6Address()
|
||||
{
|
||||
if( UpnpSdkInit != 1 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( UpnpSdkInit != 1 )
|
||||
return NULL;
|
||||
|
||||
return gIF_IPV6;
|
||||
return gIF_IPV6;
|
||||
}
|
||||
|
||||
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
#if 0
|
||||
|
||||
/****************************************************************************
|
||||
/*****************************************************************************
|
||||
* Function: UpnpAddRootDevice
|
||||
*
|
||||
* Parameters:
|
||||
@ -1497,29 +1341,11 @@ UpnpRegisterRootDevice3( IN const char *DescUrl,
|
||||
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
|
||||
/**************************************************************************
|
||||
* Function: UpnpRegisterClient
|
||||
*
|
||||
* Parameters:
|
||||
* IN Upnp_FunPtr Fun: Pointer to a function for receiving
|
||||
* asynchronous events.
|
||||
* IN const void * Cookie: Pointer to user data returned with the
|
||||
* callback function when invoked.
|
||||
* OUT UpnpClient_Handle *Hnd: Pointer to a variable to store
|
||||
* the new control point handle.
|
||||
*
|
||||
* Description:
|
||||
* This function registers a control point application with the
|
||||
* UPnP Library. A control point application cannot make any other API
|
||||
* calls until it registers using this function.
|
||||
*
|
||||
* Return Values: int
|
||||
*
|
||||
***************************************************************************/
|
||||
int
|
||||
UpnpRegisterClient( IN Upnp_FunPtr Fun,
|
||||
IN const void *Cookie,
|
||||
OUT UpnpClient_Handle * Hnd )
|
||||
/*****************************************************************************/
|
||||
int UpnpRegisterClient(
|
||||
IN Upnp_FunPtr Fun,
|
||||
IN const void *Cookie,
|
||||
OUT UpnpClient_Handle *Hnd)
|
||||
{
|
||||
struct Handle_Info *HInfo;
|
||||
|
||||
@ -1568,29 +1394,13 @@ UpnpRegisterClient( IN Upnp_FunPtr Fun,
|
||||
"Exiting UpnpRegisterClient \n" );
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
|
||||
} /****************** End of UpnpRegisterClient *********************/
|
||||
}
|
||||
#endif // INCLUDE_CLIENT_APIS
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: UpnpUnRegisterClient
|
||||
*
|
||||
* Parameters:
|
||||
* IN UpnpClient_Handle Hnd: The handle of the control point instance
|
||||
* to unregister
|
||||
* Description:
|
||||
* This function unregisters a client registered with
|
||||
* UpnpRegisterclient or UpnpRegisterclient2. After this call, the
|
||||
* UpnpDevice_Handle Hnd is no longer valid. The UPnP Library generates
|
||||
* no more callbacks after this function returns.
|
||||
*
|
||||
* Return Values:
|
||||
* UPNP_E_SUCCESS on success, nonzero on failure.
|
||||
*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
int
|
||||
UpnpUnRegisterClient( IN UpnpClient_Handle Hnd )
|
||||
int UpnpUnRegisterClient(IN UpnpClient_Handle Hnd)
|
||||
{
|
||||
struct Handle_Info *HInfo;
|
||||
ListNode *node = NULL;
|
||||
@ -1638,7 +1448,7 @@ UpnpUnRegisterClient( IN UpnpClient_Handle Hnd )
|
||||
"Exiting UpnpUnRegisterClient \n" );
|
||||
return UPNP_E_SUCCESS;
|
||||
|
||||
} /****************** End of UpnpUnRegisterClient *********************/
|
||||
}
|
||||
#endif // INCLUDE_CLIENT_APIS
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -5151,17 +4961,11 @@ UpnpFree( IN void *item )
|
||||
|
||||
/**************************************************************************
|
||||
* Function: UpnpSetContentLength
|
||||
* OBSOLETE METHOD : use {\bf UpnpSetMaxContentLength} instead.
|
||||
* OBSOLETE METHOD: use UpnpSetMaxContentLength() instead.
|
||||
***************************************************************************/
|
||||
int
|
||||
UpnpSetContentLength( IN UpnpClient_Handle Hnd,
|
||||
/** The handle of the device instance
|
||||
for which the coincoming content length needs
|
||||
to be set. */
|
||||
|
||||
IN int contentLength
|
||||
/** Permissible content length */
|
||||
)
|
||||
int UpnpSetContentLength(
|
||||
IN UpnpClient_Handle Hnd,
|
||||
IN int contentLength)
|
||||
{
|
||||
int errCode = UPNP_E_SUCCESS;
|
||||
struct Handle_Info *HInfo = NULL;
|
||||
|
@ -339,20 +339,6 @@ void UpnpDisplayFileAndLine(
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpDisplayBanner
|
||||
*
|
||||
* Parameters:
|
||||
* IN FILE *fd: file descriptor where the banner will be written
|
||||
* IN char **lines: The buffer that will be written
|
||||
* IN int size: Size of the buffer
|
||||
* IN int starLength: This parameter provides the width of the banner
|
||||
*
|
||||
* Description:
|
||||
* This functions takes the buffer and writes the buffer in the file as
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayBanner(
|
||||
IN FILE * fd,
|
||||
@ -408,3 +394,45 @@ void UpnpDisplayBanner(
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
void PrintThreadPoolStats(
|
||||
ThreadPool *tp,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char *msg)
|
||||
{
|
||||
ThreadPoolStats stats;
|
||||
ThreadPoolGetStats(tp, &stats);
|
||||
UpnpPrintf(UPNP_INFO, API, DbgFileName, DbgLineNo,
|
||||
"%s\n"
|
||||
"High Jobs pending: %d\n"
|
||||
"Med Jobs Pending: %d\n"
|
||||
"Low Jobs Pending: %d\n"
|
||||
"Average wait in High Q in milliseconds: %lf\n"
|
||||
"Average wait in Med Q in milliseconds: %lf\n"
|
||||
"Average wait in Low Q in milliseconds: %lf\n"
|
||||
"Max Threads Used: %d\n"
|
||||
"Worker Threads: %d\n"
|
||||
"Persistent Threads: %d\n"
|
||||
"Idle Threads: %d\n"
|
||||
"Total Threads: %d\n"
|
||||
"Total Work Time: %lf\n"
|
||||
"Total Idle Time: %lf\n",
|
||||
msg,
|
||||
stats.currentJobsHQ,
|
||||
stats.currentJobsMQ,
|
||||
stats.currentJobsLQ,
|
||||
stats.avgWaitHQ,
|
||||
stats.avgWaitMQ,
|
||||
stats.avgWaitLQ,
|
||||
stats.maxThreads,
|
||||
stats.workerThreads,
|
||||
stats.persistentThreads,
|
||||
stats.idleThreads,
|
||||
stats.totalThreads,
|
||||
stats.totalWorkTime,
|
||||
stats.totalIdleTime);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define VIRTUALDIR_H
|
||||
|
||||
|
||||
/** The {\bf VirtualDirCallbacks} structure contains the pointers to
|
||||
/** The \b VirtualDirCallbacks structure contains the pointers to
|
||||
* file-related callback functions a device application can register to
|
||||
* virtualize URLs.
|
||||
*/
|
||||
@ -16,43 +16,41 @@ struct VirtualDirCallbacks
|
||||
|
||||
/** Called by the web server to open a file. The callback should return
|
||||
* a valid handle if the file can be opened. Otherwise, it should return
|
||||
* {\tt NULL} to signify an error. */
|
||||
* \c NULL to signify an error. */
|
||||
VDCallback_Open open;
|
||||
|
||||
/** Called by the web server to perform a sequential read from an open
|
||||
* file. The callback should copy {\bf buflen} bytes from the file into
|
||||
* file. The callback should copy \b buflen bytes from the file into
|
||||
* the buffer.
|
||||
* @return [int] An integer representing one of the following:
|
||||
* \begin{itemize}
|
||||
* \item {\tt 0}: The file contains no more data (EOF).
|
||||
* \item {\tt >0}: A successful read of the number of bytes in the
|
||||
* return code.
|
||||
* \item {\tt <0}: An error occurred reading the file.
|
||||
* \end{itemzie}
|
||||
* @return An integer representing one of the following:
|
||||
* \li <tt> 0</tt>: The file contains no more data (EOF).
|
||||
* \li <tt> > 0</tt>: A successful read of the number of bytes in the
|
||||
* return code.
|
||||
* \li <tt> < 0</tt>: An error occurred reading the file.
|
||||
*/
|
||||
VDCallback_Read read;
|
||||
|
||||
/** Called by the web server to perform a sequential write to an open
|
||||
* file. The callback should write {\bf buflen} bytes into the file from
|
||||
* file. The callback should write \b buflen bytes into the file from
|
||||
* the buffer. It should return the actual number of bytes written,
|
||||
* which might be less than {\bf buflen} in the case of a write error.
|
||||
* which might be less than \b buflen in the case of a write error.
|
||||
*/
|
||||
VDCallback_Write write;
|
||||
|
||||
/** Called by the web server to move the file pointer, or offset, into
|
||||
* an open file. The {\bf origin} parameter determines where to start
|
||||
* moving the file pointer. A value of {\tt SEEK_CUR} moves the
|
||||
* file pointer relative to where it is. The {\bf offset} parameter can
|
||||
* an open file. The \b origin parameter determines where to start
|
||||
* moving the file pointer. A value of \c SEEK_CUR moves the
|
||||
* file pointer relative to where it is. The \b offset parameter can
|
||||
* be either positive (move forward) or negative (move backward).
|
||||
* {\tt SEEK_END} moves relative to the end of the file. A positive
|
||||
* {\bf offset} extends the file. A negative {\bf offset} moves backward
|
||||
* in the file. Finally, {\tt SEEK_SET} moves to an absolute position in
|
||||
* the file. In this case, {\bf offset} must be positive. The callback
|
||||
* \c SEEK_END moves relative to the end of the file. A positive
|
||||
* \b offset extends the file. A negative \b offset moves backward
|
||||
* in the file. Finally, \c SEEK_SET moves to an absolute position in
|
||||
* the file. In this case, \b offset must be positive. The callback
|
||||
* should return 0 on a successful seek or a non-zero value on an error.
|
||||
*/
|
||||
VDCallback_Seek seek;
|
||||
|
||||
/** Called by the web server to close a file opened via the {\bf open}
|
||||
/** Called by the web server to close a file opened via the \b open
|
||||
* callback. It should return 0 on success, or a non-zero value on an
|
||||
* error.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user