Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-dpnet.c
blobd923016dae361f1c3bbf13733084d2badbba6f47
1 /* packet-dpnet.c
2 * This is a dissector for the DirectPlay 8 protocol.
4 * Copyright 2017 - Alistair Leslie-Hughes
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include "config.h"
16 #include <epan/packet.h>
17 #include <epan/tfs.h>
19 void proto_register_dpnet(void);
20 void proto_reg_handoff_dpnet(void);
22 static dissector_handle_t dpnet_handle;
24 #define DPNET_PORT 6073
26 static int proto_dpnet;
28 static int hf_dpnet_lead;
29 static int hf_dpnet_command;
30 static int hf_dpnet_payload;
31 static int hf_dpnet_type;
32 static int hf_dpnet_application;
33 static int hf_dpnet_data;
34 static int hf_dpnet_reply_offset;
35 static int hf_dpnet_response_size;
37 static int hf_dpnet_desc_size;
38 static int hf_dpnet_desc_flags;
39 static int hf_dpnet_max_players;
40 static int hf_dpnet_current_players;
41 static int hf_dpnet_session_offset;
42 static int hf_dpnet_session_size;
43 static int hf_dpnet_session_name;
44 static int hf_dpnet_password_offset;
45 static int hf_dpnet_password_size;
46 static int hf_dpnet_reserved_offset;
47 static int hf_dpnet_reserved_size;
48 static int hf_dpnet_application_offset;
49 static int hf_dpnet_application_size;
50 static int hf_dpnet_application_data;
51 static int hf_dpnet_instance;
52 static int hf_dpnet_data_cframe_control;
53 static int hf_dpnet_data_cframe_msgid;
54 static int hf_dpnet_data_cframe_rspid;
55 static int hf_dpnet_data_cframe_protocol;
56 static int hf_dpnet_data_cframe_session;
57 static int hf_dpnet_data_cframe_timestamp;
58 static int hf_dpnet_data_cframe_padding;
59 static int hf_dpnet_data_cframe_flags;
60 static int hf_dpnet_data_cframe_retry;
61 static int hf_dpnet_data_cframe_nseq;
62 static int hf_dpnet_data_cframe_nrcv;
63 static int hf_dpnet_data_cframe_sack_mask1;
64 static int hf_dpnet_data_cframe_sack_mask2;
65 static int hf_dpnet_data_cframe_send_mask1;
66 static int hf_dpnet_data_cframe_send_mask2;
67 static int hf_dpnet_data_cframe_signature;
68 static int hf_dpnet_data_cframe_send_secret;
69 static int hf_dpnet_data_cframe_recv_secret;
70 static int hf_dpnet_data_cframe_signing_opts;
71 static int hf_dpnet_data_cframe_echo_time;
72 static int hf_dpnet_data_seq;
73 static int hf_dpnet_data_nseq;
74 static int hf_dpnet_data_command;
75 static int hf_dpnet_command_data;
76 static int hf_dpnet_command_reliable;
77 static int hf_dpnet_command_seq;
78 static int hf_dpnet_command_poll;
79 static int hf_dpnet_command_new_msg;
80 static int hf_dpnet_command_end_msg;
81 static int hf_dpnet_command_user1;
82 static int hf_dpnet_command_user2;
83 static int hf_dpnet_desc_client_server;
84 static int hf_dpnet_desc_migrate_host;
85 static int hf_dpnet_desc_nodpnsvr;
86 static int hf_dpnet_desc_req_password;
87 static int hf_dpnet_desc_no_enums;
88 static int hf_dpnet_desc_fast_signed;
89 static int hf_dpnet_desc_full_signed;
91 static int ett_dpnet;
92 static int ett_dpnet_command_flags;
93 static int ett_dpnet_desc_flags;
95 #define DPNET_QUERY_GUID 0x01
97 #define DPNET_ENUM_QUERY 0x02
98 #define DPNET_ENUM_RESPONSE 0x03
100 #define DPNET_COMMAND_DATA 0x01
101 #define DPNET_COMMAND_RELIABLE 0x02
102 #define DPNET_COMMAND_SEQUENTIAL 0x04
103 #define DPNET_COMMAND_POLL 0x08
104 #define DPNET_COMMAND_NEW_MSG 0x10
105 #define DPNET_COMMAND_END_MSG 0x20
106 #define DPNET_COMMAND_USER_1 0x40
107 #define DPNET_COMMAND_CFRAME 0x80
109 #define DN_MSG_INTERNAL_PLAYER_CONNECT_INFO 0x000000c1
110 #define DN_MSG_INTERNAL_SEND_CONNECT_INFO 0x000000c2
111 #define DN_MSG_INTERNAL_ACK_CONNECT_INFO 0x000000c3
113 #define FRAME_EXOPCODE_CONNECT 0x01
114 #define FRAME_EXOPCODE_CONNECTED 0x02
115 #define FRAME_EXOPCODE_CONNECTED_SIGNED 0x03
116 #define FRAME_EXOPCODE_HARD_DISCONNECT 0x04
117 #define FRAME_EXOPCODE_SACK 0x06
119 #define PROTOCOL_VER_0 0x00010000
120 #define PROTOCOL_VER_1 0x00010001
121 #define PROTOCOL_VER_2 0x00010002
122 #define PROTOCOL_VER_3 0x00010003
123 #define PROTOCOL_VER_4 0x00010004
124 #define PROTOCOL_VER_5 0x00010005
125 #define PROTOCOL_VER_6 0x00010006
127 #define SACK_FLAGS_RESPONSE 0x01
128 #define SACK_FLAGS_SACK_MASK1 0x02
129 #define SACK_FLAGS_SACK_MASK2 0x04
130 #define SACK_FLAGS_SEND_MASK1 0x08
131 #define SACK_FLAGS_SEND_MASK2 0x10
133 #define PACKET_SIGNING_FAST 0x01
134 #define PACKET_SIGNING_FULL 0x02
136 #define SESSION_CLIENT_SERVER 0x0001
137 #define SESSION_MIGRATE_HOST 0x0004
138 #define SESSION_NODPNSVR 0x0040
139 #define SESSION_REQUIREPASSWORD 0x0080
140 #define SESSION_NOENUMS 0x0100
141 #define SESSION_FAST_SIGNED 0x0200
142 #define SESSION_FULL_SIGNED 0x0400
144 static const value_string packetenumttypes[] = {
145 { 1, "Application GUID" },
146 { 2, "All Applications" },
147 { 0, NULL }
150 static const value_string packetquerytype[] = {
151 { 2, "Enumeration Query" },
152 { 3, "Enumeration Response" },
153 { 0, NULL }
156 static const value_string msg_cframe_control[] = {
157 {FRAME_EXOPCODE_CONNECT, "FRAME_EXOPCODE_CONNECT"},
158 {FRAME_EXOPCODE_CONNECTED, "FRAME_EXOPCODE_CONNECTED"},
159 {FRAME_EXOPCODE_CONNECTED_SIGNED, "FRAME_EXOPCODE_CONNECTED_SIGNED"},
160 {FRAME_EXOPCODE_HARD_DISCONNECT, "FRAME_EXOPCODE_HARD_DISCONNECT"},
161 {FRAME_EXOPCODE_SACK, "FRAME_EXOPCODE_SACK"},
162 {0, NULL }
165 static const value_string protocol_versions[] = {
166 {PROTOCOL_VER_0, "Supports Base Features"},
167 {PROTOCOL_VER_1, "Supports Base Features"},
168 {PROTOCOL_VER_2, "Supports Base Features"},
169 {PROTOCOL_VER_3, "Supports Base Features"},
170 {PROTOCOL_VER_4, "Supports Base Features"},
171 {PROTOCOL_VER_5, "Supports Coalescence"},
172 {PROTOCOL_VER_6, "Supports Coalescence and Signing"},
173 {0, NULL }
176 static const value_string sack_flags[] = {
177 {SACK_FLAGS_RESPONSE, "Retry field is valid"},
178 {SACK_FLAGS_SACK_MASK1, "Low 32 bits of the SACK mask are present in sack.mask1"},
179 {SACK_FLAGS_SACK_MASK2, "High 32 bits of the SACK mask are present in sack.mask2"},
180 {SACK_FLAGS_SEND_MASK1, "Low 32 bits of the Send mask are present in send.mask1"},
181 {SACK_FLAGS_SEND_MASK2, "High 32 bits of the Send mask are present in send.mask2"},
182 {0, NULL }
185 static const value_string signing_opts[] = {
186 {PACKET_SIGNING_FAST, "Fasting signing"},
187 {PACKET_SIGNING_FULL, "Full signing"},
188 {0, NULL }
191 static const true_false_string tfs_flags_game_client = {
192 "Client/Server session",
193 "Peer session"
196 static const true_false_string tfs_flags_migrate = {
197 "Host Migrating allowed",
198 "Host Migrating NOT allowed"
201 static const true_false_string tfs_flags_dpnsvr = {
202 "NOT using dpnsvr.exe",
203 "Using dpnsvr.exe"
206 static const true_false_string tfs_flags_password_required = {
207 "Password required",
208 "NO password required"
211 static const true_false_string tfs_flags_enumeration = {
212 "Enumeration NOT allowed",
213 "Enumeration allowed"
216 static const true_false_string tfs_flags_fast = {
217 "Using Fast signing",
218 "NOT using Fast signing"
221 static const true_false_string tfs_flags_full = {
222 "Using Full signing",
223 "NOT using Full signing"
227 static int * const desc_flags[] = {
228 &hf_dpnet_desc_client_server,
229 &hf_dpnet_desc_migrate_host,
230 &hf_dpnet_desc_nodpnsvr,
231 &hf_dpnet_desc_req_password,
232 &hf_dpnet_desc_no_enums,
233 &hf_dpnet_desc_fast_signed,
234 &hf_dpnet_desc_full_signed,
235 NULL
238 static int * const command_flags[] = {
239 &hf_dpnet_command_data,
240 &hf_dpnet_command_reliable,
241 &hf_dpnet_command_seq,
242 &hf_dpnet_command_poll,
243 &hf_dpnet_command_new_msg,
244 &hf_dpnet_command_end_msg,
245 &hf_dpnet_command_user1,
246 &hf_dpnet_command_user2,
247 NULL
250 static void process_dpnet_query(proto_tree *dpnet_tree, tvbuff_t *tvb, packet_info *pinfo)
252 int offset = 0, data_tvb_len;
253 uint8_t has_guid;
254 uint8_t is_query;
256 proto_tree_add_item(dpnet_tree, hf_dpnet_lead, tvb, 0, 1, ENC_BIG_ENDIAN); offset += 1;
257 is_query = tvb_get_uint8(tvb, offset);
258 proto_tree_add_item(dpnet_tree, hf_dpnet_command, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
259 proto_tree_add_item(dpnet_tree, hf_dpnet_payload, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2;
261 if(is_query == DPNET_ENUM_QUERY)
263 col_set_str(pinfo->cinfo, COL_INFO, "DPNET Enum Query");
265 has_guid = tvb_get_uint8(tvb, offset);
266 proto_tree_add_item(dpnet_tree, hf_dpnet_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
268 if (has_guid & DPNET_QUERY_GUID) {
269 proto_tree_add_item(dpnet_tree, hf_dpnet_application, tvb, offset, 16, ENC_BIG_ENDIAN);
270 offset += 16;
273 data_tvb_len = tvb_reported_length_remaining(tvb, offset);
274 if(data_tvb_len)
275 proto_tree_add_item(dpnet_tree, hf_dpnet_data, tvb, offset, data_tvb_len, ENC_NA);
278 else if(is_query == DPNET_ENUM_RESPONSE)
280 uint32_t session_offset, session_size;
281 uint32_t application_offset, application_size;
283 col_set_str(pinfo->cinfo, COL_INFO, "DPNET Enum Response");
285 proto_tree_add_item(dpnet_tree, hf_dpnet_reply_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
286 proto_tree_add_item(dpnet_tree, hf_dpnet_response_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
287 proto_tree_add_item(dpnet_tree, hf_dpnet_desc_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
288 proto_tree_add_bitmask(dpnet_tree, tvb, offset, hf_dpnet_desc_flags, ett_dpnet_desc_flags, desc_flags, ENC_LITTLE_ENDIAN);
289 offset += 4;
290 proto_tree_add_item(dpnet_tree, hf_dpnet_max_players, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
291 proto_tree_add_item(dpnet_tree, hf_dpnet_current_players, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
292 proto_tree_add_item_ret_uint(dpnet_tree, hf_dpnet_session_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN, &session_offset); offset += 4;
293 proto_tree_add_item_ret_uint(dpnet_tree, hf_dpnet_session_size, tvb, offset, 4, ENC_LITTLE_ENDIAN, &session_size); offset += 4;
294 proto_tree_add_item(dpnet_tree, hf_dpnet_password_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
295 proto_tree_add_item(dpnet_tree, hf_dpnet_password_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
296 proto_tree_add_item(dpnet_tree, hf_dpnet_reserved_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
297 proto_tree_add_item(dpnet_tree, hf_dpnet_reserved_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4;
298 proto_tree_add_item_ret_uint(dpnet_tree, hf_dpnet_application_offset, tvb, offset, 4, ENC_LITTLE_ENDIAN, &application_offset); offset += 4;
299 proto_tree_add_item_ret_uint(dpnet_tree, hf_dpnet_application_size, tvb, offset, 4, ENC_LITTLE_ENDIAN, &application_size); offset += 4;
300 proto_tree_add_item(dpnet_tree, hf_dpnet_instance, tvb, offset, 16, ENC_LITTLE_ENDIAN); offset += 16;
301 proto_tree_add_item(dpnet_tree, hf_dpnet_application, tvb, offset, 16, ENC_LITTLE_ENDIAN);
303 if(session_offset)
305 /* session_offset starts from the hf_dpnet_payload */
306 proto_tree_add_item(dpnet_tree, hf_dpnet_session_name, tvb, session_offset + 4, session_size, ENC_UTF_16|ENC_LITTLE_ENDIAN);
309 if(application_offset)
311 /* application_offset starts from the hf_dpnet_payload */
312 proto_tree_add_item(dpnet_tree, hf_dpnet_application_data, tvb, application_offset + 4, application_size, ENC_NA);
317 static void
318 dpnet_process_data_frame(proto_tree *dpnet_tree, tvbuff_t *tvb, packet_info *pinfo)
320 int offset = 0;
322 col_set_str(pinfo->cinfo, COL_INFO, "DPNET DFrame");
324 proto_tree_add_bitmask(dpnet_tree, tvb, offset, hf_dpnet_data_command, ett_dpnet_command_flags, command_flags, ENC_BIG_ENDIAN);
326 /* TODO */
329 static void
330 dpnet_process_control_frame(proto_tree *dpnet_tree, tvbuff_t *tvb, packet_info *pinfo)
332 int offset = 0;
333 int command;
334 const char *command_str;
335 int flag;
336 uint32_t data_tvb_len;
338 col_set_str(pinfo->cinfo, COL_INFO, "DPNET CFrame");
340 proto_tree_add_bitmask(dpnet_tree, tvb, offset, hf_dpnet_data_command, ett_dpnet_command_flags, command_flags, ENC_BIG_ENDIAN);
341 offset += 1;
343 command = tvb_get_uint8(tvb, offset);
344 command_str = val_to_str_const(command, msg_cframe_control, "Unknown Control (obsolete or malformed?)");
345 col_append_fstr(pinfo->cinfo, COL_INFO, " - %s", command_str);
347 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_control, tvb, offset, 1, ENC_LITTLE_ENDIAN);
348 offset += 1;
350 switch(command)
352 case FRAME_EXOPCODE_CONNECT:
353 case FRAME_EXOPCODE_CONNECTED:
354 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_msgid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
355 offset += 1;
356 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_rspid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
357 offset += 1;
358 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_protocol, tvb, offset, 4, ENC_LITTLE_ENDIAN);
359 offset += 4;
360 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_session, tvb, offset, 4, ENC_LITTLE_ENDIAN);
361 offset += 4;
362 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_timestamp, tvb, offset, 4, ENC_LITTLE_ENDIAN);
363 break;
364 case FRAME_EXOPCODE_CONNECTED_SIGNED:
365 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_msgid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
366 offset += 1;
367 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_rspid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
368 offset += 1;
369 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_protocol, tvb, offset, 4, ENC_LITTLE_ENDIAN);
370 offset += 4;
371 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_session, tvb, offset, 4, ENC_LITTLE_ENDIAN);
372 offset += 4;
373 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_timestamp, tvb, offset, 4, ENC_LITTLE_ENDIAN);
374 offset += 4;
375 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_signature, tvb, offset, 8, ENC_NA);
376 offset += 8;
377 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_send_secret, tvb, offset, 8, ENC_NA);
378 offset += 8;
379 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_recv_secret, tvb, offset, 8, ENC_NA);
380 offset += 8;
381 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_signing_opts, tvb, offset, 4, ENC_LITTLE_ENDIAN);
382 offset += 4;
383 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_echo_time, tvb, offset, 4, ENC_LITTLE_ENDIAN);
384 break;
385 case FRAME_EXOPCODE_HARD_DISCONNECT:
386 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_msgid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
387 offset += 1;
388 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_rspid, tvb, offset, 1, ENC_LITTLE_ENDIAN);
389 offset += 1;
390 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_protocol, tvb, offset, 4, ENC_LITTLE_ENDIAN);
391 offset += 4;
392 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_session, tvb, offset, 4, ENC_LITTLE_ENDIAN);
393 offset += 4;
394 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_timestamp, tvb, offset, 4, ENC_LITTLE_ENDIAN);
395 offset += 4;
397 data_tvb_len = tvb_reported_length_remaining(tvb, offset);
398 if(data_tvb_len)
399 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_signature, tvb, offset, 8, ENC_NA);
400 break;
401 case FRAME_EXOPCODE_SACK:
402 flag = tvb_get_uint8(tvb, offset);
403 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN);
404 offset += 1;
405 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_retry, tvb, offset, 1, ENC_LITTLE_ENDIAN);
406 offset += 1;
407 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_nseq, tvb, offset, 1, ENC_LITTLE_ENDIAN);
408 offset += 1;
409 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_nrcv, tvb, offset, 1, ENC_LITTLE_ENDIAN);
410 offset += 1;
411 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_padding, tvb, offset, 2, ENC_LITTLE_ENDIAN);
412 offset += 2;
413 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_timestamp, tvb, offset, 4, ENC_LITTLE_ENDIAN);
414 offset += 4;
416 if(flag & SACK_FLAGS_SACK_MASK1)
418 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_sack_mask1, tvb, offset, 4, ENC_LITTLE_ENDIAN);
419 offset += 4;
421 if(flag & SACK_FLAGS_SACK_MASK2)
423 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_sack_mask2, tvb, offset, 4, ENC_LITTLE_ENDIAN);
424 offset += 4;
426 if(flag & SACK_FLAGS_SEND_MASK1)
428 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_send_mask1, tvb, offset, 4, ENC_LITTLE_ENDIAN);
429 offset += 4;
431 if(flag & SACK_FLAGS_SEND_MASK2)
433 proto_tree_add_item(dpnet_tree, hf_dpnet_data_cframe_send_mask2, tvb, offset, 4, ENC_LITTLE_ENDIAN);
435 break;
436 default:
437 break;
441 static int
442 dissect_dpnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
444 uint8_t lead;
446 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DPNET");
447 /* Clear out stuff in the info column */
448 col_clear(pinfo->cinfo,COL_INFO);
450 proto_item *ti = proto_tree_add_item(tree, proto_dpnet, tvb, 0, -1, ENC_NA);
451 proto_tree *dpnet_tree = proto_item_add_subtree(ti, ett_dpnet);
453 lead = tvb_get_uint8(tvb, 0);
454 if(lead == 0)
456 process_dpnet_query(dpnet_tree, tvb, pinfo);
458 else
460 if(lead & DPNET_COMMAND_DATA)
461 dpnet_process_data_frame(dpnet_tree, tvb, pinfo);
462 else
463 dpnet_process_control_frame(dpnet_tree, tvb, pinfo);
466 return tvb_captured_length(tvb);
469 void
470 proto_register_dpnet(void)
472 static hf_register_info hf[] = {
473 { &hf_dpnet_lead,
474 { "Lead", "dpnet.lead",
475 FT_UINT8, BASE_DEC,
476 NULL, 0,
477 NULL, HFILL }
479 { &hf_dpnet_command,
480 { "Command", "dpnet.command",
481 FT_UINT8, BASE_HEX,
482 VALS(packetquerytype), 0,
483 NULL, HFILL }
485 { &hf_dpnet_payload,
486 { "Payload", "dpnet.payload",
487 FT_UINT16, BASE_HEX,
488 NULL, 0,
489 NULL, HFILL }
491 { &hf_dpnet_type,
492 { "Type", "dpnet.type",
493 FT_UINT8, BASE_DEC,
494 VALS(packetenumttypes), 0,
495 NULL, HFILL }
497 { &hf_dpnet_application,
498 { "Application GUID", "dpnet.application",
499 FT_GUID, BASE_NONE,
500 NULL, 0,
501 NULL, HFILL }
503 { &hf_dpnet_data,
504 { "Data", "dpnet.data",
505 FT_BYTES, BASE_NONE,
506 NULL, 0,
507 NULL, HFILL }
509 { &hf_dpnet_reply_offset,
510 { "Reply Offset", "dpnet.reply_offset",
511 FT_UINT32, BASE_DEC,
512 NULL, 0,
513 NULL, HFILL }
515 { &hf_dpnet_response_size,
516 { "Response Size", "dpnet.response_size",
517 FT_UINT32, BASE_DEC,
518 NULL, 0,
519 NULL, HFILL }
521 { &hf_dpnet_desc_size,
522 { "Description Size", "dpnet.desc_size",
523 FT_UINT32, BASE_DEC,
524 NULL, 0,
525 NULL, HFILL }
527 { &hf_dpnet_desc_flags,
528 { "Description Flags", "dpnet.desc_flags",
529 FT_UINT16, BASE_HEX,
530 NULL, 0,
531 NULL, HFILL }
533 { &hf_dpnet_max_players,
534 { "Max Players", "dpnet.max_players",
535 FT_UINT32, BASE_DEC,
536 NULL, 0,
537 NULL, HFILL }
539 { &hf_dpnet_current_players,
540 { "Current Players", "dpnet.current_players",
541 FT_UINT32, BASE_DEC,
542 NULL, 0,
543 NULL, HFILL }
545 { &hf_dpnet_session_offset,
546 { "Session Offset", "dpnet.session_offset",
547 FT_UINT32, BASE_DEC,
548 NULL, 0,
549 NULL, HFILL }
551 { &hf_dpnet_session_size,
552 { "Session Size", "dpnet.session_size",
553 FT_UINT32, BASE_DEC,
554 NULL, 0,
555 NULL, HFILL }
557 { &hf_dpnet_session_name,
558 { "Session name", "dpnet.session_name",
559 FT_STRING, BASE_NONE,
560 NULL, 0,
561 NULL, HFILL }
563 { &hf_dpnet_password_offset,
564 { "Password Offset", "dpnet.password_offset",
565 FT_UINT32, BASE_DEC,
566 NULL, 0,
567 NULL, HFILL }
569 { &hf_dpnet_password_size,
570 { "Password Size", "dpnet.password_size",
571 FT_UINT32, BASE_DEC,
572 NULL, 0,
573 NULL, HFILL }
575 { &hf_dpnet_reserved_offset,
576 { "Reserved Offset", "dpnet.reserved_offset",
577 FT_UINT32, BASE_DEC,
578 NULL, 0,
579 NULL, HFILL }
581 { &hf_dpnet_reserved_size,
582 { "Reserved Size", "dpnet.reserved_size",
583 FT_UINT32, BASE_DEC,
584 NULL, 0,
585 NULL, HFILL }
587 { &hf_dpnet_application_offset,
588 { "Application Offset", "dpnet.application_offset",
589 FT_UINT32, BASE_DEC,
590 NULL, 0,
591 NULL, HFILL }
593 { &hf_dpnet_application_size,
594 { "Application Size", "dpnet.application_size",
595 FT_UINT32, BASE_DEC,
596 NULL, 0,
597 NULL, HFILL }
599 { &hf_dpnet_application_data,
600 { "Application data", "dpnet.application_data",
601 FT_BYTES, BASE_NONE,
602 NULL, 0,
603 NULL, HFILL }
605 { &hf_dpnet_instance,
606 { "Instance GUID", "dpnet.instance",
607 FT_GUID, BASE_NONE,
608 NULL, 0,
609 NULL, HFILL }
611 { &hf_dpnet_data_command,
612 { "Command", "dpnet.command",
613 FT_UINT8, BASE_HEX,
614 NULL, 0,
615 NULL, HFILL }
617 { &hf_dpnet_data_cframe_control,
618 { "Control", "dpnet.cframe.control",
619 FT_UINT8, BASE_HEX,
620 VALS(msg_cframe_control), 0,
621 NULL, HFILL }
623 { &hf_dpnet_data_cframe_msgid,
624 { "Message ID", "dpnet.cframe.msg_id",
625 FT_UINT8, BASE_HEX,
626 NULL, 0,
627 NULL, HFILL }
629 { &hf_dpnet_data_cframe_rspid,
630 { "Response ID", "dpnet.cframe.rsp_id",
631 FT_UINT8, BASE_HEX,
632 NULL, 0,
633 NULL, HFILL }
635 { &hf_dpnet_data_cframe_protocol,
636 { "Protocol", "dpnet.cframe.protocol",
637 FT_UINT32, BASE_HEX,
638 VALS(protocol_versions), 0,
639 NULL, HFILL }
641 { &hf_dpnet_data_cframe_session,
642 { "Session", "dpnet.cframe.session",
643 FT_UINT32, BASE_HEX,
644 NULL, 0,
645 NULL, HFILL }
647 { &hf_dpnet_data_cframe_timestamp,
648 { "Timestamp", "dpnet.cframe.timestamp",
649 FT_UINT32, BASE_DEC,
650 NULL, 0,
651 NULL, HFILL }
653 { &hf_dpnet_data_cframe_padding,
654 { "Padding", "dpnet.cframe.padding",
655 FT_UINT16, BASE_DEC,
656 NULL, 0,
657 NULL, HFILL }
659 { &hf_dpnet_data_cframe_flags,
660 { "Flags", "dpnet.cframe.flags",
661 FT_UINT8, BASE_HEX,
662 VALS(sack_flags), 0,
663 NULL, HFILL }
665 { &hf_dpnet_data_cframe_retry,
666 { "Retry", "dpnet.cframe.retry",
667 FT_UINT8, BASE_HEX,
668 NULL, 0,
669 NULL, HFILL }
671 { &hf_dpnet_data_cframe_nseq,
672 { "Next Sequence", "dpnet.cframe.nseq",
673 FT_UINT8, BASE_HEX,
674 NULL, 0,
675 NULL, HFILL }
677 { &hf_dpnet_data_cframe_nrcv,
678 { "Received", "dpnet.cframe.nrcv",
679 FT_UINT8, BASE_HEX,
680 NULL, 0,
681 NULL, HFILL }
683 { &hf_dpnet_data_cframe_sack_mask1,
684 { "SACK Mask1", "dpnet.cframe.sack.mask1",
685 FT_UINT32, BASE_HEX,
686 NULL, 0,
687 NULL, HFILL }
689 { &hf_dpnet_data_cframe_sack_mask2,
690 { "SACK Mask2", "dpnet.cframe.sack.mask2",
691 FT_UINT32, BASE_HEX,
692 NULL, 0,
693 NULL, HFILL }
695 { &hf_dpnet_data_cframe_send_mask1,
696 { "Send Mask1", "dpnet.cframe.send.mask1",
697 FT_UINT32, BASE_HEX,
698 NULL, 0,
699 NULL, HFILL }
701 { &hf_dpnet_data_cframe_send_mask2,
702 { "Send Mask2", "dpnet.cframe.send.mask2",
703 FT_UINT32, BASE_HEX,
704 NULL, 0,
705 NULL, HFILL }
707 { &hf_dpnet_data_cframe_signature,
708 { "Signature", "dpnet.cframe.signature",
709 FT_UINT64, BASE_HEX,
710 NULL, 0,
711 NULL, HFILL }
713 { &hf_dpnet_data_cframe_send_secret,
714 { "Sender Secret", "dpnet.cframe.sender_secret",
715 FT_UINT64, BASE_HEX,
716 NULL, 0,
717 NULL, HFILL }
719 { &hf_dpnet_data_cframe_recv_secret,
720 { "Receiver Secret", "dpnet.cframe.receiver_secret",
721 FT_UINT64, BASE_HEX,
722 NULL, 0,
723 NULL, HFILL }
725 { &hf_dpnet_data_cframe_signing_opts,
726 { "Signing Options", "dpnet.cframe.sign_opt",
727 FT_UINT32, BASE_HEX,
728 VALS(signing_opts), 0,
729 NULL, HFILL }
731 { &hf_dpnet_data_cframe_echo_time,
732 { "Signing Options", "dpnet.cframe.echo_time",
733 FT_UINT32, BASE_HEX,
734 NULL, 0,
735 NULL, HFILL }
737 { &hf_dpnet_data_seq,
738 { "Sequence", "dpnet.sequence",
739 FT_UINT8, BASE_HEX,
740 NULL, 0,
741 NULL, HFILL }
743 { &hf_dpnet_data_nseq,
744 { "Next Sequence", "dpnet.next",
745 FT_UINT8, BASE_HEX,
746 NULL, 0,
747 NULL, HFILL }
749 {&hf_dpnet_command_data,
750 {"Control Data", "dpnet.control.data",
751 FT_BOOLEAN, 8,
752 NULL, DPNET_COMMAND_DATA,
753 NULL, HFILL}
755 {&hf_dpnet_command_reliable,
756 {"Reliable", "dpnet.control.reliable",
757 FT_BOOLEAN, 8,
758 NULL, DPNET_COMMAND_RELIABLE,
759 NULL, HFILL}
761 {&hf_dpnet_command_seq,
762 {"Sequential", "dpnet.control.sequential",
763 FT_BOOLEAN, 8,
764 NULL, DPNET_COMMAND_SEQUENTIAL,
765 NULL, HFILL}
767 {&hf_dpnet_command_poll,
768 {"Poll", "dpnet.control.poll",
769 FT_BOOLEAN, 8,
770 NULL, DPNET_COMMAND_POLL,
771 NULL, HFILL}
773 {&hf_dpnet_command_new_msg,
774 {"New Message", "dpnet.control.new_msg",
775 FT_BOOLEAN, 8,
776 NULL, DPNET_COMMAND_NEW_MSG,
777 NULL, HFILL}
779 {&hf_dpnet_command_end_msg,
780 {"End Message", "dpnet.control.end_msg",
781 FT_BOOLEAN, 8,
782 NULL, DPNET_COMMAND_END_MSG,
783 NULL, HFILL}
785 {&hf_dpnet_command_user1,
786 {"User 1", "dpnet.control.user1",
787 FT_BOOLEAN, 8,
788 NULL, DPNET_COMMAND_USER_1,
789 NULL, HFILL}
791 {&hf_dpnet_command_user2,
792 {"CFrame", "dpnet.control.cframe",
793 FT_BOOLEAN, 8,
794 NULL, DPNET_COMMAND_CFRAME,
795 NULL, HFILL}
797 {&hf_dpnet_desc_client_server,
798 {"Client", "dpnet.session.client",
799 FT_BOOLEAN, 16,
800 TFS(&tfs_flags_game_client), SESSION_CLIENT_SERVER,
801 NULL, HFILL}
803 {&hf_dpnet_desc_migrate_host,
804 {"Migrate", "dpnet.session.migrate",
805 FT_BOOLEAN, 16,
806 TFS(&tfs_flags_migrate), SESSION_MIGRATE_HOST,
807 NULL, HFILL}
809 {&hf_dpnet_desc_nodpnsvr,
810 {"dpnsvr", "dpnet.session.dpnsvr",
811 FT_BOOLEAN, 16,
812 TFS(&tfs_flags_dpnsvr), SESSION_NODPNSVR,
813 NULL, HFILL}
815 {&hf_dpnet_desc_req_password,
816 {"Password", "dpnet.session.password",
817 FT_BOOLEAN, 16,
818 TFS(&tfs_flags_password_required), SESSION_REQUIREPASSWORD,
819 NULL, HFILL}
821 {&hf_dpnet_desc_no_enums,
822 {"Enumeration", "dpnet.session.enumeration",
823 FT_BOOLEAN, 16,
824 TFS(&tfs_flags_enumeration), SESSION_NOENUMS,
825 NULL, HFILL}
827 {&hf_dpnet_desc_fast_signed,
828 {"Fast signing", "dpnet.session.fast_sign",
829 FT_BOOLEAN, 16,
830 TFS(&tfs_flags_fast), SESSION_FAST_SIGNED,
831 NULL, HFILL}
833 {&hf_dpnet_desc_full_signed,
834 {"Full signing", "dpnet.session.full_sign",
835 FT_BOOLEAN, 16,
836 TFS(&tfs_flags_full), SESSION_FULL_SIGNED,
837 NULL, HFILL}
841 /* Setup protocol subtree array */
842 static int *ett[] = {
843 &ett_dpnet,
844 &ett_dpnet_command_flags,
845 &ett_dpnet_desc_flags
849 proto_dpnet = proto_register_protocol ("DirectPlay 8 protocol", "DPNET", "dpnet");
851 proto_register_field_array(proto_dpnet, hf, array_length(hf));
852 proto_register_subtree_array(ett, array_length(ett));
854 dpnet_handle = register_dissector("dpnet", dissect_dpnet, proto_dpnet);
857 void
858 proto_reg_handoff_dpnet(void)
860 dissector_add_uint("udp.port", DPNET_PORT, dpnet_handle);
864 * Editor modelines
866 * Local Variables:
867 * c-basic-offset: 4
868 * tab-width: 8
869 * indent-tabs-mode: nil
870 * End:
872 * ex: set shiftwidth=4 tabstop=8 expandtab:
873 * :indentSize=4:tabSize=8:noTabs=true: