#include <vlib/vlib.h> /* for VLIB_N_RX_TX */
#include <vnet/pg/edit.h>
#include <vppinfra/fifo.h> /* for buffer_fifo */
+#include <vnet/unix/pcap.h>
+#include <vnet/interface.h>
+
+extern vnet_device_class_t pg_dev_class;
struct pg_main_t;
struct pg_stream_t;
/* Output next index to reach output node from stream input node. */
u32 next_index;
+ u32 if_id;
+
/* Number of packets currently generated. */
u64 n_packets_generated;
u32 hw_if_index, sw_if_index;
/* Identifies stream for this interface. */
- u32 stream_index;
+ u32 id;
+
+ pcap_main_t pcap_main;
+ u8 * pcap_file_name;
} pg_interface_t;
/* Per VLIB node data. */
/* Hash mapping name -> stream index. */
uword * stream_index_by_name;
- /* Vector of interfaces. */
+ /* Pool of interfaces. */
pg_interface_t * interfaces;
+ uword * if_index_by_if_id;
/* Per VLIB node information. */
pg_node_t * nodes;
-
- u32 * free_interfaces;
} pg_main_t;
/* Global main structure. */
void pg_stream_enable_disable (pg_main_t * pg, pg_stream_t * s, int is_enable);
/* Find/create free packet-generator interface index. */
-u32 pg_interface_find_free (pg_main_t * pg, uword stream_index);
+u32 pg_interface_add_or_get (pg_main_t * pg, uword stream_index);
always_inline pg_node_t *
pg_get_node (uword node_index)
void * fixed_packet_data,
void * fixed_packet_data_mask);
+void pg_enable_disable (u32 stream_index, int is_enable);
+
+typedef struct {
+ u32 hw_if_index;
+ u32 dev_instance;
+ u8 is_enabled;
+ u8 * pcap_file_name;
+ u32 count;
+} pg_capture_args_t;
+
+clib_error_t * pg_capture (pg_capture_args_t *a);
+
#endif /* included_vlib_pg_h */