修复Verify Policy中fqdn entry的命中路径错误,增加Verify Policy测试用例代码框架

This commit is contained in:
fengweihao
2024-08-02 10:55:58 +08:00
parent 60cd4283db
commit 41caf21f43
12 changed files with 1638 additions and 786 deletions

39
common/include/utils.h Normal file
View File

@@ -0,0 +1,39 @@
#ifndef __RT_COMMON_H__
#define __RT_COMMON_H__
#include <assert.h>
#define EVAL_TM_STYLE "%Y-%m-%d"
#define VERIFY_SYMBOL_MAX 64
#define VERIFY_PATH_MAX 258
#define VERIFY_STRING_MAX 2048
#define VERIFY_ARRAY_MAX 512
#define MAX_TAG_ID_NUM 128
/** Alway treated the expr as true */
#ifndef likely
#define likely(expr) __builtin_expect(!!(expr), 1)
#endif
/** Alway treated the expr as false */
#ifndef unlikely
#define unlikely(expr) __builtin_expect(!!(expr), 0)
#endif
#ifndef FOREVER
#define FOREVER for(;;)
#endif
#define __rt_always_inline__ __attribute__((always_inline)) inline
#define ALLOC(type, number) ((type *)calloc(sizeof(type), number))
#define FREE(p) {free(*p);*p=NULL;}
char* rt_strdup(const char* s);
#define MODULE_VERIFY_POLICY "verify-policy.init"
#define CHECK_OR_EXIT(condition, fmt, ...) \
do { if(!(condition)) { log_fatal(g_verify_proxy->logger, MODULE_VERIFY_POLICY, fmt, ##__VA_ARGS__); exit(EXIT_FAILURE); } } while(0) \
#endif