* Copyright (c) 2010 by Hadriel Kaplan <hadrielk@yahoo.com>
* with generous copying from other wiretaps, such as pcapng
*
- * 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.
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
/* File format reference:
gint64 *data_offset);
static gboolean
ipfix_seek_read(wtap *wth, gint64 seek_off,
- struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info);
+ wtap_rec *rec, Buffer *buf, int *err, gchar **err_info);
#define IPFIX_VERSION 10
* errors (EOF is ok, since return value is still FALSE).
*/
static gboolean
-ipfix_read_message(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
+ipfix_read_message(FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info)
{
ipfix_message_header_t msg_hdr;
return FALSE;
/*
* The maximum value of msg_hdr.message_length is 65535, which is
- * less than WTAP_MAX_PACKET_SIZE will ever be, so we don't need
+ * less than WTAP_MAX_PACKET_SIZE_STANDARD will ever be, so we don't need
* to check it.
*/
- phdr->rec_type = REC_TYPE_PACKET;
- phdr->presence_flags = WTAP_HAS_TS;
- phdr->len = msg_hdr.message_length;
- phdr->caplen = msg_hdr.message_length;
- phdr->ts.secs = msg_hdr.export_time_secs;
- phdr->ts.nsecs = 0;
+ rec->rec_type = REC_TYPE_PACKET;
+ rec->presence_flags = WTAP_HAS_TS;
+ rec->rec_header.packet_header.len = msg_hdr.message_length;
+ rec->rec_header.packet_header.caplen = msg_hdr.message_length;
+ rec->ts.secs = msg_hdr.export_time_secs;
+ rec->ts.nsecs = 0;
return wtap_read_packet_bytes(fh, buf, msg_hdr.message_length, err, err_info);
}
ipfix_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
{
*data_offset = file_tell(wth->fh);
- ipfix_debug("ipfix_read: data_offset is initially %" G_GINT64_MODIFIER "d", *data_offset);
+ ipfix_debug("ipfix_read: data_offset is initially %" G_GINT64_MODIFIER "d",
+ wth->rec.rec_header.packet_header.file_offset);
- if (!ipfix_read_message(wth->fh, &wth->phdr, wth->frame_buffer, err, err_info)) {
+ if (!ipfix_read_message(wth->fh, &wth->rec, wth->rec_data, err, err_info)) {
ipfix_debug("ipfix_read: couldn't read message header with code: %d\n, and error '%s'",
*err, *err_info);
return FALSE;
/* classic wtap: seek to file position and read packet */
static gboolean
-ipfix_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
+ipfix_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec,
Buffer *buf, int *err, gchar **err_info)
{
/* seek to the right file position */
ipfix_debug("ipfix_seek_read: reading at offset %" G_GINT64_MODIFIER "u", seek_off);
- if (!ipfix_read_message(wth->random_fh, phdr, buf, err, err_info)) {
+ if (!ipfix_read_message(wth->random_fh, rec, buf, err, err_info)) {
ipfix_debug("ipfix_seek_read: couldn't read message header");
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;