Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-kdsp.c
blobc5322325856b80c57ab29287d04353543c9454da
1 /* packet-kdsp.c
2 * Routines for Kismet Drone/Server Protocol packet disassembly
3 * By Kyle Feuz <kyle.feuz@aggiemail.usu.edu>
4 * Copyright 2011 Kyle Feuz
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include "config.h"
15 #include <epan/packet.h>
16 #include <epan/expert.h>
17 #include "packet-tcp.h"
19 void proto_register_kdsp(void);
20 void proto_reg_handoff_kdsp(void);
22 static dissector_handle_t kdsp_handle;
24 #define KDSP_PORT 2502 /* Not IANA registered */
25 #define FRAME_HEADER_LEN 12
27 #define HELLO 1
28 #define STRING 2
29 #define CAPPACKET 3
30 #define CHANNELSET 4
31 #define SOURCE 5
32 #define REPORT 6
34 #define CPT_FLAG 0x80000000
35 #define FCS_FLAG 0x00000004
36 #define GPS_FLAG 0x00000002
37 #define RADIO_FLAG 0x00000001
39 #define RADIO_ACCURACY_FLAG 0x000000
40 #define RADIO_FREQ_MHZ_FLAG 0x000000
41 #define RADIO_SIGNAL_DBM_FLAG 0x000000
42 #define RADIO_NOISE_DBM_FLAG 0x000000
43 #define RADIO_CARRIER_FLAG 0x000000
44 #define RADIO_ENCODING_FLAG 0x000000
45 #define RADIO_DATARATE_FLAG 0x000000
46 #define RADIO_SIGNAL_RSSI_FLAG 0x000000
47 #define RADIO_NOISE_RSSI_FLAG 0x000000
49 #define GPS_FIX_FLAG 0x000000
50 #define GPS_LAT_FLAG 0x000000
51 #define GPS_LON_FLAG 0x000000
52 #define GPS_ALT_FLAG 0x000000
53 #define GPS_SPD_FLAG 0x000000
54 #define GPS_HEADING_FLAG 0x000000
56 #define DATA_UUID_FLAG 0x00000010
57 #define DATA_PACKLEN_FLAG 0x00000008
58 #define DATA_TVSEC_FLAG 0x00000004
59 #define DATA_TVUSEC_FLAG 0x00000002
60 #define DATA_DLT_FLAG 0x00000001
62 #define CH_UUID_FLAG 0x00000001
63 #define CH_CMD_FLAG 0x00000002
64 #define CH_CURCH_FLAG 0x00000004
65 #define CH_HOP_FLAG 0x00000008
66 #define CH_NUMCH_FLAG 0x00000010
67 #define CH_CHANNELS_FLAG 0x00000020
68 #define CH_DWELL_FLAG 0x00000040
69 #define CH_RATE_FLAG 0x00000080
70 #define CH_HOPDWELL_FLAG 0x00000100
72 #define SRC_UUID_FLAG 0x00000001
73 #define SRC_INVALID_FLAG 0x00000002
74 #define SRC_NAMESTR_FLAG 0x00000004
75 #define SRC_INTSTR_FLAG 0x00000008
76 #define SRC_TYPESTR_FLAG 0x00000010
77 #define SRC_HOP_FLAG 0x00000020
78 #define SRC_DWELL_FLAG 0x00000040
79 #define SRC_RATE_FLAG 0x00000080
81 #define REPORT_UUID_FLAG 0x000000
82 #define REPORT_FLAGS_FLAG 0x000000
83 #define REPORT_HOP_TM_SEC_FLAG 0x000000
84 #define REPORT_HOP_TM_USEC_FLAG 0x000000
86 #define DATALINK_WLAN 0x69
87 #define DATALINK_RADIOTAP 0x7F
89 static int proto_kdsp;
91 static dissector_table_t subdissector_dlt_table;
93 static const value_string packettypenames[] = {
94 {0, "NULL"},
95 {1, "HELLO"},
96 {2, "STRING"},
97 {3, "CAPPACKET"},
98 {4, "CHANNELSET"},
99 {5, "SOURCE"},
100 {6, "REPORT"},
101 {0, NULL}
104 static const value_string payloadtypenames[] = {
105 {DATALINK_WLAN, "802.11"},
106 {DATALINK_RADIOTAP, "RADIOTAP"},
107 {0, NULL}
110 static const value_string channelcmds[] = {
111 {0, "NONE"},
112 {1, "SET HOP"},
113 {2, "SET VECTOR"},
114 {3, "SET CURRENT"},
115 {4, "SET HOP/DWELL"},
116 {0, NULL}
120 static int hf_kdsp_sentinel;
121 static int hf_kdsp_cmdnum;
122 static int hf_kdsp_length;
124 static int hf_kdsp_version;
125 static int hf_kdsp_server_version;
126 static int hf_kdsp_hostname;
128 static int hf_kdsp_str_flags;
129 static int hf_kdsp_str_len;
130 static int hf_kdsp_str_msg;
132 static int hf_kdsp_cpt_bitmap;
133 static int hf_kdsp_cpt_flag_cpt;
134 static int hf_kdsp_cpt_flag_fcs;
135 static int hf_kdsp_cpt_flag_gps;
136 static int hf_kdsp_cpt_flag_radio;
137 static int hf_kdsp_cpt_offset;
139 static int hf_kdsp_fcs;
140 static int hf_kdsp_fcs_data;
142 static int hf_kdsp_radio_hdr;
143 static int hf_kdsp_radio_hdr_len;
144 static int hf_kdsp_radio_content_bitmap;
145 static int hf_kdsp_radio_accuracy;
146 static int hf_kdsp_radio_freq_mhz;
147 static int hf_kdsp_radio_signal_dbm;
148 static int hf_kdsp_radio_noise_dbm;
149 static int hf_kdsp_radio_carrier;
150 static int hf_kdsp_radio_encoding;
151 static int hf_kdsp_radio_datarate;
152 static int hf_kdsp_radio_signal_rssi;
153 static int hf_kdsp_radio_noise_rssi;
155 static int hf_kdsp_gps_hdr;
156 static int hf_kdsp_gps_hdr_len;
157 static int hf_kdsp_gps_content_bitmap;
158 static int hf_kdsp_gps_fix;
159 static int hf_kdsp_gps_lat;
160 static int hf_kdsp_gps_lon;
161 static int hf_kdsp_gps_alt;
162 static int hf_kdsp_gps_spd;
163 static int hf_kdsp_gps_heading;
165 static int hf_kdsp_cpt_data_hdr;
166 static int hf_kdsp_cpt_data_hdr_len;
167 static int hf_kdsp_cpt_data_content_bitmap;
168 static int hf_kdsp_cpt_dc_flag_uuid;
169 static int hf_kdsp_cpt_dc_flag_len;
170 static int hf_kdsp_cpt_dc_flag_sec;
171 static int hf_kdsp_cpt_dc_flag_usec;
172 static int hf_kdsp_cpt_dc_flag_dlt;
173 static int hf_kdsp_cpt_uuid;
174 static int hf_kdsp_cpt_packet_len;
175 static int hf_kdsp_cpt_tv_sec;
176 static int hf_kdsp_cpt_tv_usec;
177 static int hf_kdsp_cpt_dlt;
179 static int hf_kdsp_ch_length;
180 static int hf_kdsp_ch_bitmap;
181 static int hf_kdsp_ch_flag_uuid;
182 static int hf_kdsp_ch_flag_cmd;
183 static int hf_kdsp_ch_flag_curch;
184 static int hf_kdsp_ch_flag_hop;
185 static int hf_kdsp_ch_flag_numch;
186 static int hf_kdsp_ch_flag_channels;
187 static int hf_kdsp_ch_flag_dwell;
188 static int hf_kdsp_ch_flag_rate;
189 static int hf_kdsp_ch_flag_hopdwell;
190 static int hf_kdsp_ch_uuid;
191 static int hf_kdsp_ch_cmd;
192 static int hf_kdsp_ch_cur_ch;
193 static int hf_kdsp_ch_hop;
194 static int hf_kdsp_ch_num_ch;
195 static int hf_kdsp_ch_data;
196 static int hf_kdsp_ch_ch;
197 static int hf_kdsp_ch_dwell;
198 static int hf_kdsp_ch_start;
199 static int hf_kdsp_ch_end;
200 static int hf_kdsp_ch_width;
201 static int hf_kdsp_ch_iter;
202 static int hf_kdsp_ch_rate;
203 static int hf_kdsp_ch_ch_dwell;
205 static int hf_kdsp_source_length;
206 static int hf_kdsp_source_bitmap;
207 static int hf_kdsp_source_uuid;
208 static int hf_kdsp_source_invalidate;
209 static int hf_kdsp_source_name;
210 static int hf_kdsp_source_interface;
211 static int hf_kdsp_source_type;
212 static int hf_kdsp_source_hop;
213 static int hf_kdsp_source_dwell;
214 static int hf_kdsp_source_rate;
216 static int hf_kdsp_report_hdr_len;
217 static int hf_kdsp_report_content_bitmap;
218 static int hf_kdsp_report_uuid;
219 static int hf_kdsp_report_flags;
220 static int hf_kdsp_report_hop_tm_sec;
221 static int hf_kdsp_report_hop_tm_usec;
223 static int ett_kdsp_pdu;
224 static int ett_cpt_bitmap;
225 static int ett_cpt_data_content_bitmap;
226 static int ett_ch_bitmap;
227 static int ett_ch_data;
228 static int ett_sub_fcs;
229 static int ett_sub_radio;
230 static int ett_sub_gps;
231 static int ett_sub_cpt;
233 static expert_field ei_kdsp_payload_expected;
234 static expert_field ei_kdsp_payload_unexpected;
235 static expert_field ei_kdsp_cpt_data_hdr_len;
236 static expert_field ei_kdsp_cmdnum;
238 /* determine PDU length of protocol */
239 static unsigned
240 get_kdsp_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
241 int offset, void *data _U_)
243 return tvb_get_ntohl(tvb, offset+8) + FRAME_HEADER_LEN; /* length is at offset 8 */
246 /* This method dissects fully reassembled messages */
247 static int
248 dissect_kdsp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
250 uint32_t offset = 0;
251 uint32_t command, length, numChan, bitmap, cptbitmap;
252 uint32_t i, datalink_type=0, payload_len;
253 uint16_t type, reported_payload_len=0, data_hdr_len, data_hdr_len_check;
254 proto_item *kdsp_item, *sub_item, *subsub_item, *data_len_item, *command_item;
255 proto_tree *kdsp_tree, *sub_tree, *subsub_tree;
256 tvbuff_t *payload_tvb;
258 col_set_str(pinfo->cinfo, COL_PROTOCOL, "KDSP");
259 col_clear(pinfo->cinfo, COL_INFO);
261 command = tvb_get_ntohl(tvb, 4);
262 col_add_fstr(pinfo->cinfo, COL_INFO, "Command %s; ",
263 val_to_str(command, packettypenames, "Unknown (0x%02x)"));
264 col_set_fence(pinfo->cinfo, COL_INFO);
266 kdsp_item = proto_tree_add_item(tree, proto_kdsp, tvb, 0, -1, ENC_NA);
267 kdsp_tree = proto_item_add_subtree(kdsp_item, ett_kdsp_pdu);
268 proto_tree_add_item(kdsp_tree, hf_kdsp_sentinel, tvb, offset, 4, ENC_BIG_ENDIAN);
269 offset += 4;
270 command_item = proto_tree_add_item(kdsp_tree, hf_kdsp_cmdnum, tvb, offset, 4, ENC_BIG_ENDIAN);
271 offset += 4;
272 proto_item_append_text(kdsp_item, ", Command %s",
273 val_to_str(command, packettypenames, "Unknown (0x%02x)"));
275 proto_tree_add_item(kdsp_tree, hf_kdsp_length, tvb, offset, 4, ENC_BIG_ENDIAN);
276 length = tvb_get_ntohl(tvb, offset);
277 offset += 4;
279 switch(command)
281 case HELLO:
282 proto_tree_add_item(kdsp_tree, hf_kdsp_version, tvb, offset, 4, ENC_BIG_ENDIAN);
283 offset +=4;
284 proto_tree_add_item(kdsp_tree, hf_kdsp_server_version,
285 tvb, offset, 32, ENC_ASCII);
286 offset +=32;
287 proto_tree_add_item(kdsp_tree, hf_kdsp_hostname, tvb, offset, 32, ENC_ASCII);
288 /*offset +=32;*/
289 break;
290 case STRING:
291 proto_tree_add_item(kdsp_tree, hf_kdsp_str_flags, tvb, offset, 4, ENC_BIG_ENDIAN);
292 offset +=4;
293 proto_tree_add_item(kdsp_tree, hf_kdsp_str_len, tvb, offset, 4, ENC_BIG_ENDIAN);
294 offset +=4;
295 proto_tree_add_item(kdsp_tree, hf_kdsp_str_msg, tvb, offset, -1, ENC_ASCII);
296 break;
297 case CAPPACKET:
298 sub_item = proto_tree_add_item(kdsp_tree, hf_kdsp_cpt_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN);
299 sub_tree = proto_item_add_subtree(sub_item, ett_cpt_bitmap);
300 proto_tree_add_item(sub_tree, hf_kdsp_cpt_flag_cpt, tvb, offset, 4, ENC_BIG_ENDIAN);
301 proto_tree_add_item(sub_tree, hf_kdsp_cpt_flag_fcs, tvb, offset, 4, ENC_BIG_ENDIAN);
302 proto_tree_add_item(sub_tree, hf_kdsp_cpt_flag_gps, tvb, offset, 4, ENC_BIG_ENDIAN);
303 proto_tree_add_item(sub_tree, hf_kdsp_cpt_flag_radio, tvb, offset, 4, ENC_BIG_ENDIAN);
304 bitmap = tvb_get_ntohl(tvb, offset);
305 offset +=4;
306 proto_tree_add_item(kdsp_tree, hf_kdsp_cpt_offset, tvb, offset, 4, ENC_BIG_ENDIAN);
307 offset +=4;
308 if (bitmap & FCS_FLAG) {
309 sub_item = proto_tree_add_item(kdsp_tree, hf_kdsp_fcs, tvb, offset, 4, ENC_NA);
310 sub_tree = proto_item_add_subtree(sub_item, ett_sub_fcs);
312 proto_tree_add_item(sub_tree, hf_kdsp_fcs_data, tvb, offset, 4, ENC_BIG_ENDIAN);
313 offset += 4;
315 if (bitmap & RADIO_FLAG) {
316 sub_item = proto_tree_add_item(kdsp_tree, hf_kdsp_radio_hdr, tvb, offset, 30, ENC_NA);
317 sub_tree = proto_item_add_subtree(sub_item, ett_sub_radio);
319 proto_tree_add_item(sub_tree, hf_kdsp_radio_hdr_len, tvb, offset, 2, ENC_BIG_ENDIAN);
320 offset += 2;
321 proto_tree_add_item(sub_tree, hf_kdsp_radio_content_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN);
322 offset += 4;
323 proto_tree_add_item(sub_tree, hf_kdsp_radio_accuracy, tvb, offset, 2, ENC_BIG_ENDIAN);
324 offset += 2;
325 proto_tree_add_item(sub_tree, hf_kdsp_radio_freq_mhz, tvb, offset, 2, ENC_BIG_ENDIAN);
326 offset += 2;
327 proto_tree_add_item(sub_tree, hf_kdsp_radio_signal_dbm, tvb, offset, 2, ENC_BIG_ENDIAN);
328 offset += 2;
329 proto_tree_add_item(sub_tree, hf_kdsp_radio_noise_dbm, tvb, offset, 2, ENC_BIG_ENDIAN);
330 offset += 2;
331 proto_tree_add_item(sub_tree, hf_kdsp_radio_carrier, tvb, offset, 4, ENC_BIG_ENDIAN);
332 offset += 4;
333 proto_tree_add_item(sub_tree, hf_kdsp_radio_encoding, tvb, offset, 4, ENC_BIG_ENDIAN);
334 offset += 4;
335 proto_tree_add_item(sub_tree, hf_kdsp_radio_datarate, tvb, offset, 4, ENC_BIG_ENDIAN);
336 offset += 4;
337 proto_tree_add_item(sub_tree, hf_kdsp_radio_signal_rssi, tvb, offset, 2, ENC_BIG_ENDIAN);
338 offset += 2;
339 proto_tree_add_item(sub_tree, hf_kdsp_radio_noise_rssi, tvb, offset, 2, ENC_BIG_ENDIAN);
340 offset += 2;
342 if (bitmap & GPS_FLAG) {
343 sub_item = proto_tree_add_item(kdsp_tree, hf_kdsp_gps_hdr, tvb, offset, 68, ENC_NA);
344 sub_tree = proto_item_add_subtree(sub_item, ett_sub_gps);
346 proto_tree_add_item(sub_tree, hf_kdsp_gps_hdr_len, tvb, offset, 2, ENC_BIG_ENDIAN);
347 offset += 2;
348 proto_tree_add_item(sub_tree, hf_kdsp_gps_content_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN);
349 offset += 4;
350 proto_tree_add_item(sub_tree, hf_kdsp_gps_fix, tvb, offset, 2, ENC_BIG_ENDIAN);
351 offset += 2;
352 proto_tree_add_item(sub_tree, hf_kdsp_gps_lat, tvb, offset, 12, ENC_NA);
353 offset += 12;
354 proto_tree_add_item(sub_tree, hf_kdsp_gps_lon, tvb, offset, 12, ENC_NA);
355 offset += 12;
356 proto_tree_add_item(sub_tree, hf_kdsp_gps_alt, tvb, offset, 12, ENC_NA);
357 offset += 12;
358 proto_tree_add_item(sub_tree, hf_kdsp_gps_spd, tvb, offset, 12, ENC_NA);
359 offset += 12;
360 proto_tree_add_item(sub_tree, hf_kdsp_gps_heading, tvb, offset, 12, ENC_NA);
361 offset += 12;
363 if (bitmap & CPT_FLAG) {
364 sub_item = proto_tree_add_item(kdsp_tree, hf_kdsp_cpt_data_hdr, tvb, offset, 44, ENC_NA);
365 sub_tree = proto_item_add_subtree(sub_item, ett_sub_cpt);
367 data_len_item = proto_tree_add_item(sub_tree, hf_kdsp_cpt_data_hdr_len, tvb, offset, 2, ENC_BIG_ENDIAN);
368 data_hdr_len = tvb_get_ntohs(tvb, offset);
369 offset += 2;
371 subsub_item = proto_tree_add_item(sub_tree, hf_kdsp_cpt_data_content_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN);
372 subsub_tree = proto_item_add_subtree(subsub_item, ett_cpt_data_content_bitmap);
373 proto_tree_add_item(subsub_tree, hf_kdsp_cpt_dc_flag_uuid, tvb, offset, 4, ENC_BIG_ENDIAN);
374 proto_tree_add_item(subsub_tree, hf_kdsp_cpt_dc_flag_len, tvb, offset, 4, ENC_BIG_ENDIAN);
375 proto_tree_add_item(subsub_tree, hf_kdsp_cpt_dc_flag_sec, tvb, offset, 4, ENC_BIG_ENDIAN);
376 proto_tree_add_item(subsub_tree, hf_kdsp_cpt_dc_flag_usec, tvb, offset, 4, ENC_BIG_ENDIAN);
377 proto_tree_add_item(subsub_tree, hf_kdsp_cpt_dc_flag_dlt, tvb, offset, 4, ENC_BIG_ENDIAN);
378 cptbitmap = tvb_get_ntohl(tvb, offset);
379 offset += 4;
381 data_hdr_len_check = 6; /* len(len) + len(bitmap) */
382 if (cptbitmap & DATA_UUID_FLAG) data_hdr_len_check += 16;
383 if (cptbitmap & DATA_PACKLEN_FLAG) data_hdr_len_check += 2;
384 if (cptbitmap & DATA_TVSEC_FLAG) data_hdr_len_check += 8;
385 if (cptbitmap & DATA_TVUSEC_FLAG) data_hdr_len_check += 8;
386 if (cptbitmap & DATA_DLT_FLAG) data_hdr_len_check += 4;
388 if (data_hdr_len_check != data_hdr_len) {
389 expert_add_info(pinfo, data_len_item, &ei_kdsp_cpt_data_hdr_len);
392 if (cptbitmap & DATA_UUID_FLAG) {
393 proto_tree_add_item(sub_tree, hf_kdsp_cpt_uuid, tvb, offset, 16, ENC_NA);
394 offset += 16;
396 if (cptbitmap & DATA_PACKLEN_FLAG) {
397 proto_tree_add_item(sub_tree, hf_kdsp_cpt_packet_len, tvb, offset, 2, ENC_BIG_ENDIAN);
398 reported_payload_len = tvb_get_ntohs(tvb, offset);
399 offset += 2;
401 if (cptbitmap & DATA_TVSEC_FLAG) {
402 proto_tree_add_item(sub_tree, hf_kdsp_cpt_tv_sec, tvb, offset, 8, ENC_BIG_ENDIAN);
403 offset += 8;
405 if (cptbitmap & DATA_TVUSEC_FLAG) {
406 proto_tree_add_item(sub_tree, hf_kdsp_cpt_tv_usec, tvb, offset, 8, ENC_BIG_ENDIAN);
407 offset += 8;
409 if (cptbitmap & DATA_DLT_FLAG) {
410 proto_tree_add_item(sub_tree, hf_kdsp_cpt_dlt, tvb, offset, 4, ENC_BIG_ENDIAN);
411 datalink_type = tvb_get_ntohl(tvb, offset);
412 offset += 4;
414 payload_len = (length + FRAME_HEADER_LEN) - offset;
415 if (cptbitmap & DATA_PACKLEN_FLAG) {
416 payload_tvb = tvb_new_subset_length_caplen(tvb, offset, payload_len, reported_payload_len);
417 if (cptbitmap & DATA_DLT_FLAG) {
418 dissector_try_uint(subdissector_dlt_table, datalink_type, payload_tvb, pinfo, tree);
420 /* XXX - Restore protocol column */
421 col_set_str(pinfo->cinfo, COL_PROTOCOL, "KDSP");
423 } else if (payload_len > 0) {
424 proto_tree_add_expert(sub_tree, pinfo, &ei_kdsp_payload_expected, tvb, offset, payload_len);
426 } else if (payload_len > 0) {
427 proto_tree_add_expert(sub_tree, pinfo, &ei_kdsp_payload_unexpected, tvb, offset, payload_len);
430 break;
431 case CHANNELSET:
432 proto_tree_add_item(kdsp_tree, hf_kdsp_ch_length, tvb, offset, 2, ENC_BIG_ENDIAN);
433 offset += 2;
434 sub_item = proto_tree_add_item(kdsp_tree, hf_kdsp_ch_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN);
435 sub_tree = proto_item_add_subtree(sub_item, ett_ch_bitmap);
436 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_uuid, tvb, offset, 4, ENC_BIG_ENDIAN);
437 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_cmd, tvb, offset, 4, ENC_BIG_ENDIAN);
438 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_curch, tvb, offset, 4, ENC_BIG_ENDIAN);
439 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_hop, tvb, offset, 4, ENC_BIG_ENDIAN);
440 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_numch, tvb, offset, 4, ENC_BIG_ENDIAN);
441 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_channels, tvb, offset, 4, ENC_BIG_ENDIAN);
442 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_dwell, tvb, offset, 4, ENC_BIG_ENDIAN);
443 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_rate, tvb, offset, 4, ENC_BIG_ENDIAN);
444 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_hopdwell, tvb, offset, 4, ENC_BIG_ENDIAN);
445 offset += 4;
446 proto_tree_add_item(kdsp_tree, hf_kdsp_ch_uuid, tvb, offset, 16, ENC_NA);
447 offset += 16;
448 proto_tree_add_item(kdsp_tree, hf_kdsp_ch_cmd, tvb, offset, 2, ENC_BIG_ENDIAN);
449 offset += 2;
450 proto_tree_add_item(kdsp_tree, hf_kdsp_ch_cur_ch, tvb, offset, 2, ENC_BIG_ENDIAN);
451 offset += 2;
452 proto_tree_add_item(kdsp_tree, hf_kdsp_ch_hop, tvb, offset, 2, ENC_BIG_ENDIAN);
453 offset += 2;
454 proto_tree_add_item(kdsp_tree, hf_kdsp_ch_num_ch, tvb, offset, 2, ENC_BIG_ENDIAN);
455 numChan = tvb_get_ntohs(tvb, offset);
456 offset += 2;
457 sub_item = proto_tree_add_item(kdsp_tree, hf_kdsp_ch_data, tvb, offset, 2046, ENC_NA);
458 sub_tree = proto_item_add_subtree(sub_item, ett_ch_data);
460 for(i = 0; i<numChan; i++) {
461 type = tvb_get_ntohs(tvb, offset);
462 type = type >> 15;
463 if (!type) {/* Highest bit (1 << 15) == 0 if channel */
464 proto_tree_add_item(sub_tree, hf_kdsp_ch_ch, tvb, offset, 2, ENC_BIG_ENDIAN);
465 offset += 2;
466 proto_tree_add_item(sub_tree, hf_kdsp_ch_dwell, tvb, offset, 2, ENC_BIG_ENDIAN);
467 offset += 6;
469 else{/* Highest bit (1 << 15) == 1 if range */
470 proto_tree_add_item(sub_tree, hf_kdsp_ch_start, tvb, offset, 2, ENC_BIG_ENDIAN);
471 offset += 2;
472 proto_tree_add_item(sub_tree, hf_kdsp_ch_end, tvb, offset, 2, ENC_BIG_ENDIAN);
473 offset += 2;
474 proto_tree_add_item(sub_tree, hf_kdsp_ch_width, tvb, offset, 2, ENC_BIG_ENDIAN);
475 offset += 2;
476 proto_tree_add_item(sub_tree, hf_kdsp_ch_iter, tvb, offset, 2, ENC_BIG_ENDIAN);
477 offset += 2;
480 offset = length+FRAME_HEADER_LEN-4;
481 proto_tree_add_item(kdsp_tree, hf_kdsp_ch_rate, tvb, offset, 2, ENC_BIG_ENDIAN);
482 offset += 2;
483 proto_tree_add_item(kdsp_tree, hf_kdsp_ch_ch_dwell, tvb, offset, 2, ENC_BIG_ENDIAN);
484 /*offset += 2;*/
485 break;
486 case SOURCE:
487 proto_tree_add_item(kdsp_tree, hf_kdsp_source_length, tvb, offset, 2, ENC_BIG_ENDIAN);
488 offset +=2;
489 sub_item = proto_tree_add_item(kdsp_tree, hf_kdsp_ch_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN);
490 sub_tree = proto_item_add_subtree(sub_item, ett_ch_bitmap);
491 proto_tree_add_item(sub_tree, hf_kdsp_ch_flag_uuid, tvb, offset, 4, ENC_BIG_ENDIAN);
492 proto_tree_add_item(kdsp_tree, hf_kdsp_source_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN);
493 offset +=4;
494 proto_tree_add_item(kdsp_tree, hf_kdsp_source_uuid, tvb, offset, 16, ENC_NA);
495 offset += 16;
496 proto_tree_add_item(kdsp_tree, hf_kdsp_source_invalidate, tvb, offset, 2, ENC_BIG_ENDIAN);
497 offset +=2;
498 proto_tree_add_item(kdsp_tree, hf_kdsp_source_name, tvb, offset, 16, ENC_ASCII);
499 offset +=16;
500 proto_tree_add_item(kdsp_tree, hf_kdsp_source_interface, tvb, offset, 16, ENC_ASCII);
501 offset += 16;
502 proto_tree_add_item(kdsp_tree, hf_kdsp_source_type, tvb, offset, 16, ENC_ASCII);
503 offset +=16;
504 proto_tree_add_item(kdsp_tree, hf_kdsp_source_hop, tvb, offset, 1, ENC_BIG_ENDIAN);
505 offset +=1;
506 proto_tree_add_item(kdsp_tree, hf_kdsp_source_dwell, tvb, offset, 2, ENC_BIG_ENDIAN);
507 offset += 2;
508 proto_tree_add_item(kdsp_tree, hf_kdsp_source_rate, tvb, offset, 2, ENC_BIG_ENDIAN);
509 /*offset += 2;*/
510 break;
511 case REPORT:
512 proto_tree_add_item(kdsp_tree, hf_kdsp_report_hdr_len, tvb, offset, 2, ENC_BIG_ENDIAN);
513 offset += 2;
514 proto_tree_add_item(kdsp_tree, hf_kdsp_report_content_bitmap, tvb, offset, 4, ENC_BIG_ENDIAN);
515 offset += 4;
516 proto_tree_add_item(kdsp_tree, hf_kdsp_report_uuid, tvb, offset, 16, ENC_NA);
517 offset += 16;
518 proto_tree_add_item(kdsp_tree, hf_kdsp_report_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
519 offset += 1;
520 proto_tree_add_item(kdsp_tree, hf_kdsp_report_hop_tm_sec, tvb, offset, 4, ENC_BIG_ENDIAN);
521 offset += 4;
522 proto_tree_add_item(kdsp_tree, hf_kdsp_report_hop_tm_usec, tvb, offset, 4, ENC_BIG_ENDIAN);
523 /*offset += 4;*/
524 break;
525 default:
526 expert_add_info(pinfo, command_item, &ei_kdsp_cmdnum);
529 return tvb_captured_length(tvb);
532 static int
533 dissect_kdsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
535 tcp_dissect_pdus(tvb, pinfo, tree, true, FRAME_HEADER_LEN,
536 get_kdsp_message_len, dissect_kdsp_message, data);
537 return tvb_captured_length(tvb);
540 void
541 proto_register_kdsp(void)
543 static hf_register_info hf[] = {
544 { &hf_kdsp_sentinel,
545 { "Sentinel", "kdsp.sentinel",
546 FT_UINT32, BASE_HEX,
547 NULL, 0x0,
548 NULL, HFILL }
550 { &hf_kdsp_cmdnum,
551 { "Command", "kdsp.command",
552 FT_UINT32, BASE_DEC,
553 VALS(packettypenames), 0x0,
554 NULL, HFILL }
556 { &hf_kdsp_length,
557 { "Length", "kdsp.length",
558 FT_UINT32, BASE_DEC,
559 NULL, 0x0,
560 NULL, HFILL }
562 { &hf_kdsp_version,
563 { "KDSP Version", "kdsp.version",
564 FT_UINT32, BASE_DEC,
565 NULL, 0x0,
566 NULL, HFILL }
568 { &hf_kdsp_server_version,
569 { "Server Version", "kdsp.server.version",
570 FT_STRING, BASE_NONE,
571 NULL, 0x0,
572 NULL, HFILL }
574 { &hf_kdsp_hostname,
575 { "Hostname", "kdsp.hostname",
576 FT_STRING, BASE_NONE,
577 NULL, 0x0,
578 NULL, HFILL }
580 { &hf_kdsp_str_flags,
581 { "String Flags", "kdsp.str.flags",
582 FT_UINT32, BASE_HEX,
583 NULL, 0x0,
584 NULL, HFILL }
586 { &hf_kdsp_str_len,
587 { "String Length", "kdsp.str.length",
588 FT_UINT32, BASE_DEC,
589 NULL, 0x0,
590 NULL, HFILL }
592 { &hf_kdsp_str_msg,
593 { "Message", "kdsp.str.message",
594 FT_STRING, BASE_NONE,
595 NULL, 0x0,
596 NULL, HFILL }
598 { &hf_kdsp_cpt_bitmap,
599 { "Bitmap", "kdsp.cpt.bitmap",
600 FT_UINT32, BASE_HEX,
601 NULL, 0x0,
602 NULL, HFILL }
604 { &hf_kdsp_cpt_flag_cpt,
605 { "Capture Packet Flag", "kdsp.cpt.flag.cpt",
606 FT_BOOLEAN, 32,
607 NULL, CPT_FLAG,
608 NULL, HFILL }
610 { &hf_kdsp_cpt_flag_fcs,
611 { "Capture FCS Flag", "kdsp.cpt.flag.fcs",
612 FT_BOOLEAN, 32,
613 NULL, FCS_FLAG,
614 NULL, HFILL }
616 { &hf_kdsp_cpt_flag_gps,
617 { "Capture GPS Flag", "kdsp.cpt.flag.gps",
618 FT_BOOLEAN, 32,
619 NULL, GPS_FLAG,
620 NULL, HFILL }
622 { &hf_kdsp_cpt_flag_radio,
623 { "Capture Radio Flag", "kdsp.cpt.flag.radio",
624 FT_BOOLEAN, 32,
625 NULL, RADIO_FLAG,
626 NULL, HFILL }
628 { &hf_kdsp_cpt_offset,
629 { "Offset Capture Packet Header", "kdsp.cpt.offset",
630 FT_UINT32, BASE_DEC,
631 NULL, 0x0,
632 NULL, HFILL }
634 { &hf_kdsp_fcs,
635 { "Capture FCS Header", "kdsp.fcs",
636 FT_NONE, BASE_NONE,
637 NULL, 0x0,
638 NULL, HFILL }
640 { &hf_kdsp_fcs_data,
641 { "Frame Checksum", "kdsp.fcs.data",
642 FT_UINT32, BASE_HEX,
643 NULL, 0x0,
644 NULL, HFILL }
646 { &hf_kdsp_radio_hdr,
647 { "Capture Radio Header", "kdsp.radio",
648 FT_NONE, BASE_NONE,
649 NULL, 0x0,
650 NULL, HFILL }
652 { &hf_kdsp_radio_hdr_len,
653 { "Length", "kdsp.radio.length",
654 FT_UINT16, BASE_DEC,
655 NULL, 0x0,
656 NULL, HFILL }
658 { &hf_kdsp_radio_content_bitmap,
659 { "Bitmap", "kdsp.radio.bitmap",
660 FT_UINT32, BASE_HEX,
661 NULL, 0x0,
662 NULL, HFILL }
664 { &hf_kdsp_radio_accuracy,
665 { "Accuracy", "kdsp.radio.accuracy",
666 FT_UINT16, BASE_DEC,
667 NULL, 0x0,
668 NULL, HFILL }
670 { &hf_kdsp_radio_freq_mhz,
671 { "Frequency", "kdsp.radio.freq",
672 FT_UINT16, BASE_DEC,
673 NULL, 0x0,
674 NULL, HFILL }
676 { &hf_kdsp_radio_signal_dbm,
677 { "Signal dbm", "kdsp.radio.signal_dbm",
678 FT_INT16, BASE_DEC,
679 NULL, 0x0,
680 NULL, HFILL }
682 { &hf_kdsp_radio_noise_dbm,
683 { "Noise dbm", "kdsp.radio.noise_dbm",
684 FT_INT16, BASE_DEC,
685 NULL, 0x0,
686 NULL, HFILL }
688 { &hf_kdsp_radio_carrier,
689 { "Carrier", "kdsp.radio.car",
690 FT_UINT32, BASE_DEC,
691 NULL, 0x0,
692 NULL, HFILL }
694 { &hf_kdsp_radio_encoding,
695 { "Encoding", "kdsp.radio.enc",
696 FT_UINT32, BASE_DEC,
697 NULL, 0x0,
698 NULL, HFILL }
700 { &hf_kdsp_radio_datarate,
701 { "Data Rate", "kdsp.radio.datarate",
702 FT_UINT32, BASE_DEC,
703 NULL, 0x0,
704 NULL, HFILL }
706 { &hf_kdsp_radio_signal_rssi,
707 { "Signal rssi", "kdsp.radio.signal_rssi",
708 FT_INT16, BASE_DEC,
709 NULL, 0x0,
710 NULL, HFILL }
712 { &hf_kdsp_radio_noise_rssi,
713 { "Noise rssi", "kdsp.radio.noise_rssi",
714 FT_INT16, BASE_DEC,
715 NULL, 0x0,
716 NULL, HFILL }
718 { &hf_kdsp_gps_hdr,
719 { "Capture GPS Header", "kdsp.gps",
720 FT_NONE, BASE_NONE,
721 NULL, 0x0,
722 NULL, HFILL }
724 { &hf_kdsp_gps_hdr_len,
725 { "GPS Length", "kdsp.gps.length",
726 FT_UINT16, BASE_DEC,
727 NULL, 0x0,
728 NULL, HFILL }
730 { &hf_kdsp_gps_content_bitmap,
731 { "Bitmap", "kdsp.gps.bitmap",
732 FT_UINT32, BASE_HEX,
733 NULL, 0x0,
734 NULL, HFILL }
736 { &hf_kdsp_gps_fix,
737 { "GPS fix", "kdsp.gps.fix",
738 FT_UINT32, BASE_DEC,
739 NULL, 0x0,
740 NULL, HFILL }
742 { &hf_kdsp_gps_lat,
743 { "Latitude", "kdsp.gps.lat",
744 FT_NONE, BASE_NONE,
745 NULL, 0x0,
746 NULL, HFILL }
748 { &hf_kdsp_gps_lon,
749 { "Longitude", "kdsp.gps.lon",
750 FT_NONE, BASE_NONE,
751 NULL, 0x0,
752 NULL, HFILL }
754 { &hf_kdsp_gps_alt,
755 { "Alt", "kdsp.gps.alt",
756 FT_NONE, BASE_NONE,
757 NULL, 0x0,
758 NULL, HFILL }
760 { &hf_kdsp_gps_spd,
761 { "Spd", "kdsp.gps.spd",
762 FT_NONE, BASE_NONE,
763 NULL, 0x0,
764 NULL, HFILL }
766 { &hf_kdsp_gps_heading,
767 { "Heading", "kdsp.gps.heading",
768 FT_NONE, BASE_NONE,
769 NULL, 0x0,
770 NULL, HFILL }
772 { &hf_kdsp_cpt_data_hdr,
773 { "Capture Packet Header", "kdsp.cpt",
774 FT_NONE, BASE_NONE,
775 NULL, 0x0,
776 NULL, HFILL }
778 { &hf_kdsp_cpt_data_hdr_len,
779 { "Length", "kdsp.cpt.length",
780 FT_UINT16, BASE_DEC,
781 NULL, 0x0,
782 NULL, HFILL }
784 { &hf_kdsp_cpt_data_content_bitmap,
785 { "Bitmap", "kdsp.cpt.bitmap",
786 FT_UINT32, BASE_HEX,
787 NULL, 0x0,
788 NULL, HFILL }
790 { &hf_kdsp_cpt_dc_flag_uuid,
791 { "Capture Content UUID Flag", "kdsp.cpt.cd.flag.uuid",
792 FT_BOOLEAN, 32,
793 NULL, DATA_UUID_FLAG,
794 NULL, HFILL }
796 { &hf_kdsp_cpt_dc_flag_len,
797 { "Capture Content Length Flag", "kdsp.cpt.cd.flag.len",
798 FT_BOOLEAN, 32,
799 NULL, DATA_PACKLEN_FLAG,
800 NULL, HFILL }
802 { &hf_kdsp_cpt_dc_flag_sec,
803 { "Capture Content Second Flag", "kdsp.cpt.cd.flag.sec",
804 FT_BOOLEAN, 32,
805 NULL, DATA_TVSEC_FLAG,
806 NULL, HFILL }
808 { &hf_kdsp_cpt_dc_flag_usec,
809 { "Capture Content Microsecond Flag", "kdsp.cpt.cd.flag.usec",
810 FT_BOOLEAN, 32,
811 NULL, DATA_TVUSEC_FLAG,
812 NULL, HFILL }
814 { &hf_kdsp_cpt_dc_flag_dlt,
815 { "Capture Content Datalink Type Flag", "kdsp.cpt.cd.flag.dlt",
816 FT_BOOLEAN, 32,
817 NULL, DATA_DLT_FLAG,
818 NULL, HFILL }
820 { &hf_kdsp_cpt_uuid,
821 { "UUID", "kdsp.cpt.uuid",
822 FT_BYTES, BASE_NONE,
823 NULL, 0x0,
824 NULL, HFILL }
826 { &hf_kdsp_cpt_packet_len,
827 { "Packet Length", "kdsp.cpt.pkt_len",
828 FT_UINT16, BASE_DEC,
829 NULL, 0x0,
830 NULL, HFILL }
832 { &hf_kdsp_cpt_tv_sec,
833 { "TV sec", "kdsp.cpt.tv_sec",
834 FT_UINT64, BASE_DEC,
835 NULL, 0x0,
836 NULL, HFILL }
838 { &hf_kdsp_cpt_tv_usec,
839 { "TV usec", "kdsp.cpt.tv_usec",
840 FT_UINT64, BASE_DEC,
841 NULL, 0x0,
842 NULL, HFILL }
844 { &hf_kdsp_cpt_dlt,
845 { "Data Link Type", "kdsp.cpt.dlt",
846 FT_UINT32, BASE_DEC,
847 VALS(payloadtypenames), 0x0,
848 NULL, HFILL }
850 { &hf_kdsp_ch_length,
851 { "Length", "kdsp.chset.length",
852 FT_UINT16, BASE_DEC,
853 NULL, 0x0,
854 NULL, HFILL }
856 { &hf_kdsp_ch_bitmap,
857 { "Bitmap", "kdsp.chset.bitmap",
858 FT_UINT32, BASE_HEX,
859 NULL, 0x0,
860 NULL, HFILL }
862 { &hf_kdsp_ch_flag_uuid,
863 { "UUID Flag", "kdsp.ch.flag.uuid",
864 FT_BOOLEAN, 32,
865 NULL, CH_UUID_FLAG,
866 NULL, HFILL }
868 { &hf_kdsp_ch_flag_cmd,
869 { "Command Flag", "kdsp.ch.flag.cmd",
870 FT_BOOLEAN, 32,
871 NULL, CH_CMD_FLAG,
872 NULL, HFILL }
874 { &hf_kdsp_ch_flag_curch,
875 { "Current Channel Flag", "kdsp.ch.flag.curch",
876 FT_BOOLEAN, 32,
877 NULL, CH_CURCH_FLAG,
878 NULL, HFILL }
880 { &hf_kdsp_ch_flag_hop,
881 { "Hop Flag", "kdsp.ch.flag.hop",
882 FT_BOOLEAN, 32,
883 NULL, CH_HOP_FLAG,
884 NULL, HFILL }
886 { &hf_kdsp_ch_flag_numch,
887 { "Num Channels Flag", "kdsp.ch.flag.numch",
888 FT_BOOLEAN, 32,
889 NULL, CH_NUMCH_FLAG,
890 NULL, HFILL }
892 { &hf_kdsp_ch_flag_channels,
893 { "Channels Flag", "kdsp.ch.flag.channels",
894 FT_BOOLEAN, 32,
895 NULL, CH_CHANNELS_FLAG,
896 NULL, HFILL }
898 { &hf_kdsp_ch_flag_dwell,
899 { "Dwell Flag", "kdsp.ch.flag.dwell",
900 FT_BOOLEAN, 32,
901 NULL, CH_DWELL_FLAG,
902 NULL, HFILL }
904 { &hf_kdsp_ch_flag_rate,
905 { "Rate Flag", "kdsp.ch.flag.rate",
906 FT_BOOLEAN, 32,
907 NULL, CH_RATE_FLAG,
908 NULL, HFILL }
910 { &hf_kdsp_ch_flag_hopdwell,
911 { "Hop-Dwell Flag", "kdsp.ch.flag.hopdwell",
912 FT_BOOLEAN, 32,
913 NULL, CH_HOPDWELL_FLAG,
914 NULL, HFILL }
916 { &hf_kdsp_ch_uuid,
917 { "UUID", "kdsp.chset.uuid",
918 FT_NONE, BASE_NONE,
919 NULL, 0x0,
920 NULL, HFILL }
922 { &hf_kdsp_ch_cmd,
923 { "Command", "kdsp.chset.cmd",
924 FT_UINT16, BASE_DEC,
925 VALS(channelcmds), 0x0,
926 NULL, HFILL }
928 { &hf_kdsp_ch_cur_ch,
929 { "Current Channel", "kdsp.chset.cur_ch",
930 FT_UINT16, BASE_DEC,
931 NULL, 0x0,
932 NULL, HFILL }
934 { &hf_kdsp_ch_hop,
935 { "Channel Hop", "kdsp.chset.hop",
936 FT_UINT16, BASE_DEC,
937 NULL, 0x0,
938 NULL, HFILL }
940 { &hf_kdsp_ch_num_ch,
941 { "Number of Channels", "kdsp.chset.num_ch",
942 FT_UINT16, BASE_DEC,
943 NULL, 0x0,
944 NULL, HFILL }
946 { &hf_kdsp_ch_data,
947 { "Channel Data", "kdsp.chset.data",
948 FT_NONE, BASE_NONE,
949 NULL, 0x0,
950 NULL, HFILL }
952 { &hf_kdsp_ch_ch,
953 { "Channel", "kdsp.chset.ch",
954 FT_UINT16, BASE_DEC,
955 NULL, 0x0,
956 NULL, HFILL }
958 { &hf_kdsp_ch_dwell,
959 { "Dwell", "kdsp.chset.dwell",
960 FT_UINT16, BASE_DEC,
961 NULL, 0x0,
962 NULL, HFILL }
964 { &hf_kdsp_ch_start,
965 { "Start", "kdsp.chset.start",
966 FT_UINT16, BASE_DEC,
967 NULL, 0x0,
968 NULL, HFILL }
970 { &hf_kdsp_ch_end,
971 { "End", "kdsp.chset.end",
972 FT_UINT16, BASE_DEC,
973 NULL, 0x0,
974 NULL, HFILL }
976 { &hf_kdsp_ch_width,
977 { "Width", "kdsp.chset.width",
978 FT_UINT16, BASE_DEC,
979 NULL, 0x0,
980 NULL, HFILL }
982 { &hf_kdsp_ch_iter,
983 { "Iter", "kdsp.chset.iter",
984 FT_UINT16, BASE_DEC,
985 NULL, 0x0,
986 NULL, HFILL }
988 { &hf_kdsp_ch_rate,
989 { "Rate", "kdsp.chset.rate",
990 FT_UINT16, BASE_DEC,
991 NULL, 0x0,
992 NULL, HFILL }
994 { &hf_kdsp_ch_ch_dwell,
995 { "Dwell", "kdsp.chset.dwell",
996 FT_UINT16, BASE_DEC,
997 NULL, 0x0,
998 NULL, HFILL }
1000 { &hf_kdsp_source_length,
1001 { "Length", "kdsp.source.length",
1002 FT_UINT16, BASE_DEC,
1003 NULL, 0x0,
1004 NULL, HFILL }
1006 { &hf_kdsp_source_bitmap,
1007 { "Source Bitmap", "kdsp.source.bitmap",
1008 FT_UINT32, BASE_HEX,
1009 NULL, 0x0,
1010 NULL, HFILL }
1012 { &hf_kdsp_source_uuid,
1013 { "UUID", "kdsp.source.uuid",
1014 FT_NONE, BASE_NONE,
1015 NULL, 0x0,
1016 NULL, HFILL }
1018 { &hf_kdsp_source_invalidate,
1019 { "Source Invalidate", "kdsp.source.invalidate",
1020 FT_UINT16, BASE_HEX,
1021 NULL, 0x0,
1022 NULL, HFILL }
1024 { &hf_kdsp_source_name,
1025 { "Source Name", "kdsp.source.name",
1026 FT_STRING, BASE_NONE,
1027 NULL, 0x0,
1028 NULL, HFILL }
1030 { &hf_kdsp_source_interface,
1031 { "Interface", "kdsp.source.interface",
1032 FT_STRING, BASE_NONE,
1033 NULL, 0x0,
1034 NULL, HFILL }
1036 { &hf_kdsp_source_type,
1037 { "Type", "kdsp.source.type",
1038 FT_STRING, BASE_NONE,
1039 NULL, 0x0,
1040 NULL, HFILL }
1042 { &hf_kdsp_source_hop,
1043 { "Source Hop", "kdsp.source.hop",
1044 FT_UINT8, BASE_DEC,
1045 NULL, 0x0,
1046 NULL, HFILL }
1048 { &hf_kdsp_source_dwell,
1049 { "Source Dwell", "kdsp.source.dwell",
1050 FT_UINT16, BASE_DEC,
1051 NULL, 0x0,
1052 NULL, HFILL }
1054 { &hf_kdsp_source_rate,
1055 { "Source Rate", "kdsp.source.rate",
1056 FT_UINT16, BASE_DEC,
1057 NULL, 0x0,
1058 NULL, HFILL }
1060 { &hf_kdsp_report_hdr_len,
1061 { "Length", "kdsp.report.length",
1062 FT_UINT16, BASE_DEC,
1063 NULL, 0x0,
1064 NULL, HFILL }
1066 { &hf_kdsp_report_content_bitmap,
1067 { "Bitmap", "kdsp.report.bitmap",
1068 FT_UINT32, BASE_HEX,
1069 NULL, 0x0,
1070 NULL, HFILL }
1072 { &hf_kdsp_report_uuid,
1073 { "UUID", "kdsp.report.uuid",
1074 FT_NONE, BASE_NONE,
1075 NULL, 0x0,
1076 NULL, HFILL }
1078 { &hf_kdsp_report_flags,
1079 { "flags", "kdsp.report.flags",
1080 FT_UINT8, BASE_HEX,
1081 NULL, 0x0,
1082 NULL, HFILL }
1084 { &hf_kdsp_report_hop_tm_sec,
1085 { "Hop Time (sec)", "kdsp.report.sec",
1086 FT_UINT32, BASE_DEC,
1087 NULL, 0x0,
1088 NULL, HFILL }
1090 { &hf_kdsp_report_hop_tm_usec,
1091 { "Hop Time (usec)", "kdsp.report.usec",
1092 FT_UINT32, BASE_DEC,
1093 NULL, 0x0,
1094 NULL, HFILL }
1099 /* Setup protocol subtree array */
1100 static int *ett[] = {
1101 &ett_kdsp_pdu,
1102 &ett_cpt_bitmap,
1103 &ett_cpt_data_content_bitmap,
1104 &ett_ch_bitmap,
1105 &ett_ch_data,
1106 &ett_sub_fcs,
1107 &ett_sub_radio,
1108 &ett_sub_gps,
1109 &ett_sub_cpt
1112 static ei_register_info ei[] = {
1113 { &ei_kdsp_payload_expected, { "kdsp.payload_expected", PI_MALFORMED, PI_ERROR, "Payload expected but no link type specified. Can not decode.", EXPFILL }},
1114 { &ei_kdsp_payload_unexpected, { "kdsp.payload_unexpected", PI_MALFORMED, PI_ERROR, "No payload expected but found some data", EXPFILL }},
1115 { &ei_kdsp_cpt_data_hdr_len, { "kdsp.cpt.length.invalid", PI_MALFORMED, PI_ERROR, "Calculated header length does not match reported header length. "
1116 "It is likely the dissector does not support all flags", EXPFILL }},
1117 { &ei_kdsp_cmdnum, { "kdsp.command.unknown", PI_UNDECODED, PI_WARN, "Unknown command, can not parse message", EXPFILL }},
1119 expert_module_t* expert_kdsp;
1121 proto_kdsp = proto_register_protocol("Kismet Drone/Server Protocol", "KDSP", "kdsp");
1123 proto_register_field_array(proto_kdsp, hf, array_length(hf));
1124 proto_register_subtree_array(ett, array_length(ett));
1126 expert_kdsp = expert_register_protocol(proto_kdsp);
1127 expert_register_field_array(expert_kdsp, ei, array_length(ei));
1129 subdissector_dlt_table = register_dissector_table("kdsp.cpt.dlt", "KDSP DLT Type", proto_kdsp, FT_UINT32, BASE_DEC);
1131 kdsp_handle = register_dissector("kdsp", dissect_kdsp, proto_kdsp);
1135 void
1136 proto_reg_handoff_kdsp(void)
1138 dissector_handle_t dlt_handle;
1140 /* XXX - Should be done in respective dissectors? */
1141 dlt_handle = find_dissector("radiotap");
1142 if (dlt_handle)
1143 dissector_add_uint( "kdsp.cpt.dlt", DATALINK_RADIOTAP, dlt_handle);
1145 dlt_handle = find_dissector("wlan");
1146 if (dlt_handle)
1147 dissector_add_uint( "kdsp.cpt.dlt", DATALINK_WLAN, dlt_handle);
1149 dissector_add_uint_with_preference("tcp.port", KDSP_PORT, kdsp_handle);
1153 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1155 * Local variables:
1156 * c-basic-offset: 2
1157 * tab-width: 8
1158 * indent-tabs-mode: nil
1159 * End:
1161 * vi: set shiftwidth=2 tabstop=8 expandtab:
1162 * :indentSize=2:tabSize=8:noTabs=true: