2 * Routines for Monotone Netsync packet disassembly
4 * Copyright (c) 2005 by Erwin Rol <erwin@erwinrol.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1999 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include <epan/packet.h>
18 #include <epan/prefs.h>
19 #include "packet-tcp.h"
21 void proto_register_netsync(void);
22 void proto_reg_handoff_netsync(void);
24 static dissector_handle_t netsync_handle
;
29 * http://www.monotone.ca
32 /* Define TCP ports for Monotone netsync */
34 #define TCP_PORT_NETSYNC 5253
36 #define NETSYNC_ROLE_SOURCE 1
37 #define NETSYNC_ROLE_SINK 2
38 #define NETSYNC_ROLE_BOTH 3
40 static const value_string netsync_role_vals
[] = {
41 { NETSYNC_ROLE_SOURCE
, "Source" },
42 { NETSYNC_ROLE_SINK
, "Sink" },
43 { NETSYNC_ROLE_BOTH
, "Both" },
48 #define NETSYNC_CMD_ERROR 0
49 #define NETSYNC_CMD_BYE 1
50 #define NETSYNC_CMD_HELLO 2
51 #define NETSYNC_CMD_ANONYMOUS 3
52 #define NETSYNC_CMD_AUTH 4
53 #define NETSYNC_CMD_CONFIRM 5
54 #define NETSYNC_CMD_REFINE 6
55 #define NETSYNC_CMD_DONE 7
56 #define NETSYNC_CMD_SEND_DATA 8
57 #define NETSYNC_CMD_SEND_DELTA 9
58 #define NETSYNC_CMD_DATA 10
59 #define NETSYNC_CMD_DELTA 11
60 #define NETSYNC_CMD_NONEXISTENT 12
62 static const value_string netsync_cmd_vals
[] = {
63 { NETSYNC_CMD_ERROR
, "Error" },
64 { NETSYNC_CMD_BYE
, "Bye" },
65 { NETSYNC_CMD_HELLO
, "Hello" },
66 { NETSYNC_CMD_ANONYMOUS
, "Anonymous" },
67 { NETSYNC_CMD_AUTH
, "Auth" },
68 { NETSYNC_CMD_CONFIRM
, "Confirm" },
69 { NETSYNC_CMD_REFINE
, "Refine" },
70 { NETSYNC_CMD_DONE
, "Done" },
71 { NETSYNC_CMD_SEND_DATA
, "Send Data" },
72 { NETSYNC_CMD_SEND_DELTA
, "Send Delta" },
73 { NETSYNC_CMD_DATA
, "Data" },
74 { NETSYNC_CMD_DELTA
, "Delta" },
75 { NETSYNC_CMD_NONEXISTENT
, "Nonexistent" },
79 #define NETSNYC_MERKLE_HASH_LENGTH 20
81 /* Define the monotone netsync proto */
82 static int proto_netsync
;
84 static int hf_netsync_version
;
85 static int hf_netsync_command
;
86 static int hf_netsync_size
;
87 static int hf_netsync_data
;
88 static int hf_netsync_checksum
;
90 static int hf_netsync_cmd_done_level
;
91 static int hf_netsync_cmd_done_type
;
93 static int hf_netsync_cmd_hello_keyname
;
94 static int hf_netsync_cmd_hello_key
;
95 static int hf_netsync_cmd_nonce
;
97 static int hf_netsync_cmd_anonymous_role
;
98 static int hf_netsync_cmd_anonymous_collection
;
100 static int hf_netsync_cmd_send_data_type
;
101 static int hf_netsync_cmd_send_data_id
;
103 static int hf_netsync_cmd_error_msg
;
106 static int hf_netsync_cmd_confirm_sig
;
108 static int hf_netsync_cmd_auth_role
;
109 static int hf_netsync_cmd_auth_collection
;
110 static int hf_netsync_cmd_auth_id
;
111 static int hf_netsync_cmd_auth_nonce1
;
112 static int hf_netsync_cmd_auth_nonce2
;
113 static int hf_netsync_cmd_auth_sig
;
115 static int hf_netsync_cmd_data_type
;
116 static int hf_netsync_cmd_data_id
;
117 static int hf_netsync_cmd_data_compressed
;
118 static int hf_netsync_cmd_data_payload
;
120 static int hf_netsync_cmd_delta_type
;
121 static int hf_netsync_cmd_delta_base_id
;
122 static int hf_netsync_cmd_delta_ident_id
;
123 static int hf_netsync_cmd_delta_compressed
;
124 static int hf_netsync_cmd_delta_payload
;
126 static int hf_netsync_cmd_refine_tree_node
;
128 static int hf_netsync_cmd_send_delta_type
;
129 static int hf_netsync_cmd_send_delta_base_id
;
130 static int hf_netsync_cmd_send_delta_ident_id
;
132 static int hf_netsync_cmd_nonexistent_type
;
133 static int hf_netsync_cmd_nonexistent_id
;
135 /* Define the tree for netsync */
136 static int ett_netsync
;
140 * Here are the global variables associated with the preferences
141 * for monotone netsync
144 static bool netsync_desegment
= true;
146 static int dissect_netsync_cmd_error( tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
150 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
152 proto_tree_add_item(tree
, hf_netsync_cmd_error_msg
, tvb
,
153 offset
, (int)len
, ENC_ASCII
);
159 static int dissect_netsync_cmd_bye(tvbuff_t
*tvb _U_
, int offset
, proto_tree
*tree _U_
, unsigned size _U_
)
165 static int dissect_netsync_cmd_hello(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
169 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
170 proto_tree_add_item(tree
, hf_netsync_cmd_hello_keyname
, tvb
,
171 offset
, (int)len
, ENC_ASCII
);
175 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
176 proto_tree_add_item(tree
, hf_netsync_cmd_hello_key
, tvb
,
177 offset
, (int)len
, ENC_NA
);
180 proto_tree_add_item(tree
, hf_netsync_cmd_nonce
, tvb
,
181 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
182 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
188 static int dissect_netsync_cmd_anonymous(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
192 proto_tree_add_item(tree
, hf_netsync_cmd_anonymous_role
, tvb
,
193 offset
, 1, ENC_BIG_ENDIAN
);
196 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
197 proto_tree_add_item(tree
, hf_netsync_cmd_anonymous_collection
, tvb
,
198 offset
, (int)len
, ENC_ASCII
);
201 proto_tree_add_item(tree
, hf_netsync_cmd_nonce
, tvb
,
202 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
203 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
209 static int dissect_netsync_cmd_auth(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
213 proto_tree_add_item(tree
, hf_netsync_cmd_auth_role
, tvb
,
214 offset
, 1, ENC_BIG_ENDIAN
);
218 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
219 proto_tree_add_item(tree
, hf_netsync_cmd_auth_collection
, tvb
,
220 offset
, (int)len
, ENC_ASCII
);
223 proto_tree_add_item(tree
, hf_netsync_cmd_auth_id
, tvb
,
224 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
225 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
229 proto_tree_add_item(tree
, hf_netsync_cmd_auth_nonce1
, tvb
,
230 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
231 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
235 proto_tree_add_item(tree
, hf_netsync_cmd_auth_nonce2
, tvb
,
236 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
237 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
239 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
240 proto_tree_add_item(tree
, hf_netsync_cmd_auth_sig
, tvb
,
241 offset
, (int)len
, ENC_NA
);
248 static int dissect_netsync_cmd_confirm(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
252 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
253 proto_tree_add_item(tree
, hf_netsync_cmd_confirm_sig
, tvb
,
254 offset
, (int)len
, ENC_NA
);
262 static int dissect_netsync_cmd_refine(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size
)
264 proto_tree_add_item(tree
, hf_netsync_cmd_refine_tree_node
, tvb
,
265 offset
, size
, ENC_NA
);
272 static int dissect_netsync_cmd_done(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
276 proto_tree_add_item_ret_length(tree
, hf_netsync_cmd_done_level
, tvb
,
277 offset
, -1, ENC_LITTLE_ENDIAN
|ENC_VARINT_PROTOBUF
, &bytes
);
280 proto_tree_add_item(tree
, hf_netsync_cmd_done_type
, tvb
,
281 offset
, 1, ENC_BIG_ENDIAN
);
288 static int dissect_netsync_cmd_send_data(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
290 proto_tree_add_item(tree
, hf_netsync_cmd_send_data_type
, tvb
,
291 offset
, 1, ENC_BIG_ENDIAN
);
294 proto_tree_add_item(tree
, hf_netsync_cmd_send_data_id
, tvb
,
295 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
296 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
302 static int dissect_netsync_cmd_send_delta(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
304 proto_tree_add_item(tree
, hf_netsync_cmd_send_delta_type
, tvb
,
305 offset
, 1, ENC_BIG_ENDIAN
);
308 proto_tree_add_item(tree
, hf_netsync_cmd_send_delta_base_id
, tvb
,
309 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
310 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
313 proto_tree_add_item(tree
, hf_netsync_cmd_send_delta_ident_id
, tvb
,
314 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
315 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
321 static int dissect_netsync_cmd_data(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
325 proto_tree_add_item(tree
, hf_netsync_cmd_data_type
, tvb
,
326 offset
, 1, ENC_BIG_ENDIAN
);
329 proto_tree_add_item(tree
, hf_netsync_cmd_data_id
, tvb
,
330 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
331 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
333 proto_tree_add_item(tree
, hf_netsync_cmd_data_compressed
, tvb
,
334 offset
, 1, ENC_BIG_ENDIAN
);
337 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
338 proto_tree_add_item(tree
, hf_netsync_cmd_data_payload
, tvb
,
339 offset
, (int)len
, ENC_NA
);
346 static int dissect_netsync_cmd_delta(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
350 proto_tree_add_item(tree
, hf_netsync_cmd_delta_type
, tvb
,
351 offset
, 1, ENC_BIG_ENDIAN
);
354 proto_tree_add_item(tree
, hf_netsync_cmd_delta_base_id
, tvb
,
355 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
356 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
358 proto_tree_add_item(tree
, hf_netsync_cmd_delta_ident_id
, tvb
,
359 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
360 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
362 proto_tree_add_item(tree
, hf_netsync_cmd_delta_compressed
, tvb
,
363 offset
, 1, ENC_BIG_ENDIAN
);
366 offset
+= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &len
, ENC_VARINT_PROTOBUF
);
367 proto_tree_add_item(tree
, hf_netsync_cmd_delta_payload
, tvb
,
368 offset
, (int)len
, ENC_NA
);
375 static int dissect_netsync_cmd_nonexistent(tvbuff_t
*tvb
, int offset
, proto_tree
*tree
, unsigned size _U_
)
377 proto_tree_add_item(tree
, hf_netsync_cmd_nonexistent_type
, tvb
,
378 offset
, 1, ENC_BIG_ENDIAN
);
381 proto_tree_add_item(tree
, hf_netsync_cmd_nonexistent_id
, tvb
,
382 offset
, NETSNYC_MERKLE_HASH_LENGTH
, ENC_NA
);
383 offset
+= NETSNYC_MERKLE_HASH_LENGTH
;
389 get_netsync_pdu_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
, void *data _U_
)
394 /* skip version and command */
397 size_bytes
= tvb_get_varint( tvb
, offset
, FT_VARINT_MAX_LEN
, &size
, ENC_VARINT_PROTOBUF
);
399 /* the calculated size if for the data only, this doesn't
400 * include the version (1 byte), command (1 byte),
401 * length (size_bytes bytes) and checksum (4 bytes)
404 return 1 + 1 + size_bytes
+ (unsigned)size
+ 4;
408 dissect_netsync_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
412 uint8_t cmd
, version
;
413 uint32_t size
, size_bytes
, shift
;
414 proto_tree
*ti
,*netsync_tree
=NULL
;
416 /* Set the protocol column */
417 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "Netsync");
420 return tvb_captured_length(tvb
);
422 while (tvb_reported_length_remaining(tvb
, offset
) > 0) {
423 ti
= proto_tree_add_item(tree
, proto_netsync
, tvb
, offset
, -1, ENC_NA
);
424 netsync_tree
= proto_item_add_subtree(ti
, ett_netsync
);
426 version
= tvb_get_uint8(tvb
, offset
);
427 proto_tree_add_item(netsync_tree
, hf_netsync_version
, tvb
,
428 offset
, 1, ENC_BIG_ENDIAN
);
431 cmd
= tvb_get_uint8(tvb
, offset
);
432 proto_tree_add_item(netsync_tree
, hf_netsync_command
, tvb
,
433 offset
, 1, ENC_BIG_ENDIAN
);
442 tmp
= tvb_get_uint8(tvb
, offset
+ size_bytes
);
445 size
|= (tmp
& 0x7F) << shift
;
447 } while ((tmp
& 0x80) && (shift
< 32));
450 proto_tree_add_uint(netsync_tree
, hf_netsync_size
, tvb
,
451 offset
, size_bytes
, size
);
452 offset
+= size_bytes
;
455 case NETSYNC_CMD_DONE
:
456 dissect_netsync_cmd_done( tvb
, offset
, netsync_tree
, size
);
459 case NETSYNC_CMD_ERROR
:
460 dissect_netsync_cmd_error( tvb
, offset
, netsync_tree
, size
);
463 case NETSYNC_CMD_BYE
:
464 dissect_netsync_cmd_bye( tvb
, offset
, netsync_tree
, size
);
467 case NETSYNC_CMD_HELLO
:
468 dissect_netsync_cmd_hello( tvb
, offset
, netsync_tree
, size
);
471 case NETSYNC_CMD_ANONYMOUS
:
472 dissect_netsync_cmd_anonymous( tvb
, offset
, netsync_tree
, size
);
475 case NETSYNC_CMD_AUTH
:
476 dissect_netsync_cmd_auth( tvb
, offset
, netsync_tree
, size
);
479 case NETSYNC_CMD_CONFIRM
:
480 dissect_netsync_cmd_confirm( tvb
, offset
, netsync_tree
, size
);
483 case NETSYNC_CMD_REFINE
:
484 dissect_netsync_cmd_refine( tvb
, offset
, netsync_tree
, size
);
487 case NETSYNC_CMD_SEND_DATA
:
488 dissect_netsync_cmd_send_data( tvb
, offset
, netsync_tree
, size
);
491 case NETSYNC_CMD_SEND_DELTA
:
492 dissect_netsync_cmd_send_delta( tvb
, offset
, netsync_tree
, size
);
495 case NETSYNC_CMD_DATA
:
496 dissect_netsync_cmd_data( tvb
, offset
, netsync_tree
, size
);
499 case NETSYNC_CMD_DELTA
:
500 dissect_netsync_cmd_delta( tvb
, offset
, netsync_tree
, size
);
503 case NETSYNC_CMD_NONEXISTENT
:
504 dissect_netsync_cmd_nonexistent( tvb
, offset
, netsync_tree
, size
);
508 proto_tree_add_item(netsync_tree
, hf_netsync_data
, tvb
,
509 offset
, size
, ENC_NA
);
515 proto_tree_add_checksum(netsync_tree
, tvb
, offset
, hf_netsync_checksum
,
516 -1, NULL
, pinfo
, 0, ENC_BIG_ENDIAN
, PROTO_CHECKSUM_NO_FLAGS
);
520 proto_item_append_text(netsync_tree
, " V%d, Cmd: %s (%d), Size: %d",
521 version
, val_to_str(cmd
, netsync_cmd_vals
, "(0x%x)"), cmd
, size
);
523 proto_item_set_len(netsync_tree
, 1+1+size_bytes
+size
+4);
526 return tvb_captured_length(tvb
);
530 dissect_netsync(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
532 tcp_dissect_pdus(tvb
, pinfo
, tree
, netsync_desegment
, 7, get_netsync_pdu_len
,
533 dissect_netsync_pdu
, data
);
534 return tvb_captured_length(tvb
);
538 proto_register_netsync(void)
540 static hf_register_info hf
[] = {
542 { &hf_netsync_version
,
543 { "Version", "netsync.version",
544 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
546 { &hf_netsync_command
,
547 { "Command", "netsync.command",
548 FT_UINT8
, BASE_HEX
, VALS(netsync_cmd_vals
), 0x0,
551 { "Size", "netsync.size",
552 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
555 { "Data", "netsync.data",
556 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
558 { &hf_netsync_checksum
,
559 { "Checksum", "netsync.checksum",
560 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
562 { &hf_netsync_cmd_hello_keyname
,
563 { "Key Name", "netsync.cmd.hello.keyname",
564 FT_STRING
, BASE_NONE
, NULL
, 0x0,
566 { &hf_netsync_cmd_hello_key
,
567 { "Key", "netsync.cmd.hello.key",
568 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
570 { &hf_netsync_cmd_nonce
,
571 { "Nonce", "netsync.cmd.nonce",
572 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
574 { &hf_netsync_cmd_anonymous_role
,
575 { "Role", "netsync.cmd.anonymous.role",
576 FT_UINT8
, BASE_DEC
, VALS(netsync_role_vals
), 0x0,
578 { &hf_netsync_cmd_anonymous_collection
,
579 { "Collection", "netsync.cmd.anonymous.collection",
580 FT_STRING
, BASE_NONE
, NULL
, 0x0,
582 { &hf_netsync_cmd_confirm_sig
,
583 { "Signature", "netsync.cmd.confirm.signature",
584 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
586 { &hf_netsync_cmd_send_data_type
,
587 { "Type", "netsync.cmd.send_data.type",
588 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
590 { &hf_netsync_cmd_send_data_id
,
591 { "ID", "netsync.cmd.send_data.id",
592 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
594 { &hf_netsync_cmd_error_msg
,
595 { "Message", "netsync.cmd.error.msg",
596 FT_STRING
, BASE_NONE
, NULL
, 0x0,
599 { &hf_netsync_cmd_done_level
,
600 { "Level", "netsync.cmd.done.level",
601 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
603 { &hf_netsync_cmd_auth_role
,
604 { "Role", "netsync.cmd.auth.role",
605 FT_UINT8
, BASE_DEC
, VALS(netsync_role_vals
), 0x0,
607 { &hf_netsync_cmd_auth_collection
,
608 { "Collection", "netsync.cmd.auth.collection",
609 FT_STRING
, BASE_NONE
, NULL
, 0x0,
611 { &hf_netsync_cmd_auth_id
,
612 { "ID", "netsync.cmd.auth.id",
613 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
615 { &hf_netsync_cmd_auth_nonce1
,
616 { "Nonce 1", "netsync.cmd.auth.nonce1",
617 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
619 { &hf_netsync_cmd_auth_nonce2
,
620 { "Nonce 2", "netsync.cmd.auth.nonce2",
621 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
623 { &hf_netsync_cmd_auth_sig
,
624 { "Signature", "netsync.cmd.auth.sig",
625 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
627 { &hf_netsync_cmd_data_type
,
628 { "Type", "netsync.cmd.data.type",
629 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
631 { &hf_netsync_cmd_data_id
,
632 { "ID", "netsync.cmd.data.id",
633 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
635 { &hf_netsync_cmd_data_compressed
,
636 { "Compressed", "netsync.cmd.data.compressed",
637 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
639 { &hf_netsync_cmd_data_payload
,
640 { "Payload", "netsync.cmd.data.payload",
641 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
643 { &hf_netsync_cmd_delta_type
,
644 { "Type", "netsync.cmd.delta.type",
645 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
647 { &hf_netsync_cmd_delta_base_id
,
648 { "Base ID", "netsync.cmd.delta.base_id",
649 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
651 { &hf_netsync_cmd_delta_ident_id
,
652 { "Ident ID", "netsync.cmd.delta.ident_id",
653 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
655 { &hf_netsync_cmd_delta_compressed
,
656 { "Compressed", "netsync.cmd.delta.compressed",
657 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
659 { &hf_netsync_cmd_delta_payload
,
660 { "Payload", "netsync.cmd.delta.payload",
661 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
663 { &hf_netsync_cmd_refine_tree_node
,
664 { "Tree Node", "netsync.cmd.refine.tree_node",
665 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
667 { &hf_netsync_cmd_send_delta_type
,
668 { "Type", "netsync.cmd.send_delta.type",
669 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
671 { &hf_netsync_cmd_send_delta_base_id
,
672 { "Base ID", "netsync.cmd.send_delta.base_id",
673 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
675 { &hf_netsync_cmd_send_delta_ident_id
,
676 { "Ident ID", "netsync.cmd.send_delta.ident_id",
677 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
679 { &hf_netsync_cmd_nonexistent_id
,
680 { "ID", "netsync.cmd.nonexistent.id",
681 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
683 { &hf_netsync_cmd_nonexistent_type
,
684 { "Type", "netsync.cmd.nonexistent.type",
685 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
687 { &hf_netsync_cmd_done_type
,
688 { "Type", "netsync.cmd.done.type",
689 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
695 static int *ett
[] = {
699 module_t
*netsync_module
;
701 proto_netsync
= proto_register_protocol("Monotone Netsync", "Netsync", "netsync");
702 proto_register_field_array(proto_netsync
, hf
, array_length(hf
));
703 proto_register_subtree_array(ett
, array_length(ett
));
705 netsync_module
= prefs_register_protocol(proto_netsync
, NULL
);
707 prefs_register_bool_preference(netsync_module
, "desegment_netsync_messages",
708 "Reassemble Netsync messages spanning multiple TCP segments",
709 "Whether the Netsync dissector should reassemble messages spanning multiple TCP segments."
710 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
713 netsync_handle
= register_dissector("netsync", dissect_netsync
, proto_netsync
);
717 proto_reg_handoff_netsync(void)
719 dissector_add_uint_with_preference("tcp.port", TCP_PORT_NETSYNC
, netsync_handle
);
723 * Editor modelines - https://www.wireshark.org/tools/modelines.html
728 * indent-tabs-mode: t
731 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
732 * :indentSize=8:tabSize=8:noTabs=false: