1/*
2Copyright (C) 2020 Derry <destan19@126.com>
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20THE SOFTWARE.
21*/
22#ifndef __APPFILTER_CONFIG_H__
23#define __APPFILTER_CONFIG_H__
24#define MAX_SUPPORT_APP_NUM 1024
25#define MAX_CLASS_NAME_LEN 32
26#include "appfilter_user.h"
27extern int g_cur_class_num;
28extern int g_app_count;
29extern char CLASS_NAME_TABLE[MAX_APP_TYPE][MAX_CLASS_NAME_LEN];
30typedef struct af_time
31{
32    int hour;
33    int min;
34} af_time_t;
35typedef struct af_ctl_time
36{
37    int time_mode; // 0,1
38    af_time_t start;
39    af_time_t end;
40    af_time_t start2; // todo: time group list
41    af_time_t end2;
42    int days[7];
43} af_ctl_time_t;
44
45typedef struct app_name_info
46{
47    int id;
48    char name[64];
49} app_name_info_t;
50void init_app_name_table(void);
51void init_app_class_name_table(void);
52char *get_app_name_by_id(int id);
53
54int appfilter_config_alloc(void);
55
56int appfilter_config_free(void);
57af_ctl_time_t *load_appfilter_ctl_time_config(void);
58int config_get_appfilter_enable(void);
59int config_get_lan_ip(char *lan_ip, int len);
60int config_get_lan_mask(char *lan_mask, int len);
61
62#endif
63