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 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /** 13 * @file 14 * RTE Port Source/Sink 15 * 16 * source: input port that can be used to generate packets 17 * sink: output port that drops all packets written to it 18 * 19 ***/ 20 21 #include "rte_port.h" 22 23 /** source port parameters */ 24 struct rte_port_source_params { 25 /** Pre-initialized buffer pool */ 26 struct rte_mempool *mempool; 27 28 /** The full path of the pcap file to read packets from */ 29 const char *file_name; 30 /** The number of bytes to be read from each packet in the 31 * pcap file. If this value is 0, the whole packet is read; 32 * if it is bigger than packet size, the generated packets 33 * will contain the whole packet */ 34 uint32_t n_bytes_per_pkt; 35 }; 36 37 /** source port operations */ 38 extern struct rte_port_in_ops rte_port_source_ops; 39 40 /** sink port parameters */ 41 struct rte_port_sink_params { 42 /** The full path of the pcap file to write the packets to */ 43 const char *file_name; 44 /** The maximum number of packets write to the pcap file. 45 * If this value is 0, the "infinite" write will be carried 46 * out. 47 */ 48 uint32_t max_n_pkts; 49 }; 50 51 /** sink port operations */ 52 extern struct rte_port_out_ops rte_port_sink_ops; 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58 #endif 59