UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
upnpdebug.hpp
Go to the documentation of this file.
1#ifndef COMPA_DEBUG_HPP
2#define COMPA_DEBUG_HPP
3/*******************************************************************************
4 *
5 * Copyright (c) 2000-2003 Intel Corporation
6 * Copyright (c) 2006 Rémi Turboult <r3mi@users.sourceforge.net>
7 * All rights reserved.
8 * Copyright (C) 2022+ GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
9 * Redistribution only with this Copyright remark. Last modified: 2025-07-16
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions are met:
13 *
14 * - Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * - Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * - Neither name of Intel Corporation nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
31 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************/
36// Last compare with ./Pupnp source file on 2025-07-16, ver 1.14.21
42#include <upnp.hpp> // for UPNP_E_SUCCESS
44#include <stdio.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif /* __cplusplus */
50
51/* ! \name Other debugging features
52 *
53 * The UPnP SDK contains other features to aid in debugging.
54 * @{
55 */
56
59typedef enum Upnp_Module {
60 SSDP,
61 SOAP,
62 GENA,
63 TPOOL,
64 MSERV,
65 DOM,
66 API,
67 HTTP
70
72
88typedef enum Upnp_LogLevel_e {
89 UPNP_CRITICAL,
90 UPNP_ERROR,
91 UPNP_INFO,
92 UPNP_ALL,
93 /* Always the last, please. */
94 UPNP_NEVER
97
101#define UPNP_PACKET UPNP_ERROR
102
104#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
105
111UPnPsdk_VIS int UpnpInitLog(void);
112
113#if defined NDEBUG && !defined UPNP_DEBUG_C
114#define UpnpInitLog UpnpInitLog_Inlined
115static inline int UpnpInitLog_Inlined(void) { return UPNP_E_SUCCESS; }
116#endif
122 Upnp_LogLevel log_level);
123
124#if defined NDEBUG && !defined UPNP_DEBUG_C
125#define UpnpSetLogLevel UpnpSetLogLevel_Inlined
126static inline void UpnpSetLogLevel_Inlined(Upnp_LogLevel log_level) {
127 (void)log_level;
128 return;
129}
130#endif
131
135UPnPsdk_VIS void UpnpCloseLog(void);
136
137#if defined NDEBUG && !defined UPNP_DEBUG_C
138#define UpnpCloseLog UpnpCloseLog_Inlined
139static inline void UpnpCloseLog_Inlined(void) {}
140#endif
141
149 const char* fileName,
151 const char* Ignored);
152
153#if defined NDEBUG && !defined UPNP_DEBUG_C
154#define UpnpSetLogFileNames UpnpSetLogFileNames_Inlined
155static inline void UpnpSetLogFileNames_Inlined(const char* ErrFileName,
156 const char* ignored) {
157 (void)ErrFileName;
158 (void)ignored;
159 return;
160}
161#endif
162
174 Upnp_LogLevel DLevel,
176 Dbg_Module Module);
177
179#if (defined NDEBUG && !defined UPNP_DEBUG_C)
180#define UpnpGetDebugFile UpnpGetDebugFile_Inlined
181static inline FILE* UpnpGetDebugFile_Inlined(Upnp_LogLevel level,
182 Dbg_Module module) {
183 (void)level, (void)module;
184 return NULL;
185}
186#endif
188
200 Upnp_LogLevel DLevel,
202 Dbg_Module Module,
204 const char* DbgFileName,
207 int DbgLineNo,
209 const char* FmtStr,
212 ...)
213#if (__GNUC__ >= 3)
214 /* This enables printf like format checking by the compiler. */
215 __attribute__((format(__printf__, 5, 6)))
216#endif
217 ;
218
219#if defined NDEBUG && !defined UPNP_DEBUG_C
220#define UpnpPrintf UpnpPrintf_Inlined
221// static inline void UpnpPrintf_Inlined(Upnp_LogLevel DLevel,
222// Dbg_Module Module,
223// const char *DbgFileName,
224// int DbgLineNo,
225// const char *FmtStr,
226// ...)
227// #if (__GNUC__ >= 3)
228// /* This enables printf like format checking by the compiler. */
229// __attribute__((format(__printf__, 5, 6)))
230// #endif
231// ;
232static inline void UpnpPrintf_Inlined(Upnp_LogLevel DLevel, Dbg_Module Module,
233 const char* DbgFileName, int DbgLineNo,
234 const char* FmtStr, ...) {
235 (void)DLevel;
236 (void)Module;
237 (void)DbgFileName;
238 (void)DbgLineNo;
239 (void)FmtStr;
240 return;
241}
242#endif /* DEBUG */
243
244#ifdef __cplusplus
245}
246#endif /* __cplusplus */
247
248#endif // COMPA_DEBUG_HPP
#define UPNP_E_SUCCESS
The operation completed successfully.
Definition messages.hpp:27
static char * fileName
Definition upnpdebug.cpp:71
enum Upnp_Module Dbg_Module
Only debug messages from this program module.
Upnp_Module
Only debug messages from this program module.
Definition upnpdebug.hpp:59
UPnPsdk_VIS 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...
UPnPsdk_VIS 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 ...
UPnPsdk_VIS void UpnpPrintf(Upnp_LogLevel DLevel, Dbg_Module Module, const char *DbgFileName, int DbgLineNo, const char *FmtStr,...)
Prints the debug statement.
UPnPsdk_VIS int UpnpInitLog(void)
Initialize the log files.
Definition upnpdebug.cpp:77
UPnPsdk_VIS void UpnpSetLogLevel(Upnp_LogLevel log_level)
Set the log level (see Upnp_LogLevel).
Upnp_LogLevel_e
Upnp_LogLevel.
Definition upnpdebug.hpp:88
UPnPsdk_VIS void UpnpCloseLog(void)
Closes the log files.
enum Upnp_LogLevel_e Upnp_LogLevel
Upnp_LogLevel.
#define UPnPsdk_VIS
Prefix to export symbol for external use.