upnpdebug.h File Reference
`#include "UpnpGlobal.h"`
`#include "upnpconfig.h"`
`#include <stdio.h>`
Include dependency graph for upnpdebug.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Upnp_LogLevel

The user has the option to select 4 different types of debugging levels, see `UpnpSetLogLevel`. The critical level will show only those messages which can halt the normal processing of the library, like memory allocation errors. The remaining three levels are just for debugging purposes. Error will show recoverable errors. Info Level displays the other important operational information regarding the working of the library. If the user selects All, then the library displays all the debugging information that it has.

- `UPNP_CRITICAL` [0]
- `UPNP_ERROR` [1]
- `UPNP_INFO` [2]
- `UPNP_ALL` [3]

#define | UPNP_PACKET UPNP_ERROR
#define | UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
enum | Upnp_Module { SSDP , SOAP , GENA , TPOOL , MSERV , DOM , API , HTTP }
enum | Upnp_LogLevel_e { UPNP_CRITICAL , UPNP_ERROR , UPNP_INFO , UPNP_ALL , UPNP_NEVER }
typedef enum Upnp_Module | Dbg_Module
typedef enum Upnp_LogLevel_e | Upnp_LogLevel
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 *fileName, const char *Ignored)
| Set the name for the log file. There used to be 2 separate files. The second parameter has been kept for compatibility but is ignored. Use a NULL file name for logging to stderr.
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.
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.

## Macro Definition Documentation

## UPNP_DEFAULT_LOG_LEVEL

#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL

Default log level : see `Upnp_LogLevel`

## Function Documentation

## UpnpCloseLog()

void UpnpCloseLog | ( | void |  | ) |

Closes the log files.

References GlobalDebugMutex.

Referenced by UpnpFinish().

## UpnpGetDebugFile()

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.

Returns
  NULL if the module is turn off for debug otherwise returns the right FILE pointer.

Parameters

  [in] | level | 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.

## UpnpInitLog()

int UpnpInitLog | ( | void |  | ) |

Initialize the log files.

Returns
  -1 if fails or UPNP_E_SUCCESS if succeeds.

References GlobalDebugMutex, and UPNP_E_SUCCESS.

Referenced by TvDeviceStart(), and UpnpInitPreamble().

## UpnpPrintf()

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.

Parameters

  [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.
  [in] | ... | Printf like Variable number of arguments that will go in the debug statement.

References GlobalDebugMutex.

Referenced by AdvertiseAndReply(), AllocGenaHeaders(), create_ssdp_sock_reqv4(), create_ssdp_sock_v4(), DeviceAdvertisement(), DeviceShutdown(), FreeHandle(), gena_process_subscription_renewal_request(), gena_process_subscription_request(), gena_validate_delivery_urls(), GenaAutoRenewSubscription(), genaCallback(), genaInitNotify(), genaInitNotifyExt(), genaNotifyAll(), genaNotifyAllExt(), genaRenewSubscription(), genaSubscribe(), genaUnregisterDevice(), get_file_info(), get_miniserver_stopsock(), get_port(), GetHandleInfo(), handle_invoke_action(), handle_query_variable(), http_Connect(), http_MakeMessage(), http_ReadHttpResponse(), http_RecvMessage(), http_RecvPostMessage(), http_SendMessage(), NewRequestHandler(), notify_send_and_recv(), print_http_headers(), PrintHandleInfo(), printService(), printServiceList(), printServiceTable(), PrintThreadPoolStats(), readFromSSDPSocket(), RunMiniServer(), SearchByTarget(), send_action_response(), SendToCaller(), ServiceAdvertisement(), ServiceShutdown(), sock_destroy(), ssdp_handle_device_request(), start_event_handler(), StopMiniServer(), UpnpAcceptSubscription(), UpnpAcceptSubscriptionExt(), UpnpDownloadXmlDoc(), UpnpFinish(), UpnpGetIfInfo(), UpnpInit2(), UpnpInitPreamble(), UpnpInitStartServers(), UpnpNotify(), UpnpNotifyExt(), UpnpRegisterClient(), UpnpRegisterRootDevice(), UpnpRegisterRootDevice2(), UpnpRegisterRootDevice3(), UpnpRegisterRootDevice4(), UpnpRenewSubscription(), UpnpRenewSubscriptionAsync(), UpnpSetMaxSubscriptions(), UpnpSetMaxSubscriptionTimeOut(), UpnpSubscribe(), UpnpSubscribeAsync(), UpnpThreadDistribution(), UpnpUnRegisterClient(), UpnpUnRegisterRootDevice(), UpnpUnRegisterRootDeviceLowPower(), UpnpUnSubscribe(), UpnpUnSubscribeAsync(), valid_ssdp_msg(), and web_server_callback().

## UpnpSetLogFileNames()

void UpnpSetLogFileNames | ( | const char * | fileName,
|  | const char * | Ignored )

Set the name for the log file. There used to be 2 separate files. The second parameter has been kept for compatibility but is ignored. Use a NULL file name for logging to stderr.

Parameters

  [in] | fileName | Name of the log file.
  [in] | Ignored | Ignored.

Referenced by TvDeviceStart().

## UpnpSetLogLevel()

void UpnpSetLogLevel | ( | Upnp_LogLevel | log_level | ) |

Set the log level (see `Upnp_LogLevel`).

Parameters

  [in] | log_level | Log level.

References g_log_level.

Referenced by TvDeviceStart().