Coverage Report

Created: 2025-02-15 06:25

/src/wireshark/epan/dissectors/packet-quake.c
Line
Count
Source (jump to first uncovered line)
1
/* packet-quake.c
2
 * Routines for Quake packet dissection
3
 *
4
 * Uwe Girlich <uwe@planetquake.com>
5
 *  http://www.idsoftware.com/q1source/q1source.zip
6
 *
7
 * Wireshark - Network traffic analyzer
8
 * By Gerald Combs <gerald@wireshark.org>
9
 * Copyright 1998 Gerald Combs
10
 *
11
 * Copied from packet-tftp.c
12
 *
13
 * SPDX-License-Identifier: GPL-2.0-or-later
14
 */
15
16
#include "config.h"
17
18
#include <epan/packet.h>
19
#include <epan/conversation.h>
20
#include <epan/tfs.h>
21
#include <wsutil/array.h>
22
23
void proto_register_quake(void);
24
25
static int proto_quake;
26
static int hf_quake_header_flags;
27
static int hf_quake_header_flags_data;
28
static int hf_quake_header_flags_ack;
29
static int hf_quake_header_flags_no_ack;
30
static int hf_quake_header_flags_endmsg;
31
static int hf_quake_header_flags_unreliable;
32
static int hf_quake_header_flags_control;
33
static int hf_quake_header_length;
34
static int hf_quake_header_sequence;
35
static int hf_quake_control_command;
36
37
static int hf_quake_CCREQ_CONNECT_game;
38
static int hf_quake_CCREQ_CONNECT_version;
39
static int hf_quake_CCREQ_SERVER_INFO_game;
40
static int hf_quake_CCREQ_SERVER_INFO_version;
41
static int hf_quake_CCREQ_PLAYER_INFO_player;
42
static int hf_quake_CCREQ_RULE_INFO_lastrule;
43
44
static int hf_quake_CCREP_ACCEPT_port;
45
static int hf_quake_CCREP_REJECT_reason;
46
static int hf_quake_CCREP_SERVER_INFO_address;
47
static int hf_quake_CCREP_SERVER_INFO_server;
48
static int hf_quake_CCREP_SERVER_INFO_map;
49
static int hf_quake_CCREP_SERVER_INFO_num_player;
50
static int hf_quake_CCREP_SERVER_INFO_max_player;
51
static int hf_quake_CCREP_PLAYER_INFO_name;
52
static int hf_quake_CCREP_PLAYER_INFO_colors;
53
static int hf_quake_CCREP_PLAYER_INFO_colors_shirt;
54
static int hf_quake_CCREP_PLAYER_INFO_colors_pants;
55
static int hf_quake_CCREP_PLAYER_INFO_frags;
56
static int hf_quake_CCREP_PLAYER_INFO_connect_time;
57
static int hf_quake_CCREP_PLAYER_INFO_address;
58
static int hf_quake_CCREP_RULE_INFO_rule;
59
static int hf_quake_CCREP_RULE_INFO_value;
60
61
62
static int ett_quake;
63
static int ett_quake_control;
64
static int ett_quake_control_colors;
65
static int ett_quake_flags;
66
67
static dissector_handle_t quake_handle;
68
69
/* I took these names directly out of the Q1 source. */
70
#define NET_HEADERSIZE 8
71
14
#define DEFAULTnet_hostport 26000
72
73
14
#define NETFLAG_DATA            0x0001
74
14
#define NETFLAG_ACK             0x0002
75
14
#define NETFLAG_NAK             0x0004
76
14
#define NETFLAG_EOM             0x0008
77
14
#define NETFLAG_UNRELIABLE      0x0010
78
14
#define NETFLAG_CTL             0x8000
79
80
81
0
#define CCREQ_CONNECT           0x01
82
0
#define CCREQ_SERVER_INFO       0x02
83
0
#define CCREQ_PLAYER_INFO       0x03
84
0
#define CCREQ_RULE_INFO         0x04
85
86
0
#define CCREP_ACCEPT            0x81
87
0
#define CCREP_REJECT            0x82
88
0
#define CCREP_SERVER_INFO       0x83
89
0
#define CCREP_PLAYER_INFO       0x84
90
0
#define CCREP_RULE_INFO         0x85
91
92
static const value_string names_control_command[] = {
93
  { CCREQ_CONNECT, "connect" },
94
  { CCREQ_SERVER_INFO, "server_info" },
95
  { CCREQ_PLAYER_INFO, "player_info" },
96
  { CCREQ_RULE_INFO, "rule_info" },
97
  { CCREP_ACCEPT, "accept" },
98
  { CCREP_REJECT, "reject" },
99
  { CCREP_SERVER_INFO, "server_info" },
100
  { CCREP_PLAYER_INFO, "player_info" },
101
  { CCREP_RULE_INFO, "rule_info" },
102
  { 0, NULL }
103
};
104
105
0
#define CCREQ 0x00
106
0
#define CCREP 0x80
107
108
#define QUAKE_MAXSTRING 0x800
109
110
static const value_string names_control_direction[] = {
111
  { CCREQ, "Request" },
112
  { CCREP, "Reply" },
113
  { 0, NULL }
114
};
115
116
117
static const value_string names_colors[] = {
118
  {  0, "White" },
119
  {  1, "Brown" },
120
  {  2, "Lavender" },
121
  {  3, "Khaki" },
122
  {  4, "Red" },
123
  {  5, "Lt Brown" },
124
  {  6, "Peach" },
125
  {  7, "Lt Peach" },
126
  {  8, "Purple" },
127
  {  9, "Dk Purple" },
128
  { 10, "Tan" },
129
  { 11, "Green" },
130
  { 12, "Yellow" },
131
  { 13, "Blue" },
132
  { 14, "Fire" },
133
  { 15, "Brights" },
134
  {  0, NULL }
135
};
136
137
static void
138
dissect_quake_CCREQ_CONNECT
139
(tvbuff_t *tvb, proto_tree *tree)
140
0
{
141
0
  int offset = 0;
142
0
  int item_len;
143
144
0
  proto_tree_add_item_ret_length(tree, hf_quake_CCREQ_CONNECT_game,
145
0
      tvb, offset, -1, ENC_ASCII|ENC_NA, &item_len);
146
0
  offset += item_len;
147
148
0
  proto_tree_add_item(tree, hf_quake_CCREQ_CONNECT_version,
149
0
      tvb, offset, 1, ENC_LITTLE_ENDIAN);
150
0
}
151
152
153
static void
154
dissect_quake_CCREQ_SERVER_INFO
155
(tvbuff_t *tvb, proto_tree *tree)
156
0
{
157
0
  int offset = 0;
158
0
  int item_len;
159
160
0
  proto_tree_add_item_ret_length(tree, hf_quake_CCREQ_SERVER_INFO_game,
161
0
      tvb, offset, -1, ENC_ASCII|ENC_NA, &item_len);
162
0
  offset += item_len;
163
0
  proto_tree_add_item(tree, hf_quake_CCREQ_SERVER_INFO_version,
164
0
      tvb, offset, 1, ENC_LITTLE_ENDIAN);
165
0
}
166
167
168
static void
169
dissect_quake_CCREQ_PLAYER_INFO
170
(tvbuff_t *tvb, proto_tree *tree)
171
0
{
172
0
  proto_tree_add_item(tree, hf_quake_CCREQ_PLAYER_INFO_player,
173
0
      tvb, 0, 1, ENC_LITTLE_ENDIAN);
174
0
}
175
176
177
static void
178
dissect_quake_CCREQ_RULE_INFO
179
(tvbuff_t *tvb, proto_tree *tree)
180
0
{
181
0
  proto_tree_add_item(tree, hf_quake_CCREQ_RULE_INFO_lastrule,
182
0
      tvb, 0, -1, ENC_ASCII);
183
0
}
184
185
186
static void
187
dissect_quake_CCREP_ACCEPT
188
(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
189
0
{
190
0
  uint32_t port;
191
0
  conversation_t *c;
192
193
0
  port = tvb_get_letohl(tvb, 0);
194
0
  c = find_or_create_conversation(pinfo);
195
0
  conversation_set_dissector(c, quake_handle);
196
197
0
  proto_tree_add_uint(tree, hf_quake_CCREP_ACCEPT_port,
198
0
      tvb, 0, 4, port);
199
0
}
200
201
202
static void
203
dissect_quake_CCREP_REJECT
204
(tvbuff_t *tvb, proto_tree *tree)
205
0
{
206
0
  proto_tree_add_item(tree, hf_quake_CCREP_REJECT_reason,
207
0
      tvb, 0, -1, ENC_ASCII);
208
0
}
209
210
211
static void
212
dissect_quake_CCREP_SERVER_INFO
213
(tvbuff_t *tvb, proto_tree *tree)
214
0
{
215
0
  int offset = 0;
216
0
  int item_len;
217
218
0
  proto_tree_add_item_ret_length(tree,
219
0
      hf_quake_CCREP_SERVER_INFO_address, tvb, offset, -1,
220
0
      ENC_ASCII|ENC_NA, &item_len);
221
0
  offset += item_len;
222
223
0
  proto_tree_add_item_ret_length(tree,
224
0
      hf_quake_CCREP_SERVER_INFO_server, tvb, offset, -1,
225
0
      ENC_ASCII|ENC_NA, &item_len);
226
0
  offset += item_len;
227
228
0
  proto_tree_add_item_ret_length(tree,
229
0
      hf_quake_CCREP_SERVER_INFO_map, tvb, offset, -1,
230
0
      ENC_ASCII|ENC_NA, &item_len);
231
0
  offset += item_len;
232
233
0
  proto_tree_add_item(tree, hf_quake_CCREP_SERVER_INFO_num_player,
234
0
      tvb, offset, 1, ENC_LITTLE_ENDIAN);
235
0
  offset += 1;
236
0
  proto_tree_add_item(tree, hf_quake_CCREP_SERVER_INFO_max_player,
237
0
      tvb, offset, 1, ENC_LITTLE_ENDIAN);
238
0
  offset += 1;
239
0
  proto_tree_add_item(tree, hf_quake_CCREQ_SERVER_INFO_version,
240
0
      tvb, offset, 1, ENC_LITTLE_ENDIAN);
241
0
}
242
243
244
static void
245
dissect_quake_CCREP_PLAYER_INFO
246
(tvbuff_t *tvb, proto_tree *tree)
247
0
{
248
0
  int offset = 0;
249
0
  uint32_t colors;
250
0
  uint32_t color_shirt;
251
0
  uint32_t color_pants;
252
0
  proto_item *colors_item;
253
0
  proto_tree *colors_tree;
254
0
  int item_len;
255
256
0
  proto_tree_add_item(tree, hf_quake_CCREQ_PLAYER_INFO_player,
257
0
      tvb, offset, 1, ENC_LITTLE_ENDIAN);
258
0
  offset += 1;
259
260
0
  proto_tree_add_item_ret_length(tree, hf_quake_CCREP_PLAYER_INFO_name,
261
0
      tvb, offset, -1, ENC_ASCII|ENC_NA, &item_len);
262
0
  offset += item_len;
263
264
0
  colors       = tvb_get_letohl(tvb, offset + 0);
265
0
  color_shirt = (colors >> 4) & 0x0f;
266
0
  color_pants = (colors     ) & 0x0f;
267
268
0
  colors_item = proto_tree_add_uint(tree,
269
0
      hf_quake_CCREP_PLAYER_INFO_colors,
270
0
      tvb, offset, 4, colors);
271
0
  colors_tree = proto_item_add_subtree(colors_item,
272
0
      ett_quake_control_colors);
273
0
  proto_tree_add_uint(colors_tree,
274
0
      hf_quake_CCREP_PLAYER_INFO_colors_shirt,
275
0
      tvb, offset, 1, color_shirt);
276
0
  proto_tree_add_uint(colors_tree,
277
0
      hf_quake_CCREP_PLAYER_INFO_colors_pants,
278
0
      tvb, offset, 1, color_pants);
279
0
  offset += 4;
280
0
  proto_tree_add_item(tree, hf_quake_CCREP_PLAYER_INFO_frags,
281
0
      tvb, offset, 4, ENC_LITTLE_ENDIAN);
282
0
  offset += 4;
283
0
  proto_tree_add_item(tree, hf_quake_CCREP_PLAYER_INFO_connect_time,
284
0
      tvb, offset, 4, ENC_LITTLE_ENDIAN);
285
0
  offset += 4;
286
287
0
  proto_tree_add_item(tree, hf_quake_CCREP_PLAYER_INFO_address,
288
0
      tvb, offset, -1, ENC_ASCII);
289
0
}
290
291
292
static void
293
dissect_quake_CCREP_RULE_INFO
294
(tvbuff_t *tvb, proto_tree *tree)
295
0
{
296
0
  int offset = 0;
297
0
  int item_len;
298
299
0
  if (tvb_reported_length(tvb) == 0) return;
300
301
0
  proto_tree_add_item_ret_length(tree, hf_quake_CCREP_RULE_INFO_rule,
302
0
      tvb, offset, -1, ENC_ASCII|ENC_NA, &item_len);
303
0
  offset += item_len;
304
305
0
  proto_tree_add_item(tree, hf_quake_CCREP_RULE_INFO_value,
306
0
      tvb, offset, -1, ENC_ASCII);
307
0
}
308
309
310
static void
311
dissect_quake_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
312
0
{
313
0
  uint8_t   command;
314
0
  int   direction;
315
0
  proto_tree  *control_tree;
316
0
  tvbuff_t  *next_tvb;
317
318
0
  command = tvb_get_uint8(tvb, 0);
319
0
  direction = (command & 0x80) ? CCREP : CCREQ;
320
321
0
  col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
322
0
      val_to_str(command,names_control_command, "%u"),
323
0
      val_to_str(direction,names_control_direction,"%u"));
324
325
0
  control_tree = proto_tree_add_subtree_format(tree, tvb,
326
0
      0, -1, ett_quake_control, NULL, "Control %s: %s",
327
0
      val_to_str(direction, names_control_direction, "%u"),
328
0
      val_to_str(command, names_control_command, "%u"));
329
0
  proto_tree_add_uint(control_tree, hf_quake_control_command,
330
0
      tvb, 0, 1, command);
331
332
0
  next_tvb = tvb_new_subset_remaining(tvb, 1);
333
0
  switch (command) {
334
0
    case CCREQ_CONNECT:
335
0
      dissect_quake_CCREQ_CONNECT
336
0
        (next_tvb, control_tree);
337
0
    break;
338
0
    case CCREQ_SERVER_INFO:
339
0
      dissect_quake_CCREQ_SERVER_INFO
340
0
        (next_tvb, control_tree);
341
0
    break;
342
0
    case CCREQ_PLAYER_INFO:
343
0
      dissect_quake_CCREQ_PLAYER_INFO
344
0
        (next_tvb, control_tree);
345
0
    break;
346
0
    case CCREQ_RULE_INFO:
347
0
      dissect_quake_CCREQ_RULE_INFO
348
0
        (next_tvb, control_tree);
349
0
    break;
350
0
    case CCREP_ACCEPT:
351
0
      dissect_quake_CCREP_ACCEPT
352
0
        (next_tvb, pinfo, control_tree);
353
0
    break;
354
0
    case CCREP_REJECT:
355
0
      dissect_quake_CCREP_REJECT
356
0
        (next_tvb, control_tree);
357
0
    break;
358
0
    case CCREP_SERVER_INFO:
359
0
      dissect_quake_CCREP_SERVER_INFO
360
0
        (next_tvb, control_tree);
361
0
    break;
362
0
    case CCREP_PLAYER_INFO:
363
0
      dissect_quake_CCREP_PLAYER_INFO
364
0
        (next_tvb, control_tree);
365
0
    break;
366
0
    case CCREP_RULE_INFO:
367
0
      dissect_quake_CCREP_RULE_INFO
368
0
        (next_tvb, control_tree);
369
0
    break;
370
0
    default:
371
0
      call_data_dissector(next_tvb, pinfo, control_tree);
372
0
    break;
373
0
  }
374
0
}
375
376
377
static int
378
dissect_quake(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
379
0
{
380
0
  proto_tree  *quake_tree;
381
0
  proto_item  *quake_item;
382
0
  uint16_t    flags;
383
0
  proto_item  *flags_item;
384
0
  proto_tree  *flags_tree;
385
0
  uint32_t    sequence = 0;
386
0
  tvbuff_t  *next_tvb;
387
388
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKE");
389
0
  col_clear(pinfo->cinfo, COL_INFO);
390
391
0
  flags = tvb_get_ntohs(tvb, 2);
392
393
0
  quake_item = proto_tree_add_item(tree, proto_quake, tvb, 0, -1, ENC_NA);
394
0
  quake_tree = proto_item_add_subtree(quake_item, ett_quake);
395
396
0
  flags_item = proto_tree_add_item(quake_tree, hf_quake_header_flags,
397
0
      tvb, 2, 2, ENC_BIG_ENDIAN);
398
0
  flags_tree = proto_item_add_subtree(flags_item, ett_quake_flags);
399
0
  proto_tree_add_item(flags_tree, hf_quake_header_flags_data,
400
0
      tvb, 2, 2, ENC_BIG_ENDIAN);
401
0
  proto_tree_add_item(flags_tree, hf_quake_header_flags_ack,
402
0
      tvb, 2, 2, ENC_BIG_ENDIAN);
403
0
  proto_tree_add_item(flags_tree, hf_quake_header_flags_no_ack,
404
0
      tvb, 2, 2, ENC_BIG_ENDIAN);
405
0
  proto_tree_add_item(flags_tree, hf_quake_header_flags_endmsg,
406
0
      tvb, 2, 2, ENC_BIG_ENDIAN);
407
0
  proto_tree_add_item(flags_tree, hf_quake_header_flags_unreliable,
408
0
      tvb, 2, 2, ENC_BIG_ENDIAN);
409
0
  proto_tree_add_item(flags_tree, hf_quake_header_flags_control,
410
0
      tvb, 2, 2, ENC_BIG_ENDIAN);
411
412
0
  proto_tree_add_item(quake_tree, hf_quake_header_length, tvb, 0, 2, ENC_BIG_ENDIAN);
413
414
0
  if (flags == NETFLAG_CTL) {
415
0
    next_tvb = tvb_new_subset_remaining(tvb, 4);
416
0
    dissect_quake_control(next_tvb, pinfo, quake_tree);
417
0
    return tvb_captured_length(tvb);
418
0
  }
419
420
0
  sequence = tvb_get_ntohl(tvb, 4);
421
0
  col_add_fstr(pinfo->cinfo, COL_INFO, "seq 0x%x", sequence);
422
0
  proto_tree_add_uint(quake_tree, hf_quake_header_sequence,
423
0
      tvb, 4, 4, sequence);
424
425
0
  next_tvb = tvb_new_subset_remaining(tvb, 8);
426
0
  call_data_dissector(next_tvb, pinfo, quake_tree);
427
0
  return tvb_captured_length(tvb);
428
0
}
429
430
431
void proto_reg_handoff_quake(void);
432
433
void
434
proto_register_quake(void)
435
14
{
436
14
  static hf_register_info hf[] = {
437
14
    { &hf_quake_header_flags,
438
14
      { "Flags", "quake.header.flags",
439
14
        FT_UINT16, BASE_HEX, NULL, 0x0,
440
14
        NULL, HFILL }},
441
14
    { &hf_quake_header_flags_data,
442
14
      { "Data", "quake.header.flags.data",
443
14
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), NETFLAG_DATA,
444
14
        NULL, HFILL }},
445
14
    { &hf_quake_header_flags_ack,
446
14
      { "Acknowledgment", "quake.header.flags.ack",
447
14
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), NETFLAG_ACK,
448
14
        NULL, HFILL }},
449
14
    { &hf_quake_header_flags_no_ack,
450
14
      { "No Acknowledgment", "quake.header.flags.no_ack",
451
14
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), NETFLAG_NAK,
452
14
        NULL, HFILL }},
453
14
    { &hf_quake_header_flags_endmsg,
454
14
      { "End Of Message", "quake.header.flags.endmsg",
455
14
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), NETFLAG_EOM,
456
14
        NULL, HFILL }},
457
14
    { &hf_quake_header_flags_unreliable,
458
14
      { "Unreliable", "quake.header.flags.unreliable",
459
14
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), NETFLAG_UNRELIABLE,
460
14
        NULL, HFILL }},
461
14
    { &hf_quake_header_flags_control,
462
14
      { "Control", "quake.header.flags.control",
463
14
        FT_BOOLEAN, 16, TFS(&tfs_set_notset), NETFLAG_CTL,
464
14
        NULL, HFILL }},
465
14
    { &hf_quake_header_length,
466
14
      { "Length", "quake.header.length",
467
14
        FT_UINT16, BASE_DEC, NULL, 0x0,
468
14
        "full data length", HFILL }},
469
14
    { &hf_quake_header_sequence,
470
14
      { "Sequence", "quake.header.sequence",
471
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
472
14
        "Sequence Number", HFILL }},
473
14
    { &hf_quake_control_command,
474
14
      { "Command", "quake.control.command",
475
14
        FT_UINT8, BASE_HEX, VALS(names_control_command), 0x0,
476
14
        "Control Command", HFILL }},
477
14
    { &hf_quake_CCREQ_CONNECT_game,
478
14
      { "Game", "quake.control.connect.game",
479
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
480
14
        "Game Name", HFILL }},
481
14
    { &hf_quake_CCREQ_CONNECT_version,
482
14
      { "Version", "quake.control.connect.version",
483
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
484
14
        "Game Protocol Version Number", HFILL }},
485
14
    { &hf_quake_CCREQ_SERVER_INFO_game,
486
14
      { "Game", "quake.control.server_info.game",
487
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
488
14
        "Game Name", HFILL }},
489
14
    { &hf_quake_CCREQ_SERVER_INFO_version,
490
14
      { "Version", "quake.control.server_info.version",
491
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
492
14
        "Game Protocol Version Number", HFILL }},
493
14
    { &hf_quake_CCREQ_PLAYER_INFO_player,
494
14
      { "Player", "quake.control.player_info.player",
495
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
496
14
        NULL, HFILL }},
497
14
    { &hf_quake_CCREQ_RULE_INFO_lastrule,
498
14
      { "Last Rule", "quake.control.rule_info.lastrule",
499
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
500
14
        "Last Rule Name", HFILL }},
501
14
    { &hf_quake_CCREP_ACCEPT_port,
502
14
      { "Port", "quake.control.accept.port",
503
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
504
14
        "Game Data Port", HFILL }},
