#define DEBUG_VARIABLE "SNORT_DEBUG"
在系统的环境变量里存在名为SNORT_DEBUG的变量。
紧接着是各个模块的debug_lever的宏定义

 1snort里的debug(debug.h,debug.c)#define DEBUG_ALL             0xffffffff
 2snort里的debug(debug.h,debug.c)#define DEBUG_INIT            0x00000001  /* 1 */
 3snort里的debug(debug.h,debug.c)#define DEBUG_CONFIGRULES     0x00000002  /* 2 */
 4snort里的debug(debug.h,debug.c)#define DEBUG_PLUGIN          0x00000004  /* 4 */
 5snort里的debug(debug.h,debug.c)#define DEBUG_DATALINK        0x00000008  /* 8 */
 6snort里的debug(debug.h,debug.c)#define DEBUG_IP              0x00000010  /* 16 */
 7snort里的debug(debug.h,debug.c)#define DEBUG_TCPUDP          0x00000020  /* 32 */
 8snort里的debug(debug.h,debug.c)#define DEBUG_DECODE          0x00000040  /* 64 */
 9snort里的debug(debug.h,debug.c)#define DEBUG_LOG             0x00000080  /* 128 */
10snort里的debug(debug.h,debug.c)#define DEBUG_MSTRING         0x00000100  /* 256 */
11snort里的debug(debug.h,debug.c)#define DEBUG_PARSER          0x00000200  /* 512 */
12snort里的debug(debug.h,debug.c)#define DEBUG_PLUGBASE        0x00000400  /* 1024 */
13snort里的debug(debug.h,debug.c)#define DEBUG_RULES           0x00000800  /* 2048 */
14snort里的debug(debug.h,debug.c)#define DEBUG_FLOW            0x00001000  /* 4096 */
15snort里的debug(debug.h,debug.c)#define DEBUG_STREAM          0x00002000  /* 8192 */
16snort里的debug(debug.h,debug.c)#define DEBUG_PATTERN_MATCH   0x00004000  /* 16384 */
17snort里的debug(debug.h,debug.c)#define DEBUG_DETECT          0x00008000  /* 32768 */
18snort里的debug(debug.h,debug.c)#define DEBUG_CONVERSATION    0x00010000  /* 65536 */
19snort里的debug(debug.h,debug.c)#define DEBUG_FRAG2           0x00020000  /* 131072 */
20snort里的debug(debug.h,debug.c)#define DEBUG_HTTP_DECODE     0x00040000  /* 262144 */
21snort里的debug(debug.h,debug.c)#define DEBUG_PORTSCAN2       0x00080000  /* 524288 / (+ conv2 ) 589824 */
22snort里的debug(debug.h,debug.c)#define DEBUG_RPC             0x00100000  /* 1048576 */
23snort里的debug(debug.h,debug.c)#define DEBUG_FLOWSYS         0x00200000  /* 2097152 */
24snort里的debug(debug.h,debug.c)#define DEBUG_HTTPINSPECT     0x00400000  /* 4194304 */
25snort里的debug(debug.h,debug.c)#define DEBUG_STREAM_STATE    0x00800000  /* 8388608 */
26snort里的debug(debug.h,debug.c)#define DEBUG_ASN1            0x01000000  /* 16777216 */

int GetDebugLevel (void);的说明。

 1snort里的debug(debug.h,debug.c)int GetDebugLevel (void)
 2}
int DebugThis(int level);的说明
snort里的debug(debug.h,debug.c)int DebugThis(int level)
}


    #define    DebugMessage    DebugMessageFile = __FILE__; DebugMessageLine = __LINE__; DebugMessageFunc

    void DebugMessageFunc(int , char *, ...);
以上联合使用的就是DebugMessage(int,char *,...);

snort里的debug(debug.h,debug.c)void DebugMessageFunc(int level, char *fmt, snort里的debug(debug.h,debug.c))
}

这里引出了以前我对几个问题的不理解,查资料后总结如下:

关于va可变参数的几个宏,使用va必须include <stdarg.h>
va_list 是指向参数的指针
void va_start( va_list arg_ptr, prev_param );
type va_arg( va_list arg_ptr, type ); 返回可变的参数,type指定返回的类型
void va_end( va_list arg_ptr );
另外是一些输入输出的东东。。。。所有的输入是用scanf替换printf
#include <stdio.h>
int printf(const char *format, ...);
int fprintf(FILE *stream, const char *format, ...);
int sprintf(char *str, const char *format, ...);
int snprintf(char *str, size_t size, const char *format, ...);

#include <stdarg.h>

int vprintf(const char *format, va_list ap);
int vfprintf(FILE *stream, const char *format, va_list ap);
int vsprintf(char *str, const char *format, va_list ap);
int vsnprintf(char *str, size_t size, const char *format, va_list ap);  

描述 (DESCRIPTION)
printf 系列 函数 根据 下述的 format 参数 生成 输出内容. printf 和 vprintf 函数 把 输出内容 写到 stdout, 即 标准输出流; fprintf 和 vfprintf 函数 把 输出内容 写到 给定的 stream 流; sprintf, snprintf, vsprintf 和 vsnprintf 函数 把 输出内容 存放到 字符串 str 中.
这些 函数 由 格式字符串 format 参数 控制 输出内容, 它 指出 怎么样 把 后面的 参数 (或 通过 stdarg(3) 的 变长参数机制 访问的 参数) 转换成 输出内容. 这些 函数 返回 打印的 字符 数量 (不包括 字符串 结尾用的 `\0'). snprintf 和 vsnprintf 的 输出 不会 超过 size 字节 (包括了 结尾的 `\0'), 如果 因为 这个 限制 导致 输出内容 被截断, 则 函数 返回 -1.
格式字符串 (format 参数) 由 零到多个 指令 组成: 普通字符 (除 % 外), 它们 被 原封不动的 送到 输出流; 以及 格式转换说明 (conversion specification), 每个 格式转换说明 都会 从后面 提取 零到多个 参数. 格式转换说明 由 % 字符 引导开始. 参数 必须 正确的 对应到 格式转换符 (conversion specifier) 上.

相关文章:

  • 2021-05-13
  • 2021-09-26
  • 2021-09-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
猜你喜欢
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-01-05
相关资源
相似解决方案