diff options
| author | yulingjing <[email protected]> | 2019-07-31 16:03:48 +0800 |
|---|---|---|
| committer | yulingjing <[email protected]> | 2019-07-31 16:03:48 +0800 |
| commit | f69cf0b3c639b4744649d2f851ea1d3bf8c36128 (patch) | |
| tree | 06c01b360f94cd3dd5036c9f85b48d0353104ac1 /src/include/url_classification.h | |
Diffstat (limited to 'src/include/url_classification.h')
| -rw-r--r-- | src/include/url_classification.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/include/url_classification.h b/src/include/url_classification.h new file mode 100644 index 0000000..9bb72e8 --- /dev/null +++ b/src/include/url_classification.h @@ -0,0 +1,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 + |
