Skip to content

Commit

Permalink
moving structs to common file
Browse files Browse the repository at this point in the history
Signed-off-by: Atul-source <atulprajapati6031@gmail.com>
  • Loading branch information
Atul-source committed Sep 10, 2024
1 parent 1ee2342 commit 968cc81
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 60 deletions.
30 changes: 0 additions & 30 deletions ipfix-flow-exporter/bpf_ipfix_egress.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,6 @@ static u32 flow_key_hash (const flow_key_t f) {
return hash_val;
}

struct update_flow_record_args {
flow_record_t *flow_rec_from_map;
flow_key_t flow_key;
u16 pckt_size;
u16 control_bit;
u8 tos;
u16 icmp_type;
u8 ttl;
u32 hash_key;
};

static void update_flow_record(struct update_flow_record_args *args)
{
flow_record_t flow_rec ;
Expand Down Expand Up @@ -110,16 +99,6 @@ static void update_flow_record(struct update_flow_record_args *args)
return;
}

struct create_flow_record_args {
flow_key_t flow_key;
u16 pckt_size;
u16 control_bit;
u8 tos;
u16 icmp_type;
u8 ttl;
u32 hash_key;
};

static void create_flow_record(struct create_flow_record_args *args)
{
flow_record_t flow_rec ;
Expand Down Expand Up @@ -196,15 +175,6 @@ static void parse_icmp_type(void *icmp_data,void *data_end, u16 *icmp_type){
return;
}

struct parse_port_args {
void *trans_data;
void *data_end;
u8 proto;
u32 *dport;
u32 *sport;
u16 *control_bit;
};

static void parse_port(struct parse_port_args *args)
{
struct udphdr *udph;
Expand Down
30 changes: 0 additions & 30 deletions ipfix-flow-exporter/bpf_ipfix_ingress.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ static u32 flow_key_hash (const flow_key_t f) {
return hash_val;
}

struct update_flow_record_args {
flow_record_t *flow_rec_from_map;
flow_key_t flow_key;
u16 pckt_size;
u16 control_bit;
u8 tos;
u16 icmp_type;
u8 ttl;
u32 hash_key;
};

static void update_flow_record(struct update_flow_record_args *args)
{
flow_record_t flow_rec ;
Expand Down Expand Up @@ -111,16 +100,6 @@ static void update_flow_record(struct update_flow_record_args *args)
return;
}

struct create_flow_record_args {
flow_key_t flow_key;
u16 pckt_size;
u16 control_bit;
u8 tos;
u16 icmp_type;
u8 ttl;
u32 hash_key;
};

static void create_flow_record(struct create_flow_record_args *args)
{
flow_record_t flow_rec ;
Expand Down Expand Up @@ -196,15 +175,6 @@ static void parse_icmp_type(void *icmp_data,void *data_end, u16 *icmp_type){
return;
}

struct parse_port_args {
void *trans_data;
void *data_end;
u8 proto;
u32 *dport;
u32 *sport;
u16 *control_bit;
};

static void parse_port(struct parse_port_args *args)
{
struct udphdr *udph;
Expand Down
30 changes: 30 additions & 0 deletions ipfix-flow-exporter/bpf_ipfix_kern_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,33 @@ void *memset(void *b, int c, unsigned long len)
#define flow_key_hash_mask 0x000fffff

#endif

struct update_flow_record_args {
flow_record_t *flow_rec_from_map;
flow_key_t flow_key;
u16 pckt_size;
u16 control_bit;
u8 tos;
u16 icmp_type;
u8 ttl;
u32 hash_key;
};

struct create_flow_record_args {
flow_key_t flow_key;
u16 pckt_size;
u16 control_bit;
u8 tos;
u16 icmp_type;
u8 ttl;
u32 hash_key;
};

struct parse_port_args {
void *trans_data;
void *data_end;
u8 proto;
u32 *dport;
u32 *sport;
u16 *control_bit;
};

0 comments on commit 968cc81

Please sign in to comment.