修正部分编译错误
This commit is contained in:
83
plugin/business/traffic-mirror/include/traffic_mirror.h
Normal file
83
plugin/business/traffic-mirror/include/traffic_mirror.h
Normal file
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
|
||||
#include <tfe_stream.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <MESA/Maat_rule.h>
|
||||
#include <pcap/pcap.h>
|
||||
|
||||
enum traffic_mirror_ethdev_type
|
||||
{
|
||||
TRAFFIC_MIRROR_ETHDEV_AF_PACKET,
|
||||
TRAFFIC_MIRROR_ETHDEV_MARSIO
|
||||
};
|
||||
|
||||
enum traffic_mirror_target_addr_type
|
||||
{
|
||||
TRAFFIC_MIRROR_TARGET_BY_VLAN_ID,
|
||||
TRAFFIC_MIRROR_TARGET_BY_ETHER_ADDR,
|
||||
};
|
||||
|
||||
struct traffic_mirror_instance
|
||||
{
|
||||
void * logger;
|
||||
unsigned int nr_threads;
|
||||
|
||||
Maat_feather_t maat_feather;
|
||||
int policy_table_id;
|
||||
int profile_table_id;
|
||||
|
||||
/* DEFAULT MAC ADDRESS, IN VLAN MODE */
|
||||
char default_ether_addr_src;
|
||||
char default_ether_addr_dst;
|
||||
};
|
||||
|
||||
struct policy_table_ex_data
|
||||
{
|
||||
unsigned int atomic_refcnt;
|
||||
unsigned int enable;
|
||||
unsigned int profile_id;
|
||||
};
|
||||
|
||||
struct profile_table_ex_data
|
||||
{
|
||||
unsigned int atomic_refcnt;
|
||||
unsigned int nr_targets;
|
||||
|
||||
/* Target VLANS */
|
||||
unsigned int * vlans;
|
||||
struct ether_addr * ether_addrs;
|
||||
};
|
||||
|
||||
struct traffic_mirror_ethdev
|
||||
{
|
||||
/* PUBLIC */
|
||||
char str_device[TFE_SYMBOL_MAX];
|
||||
enum traffic_mirror_ethdev_type type;
|
||||
|
||||
unsigned int mtu;
|
||||
unsigned int en_offload_vlan;
|
||||
unsigned int en_offload_ip_cksum;
|
||||
unsigned int en_offload_tcp_cksum;
|
||||
|
||||
/* PRIVATE, FOR PCAP */
|
||||
pcap_t * pcap_device_handle;
|
||||
char local_ether_addr[6];
|
||||
|
||||
/* FUNCTIONS */
|
||||
int (*fn_inject)(struct traffic_mirror_ethdev *, const char * pkt, unsigned int pktlen);
|
||||
void (*fn_destroy)(struct traffic_mirror_ethdev * ethdev);
|
||||
};
|
||||
|
||||
struct traffic_mirror_ethdev * traffic_mirror_ethdev_pcap_create(const char * str_ethdev, void * logger);
|
||||
void traffic_mirror_ethdev_destroy(struct traffic_mirror_ethdev * ethdev);
|
||||
int traffic_mirror_ethdev_inject(struct traffic_mirror_ethdev * ethdev, const char * pkt, unsigned int pktlen);
|
||||
|
||||
|
||||
struct traffic_mirror_rebuild * traffic_mirror_rebuild_create(struct tfe_stream_addr * addr,
|
||||
struct profile_table_ex_data * target, struct traffic_mirror_ethdev * ethdev);
|
||||
void traffic_mirror_rebuild_destroy(struct traffic_mirror_rebuild * instance);
|
||||
void traffic_mirror_rebuild_handshake(struct traffic_mirror_rebuild * instance);
|
||||
void traffic_mirror_rebuild_data(struct traffic_mirror_rebuild * instance, const char * data,
|
||||
unsigned int datalen, enum tfe_conn_dir dir);
|
||||
void traffic_mirror_rebuild_farewell(struct traffic_mirror_rebuild * instance);
|
||||
|
||||
Reference in New Issue
Block a user