2 * HDFS data Protocol and dissectors
4 * Copyright (c) 2011 by Isilon Systems.
6 * Author: Allison Obourn <aobourn@isilon.com>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1999 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <epan/packet.h>
33 #include <epan/prefs.h>
34 #include "epan/dissectors/packet-tcp.h"
38 #define NAMENODE_PORT 8020
39 #define DATANODE_PORT 8021
42 #define FIRST_READ_FRAGMENT_LEN 15
43 #define SECOND_READ_FRAGMENT_LEN 29
44 #define LAST_READ_FRAGMENT_LEN 4
47 #define MIN_WRITE_REQ 35
48 #define MIN_READ_REQ 36
50 #define STATUS_SUCCESS 6
51 #define PIPELINE_LEN 1
53 #define FINISH_REQ_LEN 4
54 #define END_PACKET_LEN 8
55 #define READ_RESP_HEAD_LEN 19
56 #define WRITE_RESP_HEAD_LEN 21
57 #define WRITE_REQ_HEAD_LEN 7
61 #define CHUNKSIZE_START 3
65 static const int RESPONSE_HEADER
= 1;
66 static const int RESPONSE_METADATA
= 2;
67 static const int RESPONSE_DATA
= 3;
70 static guint tcp_port
= 0;
72 static int proto_hdfsdata
= -1;
73 static int hf_hdfsdata_version
= -1;
74 static int hf_hdfsdata_cmd
= -1;
75 static int hf_hdfsdata_blockid
= -1;
76 static int hf_hdfsdata_timestamp
= -1;
77 static int hf_hdfsdata_startoffset
= -1;
78 static int hf_hdfsdata_blocklen
= -1;
79 static int hf_hdfsdata_clientlen
= -1;
80 static int hf_hdfsdata_clientid
= -1;
81 static int hf_hdfsdata_tokenlen
= -1;
82 static int hf_hdfsdata_tokenid
= -1;
83 static int hf_hdfsdata_tokenpassword
= -1;
84 static int hf_hdfsdata_tokentype
= -1;
85 static int hf_hdfsdata_tokenservice
= -1;
86 static int hf_hdfsdata_status
= -1;
87 static int hf_hdfsdata_checksumtype
= -1;
88 static int hf_hdfsdata_chunksize
= -1;
89 static int hf_hdfsdata_chunkoffset
= -1;
90 static int hf_hdfsdata_datalength
= -1;
91 static int hf_hdfsdata_inblockoffset
= -1;
92 static int hf_hdfsdata_seqnum
= -1;
93 static int hf_hdfsdata_last
= -1;
94 static int hf_hdfsdata_crc32
= -1;
95 static int hf_hdfsdata_datalen
= -1;
96 static int hf_hdfsdata_rest
= -1;
97 static int hf_hdfsdata_end
= -1;
98 static int hf_hdfsdata_packetsize
= -1;
99 static int hf_hdfsdata_chunklength
= -1;
100 static int hf_hdfsdata_crc64
= -1;
101 static int hf_hdfsdata_pipelinestatus
= -1;
103 static int hf_hdfsdata_pipelinenum
= -1;
104 static int hf_hdfsdata_recovery
= -1;
105 static int hf_hdfsdata_sourcenode
= -1;
106 static int hf_hdfsdata_currentpipeline
= -1;
107 static int hf_hdfsdata_node
= -1;
109 static gint ett_hdfsdata
= -1;
111 static dissector_handle_t hdfsdata_handle
;
113 void proto_reg_handoff_hdfsdata(void);
116 Parse the first byte of a vint/vlong to determine the number of bytes
117 value is the first byte of the vint/vlong
118 returns the total number of bytes (1 to 9) */
120 decode_vint_size (char value
) {
123 } else if (value
< -120) {
130 converts a variable length number into a long and discovers how many bytes it is
131 returns the decoded number */
133 dissect_variable_length_long (tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int* offset
)
138 gint8 first_byte
= tvb_get_guint8(tvb
, *offset
);
141 int len
= decode_vint_size(first_byte
);
143 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_clientlen
, tvb
, *offset
, byte_count
, ENC_BIG_ENDIAN
);
144 *offset
= (*offset
) + byte_count
;
148 for (idx
= 0; idx
< len
-1; idx
++) {
149 char b
= tvb_get_guint8(tvb
, *offset
+ byte_count
);
154 size
= ((first_byte
< -120 || (first_byte
>= -112 && first_byte
< 0)) ? (i
^ 0xFFFFFFFF) : i
);
155 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_clientlen
, tvb
, *offset
, byte_count
, ENC_BIG_ENDIAN
);
156 *offset
= (*offset
) + byte_count
;
161 /* dissects a variable length int and then using its value dissects the following string */
163 dissect_variable_int_string(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int *offset
)
165 /* Get the variable length int that represents the length of the next feild */
166 int len
= dissect_variable_length_long (tvb
, hdfsdata_tree
, offset
);
168 /* client id = amount of bytes in previous */
169 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_clientid
, tvb
, *offset
, len
, ENC_ASCII
|ENC_NA
);
173 /* dissects the access tokens that appear at the end of requests.
174 tokens: id, password, kind, service */
176 dissect_access_tokens(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int *offset
)
180 len
= tvb_get_guint8(tvb
, *offset
);
181 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_tokenlen
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
184 /* token id = amount of bytes in previous */
185 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_tokenid
, tvb
, *offset
, len
, ENC_ASCII
|ENC_NA
);
188 len
= tvb_get_guint8(tvb
, *offset
);
189 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_tokenlen
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
192 /* token password = amount of bytes in previous */
193 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_tokenpassword
, tvb
, *offset
, len
, ENC_ASCII
|ENC_NA
);
196 len
= tvb_get_guint8(tvb
, *offset
);
197 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_tokenlen
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
200 /* token type = amount of bytes in previous */
201 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_tokentype
, tvb
, *offset
, len
, ENC_ASCII
|ENC_NA
);
204 len
= tvb_get_guint8(tvb
, *offset
);
205 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_tokenlen
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
208 /* token service = amount of bytes in previous; */
209 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_tokenservice
, tvb
, *offset
, len
, ENC_ASCII
|ENC_NA
);
213 /* handles parsing read response packets */
215 dissect_read_response(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int offset
)
220 /* 4 bytes = data length */
221 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_datalength
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
224 /* 8 bytes = in block offset */
225 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_inblockoffset
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
228 /* 8 bytes = sequence number */
229 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_seqnum
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
232 /* 1 byte = last packet in block */
233 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_last
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
236 /* 4 byte = length of data */
237 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_datalen
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
240 /* if there is a crc checksum it is 8* the length of the data * checksum size / chunksize */
241 chunksize
= tvb_get_ntohl(tvb
, CHUNKSIZE_START
);
242 if (chunksize
== 0) /* let's not divide by zero */
244 if (tvb_get_guint8(tvb
, 2) == CRC
) {
245 len
= (int)(CRC_SIZE
* tvb_get_ntohl(tvb
, offset
- 4) *
246 tvb_get_ntohl(tvb
, offset
- 8) / chunksize
);
249 /* the rest of bytes (usually 4) = crc32 code */
250 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_crc32
, tvb
, offset
, len
, ENC_BIG_ENDIAN
);
254 /* dissects the first packet of the read response */
256 dissect_read_response_start(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int offset
) {
257 /* 2 bytes = status code */
258 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_status
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
261 /* checksum type = 1 byte. 1 = crc32, 0 = null */
262 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_checksumtype
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
265 /* 4 bytes = chunksize */
266 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_chunksize
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
269 /* 8 bytes = chunk offset */
270 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_chunkoffset
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
274 /* dissects the fields specific to a read request */
276 dissect_read_request(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int *offset
)
279 /* 8 bytes = start offset */
280 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_startoffset
, tvb
, *offset
, 8, ENC_BIG_ENDIAN
);
283 /* 8 bytes = block length */
284 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_blocklen
, tvb
, *offset
, 8, ENC_BIG_ENDIAN
);
289 /* dissects the fields specific to a write request */
291 dissect_write_request(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int *offset
)
293 /* 4 bytes = number of nodes in pipeline */
294 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_pipelinenum
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
297 /* 1 bytes = recovery boolean */
298 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_recovery
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
302 /* dissects the fields specific to a write request */
304 dissect_write_request_end(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int *offset
)
309 /* 1 bytes = source node */
310 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_sourcenode
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
313 /* 4 bytes = number of nodes currently in the pipeline (usually just -1 of before) */
314 len
= tvb_get_ntohl(tvb
, *offset
);
315 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_currentpipeline
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
318 /* varible length sequence of node objects */
319 for (i
= 0; i
< len
; i
++) {
320 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_node
, tvb
, *offset
, 4, ENC_BIG_ENDIAN
);
325 /* dissects the beginning of the read and write request messages */
327 dissect_header(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int* offset
){
331 /* 2 bytes = protocol version */
332 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_version
, tvb
, *offset
, 2, ENC_BIG_ENDIAN
);
335 /* 1 byte = command */
336 command
= tvb_get_guint8(tvb
, *offset
);
337 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_cmd
, tvb
, *offset
, 1, ENC_BIG_ENDIAN
);
340 /* 8 bytes = block id */
341 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_blockid
, tvb
, *offset
, 8, ENC_BIG_ENDIAN
);
344 /* 8 bytes = timestamp */
345 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_timestamp
, tvb
, *offset
, 8, ENC_BIG_ENDIAN
);
351 /* decodes the write response messages */
353 dissect_write_response(tvbuff_t
*tvb
, proto_tree
*hdfsdata_tree
, int offset
)
355 /* 4 bytes = packetsize */
356 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_packetsize
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
359 /* 8 bytes = offset in block */
360 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_startoffset
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
363 /* 8 bytes = sequence number */
364 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_seqnum
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
367 /* 1 bytes = last packet */
368 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_last
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
371 /* 4 bytes = chunk length */
372 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_chunklength
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
375 /* 8 bytes = crc code */
376 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_crc64
, tvb
, offset
, 8, ENC_BIG_ENDIAN
);
379 /* add the rest -> RESPONSE_DATA */
380 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_rest
, tvb
, offset
, (tvb_reported_length(tvb
)) - offset
, ENC_ASCII
|ENC_NA
);
381 /* offset += (tvb_reported_length(tvb)); */
384 /* determine PDU length of protocol */
386 get_hdfsdata_message_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
)
388 /* get data packet len, add FIRST_READ_FRAGMENT_LEN for first fragment (before len),
389 SECOND_READ_FRAGMENT_LEN for second fragment (incl len), subtract 4 for length itself. */
391 if (tvb_reported_length(tvb
) <= 4 || tvb_reported_length(tvb
) == END_PACKET_LEN
392 || tvb_get_ntohl(tvb
, 0) == tvb_reported_length(tvb
) - WRITE_RESP_HEAD_LEN
393 || (tvb_reported_length(tvb
) >= MIN_READ_REQ
&& tvb_get_guint8(tvb
, 2) == READ_OP
)
394 || (tvb_reported_length(tvb
) >= MIN_WRITE_REQ
&& tvb_get_guint8(tvb
, 2) == WRITE_OP
)) {
396 return tvb_reported_length(tvb
);
398 return tvb_get_ntohl(tvb
, offset
+ FIRST_READ_FRAGMENT_LEN
) +
399 FIRST_READ_FRAGMENT_LEN
+ SECOND_READ_FRAGMENT_LEN
- LAST_READ_FRAGMENT_LEN
;
402 /* This method dissects fully reassembled messages */
404 dissect_hdfsdata_message(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
408 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "HDFSDATA");
409 /* Clear out stuff in the info column */
410 col_set_str(pinfo
->cinfo
, COL_INFO
, "HDFS Data");
414 proto_item
*ti
= NULL
;
415 proto_tree
*hdfsdata_tree
= NULL
;
417 ti
= proto_tree_add_item(tree
, proto_hdfsdata
, tvb
, offset
, -1, ENC_NA
);
418 hdfsdata_tree
= proto_item_add_subtree(ti
, ett_hdfsdata
);
420 /* if only 1 bytes packet must just contain just the pipeline status */
421 if ((tvb_reported_length(tvb
)) == PIPELINE_LEN
) {
423 /* 1 bytes = pipeline status */
424 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_pipelinestatus
, tvb
, offset
, PIPELINE_LEN
, ENC_BIG_ENDIAN
);
426 /* if only 2 bytes packet must just contain just a status code */
427 } else if ((tvb_reported_length(tvb
)) == STATUS_LEN
) {
428 /* 2 bytes = status code */
429 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_status
, tvb
, offset
, STATUS_LEN
, ENC_BIG_ENDIAN
);
431 /* if it is 4 bytes long it must be a finish request packet */
432 } else if ((tvb_reported_length(tvb
)) == FINISH_REQ_LEN
) {
433 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_end
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
435 /* read response packet */
436 } else if (tvb_reported_length(tvb
) >= READ_RESP_HEAD_LEN
&& tvb_reported_length(tvb
) ==
437 tvb_get_ntohl(tvb
, FIRST_READ_FRAGMENT_LEN
) +
438 FIRST_READ_FRAGMENT_LEN
+ SECOND_READ_FRAGMENT_LEN
- LAST_READ_FRAGMENT_LEN
){
440 dissect_read_response_start(tvb
, hdfsdata_tree
, offset
);
441 offset
+= FIRST_READ_FRAGMENT_LEN
;
443 dissect_read_response(tvb
, hdfsdata_tree
, offset
);
444 offset
+= SECOND_READ_FRAGMENT_LEN
;
446 /* This message just contains data so we can display it all as one block */
448 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_rest
, tvb
, offset
, (tvb_reported_length(tvb
)) - offset
, ENC_ASCII
|ENC_NA
);
452 guint8 op
= tvb_get_guint8(tvb
, 2);
455 if ((tvb_reported_length(tvb
)) >= MIN_READ_REQ
&& op
== READ_OP
) {
456 dissect_header(tvb
, hdfsdata_tree
, &offset
);
457 dissect_read_request(tvb
, hdfsdata_tree
, &offset
);
458 dissect_variable_int_string(tvb
, hdfsdata_tree
, &offset
);
459 dissect_access_tokens(tvb
, hdfsdata_tree
, &offset
);
462 } else if ((tvb_reported_length(tvb
)) >= MIN_WRITE_REQ
&& op
== WRITE_OP
) {
463 dissect_header(tvb
, hdfsdata_tree
, &offset
);
464 dissect_write_request(tvb
, hdfsdata_tree
, &offset
);
465 dissect_variable_int_string(tvb
, hdfsdata_tree
, &offset
);
466 dissect_write_request_end(tvb
, hdfsdata_tree
, &offset
);
467 dissect_access_tokens(tvb
, hdfsdata_tree
, &offset
);
469 /* checksum type = 1 byte. 1 = crc32, 0 = null */
470 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_checksumtype
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
473 /* 4 bytes = chunksize */
474 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_chunksize
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
476 /* write responses store the data length in the first 4 bytes. This length does not
477 include 21 bits of header */
478 } else if (tvb_reported_length(tvb
) >= 4 && tvb_get_ntohl(tvb
, 0) ==
479 tvb_reported_length(tvb
) - WRITE_RESP_HEAD_LEN
) {
481 dissect_write_response(tvb
, hdfsdata_tree
, offset
);
484 /* This message contains some form of data that we have not successfully been able to
485 pattern match and catagorize. Display all of it as data. */
486 proto_tree_add_item(hdfsdata_tree
, hf_hdfsdata_rest
, tvb
, offset
, (tvb_reported_length(tvb
)), ENC_ASCII
|ENC_NA
);
491 return tvb_length(tvb
);
495 dissect_hdfsdata(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data
)
497 int frame_header_len
= 0;
499 gboolean need_reassemble
= FALSE
;
501 gboolean only_packet
= tvb_reported_length(tvb
) == 1 || (tvb_reported_length(tvb
) == 2 &&
502 tvb_get_ntohs(tvb
, 0) == STATUS_SUCCESS
);
504 if (tvb_reported_length(tvb
) >= 3)
505 op
= tvb_get_guint8(tvb
, 2);
507 if (!only_packet
&& tvb_reported_length(tvb
) != 4 && !(tvb_reported_length(tvb
) >= MIN_READ_REQ
&& op
== READ_OP
) &&
508 !(tvb_reported_length(tvb
) >= MIN_WRITE_REQ
&& op
== WRITE_OP
) && !(tvb_reported_length(tvb
) == END_PACKET_LEN
&&
509 !tvb_get_ntohl(tvb
, 0) && !tvb_get_ntohl(tvb
, 4))) {
511 need_reassemble
= TRUE
;
514 /* setting the header size for the different types of packets */
515 if (only_packet
|| tvb_reported_length(tvb
) == END_PACKET_LEN
) {
516 frame_header_len
= tvb_reported_length(tvb
);
518 } else if (tvb_reported_length(tvb
) == FIRST_READ_FRAGMENT_LEN
||(tvb_reported_length(tvb
) >= MIN_READ_REQ
&&
519 op
== READ_OP
&& !((tvb_reported_length(tvb
)) == 2 && !tvb_get_ntohs(tvb
, 0)))) {
521 frame_header_len
= READ_RESP_HEAD_LEN
;
523 } else if (tvb_reported_length(tvb
) >= MIN_WRITE_REQ
&& op
== WRITE_OP
) {
524 frame_header_len
= WRITE_REQ_HEAD_LEN
;
527 tcp_dissect_pdus(tvb
, pinfo
, tree
, need_reassemble
, frame_header_len
, get_hdfsdata_message_len
, dissect_hdfsdata_message
, data
);
528 return tvb_length(tvb
);
531 /* registers the protcol with the given names */
533 proto_register_hdfsdata(void)
535 static hf_register_info hf
[] = {
537 /* list of all options for dissecting the protocol */
539 /*************************************************
541 **************************************************/
542 { &hf_hdfsdata_version
,
543 { "HDFSDATA protocol version", "hdfsdata.version",
549 { "HDFSDATA command", "hdfsdata.cmd",
554 { &hf_hdfsdata_blockid
,
555 { "HDFSDATA block id", "hdfsdata.blockid",
560 { &hf_hdfsdata_timestamp
,
561 { "HDFSDATA timestamp", "hdfsdata.timestamp",
569 { &hf_hdfsdata_startoffset
,
570 { "HDFSDATA start offset" , "hdfsdata.startoffset",
575 { &hf_hdfsdata_blocklen
,
576 { "HDFSDATA block length", "hdfsdata.blocklen",
584 { &hf_hdfsdata_pipelinenum
,
585 { "HDFSDATA number in pipeline", "hdfsdata.pipelinenum",
590 { &hf_hdfsdata_recovery
,
591 { "HDFSDATA recovery boolean", "hdfsdata.recovery",
596 { &hf_hdfsdata_sourcenode
,
597 { "HDFSDATA source node", "hdfsdata.sourcenode",
602 { &hf_hdfsdata_currentpipeline
,
603 { "HDFSDATA current number of nodes in the pipeline", "hdfsdata.currentpipline",
609 { "HDFSDATA node object", "hdfsdata.node",
617 { &hf_hdfsdata_clientlen
,
618 { "HDFSDATA client id length", "hdfsdata.clientlen",
623 { &hf_hdfsdata_clientid
,
624 { "HDFSDATA client id", "hdfsdata.clientid",
625 FT_STRING
, BASE_NONE
,
630 { "HDFSDATA end data request", "hdfsdata.end",
635 /*************************************************
637 **************************************************/
638 { &hf_hdfsdata_tokenlen
,
639 { "HDFSDATA access token length", "hdfsdata.tokenlen",
644 { &hf_hdfsdata_tokenid
,
645 { "HDFSDATA access token ID", "hdfsdata.tokenid",
646 FT_STRING
, BASE_NONE
,
650 { &hf_hdfsdata_tokenpassword
,
651 { "HDFSDATA access token password", "hdfsdata.tokenpassword",
652 FT_STRING
, BASE_NONE
,
656 { &hf_hdfsdata_tokentype
,
657 { "HDFSDATA access token type", "hdfsdata.tokentype",
658 FT_STRING
, BASE_NONE
,
662 { &hf_hdfsdata_tokenservice
,
663 { "HDFSDATA access token service", "hdfsdata.tokenservice",
664 FT_STRING
, BASE_NONE
,
668 /***********************************************
670 ***********************************************/
671 { &hf_hdfsdata_status
,
672 { "HDFSDATA status code", "hdfsdata.status",
677 { &hf_hdfsdata_checksumtype
,
678 { "HDFSDATA checksum type", "hdfsdata.checksumtype",
683 { &hf_hdfsdata_chunksize
,
684 { "HDFSDATA chunk size", "hdfsdata.chunksize",
689 { &hf_hdfsdata_chunkoffset
,
690 { "HDFSDATA chunk offset", "hdfsdata.chunkoffset",
695 /***********************************************
697 ***********************************************/
698 { &hf_hdfsdata_datalength
,
699 { "HDFSDATA length of data", "hdfsdata.datalength",
704 { &hf_hdfsdata_inblockoffset
,
705 { "HDFSDATA in block offset", "hdfsdata.inblockoffset",
710 { &hf_hdfsdata_seqnum
,
711 { "HDFSDATA sequence number", "hdfsdata.seqnum",
717 { "HDFSDATA last packet in block", "hdfsdata.last",
722 { &hf_hdfsdata_datalen
,
723 { "HDFSDATA length of data", "hdfsdata.datalen",
728 { &hf_hdfsdata_crc32
,
729 { "HDFSDATA crc32 checksum", "hdfsdata.crc32",
734 /***********************************************
736 ***********************************************/
738 { "HDFSDATA data", "hdfsdata.rest",
739 FT_STRING
, BASE_NONE
,
743 /***********************************************
745 ***********************************************/
746 { &hf_hdfsdata_packetsize
,
747 { "HDFSDATA packet size", "hdfsdata.packetsize",
752 { &hf_hdfsdata_chunklength
,
753 { "HDFSDATA chunk length", "hdfsdata.chunklength",
758 { &hf_hdfsdata_crc64
,
759 { "HDFSDATA crc64 checksum", "hdfsdata.crc64",
764 { &hf_hdfsdata_pipelinestatus
,
765 { "HDFSDATA pipeline status", "hdfsdata.pipelinestatus",
772 /* Setup protocol subtree array */
773 static gint
*ett
[] = {
777 module_t
*hdfsdata_module
;
779 proto_hdfsdata
= proto_register_protocol (
780 "HDFSDATA Protocol", /* name */
781 "HDFSDATA", /* short name */
782 "hdfsdata" /* abbrev */
785 proto_register_field_array(proto_hdfsdata
, hf
, array_length(hf
));
786 proto_register_subtree_array(ett
, array_length(ett
));
788 hdfsdata_module
= prefs_register_protocol(proto_hdfsdata
, proto_reg_handoff_hdfsdata
);
790 prefs_register_uint_preference(hdfsdata_module
,
792 "TCP port for HDFSDATA",
793 "Set the TCP port for HDFSDATA",
797 hdfsdata_handle
= new_register_dissector("hdfsdata", dissect_hdfsdata
, proto_hdfsdata
);
800 /* registers handoff */
802 proto_reg_handoff_hdfsdata(void)
804 static gboolean initialized
= FALSE
;
805 static guint saved_tcp_port
;
808 dissector_add_handle("tcp.port", hdfsdata_handle
); /* for "decode as" */
810 } else if (saved_tcp_port
!= 0) {
811 dissector_delete_uint("tcp.port", saved_tcp_port
, hdfsdata_handle
);
815 dissector_add_uint("tcp.port", tcp_port
, hdfsdata_handle
);
818 saved_tcp_port
= tcp_port
;
826 * indent-tabs-mode: nil
829 * ex: set shiftwidth=2 tabstop=8 expandtab:
830 * :indentSize=2:tabSize=8:noTabs=true: