summaryrefslogtreecommitdiff
path: root/src/wy_singleflow_entry.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wy_singleflow_entry.h')
-rw-r--r--src/wy_singleflow_entry.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/wy_singleflow_entry.h b/src/wy_singleflow_entry.h
new file mode 100644
index 0000000..47c5961
--- /dev/null
+++ b/src/wy_singleflow_entry.h
@@ -0,0 +1,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
+