| 544 | } |
| 545 | |
| 546 | static int |
| 547 | open_single_tx_pcap(const char *pcap_filename, pcap_dumper_t **dumper) |
| 548 | { |
| 549 | pcap_t *tx_pcap; |
| 550 | |
| 551 | /* |
| 552 | * We need to create a dummy empty pcap_t to use it |
| 553 | * with pcap_dump_open(). We create big enough an Ethernet |
| 554 | * pcap holder. |
| 555 | */ |
| 556 | tx_pcap = pcap_open_dead_with_tstamp_precision(DLT_EN10MB, |
| 557 | RTE_ETH_PCAP_SNAPSHOT_LEN, PCAP_TSTAMP_PRECISION_NANO); |
| 558 | if (tx_pcap == NULL) { |
| 559 | PMD_LOG(ERR, "Couldn't create dead pcap"); |
| 560 | return -1; |
| 561 | } |
| 562 | |
| 563 | /* The dumper is created using the previous pcap_t reference */ |
| 564 | *dumper = pcap_dump_open(tx_pcap, pcap_filename); |
| 565 | if (*dumper == NULL) { |
| 566 | pcap_close(tx_pcap); |
| 567 | PMD_LOG(ERR, "Couldn't open %s for writing.", |
| 568 | pcap_filename); |
| 569 | return -1; |
| 570 | } |
| 571 | |
| 572 | pcap_close(tx_pcap); |
| 573 | return 0; |
| 574 | } |
| 575 | |
| 576 | static int |
| 577 | open_single_rx_pcap(const char *pcap_filename, pcap_t **pcap) |
no outgoing calls
no test coverage detected