diff options
author | Дмитрий Цветцих <dmitrycvet@gmail.com> | 2016-01-18 17:16:05 +0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-01-19 07:47:43 +0000 |
commit | 60a085269d3c5da6c5aeb52fdc52732307596840 (patch) | |
tree | b1dff7d92a8f7c0fd5fa85fcc28009bdfbab44e7 /epan | |
parent | 72a9968fabd30865bd972f13613f10b33ecc0272 (diff) |
improved vuze-dht support
Vuze have a very old documentation. The last version
of the protocol contains 2 new fields. This patch added
support of these fields. They are named "Generic Flags" and
"Generic Flags 2" as a getters in source code.
Change-Id: I2257b273537ee2d5316ebcde72ade6ad4ad8d299
Reviewed-on: https://code.wireshark.org/review/13395
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-vuze-dht.c | 68 |
1 files changed, 62 insertions, 6 deletions
diff --git a/epan/dissectors/packet-vuze-dht.c b/epan/dissectors/packet-vuze-dht.c index 93dfb1364a..5b2ebe6f9c 100644 --- a/epan/dissectors/packet-vuze-dht.c +++ b/epan/dissectors/packet-vuze-dht.c @@ -63,7 +63,11 @@ enum { PV_RESTRICT_ID_PORTS2X = 34, PV_RESTRICT_ID_PORTS2Y = 35, PV_RESTRICT_ID_PORTS2Z = 36, - PV_RESTRICT_ID3 = 50 + PV_RESTRICT_ID3 = 50, + PV_VIVALDI_OPTIONAL = 51, + PV_PACKET_FLAGS = 51, + PV_ALT_CONTACTS = 52, + PV_PACKET_FLAGS2 = 53 }; /* Type Length */ @@ -145,7 +149,9 @@ enum { FT_DOWNLOADING = 0x01, FT_SEEDING = 0x02, FT_MULTI_VALUE = 0x04, - FT_STATS = 0x08 + FT_STATS = 0x08, + FLAG_ANON = 0x10, + FLAG_PRECIOUS = 0x20 }; static const value_string vuze_dht_flag_type_vals[] = { { FT_SINGLE_VALUE, "Single value" }, @@ -153,9 +159,22 @@ static const value_string vuze_dht_flag_type_vals[] = { { FT_SEEDING, "Seeding" }, { FT_MULTI_VALUE, "Multi value" }, { FT_STATS, "Stats" }, + { FLAG_ANON, "Anon" }, + { FLAG_PRECIOUS, "Precious" }, { 0, NULL } }; +/* generic flag type */ +enum { + GF_NONE = 0x00, + GF_DHT_SLEEPING = 0x01 +}; +static const value_string vuze_dht_generic_flag_type_vals[] = { + { GF_NONE, "None"}, + { GF_DHT_SLEEPING, "DHT sleeping" }, + {0, NULL} +}; + /* error type */ enum { ET_WRONG_ADDRESS = 1, @@ -202,6 +221,8 @@ static int hf_vuze_dht_network_id = -1; static int hf_vuze_dht_local_proto_ver = -1; static int hf_vuze_dht_instance_id = -1; static int hf_vuze_dht_time = -1; +static int hf_vuze_dht_generic_flags = -1; +static int hf_vuze_dht_generic_flags2 = -1; /* firstly appear in reply ping */ static int hf_vuze_dht_network_coordinates_count = -1; @@ -607,6 +628,8 @@ LOCAL_PROTOCOL_VERSION byte >=FIX_ORIGINATOR maximum protocol version thi NODE_ADDRESS address always address of the local node INSTANCE_ID int always application's helper number; randomly generated at the start TIME long always time of the local node; stored as number of milliseconds since Epoch +FLAG byte >=PACKET_FLAGS +FLAG2 byte >=PACKET_FLAGS2 */ static int @@ -633,12 +656,12 @@ dissect_vuze_dht_request_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t offset += TL_BYTE; } - if( *ver > PV_NETWORKS ) + if( *ver >= PV_NETWORKS ) { proto_tree_add_item(tree, hf_vuze_dht_network_id, tvb, offset, TL_INT, ENC_BIG_ENDIAN); offset += TL_INT; } - if( *ver > PV_FIX_ORIGINATOR ) + if( *ver >= PV_FIX_ORIGINATOR ) { proto_tree_add_item(tree, hf_vuze_dht_local_proto_ver, tvb, offset, TL_BYTE, ENC_BIG_ENDIAN); offset += TL_BYTE; @@ -650,6 +673,17 @@ dissect_vuze_dht_request_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_tree_add_item(tree, hf_vuze_dht_time, tvb, offset, TL_LONG, ENC_BIG_ENDIAN); offset += TL_LONG; + if( *ver >= PV_PACKET_FLAGS ) + { + proto_tree_add_item(tree, hf_vuze_dht_generic_flags, tvb, offset, TL_BYTE, ENC_BIG_ENDIAN); + offset += TL_BYTE; + } + if( *ver >= PV_PACKET_FLAGS2 ) + { + proto_tree_add_item(tree, hf_vuze_dht_generic_flags2, tvb, offset, TL_BYTE, ENC_BIG_ENDIAN); + offset += TL_BYTE; + } + return offset; } @@ -663,6 +697,8 @@ PROTOCOL_VERSION byte always version of protocol used in this pack VENDOR_ID byte >=VENDOR_ID same meaning as in the request NETWORK_ID int >=NETWORKS same meaning as in the request INSTANCE_ID int always instance id of the node that replies to the request +FLAG byte >=PACKET_FLAGS +FLAG2 byte >=PACKET_FLAGS2 */ static int @@ -689,7 +725,7 @@ dissect_vuze_dht_reply_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre offset += TL_BYTE; } - if( *ver > PV_NETWORKS ) + if( *ver >= PV_NETWORKS ) { proto_tree_add_item(tree, hf_vuze_dht_network_id, tvb, offset, TL_INT, ENC_BIG_ENDIAN); offset += TL_INT; @@ -698,6 +734,17 @@ dissect_vuze_dht_reply_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre proto_tree_add_item(tree, hf_vuze_dht_instance_id, tvb, offset, TL_INT, ENC_BIG_ENDIAN); offset += TL_INT; + if( *ver >= PV_PACKET_FLAGS ) + { + proto_tree_add_item(tree, hf_vuze_dht_generic_flags, tvb, offset, TL_BYTE, ENC_BIG_ENDIAN); + offset += TL_BYTE; + } + if( *ver >= PV_PACKET_FLAGS2 ) + { + proto_tree_add_item(tree, hf_vuze_dht_generic_flags2, tvb, offset, TL_BYTE, ENC_BIG_ENDIAN); + offset += TL_BYTE; + } + return offset; } @@ -1399,6 +1446,16 @@ proto_register_vuze_dht(void) { "Signature", "vuze-dht.signature", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } + }, + { &hf_vuze_dht_generic_flags, + { "Generic Flags", "vuze-dht.generic_flags", + FT_UINT8, BASE_DEC, VALS(vuze_dht_generic_flag_type_vals), 0x0, + NULL, HFILL } + }, + { &hf_vuze_dht_generic_flags2, + { "Generic Flags 2", "vuze-dht.generic_flags2", + FT_UINT8, BASE_DEC, VALS(vuze_dht_flag_type_vals), 0x0, + NULL, HFILL } } }; @@ -1471,4 +1528,3 @@ proto_reg_handoff_vuze_dht(void) * ex: set shiftwidth=2 tabstop=8 expandtab: * :indentSize=2:tabSize=8:noTabs=true: */ - |