Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-ar_drone.c
blob18a5e960426827808879d1915c847a6f344783c1
1 /* packet-ar_drone.c
2 * Routines for AR ar_drone protocol packet disassembly
3 * By Paul Hoisington <hoisingtonp@bit-sys.com>,
4 * Tom Hildesheim <hildesheimt@bit-sys.com>,
5 * and Claire Brantley <brantleyc@bit-sys.com>
6 * Copyright 2012 BIT Systems
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include "config.h"
17 #include <epan/packet.h>
18 #include <epan/expert.h>
20 void proto_register_ar_drone(void);
21 void proto_reg_handoff_ar_drone(void);
23 /* ************************************************ */
24 /* Begin static variable declaration/initialization */
25 /* ************************************************ */
27 /* ar_drone Protocol */
28 static int proto_ar_drone;
30 /* ar_drone Dissector handle */
31 static dissector_handle_t ar_drone_handle;
33 /* Headers */
34 static int hf_command;
35 static int hf_PCMD_id;
36 static int hf_PCMD_flag;
37 static int hf_PCMD_roll;
38 static int hf_PCMD_pitch;
39 static int hf_PCMD_gaz;
40 static int hf_PCMD_yaw;
41 static int hf_REF_id;
42 static int hf_REF_ctrl;
43 static int hf_FTRIM_seq;
44 static int hf_CONFIG_seq;
45 static int hf_CONFIG_name;
46 static int hf_CONFIG_val;
47 static int hf_CONFIG_ID_seq;
48 static int hf_CONFIG_ID_session;
49 static int hf_CONFIG_ID_user;
50 static int hf_CONFIG_ID_app;
51 static int hf_COMWDG;
52 static int hf_LED_seq;
53 static int hf_LED_anim;
54 static int hf_LED_freq;
55 static int hf_LED_sec;
56 static int hf_ANIM_seq;
57 static int hf_ANIM_anim;
58 static int hf_ANIM_sec;
59 static int hf_CTRL_seq;
60 static int hf_CTRL_mode;
61 static int hf_CTRL_fsize;
63 /**Subtrees */
64 static int ett_FTRIM;
65 static int ett_ar_drone;
66 static int ett_PCMD;
67 static int ett_REF;
68 static int ett_CONFIG;
69 static int ett_CONFIG_ID;
70 static int ett_COMWDG;
71 static int ett_LED;
72 static int ett_ANIM;
73 static int ett_CTRL;
75 static expert_field ei_NO_COMMA;
76 static expert_field ei_NO_CR;
78 /* Value String */
79 #if 0 /* TODO: Delete these? Or make use of them? */
80 static const value_string REF_types_vs[] = {
81 { 0x38323038, "FLYING MODE" },
82 { 0x37393532, "EMERGENCY LANDING" },
83 { 0x37363936, "LANDING MODE" },
84 { 0, NULL }
86 static const value_string PCMD_flag_vs[] = {
87 { 0x30 , "DO NOT ALLOW ROLL/PITCH" },
88 { 0x31 , "ALLOW ROLL/PITCH" },
89 { 0 , NULL }
91 #endif
93 static const string_string CTRL_mode_vs[] = {
94 { "4" , " (CFG_GET_CONTROL_MODE)" },
95 { "5" , " (ACK_CONTROL_MODE)" },
96 { "6" , " (CUSTOM_CFG_GET_CONTROL_MODE)" },
97 { NULL, NULL }
100 /* ********************************************** */
101 /* End static variable declaration/initialization */
102 /* ********************************************** */
103 static int
104 dissect_ar_drone(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
106 int offset, length;
107 int master_offset = 0;
108 proto_item *ti, *sub_item;
109 proto_tree *ar_tree, *sub_tree;
110 char *command;
111 uint8_t *complete_str;
112 uint32_t dword;
114 if (tvb_captured_length(tvb) < 4)
115 return 0;
117 /* Make sure the packet we're dissecting is a ar_drone packet
118 * Cheap string check for 'AT*'
120 dword = tvb_get_ntoh24(tvb, 0);
121 if (dword != 0x41542a)
122 return 0;
124 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ar_drone");
125 col_set_str(pinfo->cinfo, COL_INFO, "AR Drone Packet");
127 /* Initialize ar_drone Packet tree with subtrees */
128 ti = proto_tree_add_item(tree, proto_ar_drone, tvb, 0, -1, ENC_NA);
129 ar_tree = proto_item_add_subtree(ti, ett_ar_drone);
131 while (tvb_reported_length_remaining(tvb, master_offset) > 3)
133 /* Get a string to compare our command strings (aka "AT*PCMD", etc.) to */
134 offset = tvb_find_uint8(tvb, master_offset, -1, '=');
135 if (offset < master_offset)
136 return master_offset;
138 command = tvb_get_string_enc(pinfo->pool, tvb, master_offset, offset-master_offset, ENC_ASCII|ENC_NA);
139 complete_str = tvb_get_string_enc(pinfo->pool, tvb, master_offset+3, offset-master_offset-3, ENC_ASCII|ENC_NA);
140 sub_item = proto_tree_add_string(ar_tree, hf_command, tvb, master_offset, -1, complete_str);
142 if (!strncmp(command, "AT*PCMD", 7))
144 /** Parse according the PCMD layout: */
145 uint8_t PCMD_byte;
146 const char *PCMD_str;
148 sub_tree = proto_item_add_subtree(sub_item, ett_PCMD);
150 offset = master_offset + 8;
152 /* Add PCMD ID */
153 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
154 if (length < 0) {
155 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
156 return offset;
158 proto_tree_add_item(sub_tree, hf_PCMD_id, tvb, offset, length, ENC_ASCII);
159 offset += (length + 1);
161 /* Add PCMD Flag */
162 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
163 if (length < 0) {
164 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
165 return offset;
167 proto_tree_add_item(sub_tree, hf_PCMD_flag, tvb, offset, length, ENC_ASCII);
168 offset += (length + 1);
170 /* Add PCMD Roll */
171 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
172 if (length < 0) {
173 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
174 return offset;
176 ti = proto_tree_add_item(sub_tree, hf_PCMD_roll, tvb, offset, length, ENC_ASCII);
178 PCMD_byte = tvb_get_uint8(tvb, offset);
179 if (PCMD_byte == 0x30)
181 PCMD_str = " (NO CHANGE)";
183 else if (PCMD_byte == 0x2d)
185 PCMD_byte = tvb_get_uint8(tvb, offset + 1);
186 if (PCMD_byte == 0x30)
188 PCMD_str = " (NO CHANGE)";
190 else
192 PCMD_str = " (ROLL LEFT)";
195 else
197 PCMD_str = " (ROLL RIGHT)";
199 proto_item_append_text(ti, "%s", PCMD_str);
200 offset += (length + 1);
202 /* Add PCMD Pitch */
203 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
204 if (length < 0) {
205 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
206 return offset;
208 ti = proto_tree_add_item(sub_tree, hf_PCMD_pitch, tvb, offset, length, ENC_ASCII);
210 PCMD_byte = tvb_get_uint8(tvb, offset);
211 if (PCMD_byte == 0x30)
213 PCMD_str = " (NO CHANGE)";
215 else if (PCMD_byte == 0x2d)
217 PCMD_byte = tvb_get_uint8(tvb, offset + 1);
218 if (PCMD_byte == 0x30)
220 PCMD_str = " (NO CHANGE)";
222 else
224 PCMD_str = " (PITCH FORWARD)";
227 else
229 PCMD_str = " (PITCH BACKWARD)";
231 proto_item_append_text(ti, "%s", PCMD_str);
232 offset += (length + 1);
234 /* Add PCMD Gaz */
235 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
236 if (length < 0) {
237 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
238 return offset;
240 ti = proto_tree_add_item(sub_tree, hf_PCMD_gaz, tvb, offset, length, ENC_ASCII);
242 PCMD_byte = tvb_get_uint8(tvb, offset);
243 if (PCMD_byte == 0x30)
245 PCMD_str = " (NO CHANGE)";
247 else if (PCMD_byte == 0x2d)
249 PCMD_byte = tvb_get_uint8(tvb, offset + 1);
250 if (PCMD_byte == 0x30)
252 PCMD_str = " (NO CHANGE)";
254 else
256 PCMD_str = " (DECREASE VERT SPEED)";
259 else
261 PCMD_str = " (INCREASE VERT SPEED)";
263 proto_item_append_text(ti, "%s", PCMD_str);
264 offset += (length + 1);
266 /* Add PCMD Yaw */
267 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
268 if (length < 0) {
269 expert_add_info(pinfo, sub_item, &ei_NO_CR);
270 return offset;
272 ti = proto_tree_add_item(sub_tree, hf_PCMD_yaw, tvb, offset, length, ENC_ASCII);
274 PCMD_byte = tvb_get_uint8(tvb, offset);
275 if (PCMD_byte == 0x30)
277 PCMD_str = " (NO CHANGE)";
279 else if (PCMD_byte == 0x2d)
281 PCMD_byte = tvb_get_uint8(tvb, offset + 1);
282 if (PCMD_byte == 0x30)
284 PCMD_str = " (NO CHANGE)";
286 else
288 PCMD_str = " (ROTATE LEFT)";
291 else
293 PCMD_str = " (ROTATE RIGHT)";
295 proto_item_append_text(ti, "%s", PCMD_str);
296 offset += (length + 1);
298 else if (!strncmp(command, "AT*REF", 6))
300 /** Parse according to the REF layout: */
301 sub_tree = proto_item_add_subtree(sub_item, ett_REF);
303 offset = master_offset + 7;
305 /* Add REF ID */
306 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
307 if (length < 0) {
308 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
309 return offset;
311 proto_tree_add_item(sub_tree, hf_REF_id, tvb, offset, length, ENC_ASCII);
312 offset += (length + 1);
314 /* Add REF ctrl */
315 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
316 if (length < 0) {
317 expert_add_info(pinfo, sub_item, &ei_NO_CR);
318 return offset;
320 proto_tree_add_item(sub_tree, hf_REF_ctrl, tvb, offset, length, ENC_ASCII);
321 offset += (length + 1);
323 } else if (!strncmp(command, "AT*CONFIG_IDS", 13))
325 /** Parse according to the CONFIG_ID layout: */
326 sub_tree = proto_item_add_subtree(sub_item, ett_CONFIG_ID);
328 offset = master_offset + 14;
330 /* Add Sequence Number */
331 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
332 if (length < 0) {
333 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
334 return offset;
336 proto_tree_add_item(sub_tree, hf_CONFIG_ID_seq, tvb, offset, length, ENC_ASCII);
337 offset += (length + 1);
339 /* Add Session ID */
340 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
341 if (length < 0) {
342 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
343 return offset;
345 proto_tree_add_item(sub_tree, hf_CONFIG_ID_session, tvb, offset, length, ENC_ASCII);
346 offset += (length + 1);
348 /* Add User ID */
349 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
350 if (length < 0) {
351 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
352 return offset;
354 proto_tree_add_item(sub_tree, hf_CONFIG_ID_user, tvb, offset, length, ENC_ASCII);
355 offset += (length + 1);
357 /* Add Application ID */
358 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
359 if (length < 0) {
360 expert_add_info(pinfo, sub_item, &ei_NO_CR);
361 return offset;
363 proto_tree_add_item(sub_tree, hf_CONFIG_ID_app, tvb, offset, length, ENC_ASCII);
364 offset += (length + 1);
366 } else if (!strncmp(command, "AT*ANIM", 7))
368 /** Parse according to the ANIM layout: */
369 sub_tree = proto_item_add_subtree(sub_item, ett_ANIM);
371 offset = master_offset + 8;
373 /* Add sequence */
374 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
375 if (length < 0) {
376 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
377 return offset;
379 proto_tree_add_item(sub_tree, hf_ANIM_seq, tvb, offset, length, ENC_ASCII);
380 offset += (length + 1);
382 /* Add Animation */
383 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
384 if (length < 0) {
385 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
386 return offset;
388 proto_tree_add_item(sub_tree, hf_ANIM_anim, tvb, offset, length, ENC_ASCII);
389 offset += (length + 1);
391 /* Add animation time(sec) */
392 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
393 if (length < 0) {
394 expert_add_info(pinfo, sub_item, &ei_NO_CR);
395 return offset;
397 proto_tree_add_item(sub_tree, hf_ANIM_sec, tvb, offset, length, ENC_ASCII);
398 offset += (length + 1);
400 } else if (!strncmp(command, "AT*FTRIM", 8))
402 /** Parse according to the FTRIM layout: */
403 sub_tree = proto_item_add_subtree(sub_item, ett_FTRIM);
405 offset = master_offset + 9;
407 /* Add sequence number */
408 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
409 if (length < 0) {
410 expert_add_info(pinfo, sub_item, &ei_NO_CR);
411 return offset;
413 proto_item_append_text(sub_item, " (Sets the reference for the horizontal plane)");
414 proto_tree_add_item(sub_tree, hf_FTRIM_seq, tvb, offset, length, ENC_ASCII);
415 offset += (length + 1);
416 } else if (!strncmp(command, "AT*CONFIG", 9))
418 /** Parse according to the CONFIG layout: */
419 sub_tree = proto_item_add_subtree(sub_item, ett_CONFIG);
421 offset = master_offset + 10;
423 /* Add sequence */
424 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
425 if (length < 0) {
426 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
427 return offset;
429 proto_tree_add_item(sub_tree, hf_CONFIG_seq, tvb, offset, length, ENC_ASCII);
430 offset += (length + 1);
432 /* Add Name */
433 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
434 if (length < 0) {
435 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
436 return offset;
438 proto_tree_add_item(sub_tree, hf_CONFIG_name, tvb, offset, length, ENC_ASCII);
439 offset += (length + 1);
441 /* Add Value */
442 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
443 if (length < 0) {
444 expert_add_info(pinfo, sub_item, &ei_NO_CR);
445 return offset;
447 proto_tree_add_item(sub_tree, hf_CONFIG_val, tvb, offset, length, ENC_ASCII);
448 offset += (length + 1);
450 } else if (!strncmp(command, "AT*LED", 6))
452 /** Parse according to the LED layout: */
453 sub_tree = proto_item_add_subtree(sub_item, ett_LED);
455 offset = master_offset + 7;
457 /* Add sequence */
458 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
459 if (length < 0) {
460 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
461 return offset;
463 proto_tree_add_item(sub_tree, hf_LED_seq, tvb, offset, length, ENC_ASCII);
464 offset += (length + 1);
466 /* Add animation to play */
467 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
468 if (length < 0) {
469 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
470 return offset;
472 proto_tree_add_item(sub_tree, hf_LED_anim, tvb, offset, length, ENC_ASCII);
473 offset += (length + 1);
475 /* Add frequency */
476 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
477 if (length < 0) {
478 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
479 return offset;
481 proto_tree_add_item(sub_tree, hf_LED_freq, tvb, offset, length, ENC_ASCII);
482 offset += (length + 1);
484 /* Add Time to play in sec */
485 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
486 if (length < 0) {
487 expert_add_info(pinfo, sub_item, &ei_NO_CR);
488 return offset;
490 proto_tree_add_item(sub_tree, hf_LED_sec, tvb, offset, length, ENC_ASCII);
491 offset += (length + 1);
493 } else if (!strncmp(command, "AT*COMWDG", 9))
495 /** Parse according to the COMWDG layout: */
496 sub_tree = proto_item_add_subtree(sub_item, ett_COMWDG);
498 offset = master_offset + 10;
500 /* Add sequence number */
501 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
502 if (length < 0) {
503 expert_add_info(pinfo, sub_item, &ei_NO_CR);
504 return offset;
506 proto_tree_add_item(sub_tree, hf_COMWDG, tvb, offset, length, ENC_ASCII);
507 offset += (length + 1);
509 }else if (!strncmp(command, "AT*CTRL", 7))
511 const uint8_t* CTRL_mode_str;
513 /** Parse according to the CTRL layout: */
514 sub_tree = proto_item_add_subtree(sub_item, ett_CTRL);
516 offset = master_offset + 8;
518 /* Add sequence */
519 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
520 if (length < 0) {
521 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
522 return offset;
524 proto_tree_add_item(sub_tree, hf_CTRL_seq, tvb, offset, length, ENC_ASCII);
525 offset += (length + 1);
527 /* Add Mode */
528 length = tvb_find_uint8(tvb, offset, -1, ',') - offset;
529 if (length < 0) {
530 expert_add_info(pinfo, sub_item, &ei_NO_COMMA);
531 return offset;
533 ti = proto_tree_add_item_ret_string(sub_tree, hf_CTRL_mode, tvb, offset, length, ENC_ASCII|ENC_NA, pinfo->pool, &CTRL_mode_str);
534 proto_item_append_text(ti, "%s", str_to_str(CTRL_mode_str, CTRL_mode_vs, " (Unknown Mode)"));
535 offset += (length + 1);
537 /* Add File Size */
538 length = tvb_find_uint8(tvb, offset, -1, 0x0d) - offset;
539 if (length < 0) {
540 expert_add_info(pinfo, sub_item, &ei_NO_CR);
541 return offset;
543 proto_tree_add_item(sub_tree, hf_CTRL_fsize, tvb, offset, length, ENC_ASCII);
544 offset += (length + 1);
546 else
548 /* Unknown command, just abort */
549 return master_offset;
552 proto_item_set_len(sub_item, offset-master_offset);
553 master_offset = offset;
556 return master_offset;
559 static bool
560 dissect_ar_drone_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
562 return dissect_ar_drone(tvb, pinfo, tree, data) > 0;
565 void
566 proto_register_ar_drone(void)
568 /* Setup protocol header array */
569 static hf_register_info hf[] = {
570 { &hf_command,
571 { "Command", "ar_drone.command",
572 FT_STRING, BASE_NONE,
573 NULL, 0x0,
574 NULL, HFILL }
576 { &hf_PCMD_id,
577 { "Sequence Number", "ar_drone.pcmd.id",
578 FT_STRING, BASE_NONE,
579 NULL, 0x0,
580 "Progressive Command ID", HFILL }
582 { &hf_PCMD_flag,
583 { "Flag", "ar_drone.pcmd.flag",
584 FT_STRING, BASE_NONE,
585 NULL/*VALS(PCMD_flag_vs)*/, 0x0,
586 "Progressive Command Flag", HFILL }
588 { &hf_PCMD_roll,
589 { "Roll", "ar_drone.pcmd.roll",
590 FT_STRING, BASE_NONE,
591 NULL, 0x0,
592 "Progressive Command Roll", HFILL }
594 { &hf_PCMD_pitch,
595 { "Pitch", "ar_drone.pcmd.pitch",
596 FT_STRING, BASE_NONE,
597 NULL, 0x0,
598 "Progressive Command Pitch", HFILL }
600 { &hf_PCMD_gaz,
601 { "Gaz", "ar_drone.pcmd.gaz",
602 FT_STRING, BASE_NONE,
603 NULL, 0x0,
604 "Progressive Command Gaz", HFILL }
606 { &hf_PCMD_yaw,
607 { "Yaw", "ar_drone.pcmd.yaw",
608 FT_STRING, BASE_NONE,
609 NULL, 0x0,
610 "Progressive Command Yaw", HFILL }
612 { &hf_REF_id,
613 { "Sequence Number", "ar_drone.ref.id",
614 FT_STRING, BASE_NONE,
615 NULL, 0x0,
616 "Reference ID", HFILL }
618 { &hf_REF_ctrl,
619 { "Control Command", "ar_drone.ref.ctrl",
620 FT_STRING, BASE_NONE,
621 NULL/*VALS(REF_types_vs)*/, 0x0,
622 NULL, HFILL }
624 { &hf_FTRIM_seq,
625 { "Sequence Number", "ar_drone.ftrim.seq",
626 FT_STRING, BASE_NONE,
627 NULL, 0x0,
628 "Flap Trim / Horizontal Plane Reference", HFILL }
630 { &hf_CONFIG_ID_seq,
631 { "Sequence Number", "ar_drone.configids.seq",
632 FT_STRING, BASE_NONE,
633 NULL, 0x0,
634 "Configuration ID sequence number", HFILL }
636 { &hf_CONFIG_ID_session,
637 { "Current Session ID", "ar_drone.configids.session",
638 FT_STRING, BASE_NONE,
639 NULL, 0x0,
640 "Configuration ID current session ID", HFILL }
642 { &hf_CONFIG_ID_user,
643 { "Current User ID", "ar_drone.configids.user",
644 FT_STRING, BASE_NONE,
645 NULL, 0x0,
646 "Configuration ID current user ID", HFILL }
648 { &hf_CONFIG_ID_app,
649 { "Current Application ID", "ar_drone.configids.app",
650 FT_STRING, BASE_NONE,
651 NULL, 0x0,
652 "Configuration ID current application ID", HFILL }
654 { &hf_COMWDG,
655 { "Command WatchDog Request", "ar_drone.comwdg",
656 FT_STRING, BASE_NONE,
657 NULL, 0x0,
658 "Command WatchDog Reset request", HFILL }
660 { &hf_CONFIG_seq,
661 { "Sequence Number", "ar_drone.config.seq",
662 FT_STRING, BASE_NONE,
663 NULL, 0x0,
664 "Configuration Seq Num", HFILL }
666 { &hf_CONFIG_name,
667 { "Option Name", "ar_drone.config.name",
668 FT_STRING, BASE_NONE,
669 NULL, 0x0,
670 NULL, HFILL }
672 { &hf_CONFIG_val,
673 { "Option Parameter", "ar_drone.config.val",
674 FT_STRING, BASE_NONE,
675 NULL, 0x0,
676 NULL, HFILL }
678 { &hf_LED_seq,
679 { "Sequence Number", "ar_drone.led.seq",
680 FT_STRING, BASE_NONE,
681 NULL, 0x0,
682 "LED Sequence Number", HFILL }
684 { &hf_LED_anim,
685 { "Selected Animation", "ar_drone.led.anim",
686 FT_STRING, BASE_NONE,
687 NULL, 0x0,
688 "Selected LED Animation", HFILL }
690 { &hf_LED_freq,
691 { "Animation Frequency", "ar_drone.led.freq",
692 FT_STRING, BASE_NONE,
693 NULL, 0x0,
694 "LED Animation Frequency", HFILL }
696 { &hf_LED_sec,
697 { "LED Animation Length (Seconds)", "ar_drone.led.sec",
698 FT_STRING, BASE_NONE,
699 NULL, 0x0,
700 "LED Anim Length", HFILL }
702 { &hf_ANIM_seq,
703 { "Animation Sequence Number", "ar_drone.anim.seq",
704 FT_STRING, BASE_NONE,
705 NULL, 0x0,
706 "Movement(Animation) Sequence #", HFILL }
708 { &hf_ANIM_anim,
709 { "Selected Animation Number", "ar_drone.anim.num",
710 FT_STRING, BASE_NONE,
711 NULL, 0x0,
712 "Movement(Animation) to Play", HFILL }
714 { &hf_ANIM_sec,
715 { "Animation Duration (seconds)", "ar_drone.anim.sec",
716 FT_STRING, BASE_NONE,
717 NULL, 0x0,
718 "Movement(Animation) Time in Seconds", HFILL }
720 { &hf_CTRL_seq,
721 { "Sequence Number", "ar_drone.ctrl.seq",
722 FT_STRING, BASE_NONE,
723 NULL, 0x0,
724 NULL, HFILL }
726 { &hf_CTRL_mode,
727 { "Control Mode", "ar_drone.ctrl.mode",
728 FT_STRING, BASE_NONE,
729 NULL, 0x0,
730 NULL, HFILL }
732 { &hf_CTRL_fsize,
733 { "Firmware Update File Size (0 for no update)", "ar_drone.ctrl.filesize",
734 FT_STRING, BASE_NONE,
735 NULL, 0x0,
736 NULL, HFILL }
740 /* Setup protocol subtree array */
741 static int *ett[] = {
742 &ett_ar_drone,
743 &ett_PCMD,
744 &ett_REF,
745 &ett_FTRIM,
746 &ett_CONFIG,
747 &ett_CONFIG_ID,
748 &ett_COMWDG,
749 &ett_LED,
750 &ett_ANIM,
751 &ett_CTRL
754 static ei_register_info ei[] = {
755 { &ei_NO_COMMA, { "ar_drone.no_comma", PI_MALFORMED, PI_ERROR, "Comma delimiter not found", EXPFILL }},
756 { &ei_NO_CR, { "ar_drone.no_cr", PI_MALFORMED, PI_ERROR, "Carriage return delimiter (0x0d) not found", EXPFILL }},
759 expert_module_t* expert_drone;
761 /* Setup protocol info */
762 proto_ar_drone = proto_register_protocol("AR Drone Packet", "AR Drone", "ar_drone");
763 ar_drone_handle = register_dissector("ar_drone", dissect_ar_drone, proto_ar_drone);
765 proto_register_field_array(proto_ar_drone, hf, array_length(hf));
766 proto_register_subtree_array(ett, array_length(ett));
768 expert_drone = expert_register_protocol(proto_ar_drone);
769 expert_register_field_array(expert_drone, ei, array_length(ei));
772 void
773 proto_reg_handoff_ar_drone(void)
775 heur_dissector_add("udp", dissect_ar_drone_heur, "AR Drone over UDP", "ar_drone_udp", proto_ar_drone, HEURISTIC_ENABLE);
776 dissector_add_for_decode_as_with_preference("udp.port", ar_drone_handle);
780 * Editor modelines - https://www.wireshark.org/tools/modelines.html
782 * Local variables:
783 * c-basic-offset: 4
784 * tab-width: 8
785 * indent-tabs-mode: nil
786 * End:
788 * vi: set shiftwidth=4 tabstop=8 expandtab:
789 * :indentSize=4:tabSize=8:noTabs=true: