forked from OFLOPS-Turbo/oflops-turbo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
traffic_generator.h
50 lines (41 loc) · 1.15 KB
/
traffic_generator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef TRAFFIC_GENERATOR_H
#define TRAFFIC_GENERATOR_H 1
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdint.h>
#include "oflops.h"
#include "context.h"
#include "utils.h"
#include "msg.h"
struct traf_gen_det {
char intf_name[20];
char src_ip[20], dst_ip_max[20], dst_ip_min[20];
char mac_dst[20], mac_src[20];
uint16_t udp_src_port, udp_dst_port;
uint32_t pkt_size;
uint16_t vlan;
uint16_t vlan_p;
uint16_t vlan_cfi;
uint32_t delay;
uint64_t pkt_count;
char flags[1024];
};
#ifndef PKTGEN_HDR
#define PKTGEN_HDR 1
struct pktgen_hdr {
uint32_t magic;
uint32_t seq_num;
uint32_t tv_sec;
uint32_t tv_usec;
};
#endif
int init_traf_gen(struct oflops_context *ctx);
int add_traffic_generator(struct oflops_context *ctx, int channel, struct traf_gen_det *det);
int start_traffic_generator(oflops_context *ctx);
int stop_traffic_generator( oflops_context *ctx);
char *report_traffic_generator(oflops_context *ctx);
struct pktgen_hdr *extract_pktgen_pkt(oflops_context *ctx, int port,
unsigned char *b, int len, struct flow *fl);
void oflops_gettimeofday(struct oflops_context *ctx, struct timeval *ts);
#endif