Skip to content

Commit 71ee668

Browse files
committed
Wireshark: style tweaks akin to Wireshark practices
Some minor tweaks to the coding style of the Wireshark dissector to bring it closer to the standard practices used in the Wireshark project itself. All changes are compatible with Wireshark 4.6 and should be with 4.4 as well. Define `WS_LOG_DOMAIN`. Allows for more targeted showing/hiding of [log messages](https://www.wireshark.org/docs/wsdg_html/#ChSrcLogging). Use `ws_warning()` instead of `g_warning()` to leverage. Correct spelling of `MAX_SSL_VERSION()` macro. Run script through Wireshark's `tools/convert-glib-types.py` to replace GLib-specific types with C99 standard types (ref Wireshark [#19116](https://gitlab.com/wireshark/wireshark/-/issues/19116)). Make every global variable and every function (except the register and handoff functions) static, since none of them are used outside of this plugin. Remove constant `HFIDS` and instead define `interesting_hfids[]` as having an indefinite number of elements. Use the `array_length()` macro instead for determining the size of the array. It's still calculated at compile time, and removes a potential source of bugs if elements are added to or removed from `interesting_hfids[]` in future changes. Add `g_strfreev()` calls to correspond with each call to `g_strsplit()`, which specifies in its [documentation](https://docs.gtk.org/glib/func.strsplit.html) that its return value must be freed.
1 parent 86eedff commit 71ee668

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

wireshark/source/packet-ja4.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,24 @@ static inline const uint8_t *field_bytes(fvalue_t const *fv) {
5555
#endif
5656
}
5757

58-
static int proto_ja4;
59-
static int proto_http;
60-
static int ett_ja4;
61-
static int hf_ja4s_raw;
62-
static int hf_ja4s;
63-
static int hf_ja4x_raw;
64-
static int hf_ja4x;
65-
static int hf_ja4h;
66-
static int hf_ja4h_raw;
67-
static int hf_ja4h_raw_original;
68-
static int hf_ja4l;
69-
static int hf_ja4l_delta;
70-
static int hf_ja4ls;
71-
static int hf_ja4ls_delta;
72-
static int hf_ja4ssh;
73-
static int hf_ja4t;
74-
static int hf_ja4ts;
75-
static int hf_ja4d;
58+
static int proto_ja4 = -1;
59+
static int proto_http = -1;
60+
static int ett_ja4 = -1;
61+
static int hf_ja4s_raw = -1;
62+
static int hf_ja4s = -1;
63+
static int hf_ja4x_raw = -1;
64+
static int hf_ja4x = -1;
65+
static int hf_ja4h = -1;
66+
static int hf_ja4h_raw = -1;
67+
static int hf_ja4h_raw_original = -1;
68+
static int hf_ja4l = -1;
69+
static int hf_ja4l_delta = -1;
70+
static int hf_ja4ls = -1;
71+
static int hf_ja4ls_delta = -1;
72+
static int hf_ja4ssh = -1;
73+
static int hf_ja4t = -1;
74+
static int hf_ja4ts = -1;
75+
static int hf_ja4d = -1;
7676

7777
static int dissect_ja4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dummy);
7878

0 commit comments

Comments
 (0)