1 .\" @(#) $Header: /tcpdump/master/libpcap/pcap_next_ex.3pcap,v 1.1 2008-04-05 20:19:42 guy Exp $
3 .\" Copyright (c) 1994, 1996, 1997
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that: (1) source code distributions
8 .\" retain the above copyright notice and this paragraph in its entirety, (2)
9 .\" distributions including binary code include the above copyright notice and
10 .\" this paragraph in its entirety in the documentation or other materials
11 .\" provided with the distribution, and (3) all advertising materials mentioning
12 .\" features or use of this software display the following acknowledgement:
13 .\" ``This product includes software developed by the University of California,
14 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 .\" the University nor the names of its contributors may be used to endorse
16 .\" or promote products derived from this software without specific prior
17 .\" written permission.
18 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 .TH PCAP_NEXT_EX 3PCAP "4 April 2008"
24 pcap_next_ex, pcap_next \- read the next packet from a pcap_t
32 int pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header,
34 const u_char **pkt_data);
35 const u_char *pcap_next(pcap_t *p, struct pcap_pkthdr *h);
40 reads the next packet and returns a success/failure indication.
41 If the packet was read without problems, the pointer pointed to by the
43 argument is set to point to the
45 struct for the packet, and the
46 pointer pointed to by the
48 argument is set to point to the data in the packet.
51 reads the next packet (by calling
57 pointer to the data in that packet.
60 structure pointed to by
62 is filled in with the appropriate values for the packet.
65 returns 1 if the packet was read without problems, 0
66 if packets are being read from a live capture, and the timeout expired,
67 \-1 if an error occurred while reading the packet, and \-2 if
68 packets are being read from a ``savefile'', and there are no more
69 packets to read from the savefile.
76 as an argument to fetch or display the error text.
79 returns a pointer to the packet data on success, and returns
81 if an error occured, or if no packets were read from a live
82 capture (if, for example, they were discarded because they didn't pass
83 the packet filter, or if, on platforms that support a read timeout that
84 starts before any packets arrive, the timeout expires before any packets
85 arrive, or if the file descriptor for the capture device is in
86 non-blocking mode and no packets were available to be read), or if no
87 more packets are available in a ``savefile.'' Unfortunately, there is
88 no way to determine whether an error occured or not.
90 pcap_geterr(3PCAP), pcap_dispatch(3PCAP)