2 * HDFS Protocol and dissectors
4 * Copyright (c) 2011 by Isilon Systems.
6 * Author: Allison Obourn <aobourn@isilon.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1999 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32 #include <epan/packet.h>
33 #include <epan/dissectors/packet-tcp.h>
34 #include <epan/prefs.h>
36 void proto_register_hdfs(void);
37 void proto_reg_handoff_hdfs(void);
40 #define NAMENODE_PORT 8020
43 #define REQUEST_STR "hrpc"
45 #define SEND_DEC 1936027236
46 #define SEND_OFFSET 13
47 #define HEAR_DEC 1214603634
49 #define TBEA_DEC 1952605537
54 #define FIRST_READ_FRAGMENT_LEN 15
55 #define SECOND_READ_FRAGMENT_LEN 29
59 static const int START = 0;
60 static const int AUTHENTICATION = 1;
61 static const int DATA = 2;
64 static guint tcp_port = 0;
66 static int proto_hdfs = -1;
67 static int hf_hdfs_pdu_type = -1;
68 static int hf_hdfs_flags = -1;
69 static int hf_hdfs_sequenceno = -1;
70 static int hf_hdfs_packetno = -1;
71 static int hf_hdfs_authlen = -1;
72 static int hf_hdfs_success = -1;
73 static int hf_hdfs_auth = -1;
74 static int hf_hdfs_len = -1;
75 static int hf_hdfs_strcall = -1;
76 static int hf_hdfs_params = -1;
77 static int hf_hdfs_paramtype = -1;
78 static int hf_hdfs_paramval = -1;
79 static int hf_hdfs_paramvalnum = -1;
80 /* static int hf_hdfs_rest = -1; */
81 static int hf_hdfs_fileperm = -1;
82 static int hf_hdfs_blockloc = -1;
83 static int hf_hdfs_endblockloc = -1;
84 static int hf_hdfs_blockgen = -1;
85 static int hf_hdfs_prover = -1;
86 static int hf_hdfs_objname = -1;
87 static int hf_hdfs_filename = -1;
88 static int hf_hdfs_blockcount = -1;
89 static int hf_hdfs_ownername = -1;
90 static int hf_hdfs_groupname = -1;
91 static int hf_hdfs_namelenone = -1;
92 static int hf_hdfs_namelentwo = -1;
93 static int hf_hdfs_accesstime = -1;
94 static int hf_hdfs_modtime = -1;
95 static int hf_hdfs_blockrep = -1;
96 static int hf_hdfs_isdir = -1;
97 static int hf_hdfs_blocksize = -1;
98 static int hf_hdfs_filelen = -1;
99 static int hf_hdfs_construct = -1;
100 static int hf_hdfs_hostname = -1;
101 static int hf_hdfs_rackloc = -1;
102 static int hf_hdfs_adminstate = -1;
103 static int hf_hdfs_activecon = -1;
104 static int hf_hdfs_lastupdate = -1;
105 static int hf_hdfs_remaining = -1;
106 static int hf_hdfs_dfsused = -1;
107 static int hf_hdfs_capacity = -1;
108 static int hf_hdfs_ipcport = -1;
109 static int hf_hdfs_infoport = -1;
110 static int hf_hdfs_storageid = -1;
111 static int hf_hdfs_datanodeid = -1;
112 static int hf_hdfs_locations = -1;
113 static int hf_hdfs_offset = -1;
114 static int hf_hdfs_corrupt = -1;
115 static int hf_hdfs_identifier = -1;
116 static int hf_hdfs_password = -1;
117 static int hf_hdfs_kind = -1;
118 static int hf_hdfs_service = -1;
120 static gint ett_hdfs = -1;
122 static dissector_handle_t hdfs_handle;
124 /* Parses the parameters of a function.
125 Parses the type length which is always in 2 bytes.
126 Next the type which is the previously found length.
127 If this type is variable length it then reads the length of the data
128 from 2 bytes and then the data.
129 Otherwise reads just the data. */
131 dissect_params (tvbuff_t *tvb, proto_tree *hdfs_tree, guint offset, int params) {
135 const guint8* type_name;
136 for (i = 0; i < params; i++) {
138 /* get length that we just dissected */
139 length = tvb_get_ntohs(tvb, offset);
141 /* 2 bytes = parameter type length */
142 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
145 /* length bytes = parameter type */
146 proto_tree_add_item(hdfs_tree, hf_hdfs_paramtype, tvb, offset, length, ENC_ASCII|ENC_NA);
149 if (offset >= length && (!tvb_memeql(tvb, offset - length, "long", length) || !tvb_memeql(tvb, offset - length, "int", length) ||
150 !tvb_memeql(tvb, offset - length, "short", length) || !tvb_memeql(tvb, offset - length, "char", length) ||
151 !tvb_memeql(tvb, offset - length, "byte", length) || !tvb_memeql(tvb, offset - length, "float", length)
152 || !tvb_memeql(tvb, offset - length, "double", length) || !tvb_memeql(tvb, offset - length, "boolean", length))) {
154 if (!tvb_memeql(tvb, offset - length, "boolean", length)) {
156 } else if (!tvb_memeql(tvb, offset - length, "short", length)) {
159 length = sizeof(type_name);
162 proto_tree_add_item(hdfs_tree, hf_hdfs_paramvalnum, tvb, offset, length, ENC_BIG_ENDIAN);
167 length = tvb_get_ntohs(tvb, offset);
169 /* 2 bytes = parameter value length */
170 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
173 proto_tree_add_item(hdfs_tree, hf_hdfs_paramval, tvb, offset, length, ENC_ASCII|ENC_NA);
176 if (!tvb_memeql(tvb, offset - length, "org.apache.hadoop.fs.permission.FsPermission", length)) {
177 proto_tree_add_item(hdfs_tree, hf_hdfs_fileperm, tvb, offset, 2, ENC_BIG_ENDIAN);
185 /* Dissects a data packet of the form:
186 method name length : 2B
187 method name : above value
188 number of parameters : 4B
189 -- list of parameters the length of above --
190 parameter type length : 2B
191 parameter type : above value
192 -- if the type is variable size --
193 parameter value length : 2B
194 parameter value : above value
196 parameter value : length of the type */
198 dissect_data (tvbuff_t *tvb, proto_tree *hdfs_tree, guint offset) {
203 length = tvb_get_ntohs(tvb, offset);
205 /* method name length = 2 B */
206 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
209 /* length bytes = method name */
210 proto_tree_add_item(hdfs_tree, hf_hdfs_strcall, tvb, offset, length, ENC_ASCII|ENC_NA);
213 /* we only want to parse the packet if it is not a heartbeat (random looking numbers are the decimal
214 representation of sendHeartbeat */
215 if (!(tvb_get_ntohl(tvb, offset - SEND_OFFSET) == SEND_DEC && tvb_get_ntohl(tvb, offset - HEAR_OFFSET) == HEAR_DEC &&
216 tvb_get_ntohl(tvb, offset - TBEA_OFFSET) == TBEA_DEC && tvb_get_guint8(tvb, offset - T_OFFSET) == T_DEC)) {
218 /* get number of params */
219 params = tvb_get_ntohl(tvb, offset);
221 /* 4 bytes = # of parameters */
222 proto_tree_add_item(hdfs_tree, hf_hdfs_params, tvb, offset, 4, ENC_BIG_ENDIAN);
225 /* go through all params and dissect their type length, type, value length and value */
226 dissect_params (tvb, hdfs_tree, offset, params);
231 response to a get protocol version message
232 contains a type length, type name and the value
235 dissect_resp_long (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
236 /* get length that we just dissected */
237 int length = tvb_get_ntohs(tvb, offset);
239 /* 2 bytes = parameter type length */
240 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
243 /* length bytes = parameter type */
244 proto_tree_add_item(hdfs_tree, hf_hdfs_paramtype, tvb, offset, length, ENC_ASCII|ENC_NA);
248 proto_tree_add_item(hdfs_tree, hf_hdfs_prover, tvb, offset, 8, ENC_BIG_ENDIAN);
255 Response to a file status message
258 dissect_resp_filestatus (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
263 proto_tree_add_item(hdfs_tree, hf_hdfs_fileperm, tvb, offset, 2, ENC_BIG_ENDIAN);
267 length = tvb_get_ntohs(tvb, offset);
269 /* 2 bytes = file name length */
270 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
274 proto_tree_add_item(hdfs_tree, hf_hdfs_filename, tvb, offset, length, ENC_ASCII|ENC_NA);
278 /* 8 file size / end location */
279 proto_tree_add_item(hdfs_tree, hf_hdfs_endblockloc, tvb, offset, 8, ENC_BIG_ENDIAN);
283 proto_tree_add_item(hdfs_tree, hf_hdfs_isdir, tvb, offset, 1, ENC_BIG_ENDIAN);
286 /* block replication factor */
287 proto_tree_add_item(hdfs_tree, hf_hdfs_blockrep, tvb, offset, 2, ENC_BIG_ENDIAN);
291 proto_tree_add_item(hdfs_tree, hf_hdfs_blocksize, tvb, offset, 8, ENC_BIG_ENDIAN);
295 proto_tree_add_item(hdfs_tree, hf_hdfs_modtime, tvb, offset, 8, ENC_BIG_ENDIAN);
299 proto_tree_add_item(hdfs_tree, hf_hdfs_accesstime, tvb, offset, 8, ENC_BIG_ENDIAN);
302 /* 2 of file permissions */
303 proto_tree_add_item(hdfs_tree, hf_hdfs_fileperm, tvb, offset, 2, ENC_BIG_ENDIAN);
308 length = tvb_get_guint8 (tvb, offset);
310 /* owner name length */
311 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
315 proto_tree_add_item(hdfs_tree, hf_hdfs_ownername, tvb, offset, length, ENC_ASCII|ENC_NA);
319 length = tvb_get_guint8 (tvb, offset);
321 /* group name length */
322 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
326 proto_tree_add_item(hdfs_tree, hf_hdfs_groupname, tvb, offset, length, ENC_ASCII|ENC_NA);
334 Response to the get block info message
335 parses the sent back information about each blcok
338 dissect_block_info (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
342 length = tvb_get_guint8(tvb, offset);
344 /* identifier length */
345 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
349 proto_tree_add_item(hdfs_tree, hf_hdfs_identifier, tvb, offset, length, ENC_ASCII|ENC_NA);
352 length = tvb_get_guint8(tvb, offset);
354 /* password length */
355 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
359 proto_tree_add_item(hdfs_tree, hf_hdfs_password, tvb, offset, length, ENC_ASCII|ENC_NA);
362 length = tvb_get_guint8(tvb, offset);
365 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
369 proto_tree_add_item(hdfs_tree, hf_hdfs_kind, tvb, offset, length, ENC_ASCII|ENC_NA);
372 length = tvb_get_guint8(tvb, offset);
375 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
379 proto_tree_add_item(hdfs_tree, hf_hdfs_service, tvb, offset, length, ENC_ASCII|ENC_NA);
383 proto_tree_add_item(hdfs_tree, hf_hdfs_corrupt, tvb, offset, 1, ENC_BIG_ENDIAN);
387 proto_tree_add_item(hdfs_tree, hf_hdfs_offset, tvb, offset, 8, ENC_BIG_ENDIAN);
391 /* block info section */
394 proto_tree_add_item(hdfs_tree, hf_hdfs_blockloc, tvb, offset, 8, ENC_BIG_ENDIAN);
398 proto_tree_add_item(hdfs_tree, hf_hdfs_blocksize, tvb, offset, 8, ENC_BIG_ENDIAN);
402 proto_tree_add_item(hdfs_tree, hf_hdfs_blockgen, tvb, offset, 8, ENC_BIG_ENDIAN);
406 proto_tree_add_item(hdfs_tree, hf_hdfs_locations, tvb, offset, 4, ENC_BIG_ENDIAN);
410 /* address section */
413 length = tvb_get_ntohs(tvb, offset);
416 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
420 proto_tree_add_item(hdfs_tree, hf_hdfs_datanodeid, tvb, offset, length, ENC_ASCII|ENC_NA);
423 length = tvb_get_ntohs(tvb, offset);
426 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
430 proto_tree_add_item(hdfs_tree, hf_hdfs_storageid, tvb, offset, length, ENC_ASCII|ENC_NA);
434 proto_tree_add_item(hdfs_tree, hf_hdfs_infoport, tvb, offset, 2, ENC_BIG_ENDIAN);
438 /* default name node port */
439 proto_tree_add_item(hdfs_tree, hf_hdfs_ipcport, tvb, offset, 2, ENC_BIG_ENDIAN);
443 proto_tree_add_item(hdfs_tree, hf_hdfs_capacity, tvb, offset, 8, ENC_BIG_ENDIAN);
447 proto_tree_add_item(hdfs_tree, hf_hdfs_dfsused, tvb, offset, 8, ENC_BIG_ENDIAN);
451 proto_tree_add_item(hdfs_tree, hf_hdfs_remaining, tvb, offset, 8, ENC_BIG_ENDIAN);
455 proto_tree_add_item(hdfs_tree, hf_hdfs_lastupdate, tvb, offset, 8, ENC_BIG_ENDIAN);
458 /* num active connections */
459 proto_tree_add_item(hdfs_tree, hf_hdfs_activecon, tvb, offset, 4, ENC_BIG_ENDIAN);
463 length = tvb_get_guint8(tvb, offset);
465 /* location rack length */
466 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
470 proto_tree_add_item(hdfs_tree, hf_hdfs_rackloc, tvb, offset, length, ENC_ASCII|ENC_NA);
473 length = tvb_get_guint8(tvb, offset);
475 /* hostname length */
476 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
480 proto_tree_add_item(hdfs_tree, hf_hdfs_hostname, tvb, offset, length, ENC_ASCII|ENC_NA);
483 length = tvb_get_guint8(tvb, offset);
485 /* admin state length */
486 proto_tree_add_item(hdfs_tree, hf_hdfs_namelenone, tvb, offset, 1, ENC_BIG_ENDIAN);
490 proto_tree_add_item(hdfs_tree, hf_hdfs_adminstate, tvb, offset, length, ENC_ASCII|ENC_NA);
500 dissects the response from get block info.
503 dissect_resp_locatedblocks (tvbuff_t *tvb, proto_tree *hdfs_tree, int offset) {
506 /* file length = 8 */
507 proto_tree_add_item(hdfs_tree, hf_hdfs_filelen, tvb, offset, 8, ENC_BIG_ENDIAN);
510 /* under construction = 1 */
511 proto_tree_add_item(hdfs_tree, hf_hdfs_construct, tvb, offset, 1, ENC_BIG_ENDIAN);
514 /* number of blocks */
515 proto_tree_add_item(hdfs_tree, hf_hdfs_blockcount, tvb, offset, 4, ENC_BIG_ENDIAN);
518 /* dissect info for each block */
519 while (tvb_reported_length(tvb) - offset > 0) {
520 offset = dissect_block_info (tvb, hdfs_tree, offset);
527 dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
534 col_set_str(pinfo->cinfo, COL_PROTOCOL, "HDFS");
535 /* Clear out stuff in the info column */
536 col_clear(pinfo->cinfo,COL_INFO);
540 proto_item *ti = NULL;
541 proto_tree *hdfs_tree = NULL;
543 ti = proto_tree_add_item(tree, proto_hdfs, tvb, 0, -1, ENC_NA);
544 hdfs_tree = proto_item_add_subtree(ti, ett_hdfs);
547 if (pinfo->srcport == tcp_port) {
548 /* 4 bytes = sequence number */
549 proto_tree_add_item(hdfs_tree, hf_hdfs_packetno, tvb, offset, 4, ENC_BIG_ENDIAN);
552 /* 4 bytes = status -> 0000 = success, 0001 = error, ffff = fatal */
553 success = tvb_get_ntohl(tvb, offset);
554 proto_tree_add_item(hdfs_tree, hf_hdfs_success, tvb, offset, 4, ENC_BIG_ENDIAN);
561 if (!tvb_memeql(tvb, offset + 2, "long", 4)) {
562 dissect_resp_long (tvb, hdfs_tree, offset);
566 /* name length = 2 B */
567 length = tvb_get_ntohs(tvb, offset);
568 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
571 /* length bytes = method name */
572 proto_tree_add_item(hdfs_tree, hf_hdfs_objname, tvb, offset, length, ENC_ASCII|ENC_NA);
575 /* get length that we just dissected */
576 length = tvb_get_ntohs(tvb, offset);
578 /* 2 bytes = objects length */
579 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
582 /* length bytes = object name */
583 proto_tree_add_item(hdfs_tree, hf_hdfs_objname, tvb, offset, length, ENC_ASCII|ENC_NA);
586 /* responses about block location info */
587 if (!tvb_memeql(tvb, offset - length, "org.apache.hadoop.hdfs.protocol.LocatedBlocks", length)) {
588 dissect_resp_locatedblocks (tvb, hdfs_tree, offset);
590 /* responses about file statuses */
591 } else if (!tvb_memeql(tvb, offset - length, "org.apache.hadoop.hdfs.protocol.HdfsFileStatus", length)) {
592 dissect_resp_filestatus (tvb, hdfs_tree, offset);
596 length = tvb_get_ntohs(tvb, offset);
598 /* 2 bytes = parameter value length */
599 proto_tree_add_item(hdfs_tree, hf_hdfs_namelentwo, tvb, offset, 2, ENC_BIG_ENDIAN);
602 /* the value of the parameter */
603 proto_tree_add_item(hdfs_tree, hf_hdfs_paramval, tvb, offset, length, ENC_ASCII|ENC_NA);
604 /*offset += length;*/
608 /* Request to namenode */
611 /* check the packet length */
612 guint auth = tvb_get_ntohl(tvb, offset);
614 /* first setup packet starts with "hrpc" */
615 if (!tvb_memeql(tvb, offset, REQUEST_STR, sizeof(REQUEST_STR) - 1)) {
617 proto_tree_add_item(hdfs_tree, hf_hdfs_sequenceno, tvb, offset, sizeof(REQUEST_STR) - 1, ENC_ASCII|ENC_NA);
618 offset += (int)sizeof(REQUEST_STR) - 1;
620 proto_tree_add_item(hdfs_tree, hf_hdfs_pdu_type, tvb, offset, 1, ENC_BIG_ENDIAN);
623 proto_tree_add_item(hdfs_tree, hf_hdfs_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
627 /* second authentication packet */
628 if (auth + 4 != tvb_reported_length(tvb)) {
630 /* authentication length (read out of first 4 bytes) */
631 length = tvb_get_ntohl(tvb, offset);
632 proto_tree_add_item(hdfs_tree, hf_hdfs_authlen, tvb, offset, 4, ENC_ASCII|ENC_NA);
635 /* authentication (length the number we just got) */
636 proto_tree_add_item(hdfs_tree, hf_hdfs_auth, tvb, offset, length, ENC_ASCII|ENC_NA);
642 /* 4 bytes = length */
643 proto_tree_add_item(hdfs_tree, hf_hdfs_len, tvb, offset, 4, ENC_BIG_ENDIAN);
646 /* 4 bytes = sequence number */
647 proto_tree_add_item(hdfs_tree, hf_hdfs_packetno, tvb, offset, 4, ENC_BIG_ENDIAN);
650 /* dissect packet data */
651 dissect_data (tvb, hdfs_tree, offset);
655 return tvb_length(tvb);
658 /* determine PDU length of protocol */
659 static guint get_hdfs_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset _U_)
661 int len = tvb_reported_length(tvb);
663 if (tvb_reported_length(tvb) == 1448 || tvb_reported_length(tvb) == 1321) {
664 len = 150 * tvb_get_ntohs(tvb, 113) + 115 ;
672 dissect_hdfs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
674 int frame_header_len = 0;
675 gboolean need_reassemble = FALSE;
677 frame_header_len = tvb_reported_length(tvb);
679 if (frame_header_len == 1448 || frame_header_len == 1321) {
680 need_reassemble = TRUE;
683 tcp_dissect_pdus(tvb, pinfo, tree, need_reassemble, frame_header_len, get_hdfs_message_len, dissect_hdfs_message, data);
684 return tvb_length(tvb);
687 /* registers the protcol with the given names */
689 proto_register_hdfs(void)
692 static hf_register_info hf[] = {
694 /* list of all options for dissecting the protocol */
696 /*************************************************
698 **************************************************/
699 { &hf_hdfs_sequenceno,
700 { "HDFS protocol type", "hdfs.type",
701 FT_STRING, BASE_NONE,
706 { "HDFS protocol version", "hdfs.version",
712 { "HDFS authentication type", "hdfs.auth_type",
717 /***********************************************
718 Authentication packet
719 ***********************************************/
721 { "HDFS authentication length", "hdfs.authlen",
722 FT_STRING, BASE_NONE,
727 { "HDFS authorization bits", "hdfs.auth",
728 FT_STRING, BASE_NONE,
732 /**********************************************
734 **********************************************/
736 { "HDFS packet number", "hdfs.seqno",
742 { "HDFS success", "hdfs.success",
748 { "HDFS method name", "hdfs.strcall",
749 FT_STRING, BASE_NONE,
755 { "HDFS value", "hdfs.rest",
756 FT_STRING, BASE_NONE,
762 { "HDFS block location", "hdfs.blockloc",
767 { &hf_hdfs_blocksize,
768 { "HDFS block size", "hdfs.blocksize",
773 { &hf_hdfs_endblockloc,
774 { "HDFS file size", "hdfs.endblockloc",
780 { "HDFS block gen", "hdfs.blockgen",
786 { "HDFS protocol version", "hdfs.prover",
792 { "HDFS object name", "hdfs.objname",
793 FT_STRING, BASE_NONE,
798 { "HDFS file name", "hdfs.filename",
799 FT_STRING, BASE_NONE,
803 { &hf_hdfs_blockcount,
804 { "HDFS block count", "hdfs.blockcount",
809 { &hf_hdfs_ownername,
810 { "HDFS owner name", "hdfs.ownername",
811 FT_STRING, BASE_NONE,
815 { &hf_hdfs_groupname,
816 { "HDFS group name", "hdfs.groupname",
817 FT_STRING, BASE_NONE,
821 { &hf_hdfs_accesstime,
822 { "HDFS access time", "hdfs.accesstime",
828 { "HDFS modified time", "hdfs.modtime",
834 { "HDFS block replication factor", "hdfs.blockrep",
840 { "HDFS is directory", "hdfs.isdir",
846 { "HDFS file length", "hdfs.filelen",
851 { &hf_hdfs_construct,
852 { "HDFS under construction", "hdfs.construct",
858 { "HDFS rack location", "hdfs.rackloc",
859 FT_STRING, BASE_NONE,
863 { &hf_hdfs_adminstate,
864 { "HDFS admin state", "hdfs.adminstate",
865 FT_STRING, BASE_NONE,
870 { "HDFS hostname", "hdfs.hostname",
871 FT_STRING, BASE_NONE,
877 { &hf_hdfs_namelenone,
878 { "HDFS name length", "hdfs.namelenone",
883 { &hf_hdfs_namelentwo,
884 { "HDFS name length", "hdfs.namelentwo",
891 /***************************************
893 ***************************************/
894 { &hf_hdfs_activecon,
895 { "HDFS active connections", "hdfs.activecon",
900 { &hf_hdfs_lastupdate,
901 { "HDFS lastupdate", "hdfs.lastupdate",
906 { &hf_hdfs_remaining,
907 { "HDFS remaining", "hdfs.remaining",
913 { "HDFS dfs used", "hdfs.dfsused",
919 { "HDFS capacity", "hdfs.capacity",
925 { "HDFS ipcport", "hdfs.ipcport",
931 { "HDFS info port", "hdfs.infoport",
936 { &hf_hdfs_storageid,
937 { "HDFS storage id", "hdfs.storageid",
938 FT_STRING, BASE_NONE,
942 { &hf_hdfs_datanodeid,
943 { "HDFS datanodeid", "hdfs.datanodeid",
944 FT_STRING, BASE_NONE,
948 { &hf_hdfs_locations,
949 { "HDFS locations", "hdfs.locations",
955 { &hf_hdfs_identifier,
956 { "HDFS locations", "hdfs.identifier",
957 FT_STRING, BASE_NONE,
962 { "HDFS password", "hdfs.password",
963 FT_STRING, BASE_NONE,
968 { "HDFS kind", "hdfs.kind",
969 FT_STRING, BASE_NONE,
974 { "HDFS locations", "hdfs.service",
975 FT_STRING, BASE_NONE,
980 { "HDFS corrupt", "hdfs.corrupt",
986 { "HDFS offset", "hdfs.offset",
993 /***********************************************
995 ***********************************************/
997 { "HDFS length", "hdfs.len",
1002 /* packet number, same as in response
1003 method name length, same as in response
1004 string call, same as in response */
1006 { "HDFS number of parameters", "hdfs.params",
1007 FT_UINT32, BASE_DEC,
1011 { &hf_hdfs_paramtype,
1012 { "HDFS parameter type", "hdfs.paramtype",
1013 FT_STRING, BASE_NONE,
1017 { &hf_hdfs_paramval,
1018 { "HDFS parameter value", "hdfs.paramval",
1019 FT_STRING, BASE_NONE,
1023 /* param value that is displayed as a number not a string */
1024 { &hf_hdfs_paramvalnum,
1025 { "HDFS parameter value", "hdfs.paramvalnum",
1030 { &hf_hdfs_fileperm,
1031 { "HDFS File permission", "hdfs.fileperm",
1039 /* Setup protocol subtree array */
1040 static gint *ett[] = {
1044 module_t *hdfs_module;
1046 proto_hdfs = proto_register_protocol (
1047 "HDFS Protocol", /* name */
1048 "HDFS", /* short name */
1052 proto_register_field_array(proto_hdfs, hf, array_length(hf));
1053 proto_register_subtree_array(ett, array_length(ett));
1055 hdfs_module = prefs_register_protocol(proto_hdfs, proto_reg_handoff_hdfs);
1057 prefs_register_uint_preference(hdfs_module,
1059 "TCP port for HDFS",
1060 "Set the TCP port for HDFS",
1064 hdfs_handle = new_register_dissector("hdfs", dissect_hdfs, proto_hdfs);
1067 /* registers handoff */
1069 proto_reg_handoff_hdfs(void)
1071 static gboolean initialized = FALSE;
1072 static guint saved_tcp_port;
1075 dissector_add_handle("tcp.port", hdfs_handle); /* for "decode as" */
1077 } else if (saved_tcp_port != 0) {
1078 dissector_delete_uint("tcp.port", saved_tcp_port, hdfs_handle);
1081 if (tcp_port != 0) {
1082 dissector_add_uint("tcp.port", tcp_port, hdfs_handle);
1085 saved_tcp_port = tcp_port;
1093 * indent-tabs-mode: nil
1096 * ex: set shiftwidth=4 tabstop=8 expandtab:
1097 * :indentSize=4:tabSize=8:noTabs=true: