TSG-13630 tsg-service-chaining-engine使用mrzcpd捕获报文/回注报文
TSG-13685 tsg-service-chaining-engine使用VXLAN封装Steering/Mirroring的Package
This commit is contained in:
19
platform/include/packet_io.h
Normal file
19
platform/include/packet_io.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef _PACKET_IO_H
|
||||
#define _PACKET_IO_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct packet_io *packet_io_create(const char *profile, int thread_num);
|
||||
void packet_io_destory(struct packet_io *handle);
|
||||
|
||||
int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, void *ctx);
|
||||
int packet_io_polling_endpoint(struct packet_io *handle, int thread_seq, void *ctx);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "utils.h"
|
||||
#include "raw_packet.h"
|
||||
|
||||
enum traffic_type
|
||||
@@ -82,23 +83,27 @@ struct connectivity
|
||||
|
||||
struct selected_sf
|
||||
{
|
||||
int policy_id;
|
||||
enum traffic_type traffic_type;
|
||||
|
||||
int sff_profile_id;
|
||||
enum forward_type sff_forward_type;
|
||||
|
||||
int sf_need_skip;
|
||||
int sf_profile_id;
|
||||
enum session_action sf_action;
|
||||
enum session_action_reason sf_action_reason;
|
||||
struct connectivity sf_connectivity;
|
||||
|
||||
struct throughput_metrics rx;
|
||||
struct throughput_metrics tx;
|
||||
};
|
||||
|
||||
struct selected_chaining
|
||||
{
|
||||
int policy_id;
|
||||
enum traffic_type traffic_type;
|
||||
|
||||
struct selected_sf *chaining;
|
||||
int chaining_size;
|
||||
int chaining_index;
|
||||
int chaining_used;
|
||||
};
|
||||
|
||||
// return NULL : error
|
||||
@@ -115,8 +120,7 @@ void selected_chaining_destory(struct selected_chaining *chaining);
|
||||
void selected_chaining_dump(struct selected_chaining *chaining);
|
||||
void selected_chaining_bref(struct selected_chaining *chaining);
|
||||
|
||||
// return value need be free by selected_chaining_destory()
|
||||
struct selected_chaining *policy_enforce_select_chaining(struct policy_enforcer *enforcer, struct raw_pkt_parser *parser, int policy_id, int dir_is_internal);
|
||||
void policy_enforce_select_chaining(struct selected_chaining *chaining, struct policy_enforcer *enforcer, struct raw_pkt_parser *parser, int policy_id, int dir_is_internal);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
|
||||
108
platform/include/sce.h
Normal file
108
platform/include/sce.h
Normal file
@@ -0,0 +1,108 @@
|
||||
#ifndef _SCE_H
|
||||
#define _SCE_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "utils.h"
|
||||
#include "policy.h"
|
||||
#include "packet_io.h"
|
||||
#include "session_table.h"
|
||||
|
||||
/******************************************************************************
|
||||
* Struct For Global
|
||||
******************************************************************************/
|
||||
|
||||
struct global_metrics
|
||||
{
|
||||
struct throughput_metrics dev_endpoint_rx; // 累计值
|
||||
struct throughput_metrics dev_endpoint_tx; // 累计值
|
||||
struct throughput_metrics dev_endpoint_err_drop; // 累计值
|
||||
|
||||
struct throughput_metrics dev_nf_interface_rx; // 累计值
|
||||
struct throughput_metrics dev_nf_interface_tx; // 累计值
|
||||
struct throughput_metrics dev_nf_interface_err_bypass; // 累计值
|
||||
|
||||
struct throughput_metrics hit_block_policy; // 累计值
|
||||
struct throughput_metrics hit_bypass_policy; // 累计值
|
||||
|
||||
uint64_t session_nums; // 瞬时值
|
||||
};
|
||||
|
||||
struct global_metrics *global_metrics_create();
|
||||
void global_metrics_destory(struct global_metrics *metrics);
|
||||
void global_metrics_dump(struct global_metrics *metrics);
|
||||
|
||||
/******************************************************************************
|
||||
* Struct For Thread
|
||||
******************************************************************************/
|
||||
|
||||
struct thread_ctx
|
||||
{
|
||||
pthread_t tid;
|
||||
int thread_index;
|
||||
struct session_table *session_table;
|
||||
|
||||
struct packet_io *ref_io;
|
||||
struct global_metrics *ref_metrics;
|
||||
struct policy_enforcer *ref_enforcer;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Struct For Session
|
||||
******************************************************************************/
|
||||
|
||||
struct packet_info
|
||||
{
|
||||
int dir_is_e2i;
|
||||
struct addr_tuple4 tuple4;
|
||||
char *addr_string;
|
||||
|
||||
char *header_data;
|
||||
int header_len;
|
||||
};
|
||||
|
||||
struct session_ctx
|
||||
{
|
||||
struct fixed_num_array policy_ids;
|
||||
uint64_t session_id;
|
||||
|
||||
char raw_pkt_i2e_route_ctx[64];
|
||||
char raw_pkt_e2i_route_ctx[64];
|
||||
|
||||
struct sids raw_pkt_i2e_sids;
|
||||
struct sids raw_pkt_e2i_sids;
|
||||
|
||||
// depending on first control packet
|
||||
struct packet_info first_ctrl_pkt;
|
||||
struct selected_chaining *chaining;
|
||||
};
|
||||
|
||||
struct session_ctx *session_ctx_new();
|
||||
void session_ctx_free(struct session_ctx *ctx);
|
||||
|
||||
/******************************************************************************
|
||||
* Struct For SCE
|
||||
******************************************************************************/
|
||||
|
||||
struct sce_ctx
|
||||
{
|
||||
int firewall_sids;
|
||||
int nr_worker_threads;
|
||||
|
||||
struct packet_io *io;
|
||||
struct global_metrics *metrics;
|
||||
struct policy_enforcer *enforcer;
|
||||
struct thread_ctx work_threads[128];
|
||||
};
|
||||
|
||||
struct sce_ctx *sce_ctx_create(const char *profile);
|
||||
void sce_ctx_destory(struct sce_ctx *ctx);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user