DPDK  25.11.0
rte_pcapng.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019 Microsoft Corporation
3  */
4 
19 #ifndef _RTE_PCAPNG_H_
20 #define _RTE_PCAPNG_H_
21 
22 #include <stdint.h>
23 #include <sys/types.h>
24 
25 #include <rte_mempool.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /* Default link type for Ethernet traffic. */
32 #ifndef DLT_EN10MB
33 #define DLT_EN10MB 1
34 #endif
35 
36 /* Opaque handle used for functions in this library. */
37 typedef struct rte_pcapng rte_pcapng_t;
38 
58 rte_pcapng_t *
60  const char *osname, const char *hardware,
61  const char *appname, const char *comment);
62 
69 void
70 rte_pcapng_close(rte_pcapng_t *self);
71 
93 int
94 rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port, uint16_t link_type,
95  const char *ifname, const char *ifdescr,
96  const char *filter);
97 
103  RTE_PCAPNG_DIRECTION_UNKNOWN = 0,
104  RTE_PCAPNG_DIRECTION_IN = 1,
105  RTE_PCAPNG_DIRECTION_OUT = 2,
106 };
107 
133 struct rte_mbuf *
134 rte_pcapng_copy(uint16_t port_id, uint32_t queue,
135  const struct rte_mbuf *m, struct rte_mempool *mp,
136  uint32_t length,
137  enum rte_pcapng_direction direction, const char *comment);
138 
139 
149 uint32_t
150 rte_pcapng_mbuf_size(uint32_t length);
151 
173 ssize_t
174 rte_pcapng_write_packets(rte_pcapng_t *self,
175  struct rte_mbuf *pkts[], uint16_t nb_pkts);
176 
197 ssize_t
198 rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port,
199  uint64_t ifrecv, uint64_t ifdrop,
200  const char *comment);
201 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif /* _RTE_PCAPNG_H_ */
int rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port, uint16_t link_type, const char *ifname, const char *ifdescr, const char *filter)
rte_pcapng_direction
Definition: rte_pcapng.h:102
void rte_pcapng_close(rte_pcapng_t *self)
rte_pcapng_t * rte_pcapng_fdopen(int fd, const char *osname, const char *hardware, const char *appname, const char *comment)
ssize_t rte_pcapng_write_packets(rte_pcapng_t *self, struct rte_mbuf *pkts[], uint16_t nb_pkts)
struct rte_mbuf * rte_pcapng_copy(uint16_t port_id, uint32_t queue, const struct rte_mbuf *m, struct rte_mempool *mp, uint32_t length, enum rte_pcapng_direction direction, const char *comment)
ssize_t rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port, uint64_t ifrecv, uint64_t ifdrop, const char *comment)
uint32_t rte_pcapng_mbuf_size(uint32_t length)
uint16_t port