wireshark/wiretap/ruby_marshal.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

36 lines
660 B
C

/** @file
*
* Copyright 2018, Dario Lombardo <lomato@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
*/
#ifndef __RUBY_MARSHAL_H__
#define __RUBY_MARSHAL_H__
#include <glib.h>
#include "wtap.h"
// Current Ruby Marshal library version
#define RUBY_MARSHAL_MAJOR 4
#define RUBY_MARSHAL_MINOR 8
wtap_open_return_val ruby_marshal_open(wtap *wth, int *err, char **err_info);
#endif
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/