1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-30 03:19:02 +00:00

Use libnetutil's read_reply_pcap to deduplicate pcap reading logic.

This commit is contained in:
dmiller
2020-01-13 21:48:04 +00:00
parent 00cb4d22d9
commit 4ffeb09ad3
4 changed files with 143 additions and 237 deletions

View File

@@ -583,6 +583,16 @@ int read_ns_reply_pcap(pcap_t *pd, u8 *sendermac,
struct timeval *rcvdtime,
void (*traceArp_callback)(int, const u8 *, u32 , struct timeval *));
/* Attempts to read one IP packet from the pcap descriptor pd. Input parameters are pd,
to_usec, and accept_callback. If a received frame passes accept_callback,
then the output parameters p, head, rcvdtime, datalink, and offset are filled
in, and the function returns 1. If no frame passes before the timeout, then
the function returns 0 and the output parameters are undefined. */
int read_reply_pcap(pcap_t *pd, long to_usec,
bool (*accept_callback)(const unsigned char *, const struct pcap_pkthdr *, int, size_t),
const unsigned char **p, struct pcap_pkthdr **head, struct timeval *rcvdtime,
int *datalink, size_t *offset);
/* Read a single host specification from a file, as for -iL and --excludefile.
It returns the length of the string read; an overflow is indicated when the
return value is >= n. Returns 0 if there was no specification to be read. The