DPDK  23.03.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 
23 #ifndef _RTE_PCAPNG_H_
24 #define _RTE_PCAPNG_H_
25 
26 #include <stdint.h>
27 #include <sys/types.h>
28 #include <rte_compat.h>
29 #include <rte_mempool.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* Opaque handle used for functions in this library. */
36 typedef struct rte_pcapng rte_pcapng_t;
37 
57 __rte_experimental
58 rte_pcapng_t *
59 rte_pcapng_fdopen(int fd,
60  const char *osname, const char *hardware,
61  const char *appname, const char *comment);
62 
69 __rte_experimental
70 void
71 rte_pcapng_close(rte_pcapng_t *self);
72 
92 __rte_experimental
93 int
94 rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,
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 
136 __rte_experimental
137 struct rte_mbuf *
138 rte_pcapng_copy(uint16_t port_id, uint32_t queue,
139  const struct rte_mbuf *m, struct rte_mempool *mp,
140  uint32_t length, uint64_t timestamp,
141  enum rte_pcapng_direction direction, const char *comment);
142 
143 
153 __rte_experimental
154 uint32_t
155 rte_pcapng_mbuf_size(uint32_t length);
156 
178 __rte_experimental
179 ssize_t
180 rte_pcapng_write_packets(rte_pcapng_t *self,
181  struct rte_mbuf *pkts[], uint16_t nb_pkts);
182 
209 __rte_experimental
210 ssize_t
211 rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port,
212  const char *comment,
213  uint64_t start_time, uint64_t end_time,
214  uint64_t ifrecv, uint64_t ifdrop);
215 
216 #ifdef __cplusplus
217 }
218 #endif
219 
220 #endif /* _RTE_PCAPNG_H_ */
__rte_experimental ssize_t rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port, const char *comment, uint64_t start_time, uint64_t end_time, uint64_t ifrecv, uint64_t ifdrop)
__rte_experimental int rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port, const char *ifname, const char *ifdescr, const char *filter)
rte_pcapng_direction
Definition: rte_pcapng.h:102
__rte_experimental 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, uint64_t timestamp, enum rte_pcapng_direction direction, const char *comment)
uint16_t port
__rte_experimental ssize_t rte_pcapng_write_packets(rte_pcapng_t *self, struct rte_mbuf *pkts[], uint16_t nb_pkts)
__rte_experimental uint32_t rte_pcapng_mbuf_size(uint32_t length)
__rte_experimental void rte_pcapng_close(rte_pcapng_t *self)
__rte_experimental rte_pcapng_t * rte_pcapng_fdopen(int fd, const char *osname, const char *hardware, const char *appname, const char *comment)