libUPnP
1.6.17
|
#include "config.h"
#include "ithread.h"
#include "ixml.h"
#include "upnp.h"
#include "upnpdebug.h"
#include <libgen.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Functions | |
int | UpnpInitLog (void) |
Initialize the log files. | |
void | UpnpSetLogLevel (Upnp_LogLevel log_level) |
Set the log level (see Upnp_LogLevel ). | |
void | UpnpCloseLog (void) |
Closes the log files. | |
void | UpnpSetLogFileNames (const char *ErrFileName, const char *InfoFileName) |
Set the name for error and information files, respectively. | |
int | DebugAtThisLevel (Upnp_LogLevel DLevel, Dbg_Module Module) |
Returns true if debug output should be done in this module. | |
void | UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...) |
Prints the debug statement either on the standard output or log file along with the information from where this debug statement is coming. | |
FILE * | UpnpGetDebugFile (Upnp_LogLevel DLevel, Dbg_Module Module) |
Check if the module is turned on for debug and returns the file descriptor corresponding to the debug level. | |
void | UpnpDisplayFileAndLine (FILE *fd, const char *DbgFileName, int DbgLineNo) |
Writes the file name and file number from where debug statement is coming to the log file. | |
Variables | |
static ithread_mutex_t | GlobalDebugMutex |
static Upnp_LogLevel | g_log_level = UPNP_DEFAULT_LOG_LEVEL |
static FILE * | ErrFileHnd = NULL |
static FILE * | InfoFileHnd = NULL |
static const char * | errFileName = NULL |
static const char * | infoFileName = NULL |
int DebugAtThisLevel | ( | Upnp_LogLevel | DLevel, |
Dbg_Module | Module | ||
) |
Returns true if debug output should be done in this module.
[in] | DLevel | The level of the debug logging. It will decide whether debug statement will go to standard output, or any of the log files. |
[in] | Module | Debug will go in the name of this module. |
References g_log_level.
Referenced by UpnpGetDebugFile(), and UpnpPrintf().
void UpnpCloseLog | ( | void | ) |
Closes the log files.
References ErrFileHnd, GlobalDebugMutex, and InfoFileHnd.
Referenced by UpnpFinish().
void UpnpDisplayFileAndLine | ( | FILE * | fd, |
const char * | DbgFileName, | ||
int | DbgLineNo | ||
) |
Writes the file name and file number from where debug statement is coming to the log file.
[in] | fd | File descriptor where line number and file name will be written. |
[in] | DbgFileName | Name of the file. |
[in] | DbgLineNo | Line number of the file. |
Referenced by UpnpPrintf().
FILE* UpnpGetDebugFile | ( | Upnp_LogLevel | level, |
Dbg_Module | module | ||
) |
Check if the module is turned on for debug and returns the file descriptor corresponding to the debug level.
[in] | DLevel | The level of the debug logging. It will decide whether debug statement will go to standard output, or any of the log files. |
[in] | Module | debug will go in the name of this module. |
References DebugAtThisLevel(), ErrFileHnd, and InfoFileHnd.
int UpnpInitLog | ( | void | ) |
Initialize the log files.
References ErrFileHnd, errFileName, GlobalDebugMutex, InfoFileHnd, infoFileName, and UPNP_E_SUCCESS.
Referenced by UpnpInitPreamble().
void UpnpPrintf | ( | Upnp_LogLevel | DLevel, |
Dbg_Module | Module, | ||
const char * | DbgFileName, | ||
int | DbgLineNo, | ||
const char * | FmtStr, | ||
... | |||
) |
Prints the debug statement either on the standard output or log file along with the information from where this debug statement is coming.
[in] | DLevel | The level of the debug logging. It will decide whether debug statement will go to standard output, or any of the log files. |
[in] | Module | debug will go in the name of this module. |
[in] | DbgFileName | Name of the file from where debug statement is coming. |
[in] | DbgLineNo | Line number of the file from where debug statement is coming. |
[in] | FmtStr | Printf like format specification. |
References DebugAtThisLevel(), ErrFileHnd, GlobalDebugMutex, InfoFileHnd, and UpnpDisplayFileAndLine().
Referenced by AdvertiseAndReply(), AllocGenaHeaders(), Check_Connect_And_Wait_Connection(), create_ssdp_sock_reqv4(), create_ssdp_sock_v4(), DeviceAdvertisement(), DeviceShutdown(), FreeHandle(), gena_process_subscription_renewal_request(), gena_process_subscription_request(), GenaAutoRenewSubscription(), genaInitNotify(), genaInitNotifyExt(), genaNotifyAll(), genaNotifyAllExt(), genaRenewSubscription(), genaSubscribe(), genaUnregisterDevice(), get_action_node(), get_file_info(), get_miniserver_stopsock(), get_port(), get_var_name(), GetHandleInfo(), getlocalhostname(), handle_invoke_action(), handle_query_variable(), http_RecvMessage(), http_RecvPostMessage(), http_SendMessage(), NewRequestHandler(), notify_send_and_recv(), Param_delete(), PrintHandleInfo(), printService(), printServiceList(), printServiceTable(), PrintThreadPoolStats(), readFromSSDPSocket(), remove_dots(), RunMiniServer(), SearchByTarget(), send_action_response(), ServiceAdvertisement(), ServiceShutdown(), sock_destroy(), ssdp_handle_device_request(), start_event_handler(), StopMiniServer(), UpnpAcceptSubscription(), UpnpAcceptSubscriptionExt(), UpnpDownloadXmlDoc(), UpnpFinish(), UpnpGetIfInfo(), UpnpGetServiceVarStatus(), UpnpGetServiceVarStatusAsync(), UpnpInit(), UpnpInitPreamble(), UpnpInitStartServers(), UpnpNotify(), UpnpNotifyExt(), UpnpRegisterClient(), UpnpRegisterRootDevice(), UpnpRegisterRootDevice2(), UpnpRegisterRootDevice3(), UpnpRegisterRootDevice4(), UpnpRenewSubscription(), UpnpRenewSubscriptionAsync(), UpnpSearchAsync(), UpnpSendAction(), UpnpSendActionAsync(), UpnpSendActionEx(), UpnpSendActionExAsync(), UpnpSendAdvertisement(), UpnpSendAdvertisementLowPower(), UpnpSetMaxSubscriptions(), UpnpSetMaxSubscriptionTimeOut(), UpnpSubscribe(), UpnpSubscribeAsync(), UpnpThreadDistribution(), UpnpUnRegisterClient(), UpnpUnRegisterRootDevice(), UpnpUnRegisterRootDeviceLowPower(), UpnpUnSubscribe(), UpnpUnSubscribeAsync(), and valid_ssdp_msg().
void UpnpSetLogFileNames | ( | const char * | ErrFileName, |
const char * | InfoFileName | ||
) |
Set the name for error and information files, respectively.
[in] | ErrFileName | Name of the error file. |
[in] | InfoFileName | Name of the information file. |
References errFileName, and infoFileName.
void UpnpSetLogLevel | ( | Upnp_LogLevel | log_level | ) |
FILE* ErrFileHnd = NULL [static] |
File handle for the error log file
Referenced by UpnpCloseLog(), UpnpGetDebugFile(), UpnpInitLog(), and UpnpPrintf().
const char* errFileName = NULL [static] |
Name of the error file
Referenced by UpnpInitLog(), and UpnpSetLogFileNames().
Upnp_LogLevel g_log_level = UPNP_DEFAULT_LOG_LEVEL [static] |
Global log level
Referenced by DebugAtThisLevel(), and UpnpSetLogLevel().
ithread_mutex_t GlobalDebugMutex [static] |
Mutex to synchronize all the log file opeartions in the debug mode
Referenced by UpnpCloseLog(), UpnpInitLog(), and UpnpPrintf().
FILE* InfoFileHnd = NULL [static] |
File handle for the information log file
Referenced by UpnpCloseLog(), UpnpGetDebugFile(), UpnpInitLog(), and UpnpPrintf().
const char* infoFileName = NULL [static] |
Name of the info file
Referenced by UpnpInitLog(), and UpnpSetLogFileNames().