forked from osmocom/wireshark
63479adf63
For some routines that take multiple arguments that come from a struct wtap_pkthdr, pass a pointer to the struct wtap_pkthdr in question, rather than the separate arguments. Do this even if we're passing expressions that were earlier assigned to the struct wtap_pkthdr fields in question. This simplifies the calling sequences and ensures that the right values are picked up by the called routine; in at least one case we were *not* passing the right values (the code to handle Simple Packet Blocks in pcap-ng files). Also, call the byte-swapping routines for pseudo-header fields only if we need to do byte-swapping. Change-Id: I3a8badfcfeb0237dfc1d1014185a67f18c0f2ebe Reviewed-on: https://code.wireshark.org/review/119 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
48 lines
1.7 KiB
C
48 lines
1.7 KiB
C
/* pcap-common.h
|
|
* Declarations for code common to libpcap and pcap-NG file formats
|
|
*
|
|
* $Id$
|
|
*
|
|
* Wiretap Library
|
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
|
|
*
|
|
* File format support for pcap-ng file format
|
|
* Copyright (c) 2007 by Ulf Lamping <ulf.lamping@web.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*/
|
|
|
|
#ifndef __W_PCAP_COMMON_H__
|
|
#define __W_PCAP_COMMON_H__
|
|
|
|
#include <glib.h>
|
|
#include <wtap.h>
|
|
#include "ws_symbol_export.h"
|
|
|
|
extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
|
guint packet_size, gboolean check_packet_size,
|
|
struct wtap_pkthdr *phdr, int *err, gchar **err_info);
|
|
|
|
extern void pcap_read_post_process(int file_type, int wtap_encap,
|
|
struct wtap_pkthdr *phdr, guint8 *pd, gboolean bytes_swapped, int fcs_len);
|
|
|
|
extern int pcap_get_phdr_size(int encap,
|
|
const union wtap_pseudo_header *pseudo_header);
|
|
|
|
extern gboolean pcap_write_phdr(wtap_dumper *wdh, int wtap_encap,
|
|
const union wtap_pseudo_header *pseudo_header, int *err);
|
|
|
|
#endif
|