diff options
author | Guy Harris <gharris@sonic.net> | 2021-11-03 10:24:06 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-11-03 10:24:06 -0700 |
commit | 2aaaef7d3a802d4379d7e994d16ac428e5faefe5 (patch) | |
tree | 11d8dfcee4ae02648024d88eb43c109936639c94 /pcap.c | |
parent | 4a8640f5d27e0df51ca95177de7909fac4258990 (diff) |
Fix comments.
On success, pcap_offline_read() and the read_op routine return a value >
0 that is the number of packets read or captured, respectively. Given
that, in the calls to them in pcap_next_ex(), we pass a maximum packet
count of 1, they will read or capture, respectively, at most one packet,
so, in those particular calls, they will return 1 on success.
Diffstat (limited to 'pcap.c')
-rw-r--r-- | pcap.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -622,7 +622,9 @@ pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, * Return codes for pcap_offline_read() are: * - 0: EOF * - -1: error - * - >1: OK + * - >0: OK - result is number of packets read, so + * it will be 1 in this case, as we've passed + * a maximum packet count of 1 * The first one ('0') conflicts with the return code of * 0 from pcap_read() meaning "no packets arrived before * the timeout expired", so we map it to -2 so you can @@ -641,7 +643,9 @@ pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, * - 0: timeout * - -1: error * - -2: loop was broken out of with pcap_breakloop() - * - >1: OK + * - >0: OK, result is number of packets captured, so + * it will be 1 in this case, as we've passed + * a maximum packet count of 1 * The first one ('0') conflicts with the return code of 0 from * pcap_offline_read() meaning "end of file". */ |