/*++
Copyright (c) 1995 Microsoft Corporation
Module Name:
net\ip\rtrmgr\logtrdefs.c
Abstract:
IP Router Manager defines for tracing and logging
Revision History:
Gurdeep Singh Pall 6/16/95 Created
--*/
#ifndef __LOGTRDEF_H__
#define __LOGTRDEF_H__
//
// constants and macros used for tracing
//
#define SAMP_TRACE_ANY ((DWORD)0xFFFF0000 | TRACE_USE_MASK)
#define SAMP_TRACE_ERR SAMP_TRACE_ANY
#define SAMP_TRACE_ENTER ((DWORD)0x00010000 | TRACE_USE_MASK)
#define SAMP_TRACE_INTF ((DWORD)0x00020000 | TRACE_USE_MASK)
#define SAMP_TRACE_GLOBAL ((DWORD)0x00040000 | TRACE_USE_MASK)
#define SAMP_TRACE_ROUTE ((DWORD)0x00080000 | TRACE_USE_MASK)
#define TRACEID g_dwTrace
#define Trace0(l,a) \
TracePrintfEx(TRACEID, SAMP_TRACE_ ## l, a)
#define Trace1(l,a,b) \
TracePrintfEx(TRACEID, SAMP_TRACE_ ## l, a, b)
#define Trace2(l,a,b,c) \
TracePrintfEx(TRACEID, SAMP_TRACE_ ## l, a, b, c)
#define Trace3(l,a,b,c,d) \
TracePrintfEx(TRACEID, SAMP_TRACE_ ## l, a, b, c, d)
#define Trace4(l,a,b,c,d,e) \
TracePrintfEx(TRACEID, SAMP_TRACE_ ## l, a, b, c, d, e)
#define Trace5(l,a,b,c,d,e,f) \
TracePrintfEx(TRACEID, SAMP_TRACE_ ## l, a, b, c, d, e, f)
#define Trace6(l,a,b,c,d,e,f,g) \
TracePrintfEx(TRACEID, SAMP_TRACE_ ## l, a, b, c, d, e, f, g)
#define Trace7(l,a,b,c,d,e,f,g,h) \
TracePrintfEx(TRACEID, SAMP_TRACE_ ## l, a, b, c, d, e, f, g, h)
#if DBG
#define TraceEnter(X) TracePrintfEx(TRACEID, SAMP_TRACE_ENTER, "Entered: "X)
#define TraceLeave(X) TracePrintfEx(TRACEID, SAMP_TRACE_ENTER, "Leaving: "X"\n")
#else // DBG
#define TraceEnter(X)
#define TraceLeave(X)
#endif // DBG
//
// Event logging macros
//
#define LOGLEVEL g_dwLogLevel
#define LOGHANDLE g_hLogHandle
#define LOGERR RouterLogError
#define LOGERRDATA RouterLogErrorData
#define LOGWARN RouterLogWarning
#define LOGWARNDATA RouterLogWarningData
#define LOGINFO RouterLogInformation
#define LOGINFODATA RouterLogInformationData
//
// Error logging
//
//
// VOID
// Log{Err|Warn|Info}{NumArgs}(
// DWORD dwLogMsgId,
// PSTR pszInsertString1,
// ....
// PSTR pszInsertString{NumArgs},
// DWORD dwErrorCode
// );
//
// VOID
// Log{Err|Warn|Info}Data{NumArgs}(
// DWORD dwLogMsgId,
// PSTR pszInsertString1,
// ....
// PSTR pszInsertString{NumArgs},
// DWORD dwDataSize,
// PBYTE pbData
// );
//
#define LogErr0(msg,err) \
if (LOGLEVEL >= PROTO_LOGGING_ERROR) \
LOGERR(LOGHANDLE,SAMPLOG_ ## msg,0,NULL,(err))
#define LogErr1(msg,a,err) \
if (LOGLEVEL >= PROTO_LOGGING_ERROR) \
LOGERR(LOGHANDLE,SAMPLOG_ ## msg,1,&(a),(err))
#define LogErr2(msg,a,b,err) \
if (LOGLEVEL >= PROTO_LOGGING_ERROR) { \
LPSTR _asz[2] = { (a), (b) }; \
LOGERR(LOGHANDLE,SAMPLOG_ ## msg,2,_asz,(err)); \
}
#define LogErr3(msg,a,b,c,err) \
if (LOGLEVEL >= PROTO_LOGGING_ERROR) { \
LPSTR _asz[3] = { (a), (b), (c) }; \
LOGERR(LOGHANDLE,SAMPLOG_ ## msg,3,_asz,(err)); \
}
#define LogErr4(msg,a,b,c,d,err) \
if (LOGLEVEL >= PROTO_LOGGING_ERROR) { \
LPSTR _asz[4] = { (a), (b), (c), (d) }; \
LOGERR(LOGHANDLE,SAMPLOG_ ## msg,4,_asz,(err)); \
}
// Warning logging
#define LogWarn0(msg,err) \
if (LOGLEVEL >= PROTO_LOGGING_WARN) \
LOGWARN(LOGHANDLE,SAMPLOG_ ## msg,0,NULL,(err))
#define LogWarn1(msg,a,err) \
if (LOGLEVEL >= PROTO_LOGGING_WARN) \
LOGWARN(LOGHANDLE,SAMPLOG_ ## msg,1,&(a),(err))
#define LogWarn2(msg,a,b,err) \
if (LOGLEVEL >= PROTO_LOGGING_WARN) { \
LPSTR _asz[2] = { (a), (b) }; \
LOGWARN(LOGHANDLE,SAMPLOG_ ## msg,2,_asz,(err)); \
}
#define LogWarn3(msg,a,b,c,err) \
if (LOGLEVEL >= PROTO_LOGGING_WARN) { \
LPSTR _asz[3] = { (a), (b), (c) }; \
LOGWARN(LOGHANDLE,SAMPLOG_ ## msg,3,_asz,(err)); \
}
#define LogWarn4(msg,a,b,c,d,err) \
if (LOGLEVEL >= PROTO_LOGGING_WARN) { \
LPSTR _asz[4] = { (a), (b), (c), (d) }; \
LOGWARN(LOGHANDLE,SAMPLOG_ ## msg,4,_asz,(err)); \
}
#define LogWarnData2(msg,a,b,dw,buf) \
if (LOGLEVEL >= PROTO_LOGGING_WARN) { \
LPSTR _asz[2] = { (a), (b) }; \
LOGWARNDATA(LOGHANDLE,SAMPLOG_ ## msg,2,_asz,(dw),(buf)); \
}
#define LogWarnData5(msg,a,b,c,d,e,dw,buf) \
if (LOGLEVEL >= PROTO_LOGGING_WARN) { \
LPSTR _asz[5] = { (a), (b), (c), (d), (e)}; \
LOGWARNDATA(LOGHANDLE,SAMPLOG_ ## msg,5,_asz,(dw),(buf)); \
}
// Information logging
#define LogInfo0(msg,err) \
if (LOGLEVEL >= PROTO_LOGGING_INFO) \
LOGINFO(LOGHANDLE,SAMPLOG_ ## msg,0,NULL,(err))
#define LogInfo1(msg,a,err) \
if (LOGLEVEL >= PROTO_LOGGING_INFO) \
LOGINFO(LOGHANDLE,SAMPLOG_ ## msg,1,&(a),(err))
#define LogInfo2(msg,a,b,err) \
if (LOGLEVEL >= PROTO_LOGGING_INFO) { \
LPSTR _asz[2] = { (a), (b) }; \
LOGINFO(LOGHANDLE,SAMPLOG_ ## msg,2,_asz,(err)); \
}
#define LogInfo3(msg,a,b,c,err) \
if (LOGLEVEL >= PROTO_LOGGING_INFO) { \
LPSTR _asz[3] = { (a), (b), (c) }; \
LOGINFO(LOGHANDLE,SAMPLOG_ ## msg,3,_asz,(err)); \
}
#define LogInfo4(msg,a,b,c,d,err) \
if (LOGLEVEL >= PROTO_LOGGING_INFO) { \
LPSTR _asz[4] = { (a), (b), (c), (d) }; \
LOGINFO(LOGHANDLE,SAMPLOG_ ## msg,4,_asz,(err)); \
}
#endif // __LOGTRDEF_H__