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.
34 #include <epan/packet.h>
35 #include <epan/prefs.h>
36 #include "epan/dissectors/packet-tcp.h"
40 #define NAMENODE_PORT 8020
41 #define DATANODE_PORT 8021
44 #define FIRST_READ_FRAGMENT_LEN 15
45 #define SECOND_READ_FRAGMENT_LEN 29
46 #define LAST_READ_FRAGMENT_LEN 4
49 #define MIN_WRITE_REQ 35
50 #define MIN_READ_REQ 36
52 #define STATUS_SUCCESS 6
53 #define PIPELINE_LEN 1
55 #define FINISH_REQ_LEN 4
56 #define END_PACKET_LEN 8
57 #define READ_RESP_HEAD_LEN 19
58 #define WRITE_RESP_HEAD_LEN 21
59 #define WRITE_REQ_HEAD_LEN 7
63 #define CHUNKSIZE_START 3
66 static const int RESPONSE_HEADER = 1;
67 static const int RESPONSE_METADATA = 2;
68 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 void proto_reg_handoff_hdfsdata(void);
114 Parse the first byte of a vint/vlong to determine the number of bytes
115 value is the first byte of the vint/vlong
116 returns the total number of bytes (1 to 9) */
118 decode_vint_size (char value) {
121 } else if (value < -120) {
128 converts a variable length number into a long and discovers how many bytes it is
129 returns the decoded number */
131 dissect_variable_length_long (tvbuff_t *tvb, proto_tree *hdfsdata_tree, int* offset)
136 char first_byte = tvb_get_guint8(tvb, *offset);
139 int len = decode_vint_size(first_byte);
141 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_clientlen, tvb, *offset, byte_count, ENC_BIG_ENDIAN);
142 *offset = (*offset) + byte_count;
146 for (idx = 0; idx < len-1; idx++) {
147 char b = tvb_get_guint8(tvb, *offset + byte_count);
152 size = ((first_byte < -120 || (first_byte >= -112 && first_byte < 0)) ? (i ^ -1L) : i);
153 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_clientlen, tvb, *offset, byte_count, ENC_BIG_ENDIAN);
154 *offset = (*offset) + byte_count;
159 /* dissects a variable length int and then using its value dissects the following string */
161 dissect_variable_int_string(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
163 /* Get the variable length int that represents the length of the next feild */
164 int len = dissect_variable_length_long (tvb, hdfsdata_tree, offset);
166 /* client id = amount of bytes in previous */
167 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_clientid, tvb, *offset, len, ENC_ASCII|ENC_NA);
171 /* dissects the access tokens that appear at the end of requests.
172 tokens: id, password, kind, service */
174 dissect_access_tokens(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
178 len = tvb_get_guint8(tvb, *offset);
179 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenlen, tvb, *offset, 1, ENC_BIG_ENDIAN);
182 /* token id = amount of bytes in previous */
183 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenid, tvb, *offset, len, ENC_ASCII|ENC_NA);
186 len = tvb_get_guint8(tvb, *offset);
187 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenlen, tvb, *offset, 1, ENC_BIG_ENDIAN);
190 /* token password = amount of bytes in previous */
191 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenpassword, tvb, *offset, len, ENC_ASCII|ENC_NA);
194 len = tvb_get_guint8(tvb, *offset);
195 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenlen, tvb, *offset, 1, ENC_BIG_ENDIAN);
198 /* token type = amount of bytes in previous */
199 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokentype, tvb, *offset, len, ENC_ASCII|ENC_NA);
202 len = tvb_get_guint8(tvb, *offset);
203 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenlen, tvb, *offset, 1, ENC_BIG_ENDIAN);
206 /* token service = amount of bytes in previous; */
207 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenservice, tvb, *offset, len, ENC_ASCII|ENC_NA);
211 /* handles parsing read response packets */
213 dissect_read_response(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset)
217 /* 4 bytes = data length */
218 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_datalength, tvb, offset, 4, ENC_BIG_ENDIAN);
221 /* 8 bytes = in block offset */
222 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_inblockoffset, tvb, offset, 8, ENC_BIG_ENDIAN);
225 /* 8 bytes = sequence number */
226 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_seqnum, tvb, offset, 8, ENC_BIG_ENDIAN);
229 /* 1 byte = last packet in block */
230 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_last, tvb, offset, 1, ENC_BIG_ENDIAN);
233 /* 4 byte = length of data */
234 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_datalen, tvb, offset, 4, ENC_BIG_ENDIAN);
237 /* if there is a crc checksum it is 8* the length of the data * checksum size / chunksize */
238 if (tvb_get_guint8(tvb, 2) == CRC) {
239 len = (int)(CRC_SIZE * tvb_get_ntohl(tvb, offset - 4) *
240 tvb_get_ntohl(tvb, offset - 8) / tvb_get_ntohl(tvb, CHUNKSIZE_START));
243 /* the rest of bytes (usually 4) = crc32 code */
244 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_crc32, tvb, offset, len, ENC_BIG_ENDIAN);
248 /* dissects the first packet of the read response */
250 dissect_read_response_start(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset) {
251 /* 2 bytes = status code */
252 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_status, tvb, offset, 2, ENC_BIG_ENDIAN);
255 /* checksum type = 1 byte. 1 = crc32, 0 = null */
256 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_checksumtype, tvb, offset, 1, ENC_BIG_ENDIAN);
259 /* 4 bytes = chunksize */
260 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_chunksize, tvb, offset, 4, ENC_BIG_ENDIAN);
263 /* 8 bytes = chunk offset */
264 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_chunkoffset, tvb, offset, 8, ENC_BIG_ENDIAN);
268 /* dissects the fields specific to a read request */
270 dissect_read_request(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
273 /* 8 bytes = start offset */
274 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_startoffset, tvb, *offset, 8, ENC_BIG_ENDIAN);
277 /* 8 bytes = block length */
278 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_blocklen, tvb, *offset, 8, ENC_BIG_ENDIAN);
283 /* dissects the fields specific to a write request */
285 dissect_write_request(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
287 /* 4 bytes = number of nodes in pipeline */
288 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_pipelinenum, tvb, *offset, 4, ENC_BIG_ENDIAN);
291 /* 1 bytes = recovery boolean */
292 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_recovery, tvb, *offset, 1, ENC_BIG_ENDIAN);
296 /* dissects the fields specific to a write request */
298 dissect_write_request_end(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
303 /* 1 bytes = source node */
304 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_sourcenode, tvb, *offset, 1, ENC_BIG_ENDIAN);
307 /* 4 bytes = number of nodes currently in the pipeline (usually just -1 of before) */
308 len = tvb_get_ntohl(tvb, *offset);
309 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_currentpipeline, tvb, *offset, 4, ENC_BIG_ENDIAN);
312 /* varible length sequence of node objects */
313 for (i = 0; i < len; i++) {
314 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_node, tvb, *offset, 4, ENC_BIG_ENDIAN);
319 /* dissects the beginning of the read and write request messages */
321 dissect_header(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int* offset){
325 /* 2 bytes = protocol version */
326 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_version, tvb, *offset, 2, ENC_BIG_ENDIAN);
329 /* 1 byte = command */
330 command = tvb_get_guint8(tvb, *offset);
331 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_cmd, tvb, *offset, 1, ENC_BIG_ENDIAN);
334 /* 8 bytes = block id */
335 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_blockid, tvb, *offset, 8, ENC_BIG_ENDIAN);
338 /* 8 bytes = timestamp */
339 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_timestamp, tvb, *offset, 8, ENC_BIG_ENDIAN);
345 /* decodes the write response messages */
347 dissect_write_response(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset)
349 /* 4 bytes = packetsize */
350 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_packetsize, tvb, offset, 4, ENC_BIG_ENDIAN);
353 /* 8 bytes = offset in block */
354 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_startoffset, tvb, offset, 8, ENC_BIG_ENDIAN);
357 /* 8 bytes = sequence number */
358 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_seqnum, tvb, offset, 8, ENC_BIG_ENDIAN);
361 /* 1 bytes = last packet */
362 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_last, tvb, offset, 1, ENC_BIG_ENDIAN);
365 /* 4 bytes = chunk length */
366 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_chunklength, tvb, offset, 4, ENC_BIG_ENDIAN);
369 /* 8 bytes = crc code */
370 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_crc64, tvb, offset, 8, ENC_BIG_ENDIAN);
373 /* add the rest -> RESPONSE_DATA */
374 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_rest, tvb, offset, (tvb_reported_length(tvb)) - offset, ENC_ASCII|ENC_NA);
375 /* offset += (tvb_reported_length(tvb)); */
378 /* determine PDU length of protocol */
380 get_hdfsdata_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
382 /* get data packet len, add FIRST_READ_FRAGMENT_LEN for first fragment (before len),
383 SECOND_READ_FRAGMENT_LEN for second fragment (incl len), subtract 4 for length itself. */
385 if (tvb_reported_length(tvb) <= 4 || tvb_reported_length(tvb) == END_PACKET_LEN
386 || tvb_get_ntohl(tvb, 0) == tvb_reported_length(tvb) - WRITE_RESP_HEAD_LEN
387 || (tvb_reported_length(tvb) >= MIN_READ_REQ && tvb_get_guint8(tvb, 2) == READ_OP)
388 || (tvb_reported_length(tvb) >= MIN_WRITE_REQ && tvb_get_guint8(tvb, 2) == WRITE_OP)) {
390 return tvb_reported_length(tvb);
392 return tvb_get_ntohl(tvb, offset + FIRST_READ_FRAGMENT_LEN) +
393 FIRST_READ_FRAGMENT_LEN + SECOND_READ_FRAGMENT_LEN - LAST_READ_FRAGMENT_LEN;
396 /* This method dissects fully reassembled messages */
398 dissect_hdfsdata_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
402 col_set_str(pinfo->cinfo, COL_PROTOCOL, "HDFSDATA");
403 /* Clear out stuff in the info column */
404 col_set_str(pinfo->cinfo, COL_INFO, "HDFS Data");
408 proto_item *ti = NULL;
409 proto_tree *hdfsdata_tree = NULL;
411 ti = proto_tree_add_item(tree, proto_hdfsdata, tvb, offset, -1, ENC_NA);
412 hdfsdata_tree = proto_item_add_subtree(ti, ett_hdfsdata);
414 /* if only 1 bytes packet must just contain just the pipeline status */
415 if ((tvb_reported_length(tvb)) == PIPELINE_LEN) {
417 /* 1 bytes = pipeline status */
418 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_pipelinestatus, tvb, offset, PIPELINE_LEN, ENC_BIG_ENDIAN);
420 /* if only 2 bytes packet must just contain just a status code */
421 } else if ((tvb_reported_length(tvb)) == STATUS_LEN) {
422 /* 2 bytes = status code */
423 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_status, tvb, offset, STATUS_LEN, ENC_BIG_ENDIAN);
425 /* if it is 4 bytes long it must be a finish request packet */
426 } else if ((tvb_reported_length(tvb)) == FINISH_REQ_LEN) {
427 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_end, tvb, offset, 4, ENC_BIG_ENDIAN);
429 /* read response packet */
430 } else if (tvb_reported_length(tvb) >= READ_RESP_HEAD_LEN && tvb_reported_length(tvb) ==
431 tvb_get_ntohl(tvb, FIRST_READ_FRAGMENT_LEN) +
432 FIRST_READ_FRAGMENT_LEN + SECOND_READ_FRAGMENT_LEN - LAST_READ_FRAGMENT_LEN){
434 dissect_read_response_start(tvb, hdfsdata_tree, offset);
435 offset += FIRST_READ_FRAGMENT_LEN;
437 dissect_read_response(tvb, hdfsdata_tree, offset);
438 offset+= SECOND_READ_FRAGMENT_LEN;
440 /* This message just contains data so we can display it all as one block */
442 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_rest, tvb, offset, (tvb_reported_length(tvb)) - offset, ENC_ASCII|ENC_NA);
446 guint8 op = tvb_get_guint8(tvb, 2);
449 if ((tvb_reported_length(tvb)) >= MIN_READ_REQ && op == READ_OP) {
450 dissect_header(tvb, hdfsdata_tree, &offset);
451 dissect_read_request(tvb, hdfsdata_tree, &offset);
452 dissect_variable_int_string(tvb, hdfsdata_tree, &offset);
453 dissect_access_tokens(tvb, hdfsdata_tree, &offset);
456 } else if ((tvb_reported_length(tvb)) >= MIN_WRITE_REQ && op == WRITE_OP) {
457 dissect_header(tvb, hdfsdata_tree, &offset);
458 dissect_write_request(tvb, hdfsdata_tree, &offset);
459 dissect_variable_int_string(tvb, hdfsdata_tree, &offset);
460 dissect_write_request_end(tvb, hdfsdata_tree, &offset);
461 dissect_access_tokens(tvb, hdfsdata_tree, &offset);
463 /* checksum type = 1 byte. 1 = crc32, 0 = null */
464 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_checksumtype, tvb, offset, 1, ENC_BIG_ENDIAN);
467 /* 4 bytes = chunksize */
468 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_chunksize, tvb, offset, 4, ENC_BIG_ENDIAN);
470 /* write responses store the data length in the first 4 bytes. This length does not
471 include 21 bits of header */
472 } else if (tvb_reported_length(tvb) >= 4 && tvb_get_ntohl(tvb, 0) ==
473 tvb_reported_length(tvb) - WRITE_RESP_HEAD_LEN) {
475 dissect_write_response(tvb, hdfsdata_tree, offset);
478 /* This message contains some form of data that we have not successfully been able to
479 pattern match and catagorize. Display all of it as data. */
480 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_rest, tvb, offset, (tvb_reported_length(tvb)), ENC_ASCII|ENC_NA);
487 dissect_hdfsdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
489 int frame_header_len = 0;
491 gboolean need_reassemble = FALSE;
493 gboolean only_packet = tvb_reported_length(tvb) == 1 || (tvb_reported_length(tvb) == 2 &&
494 tvb_get_ntohs(tvb, 0) == STATUS_SUCCESS);
496 if (tvb_reported_length(tvb) >= 3)
497 op = tvb_get_guint8(tvb, 2);
499 if (!only_packet && tvb_reported_length(tvb) != 4 && !(tvb_reported_length(tvb) >= MIN_READ_REQ && op == READ_OP) &&
500 !(tvb_reported_length(tvb) >= MIN_WRITE_REQ && op == WRITE_OP) && !(tvb_reported_length(tvb) == END_PACKET_LEN &&
501 !tvb_get_ntohl(tvb, 0) && !tvb_get_ntohl(tvb, 4))) {
503 need_reassemble = TRUE;
506 /* setting the header size for the different types of packets */
507 if (only_packet || tvb_reported_length(tvb) == END_PACKET_LEN) {
508 frame_header_len = tvb_reported_length(tvb);
510 } else if (tvb_reported_length(tvb) == FIRST_READ_FRAGMENT_LEN ||(tvb_reported_length(tvb) >= MIN_READ_REQ &&
511 op == READ_OP && !((tvb_reported_length(tvb)) == 2 && !tvb_get_ntohs(tvb, 0)))) {
513 frame_header_len = READ_RESP_HEAD_LEN;
515 } else if (tvb_reported_length(tvb) >= MIN_WRITE_REQ && op == WRITE_OP) {
516 frame_header_len = WRITE_REQ_HEAD_LEN;
519 tcp_dissect_pdus(tvb, pinfo, tree, need_reassemble, frame_header_len, get_hdfsdata_message_len, dissect_hdfsdata_message);
522 /* registers the protcol with the given names */
524 proto_register_hdfsdata(void)
526 static hf_register_info hf[] = {
528 /* list of all options for dissecting the protocol */
530 /*************************************************
532 **************************************************/
533 { &hf_hdfsdata_version,
534 { "HDFSDATA protocol version", "hdfsdata.version",
540 { "HDFSDATA command", "hdfsdata.cmd",
545 { &hf_hdfsdata_blockid,
546 { "HDFSDATA block id", "hdfsdata.blockid",
551 { &hf_hdfsdata_timestamp,
552 { "HDFSDATA timestamp", "hdfsdata.timestamp",
560 { &hf_hdfsdata_startoffset,
561 { "HDFSDATA start offset" , "hdfsdata.startoffset",
566 { &hf_hdfsdata_blocklen,
567 { "HDFSDATA block length", "hdfsdata.blocklen",
575 { &hf_hdfsdata_pipelinenum,
576 { "HDFSDATA number in pipeline", "hdfsdata.pipelinenum",
581 { &hf_hdfsdata_recovery,
582 { "HDFSDATA recovery boolean", "hdfsdata.recovery",
587 { &hf_hdfsdata_sourcenode,
588 { "HDFSDATA source node", "hdfsdata.sourcenode",
593 { &hf_hdfsdata_currentpipeline,
594 { "HDFSDATA current number of nodes in the pipeline", "hdfsdata.currentpipline",
600 { "HDFSDATA node object", "hdfsdata.node",
608 { &hf_hdfsdata_clientlen,
609 { "HDFSDATA client id length", "hdfsdata.clientlen",
614 { &hf_hdfsdata_clientid,
615 { "HDFSDATA client id", "hdfsdata.clientid",
616 FT_STRING, BASE_NONE,
621 { "HDFSDATA end data request", "hdfsdata.end",
626 /*************************************************
628 **************************************************/
629 { &hf_hdfsdata_tokenlen,
630 { "HDFSDATA access token length", "hdfsdata.tokenlen",
635 { &hf_hdfsdata_tokenid,
636 { "HDFSDATA access token ID", "hdfsdata.tokenid",
637 FT_STRING, BASE_NONE,
641 { &hf_hdfsdata_tokenpassword,
642 { "HDFSDATA access token password", "hdfsdata.tokenpassword",
643 FT_STRING, BASE_NONE,
647 { &hf_hdfsdata_tokentype,
648 { "HDFSDATA access token type", "hdfsdata.tokentype",
649 FT_STRING, BASE_NONE,
653 { &hf_hdfsdata_tokenservice,
654 { "HDFSDATA access token service", "hdfsdata.tokenservice",
655 FT_STRING, BASE_NONE,
659 /***********************************************
661 ***********************************************/
662 { &hf_hdfsdata_status,
663 { "HDFSDATA status code", "hdfsdata.status",
668 { &hf_hdfsdata_checksumtype,
669 { "HDFSDATA checksum type", "hdfsdata.checksumtype",
674 { &hf_hdfsdata_chunksize,
675 { "HDFSDATA chunk size", "hdfsdata.chunksize",
680 { &hf_hdfsdata_chunkoffset,
681 { "HDFSDATA chunk offset", "hdfsdata.chunkoffset",
686 /***********************************************
688 ***********************************************/
689 { &hf_hdfsdata_datalength,
690 { "HDFSDATA length of data", "hdfsdata.datalength",
695 { &hf_hdfsdata_inblockoffset,
696 { "HDFSDATA in block offset", "hdfsdata.inblockoffset",
701 { &hf_hdfsdata_seqnum,
702 { "HDFSDATA sequence number", "hdfsdata.seqnum",
708 { "HDFSDATA last packet in block", "hdfsdata.last",
713 { &hf_hdfsdata_datalen,
714 { "HDFSDATA length of data", "hdfsdata.datalen",
719 { &hf_hdfsdata_crc32,
720 { "HDFSDATA crc32 checksum", "hdfsdata.crc32",
725 /***********************************************
727 ***********************************************/
729 { "HDFSDATA data", "hdfsdata.rest",
730 FT_STRING, BASE_NONE,
734 /***********************************************
736 ***********************************************/
737 { &hf_hdfsdata_packetsize,
738 { "HDFSDATA packet size", "hdfsdata.packetsize",
743 { &hf_hdfsdata_chunklength,
744 { "HDFSDATA chunk length", "hdfsdata.chunklength",
749 { &hf_hdfsdata_crc64,
750 { "HDFSDATA crc64 checksum", "hdfsdata.crc64",
755 { &hf_hdfsdata_pipelinestatus,
756 { "HDFSDATA pipeline status", "hdfsdata.pipelinestatus",
763 /* Setup protocol subtree array */
764 static gint *ett[] = {
768 module_t *hdfsdata_module;
770 proto_hdfsdata = proto_register_protocol (
771 "HDFSDATA Protocol", /* name */
772 "HDFSDATA", /* short name */
773 "hdfsdata" /* abbrev */
776 proto_register_field_array(proto_hdfsdata, hf, array_length(hf));
777 proto_register_subtree_array(ett, array_length(ett));
779 hdfsdata_module = prefs_register_protocol(proto_hdfsdata, proto_reg_handoff_hdfsdata);
781 prefs_register_uint_preference(hdfsdata_module,
783 "TCP port for HDFSDATA",
784 "Set the TCP port for HDFSDATA",
788 register_dissector("hdfsdata", dissect_hdfsdata, proto_hdfsdata);
791 /* registers handoff */
793 proto_reg_handoff_hdfsdata(void)
795 static gboolean initialized = FALSE;
796 static dissector_handle_t hdfsdata_handle;
797 static guint saved_tcp_port;
800 hdfsdata_handle = create_dissector_handle(dissect_hdfsdata, proto_hdfsdata);
801 dissector_add_handle("tcp.port", hdfsdata_handle); /* for "decode as" */
803 } else if (saved_tcp_port != 0) {
804 dissector_delete_uint("tcp.port", saved_tcp_port, hdfsdata_handle);
808 dissector_add_uint("tcp.port", tcp_port, hdfsdata_handle);
811 saved_tcp_port = tcp_port;
819 * indent-tabs-mode: nil
822 * ex: set shiftwidth=2 tabstop=8 expandtab:
823 * :indentSize=2:tabSize=8:noTabs=true: