TSG-13684 tsg-service-chaining-engine使用VLAN封装Packet并执行Traffic Mirroring
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef _CTRL_PACKET_H
|
||||
#define _CTRL_PACKET_H
|
||||
#ifndef _CONTROL_PACKET_H
|
||||
#define _CONTROL_PACKET_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
@@ -16,7 +16,7 @@ enum session_state
|
||||
SESSION_STATE_RESETALL = 4,
|
||||
};
|
||||
|
||||
struct ctrl_pkt_parser
|
||||
struct control_packet
|
||||
{
|
||||
char tsync[4];
|
||||
uint64_t session_id;
|
||||
@@ -27,12 +27,11 @@ struct ctrl_pkt_parser
|
||||
};
|
||||
|
||||
const char *session_state_to_string(enum session_state state);
|
||||
void ctrl_packet_parser_init(struct ctrl_pkt_parser *handler);
|
||||
|
||||
// return 0 : success
|
||||
// return -1 : error
|
||||
int ctrl_packet_parser_parse(struct ctrl_pkt_parser *handler, const char *data, size_t length);
|
||||
void ctrl_packet_parser_dump(struct ctrl_pkt_parser *handler);
|
||||
int control_packet_parse(struct control_packet *handler, const char *data, size_t length);
|
||||
void control_packet_dump(struct control_packet *handler);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef _RAW_PACKET_H
|
||||
#define _RAW_PACKET_H
|
||||
#ifndef _DATA_PACKET_H
|
||||
#define _DATA_PACKET_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
@@ -67,30 +67,28 @@ struct layer_results
|
||||
uint16_t layers_size;
|
||||
};
|
||||
|
||||
struct raw_pkt_parser
|
||||
struct data_packet
|
||||
{
|
||||
enum layer_type expect_type;
|
||||
struct layer_results results;
|
||||
|
||||
const void *ptr_pkt_start;
|
||||
uint64_t pkt_trace_id;
|
||||
const void *data_ptr;
|
||||
uint64_t trace_id;
|
||||
};
|
||||
|
||||
void raw_packet_parser_init(struct raw_pkt_parser *handler, uint64_t pkt_trace_id, enum layer_type expect_type, uint16_t expect_results_num);
|
||||
// return most inner payload
|
||||
const void *raw_packet_parser_parse(struct raw_pkt_parser *handler, const void *data, size_t length);
|
||||
const void *data_packet_parse(struct data_packet *handler, const void *data, size_t length, uint64_t trace_id);
|
||||
|
||||
// return 0 : success
|
||||
// return -1 : error
|
||||
int raw_packet_parser_get_most_inner_tuple4(struct raw_pkt_parser *handler, struct addr_tuple4 *addr);
|
||||
int raw_packet_parser_get_most_outer_tuple4(struct raw_pkt_parser *handler, struct addr_tuple4 *addr);
|
||||
int data_packet_get_innermost_tuple4(struct data_packet *handler, struct addr_tuple4 *addr);
|
||||
int data_packet_get_outermost_tuple4(struct data_packet *handler, struct addr_tuple4 *addr);
|
||||
|
||||
// return 0 : success
|
||||
// return -1 : error
|
||||
int raw_packet_parser_get_most_inner_address(struct raw_pkt_parser *handler, struct addr_tuple4 *addr);
|
||||
int raw_packet_parser_get_most_outer_address(struct raw_pkt_parser *handler, struct addr_tuple4 *addr);
|
||||
int data_packet_get_innermost_address(struct data_packet *handler, struct addr_tuple4 *addr);
|
||||
int data_packet_get_outermost_address(struct data_packet *handler, struct addr_tuple4 *addr);
|
||||
|
||||
uint64_t raw_packet_parser_get_hash_value(struct raw_pkt_parser *handler, enum ldbc_method method, int dir_is_i2e);
|
||||
uint64_t data_packet_get_hash(struct data_packet *handler, enum ldbc_method method, int dir_is_i2e);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
@@ -11,7 +11,7 @@ extern "C"
|
||||
#define LOG_TAG_SCE "SCE"
|
||||
#define LOG_TAG_POLICY "POLICY"
|
||||
#define LOG_TAG_PKTIO "PACKET_IO"
|
||||
#define LOG_TAG_RAWPKT "RAW_PACKET"
|
||||
#define LOG_TAG_RAWPKT "DATA_PACKET"
|
||||
#define LOG_TAG_CTRLPKT "CTRL_PACKET"
|
||||
#define LOG_TAG_METRICS "G_METRICS"
|
||||
#define LOG_TAG_SF_METRICS "SF_METRICS"
|
||||
@@ -36,23 +36,23 @@ extern "C"
|
||||
#include <netinet/in.h>
|
||||
|
||||
/******************************************************************************
|
||||
* fixed_num_array
|
||||
* mutable_array
|
||||
******************************************************************************/
|
||||
|
||||
struct fixed_num_array
|
||||
struct mutable_array
|
||||
{
|
||||
uint64_t elems[128];
|
||||
int num;
|
||||
int size;
|
||||
};
|
||||
|
||||
void fixed_num_array_init(struct fixed_num_array *array);
|
||||
void fixed_num_array_add_elem(struct fixed_num_array *array, uint64_t elem);
|
||||
void fixed_num_array_del_elem(struct fixed_num_array *array, uint64_t elem);
|
||||
int fixed_num_array_is_full(struct fixed_num_array *array);
|
||||
int fixed_num_array_count_elem(struct fixed_num_array *array);
|
||||
int fixed_num_array_exist_elem(struct fixed_num_array *array, uint64_t elem);
|
||||
int fixed_num_array_index_elem(struct fixed_num_array *array, int index);
|
||||
void mutable_array_init(struct mutable_array *array);
|
||||
void mutable_array_add_elem(struct mutable_array *array, uint64_t elem);
|
||||
void mutable_array_del_elem(struct mutable_array *array, uint64_t elem);
|
||||
int mutable_array_is_full(struct mutable_array *array);
|
||||
int mutable_array_count_elem(struct mutable_array *array);
|
||||
int mutable_array_exist_elem(struct mutable_array *array, uint64_t elem);
|
||||
int mutable_array_index_elem(struct mutable_array *array, int index);
|
||||
|
||||
/******************************************************************************
|
||||
* sids
|
||||
|
||||
Reference in New Issue
Block a user