|
3 | 3 |
|
4 | 4 | #include "ndpheader.h" |
5 | 5 |
|
| 6 | +#include <nfb/ndp.h> |
6 | 7 | #include <stdint.h> |
7 | 8 | #include <string> |
8 | | -#include <vector> |
9 | | -#include <nfb/ndp.h> |
10 | 9 | #include <sys/time.h> |
| 10 | +#include <vector> |
11 | 11 |
|
12 | 12 | enum class NdpFwType { |
13 | | - NDP_FW_HANIC, |
14 | | - NDP_FW_NDK, |
15 | | - NDP_FW_UNKNOWN, |
| 13 | + NDP_FW_HANIC, |
| 14 | + NDP_FW_NDK, |
| 15 | + NDP_FW_UNKNOWN, |
16 | 16 | }; |
17 | 17 |
|
18 | | -class NdpReader |
19 | | -{ |
| 18 | +class NdpReader { |
20 | 19 | public: |
21 | | - NdpReader(uint16_t packet_bufferSize = 50, uint64_t timeout = 300); |
22 | | - ~NdpReader(); |
23 | | - |
24 | | - int init_interface(const std::string &interface); |
25 | | - void print_stats(); |
26 | | - void close(); |
27 | | - int get_pkt(struct ndp_packet **ndp_packet, struct timeval *timestamp); |
28 | | - std::string error_msg; |
| 20 | + NdpReader(uint16_t packet_bufferSize = 50, uint64_t timeout = 300); |
| 21 | + ~NdpReader(); |
| 22 | + |
| 23 | + int init_interface(const std::string& interface); |
| 24 | + void print_stats(); |
| 25 | + void close(); |
| 26 | + int get_pkt(struct ndp_packet** ndp_packet, struct timeval* timestamp); |
| 27 | + std::string error_msg; |
| 28 | + |
29 | 29 | private: |
30 | | - void set_booted_fw(); |
31 | | - void convert_fw_ts_to_timeval(const uint64_t *fw_ts, struct timeval *tv); |
32 | | - void set_sw_timestamp(struct timeval *tv); |
33 | | - bool retrieve_ndp_packets(); |
34 | | - struct nfb_device *dev_handle; // NFB device |
35 | | - struct ndp_queue *rx_handle; // data receiving NDP queue |
36 | | - uint64_t processed_packets; |
37 | | - uint16_t packet_bufferSize; |
38 | | - uint64_t timeout; |
39 | | - |
40 | | - NdpFwType fw_type; |
41 | | - std::vector<uint32_t> ndk_timestamp_offsets; |
42 | | - |
43 | | - uint16_t ndp_packet_buffer_processed; |
44 | | - uint16_t ndp_packet_buffer_packets; |
45 | | - struct ndp_packet *ndp_packet_buffer; |
46 | | - bool ndp_packet_buffer_valid; |
| 30 | + void set_booted_fw(); |
| 31 | + void convert_fw_ts_to_timeval(const uint64_t* fw_ts, struct timeval* tv); |
| 32 | + void set_sw_timestamp(struct timeval* tv); |
| 33 | + bool retrieve_ndp_packets(); |
| 34 | + struct nfb_device* dev_handle; // NFB device |
| 35 | + std::vector<struct nfb_device*> dev_handles; // NFB devices |
| 36 | + std::vector<struct ndp_queue*> rx_handles; // data receiving NDP queues |
| 37 | + struct ndp_queue* rx_handle; // data receiving NDP queue |
| 38 | + uint64_t processed_packets; |
| 39 | + uint16_t packet_bufferSize; |
| 40 | + uint64_t timeout; |
| 41 | + |
| 42 | + NdpFwType fw_type; |
| 43 | + std::vector<uint32_t> ndk_timestamp_offsets; |
| 44 | + |
| 45 | + uint16_t ndp_packet_buffer_processed; |
| 46 | + uint16_t ndp_packet_buffer_packets; |
| 47 | + struct ndp_packet* ndp_packet_buffer; |
| 48 | + bool ndp_packet_buffer_valid; |
| 49 | + |
| 50 | + uint64_t port_index = 0; |
47 | 51 | }; |
48 | 52 |
|
49 | | -#endif //NFBREADER_HPP |
| 53 | +#endif // NFBREADER_HPP |
0 commit comments