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
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 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.
33 #include <epan/packet.h>
34 #include <epan/prefs.h>
35 #include <epan/expert.h>
37 void proto_register_ar_drone(void);
38 void proto_reg_handoff_ar_drone(void);
40 static guint ar_drone_port
= 0;
42 /* ************************************************ */
43 /* Begin static variable declaration/initialization */
44 /* ************************************************ */
46 /* ar_drone Protocol */
47 static int proto_ar_drone
= -1;
50 static int hf_command
= -1;
51 static int hf_PCMD_id
= -1;
52 static int hf_PCMD_flag
= -1;
53 static int hf_PCMD_roll
= -1;
54 static int hf_PCMD_pitch
= -1;
55 static int hf_PCMD_gaz
= -1;
56 static int hf_PCMD_yaw
= -1;
57 static int hf_REF_id
= -1;
58 static int hf_REF_ctrl
= -1;
59 static int hf_FTRIM_seq
= -1;
60 static int hf_CONFIG_seq
= -1;
61 static int hf_CONFIG_name
= -1;
62 static int hf_CONFIG_val
= -1;
63 static int hf_CONFIG_ID_seq
= -1;
64 static int hf_CONFIG_ID_session
= -1;
65 static int hf_CONFIG_ID_user
= -1;
66 static int hf_CONFIG_ID_app
= -1;
67 static int hf_COMWDG
= -1;
68 static int hf_LED_seq
= -1;
69 static int hf_LED_anim
= -1;
70 static int hf_LED_freq
= -1;
71 static int hf_LED_sec
= -1;
72 static int hf_ANIM_seq
= -1;
73 static int hf_ANIM_anim
= -1;
74 static int hf_ANIM_sec
= -1;
75 static int hf_CTRL_seq
= -1;
76 static int hf_CTRL_mode
= -1;
77 static int hf_CTRL_fsize
= -1;
80 static gint ett_FTRIM
= -1;
81 static gint ett_ar_drone
= -1;
82 static gint ett_PCMD
= -1;
83 static gint ett_REF
= -1;
84 static gint ett_CONFIG
= -1;
85 static gint ett_CONFIG_ID
= -1;
86 static gint ett_COMWDG
= -1;
87 static gint ett_LED
= -1;
88 static gint ett_ANIM
= -1;
89 static gint ett_CTRL
= -1;
91 static expert_field ei_NO_COMMA
= EI_INIT
;
92 static expert_field ei_NO_CR
= EI_INIT
;
95 #if 0 /* TODO: Delete these? Or make use of them? */
96 static const value_string REF_types_vs
[] = {
97 { 0x38323038, "FLYING MODE" },
98 { 0x37393532, "EMERGENCY LANDING" },
99 { 0x37363936, "LANDING MODE" },
102 static const value_string PCMD_flag_vs
[] = {
103 { 0x30 , "DO NOT ALLOW ROLL/PITCH" },
104 { 0x31 , "ALLOW ROLL/PITCH" },
109 static const string_string CTRL_mode_vs
[] = {
110 { "4" , " (CFG_GET_CONTROL_MODE)" },
111 { "5" , " (ACK_CONTROL_MODE)" },
112 { "6" , " (CUSTOM_CFG_GET_CONTROL_MODE)" },
116 /* ********************************************** */
117 /* End static variable declaration/initialization */
118 /* ********************************************** */
120 dissect_ar_drone(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
123 gint master_offset
= 0;
124 proto_item
*ti
, *sub_item
;
125 proto_tree
*ar_tree
, *sub_tree
;
129 if (tvb_length(tvb
) < 4)
132 /* Make sure the packet we're dissecting is a ar_drone packet
133 * Cheap string check for 'AT*'
135 dword
= tvb_get_ntoh24(tvb
,0);
136 if(dword
!= 0x41542a)
139 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "ar_drone");
140 col_set_str(pinfo
->cinfo
, COL_INFO
,"AR Drone Packet");
142 /* Initialize ar_drone Packet tree with subtrees */
143 ti
= proto_tree_add_item(tree
, proto_ar_drone
, tvb
, 0, -1, ENC_NA
);
144 ar_tree
= proto_item_add_subtree(ti
, ett_ar_drone
);
146 while(tvb_reported_length_remaining(tvb
, master_offset
) > 3)
148 /* Get a string to compare our command strings (aka "AT*PCMD", etc.) to */
149 offset
= tvb_find_guint8(tvb
, master_offset
, -1, '=');
150 if (offset
< master_offset
)
151 return master_offset
;
153 command
= tvb_get_string(wmem_packet_scope(), tvb
, master_offset
, offset
-master_offset
);
154 sub_item
= proto_tree_add_string(ar_tree
, hf_command
, tvb
, master_offset
, -1,
155 tvb_get_string(wmem_packet_scope(), tvb
, master_offset
+3, offset
-master_offset
-3));
157 if(!strncmp(command
,"AT*PCMD",7))
159 /** Parse according the PCMD layout: */
161 const char *PCMD_str
;
163 sub_tree
= proto_item_add_subtree(sub_item
, ett_PCMD
);
165 offset
= master_offset
+ 8;
168 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
170 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
173 proto_tree_add_item(sub_tree
, hf_PCMD_id
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
174 offset
+= (length
+ 1);
177 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
179 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
182 proto_tree_add_item(sub_tree
, hf_PCMD_flag
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
183 offset
+= (length
+ 1);
186 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
188 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
191 ti
= proto_tree_add_item(sub_tree
, hf_PCMD_roll
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
193 PCMD_byte
= tvb_get_guint8(tvb
, offset
);
194 if (PCMD_byte
== 0x30)
196 PCMD_str
= " (NO CHANGE)";
198 else if(PCMD_byte
== 0x2d)
200 PCMD_byte
= tvb_get_guint8(tvb
, offset
+ 1);
201 if(PCMD_byte
== 0x30)
203 PCMD_str
= " (NO CHANGE)";
207 PCMD_str
= " (ROLL LEFT)";
212 PCMD_str
= " (ROLL RIGHT)";
214 proto_item_append_string(ti
, PCMD_str
);
215 offset
+= (length
+ 1);
218 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
220 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
223 ti
= proto_tree_add_item(sub_tree
, hf_PCMD_pitch
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
225 PCMD_byte
= tvb_get_guint8(tvb
, offset
);
226 if (PCMD_byte
== 0x30)
228 PCMD_str
= " (NO CHANGE)";
230 else if(PCMD_byte
== 0x2d)
232 PCMD_byte
= tvb_get_guint8(tvb
, offset
+ 1);
233 if(PCMD_byte
== 0x30)
235 PCMD_str
= " (NO CHANGE)";
239 PCMD_str
= " (PITCH FORWARD)";
244 PCMD_str
= " (PITCH BACKWARD)";
246 proto_item_append_string(ti
, PCMD_str
);
247 offset
+= (length
+ 1);
250 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
252 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
255 ti
= proto_tree_add_item(sub_tree
, hf_PCMD_gaz
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
257 PCMD_byte
= tvb_get_guint8(tvb
, offset
);
258 if (PCMD_byte
== 0x30)
260 PCMD_str
= " (NO CHANGE)";
262 else if(PCMD_byte
== 0x2d)
264 PCMD_byte
= tvb_get_guint8(tvb
, offset
+ 1);
265 if(PCMD_byte
== 0x30)
267 PCMD_str
= " (NO CHANGE)";
271 PCMD_str
= " (DECREASE VERT SPEED)";
276 PCMD_str
= " (INCREASE VERT SPEED)";
278 proto_item_append_string(ti
, PCMD_str
);
279 offset
+= (length
+ 1);
282 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
284 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
287 ti
= proto_tree_add_item(sub_tree
, hf_PCMD_yaw
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
289 PCMD_byte
= tvb_get_guint8(tvb
, offset
);
290 if (PCMD_byte
== 0x30)
292 PCMD_str
= " (NO CHANGE)";
294 else if(PCMD_byte
== 0x2d)
296 PCMD_byte
= tvb_get_guint8(tvb
, offset
+ 1);
297 if(PCMD_byte
== 0x30)
299 PCMD_str
= " (NO CHANGE)";
303 PCMD_str
= " (ROTATE LEFT)";
308 PCMD_str
= " (ROTATE RIGHT)";
310 proto_item_append_string(ti
, PCMD_str
);
311 offset
+= (length
+ 1);
313 else if(!strncmp(command
, "AT*REF",6))
315 /** Parse according to the REF layout: */
316 sub_tree
= proto_item_add_subtree(sub_item
, ett_REF
);
318 offset
= master_offset
+ 7;
321 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
323 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
326 proto_tree_add_item(sub_tree
, hf_REF_id
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
327 offset
+= (length
+ 1);
330 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
332 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
335 proto_tree_add_item(sub_tree
, hf_REF_ctrl
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
336 offset
+= (length
+ 1);
338 } else if(!strncmp(command
, "AT*CONFIG_IDS", 13))
340 /** Parse according to the CONFIG_ID layout: */
341 sub_tree
= proto_item_add_subtree(sub_item
, ett_CONFIG_ID
);
343 offset
= master_offset
+ 14;
345 /* Add Sequence Number */
346 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
348 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
351 proto_tree_add_item(sub_tree
, hf_CONFIG_ID_seq
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
352 offset
+= (length
+ 1);
355 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
357 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
360 proto_tree_add_item(sub_tree
, hf_CONFIG_ID_session
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
361 offset
+= (length
+ 1);
364 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
366 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
369 proto_tree_add_item(sub_tree
, hf_CONFIG_ID_user
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
370 offset
+= (length
+ 1);
372 /* Add Application ID */
373 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
375 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
378 proto_tree_add_item(sub_tree
, hf_CONFIG_ID_app
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
379 offset
+= (length
+ 1);
381 } else if(!strncmp(command
, "AT*ANIM", 7))
383 /** Parse according to the ANIM layout: */
384 sub_tree
= proto_item_add_subtree(sub_item
, ett_ANIM
);
386 offset
= master_offset
+ 8;
389 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
391 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
394 proto_tree_add_item(sub_tree
, hf_ANIM_seq
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
395 offset
+= (length
+ 1);
398 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
400 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
403 proto_tree_add_item(sub_tree
, hf_ANIM_anim
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
404 offset
+= (length
+ 1);
406 /* Add animation time(sec) */
407 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
409 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
412 proto_tree_add_item(sub_tree
, hf_ANIM_sec
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
413 offset
+= (length
+ 1);
415 } else if(!strncmp(command
, "AT*FTRIM", 8))
417 /** Parse according to the FTRIM layout: */
418 sub_tree
= proto_item_add_subtree(sub_item
, ett_FTRIM
);
420 offset
= master_offset
+ 9;
422 /* Add sequence number */
423 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
425 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
428 proto_tree_add_text(sub_tree
, tvb
, master_offset
, length
, "(Sets the reference for the horizontal plane)");
429 proto_tree_add_item(sub_tree
, hf_FTRIM_seq
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
430 offset
+= (length
+ 1);
431 } else if(!strncmp(command
, "AT*CONFIG", 9))
433 /** Parse according to the CONFIG layout: */
434 sub_tree
= proto_item_add_subtree(sub_item
, ett_CONFIG
);
436 offset
= master_offset
+ 10;
439 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
441 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
444 proto_tree_add_item(sub_tree
, hf_CONFIG_seq
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
445 offset
+= (length
+ 1);
448 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
450 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
453 proto_tree_add_item(sub_tree
, hf_CONFIG_name
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
454 offset
+= (length
+ 1);
457 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
459 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
462 proto_tree_add_item(sub_tree
, hf_CONFIG_val
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
463 offset
+= (length
+ 1);
465 } else if(!strncmp(command
, "AT*LED", 6))
467 /** Parse according to the LED layout: */
468 sub_tree
= proto_item_add_subtree(sub_item
, ett_LED
);
470 offset
= master_offset
+ 7;
473 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
475 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
478 proto_tree_add_item(sub_tree
, hf_LED_seq
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
479 offset
+= (length
+ 1);
481 /* Add animation to play */
482 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
484 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
487 proto_tree_add_item(sub_tree
, hf_LED_anim
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
488 offset
+= (length
+ 1);
491 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
493 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
496 proto_tree_add_item(sub_tree
, hf_LED_freq
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
497 offset
+= (length
+ 1);
499 /* Add Time to play in sec */
500 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
502 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
505 proto_tree_add_item(sub_tree
, hf_LED_sec
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
506 offset
+= (length
+ 1);
508 } else if(!strncmp(command
, "AT*COMWDG", 9))
510 /** Parse according to the COMWDG layout: */
511 sub_tree
= proto_item_add_subtree(sub_item
, ett_COMWDG
);
513 offset
= master_offset
+ 10;
515 /* Add sequence number */
516 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
518 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
521 proto_tree_add_item(sub_tree
, hf_COMWDG
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
522 offset
+= (length
+ 1);
524 }else if(!strncmp(command
, "AT*CTRL", 7))
526 /** Parse according to the CTRL layout: */
527 sub_tree
= proto_item_add_subtree(sub_item
, ett_CTRL
);
529 offset
= master_offset
+ 8;
532 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
534 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
537 proto_tree_add_item(sub_tree
, hf_CTRL_seq
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
538 offset
+= (length
+ 1);
541 length
= tvb_find_guint8(tvb
, offset
, -1, ',') - offset
;
543 expert_add_info(pinfo
, sub_item
, &ei_NO_COMMA
);
546 ti
= proto_tree_add_item(sub_tree
, hf_CTRL_mode
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
547 proto_item_append_text(ti
, "%s",
548 str_to_str(tvb_get_string(wmem_packet_scope(), tvb
, offset
, length
), CTRL_mode_vs
, " (Unknown Mode)"));
549 offset
+= (length
+ 1);
552 length
= tvb_find_guint8(tvb
, offset
, -1, 0x0d) - offset
;
554 expert_add_info(pinfo
, sub_item
, &ei_NO_CR
);
557 proto_tree_add_item(sub_tree
, hf_CTRL_fsize
, tvb
, offset
, length
, ENC_ASCII
|ENC_NA
);
558 offset
+= (length
+ 1);
562 /* Unknown command, just abort */
563 return master_offset
;
566 proto_item_set_len(sub_item
, offset
-master_offset
);
567 master_offset
= offset
;
570 return master_offset
;
574 proto_register_ar_drone(void)
576 /* Setup protocol header array */
577 static hf_register_info hf
[] = {
579 { "Command", "ar_drone.command",
580 FT_STRING
, BASE_NONE
,
585 { "Sequence Number", "ar_drone.pcmd.id",
586 FT_STRING
, BASE_NONE
,
588 "Progressive Command ID", HFILL
}
591 { "Flag", "ar_drone.pcmd.flag",
592 FT_STRING
, BASE_NONE
,
593 NULL
/*VALS(PCMD_flag_vs)*/, 0x0,
594 "Progressive Command Flag", HFILL
}
597 { "Roll", "ar_drone.pcmd.roll",
598 FT_STRING
, BASE_NONE
,
600 "Progressive Command Roll", HFILL
}
603 { "Pitch", "ar_drone.pcmd.pitch",
604 FT_STRING
, BASE_NONE
,
606 "Progressive Command Pitch", HFILL
}
609 { "Gaz", "ar_drone.pcmd.gaz",
610 FT_STRING
, BASE_NONE
,
612 "Progressive Command Gaz", HFILL
}
615 { "Yaw", "ar_drone.pcmd.yaw",
616 FT_STRING
, BASE_NONE
,
618 "Progressive Command Yaw", HFILL
}
621 { "Sequence Number", "ar_drone.ref.id",
622 FT_STRING
, BASE_NONE
,
624 "Reference ID", HFILL
}
627 { "Control Command", "ar_drone.ref.ctrl",
628 FT_STRING
, BASE_NONE
,
629 NULL
/*VALS(REF_types_vs)*/, 0x0,
633 { "Sequence Number", "ar_drone.ftrim.seq",
634 FT_STRING
, BASE_NONE
,
636 "Flap Trim / Horizontal Plane Reference", HFILL
}
639 { "Sequence Number", "ar_drone.configids.seq",
640 FT_STRING
, BASE_NONE
,
642 "Configuration ID sequence number", HFILL
}
644 { &hf_CONFIG_ID_session
,
645 { "Current Session ID", "ar_drone.configids.session",
646 FT_STRING
, BASE_NONE
,
648 "Configuration ID current session ID", HFILL
}
650 { &hf_CONFIG_ID_user
,
651 { "Current User ID", "ar_drone.configids.user",
652 FT_STRING
, BASE_NONE
,
654 "Configuration ID current user ID", HFILL
}
657 { "Current Application ID", "ar_drone.configids.app",
658 FT_STRING
, BASE_NONE
,
660 "Configuration ID current application ID", HFILL
}
663 { "Command WatchDog Request", "ar_drone.comwdg",
664 FT_STRING
, BASE_NONE
,
666 "Command WatchDog Reset request", HFILL
}
669 { "Sequence Number", "ar_drone.config.seq",
670 FT_STRING
, BASE_NONE
,
672 "Configuration Seq Num", HFILL
}
675 { "Option Name", "ar_drone.config.name",
676 FT_STRING
, BASE_NONE
,
681 { "Option Parameter", "ar_drone.config.val",
682 FT_STRING
, BASE_NONE
,
687 { "Sequence Number", "ar_drone.led.seq",
688 FT_STRING
, BASE_NONE
,
690 "LED Sequence Number", HFILL
}
693 { "Selected Animation", "ar_drone.led.anim",
694 FT_STRING
, BASE_NONE
,
696 "Selected LED Animation", HFILL
}
699 { "Animation Frequency", "ar_drone.led.freq",
700 FT_STRING
, BASE_NONE
,
702 "LED Animation Frequency", HFILL
}
705 { "LED Animation Length (Seconds)", "ar_drone.led.sec",
706 FT_STRING
, BASE_NONE
,
708 "LED Anim Length", HFILL
}
711 { "Animation Sequence Number", "ar_drone.anim.seq",
712 FT_STRING
, BASE_NONE
,
714 "Movment(Animation) Sequence #", HFILL
}
717 { "Selected Animation Number", "ar_drone.anim.num",
718 FT_STRING
, BASE_NONE
,
720 "Movment(Animation) to Play", HFILL
}
723 { "Animation Duration (seconds)", "ar_drone.anim.sec",
724 FT_STRING
, BASE_NONE
,
726 "Movment(Animation) Time in Seconds", HFILL
}
729 { "Sequence Number", "ar_drone.ctrl.seq",
730 FT_STRING
, BASE_NONE
,
735 { "Control Mode", "ar_drone.ctrl.mode",
736 FT_STRING
, BASE_NONE
,
741 { "Firmware Update File Size (0 for no update)", "ar_drone.ctrl.filesize",
742 FT_STRING
, BASE_NONE
,
748 /* Setup protocol subtree array */
749 static gint
*ett
[] = {
762 static ei_register_info ei
[] = {
763 { &ei_NO_COMMA
, { "ar_drone.no_comma", PI_MALFORMED
, PI_ERROR
, "Comma delimiter not found", EXPFILL
}},
764 { &ei_NO_CR
, { "ar_drone.no_cr", PI_MALFORMED
, PI_ERROR
, "Carriage return delimiter (0x0d) not found", EXPFILL
}},
768 static expert_field = EI_INIT;
769 static expert_field = EI_INIT;
771 module_t
*drone_module
;
772 expert_module_t
* expert_drone
;
774 /* Setup protocol info */
775 proto_ar_drone
= proto_register_protocol (
776 "AR Drone Packet", /* name */
777 "AR Drone", /* short name */
778 "ar_drone" /* abbrev */
781 proto_register_field_array(proto_ar_drone
, hf
, array_length(hf
));
782 proto_register_subtree_array(ett
, array_length(ett
));
784 expert_drone
= expert_register_protocol(proto_ar_drone
);
785 expert_register_field_array(expert_drone
, ei
, array_length(ei
));
787 drone_module
= prefs_register_protocol(proto_ar_drone
, NULL
);
789 prefs_register_uint_preference(drone_module
, "udp.port",
797 proto_reg_handoff_ar_drone(void)
799 static dissector_handle_t ar_drone_handle
;
800 static guint old_port
= 0;
801 static gboolean initialized
= FALSE
;
803 if (initialized
== FALSE
)
805 ar_drone_handle
= new_create_dissector_handle(dissect_ar_drone
, proto_ar_drone
);
807 heur_dissector_add("udp", dissect_ar_drone
, proto_ar_drone
);
812 /* Register UDP port for dissection */
813 if(old_port
!= 0 && old_port
!= ar_drone_port
)
815 dissector_delete_uint("udp.port", old_port
, ar_drone_handle
);
818 if(ar_drone_port
!= 0 && old_port
!= ar_drone_port
)
820 dissector_add_uint("udp.port", ar_drone_port
, ar_drone_handle
);
823 old_port
= ar_drone_port
;
827 * Editor modelines - http://www.wireshark.org/tools/modelines.html
832 * indent-tabs-mode: nil
835 * vi: set shiftwidth=4 tabstop=4 expandtab:
836 * :indentSize=4:tabSize=4:noTabs=true: