wireshark/wiretap/netscreen.h
John Thacker 13c8a2f887 Convert Wiretap to C99
This one is complicated because a gboolean is an int, but a bool
is not, in the way that a pointer to a bool (including in the
return of a function pointer) cannot be substituted for a pointer
to a gboolean. (They can convert a bool used internally to a gboolean
on return.)

Continue for that reason to have some functions return gboolean
when used with glib callback functions:
https://docs.gtk.org/glib/callback.HRFunc.html

Another small gotcha is that macros like UINT64_C are not necessarily
guaranteed to wrap the return in parentheses, which G_GUINT64_CONSTANT
and the like do.

In wtap.h, the file subtype "dump_open" function was typedef'd
as returning an int, but almost all users (except in wslua) returned
a gboolean. Switch it to a bool.

Make a note about why can_write_encap does not return a bool,
because it returns error codes on failure (for Lua) instead of
having the err as a separate parameter.

Update the usbdump wiretap plugin too.

A few places outside of wiretap use wiretap function pointers, such
as in the Lua interface, adding IP addresses to NRBs, merging, and
the frame dissector using wiretap functions. Switch those to bool.

Ping #19116
2024-03-20 20:48:19 +00:00

40 lines
1.0 KiB
C

/** @file
*
* Juniper NetScreen snoop output parser
* Created by re-using a lot of code from cosine.c
* Copyright (c) 2007 by Sake Blok <sake@euronet.nl>
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
*/
#ifndef __W_NETSCREEN_H__
#define __W_NETSCREEN_H__
#include <glib.h>
#include "wtap.h"
/* Magic text to check for NetScreen snoop output */
#define NETSCREEN_HDR_MAGIC_STR1 "(i) len="
#define NETSCREEN_HDR_MAGIC_STR2 "(o) len="
/* Magic text for start of packet */
#define NETSCREEN_REC_MAGIC_STR1 NETSCREEN_HDR_MAGIC_STR1
#define NETSCREEN_REC_MAGIC_STR2 NETSCREEN_HDR_MAGIC_STR2
#define NETSCREEN_LINE_LENGTH 128
#define NETSCREEN_HEADER_LINES_TO_CHECK 32
#define NETSCREEN_MAX_INFOLINES 8
#define NETSCREEN_SPACES_ON_INFO_LINE 14
#define NETSCREEN_MAX_INT_NAME_LENGTH 16
#define NETSCREEN_INGRESS false
#define NETSCREEN_EGRESS true
wtap_open_return_val netscreen_open(wtap *wth, int *err, char **err_info);
#endif