#include <errno.h>#include <memory.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "pcap-int.h"Go to the source code of this file.
| Data Structures | |
| struct | linktype_map | 
| Defines | |
| #define | TCPDUMP_MAGIC 0xa1b2c3d4 | 
| #define | PATCHED_TCPDUMP_MAGIC 0xa1b2cd34 | 
| #define | SWAPLONG(y) ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff)) | 
| #define | SWAPSHORT(y) ( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) ) | 
| #define | SFERR_TRUNC 1 | 
| #define | SFERR_BADVERSION 2 | 
| #define | SFERR_BADF 3 | 
| #define | SFERR_EOF 4 | 
| #define | LINKTYPE_NULL DLT_NULL | 
| #define | LINKTYPE_ETHERNET DLT_EN10MB | 
| #define | LINKTYPE_EXP_ETHERNET DLT_EN3MB | 
| #define | LINKTYPE_AX25 DLT_AX25 | 
| #define | LINKTYPE_PRONET DLT_PRONET | 
| #define | LINKTYPE_CHAOS DLT_CHAOS | 
| #define | LINKTYPE_TOKEN_RING DLT_IEEE802 | 
| #define | LINKTYPE_ARCNET DLT_ARCNET | 
| #define | LINKTYPE_SLIP DLT_SLIP | 
| #define | LINKTYPE_PPP DLT_PPP | 
| #define | LINKTYPE_FDDI DLT_FDDI | 
| #define | LINKTYPE_PPP_HDLC 50 | 
| #define | LINKTYPE_PPP_ETHER 51 | 
| #define | LINKTYPE_ATM_RFC1483 100 | 
| #define | LINKTYPE_RAW 101 | 
| #define | LINKTYPE_SLIP_BSDOS 102 | 
| #define | LINKTYPE_PPP_BSDOS 103 | 
| #define | LINKTYPE_C_HDLC 104 | 
| #define | LINKTYPE_IEEE802_11 105 | 
| #define | LINKTYPE_ATM_CLIP 106 | 
| #define | LINKTYPE_FRELAY 107 | 
| #define | LINKTYPE_LOOP 108 | 
| #define | LINKTYPE_LINUX_SLL 113 | 
| #define | LINKTYPE_LTALK 114 | 
| #define | LINKTYPE_ECONET 115 | 
| #define | LINKTYPE_CISCO_IOS 118 | 
| #define | LINKTYPE_PRISM_HEADER 119 | 
| #define | LINKTYPE_AIRONET_HEADER 120 | 
| #define | LINKTYPE_IP_OVER_FC 122 | 
| #define | LINKTYPE_SUNATM 123 | 
| #define | LINKTYPE_IEEE802_11_RADIO 127 | 
| #define | LINKTYPE_TZSP 128 | 
| #define | LINKTYPE_ARCNET_LINUX 129 | 
| #define | LINKTYPE_ENC 109 | 
| #define | LINKTYPE_LANE8023 110 | 
| #define | LINKTYPE_HIPPI 111 | 
| #define | LINKTYPE_HDLC 112 | 
| #define | LINKTYPE_IPFILTER 116 | 
| #define | LINKTYPE_PFLOG 117 | 
| #define | LINKTYPE_HHDLC 121 | 
| #define | LINKTYPE_RIO 124 | 
| #define | LINKTYPE_PCI_EXP 125 | 
| #define | LINKTYPE_AURORA 126 | 
| Functions | |
| int | dlt_to_linktype (int dlt) | 
| int | linktype_to_dlt (int linktype) | 
| int | sf_write_header (FILE *fp, int linktype, int thiszone, int snaplen) | 
| void | swap_hdr (struct pcap_file_header *hp) | 
| pcap_t * | pcap_open_offline (const char *fname, char *errbuf) | 
| Deprecated: use the pcap_open() instead. Opens a savefile in the tcpdump/libpcap format to read the packets. | |
| int | sf_next_packet (pcap_t *p, struct pcap_pkthdr *hdr, u_char *buf, int buflen) | 
| int | pcap_offline_read (pcap_t *p, int cnt, pcap_handler callback, u_char *user) | 
| void | pcap_dump (u_char *user, const struct pcap_pkthdr *h, const u_char *sp) | 
| Saves a packet to disk. | |
| pcap_dumper_t * | pcap_dump_open (pcap_t *p, const char *fname) | 
| Opens a file to write the network traffic. | |
| int | pcap_dump_flush (pcap_dumper_t *p) | 
| void | pcap_dump_close (pcap_dumper_t *p) | 
| pcap_dump_close() closes the "savefile". | |
| Variables | |
| const char | rcsid [] | 
| linktype_map | map [] | 
| 
 | 
| 
 Definition at line 166 of file savefile.c. | 
| 
 | 
| 
 Definition at line 126 of file savefile.c. | 
| 
 | 
| 
 Definition at line 174 of file savefile.c. | 
| 
 | 
| 
 Definition at line 156 of file savefile.c. | 
| 
 | 
| 
 Definition at line 150 of file savefile.c. | 
| 
 | 
| 
 Definition at line 188 of file savefile.c. | 
| 
 | 
| 
 Definition at line 122 of file savefile.c. | 
| 
 | 
| 
 Definition at line 154 of file savefile.c. | 
| 
 | 
| 
 Definition at line 124 of file savefile.c. | 
| 
 | 
| 
 Definition at line 164 of file savefile.c. | 
| 
 | 
| 
 Definition at line 162 of file savefile.c. | 
| 
 | 
| 
 Definition at line 179 of file savefile.c. | 
| 
 | 
| 
 Definition at line 120 of file savefile.c. | 
| 
 | 
| 
 Definition at line 121 of file savefile.c. | 
| 
 | 
| 
 Definition at line 129 of file savefile.c. | 
| 
 | 
| 
 Definition at line 157 of file savefile.c. | 
| 
 | 
| 
 Definition at line 182 of file savefile.c. | 
| 
 | 
| 
 Definition at line 185 of file savefile.c. | 
| 
 | 
| 
 Definition at line 181 of file savefile.c. | 
| 
 | 
| 
 Definition at line 155 of file savefile.c. | 
| 
 | 
| 
 Definition at line 170 of file savefile.c. | 
| 
 | 
| 
 Definition at line 167 of file savefile.c. | 
| 
 | 
| 
 Definition at line 183 of file savefile.c. | 
| 
 | 
| 
 Definition at line 180 of file savefile.c. | 
| 
 | 
| 
 Definition at line 160 of file savefile.c. | 
| 
 | 
| 
 Definition at line 158 of file savefile.c. | 
| 
 | 
| 
 Definition at line 161 of file savefile.c. | 
| 
 | 
| 
 Definition at line 119 of file savefile.c. | 
| 
 | 
| 
 Definition at line 187 of file savefile.c. | 
| 
 | 
| 
 Definition at line 184 of file savefile.c. | 
| 
 | 
| 
 Definition at line 128 of file savefile.c. | 
| 
 | 
| 
 Definition at line 153 of file savefile.c. | 
| 
 | 
| 
 Definition at line 148 of file savefile.c. | 
| 
 | 
| 
 Definition at line 146 of file savefile.c. | 
| 
 | 
| 
 Definition at line 165 of file savefile.c. | 
| 
 | 
| 
 Definition at line 123 of file savefile.c. | 
| 
 | 
| 
 Definition at line 151 of file savefile.c. | 
| 
 | 
| 
 Definition at line 186 of file savefile.c. | 
| 
 | 
| 
 Definition at line 127 of file savefile.c. | 
| 
 | 
| 
 Definition at line 152 of file savefile.c. | 
| 
 | 
| 
 Definition at line 168 of file savefile.c. | 
| 
 | 
| 
 Definition at line 125 of file savefile.c. | 
| 
 | 
| 
 Definition at line 172 of file savefile.c. | 
| 
 | 
| 
 Definition at line 53 of file savefile.c. Referenced by pcap_open_offline(). | 
| 
 | 
| 
 Definition at line 72 of file savefile.c. | 
| 
 | 
| 
 Definition at line 71 of file savefile.c. | 
| 
 | 
| 
 Definition at line 73 of file savefile.c. | 
| 
 | 
| 
 Definition at line 70 of file savefile.c. | 
| 
 | 
| 
 Definition at line 65 of file savefile.c. | 
| 
 | 
| 
 Definition at line 67 of file savefile.c. Referenced by swap_hdr(). | 
| 
 | 
| 
 Definition at line 52 of file savefile.c. | 
| 
 | 
| 
 Definition at line 320 of file savefile.c. References linktype_map::dlt, linktype_map::linktype, and map. Referenced by pcap_dump_open(). | 
| 
 | 
| 
 Definition at line 338 of file savefile.c. References linktype_map::dlt, linktype_map::linktype, and map. Referenced by pcap_open_offline(). | 
| 
 | ||||||||||||||||
| Saves a packet to disk. pcap_dump() outputs a packet to the "savefile" opened with pcap_dump_open(). Note that its calling arguments are suitable for use with pcap_dispatch() or pcap_loop(). If called directly, the user parameter is of type pcap_dumper_t as returned by pcap_dump_open(). 
 
 Definition at line 650 of file savefile.c. References pcap_pkthdr::caplen, pcap_pkthdr::len, and pcap_pkthdr::ts. Referenced by dispatcher_handler(). | 
| 
 | 
| pcap_dump_close() closes the "savefile". 
 
 Definition at line 715 of file savefile.c. | 
| 
 | 
| 
 Definition at line 705 of file savefile.c. | 
| 
 | ||||||||||||
| Opens a file to write the network traffic. pcap_dump_open() is called to open a "savefile" for writing. fname is the name of the file to open. The name "-" in a synonym for stdout. If NULL is returned, pcap_geterr() can be used to get the error text. 
 
 Definition at line 669 of file savefile.c. References dlt_to_linktype(), pcap_dumper_t, pcap_strerror(), sf_write_header(), and snprintf. Referenced by main(). | 
| 
 | ||||||||||||||||||||
| 
 Definition at line 619 of file savefile.c. References bpf_filter(), pcap_pkthdr::caplen, pcap_pkthdr::len, n, and sf_next_packet(). Referenced by pcap_dispatch(), pcap_loop(), and pcap_next_ex(). | 
| 
 | ||||||||||||
| Deprecated: use the pcap_open() instead. Opens a savefile in the tcpdump/libpcap format to read the packets. pcap_open_offline() is called to open a "savefile" for reading. fname specifies the name of the file to open. The file has the same format as those used by tcpdump(1) and tcpslice(1). The name "-" in a synonym for stdin. errbuf is used to return error text and is only set when pcap_open_offline() fails and returns NULL. 
 Definition at line 387 of file savefile.c. References bpf_u_int32, linktype_to_dlt(), PATCHED_TCPDUMP_MAGIC, pcap_fddipad, pcap_strerror(), pcap_t, PCAP_VERSION_MAJOR, snprintf, swap_hdr(), and TCPDUMP_MAGIC. Referenced by main(), and pcap_open(). | 
| 
 | ||||||||||||||||||||
| 
 Definition at line 517 of file savefile.c. References pcap_pkthdr::caplen, pcap_pkthdr::len, snprintf, and pcap_pkthdr::ts. Referenced by pcap_offline_read(). | 
| 
 | ||||||||||||||||||||
| 
 Definition at line 356 of file savefile.c. References pcap_file_header::linktype, pcap_file_header::magic, PCAP_VERSION_MAJOR, PCAP_VERSION_MINOR, pcap_file_header::sigfigs, pcap_file_header::snaplen, TCPDUMP_MAGIC, pcap_file_header::thiszone, pcap_file_header::version_major, and pcap_file_header::version_minor. Referenced by pcap_dump_open(). | 
| 
 | 
| 
 Definition at line 376 of file savefile.c. References pcap_file_header::linktype, pcap_file_header::sigfigs, pcap_file_header::snaplen, SWAPSHORT, pcap_file_header::thiszone, pcap_file_header::version_major, and pcap_file_header::version_minor. Referenced by pcap_open_offline(). | 
| 
 | 
| 
 Referenced by dlt_to_linktype(), and linktype_to_dlt(). | 
| 
 | 
| Initial value: 
    "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.75 2003/01/23 07:24:53 guy Exp $ (LBL)"
Definition at line 32 of file savefile.c. | 
 documentation. Copyright (c) 2002-2003 Politecnico di Torino. All rights reserved.
documentation. Copyright (c) 2002-2003 Politecnico di Torino. All rights reserved.