1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
#ifndef __URL_CLASSIFICATION_H__
#define __URL_CLASSIFICATION_H__
#ifdef __cplusplus
extern "C"
{
#endif
enum URL_CLASSIFICATION_TYPE
{
URL_CLASSTYPE_ADULT=0,
URL_CLASSTYPE_VIRUS,
URL_CLASSTYPE_PHISHING,
URL_CLASSTYPE_DUGS,
URL_CLASSTYPE_ACCEMIC_FRAUD,
URL_CLASSTYPE_TASTELESS,
URL_CLASSTYPE_HATE,
URL_CLASSTYPE_PEOXIES,
URL_CLASSTYPE_DATING,
URL_CLASSTYPE_MUSIC,
URL_CLASSTYPE_NEWS,
URL_CLASSTYPE_AUDIO_VIDEO,
URL_CLASSTYPE_ENTERTANMENT,
//To be Continued, to be modified.
URL_CLASSTYPE_NUM, //������
};
typedef void* URLClassDB_handler_t;
/*����: ��ѯij�������URL��������
*����ֵ: ������0����δ��ѯ����
*/
int URLClassDB_count_class(URLClassDB_handler_t handler, enum URL_CLASSIFICATION_TYPE type);
/*����: ��ѯij��URL�����ķ���
*����: @url
*���: @array_num���������
*����ֵ: ���飬��������Ҫfree��
*/
enum URL_CLASSIFICATION_TYPE *URLClassDB_query_url_type(URLClassDB_handler_t handler, const char *url, int *array_num);
/*����: ��ȡij�������������Ϣ
*����ֵ: ij�������JSON��ʽ��������JSON�ṹ���������䡣����
* {"en_name":"adult","ru_name":"���ѧۧ�� �էݧ� �ӧ٧���ݧ���","cn_name":"������վ"}
*/
const char *URLClassDB_get_class_description(URLClassDB_handler_t handler, enum URL_CLASSIFICATION_TYPE type);
/*����: ���¹�ע�ķ����б�
*����: @types_array�������
@array_num���������
*����ֵ: 0: �ɹ���
* -1: ʧ�ܣ�
*/
int URLClassDB_update_classes(URLClassDB_handler_t handler, const enum URL_CLASSIFICATION_TYPE *types_array, int array_num);
typedef void (*update_class_callback)(int succ, void *user);
/*����: ���¹�ע�ķ����б����ڲ������̣߳������߳��ڻص�update_class_callback��
*����: @types_array�������
@array_num���������
*����ֵ: 0: �ɹ���
* -1: ʧ�ܣ�
*/
int URLClassDB_update_classes_asyn(URLClassDB_handler_t handler, update_class_callback cb, void *user,
const enum URL_CLASSIFICATION_TYPE *types_array, int array_num);
enum URLCLASSDB_INIT_OPT
{
URLCLASSDB_OPT_TMP_DIR=0, //Where to store temporary files which are generated by this module. VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. DEFAULT: Current directory.
};
int URLClassDB_set_opttype(URLClassDB_handler_t handler, enum URLCLASSDB_INIT_OPT opt, const void* value, int size);
/*����: ����һ����ѯ/ɨ��ʵ��
*����ֵ: ʵ���ľ��
*/
URLClassDB_handler_t URLClassDB_instance_new(const char *dat_dir, const char *log_dir);
/*����: ����һ��ʵ��
*����ֵ: 0: �ɹ���
* -1: ʧ�ܣ�
*/
int URLClassDB_instance_starts(URLClassDB_handler_t handler);
/*����: ����һ����ѯ/ɨ��ʵ��
*/
void URLClassDB_instance_destroy(URLClassDB_handler_t handler);
#ifdef __cplusplus
}
#endif
#endif
|