505
14
    { &hf_quake_CCREP_REJECT_reason,
506
14
      { "Reason", "quake.control.reject.reason",
507
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
508
14
        "Reject Reason", HFILL }},
509
14
    { &hf_quake_CCREP_SERVER_INFO_address,
510
14
      { "Address", "quake.control.server_info.address",
511
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
512
14
        "Server Address", HFILL }},
513
14
    { &hf_quake_CCREP_SERVER_INFO_server,
514
14
      { "Server", "quake.control.server_info.server",
515
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
516
14
        "Server Name", HFILL }},
517
14
    { &hf_quake_CCREP_SERVER_INFO_map,
518
14
      { "Map", "quake.control.server_info.map",
519
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
520
14
        "Map Name", HFILL }},
521
14
    { &hf_quake_CCREP_SERVER_INFO_num_player,
522
14
      { "Number of Players", "quake.control.server_info.num_player",
523
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
524
14
        "Current Number of Players", HFILL }},
525
14
    { &hf_quake_CCREP_SERVER_INFO_max_player,
526
14
      { "Maximal Number of Players", "quake.control.server_info.max_player",
527
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
528
14
        NULL, HFILL }},
529
14
    { &hf_quake_CCREP_PLAYER_INFO_name,
530
14
      { "Name", "quake.control.player_info.name",
531
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
532
14
        "Player Name", HFILL }},
