Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-fractalgeneratorprotocol.c
blob4bfe15d744d560c62cfeb5ea5f6568c5ac024817
1 /* packet-fractalgeneratorprotocol.c
2 * Routines for the Fractal Generator Protocol, a test application of the
3 * RSPLIB RSerPool implementation
4 * https://www.uni-due.de/~be0001/rserpool/
6 * Copyright 2006-2021 by Thomas Dreibholz <dreibh [AT] iem.uni-due.de>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * Copied from README.developer
14 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include "config.h"
19 #include <epan/packet.h>
20 #include <epan/sctpppids.h>
21 #include <epan/stat_tap_ui.h>
22 #include <wsutil/array.h>
24 void proto_register_fractalgeneratorprotocol(void);
25 void proto_reg_handoff_fractalgeneratorprotocol(void);
27 static dissector_handle_t fgp_handle;
29 #define FRACTALGENERATORPROTOCOL_PAYLOAD_PROTOCOL_ID_LEGACY 0x29097601
32 /* Initialize the protocol and registered fields */
33 static int proto_fractalgeneratorprotocol;
34 static int tap_fractalgeneratorprotocol = -1;
35 static int hf_message_type;
36 static int hf_message_flags;
37 static int hf_message_length;
38 static int hf_data_start_x;
39 static int hf_data_start_y;
40 static int hf_data_points;
41 static int hf_parameter_width;
42 static int hf_parameter_height;
43 static int hf_parameter_maxiterations;
44 static int hf_parameter_algorithmid;
45 static int hf_parameter_c1real;
46 static int hf_parameter_c1imag;
47 static int hf_parameter_c2real;
48 static int hf_parameter_c2imag;
49 static int hf_parameter_n;
50 static int hf_buffer;
52 static uint64_t fgp_total_msgs;
53 static uint64_t fgp_total_bytes;
55 /* Initialize the subtree pointers */
56 static int ett_fractalgeneratorprotocol;
58 /* Dissectors for messages. This is specific to FractalGeneratorProtocol */
59 #define MESSAGE_TYPE_LENGTH 1
60 #define MESSAGE_FLAGS_LENGTH 1
61 #define MESSAGE_LENGTH_LENGTH 2
63 #define MESSAGE_TYPE_OFFSET 0
64 #define MESSAGE_FLAGS_OFFSET (MESSAGE_TYPE_OFFSET + MESSAGE_TYPE_LENGTH)
65 #define MESSAGE_LENGTH_OFFSET (MESSAGE_FLAGS_OFFSET + MESSAGE_FLAGS_OFFSET)
66 #define MESSAGE_VALUE_OFFSET (MESSAGE_LENGTH_OFFSET + MESSAGE_LENGTH_LENGTH)
69 #define DATA_STARTX_LENGTH 4
70 #define DATA_STARTY_LENGTH 4
71 #define DATA_POINTS_LENGTH 4
72 #define DATA_BUFFER_LENGTH 4
74 #define DATA_STARTX_OFFSET MESSAGE_VALUE_OFFSET
75 #define DATA_STARTY_OFFSET (DATA_STARTX_OFFSET + DATA_STARTX_LENGTH)
76 #define DATA_POINTS_OFFSET (DATA_STARTY_OFFSET + DATA_STARTY_LENGTH)
77 #define DATA_BUFFER_OFFSET (DATA_POINTS_OFFSET + DATA_POINTS_LENGTH)
80 #define PARAMETER_WIDTH_LENGTH 4
81 #define PARAMETER_HEIGHT_LENGTH 4
82 #define PARAMETER_MAXITERATIONS_LENGTH 4
83 #define PARAMETER_ALGORITHMID_LENGTH 4
84 #define PARAMETER_C1REAL_LENGTH 8
85 #define PARAMETER_C1IMAG_LENGTH 8
86 #define PARAMETER_C2REAL_LENGTH 8
87 #define PARAMETER_C2IMAG_LENGTH 8
88 #define PARAMETER_N_LENGTH 8
90 #define PARAMETER_WIDTH_OFFSET MESSAGE_VALUE_OFFSET
91 #define PARAMETER_HEIGHT_OFFSET (PARAMETER_WIDTH_OFFSET + PARAMETER_WIDTH_LENGTH)
92 #define PARAMETER_MAXITERATIONS_OFFSET (PARAMETER_HEIGHT_OFFSET + PARAMETER_HEIGHT_LENGTH)
93 #define PARAMETER_ALGORITHMID_OFFSET (PARAMETER_MAXITERATIONS_OFFSET + PARAMETER_MAXITERATIONS_LENGTH)
94 #define PARAMETER_C1REAL_OFFSET (PARAMETER_ALGORITHMID_OFFSET + PARAMETER_ALGORITHMID_LENGTH)
95 #define PARAMETER_C1IMAG_OFFSET (PARAMETER_C1REAL_OFFSET + PARAMETER_C1REAL_LENGTH)
96 #define PARAMETER_C2REAL_OFFSET (PARAMETER_C1IMAG_OFFSET + PARAMETER_C1IMAG_LENGTH)
97 #define PARAMETER_C2IMAG_OFFSET (PARAMETER_C2REAL_OFFSET + PARAMETER_C2REAL_LENGTH)
98 #define PARAMETER_N_OFFSET (PARAMETER_C2IMAG_OFFSET + PARAMETER_C2IMAG_LENGTH)
100 #define FRACTALGENERATOR_PARAMETER_MESSAGE_TYPE 0x01
101 #define FRACTALGENERATOR_DATA_MESSAGE_TYPE 0x02
103 static const value_string message_type_values[] = {
104 { FRACTALGENERATOR_PARAMETER_MESSAGE_TYPE, "FractalGenerator Parameter" },
105 { FRACTALGENERATOR_DATA_MESSAGE_TYPE, "FractalGenerator Data" },
106 { 0, NULL }
109 #define FGPA_MANDELBROT 1
110 #define FGPA_MANDELBROTN 2
112 static const value_string algorithmid_values[] = {
113 { FGPA_MANDELBROT, "Mandelbrot: z_{n+1} = z_n^2 + c" },
114 { FGPA_MANDELBROTN, "Mandelbrot-N: z_{n+1} = z_n^N + c" },
115 { 0, NULL }
119 typedef struct _tap_fgp_rec_t {
120 uint8_t type;
121 uint16_t size;
122 const char* type_string;
123 } tap_fgp_rec_t;
126 static void
127 dissect_fgp_parameter_message(tvbuff_t *message_tvb, proto_tree *message_tree)
129 proto_tree_add_item(message_tree, hf_parameter_width, message_tvb, PARAMETER_WIDTH_OFFSET, PARAMETER_WIDTH_LENGTH, ENC_BIG_ENDIAN);
130 proto_tree_add_item(message_tree, hf_parameter_height, message_tvb, PARAMETER_HEIGHT_OFFSET, PARAMETER_HEIGHT_LENGTH, ENC_BIG_ENDIAN);
131 proto_tree_add_item(message_tree, hf_parameter_maxiterations, message_tvb, PARAMETER_MAXITERATIONS_OFFSET, PARAMETER_MAXITERATIONS_LENGTH, ENC_BIG_ENDIAN);
132 proto_tree_add_item(message_tree, hf_parameter_algorithmid, message_tvb, PARAMETER_ALGORITHMID_OFFSET, PARAMETER_ALGORITHMID_LENGTH, ENC_BIG_ENDIAN);
133 proto_tree_add_item(message_tree, hf_parameter_c1real, message_tvb, PARAMETER_C1REAL_OFFSET, PARAMETER_C1REAL_LENGTH, ENC_BIG_ENDIAN);
134 proto_tree_add_item(message_tree, hf_parameter_c1imag, message_tvb, PARAMETER_C1IMAG_OFFSET, PARAMETER_C1IMAG_LENGTH, ENC_BIG_ENDIAN);
135 proto_tree_add_item(message_tree, hf_parameter_c2real, message_tvb, PARAMETER_C2REAL_OFFSET, PARAMETER_C2REAL_LENGTH, ENC_BIG_ENDIAN);
136 proto_tree_add_item(message_tree, hf_parameter_c2imag, message_tvb, PARAMETER_C2IMAG_OFFSET, PARAMETER_C2IMAG_LENGTH, ENC_BIG_ENDIAN);
137 proto_tree_add_item(message_tree, hf_parameter_n, message_tvb, PARAMETER_N_OFFSET, PARAMETER_N_LENGTH, ENC_BIG_ENDIAN);
141 static void
142 dissect_fgp_data_message(tvbuff_t *message_tvb, proto_tree *message_tree)
144 uint16_t buffer_length;
146 proto_tree_add_item(message_tree, hf_data_start_x, message_tvb, DATA_STARTX_OFFSET, DATA_STARTX_LENGTH, ENC_BIG_ENDIAN);
147 proto_tree_add_item(message_tree, hf_data_start_y, message_tvb, DATA_STARTY_OFFSET, DATA_STARTY_LENGTH, ENC_BIG_ENDIAN);
148 proto_tree_add_item(message_tree, hf_data_points, message_tvb, DATA_POINTS_OFFSET, DATA_POINTS_LENGTH, ENC_BIG_ENDIAN);
150 buffer_length = tvb_get_ntohl(message_tvb, DATA_POINTS_OFFSET)*4;
151 if (buffer_length > 0) {
152 proto_tree_add_item(message_tree, hf_buffer, message_tvb, DATA_BUFFER_OFFSET, buffer_length, ENC_NA);
157 static void
158 dissect_fgp_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *fgp_tree)
160 tap_fgp_rec_t* tap_rec = wmem_new0(pinfo->pool, tap_fgp_rec_t);
161 tap_rec->type = tvb_get_uint8(message_tvb, MESSAGE_TYPE_OFFSET);
162 tap_rec->size = tvb_get_ntohs(message_tvb, MESSAGE_LENGTH_OFFSET);
163 tap_rec->type_string = val_to_str_const(tap_rec->type, message_type_values, "Unknown FractalGeneratorProtocol message type");
164 tap_queue_packet(tap_fractalgeneratorprotocol, pinfo, tap_rec);
166 col_add_fstr(pinfo->cinfo, COL_INFO, "%s ", tap_rec->type_string);
168 proto_tree_add_item(fgp_tree, hf_message_type, message_tvb, MESSAGE_TYPE_OFFSET, MESSAGE_TYPE_LENGTH, ENC_BIG_ENDIAN);
169 proto_tree_add_item(fgp_tree, hf_message_flags, message_tvb, MESSAGE_FLAGS_OFFSET, MESSAGE_FLAGS_LENGTH, ENC_BIG_ENDIAN);
170 proto_tree_add_item(fgp_tree, hf_message_length, message_tvb, MESSAGE_LENGTH_OFFSET, MESSAGE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
171 switch (tap_rec->type) {
172 case FRACTALGENERATOR_PARAMETER_MESSAGE_TYPE:
173 dissect_fgp_parameter_message(message_tvb, fgp_tree);
174 break;
175 case FRACTALGENERATOR_DATA_MESSAGE_TYPE:
176 dissect_fgp_data_message(message_tvb, fgp_tree);
177 break;
181 static int
182 dissect_fractalgeneratorprotocol(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
184 proto_item *fgp_item;
185 proto_tree *fgp_tree;
187 col_set_str(pinfo->cinfo, COL_PROTOCOL, "FractalGeneratorProtocol");
189 /* create the fractalgeneratorprotocol protocol tree */
190 fgp_item = proto_tree_add_item(tree, proto_fractalgeneratorprotocol, message_tvb, 0, -1, ENC_NA);
191 fgp_tree = proto_item_add_subtree(fgp_item, ett_fractalgeneratorprotocol);
193 /* dissect the message */
194 dissect_fgp_message(message_tvb, pinfo, fgp_tree);
195 return true;
199 /* TAP STAT INFO */
200 typedef enum
202 MESSAGE_TYPE_COLUMN = 0,
203 MESSAGES_COLUMN,
204 MESSAGES_SHARE_COLUMN,
205 BYTES_COLUMN,
206 BYTES_SHARE_COLUMN,
207 FIRST_SEEN_COLUMN,
208 LAST_SEEN_COLUMN,
209 INTERVAL_COLUMN,
210 MESSAGE_RATE_COLUMN,
211 BYTE_RATE_COLUMN
212 } fgp_stat_columns;
214 static stat_tap_table_item fgp_stat_fields[] = {
215 { TABLE_ITEM_STRING, TAP_ALIGN_LEFT, "FractalGeneratorProtocol Message Type", "%-25s" },
216 { TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Messages ", "%u" },
217 { TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Messages Share (%)" , "%1.3f %%" },
218 { TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Bytes (B)", "%u" },
219 { TABLE_ITEM_UINT, TAP_ALIGN_RIGHT, "Bytes Share (%) ", "%1.3f %%" },
220 { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, "First Seen (s)", "%1.6f" },
221 { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, "Last Seen (s)", "%1.6f" },
222 { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, "Interval (s)", "%1.6f" },
223 { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, "Message Rate (Msg/s)", "%1.2f" },
224 { TABLE_ITEM_FLOAT, TAP_ALIGN_LEFT, "Byte Rate (B/s)", "%1.2f" }
227 static void fgp_stat_init(stat_tap_table_ui* new_stat)
229 const char *table_name = "FractalGeneratorProtocol Statistics";
230 int num_fields = array_length(fgp_stat_fields);
231 stat_tap_table *table;
232 int i = 0;
233 stat_tap_table_item_type items[array_length(fgp_stat_fields)];
235 table = stat_tap_find_table(new_stat, table_name);
236 if (table) {
237 if (new_stat->stat_tap_reset_table_cb) {
238 new_stat->stat_tap_reset_table_cb(table);
240 return;
243 table = stat_tap_init_table(table_name, num_fields, 0, NULL);
244 stat_tap_add_table(new_stat, table);
246 memset(items, 0x0, sizeof(items));
247 /* Add a row for each value type */
248 while (message_type_values[i].strptr) {
249 items[MESSAGE_TYPE_COLUMN].type = TABLE_ITEM_STRING;
250 items[MESSAGE_TYPE_COLUMN].value.string_value = message_type_values[i].strptr;
251 items[MESSAGES_COLUMN].type = TABLE_ITEM_UINT;
252 items[MESSAGES_COLUMN].value.uint_value = 0;
253 items[MESSAGES_SHARE_COLUMN].type = TABLE_ITEM_NONE;
254 items[MESSAGES_SHARE_COLUMN].value.float_value = -1.0;
255 items[BYTES_COLUMN].type = TABLE_ITEM_UINT;
256 items[BYTES_COLUMN].value.uint_value = 0;
257 items[BYTES_SHARE_COLUMN].type = TABLE_ITEM_NONE;
258 items[BYTES_SHARE_COLUMN].value.float_value = -1.0;
259 items[FIRST_SEEN_COLUMN].type = TABLE_ITEM_NONE;
260 items[FIRST_SEEN_COLUMN].value.float_value = DBL_MAX;
261 items[LAST_SEEN_COLUMN].type = TABLE_ITEM_NONE;
262 items[LAST_SEEN_COLUMN].value.float_value = DBL_MIN;
263 items[INTERVAL_COLUMN].type = TABLE_ITEM_NONE;
264 items[INTERVAL_COLUMN].value.float_value = -1.0;
265 items[MESSAGE_RATE_COLUMN].type = TABLE_ITEM_NONE;
266 items[MESSAGE_RATE_COLUMN].value.float_value = -1.0;
267 items[BYTE_RATE_COLUMN].type = TABLE_ITEM_NONE;
268 items[BYTE_RATE_COLUMN].value.float_value = -1.0;
269 stat_tap_init_table_row(table, i, num_fields, items);
270 i++;
274 static tap_packet_status
275 fgp_stat_packet(void* tapdata, packet_info* pinfo _U_, epan_dissect_t* edt _U_, const void* data, tap_flags_t flags _U_)
277 stat_data_t* stat_data = (stat_data_t*)tapdata;
278 const tap_fgp_rec_t* tap_rec = (const tap_fgp_rec_t*)data;
279 stat_tap_table* table;
280 stat_tap_table_item_type* msg_data;
281 int idx;
282 uint64_t messages;
283 uint64_t bytes;
284 int i = 0;
285 double firstSeen = -1.0;
286 double lastSeen = -1.0;
288 idx = str_to_val_idx(tap_rec->type_string, message_type_values);
289 if (idx < 0)
290 return TAP_PACKET_DONT_REDRAW;
292 table = g_array_index(stat_data->stat_tap_data->tables, stat_tap_table*, 0);
294 /* Update packets counter */
295 fgp_total_msgs++;
296 msg_data = stat_tap_get_field_data(table, idx, MESSAGES_COLUMN);
297 msg_data->value.uint_value++;
298 messages = msg_data->value.uint_value;
299 stat_tap_set_field_data(table, idx, MESSAGES_COLUMN, msg_data);
301 /* Update bytes counter */
302 fgp_total_bytes += tap_rec->size;
303 msg_data = stat_tap_get_field_data(table, idx, BYTES_COLUMN);
304 msg_data->value.uint_value += tap_rec->size;
305 bytes = msg_data->value.uint_value;
306 stat_tap_set_field_data(table, idx, BYTES_COLUMN, msg_data);
308 /* Update messages and bytes share */
309 while (message_type_values[i].strptr) {
310 msg_data = stat_tap_get_field_data(table, i, MESSAGES_COLUMN);
311 const unsigned m = msg_data->value.uint_value;
312 msg_data = stat_tap_get_field_data(table, i, BYTES_COLUMN);
313 const unsigned b = msg_data->value.uint_value;
315 msg_data = stat_tap_get_field_data(table, i, MESSAGES_SHARE_COLUMN);
316 msg_data->type = TABLE_ITEM_FLOAT;
317 msg_data->value.float_value = 100.0 * m / (double)fgp_total_msgs;
318 stat_tap_set_field_data(table, i, MESSAGES_SHARE_COLUMN, msg_data);
320 msg_data = stat_tap_get_field_data(table, i, BYTES_SHARE_COLUMN);
321 msg_data->type = TABLE_ITEM_FLOAT;
322 msg_data->value.float_value = 100.0 * b / (double)fgp_total_bytes;
323 stat_tap_set_field_data(table, i, BYTES_SHARE_COLUMN, msg_data);
324 i++;
327 /* Update first seen time */
328 if (pinfo->presence_flags & PINFO_HAS_TS) {
329 msg_data = stat_tap_get_field_data(table, idx, FIRST_SEEN_COLUMN);
330 msg_data->type = TABLE_ITEM_FLOAT;
331 msg_data->value.float_value = MIN(msg_data->value.float_value, nstime_to_sec(&pinfo->rel_ts));
332 firstSeen = msg_data->value.float_value;
333 stat_tap_set_field_data(table, idx, FIRST_SEEN_COLUMN, msg_data);
336 /* Update last seen time */
337 if (pinfo->presence_flags & PINFO_HAS_TS) {
338 msg_data = stat_tap_get_field_data(table, idx, LAST_SEEN_COLUMN);
339 msg_data->type = TABLE_ITEM_FLOAT;
340 msg_data->value.float_value = MAX(msg_data->value.float_value, nstime_to_sec(&pinfo->rel_ts));
341 lastSeen = msg_data->value.float_value;
342 stat_tap_set_field_data(table, idx, LAST_SEEN_COLUMN, msg_data);
345 if ((lastSeen - firstSeen) > 0.0) {
346 /* Update interval */
347 msg_data = stat_tap_get_field_data(table, idx, INTERVAL_COLUMN);
348 msg_data->type = TABLE_ITEM_FLOAT;
349 msg_data->value.float_value = lastSeen - firstSeen;
350 stat_tap_set_field_data(table, idx, INTERVAL_COLUMN, msg_data);
352 /* Update message rate */
353 msg_data = stat_tap_get_field_data(table, idx, MESSAGE_RATE_COLUMN);
354 msg_data->type = TABLE_ITEM_FLOAT;
355 msg_data->value.float_value = messages / (lastSeen - firstSeen);
356 stat_tap_set_field_data(table, idx, MESSAGE_RATE_COLUMN, msg_data);
358 /* Update byte rate */
359 msg_data = stat_tap_get_field_data(table, idx, BYTE_RATE_COLUMN);
360 msg_data->type = TABLE_ITEM_FLOAT;
361 msg_data->value.float_value = bytes / (lastSeen - firstSeen);
362 stat_tap_set_field_data(table, idx, BYTE_RATE_COLUMN, msg_data);
365 return TAP_PACKET_REDRAW;
368 static void
369 fgp_stat_reset(stat_tap_table* table)
371 unsigned element;
372 stat_tap_table_item_type* item_data;
374 for (element = 0; element < table->num_elements; element++) {
375 item_data = stat_tap_get_field_data(table, element, MESSAGES_COLUMN);
376 item_data->value.uint_value = 0;
377 stat_tap_set_field_data(table, element, MESSAGES_COLUMN, item_data);
379 item_data = stat_tap_get_field_data(table, element, MESSAGES_SHARE_COLUMN);
380 item_data->type = TABLE_ITEM_NONE;
381 item_data->value.float_value = -1.0;
382 stat_tap_set_field_data(table, element, MESSAGES_SHARE_COLUMN, item_data);
384 item_data = stat_tap_get_field_data(table, element, BYTES_COLUMN);
385 item_data->value.uint_value = 0;
386 stat_tap_set_field_data(table, element, BYTES_COLUMN, item_data);
388 item_data = stat_tap_get_field_data(table, element, BYTES_SHARE_COLUMN);
389 item_data->type = TABLE_ITEM_NONE;
390 item_data->value.float_value = -1.0;
391 stat_tap_set_field_data(table, element, BYTES_SHARE_COLUMN, item_data);
393 item_data = stat_tap_get_field_data(table, element, FIRST_SEEN_COLUMN);
394 item_data->type = TABLE_ITEM_NONE;
395 item_data->value.float_value = DBL_MAX;
396 stat_tap_set_field_data(table, element, FIRST_SEEN_COLUMN, item_data);
398 item_data = stat_tap_get_field_data(table, element, LAST_SEEN_COLUMN);
399 item_data->type = TABLE_ITEM_NONE;
400 item_data->value.float_value = DBL_MIN;
401 stat_tap_set_field_data(table, element, LAST_SEEN_COLUMN, item_data);
403 item_data = stat_tap_get_field_data(table, element, INTERVAL_COLUMN);
404 item_data->type = TABLE_ITEM_NONE;
405 item_data->value.float_value = -1.0;
406 stat_tap_set_field_data(table, element, INTERVAL_COLUMN, item_data);
408 item_data = stat_tap_get_field_data(table, element, MESSAGE_RATE_COLUMN);
409 item_data->type = TABLE_ITEM_NONE;
410 item_data->value.float_value = -1.0;
411 stat_tap_set_field_data(table, element, MESSAGE_RATE_COLUMN, item_data);
413 item_data = stat_tap_get_field_data(table, element, BYTE_RATE_COLUMN);
414 item_data->type = TABLE_ITEM_NONE;
415 item_data->value.float_value = -1.0;
416 stat_tap_set_field_data(table, element, BYTE_RATE_COLUMN, item_data);
418 fgp_total_msgs = 0;
419 fgp_total_bytes = 0;
423 /* Register the protocol with Wireshark */
424 void
425 proto_register_fractalgeneratorprotocol(void)
428 /* Setup list of header fields */
429 static hf_register_info hf[] = {
430 { &hf_message_type, { "Type", "fractalgeneratorprotocol.message_type", FT_UINT8, BASE_DEC, VALS(message_type_values), 0x0, NULL, HFILL } },
431 { &hf_message_flags, { "Flags", "fractalgeneratorprotocol.message_flags", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
432 { &hf_message_length, { "Length", "fractalgeneratorprotocol.message_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
433 { &hf_data_start_x, { "StartX", "fractalgeneratorprotocol.data_start_x", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
434 { &hf_data_start_y, { "StartY", "fractalgeneratorprotocol.data_start_y", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
435 { &hf_data_points, { "Points", "fractalgeneratorprotocol.data_points", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
436 { &hf_parameter_width, { "Width", "fractalgeneratorprotocol.parameter_width", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
437 { &hf_parameter_height, { "Height", "fractalgeneratorprotocol.parameter_height", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
438 { &hf_parameter_maxiterations, { "MaxIterations", "fractalgeneratorprotocol.parameter_maxiterations", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
439 { &hf_parameter_algorithmid, { "AlgorithmID", "fractalgeneratorprotocol.parameter_algorithmid", FT_UINT32, BASE_DEC, VALS(algorithmid_values), 0x0, NULL, HFILL } },
440 { &hf_parameter_c1real, { "C1Real", "fractalgeneratorprotocol.parameter_c1real", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
441 { &hf_parameter_c1imag, { "C1Imag", "fractalgeneratorprotocol.parameter_c1imag", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
442 { &hf_parameter_c2real, { "C2Real", "fractalgeneratorprotocol.parameter_c2real", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
443 { &hf_parameter_c2imag, { "C2Imag", "fractalgeneratorprotocol.parameter_c2imag", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
444 { &hf_parameter_n, { "N", "fractalgeneratorprotocol.parameter_n", FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL } },
445 { &hf_buffer, { "Buffer", "fractalgeneratorprotocol.buffer", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
448 /* Setup protocol subtree array */
449 static int *ett[] = {
450 &ett_fractalgeneratorprotocol
453 static tap_param fgp_stat_params[] = {
454 { PARAM_FILTER, "filter", "Filter", NULL, true }
457 static stat_tap_table_ui fgp_stat_table = {
458 REGISTER_STAT_GROUP_RSERPOOL,
459 "FractalGeneratorProtocol Statistics",
460 "fractalgeneratorprotocol",
461 "fractalgeneratorprotocol,stat",
462 fgp_stat_init,
463 fgp_stat_packet,
464 fgp_stat_reset,
465 NULL,
466 NULL,
467 array_length(fgp_stat_fields), fgp_stat_fields,
468 array_length(fgp_stat_params), fgp_stat_params,
469 NULL,
473 /* Register the protocol name and description */
474 proto_fractalgeneratorprotocol = proto_register_protocol("Fractal Generator Protocol", "FractalGeneratorProtocol", "fractalgeneratorprotocol");
476 /* Required function calls to register the header fields and subtrees used */
477 proto_register_field_array(proto_fractalgeneratorprotocol, hf, array_length(hf));
478 proto_register_subtree_array(ett, array_length(ett));
479 tap_fractalgeneratorprotocol = register_tap("fractalgeneratorprotocol");
481 register_stat_tap_table_ui(&fgp_stat_table);
483 fgp_handle = register_dissector("fractalgeneratorprotocol", dissect_fractalgeneratorprotocol, proto_fractalgeneratorprotocol);
486 void
487 proto_reg_handoff_fractalgeneratorprotocol(void)
489 dissector_add_uint("sctp.ppi", FRACTALGENERATORPROTOCOL_PAYLOAD_PROTOCOL_ID_LEGACY, fgp_handle);
490 dissector_add_uint("sctp.ppi", FGP_PAYLOAD_PROTOCOL_ID, fgp_handle);
494 * Editor modelines - https://www.wireshark.org/tools/modelines.html
496 * Local Variables:
497 * c-basic-offset: 2
498 * tab-width: 8
499 * indent-tabs-mode: nil
500 * End:
502 * ex: set shiftwidth=2 tabstop=8 expandtab:
503 * :indentSize=2:tabSize=8:noTabs=true: