summaryrefslogtreecommitdiff
path: root/entry/include/kni_fieldstat.h
blob: cead1edded84e431ff01ebaaa37e4eccb9e5ead5 (plain)
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
#ifndef _KNI_FIELDSTAT_METRIC_H
#define _KNI_FIELDSTAT_METRIC_H

#ifdef __cpluscplus
extern "C"
{
#endif

#include <MESA/fieldstat.h>


enum proxy_metrics_column
{
    PROXY_METRIC_COLUMN_HIT_COUNT = 0,
    PROXY_METRIC_COLUMN_IN_BYTES,
    PROXY_METRIC_COLUMN_OUT_BYTES,
    PROXY_METRIC_COLUMN_IN_PKTS,
    PROXY_METRIC_COLUMN_OUT_PKTS,
    PROXY_METRIC_COLUMN_MAX
};


struct proxy_fieldstat
{
    int table_id;
    int n_thread;
    unsigned int column_ids[PROXY_METRIC_COLUMN_MAX];
    struct fieldstat_dynamic_instance *instance;
};

struct proxy_metric_tag
{
    int vsys_id;
    unsigned long long rule_id;
    unsigned char action;
    unsigned char pinning_status;
};


struct proxy_metric_value
{
    int hit_count;
    int in_bytes;
    int out_bytes;
    int in_pkts;
    int out_pkts;
};


// struct proxy_fieldstat *proxy_fieldstat_new(char *app_name, int n_thread, 
//                                                 int interval_ms, 
//                                                 const char *telegraf_ip,
//                                                 unsigned short telegraf_port,
//                                                 void *local_logger);

//  void proxy_fieldstat_free(struct proxy_fieldstat *pxy_fs);

void proxy_set_metric_value(struct proxy_fieldstat *pxy_fs,
                            struct proxy_metric_tag *metric_tags,
                            struct proxy_metric_value *metric_value,
                            int thread_id);

struct proxy_fieldstat *proxy_fieldstat_init(const char *profile,
                                             const char *section,
                                             int n_thread, 
                                             void *logger);

void proxy_fieldstat_destory(struct proxy_fieldstat *pxy_fs, void *logger);
#ifdef __cpluscplus
}


#endif

#endif