Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-hdfsdata.c
blobd4424980a369f08ff9b72d2eeebab96dd53a3d81
1 /* packet-hdfsdata.c
2 * HDFS data 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 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include "config.h"
18 #include <epan/packet.h>
19 #include "packet-tcp.h"
21 void proto_register_hdfsdata(void);
22 void proto_reg_handoff_hdfsdata(void);
24 #if 0
25 #define NAMENODE_PORT 8020
26 #define DATANODE_PORT 8021
27 #endif
29 #define FIRST_READ_FRAGMENT_LEN 15
30 #define SECOND_READ_FRAGMENT_LEN 29
31 #define LAST_READ_FRAGMENT_LEN 4
32 #define WRITE_OP 80
33 #define READ_OP 81
34 #define MIN_WRITE_REQ 35
35 #define MIN_READ_REQ 36
37 #define STATUS_SUCCESS 6
38 #define PIPELINE_LEN 1
39 #define STATUS_LEN 2
40 #define FINISH_REQ_LEN 4
41 #define END_PACKET_LEN 8
42 #define READ_RESP_HEAD_LEN 19
43 #define WRITE_RESP_HEAD_LEN 21
44 #define WRITE_REQ_HEAD_LEN 7
46 #define CRC 1
47 #define CRC_SIZE 8.0
48 #define CHUNKSIZE_START 3
51 #if 0
52 static const int RESPONSE_HEADER = 1;
53 static const int RESPONSE_METADATA = 2;
54 static const int RESPONSE_DATA = 3;
55 #endif
57 static int proto_hdfsdata;
58 static int hf_hdfsdata_version;
59 static int hf_hdfsdata_cmd;
60 static int hf_hdfsdata_blockid;
61 static int hf_hdfsdata_timestamp;
62 static int hf_hdfsdata_startoffset;
63 static int hf_hdfsdata_blocklen;
64 static int hf_hdfsdata_clientlen;
65 static int hf_hdfsdata_clientid;
66 static int hf_hdfsdata_tokenlen;
67 static int hf_hdfsdata_tokenid;
68 static int hf_hdfsdata_tokenpassword;
69 static int hf_hdfsdata_tokentype;
70 static int hf_hdfsdata_tokenservice;
71 static int hf_hdfsdata_status;
72 static int hf_hdfsdata_checksumtype;
73 static int hf_hdfsdata_chunksize;
74 static int hf_hdfsdata_chunkoffset;
75 static int hf_hdfsdata_datalength;
76 static int hf_hdfsdata_inblockoffset;
77 static int hf_hdfsdata_seqnum;
78 static int hf_hdfsdata_last;
79 static int hf_hdfsdata_crc32;
80 static int hf_hdfsdata_datalen;
81 static int hf_hdfsdata_rest;
82 static int hf_hdfsdata_end;
83 static int hf_hdfsdata_packetsize;
84 static int hf_hdfsdata_chunklength;
85 static int hf_hdfsdata_crc64;
86 static int hf_hdfsdata_pipelinestatus;
88 static int hf_hdfsdata_pipelinenum;
89 static int hf_hdfsdata_recovery;
90 static int hf_hdfsdata_sourcenode;
91 static int hf_hdfsdata_currentpipeline;
92 static int hf_hdfsdata_node;
94 static int ett_hdfsdata;
96 static dissector_handle_t hdfsdata_handle;
98 /* Taken from HDFS
99 Parse the first byte of a vint/vlong to determine the number of bytes
100 value is the first byte of the vint/vlong
101 returns the total number of bytes (1 to 9) */
102 static int
103 decode_vint_size (int8_t value) {
104 if (value >= -112) {
105 return 1;
106 } else if (value < -120) {
107 return -119 - value;
109 return -111 - value;
112 /* Taken from HDFS
113 converts a variable length number into a long and discovers how many bytes it is
114 returns the decoded number */
115 static unsigned
116 dissect_variable_length_long (tvbuff_t *tvb, proto_tree *hdfsdata_tree, int* offset)
118 int byte_count = 1;
119 int idx = 0;
120 unsigned i = 0;
121 int8_t first_byte = tvb_get_uint8(tvb, *offset);
122 unsigned size = 0;
124 int len = decode_vint_size(first_byte);
125 if (len == 1) {
126 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_clientlen, tvb, *offset, byte_count, ENC_BIG_ENDIAN);
127 *offset = (*offset) + byte_count;
128 return first_byte;
131 for (idx = 0; idx < len-1; idx++) {
132 char b = tvb_get_uint8(tvb, *offset + byte_count);
133 byte_count++;
134 i = i << 8;
135 i = i | (b & 0xFF);
137 size = ((first_byte < -120 || (first_byte >= -112 && first_byte < 0)) ? (i ^ 0xFFFFFFFF) : i);
138 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_clientlen, tvb, *offset, byte_count, ENC_BIG_ENDIAN);
139 *offset = (*offset) + byte_count;
141 return size;
144 /* dissects a variable length int and then using its value dissects the following string */
145 static void
146 dissect_variable_int_string(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
148 /* Get the variable length int that represents the length of the next field */
149 int len = dissect_variable_length_long (tvb, hdfsdata_tree, offset);
151 /* client id = amount of bytes in previous */
152 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_clientid, tvb, *offset, len, ENC_ASCII);
153 *offset += len;
156 /* dissects the access tokens that appear at the end of requests.
157 tokens: id, password, kind, service */
158 static void
159 dissect_access_tokens(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
161 int len = 0;
163 len = tvb_get_uint8(tvb, *offset);
164 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenlen, tvb, *offset, 1, ENC_BIG_ENDIAN);
165 *offset += 1;
167 /* token id = amount of bytes in previous */
168 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenid, tvb, *offset, len, ENC_ASCII);
169 *offset += len;
171 len = tvb_get_uint8(tvb, *offset);
172 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenlen, tvb, *offset, 1, ENC_BIG_ENDIAN);
173 *offset += 1;
175 /* token password = amount of bytes in previous */
176 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenpassword, tvb, *offset, len, ENC_ASCII);
177 *offset += len;
179 len = tvb_get_uint8(tvb, *offset);
180 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenlen, tvb, *offset, 1, ENC_BIG_ENDIAN);
181 *offset += 1;
183 /* token type = amount of bytes in previous */
184 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokentype, tvb, *offset, len, ENC_ASCII);
185 *offset += len;
187 len = tvb_get_uint8(tvb, *offset);
188 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenlen, tvb, *offset, 1, ENC_BIG_ENDIAN);
189 *offset += 1;
191 /* token service = amount of bytes in previous; */
192 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_tokenservice, tvb, *offset, len, ENC_ASCII);
193 *offset += len;
196 /* handles parsing read response packets */
197 static void
198 dissect_read_response(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset)
200 int len = 0;
201 uint32_t chunksize;
203 /* 4 bytes = data length */
204 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_datalength, tvb, offset, 4, ENC_BIG_ENDIAN);
205 offset += 4;
207 /* 8 bytes = in block offset */
208 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_inblockoffset, tvb, offset, 8, ENC_BIG_ENDIAN);
209 offset += 8;
211 /* 8 bytes = sequence number */
212 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_seqnum, tvb, offset, 8, ENC_BIG_ENDIAN);
213 offset += 8;
215 /* 1 byte = last packet in block */
216 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_last, tvb, offset, 1, ENC_BIG_ENDIAN);
217 offset += 1;
219 /* 4 byte = length of data */
220 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_datalen, tvb, offset, 4, ENC_BIG_ENDIAN);
221 offset += 4;
223 /* if there is a crc checksum it is 8* the length of the data * checksum size / chunksize */
224 chunksize = tvb_get_ntohl(tvb, CHUNKSIZE_START);
225 if (chunksize == 0) /* let's not divide by zero */
226 return;
227 if (tvb_get_uint8(tvb, 2) == CRC) {
228 len = (int)(CRC_SIZE * tvb_get_ntohl(tvb, offset - 4) *
229 tvb_get_ntohl(tvb, offset - 8) / chunksize);
232 /* the rest of bytes (usually 4) = crc32 code */
233 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_crc32, tvb, offset, len, ENC_BIG_ENDIAN);
234 /* offset += len; */
237 /* dissects the first packet of the read response */
238 static void
239 dissect_read_response_start(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset) {
240 /* 2 bytes = status code */
241 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_status, tvb, offset, 2, ENC_BIG_ENDIAN);
242 offset += 2;
244 /* checksum type = 1 byte. 1 = crc32, 0 = null */
245 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_checksumtype, tvb, offset, 1, ENC_BIG_ENDIAN);
246 offset += 1;
248 /* 4 bytes = chunksize */
249 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_chunksize, tvb, offset, 4, ENC_BIG_ENDIAN);
250 offset += 4;
252 /* 8 bytes = chunk offset */
253 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_chunkoffset, tvb, offset, 8, ENC_BIG_ENDIAN);
254 /* offset += 8; */
257 /* dissects the fields specific to a read request */
258 static void
259 dissect_read_request(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
262 /* 8 bytes = start offset */
263 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_startoffset, tvb, *offset, 8, ENC_BIG_ENDIAN);
264 *offset += 8;
266 /* 8 bytes = block length */
267 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_blocklen, tvb, *offset, 8, ENC_BIG_ENDIAN);
268 *offset += 8;
272 /* dissects the fields specific to a write request */
273 static void
274 dissect_write_request(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
276 /* 4 bytes = number of nodes in pipeline */
277 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_pipelinenum, tvb, *offset, 4, ENC_BIG_ENDIAN);
278 *offset += 4;
280 /* 1 bytes = recovery boolean */
281 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_recovery, tvb, *offset, 1, ENC_BIG_ENDIAN);
282 *offset += 1;
285 /* dissects the fields specific to a write request */
286 static void
287 dissect_write_request_end(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int *offset)
289 int i = 0;
290 int len = 0;
292 /* 1 bytes = source node */
293 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_sourcenode, tvb, *offset, 1, ENC_BIG_ENDIAN);
294 *offset += 1;
296 /* 4 bytes = number of nodes currently in the pipeline (usually just -1 of before) */
297 len = tvb_get_ntohl(tvb, *offset);
298 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_currentpipeline, tvb, *offset, 4, ENC_BIG_ENDIAN);
299 *offset += 4;
301 /* variable length sequence of node objects */
302 for (i = 0; i < len; i++) {
303 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_node, tvb, *offset, 4, ENC_BIG_ENDIAN);
304 *offset += 4;
308 /* dissects the beginning of the read and write request messages */
309 static int
310 dissect_header(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int* offset){
312 int command = 0;
314 /* 2 bytes = protocol version */
315 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_version, tvb, *offset, 2, ENC_BIG_ENDIAN);
316 *offset += 2;
318 /* 1 byte = command */
319 command = tvb_get_uint8(tvb, *offset);
320 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_cmd, tvb, *offset, 1, ENC_BIG_ENDIAN);
321 *offset += 1;
323 /* 8 bytes = block id */
324 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_blockid, tvb, *offset, 8, ENC_BIG_ENDIAN);
325 *offset += 8;
327 /* 8 bytes = timestamp */
328 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_timestamp, tvb, *offset, 8, ENC_BIG_ENDIAN);
329 *offset += 8;
331 return command;
334 /* decodes the write response messages */
335 static void
336 dissect_write_response(tvbuff_t *tvb, proto_tree *hdfsdata_tree, int offset)
338 /* 4 bytes = packetsize */
339 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_packetsize, tvb, offset, 4, ENC_BIG_ENDIAN);
340 offset += 4;
342 /* 8 bytes = offset in block */
343 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_startoffset, tvb, offset, 8, ENC_BIG_ENDIAN);
344 offset += 8;
346 /* 8 bytes = sequence number */
347 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_seqnum, tvb, offset, 8, ENC_BIG_ENDIAN);
348 offset += 8;
350 /* 1 bytes = last packet */
351 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_last, tvb, offset, 1, ENC_BIG_ENDIAN);
352 offset += 1;
354 /* 4 bytes = chunk length */
355 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_chunklength, tvb, offset, 4, ENC_BIG_ENDIAN);
356 offset += 4;
358 /* 8 bytes = crc code */
359 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_crc64, tvb, offset, 8, ENC_BIG_ENDIAN);
360 offset += 8;
362 /* add the rest -> RESPONSE_DATA */
363 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_rest, tvb, offset, (tvb_reported_length(tvb)) - offset, ENC_ASCII);
364 /* offset += (tvb_reported_length(tvb)); */
367 /* determine PDU length of protocol */
368 static unsigned
369 get_hdfsdata_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
371 /* get data packet len, add FIRST_READ_FRAGMENT_LEN for first fragment (before len),
372 SECOND_READ_FRAGMENT_LEN for second fragment (incl len), subtract 4 for length itself. */
374 if (tvb_reported_length(tvb) <= 4 || tvb_reported_length(tvb) == END_PACKET_LEN
375 || tvb_get_ntohl(tvb, 0) == tvb_reported_length(tvb) - WRITE_RESP_HEAD_LEN
376 || (tvb_reported_length(tvb) >= MIN_READ_REQ && tvb_get_uint8(tvb, 2) == READ_OP)
377 || (tvb_reported_length(tvb) >= MIN_WRITE_REQ && tvb_get_uint8(tvb, 2) == WRITE_OP)) {
379 return tvb_reported_length(tvb);
381 return tvb_get_ntohl(tvb, offset + FIRST_READ_FRAGMENT_LEN) +
382 FIRST_READ_FRAGMENT_LEN + SECOND_READ_FRAGMENT_LEN - LAST_READ_FRAGMENT_LEN;
385 /* This method dissects fully reassembled messages */
386 static int
387 dissect_hdfsdata_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
389 int offset = 0;
391 col_set_str(pinfo->cinfo, COL_PROTOCOL, "HDFSDATA");
392 /* Clear out stuff in the info column */
393 col_set_str(pinfo->cinfo, COL_INFO, "HDFS Data");
396 if (tree) {
397 proto_item *ti = NULL;
398 proto_tree *hdfsdata_tree = NULL;
400 ti = proto_tree_add_item(tree, proto_hdfsdata, tvb, offset, -1, ENC_NA);
401 hdfsdata_tree = proto_item_add_subtree(ti, ett_hdfsdata);
403 /* if only 1 bytes packet must just contain just the pipeline status */
404 if ((tvb_reported_length(tvb)) == PIPELINE_LEN) {
406 /* 1 bytes = pipeline status */
407 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_pipelinestatus, tvb, offset, PIPELINE_LEN, ENC_BIG_ENDIAN);
409 /* if only 2 bytes packet must just contain just a status code */
410 } else if ((tvb_reported_length(tvb)) == STATUS_LEN) {
411 /* 2 bytes = status code */
412 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_status, tvb, offset, STATUS_LEN, ENC_BIG_ENDIAN);
414 /* if it is 4 bytes long it must be a finish request packet */
415 } else if ((tvb_reported_length(tvb)) == FINISH_REQ_LEN) {
416 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_end, tvb, offset, 4, ENC_BIG_ENDIAN);
418 /* read response packet */
419 } else if (tvb_reported_length(tvb) >= READ_RESP_HEAD_LEN && tvb_reported_length(tvb) ==
420 tvb_get_ntohl(tvb, FIRST_READ_FRAGMENT_LEN) +
421 FIRST_READ_FRAGMENT_LEN + SECOND_READ_FRAGMENT_LEN - LAST_READ_FRAGMENT_LEN){
423 dissect_read_response_start(tvb, hdfsdata_tree, offset);
424 offset += FIRST_READ_FRAGMENT_LEN;
426 dissect_read_response(tvb, hdfsdata_tree, offset);
427 offset+= SECOND_READ_FRAGMENT_LEN;
429 /* This message just contains data so we can display it all as one block */
431 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_rest, tvb, offset, (tvb_reported_length(tvb)) - offset, ENC_ASCII);
433 } else {
435 uint8_t op = tvb_get_uint8(tvb, 2);
437 /* READ request */
438 if ((tvb_reported_length(tvb)) >= MIN_READ_REQ && op == READ_OP) {
439 dissect_header(tvb, hdfsdata_tree, &offset);
440 dissect_read_request(tvb, hdfsdata_tree, &offset);
441 dissect_variable_int_string(tvb, hdfsdata_tree, &offset);
442 dissect_access_tokens(tvb, hdfsdata_tree, &offset);
444 /* WRITE request */
445 } else if ((tvb_reported_length(tvb)) >= MIN_WRITE_REQ && op == WRITE_OP) {
446 dissect_header(tvb, hdfsdata_tree, &offset);
447 dissect_write_request(tvb, hdfsdata_tree, &offset);
448 dissect_variable_int_string(tvb, hdfsdata_tree, &offset);
449 dissect_write_request_end(tvb, hdfsdata_tree, &offset);
450 dissect_access_tokens(tvb, hdfsdata_tree, &offset);
452 /* checksum type = 1 byte. 1 = crc32, 0 = null */
453 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_checksumtype, tvb, offset, 1, ENC_BIG_ENDIAN);
454 offset += 1;
456 /* 4 bytes = chunksize */
457 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_chunksize, tvb, offset, 4, ENC_BIG_ENDIAN);
459 /* write responses store the data length in the first 4 bytes. This length does not
460 include 21 bits of header */
461 } else if (tvb_reported_length(tvb) >= 4 && tvb_get_ntohl(tvb, 0) ==
462 tvb_reported_length(tvb) - WRITE_RESP_HEAD_LEN) {
464 dissect_write_response(tvb, hdfsdata_tree, offset);
466 } else {
467 /* This message contains some form of data that we have not successfully been able to
468 pattern match and catagorize. Display all of it as data. */
469 proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_rest, tvb, offset, (tvb_reported_length(tvb)), ENC_ASCII);
474 return tvb_captured_length(tvb);
477 static int
478 dissect_hdfsdata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
480 int frame_header_len = 0;
482 bool need_reassemble = false;
483 uint8_t op = 0;
484 bool only_packet = tvb_reported_length(tvb) == 1 || (tvb_reported_length(tvb) == 2 &&
485 tvb_get_ntohs(tvb, 0) == STATUS_SUCCESS);
487 if (tvb_reported_length(tvb) >= 3)
488 op = tvb_get_uint8(tvb, 2);
490 if (!only_packet && tvb_reported_length(tvb) != 4 && !(tvb_reported_length(tvb) >= MIN_READ_REQ && op == READ_OP) &&
491 !(tvb_reported_length(tvb) >= MIN_WRITE_REQ && op == WRITE_OP) && !(tvb_reported_length(tvb) == END_PACKET_LEN &&
492 !tvb_get_ntohl(tvb, 0) && !tvb_get_ntohl(tvb, 4))) {
494 need_reassemble = true;
497 /* setting the header size for the different types of packets */
498 if (only_packet || tvb_reported_length(tvb) == END_PACKET_LEN) {
499 frame_header_len = tvb_reported_length(tvb);
501 } else if (tvb_reported_length(tvb) == FIRST_READ_FRAGMENT_LEN ||(tvb_reported_length(tvb) >= MIN_READ_REQ &&
502 op == READ_OP && !((tvb_reported_length(tvb)) == 2 && !tvb_get_ntohs(tvb, 0)))) {
504 frame_header_len = READ_RESP_HEAD_LEN;
506 } else if (tvb_reported_length(tvb) >= MIN_WRITE_REQ && op == WRITE_OP) {
507 frame_header_len = WRITE_REQ_HEAD_LEN;
510 tcp_dissect_pdus(tvb, pinfo, tree, need_reassemble, frame_header_len, get_hdfsdata_message_len, dissect_hdfsdata_message, data);
511 return tvb_captured_length(tvb);
514 /* registers the protocol with the given names */
515 void
516 proto_register_hdfsdata(void)
518 static hf_register_info hf[] = {
520 /* list of all options for dissecting the protocol */
522 /*************************************************
523 Read request
524 **************************************************/
525 { &hf_hdfsdata_version,
526 { "HDFSDATA protocol version", "hdfsdata.version",
527 FT_UINT16, BASE_DEC,
528 NULL, 0x0,
529 NULL, HFILL }
531 { &hf_hdfsdata_cmd,
532 { "HDFSDATA command", "hdfsdata.cmd",
533 FT_UINT8, BASE_DEC,
534 NULL, 0x0,
535 NULL, HFILL }
537 { &hf_hdfsdata_blockid,
538 { "HDFSDATA block id", "hdfsdata.blockid",
539 FT_UINT64, BASE_DEC,
540 NULL, 0x0,
541 NULL, HFILL }
543 { &hf_hdfsdata_timestamp,
544 { "HDFSDATA timestamp", "hdfsdata.timestamp",
545 FT_UINT64, BASE_DEC,
546 NULL, 0x0,
547 NULL, HFILL }
549 /***
550 Read specific
551 ***/
552 { &hf_hdfsdata_startoffset,
553 { "HDFSDATA start offset", "hdfsdata.startoffset",
554 FT_UINT64, BASE_DEC,
555 NULL, 0x0,
556 NULL, HFILL }
558 { &hf_hdfsdata_blocklen,
559 { "HDFSDATA block length", "hdfsdata.blocklen",
560 FT_UINT64, BASE_DEC,
561 NULL, 0x0,
562 NULL, HFILL }
564 /***
565 Write specific
566 ***/
567 { &hf_hdfsdata_pipelinenum,
568 { "HDFSDATA number in pipeline", "hdfsdata.pipelinenum",
569 FT_UINT32, BASE_DEC,
570 NULL, 0x0,
571 NULL, HFILL }
573 { &hf_hdfsdata_recovery,
574 { "HDFSDATA recovery boolean", "hdfsdata.recovery",
575 FT_UINT8, BASE_DEC,
576 NULL, 0x0,
577 NULL, HFILL }
579 { &hf_hdfsdata_sourcenode,
580 { "HDFSDATA source node", "hdfsdata.sourcenode",
581 FT_UINT8, BASE_DEC,
582 NULL, 0x0,
583 NULL, HFILL }
585 { &hf_hdfsdata_currentpipeline,
586 { "HDFSDATA current number of nodes in the pipeline", "hdfsdata.currentpipeline",
587 FT_UINT32, BASE_DEC,
588 NULL, 0x0,
589 NULL, HFILL }
591 { &hf_hdfsdata_node,
592 { "HDFSDATA node object", "hdfsdata.node",
593 FT_UINT32, BASE_DEC,
594 NULL, 0x0,
595 NULL, HFILL }
597 /***
598 Var length
600 { &hf_hdfsdata_clientlen,
601 { "HDFSDATA client id length", "hdfsdata.clientlen",
602 FT_UINT8, BASE_DEC,
603 NULL, 0x0,
604 NULL, HFILL }
606 { &hf_hdfsdata_clientid,
607 { "HDFSDATA client id", "hdfsdata.clientid",
608 FT_STRING, BASE_NONE,
609 NULL, 0x0,
610 NULL, HFILL }
612 { &hf_hdfsdata_end,
613 { "HDFSDATA end data request", "hdfsdata.end",
614 FT_UINT32, BASE_DEC,
615 NULL, 0x0,
616 NULL, HFILL }
618 /*************************************************
619 Access tokens
620 **************************************************/
621 { &hf_hdfsdata_tokenlen,
622 { "HDFSDATA access token length", "hdfsdata.tokenlen",
623 FT_UINT8, BASE_DEC,
624 NULL, 0x0,
625 NULL, HFILL }
627 { &hf_hdfsdata_tokenid,
628 { "HDFSDATA access token ID", "hdfsdata.tokenid",
629 FT_STRING, BASE_NONE,
630 NULL, 0x0,
631 NULL, HFILL }
633 { &hf_hdfsdata_tokenpassword,
634 { "HDFSDATA access token password", "hdfsdata.tokenpassword",
635 FT_STRING, BASE_NONE,
636 NULL, 0x0,
637 NULL, HFILL }
639 { &hf_hdfsdata_tokentype,
640 { "HDFSDATA access token type", "hdfsdata.tokentype",
641 FT_STRING, BASE_NONE,
642 NULL, 0x0,
643 NULL, HFILL }
645 { &hf_hdfsdata_tokenservice,
646 { "HDFSDATA access token service", "hdfsdata.tokenservice",
647 FT_STRING, BASE_NONE,
648 NULL, 0x0,
649 NULL, HFILL }
651 /***********************************************
652 Responses 1
653 ***********************************************/
654 { &hf_hdfsdata_status,
655 { "HDFSDATA status code", "hdfsdata.status",
656 FT_UINT16, BASE_DEC,
657 NULL, 0x0,
658 NULL, HFILL }
660 { &hf_hdfsdata_checksumtype,
661 { "HDFSDATA checksum type", "hdfsdata.checksumtype",
662 FT_UINT8, BASE_DEC,
663 NULL, 0x0,
664 NULL, HFILL }
666 { &hf_hdfsdata_chunksize,
667 { "HDFSDATA chunk size", "hdfsdata.chunksize",
668 FT_UINT32, BASE_DEC,
669 NULL, 0x0,
670 NULL, HFILL }
672 { &hf_hdfsdata_chunkoffset,
673 { "HDFSDATA chunk offset", "hdfsdata.chunkoffset",
674 FT_UINT64, BASE_DEC,
675 NULL, 0x0,
676 NULL, HFILL }
678 /***********************************************
679 Responses 2
680 ***********************************************/
681 { &hf_hdfsdata_datalength,
682 { "HDFSDATA length of data", "hdfsdata.datalength",
683 FT_UINT32, BASE_DEC,
684 NULL, 0x0,
685 NULL, HFILL }
687 { &hf_hdfsdata_inblockoffset,
688 { "HDFSDATA in block offset", "hdfsdata.inblockoffset",
689 FT_UINT64, BASE_DEC,
690 NULL, 0x0,
691 NULL, HFILL }
693 { &hf_hdfsdata_seqnum,
694 { "HDFSDATA sequence number", "hdfsdata.seqnum",
695 FT_UINT64, BASE_DEC,
696 NULL, 0x0,
697 NULL, HFILL }
699 { &hf_hdfsdata_last,
700 { "HDFSDATA last packet in block", "hdfsdata.last",
701 FT_INT8, BASE_DEC,
702 NULL, 0x0,
703 NULL, HFILL }
705 { &hf_hdfsdata_datalen,
706 { "HDFSDATA length of data", "hdfsdata.datalen",
707 FT_INT32, BASE_DEC,
708 NULL, 0x0,
709 NULL, HFILL }
711 { &hf_hdfsdata_crc32,
712 { "HDFSDATA crc32 checksum", "hdfsdata.crc32",
713 FT_INT32, BASE_DEC,
714 NULL, 0x0,
715 NULL, HFILL }
717 /***********************************************
718 Responses 3
719 ***********************************************/
720 { &hf_hdfsdata_rest,
721 { "HDFSDATA data", "hdfsdata.rest",
722 FT_STRING, BASE_NONE,
723 NULL, 0x0,
724 NULL, HFILL }
726 /***********************************************
727 Write Response 1
728 ***********************************************/
729 { &hf_hdfsdata_packetsize,
730 { "HDFSDATA packet size", "hdfsdata.packetsize",
731 FT_UINT32, BASE_DEC,
732 NULL, 0x0,
733 NULL, HFILL }
735 { &hf_hdfsdata_chunklength,
736 { "HDFSDATA chunk length", "hdfsdata.chunklength",
737 FT_UINT32, BASE_DEC,
738 NULL, 0x0,
739 NULL, HFILL }
741 { &hf_hdfsdata_crc64,
742 { "HDFSDATA crc64 checksum", "hdfsdata.crc64",
743 FT_INT64, BASE_DEC,
744 NULL, 0x0,
745 NULL, HFILL }
747 { &hf_hdfsdata_pipelinestatus,
748 { "HDFSDATA pipeline status", "hdfsdata.pipelinestatus",
749 FT_INT8, BASE_DEC,
750 NULL, 0x0,
751 NULL, HFILL }
755 /* Setup protocol subtree array */
756 static int *ett[] = {
757 &ett_hdfsdata
760 proto_hdfsdata = proto_register_protocol ("HDFSDATA Protocol", "HDFSDATA", "hdfsdata");
762 proto_register_field_array(proto_hdfsdata, hf, array_length(hf));
763 proto_register_subtree_array(ett, array_length(ett));
765 hdfsdata_handle = register_dissector("hdfsdata", dissect_hdfsdata, proto_hdfsdata);
768 /* registers handoff */
769 void
770 proto_reg_handoff_hdfsdata(void)
772 dissector_add_for_decode_as_with_preference("tcp.port", hdfsdata_handle);
775 * Editor modelines
777 * Local Variables:
778 * c-basic-offset: 2
779 * tab-width: 8
780 * indent-tabs-mode: nil
781 * End:
783 * ex: set shiftwidth=2 tabstop=8 expandtab:
784 * :indentSize=2:tabSize=8:noTabs=true: