epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / packet-rx.c
blobc824bf5d1571e55bbe95f58bd06ed633d40bde3b
1 /* packet-rx.c
2 * Routines for RX packet dissection
3 * Copyright 1999, Nathan Neulinger <nneul@umr.edu>
4 * Based on routines from tcpdump patches by
5 * Ken Hornstein <kenh@cmf.nrl.navy.mil>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * Copied from packet-tftp.c
13 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include "config.h"
18 #include <epan/packet.h>
19 #include "packet-rx.h"
20 #include <epan/addr_resolv.h>
23 * See
25 * http://web.mit.edu/kolya/afs/rx/rx-spec
27 * XXX - is the "Epoch" really a UN*X time? The high-order bit, according
28 * to that spec, is a flag bit.
30 void proto_register_rx(void);
31 void proto_reg_handoff_rx(void);
33 static dissector_handle_t rx_handle;
35 #define UDP_PORT_RX_RANGE "7000-7009,7021"
37 static const value_string rx_types[] = {
38 { RX_PACKET_TYPE_DATA, "data" },
39 { RX_PACKET_TYPE_ACK, "ack" },
40 { RX_PACKET_TYPE_BUSY, "busy" },
41 { RX_PACKET_TYPE_ABORT, "abort" },
42 { RX_PACKET_TYPE_ACKALL, "ackall" },
43 { RX_PACKET_TYPE_CHALLENGE, "challenge" },
44 { RX_PACKET_TYPE_RESPONSE, "response" },
45 { RX_PACKET_TYPE_DEBUG, "debug" },
46 { RX_PACKET_TYPE_PARAMS, "params" },
47 { RX_PACKET_TYPE_VERSION, "version" },
48 { 0, NULL },
51 static const value_string rx_reason[] = {
52 { RX_ACK_REQUESTED, "Ack Requested" },
53 { RX_ACK_DUPLICATE, "Duplicate Packet" },
54 { RX_ACK_OUT_OF_SEQUENCE, "Out Of Sequence" },
55 { RX_ACK_EXEEDS_WINDOW, "Exceeds Window" },
56 { RX_ACK_NOSPACE, "No Space" },
57 { RX_ACK_PING, "Ping" },
58 { RX_ACK_PING_RESPONSE, "Ping Response" },
59 { RX_ACK_DELAY, "Delay" },
60 { RX_ACK_IDLE, "Idle" },
61 { 0, NULL }
64 static const value_string rx_ack_type[] = {
65 { RX_ACK_TYPE_NACK, "NACK" },
66 { RX_ACK_TYPE_ACK, "ACK" },
67 { 0, NULL }
70 static int proto_rx;
71 static int hf_rx_epoch;
72 static int hf_rx_cid;
73 static int hf_rx_seq;
74 static int hf_rx_serial;
75 static int hf_rx_callnumber;
76 static int hf_rx_type;
77 static int hf_rx_flags;
78 static int hf_rx_flags_clientinit;
79 static int hf_rx_flags_request_ack;
80 static int hf_rx_flags_last_packet;
81 static int hf_rx_flags_more_packets;
82 static int hf_rx_flags_free_packet;
83 static int hf_rx_userstatus;
84 static int hf_rx_securityindex;
85 static int hf_rx_spare;
86 static int hf_rx_serviceid;
87 static int hf_rx_bufferspace;
88 static int hf_rx_maxskew;
89 static int hf_rx_first_packet;
90 static int hf_rx_prev_packet;
91 static int hf_rx_reason;
92 static int hf_rx_numacks;
93 static int hf_rx_ack_type;
94 static int hf_rx_ack;
95 static int hf_rx_challenge;
96 static int hf_rx_version;
97 static int hf_rx_nonce;
98 static int hf_rx_inc_nonce;
99 static int hf_rx_min_level;
100 static int hf_rx_level;
101 static int hf_rx_response;
102 static int hf_rx_encrypted;
103 static int hf_rx_kvno;
104 static int hf_rx_ticket_len;
105 static int hf_rx_ticket;
106 static int hf_rx_ifmtu;
107 static int hf_rx_maxmtu;
108 static int hf_rx_rwind;
109 static int hf_rx_maxpackets;
110 static int hf_rx_abort;
111 static int hf_rx_abortcode;
113 static int ett_rx;
114 static int ett_rx_flags;
115 static int ett_rx_ack;
116 static int ett_rx_challenge;
117 static int ett_rx_response;
118 static int ett_rx_encrypted;
119 static int ett_rx_abort;
121 static dissector_handle_t afs_handle;
123 static int
124 dissect_rx_response_encrypted(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
126 proto_tree *tree;
127 proto_item *item;
128 int old_offset=offset;
129 int i;
130 uint32_t callnumber;
132 item = proto_tree_add_item(parent_tree, hf_rx_encrypted, tvb, offset, -1, ENC_NA);
133 tree = proto_item_add_subtree(item, ett_rx_encrypted);
135 /* epoch : 4 bytes */
136 proto_tree_add_item(tree, hf_rx_epoch, tvb, offset, 4, ENC_TIME_SECS|ENC_BIG_ENDIAN);
137 offset += 4;
139 /* cid : 4 bytes */
140 proto_tree_add_item(tree, hf_rx_cid, tvb, offset, 4, ENC_BIG_ENDIAN);
141 offset += 4;
143 /*FIXME don't know how to handle this checksum, skipping it */
144 offset += 4;
146 /* securityindex : 1 byte */
147 proto_tree_add_item(tree, hf_rx_securityindex, tvb, offset, 1, ENC_BIG_ENDIAN);
148 offset += 4;
150 for (i=0; i<RX_MAXCALLS; i++) {
151 /* callnumber : 4 bytes */
152 callnumber = tvb_get_ntohl(tvb, offset);
153 proto_tree_add_uint(tree, hf_rx_callnumber, tvb,
154 offset, 4, callnumber);
155 offset += 4;
158 /* inc nonce : 4 bytes */
159 proto_tree_add_item(tree, hf_rx_inc_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
160 offset += 4;
162 /* level : 4 bytes */
163 proto_tree_add_item(tree, hf_rx_level, tvb, offset, 4, ENC_BIG_ENDIAN);
164 offset += 4;
166 proto_item_set_len(item, offset-old_offset);
167 return offset;
171 static int
172 dissect_rx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, uint32_t seq, uint32_t callnumber)
174 proto_tree *tree;
175 proto_item *item;
176 uint32_t version, tl;
177 int old_offset=offset;
179 col_add_fstr(pinfo->cinfo, COL_INFO,
180 "RESPONSE Seq: %lu Call: %lu Source Port: %s Destination Port: %s ",
181 (unsigned long)seq,
182 (unsigned long)callnumber,
183 udp_port_to_display(pinfo->pool, pinfo->srcport),
184 udp_port_to_display(pinfo->pool, pinfo->destport)
187 item = proto_tree_add_item(parent_tree, hf_rx_response, tvb, offset, -1, ENC_NA);
188 tree = proto_item_add_subtree(item, ett_rx_response);
190 version = tvb_get_ntohl(tvb, offset);
191 proto_tree_add_uint(tree, hf_rx_version, tvb,
192 offset, 4, version);
193 offset += 4;
195 if (version==2) {
196 /* skip unused */
197 offset += 4;
199 /* encrypted : struct */
200 offset = dissect_rx_response_encrypted(tvb, tree, offset);
202 /* kvno */
203 proto_tree_add_item(tree, hf_rx_kvno, tvb, offset, 4, ENC_BIG_ENDIAN);
204 offset += 4;
206 /* ticket_len */
207 tl = tvb_get_ntohl(tvb, offset);
208 proto_tree_add_uint(tree, hf_rx_ticket_len, tvb,
209 offset, 4, tl);
210 offset += 4;
212 proto_tree_add_item(tree, hf_rx_ticket, tvb, offset, tl, ENC_NA);
213 offset += tl;
216 proto_item_set_len(item, offset-old_offset);
217 return offset;
220 static int
221 dissect_rx_abort(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, uint32_t seq, uint32_t callnumber)
223 proto_tree *tree;
224 proto_item *item;
225 int old_offset=offset;
227 col_add_fstr(pinfo->cinfo, COL_INFO,
228 "ABORT Seq: %lu Call: %lu Source Port: %s Destination Port: %s ",
229 (unsigned long)seq,
230 (unsigned long)callnumber,
231 udp_port_to_display(pinfo->pool, pinfo->srcport),
232 udp_port_to_display(pinfo->pool, pinfo->destport)
235 item = proto_tree_add_item(parent_tree, hf_rx_abort, tvb, offset, -1, ENC_NA);
236 tree = proto_item_add_subtree(item, ett_rx_abort);
238 /* abort code */
239 proto_tree_add_item(tree, hf_rx_abortcode, tvb, offset, 4, ENC_BIG_ENDIAN);
240 offset += 4;
242 proto_item_set_len(item, offset-old_offset);
243 return offset;
247 static int
248 dissect_rx_challenge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, uint32_t seq, uint32_t callnumber)
250 proto_tree *tree;
251 proto_item *item;
252 uint32_t version;
253 int old_offset=offset;
255 col_add_fstr(pinfo->cinfo, COL_INFO,
256 "CHALLENGE Seq: %lu Call: %lu Source Port: %s Destination Port: %s ",
257 (unsigned long)seq,
258 (unsigned long)callnumber,
259 udp_port_to_display(pinfo->pool, pinfo->srcport),
260 udp_port_to_display(pinfo->pool, pinfo->destport)
263 item = proto_tree_add_item(parent_tree, hf_rx_challenge, tvb, offset, -1, ENC_NA);
264 tree = proto_item_add_subtree(item, ett_rx_challenge);
266 version = tvb_get_ntohl(tvb, offset);
267 proto_tree_add_uint(tree, hf_rx_version, tvb,
268 offset, 4, version);
269 offset += 4;
271 if (version==2) {
272 proto_tree_add_item(tree, hf_rx_nonce, tvb, offset, 4, ENC_BIG_ENDIAN);
273 offset += 4;
275 proto_tree_add_item(tree, hf_rx_min_level, tvb, offset, 4, ENC_BIG_ENDIAN);
276 offset += 4;
279 proto_item_set_len(item, offset-old_offset);
280 return offset;
283 static int
284 dissect_rx_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, uint32_t seq, uint32_t callnumber)
286 proto_tree *tree;
287 proto_item *item;
288 uint8_t num, reason;
289 int old_offset = offset;
293 item = proto_tree_add_item(parent_tree, hf_rx_ack, tvb, offset, -1, ENC_NA);
294 tree = proto_item_add_subtree(item, ett_rx_ack);
297 /* bufferspace: 2 bytes*/
298 proto_tree_add_item(tree, hf_rx_bufferspace, tvb, offset, 2, ENC_BIG_ENDIAN);
299 offset += 2;
301 /* maxskew: 2 bytes*/
302 proto_tree_add_item(tree, hf_rx_maxskew, tvb, offset, 2, ENC_BIG_ENDIAN);
303 offset += 2;
305 /* first packet: 4 bytes*/
306 proto_tree_add_item(tree, hf_rx_first_packet, tvb, offset, 4, ENC_BIG_ENDIAN);
307 offset += 4;
309 /* prev packet: 4 bytes*/
310 proto_tree_add_item(tree, hf_rx_prev_packet, tvb, offset, 4, ENC_BIG_ENDIAN);
311 offset += 4;
313 /* serial : 4 bytes */
314 proto_tree_add_item(tree, hf_rx_serial, tvb, offset, 4, ENC_BIG_ENDIAN);
315 offset += 4;
317 /* reason : 1 byte */
318 reason = tvb_get_uint8(tvb, offset);
319 proto_tree_add_item(tree, hf_rx_reason, tvb, offset, 1, ENC_BIG_ENDIAN);
320 offset += 1;
322 /* nACKs */
323 num = tvb_get_uint8(tvb, offset);
324 proto_tree_add_uint(tree, hf_rx_numacks, tvb, offset, 1, num);
325 offset += 1;
327 while(num--){
328 proto_tree_add_item(tree, hf_rx_ack_type, tvb, offset, 1,
329 ENC_BIG_ENDIAN);
330 offset += 1;
333 /* Some implementations add some extra fields.
334 * As far as I can see, these first add 3 padding bytes and then
335 * up to 4 32-bit values. (0,3,4 have been witnessed)
337 * RX as a protocol seems to be completely undefined and seems to lack
338 * any sort of documentation other than "read the source of any of the
339 * (compatible?) implementations. The OpenAFS source indicates that
340 * 3 bytes of padding are written after the acks.
342 if (tvb_reported_length_remaining(tvb, offset)>3) {
343 offset += 3; /* guess. some implementations add 3 bytes */
345 if (tvb_reported_length_remaining(tvb, offset) >= 4){
346 proto_tree_add_item(tree, hf_rx_maxmtu, tvb, offset, 4,
347 ENC_BIG_ENDIAN);
348 offset += 4;
350 if (tvb_reported_length_remaining(tvb, offset) >= 4){
351 proto_tree_add_item(tree, hf_rx_ifmtu, tvb, offset, 4,
352 ENC_BIG_ENDIAN);
353 offset += 4;
355 if (tvb_reported_length_remaining(tvb, offset) >= 4){
356 proto_tree_add_item(tree, hf_rx_rwind, tvb, offset, 4,
357 ENC_BIG_ENDIAN);
358 offset += 4;
360 if (tvb_reported_length_remaining(tvb, offset) >= 4){
361 proto_tree_add_item(tree, hf_rx_maxpackets, tvb, offset, 4,
362 ENC_BIG_ENDIAN);
363 offset += 4;
367 col_add_fstr(pinfo->cinfo, COL_INFO,
368 "ACK %s "
369 "Seq: %lu "
370 "Call: %lu "
371 "Source Port: %s "
372 "Destination Port: %s ",
373 val_to_str(reason, rx_reason, "%d"),
374 (unsigned long)seq,
375 (unsigned long)callnumber,
376 udp_port_to_display(pinfo->pool, pinfo->srcport),
377 udp_port_to_display(pinfo->pool, pinfo->destport)
380 proto_item_set_len(item, offset-old_offset);
381 return offset;
385 static int
386 dissect_rx_flags(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *parent_tree, int offset)
388 static int * const flags[] = {
389 &hf_rx_flags_free_packet,
390 &hf_rx_flags_more_packets,
391 &hf_rx_flags_last_packet,
392 &hf_rx_flags_request_ack,
393 &hf_rx_flags_clientinit,
394 NULL
397 rxinfo->flags = tvb_get_uint8(tvb, offset);
399 proto_tree_add_bitmask(parent_tree, tvb, offset, hf_rx_flags, ett_rx_flags, flags, ENC_NA);
401 offset += 1;
402 return offset;
405 static int
406 dissect_rx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
408 proto_tree *tree;
409 proto_item *item;
410 const char *version_type;
411 int offset = 0;
412 struct rxinfo rxinfo;
413 uint8_t type;
414 nstime_t ts;
415 uint32_t seq, callnumber;
416 uint16_t serviceid;
418 /* Ensure we have enough data */
419 if (tvb_captured_length(tvb) < 28)
420 return 0;
422 /* Make sure it's a known type */
423 type = tvb_get_uint8(tvb, 20);
424 if (!try_val_to_str(type, rx_types))
425 return 0;
427 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RX");
428 col_clear(pinfo->cinfo, COL_INFO);
430 item = proto_tree_add_protocol_format(parent_tree, proto_rx, tvb,
431 offset, 28, "RX Protocol");
432 tree = proto_item_add_subtree(item, ett_rx);
434 /* epoch : 4 bytes */
435 rxinfo.epoch = tvb_get_ntohl(tvb, offset);
436 ts.secs = rxinfo.epoch;
437 ts.nsecs = 0;
438 proto_tree_add_time(tree, hf_rx_epoch, tvb, offset, 4, &ts);
439 offset += 4;
441 /* cid : 4 bytes */
442 rxinfo.cid = tvb_get_ntohl(tvb, offset);
443 proto_tree_add_item(tree, hf_rx_cid, tvb, offset, 4, ENC_BIG_ENDIAN);
444 offset += 4;
446 /* callnumber : 4 bytes */
447 callnumber = tvb_get_ntohl(tvb, offset);
448 proto_tree_add_uint(tree, hf_rx_callnumber, tvb,
449 offset, 4, callnumber);
450 offset += 4;
451 rxinfo.callnumber = callnumber;
453 /* seq : 4 bytes */
454 seq = tvb_get_ntohl(tvb, offset);
455 proto_tree_add_uint(tree, hf_rx_seq, tvb,
456 offset, 4, seq);
457 offset += 4;
458 rxinfo.seq = seq;
460 /* serial : 4 bytes */
461 proto_tree_add_item(tree, hf_rx_serial, tvb, offset, 4, ENC_BIG_ENDIAN);
462 offset += 4;
464 /* type : 1 byte */
465 type = tvb_get_uint8(tvb, offset);
466 proto_tree_add_uint(tree, hf_rx_type, tvb,
467 offset, 1, type);
468 offset += 1;
469 rxinfo.type = type;
471 /* flags : 1 byte */
472 offset = dissect_rx_flags(tvb, &rxinfo, tree, offset);
474 /* userstatus : 1 byte */
475 proto_tree_add_item(tree, hf_rx_userstatus, tvb, offset, 1, ENC_BIG_ENDIAN);
476 offset += 1;
478 /* securityindex : 1 byte */
479 proto_tree_add_item(tree, hf_rx_securityindex, tvb, offset, 1, ENC_BIG_ENDIAN);
480 offset += 1;
483 * How clever: even though the AFS header files indicate that the
484 * serviceId is first, it's really encoded _after_ the spare field.
485 * I wasted a day figuring that out!
488 /* spare */
489 proto_tree_add_item(tree, hf_rx_spare, tvb, offset, 2, ENC_BIG_ENDIAN);
490 offset += 2;
492 /* service id : 2 bytes */
493 serviceid = tvb_get_ntohs(tvb, offset);
494 proto_tree_add_uint(tree, hf_rx_serviceid, tvb,
495 offset, 2, serviceid);
496 offset += 2;
497 rxinfo.serviceid = serviceid;
499 switch (type) {
500 case RX_PACKET_TYPE_ACK:
501 /*dissect_rx_acks(tvb, pinfo, parent_tree, offset,
502 can't create it in a parallel tree, then ett search
503 won't work */
504 dissect_rx_acks(tvb, pinfo, tree, offset,
505 seq, callnumber);
506 break;
507 case RX_PACKET_TYPE_ACKALL:
508 /* does not contain any payload */
509 col_add_fstr(pinfo->cinfo, COL_INFO,
510 "ACKALL Seq: %lu Call: %lu Source Port: %s Destination Port: %s ",
511 (unsigned long)seq,
512 (unsigned long)callnumber,
513 udp_port_to_display(pinfo->pool, pinfo->srcport),
514 udp_port_to_display(pinfo->pool, pinfo->destport)
516 break;
517 case RX_PACKET_TYPE_VERSION:
518 /* does not contain any payload */
519 if (rxinfo.cid == 0)
520 version_type = "NAT ping";
521 else
522 version_type = "request";
524 col_add_fstr(pinfo->cinfo, COL_INFO,
525 "VERSION %s Seq: %lu Call: %lu Source Port: %s Destination Port: %s ",
526 version_type,
527 (unsigned long)seq,
528 (unsigned long)callnumber,
529 udp_port_to_display(pinfo->pool, pinfo->srcport),
530 udp_port_to_display(pinfo->pool, pinfo->destport)
532 break;
533 case RX_PACKET_TYPE_CHALLENGE:
534 dissect_rx_challenge(tvb, pinfo, tree, offset, seq, callnumber);
535 break;
536 case RX_PACKET_TYPE_RESPONSE:
537 dissect_rx_response(tvb, pinfo, tree, offset, seq, callnumber);
538 break;
539 case RX_PACKET_TYPE_DATA: {
540 tvbuff_t *next_tvb;
542 next_tvb = tvb_new_subset_remaining(tvb, offset);
543 call_dissector_with_data(afs_handle, next_tvb, pinfo, parent_tree, &rxinfo);
545 break;
546 case RX_PACKET_TYPE_ABORT:
547 dissect_rx_abort(tvb, pinfo, tree, offset, seq, callnumber);
548 break;
551 return tvb_captured_length(tvb);
554 void
555 proto_register_rx(void)
557 static hf_register_info hf[] = {
558 { &hf_rx_epoch, {
559 "Epoch", "rx.epoch", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
560 NULL, 0, NULL, HFILL }},
562 { &hf_rx_cid, {
563 "CID", "rx.cid", FT_UINT32, BASE_DEC,
564 NULL, 0, NULL, HFILL }},
566 { &hf_rx_callnumber, {
567 "Call Number", "rx.callnumber", FT_UINT32, BASE_DEC,
568 NULL, 0, NULL, HFILL }},
570 { &hf_rx_seq, {
571 "Sequence Number", "rx.seq", FT_UINT32, BASE_DEC,
572 NULL, 0, NULL, HFILL }},
574 { &hf_rx_serial, {
575 "Serial", "rx.serial", FT_UINT32, BASE_DEC,
576 NULL, 0, NULL, HFILL }},
578 { &hf_rx_type, {
579 "Type", "rx.type", FT_UINT8, BASE_DEC,
580 VALS(rx_types), 0, NULL, HFILL }},
582 { &hf_rx_flags, {
583 "Flags", "rx.flags", FT_UINT8, BASE_HEX,
584 NULL, 0, NULL, HFILL }},
586 { &hf_rx_flags_clientinit, {
587 "Client Initiated", "rx.flags.client_init", FT_BOOLEAN, 8,
588 NULL, RX_CLIENT_INITIATED, NULL, HFILL }},
590 { &hf_rx_flags_request_ack, {
591 "Request Ack", "rx.flags.request_ack", FT_BOOLEAN, 8,
592 NULL, RX_REQUEST_ACK, NULL, HFILL }},
594 { &hf_rx_flags_last_packet, {
595 "Last Packet", "rx.flags.last_packet", FT_BOOLEAN, 8,
596 NULL, RX_LAST_PACKET, NULL, HFILL }},
598 { &hf_rx_flags_more_packets, {
599 "More Packets", "rx.flags.more_packets", FT_BOOLEAN, 8,
600 NULL, RX_MORE_PACKETS, NULL, HFILL }},
602 { &hf_rx_flags_free_packet, {
603 "Free Packet", "rx.flags.free_packet", FT_BOOLEAN, 8,
604 NULL, RX_FREE_PACKET, NULL, HFILL }},
606 /* XXX - what about RX_SLOW_START_OR_JUMBO? */
608 { &hf_rx_userstatus, {
609 "User Status", "rx.userstatus", FT_UINT32, BASE_DEC,
610 NULL, 0, NULL, HFILL }},
612 { &hf_rx_securityindex, {
613 "Security Index", "rx.securityindex", FT_UINT32, BASE_DEC,
614 NULL, 0, NULL, HFILL }},
616 { &hf_rx_spare, {
617 "Spare/Checksum", "rx.spare", FT_UINT16, BASE_DEC,
618 NULL, 0, NULL, HFILL }},
620 { &hf_rx_serviceid, {
621 "Service ID", "rx.serviceid", FT_UINT16, BASE_DEC,
622 NULL, 0, NULL, HFILL }},
624 { &hf_rx_bufferspace, {
625 "Bufferspace", "rx.bufferspace", FT_UINT16, BASE_DEC,
626 NULL, 0, "Number Of Packets Available", HFILL }},
628 { &hf_rx_maxskew, {
629 "Max Skew", "rx.maxskew", FT_UINT16, BASE_DEC,
630 NULL, 0, NULL, HFILL }},
632 { &hf_rx_first_packet, {
633 "First Packet", "rx.first", FT_UINT32, BASE_DEC,
634 NULL, 0, NULL, HFILL }},
636 { &hf_rx_prev_packet, {
637 "Prev Packet", "rx.prev", FT_UINT32, BASE_DEC,
638 NULL, 0, "Previous Packet", HFILL }},
640 { &hf_rx_reason, {
641 "Reason", "rx.reason", FT_UINT8, BASE_DEC,
642 VALS(rx_reason), 0, "Reason For This ACK", HFILL }},
644 { &hf_rx_numacks, {
645 "Num ACKs", "rx.num_acks", FT_UINT8, BASE_DEC,
646 NULL, 0, "Number Of ACKs", HFILL }},
648 { &hf_rx_ack_type, {
649 "ACK Type", "rx.ack_type", FT_UINT8, BASE_DEC,
650 VALS(rx_ack_type), 0, "Type Of ACKs", HFILL }},
652 { &hf_rx_ack, {
653 "ACK Packet", "rx.ack", FT_NONE, BASE_NONE,
654 NULL, 0, NULL, HFILL }},
656 { &hf_rx_challenge, {
657 "CHALLENGE Packet", "rx.challenge", FT_NONE, BASE_NONE,
658 NULL, 0, NULL, HFILL }},
660 { &hf_rx_version, {
661 "Version", "rx.version", FT_UINT32, BASE_DEC,
662 NULL, 0, "Version Of Challenge/Response", HFILL }},
664 { &hf_rx_nonce, {
665 "Nonce", "rx.nonce", FT_UINT32, BASE_HEX,
666 NULL, 0, NULL, HFILL }},
668 { &hf_rx_inc_nonce, {
669 "Inc Nonce", "rx.inc_nonce", FT_UINT32, BASE_HEX,
670 NULL, 0, "Incremented Nonce", HFILL }},
672 { &hf_rx_min_level, {
673 "Min Level", "rx.min_level", FT_UINT32, BASE_DEC,
674 NULL, 0, NULL, HFILL }},
676 { &hf_rx_level, {
677 "Level", "rx.level", FT_UINT32, BASE_DEC,
678 NULL, 0, NULL, HFILL }},
680 { &hf_rx_response, {
681 "RESPONSE Packet", "rx.response", FT_NONE, BASE_NONE,
682 NULL, 0, NULL, HFILL }},
684 { &hf_rx_abort, {
685 "ABORT Packet", "rx.abort", FT_NONE, BASE_NONE,
686 NULL, 0, NULL, HFILL }},
688 { &hf_rx_encrypted, {
689 "Encrypted", "rx.encrypted", FT_NONE, BASE_NONE,
690 NULL, 0, "Encrypted part of response packet", HFILL }},
692 { &hf_rx_kvno, {
693 "kvno", "rx.kvno", FT_UINT32, BASE_DEC,
694 NULL, 0, NULL, HFILL }},
696 { &hf_rx_ticket_len, {
697 "Ticket len", "rx.ticket_len", FT_UINT32, BASE_DEC,
698 NULL, 0, "Ticket Length", HFILL }},
700 { &hf_rx_ticket, {
701 "ticket", "rx.ticket", FT_BYTES, BASE_NONE,
702 NULL, 0, NULL, HFILL }},
704 { &hf_rx_ifmtu, {
705 "Interface MTU", "rx.if_mtu", FT_UINT32, BASE_DEC,
706 NULL, 0, NULL, HFILL }},
708 { &hf_rx_maxmtu, {
709 "Max MTU", "rx.max_mtu", FT_UINT32, BASE_DEC,
710 NULL, 0, NULL, HFILL }},
712 { &hf_rx_rwind, {
713 "rwind", "rx.rwind", FT_UINT32, BASE_DEC,
714 NULL, 0, NULL, HFILL }},
716 { &hf_rx_maxpackets, {
717 "Max Packets", "rx.max_packets", FT_UINT32, BASE_DEC,
718 NULL, 0, NULL, HFILL }},
720 { &hf_rx_abortcode, {
721 "Abort Code", "rx.abort_code", FT_INT32, BASE_DEC,
722 NULL, 0, NULL, HFILL }},
725 static int *ett[] = {
726 &ett_rx,
727 &ett_rx_flags,
728 &ett_rx_ack,
729 &ett_rx_challenge,
730 &ett_rx_response,
731 &ett_rx_encrypted,
732 &ett_rx_abort
735 proto_rx = proto_register_protocol("RX Protocol", "RX", "rx");
736 proto_register_field_array(proto_rx, hf, array_length(hf));
737 proto_register_subtree_array(ett, array_length(ett));
739 rx_handle = register_dissector("rx", dissect_rx, proto_rx);
742 void
743 proto_reg_handoff_rx(void)
746 * Get handle for the AFS dissector.
748 afs_handle = find_dissector_add_dependency("afs", proto_rx);
750 dissector_add_uint_range_with_preference("udp.port", UDP_PORT_RX_RANGE, rx_handle);
754 * Editor modelines - https://www.wireshark.org/tools/modelines.html
756 * Local variables:
757 * c-basic-offset: 8
758 * tab-width: 8
759 * indent-tabs-mode: t
760 * End:
762 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
763 * :indentSize=8:tabSize=8:noTabs=yes: