diff options
Diffstat (limited to 'savefile.c')
-rw-r--r-- | savefile.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/savefile.c b/savefile.c index db8a3aa05972..c711a81c3735 100644 --- a/savefile.c +++ b/savefile.c @@ -28,9 +28,7 @@ * dependent values so we can print the dump file on any architecture. */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif #include <pcap-types.h> #ifdef _WIN32 @@ -191,7 +189,7 @@ sf_oid_set_request(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_, static u_int sf_sendqueue_transmit(pcap_t *p, pcap_send_queue *queue _U_, int sync _U_) { - pcap_strlcpy(p->errbuf, "Sending packets isn't supported on savefiles", + pcapint_strlcpy(p->errbuf, "Sending packets isn't supported on savefiles", PCAP_ERRBUF_SIZE); return (0); } @@ -230,7 +228,7 @@ sf_get_airpcap_handle(pcap_t *pcap _U_) static int sf_inject(pcap_t *p, const void *buf _U_, int size _U_) { - pcap_strlcpy(p->errbuf, "Sending packets isn't supported on savefiles", + pcapint_strlcpy(p->errbuf, "Sending packets isn't supported on savefiles", PCAP_ERRBUF_SIZE); return (-1); } @@ -248,7 +246,7 @@ sf_setdirection(pcap_t *p, pcap_direction_t d _U_) } void -sf_cleanup(pcap_t *p) +pcapint_sf_cleanup(pcap_t *p) { if (p->rfile != stdin) (void)fclose(p->rfile); @@ -268,7 +266,7 @@ sf_cleanup(pcap_t *p) * local code page. */ FILE * -charset_fopen(const char *path, const char *mode) +pcapint_charset_fopen(const char *path, const char *mode) { wchar_t *utf16_path; #define MAX_MODE_LEN 16 @@ -278,7 +276,7 @@ charset_fopen(const char *path, const char *mode) FILE *fp; int save_errno; - if (pcap_utf_8_mode) { + if (pcapint_utf_8_mode) { /* * Map from UTF-8 to UTF-16LE. * Fail if there are invalid characters in the input @@ -375,7 +373,7 @@ pcap_open_offline_with_tstamp_precision(const char *fname, u_int precision, } else { /* - * Use charset_fopen(); on Windows, it tests whether we're + * Use pcapint_charset_fopen(); on Windows, it tests whether we're * in "local code page" or "UTF-8" mode, and treats the * pathname appropriately, and on other platforms, it just * wraps fopen(). @@ -384,9 +382,9 @@ pcap_open_offline_with_tstamp_precision(const char *fname, u_int precision, * support it, even though it does nothing. For MS-DOS, * we again need it. */ - fp = charset_fopen(fname, "rb"); + fp = pcapint_charset_fopen(fname, "rb"); if (fp == NULL) { - pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, + pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, errno, "%s", fname); return (NULL); } @@ -416,7 +414,7 @@ pcap_t* pcap_hopen_offline_with_tstamp_precision(intptr_t osfd, u_int precision, fd = _open_osfhandle(osfd, _O_RDONLY); if ( fd < 0 ) { - pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, + pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, errno, "_open_osfhandle"); return NULL; } @@ -424,7 +422,7 @@ pcap_t* pcap_hopen_offline_with_tstamp_precision(intptr_t osfd, u_int precision, file = _fdopen(fd, "rb"); if ( file == NULL ) { - pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, + pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, errno, "_fdopen"); _close(fd); return NULL; @@ -451,7 +449,7 @@ pcap_t* pcap_hopen_offline(intptr_t osfd, char *errbuf) * signed is that pcap_snapshot() returns an int, not an unsigned int. */ bpf_u_int32 -pcap_adjust_snapshot(bpf_u_int32 linktype, bpf_u_int32 snaplen) +pcapint_adjust_snapshot(bpf_u_int32 linktype, bpf_u_int32 snaplen) { if (snaplen == 0 || snaplen > INT_MAX) { /* @@ -511,7 +509,7 @@ pcap_fopen_offline_with_tstamp_precision(FILE *fp, u_int precision, amt_read = fread(&magic, 1, sizeof(magic), fp); if (amt_read != sizeof(magic)) { if (ferror(fp)) { - pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, + pcapint_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE, errno, "error reading dump file"); } else { snprintf(errbuf, PCAP_ERRBUF_SIZE, @@ -562,9 +560,9 @@ found: #endif p->can_set_rfmon_op = sf_cant_set_rfmon; - p->read_op = pcap_offline_read; + p->read_op = pcapint_offline_read; p->inject_op = sf_inject; - p->setfilter_op = install_bpf_program; + p->setfilter_op = pcapint_install_bpf_program; p->setdirection_op = sf_setdirection; p->set_datalink_op = NULL; /* we don't support munging link-layer headers */ p->getnonblock_op = sf_getnonblock; @@ -589,12 +587,12 @@ found: * For offline captures, the standard one-shot callback can * be used for pcap_next()/pcap_next_ex(). */ - p->oneshot_callback = pcap_oneshot; + p->oneshot_callback = pcapint_oneshot; /* * Default breakloop operation. */ - p->breakloop_op = pcap_breakloop_common; + p->breakloop_op = pcapint_breakloop_common; /* * Savefiles never require special BPF code generation. @@ -626,7 +624,7 @@ pcap_fopen_offline(FILE *fp, char *errbuf) * If cnt > 0, return after 'cnt' packets, otherwise continue until eof. */ int -pcap_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) +pcapint_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { struct bpf_insn *fcode; int n = 0; @@ -687,7 +685,7 @@ pcap_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) * and, if it passes, process it. */ if ((fcode = p->fcode.bf_insns) == NULL || - pcap_filter(fcode, data, h.len, h.caplen)) { + pcapint_filter(fcode, data, h.len, h.caplen)) { (*callback)(user, &h, data); n++; /* count the packet */ if (n >= cnt) |