1 /*
2  * This file is part of the zlog Library.
3  *
4  * Copyright (C) 2011 by Hardy Simpson <HardySimpson1984@gmail.com>
5  *
6  * Licensed under the LGPL v2.1, see the file COPYING in base directory.
7  */
8 
9 #ifndef __zlog_category_h
10 #define __zlog_category_h
11 
12 #include "zc_defs.h"
13 #include "thread.h"
14 
15 typedef struct zlog_category_s {
16 	char name[MAXLEN_PATH + 1];
17 	size_t name_len;
18 	unsigned char level_bitmap[32];
19 	unsigned char level_bitmap_backup[32];
20 	zc_arraylist_t *fit_rules;
21 	zc_arraylist_t *fit_rules_backup;
22 } zlog_category_t;
23 
24 zlog_category_t *zlog_category_new(const char *name, zc_arraylist_t * rules);
25 void zlog_category_del(zlog_category_t * a_category);
26 void zlog_category_profile(zlog_category_t *a_category, int flag);
27 
28 int zlog_category_update_rules(zlog_category_t * a_category, zc_arraylist_t * new_rules);
29 void zlog_category_commit_rules(zlog_category_t * a_category);
30 void zlog_category_rollback_rules(zlog_category_t * a_category);
31 
32 int zlog_category_output(zlog_category_t * a_category, zlog_thread_t * a_thread);
33 
34 #define zlog_category_needless_level(a_category, lv) \
35         !((a_category->level_bitmap[lv/8] >> (7 - lv % 8)) & 0x01)
36 
37 
38 #endif
39