xref: /dpdk/lib/port/rte_port_source_sink.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2016 Intel Corporation
3  */
4 
5 #ifndef __INCLUDE_RTE_PORT_SOURCE_SINK_H__
6 #define __INCLUDE_RTE_PORT_SOURCE_SINK_H__
7 
8 /**
9  * @file
10  * RTE Port Source/Sink
11  *
12  * source: input port that can be used to generate packets
13  * sink: output port that drops all packets written to it
14  */
15 
16 #include "rte_port.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /** source port parameters */
23 struct rte_port_source_params {
24 	/** Pre-initialized buffer pool */
25 	struct rte_mempool *mempool;
26 
27 	/** The full path of the pcap file to read packets from */
28 	const char *file_name;
29 	/** The number of bytes to be read from each packet in the
30 	 *  pcap file. If this value is 0, the whole packet is read;
31 	 *  if it is bigger than packet size, the generated packets
32 	 *  will contain the whole packet */
33 	uint32_t n_bytes_per_pkt;
34 };
35 
36 /** source port operations */
37 extern struct rte_port_in_ops rte_port_source_ops;
38 
39 /** sink port parameters */
40 struct rte_port_sink_params {
41 	/** The full path of the pcap file to write the packets to */
42 	const char *file_name;
43 	/** The maximum number of packets write to the pcap file.
44 	 *  If this value is 0, the "infinite" write will be carried
45 	 *  out.
46 	 */
47 	uint32_t max_n_pkts;
48 };
49 
50 /** sink port operations */
51 extern struct rte_port_out_ops rte_port_sink_ops;
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif
58