533
14
    { &hf_quake_CCREP_PLAYER_INFO_colors,
534
14
      { "Colors", "quake.control.player_info.colors",
535
14
        FT_UINT32, BASE_HEX, NULL, 0x0,
536
14
        "Player Colors", HFILL }},
537
14
    { &hf_quake_CCREP_PLAYER_INFO_colors_shirt,
538
14
      { "Shirt", "quake.control.player_info.colors.shirt",
539
14
        FT_UINT8, BASE_DEC, VALS(names_colors), 0x0,
540
14
        "Shirt Color", HFILL }},
541
14
    { &hf_quake_CCREP_PLAYER_INFO_colors_pants,
542
14
      { "Pants", "quake.control.player_info.colors.pants",
543
14
        FT_UINT8, BASE_DEC, VALS(names_colors), 0x0,
544
14
        "Pants Color", HFILL }},
545
14
    { &hf_quake_CCREP_PLAYER_INFO_frags,
546
14
      { "Frags", "quake.control.player_info.frags",
547
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
548
14
        "Player Frags", HFILL }},
549
14
    { &hf_quake_CCREP_PLAYER_INFO_connect_time,
550
14
      { "Connect Time", "quake.control.player_info.connect_time",
551
14
        FT_UINT32, BASE_DEC, NULL, 0x0,
552
14
        "Player Connect Time", HFILL }},
553
14
    { &hf_quake_CCREP_PLAYER_INFO_address,
554
14
      { "Address", "quake.control.player_info.address",
555
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
556
14
        "Player Address", HFILL }},
557
14
    { &hf_quake_CCREP_RULE_INFO_rule,
558
14
      { "Rule", "quake.control.rule_info.rule",
559
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
560
14
        "Rule Name", HFILL }},
561
14
    { &hf_quake_CCREP_RULE_INFO_value,
562
14
      { "Value", "quake.control.rule_info.value",
563
14
        FT_STRINGZ, BASE_NONE, NULL, 0x0,
564
14
        "Rule Value", HFILL }},
565
14
  };
566
14
  static int *ett[] = {
567
14
    &ett_quake,
568
14
    &ett_quake_control,
569
14
    &ett_quake_control_colors,
570
14
    &ett_quake_flags,
571
14
  };
572
573
14
  proto_quake = proto_register_protocol("Quake Network Protocol", "QUAKE", "quake");
574
14
  proto_register_field_array(proto_quake, hf, array_length(hf));
575
14
  proto_register_subtree_array(ett, array_length(ett));
576
577
14
  quake_handle = register_dissector("quake", dissect_quake, proto_quake);
578
14
}
579
580
581
void
582
proto_reg_handoff_quake(void)
583
14
{
584
14
  dissector_add_uint_with_preference("udp.port", DEFAULTnet_hostport, quake_handle);
585
14
}
586
587
/*
588
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
589
 *
590
 * Local variables:
591
 * c-basic-offset: 8
592
 * tab-width: 8
593
 * indent-tabs-mode: t
594
 * End:
595
 *
596
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
597
 * :indentSize=8:tabSize=8:noTabs=false:
598
 */