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
|
#ifndef __WYSF_PKT_ENTRY_H__
#define __WYSF_PKT_ENTRY_H__
#include <MESA/MESA_htable.h>
#include <MESA/field_stat2.h>
#include <MESA/MESA_handle_logger.h>
#include <map>
#include <string>
#include <MESA/stream_inc/gdev_keepalive.h>
#include "wy_singleflow_keepalive.h"
#include "wy_singleflow_broadcast.h"
#define WYSF_CONFIG_FILE "./conf/wy_single_flow.conf"
#ifndef __FILENAME__
#define __FILENAME__ __FILE__
#endif
#define MESA_RUNTIME_LOGV3(handle, lv, fmt, args...) \
MESA_handle_runtime_log((handle), (lv), "WYSF", "%s:%d, " fmt, __FILENAME__, __LINE__, ##args)
#define WYSF_MAGIC_NUMBER 0x6E7A
enum WYSF_FSSTAT_STATUS
{
WYSF_FSSTAT_STATUS_FLOW_TABLE=0,
WYSF_FSSTAT_STATUS_ACTIVE_FUNC,
WYSF_FSSTAT_STATUS_KEEPALIVE,
WYSF_FSSTAT_STATUS_MAX,
};
enum WYSF_FSSTAT_FIELD
{
WYSF_FSSTAT_FIELD_FLOWS_TOTAL=0,
WYSF_FSSTAT_FIELD_FLOWS_INTERCEPT,
WYSF_FSSTAT_FIELD_FLOWS_BACK,
WYSF_FSSTAT_FIELD_INTER_BYTES,
WYSF_FSSTAT_FIELD_SEND_BROADCAST,
WYSF_FSSTAT_FIELD_RECV_BROADCAST,
WYSF_FSSTAT_FIELD_MAX,
};
struct wysf_stream_context
{
struct function_node *func_node;
};
struct wysf_global_info
{
void *log_runtime;
MESA_htable_handle stream_tuple_mapping;
int32_t flowhtable_slots;
int32_t flowhtable_expires;
int32_t htable_locknum;
int32_t bfd_dest_port;
int32_t bfd_timeout_ms;
int32_t bfd_timeout_times;
struct event_base *alive_evbase;
int32_t alive_func_nodes;
int32_t func_group_num;
struct judian_as_group *judian_group_list[1024];
int32_t broadcast_udp_servert_sockfd;
int32_t broadcast_udp_server_port;
std::map<std::string, struct judian_as_group*> *group_judian;
std::map<int32_t, struct function_node*> *func_keepalive;
std::map<int32_t, struct judian_as_group*> *forwardip2judian;
screen_stat_handle_t fsstat_handle;
struct event fs_timer_output;
char fsstat_dst_ip[64];
char fsstat_appname[16];
char fsstat_filepath[256];
char fsstat_histlen[256];
u_int32_t fsstat_period;
u_int32_t fsstat_print_mode; //0-close; 1-automaticlly; 2-passively
int32_t fsstat_dst_port;
int32_t fsstat_histlen_id;
int32_t fsstat_field_ids[WYSF_FSSTAT_FIELD_MAX];
int32_t fsstat_status_ids[WYSF_FSSTAT_STATUS_MAX];
};
#endif
|