Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-ehs.c
blob88432f12eb809041d4be2b15002c90bb238d88e5
1 /* packet-ehs.c
2 * Routines for "Enhanced HOSC System" (EHS) dissection
3 * Copyright 2000, Scott Hovis scott.hovis@ums.msfc.nasa.gov
4 * Enhanced 2008, Matt Dunkle Matthew.L.Dunkle@nasa.gov
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.com>
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/tfs.h>
18 void proto_register_ehs(void);
19 void proto_reg_handoff_ehs(void);
21 /* Initialize the protocol and registered fields */
22 static int proto_ehs;
24 static int hf_ehs_ph_version;
25 static int hf_ehs_ph_project;
26 static int hf_ehs_ph_support_mode;
27 static int hf_ehs_ph_data_mode;
28 static int hf_ehs_ph_mission;
29 static int hf_ehs_ph_protocol;
31 static int hf_ehs_ph_year; /* numeric year as years since 1900 */
32 static int hf_ehs_ph_jday; /* julian day of year */
33 static int hf_ehs_ph_hour;
34 static int hf_ehs_ph_minute;
35 static int hf_ehs_ph_second;
36 static int hf_ehs_ph_tenths;
38 static int hf_ehs_ph_new_data_flag; /* indicates the time has changed */
39 /* static int hf_ehs_ph_pad1; */
40 static int hf_ehs_ph_hold_flag; /* indicates a hold condition */
41 static int hf_ehs_ph_sign_flag; /* indicates pre-mission, i.e. countdown, time */
43 /* static int hf_ehs_ph_pad2; */
44 /* static int hf_ehs_ph_pad3; */
45 /* static int hf_ehs_ph_pad4; */
47 static int hf_ehs_ph_hosc_packet_size;
49 /* generic ehs secondary header values */
50 static int hf_ehs_sh_version;
51 static int hf_ehs_sh_data_status_bit_5;
52 static int hf_ehs_sh_data_status_bit_4;
53 static int hf_ehs_sh_data_status_bit_3;
54 static int hf_ehs_sh_data_status_bit_2;
55 static int hf_ehs_sh_data_status_bit_1;
56 static int hf_ehs_sh_data_status_bit_0;
58 /* other common remappings of the data status bits specific to certain secondary ehs header values */
59 static int hf_ehs_sh_parent_stream_error; /* data status bit 3 */
60 static int hf_ehs_sh_vcdu_sequence_error; /* data status bit 2 */
61 static int hf_ehs_sh_packet_sequence_error; /* data status bit 1 */
63 /* common ehs secondary header values */
64 static int hf_ehs_sh_vcdu_sequence_number;
65 static int hf_ehs_sh_data_stream_id;
66 /* static int hf_ehs_sh_pdss_reserved_1; */
67 /* static int hf_ehs_sh_pdss_reserved_2; */
68 /* static int hf_ehs_sh_pdss_reserved_3; */
69 static int hf_ehs_sh_gse_pkt_id;
70 static int hf_ehs_sh_payload_vs_core_id;
71 static int hf_ehs_sh_apid;
72 static int hf_ehs_sh_virtual_channel;
73 static int hf_ehs_sh_pdss_reserved_sync;
75 /* tdm ehs secondary header values */
76 static int hf_ehs_sh_tdm_secondary_header_length;
78 static int hf_ehs_sh_tdm_extra_data_packet;
79 static int hf_ehs_sh_tdm_backup_stream_id_number;
80 static int hf_ehs_sh_tdm_end_of_data_flag;
81 static int hf_ehs_sh_tdm_parent_frame_error;
82 static int hf_ehs_sh_tdm_checksum_error;
83 static int hf_ehs_sh_tdm_fixed_value_error;
85 static int hf_ehs_sh_tdm_minor_frame_counter_error;
86 static int hf_ehs_sh_tdm_format_id_error;
87 static int hf_ehs_sh_tdm_bit_slip_error;
88 static int hf_ehs_sh_tdm_sync_error;
89 static int hf_ehs_sh_tdm_aoslos_flag;
90 static int hf_ehs_sh_tdm_override_errors_flag;
91 static int hf_ehs_sh_tdm_data_status;
93 static int hf_ehs_sh_tdm_idq;
94 static int hf_ehs_sh_tdm_cdq;
95 static int hf_ehs_sh_tdm_adq;
96 static int hf_ehs_sh_tdm_data_dq;
97 /* static int hf_ehs_sh_tdm_unused; */
98 static int hf_ehs_sh_tdm_format_id;
100 static int hf_ehs_sh_tdm_major_frame_packet_index;
101 static int hf_ehs_sh_tdm_numpkts_per_major_frame;
102 static int hf_ehs_sh_tdm_num_minor_frames_per_packet;
104 static int hf_ehs_sh_tdm_cntmet_present;
105 static int hf_ehs_sh_tdm_obt_present;
106 static int hf_ehs_sh_tdm_major_frame_status_present;
107 /* static int hf_ehs_sh_tdm_reserved; */
109 static int hf_ehs_sh_tdm_cnt_year; /* numeric year as years since 1900 */
110 static int hf_ehs_sh_tdm_cnt_jday; /* julian day of year */
111 static int hf_ehs_sh_tdm_cnt_hour;
112 static int hf_ehs_sh_tdm_cnt_minute;
113 static int hf_ehs_sh_tdm_cnt_second;
114 static int hf_ehs_sh_tdm_cnt_tenths;
116 static int hf_ehs_sh_tdm_obt_year; /* numeric year as years since 1900 */
117 static int hf_ehs_sh_tdm_obt_jday; /* julian day of year */
118 static int hf_ehs_sh_tdm_obt_hour;
119 static int hf_ehs_sh_tdm_obt_minute;
120 static int hf_ehs_sh_tdm_obt_second;
121 static int hf_ehs_sh_tdm_obt_tenths;
123 static int hf_ehs_sh_tdm_obt_delta_time_flag;
124 static int hf_ehs_sh_tdm_obt_computed_flag;
125 static int hf_ehs_sh_tdm_obt_not_retrieved_flag;
126 /* static int hf_ehs_sh_tdm_obt_reserved; */
127 static int hf_ehs_sh_tdm_obt_source_apid;
129 static int hf_ehs_sh_tdm_num_major_frame_status_words;
131 /* static int hf_ehs_sh_tdm_mjfs_reserved; */
132 static int hf_ehs_sh_tdm_mjfs_parent_frame_error;
133 static int hf_ehs_sh_tdm_mjfs_checksum_error;
134 static int hf_ehs_sh_tdm_mjfs_fixed_value_error;
136 static int hf_ehs_sh_tdm_mnfs_parent_frame_error;
137 static int hf_ehs_sh_tdm_mnfs_data_not_available;
138 static int hf_ehs_sh_tdm_mnfs_checksum_error;
139 static int hf_ehs_sh_tdm_mnfs_fixed_value_error;
140 static int hf_ehs_sh_tdm_mnfs_counter_error;
141 static int hf_ehs_sh_tdm_mnfs_format_id_error;
142 static int hf_ehs_sh_tdm_mnfs_bit_slip_error;
143 static int hf_ehs_sh_tdm_mnfs_sync_error;
145 /* pseudo ehs secondary header values */
146 /* static int hf_ehs_sh_pseudo_unused; */
147 static int hf_ehs_sh_pseudo_workstation_id;
148 static int hf_ehs_sh_pseudo_user_id;
149 static int hf_ehs_sh_pseudo_comp_id;
151 /* data zone values for well known protocol AOS/LOS */
152 static int hf_ehs_dz_aoslos_indicator;
154 /* data zone values for well known protocol UDSM */
155 static int hf_ehs_dz_udsm_ccsds_vs_bpdu;
156 /* static int hf_ehs_dz_udsm_unused1; */
158 /* static int hf_ehs_dz_udsm_unused2; */
160 /* static int hf_ehs_dz_udsm_unused3; */
161 static int hf_ehs_dz_udsm_gse_pkt_id;
162 static int hf_ehs_dz_udsm_payload_vs_core;
163 static int hf_ehs_dz_udsm_apid;
165 static int hf_ehs_dz_udsm_start_time_year;
166 static int hf_ehs_dz_udsm_start_time_jday;
167 static int hf_ehs_dz_udsm_start_time_hour;
168 static int hf_ehs_dz_udsm_start_time_minute;
169 static int hf_ehs_dz_udsm_start_time_second;
171 static int hf_ehs_dz_udsm_stop_time_year;
172 static int hf_ehs_dz_udsm_stop_time_jday;
173 static int hf_ehs_dz_udsm_stop_time_hour;
174 static int hf_ehs_dz_udsm_stop_time_minute;
175 static int hf_ehs_dz_udsm_stop_time_second;
177 /* static int hf_ehs_dz_udsm_unused4; */
179 static int hf_ehs_dz_udsm_num_pkts_xmtd;
181 static int hf_ehs_dz_udsm_num_vcdu_seqerrs;
183 static int hf_ehs_dz_udsm_num_pkt_seqerrs;
185 static int hf_ehs_dz_udsm_num_pktlen_errors;
187 static int hf_ehs_dz_udsm_event;
189 static int hf_ehs_dz_udsm_num_pkts_xmtd_rollover;
192 static dissector_handle_t ehs_handle;
194 /* handle to ccsds packet dissector */
195 static dissector_handle_t ccsds_handle;
197 /* Initialize the subtree pointers */
198 static int ett_ehs;
199 static int ett_ehs_primary_header;
200 static int ett_ehs_secondary_header;
201 static int ett_ehs_data_zone;
202 static int ett_ehs_cnt_time;
203 static int ett_ehs_obt_time;
204 static int ett_ehs_udsm_start_time;
205 static int ett_ehs_udsm_stop_time;
206 static int ett_ehs_ground_receipt_time;
207 static int ett_ehs_major_frame;
208 static int ett_ehs_minor_frame;
210 /* EHS protocol types */
211 typedef enum EHS_Protocol_Type
213 EHS_PROTOCOL__ALL_PROTOCOLS,
214 EHS_PROTOCOL__TDM_TELEMETRY,
215 EHS_PROTOCOL__NASCOM_TELEMETRY,
216 EHS_PROTOCOL__PSEUDO_TELEMETRY,
217 EHS_PROTOCOL__TDS_DATA,
218 EHS_PROTOCOL__TEST_DATA,
219 EHS_PROTOCOL__GSE_DATA,
220 EHS_PROTOCOL__CUSTOM_DATA,
221 EHS_PROTOCOL__HDRS_DQ,
222 EHS_PROTOCOL__CSS,
223 EHS_PROTOCOL__AOS_LOS,
224 EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET,
225 EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET,
226 EHS_PROTOCOL__PDSS_PAYLOAD_BPDU,
227 EHS_PROTOCOL__PDSS_UDSM,
228 EHS_PROTOCOL__PDSS_RPSM,
229 NUMBER_PROTOCOLS = 15
230 } EHS_Protocol_Type_t;
233 /* some basic sizing parameters */
234 enum
236 IP_HEADER_LENGTH = 48,
237 CCSDS_PRIMARY_HEADER_LENGTH = 6,
238 CCSDS_SECONDARY_HEADER_LENGTH = 10,
239 EHS_PRIMARY_HEADER_SIZE = 16,
240 EHS_SECONDARY_HEADER_SIZE = 12
243 /* determine if a ccsds primary header indicates a secondary exists */
244 #define HDR_SECHDR 0x0800
247 static const value_string ehs_primary_header_project[] =
249 { 0, "All" },
250 { 1, "STS" },
251 { 2, "SL" },
252 { 3, "ISS" },
253 { 4, "AXAF" },
254 { 0, NULL }
257 static const value_string ehs_primary_header_support_mode[] =
259 { 0, "All" },
260 { 1, "Flight" },
261 { 2, "Test" },
262 { 3, "Sim" },
263 { 4, "Validation" },
264 { 5, "Development" },
265 { 6, "Training" },
266 { 7, "Offline" },
267 { 0, NULL }
270 static const value_string ehs_primary_header_data_mode[] =
272 { 0, "Unused" },
273 { 1, "Realtime" },
274 { 2, "Dump1" },
275 { 3, "Dump2" },
276 { 4, "Dump3" },
277 { 5, "Playback1" },
278 { 6, "Playback2" },
279 { 7, "Playback3" },
280 { 8, "Playback4" },
281 { 9, "Playback5" },
282 { 10, "Playback6" },
283 { 11, "Playback7" },
284 { 12, "Playback8" },
285 { 13, "Playback9" },
286 { 14, "Playback10" },
287 { 15, "Playback11" },
288 { 16, "Mode Independent" },
289 { 0, NULL }
292 static const value_string ehs_primary_header_protocol[] =
294 { 0, "All" },
295 { 1, "TDM" },
296 { 2, "NASCOM" },
297 { 3, "PSEUDO" },
298 { 4, "Time" },
299 { 5, "Test" },
300 { 6, "GSE" },
301 { 7, "Custom_Data" },
302 { 8, "HDRS_DQ" },
303 { 9, "CSS" },
304 { 10, "AOS_LOS" },
305 { 11, "PDSS_PAYLOAD_CCSDS" },
306 { 12, "PDSS_CORE_CCSDS" },
307 { 13, "PDSS_PAYLOAD_BPDU" },
308 { 14, "PDSS_UDSM" },
309 { 15, "PDSS_RPSM" },
310 { 0, NULL }
313 static const value_string ehs_secondary_header_data_stream_id[] =
315 { 0, "CCSDS" },
316 { 1, "BPDU" },
317 { 0, NULL }
320 static const value_string ehs_secondary_header_payload_vs_core_id[] =
322 { 0, "Core" },
323 { 1, "Payload" },
324 { 0, NULL }
327 static const value_string ehs_secondary_header_tdm_backup_stream_id[] =
329 { 0, "Stream A / KMTS-A" },
330 { 1, "Stream B / KMTS-B" },
331 { 2, "SKR" },
332 { 0, NULL }
335 static const value_string ehs_secondary_header_tdm_end_of_data_flag[] =
337 { 0, "OK" },
338 { 1, "Loss of Clock" },
339 { 2, "Watchdog Timeout" },
340 { 3, "Loss of Sync" },
341 { 0, NULL }
344 static const true_false_string ehs_tfs_secondary_header_tdm_aoslos_flag =
346 "AOS" ,
347 "LOS"
350 static const value_string ehs_secondary_header_tdm_data_status[] =
352 { 0, "OK" },
353 { 1, "Suspect" },
354 { 2, "DQ Failed" },
355 { 3, "No Data" },
356 { 0, NULL }
359 static const value_string ehs_data_zone_aoslos_indicator[] =
361 { 0, "S-band LOS" },
362 { 1, "S-band AOS" },
363 { 2, "Ku-band LOS" },
364 { 3, "Ku-band AOS" },
365 { 0, NULL }
368 static const value_string ehs_data_zone_udsm_ccsds_vs_bpdu[] =
370 { 0, "CCSDS" },
371 { 1, "BPDU" },
372 { 0, NULL }
375 static const value_string ehs_data_zone_udsm_payload_vs_core[] =
377 { 0, "Core" },
378 { 1, "Payload" },
379 { 0, NULL }
382 static const value_string ehs_data_zone_udsm_event[] =
384 { 0, "Undefined" },
385 { 1, "Actual LOS" },
386 { 2, "Scheduled End of Data" },
387 { 3, "Operator Requested" },
388 { 0, NULL }
392 /* function to return EHS secondary header size according to protocol.
393 * the buffer pointer tvb should be pointing to the packets ehs primary
394 * header, and the offset should be set to the start of the ehs secondary
395 * header on input.
397 static int
398 ehs_secondary_header_size ( int protocol, tvbuff_t* tvb, int offset )
400 /* for most protocols the ehs secondary header is a standard size */
401 int size = EHS_SECONDARY_HEADER_SIZE;
403 switch ( protocol )
405 case EHS_PROTOCOL__TDM_TELEMETRY:
406 /* the TDM secondary header size is variable. its value is actually
407 * contained in the first two bytes of the secondary header itself.
409 size = tvb_get_ntohs ( tvb, offset );
410 break;
412 case EHS_PROTOCOL__NASCOM_TELEMETRY:
413 break;
415 case EHS_PROTOCOL__PSEUDO_TELEMETRY:
416 size = 8;
417 break;
419 case EHS_PROTOCOL__TDS_DATA:
420 break;
422 case EHS_PROTOCOL__TEST_DATA:
423 break;
425 case EHS_PROTOCOL__GSE_DATA:
426 size = 16;
427 break;
429 case EHS_PROTOCOL__CUSTOM_DATA:
430 break;
432 case EHS_PROTOCOL__HDRS_DQ:
433 break;
435 case EHS_PROTOCOL__CSS:
436 break;
438 case EHS_PROTOCOL__AOS_LOS:
439 break;
441 case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
442 break;
444 case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
445 break;
447 case EHS_PROTOCOL__PDSS_PAYLOAD_BPDU:
448 break;
450 case EHS_PROTOCOL__PDSS_UDSM:
451 break;
453 case EHS_PROTOCOL__PDSS_RPSM:
454 break;
456 default:
457 break;
460 return size;
465 /* common EHS secondary header dissector */
466 static void
467 common_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
469 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_vcdu_sequence_number, tvb, *offset, 3, ENC_BIG_ENDIAN );
470 *offset += 3;
472 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_stream_id, tvb, *offset, 1, ENC_BIG_ENDIAN );
473 /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pdss_reserved_1, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
474 ++(*offset);
476 /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pdss_reserved_2, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
477 ++(*offset);
479 /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pdss_reserved_3, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
480 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_gse_pkt_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
481 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_payload_vs_core_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
482 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_apid, tvb, *offset, 2, ENC_BIG_ENDIAN );
483 *offset += 2;
485 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_virtual_channel, tvb, *offset, 2, ENC_BIG_ENDIAN );
486 *offset += 2;
488 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pdss_reserved_sync, tvb, *offset, 2, ENC_BIG_ENDIAN );
489 *offset += 2;
494 /* AOS/LOS EHS secondary header dissector */
495 static void
496 aoslos_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
498 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
499 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
500 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
501 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_3, tvb, *offset, 1, ENC_BIG_ENDIAN );
502 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_2, tvb, *offset, 1, ENC_BIG_ENDIAN );
503 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_1, tvb, *offset, 1, ENC_BIG_ENDIAN );
504 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
505 ++(*offset);
507 common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
511 /* payload ccsds secondary header dissector */
512 static void
513 payload_ccsds_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
515 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
516 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
517 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
518 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_3, tvb, *offset, 1, ENC_BIG_ENDIAN );
519 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_vcdu_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
520 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_packet_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
521 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
522 ++(*offset);
524 common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
528 /* core ccsds secondary header dissector */
529 static void
530 core_ccsds_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
532 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
533 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
534 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
535 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_parent_stream_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
536 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_vcdu_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
537 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_packet_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
538 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
539 ++(*offset);
541 common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
545 /* payload bpdu secondary header dissector */
546 static void
547 payload_bpdu_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
549 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
550 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
551 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
552 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_3, tvb, *offset, 1, ENC_BIG_ENDIAN );
553 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_vcdu_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
554 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_1, tvb, *offset, 1, ENC_BIG_ENDIAN );
555 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
556 ++(*offset);
558 common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
562 /* udsm secondary header dissector */
563 static void
564 udsm_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
566 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
567 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
568 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
569 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_3, tvb, *offset, 1, ENC_BIG_ENDIAN );
570 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_2, tvb, *offset, 1, ENC_BIG_ENDIAN );
571 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_1, tvb, *offset, 1, ENC_BIG_ENDIAN );
572 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
573 ++(*offset);
575 common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
579 /* tdm secondary header dissector */
580 static void
581 tdm_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
583 int j;
584 int num_major_frames = 0;
585 int num_minor_frames = 0;
586 int cntmet_present = 0;
587 int obt_present = 0;
588 int mjfs_present = 0;
590 proto_tree* time_tree;
591 proto_item* time_item;
592 int year, jday, hour, minute, second, tenths;
594 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_secondary_header_length, tvb, *offset, 2, ENC_BIG_ENDIAN );
595 *offset += 2;
597 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_extra_data_packet, tvb, *offset, 1, ENC_BIG_ENDIAN );
598 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_backup_stream_id_number, tvb, *offset, 1, ENC_BIG_ENDIAN );
599 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_end_of_data_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
600 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_parent_frame_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
601 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_checksum_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
602 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_fixed_value_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
603 ++(*offset);
605 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_minor_frame_counter_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
606 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_format_id_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
607 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_bit_slip_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
608 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_sync_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
609 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_aoslos_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
610 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_override_errors_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
611 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_data_status, tvb, *offset, 1, ENC_BIG_ENDIAN );
612 ++(*offset);
614 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_idq, tvb, *offset, 2, ENC_BIG_ENDIAN );
615 *offset += 2;
617 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_cdq, tvb, *offset, 2, ENC_BIG_ENDIAN );
618 *offset += 2;
620 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_adq, tvb, *offset, 2, ENC_BIG_ENDIAN );
621 *offset += 2;
623 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_data_dq, tvb, *offset, 2, ENC_BIG_ENDIAN );
624 *offset += 2;
626 /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_unused, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
627 *offset += 2;
629 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_format_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
630 *offset += 2;
632 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_major_frame_packet_index, tvb, *offset, 1, ENC_BIG_ENDIAN );
633 ++(*offset);
635 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_numpkts_per_major_frame, tvb, *offset, 1, ENC_BIG_ENDIAN );
636 ++(*offset);
638 num_minor_frames = 1 + tvb_get_uint8 ( tvb, *offset );
639 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_num_minor_frames_per_packet, tvb, *offset, 1, ENC_BIG_ENDIAN );
640 ++(*offset);
642 cntmet_present = tvb_get_uint8 ( tvb, *offset ) & 0x80;
643 obt_present = tvb_get_uint8 ( tvb, *offset ) & 0x40;
644 mjfs_present = tvb_get_uint8 ( tvb, *offset ) & 0x20;
645 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_cntmet_present, tvb, *offset, 1, ENC_BIG_ENDIAN );
646 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_present, tvb, *offset, 1, ENC_BIG_ENDIAN );
647 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_major_frame_status_present, tvb, *offset, 1, ENC_BIG_ENDIAN );
648 /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_reserved, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
649 ++(*offset);
651 if ( cntmet_present )
653 time_tree = proto_tree_add_subtree(ehs_secondary_header_tree, tvb, *offset, 7, ett_ehs_cnt_time, &time_item, "CNT/MET Time: ");
655 year = tvb_get_uint8 ( tvb, *offset );
656 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_year, tvb, *offset, 1, ENC_BIG_ENDIAN );
657 ++(*offset);
659 jday = tvb_get_ntohs ( tvb, *offset );
660 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_jday, tvb, *offset, 2, ENC_BIG_ENDIAN );
661 *offset += 2;
663 hour = tvb_get_uint8 ( tvb, *offset );
664 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_hour, tvb, *offset, 1, ENC_BIG_ENDIAN );
665 ++(*offset);
667 minute = tvb_get_uint8 ( tvb, *offset );
668 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_minute, tvb, *offset, 1, ENC_BIG_ENDIAN );
669 ++(*offset);
671 second = tvb_get_uint8 ( tvb, *offset );
672 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_second, tvb, *offset, 1, ENC_BIG_ENDIAN );
673 ++(*offset);
675 tenths = tvb_get_uint8 ( tvb, *offset ) >> 4;
676 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_tenths, tvb, *offset, 1, ENC_BIG_ENDIAN );
677 ++(*offset);
679 /* format a more readable time */
680 proto_item_append_text(time_item, "%04d/%03d:%02d:%02d:%02d.%1d", year + 1900, jday, hour, minute, second, tenths );
684 if ( obt_present )
686 time_tree = proto_tree_add_subtree(ehs_secondary_header_tree, tvb, *offset, 7, ett_ehs_obt_time, &time_item, "OBT Time: ");
688 year = tvb_get_uint8 ( tvb, *offset );
689 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_year, tvb, *offset, 1, ENC_BIG_ENDIAN );
690 ++(*offset);
692 jday = tvb_get_ntohs ( tvb, *offset );
693 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_jday, tvb, *offset, 2, ENC_BIG_ENDIAN );
694 *offset += 2;
696 hour = tvb_get_uint8 ( tvb, *offset );
697 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_hour, tvb, *offset, 1, ENC_BIG_ENDIAN );
698 ++(*offset);
700 minute = tvb_get_uint8 ( tvb, *offset );
701 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_minute, tvb, *offset, 1, ENC_BIG_ENDIAN );
702 ++(*offset);
704 second = tvb_get_uint8 ( tvb, *offset );
705 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_second, tvb, *offset, 1, ENC_BIG_ENDIAN );
706 ++(*offset);
708 tenths = tvb_get_uint8 ( tvb, *offset ) >> 4;
709 proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_tenths, tvb, *offset, 1, ENC_BIG_ENDIAN );
710 ++(*offset);
712 /* format a more readable time */
713 proto_item_append_text ( time_item, "%04d/%03d:%02d:%02d:%02d.%1d", year + 1900, jday, hour, minute, second, tenths );
715 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_delta_time_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
716 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_computed_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
717 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_not_retrieved_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
718 /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_reserved, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
719 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_source_apid, tvb, *offset, 1, ENC_BIG_ENDIAN );
722 if ( mjfs_present )
724 num_major_frames = 1 + tvb_get_uint8 ( tvb, *offset );
725 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_num_major_frame_status_words, tvb, *offset, 1, ENC_BIG_ENDIAN );
726 ++(*offset);
728 for ( j=0; j < num_major_frames; ++j )
730 proto_tree* major_tree;
731 static int * const major_fields[] = {
732 /* &hf_ehs_sh_tdm_mjfs_reserved, */
733 &hf_ehs_sh_tdm_mjfs_parent_frame_error,
734 &hf_ehs_sh_tdm_mjfs_checksum_error,
735 &hf_ehs_sh_tdm_mjfs_fixed_value_error,
736 NULL
739 major_tree = proto_tree_add_subtree_format( ehs_secondary_header_tree, tvb, *offset, 1, ett_ehs_major_frame, NULL, "Major Frame Status Byte# %d", j );
740 proto_tree_add_bitmask_list(major_tree, tvb, *offset, 1, major_fields, ENC_BIG_ENDIAN);
741 ++(*offset);
745 for ( j=0; j < num_minor_frames; ++j )
747 proto_tree* minor_tree;
748 static int * const minor_fields[] = {
749 &hf_ehs_sh_tdm_mnfs_parent_frame_error,
750 &hf_ehs_sh_tdm_mnfs_data_not_available,
751 &hf_ehs_sh_tdm_mnfs_checksum_error,
752 &hf_ehs_sh_tdm_mnfs_fixed_value_error,
753 &hf_ehs_sh_tdm_mnfs_counter_error,
754 &hf_ehs_sh_tdm_mnfs_format_id_error,
755 &hf_ehs_sh_tdm_mnfs_bit_slip_error,
756 &hf_ehs_sh_tdm_mnfs_sync_error,
757 NULL
760 minor_tree = proto_tree_add_subtree_format( ehs_secondary_header_tree, tvb, *offset, 1, ett_ehs_minor_frame, NULL, "Minor Frame Status Byte# %d", j );
761 proto_tree_add_bitmask_list(minor_tree, tvb, *offset, 1, minor_fields, ENC_BIG_ENDIAN);
762 ++(*offset);
768 /* pseudo secondary header dissector */
769 static void
770 pseudo_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
772 /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pseudo_unused, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
773 *offset += 2;
775 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pseudo_workstation_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
776 *offset += 2;
778 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pseudo_user_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
779 *offset += 2;
781 proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pseudo_comp_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
782 *offset += 2;
789 /* EHS secondary header dissector */
790 static void
791 ehs_secondary_header_dissector ( int protocol, proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
793 /* the ehs secondary header structure is potentially different for each and every
794 * protocol type, including its size. we support certain protocols but not all.
795 * for those protocols which are not supported we simply increment the offset
796 * and return. support for these other protocols can easily be added at a later
797 * time if and when it becomes necessary to do so. but for right now, we're only
798 * going to dissect those protocols that we work with on a regular basis in pdss.
800 switch ( protocol )
802 case EHS_PROTOCOL__TDM_TELEMETRY:
803 tdm_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
804 break;
806 case EHS_PROTOCOL__NASCOM_TELEMETRY:
807 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
808 break;
810 case EHS_PROTOCOL__PSEUDO_TELEMETRY:
811 pseudo_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
812 break;
814 case EHS_PROTOCOL__TDS_DATA:
815 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
816 break;
818 case EHS_PROTOCOL__TEST_DATA:
819 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
820 break;
822 case EHS_PROTOCOL__GSE_DATA:
823 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
824 break;
826 case EHS_PROTOCOL__CUSTOM_DATA:
827 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
828 break;
830 case EHS_PROTOCOL__HDRS_DQ:
831 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
832 break;
834 case EHS_PROTOCOL__CSS:
835 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
836 break;
838 case EHS_PROTOCOL__AOS_LOS:
839 aoslos_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
840 break;
842 case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
843 payload_ccsds_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
844 break;
846 case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
847 core_ccsds_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
848 break;
850 case EHS_PROTOCOL__PDSS_PAYLOAD_BPDU:
851 payload_bpdu_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
852 break;
854 case EHS_PROTOCOL__PDSS_UDSM:
855 udsm_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
856 break;
858 case EHS_PROTOCOL__PDSS_RPSM:
859 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
860 break;
862 default:
863 *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
864 break;
869 /* AOS/LOS data zone dissector */
870 static void
871 aoslos_data_zone_dissector ( proto_tree* ehs_tree, tvbuff_t* tvb, int* offset, packet_info* pinfo _U_)
873 proto_tree *ehs_data_zone_tree;
875 /* create the data zone tree */
876 ehs_data_zone_tree = proto_tree_add_subtree( ehs_tree, tvb, *offset, tvb_reported_length(tvb) - *offset,
877 ett_ehs_data_zone, NULL, "AOS/LOS Data Zone" );
879 /* since the aos/los EHS packet data zone is well known, format it for display as well
881 * The AOS/LOS packet data zone is only 2 bytes in
882 * length and only 2 bits in the first byte are
883 * meaningful -- Ku band or S band and AOS or LOS
885 * 7-2 - unused
886 * 1-0 - band + AOS/LOS indicator
888 * bit 1 - 0=sband 1=kuband
889 * bit 0 - 0=LOS 1=AOS
891 * 0 00 - sband LOS
892 * 1 01 - sband AOS
893 * 2 10 - kuband LOS
894 * 3 11 - kuband AOS
896 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_aoslos_indicator, tvb, *offset, 1, ENC_BIG_ENDIAN );
897 ++(*offset);
901 /* UDSM data zone dissector */
902 static void
903 udsm_data_zone_dissector ( proto_tree* ehs_tree, tvbuff_t* tvb, int* offset, packet_info* pinfo _U_)
905 proto_tree *ehs_data_zone_tree;
907 proto_tree* time_tree;
908 proto_item* time_item;
909 int year, jday, hour, minute, second;
911 /* create the data zone tree */
912 ehs_data_zone_tree = proto_tree_add_subtree( ehs_tree, tvb, *offset, tvb_reported_length(tvb) - *offset,
913 ett_ehs_data_zone, NULL, "UDSM Data Zone" );
915 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_ccsds_vs_bpdu, tvb, *offset, 1, ENC_BIG_ENDIAN );
916 /* proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_unused1, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
917 ++(*offset);
919 /* proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_unused2, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
920 ++(*offset);
922 /* proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_unused3, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
923 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_gse_pkt_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
924 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_payload_vs_core, tvb, *offset, 2, ENC_BIG_ENDIAN );
925 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_apid, tvb, *offset, 2, ENC_BIG_ENDIAN );
926 *offset += 2;
928 time_tree = proto_tree_add_subtree(ehs_data_zone_tree, tvb, *offset, 7, ett_ehs_udsm_start_time, &time_item, "UDSM Start Time: ");
929 year = tvb_get_uint8 ( tvb, *offset );
930 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_year, tvb, *offset, 1, ENC_BIG_ENDIAN );
931 ++(*offset);
933 jday = tvb_get_ntohs ( tvb, *offset );
934 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_jday, tvb, *offset, 2, ENC_BIG_ENDIAN );
935 *offset += 2;
937 hour = tvb_get_uint8 ( tvb, *offset );
938 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_hour, tvb, *offset, 1, ENC_BIG_ENDIAN );
939 ++(*offset);
941 minute = tvb_get_uint8 ( tvb, *offset );
942 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_minute, tvb, *offset, 1, ENC_BIG_ENDIAN );
943 ++(*offset);
945 second = tvb_get_uint8 ( tvb, *offset );
946 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_second, tvb, *offset, 1, ENC_BIG_ENDIAN );
947 ++(*offset);
949 /* format a more readable time */
950 proto_item_append_text( time_item, "%04d/%03d:%02d:%02d:%02d = UDSM Start Time", year + 1900, jday, hour, minute, second );
952 time_tree = proto_tree_add_subtree(ehs_data_zone_tree, tvb, *offset, 7, ett_ehs_udsm_stop_time, &time_item, "UDSM Stop Time: ");
953 year = tvb_get_uint8 ( tvb, *offset );
954 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_year, tvb, *offset, 1, ENC_BIG_ENDIAN );
955 ++(*offset);
957 jday = tvb_get_ntohs ( tvb, *offset );
958 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_jday, tvb, *offset, 2, ENC_BIG_ENDIAN );
959 *offset += 2;
961 hour = tvb_get_uint8 ( tvb, *offset );
962 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_hour, tvb, *offset, 1, ENC_BIG_ENDIAN );
963 ++(*offset);
965 minute = tvb_get_uint8 ( tvb, *offset );
966 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_minute, tvb, *offset, 1, ENC_BIG_ENDIAN );
967 ++(*offset);
969 second = tvb_get_uint8 ( tvb, *offset );
970 proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_second, tvb, *offset, 1, ENC_BIG_ENDIAN );
971 ++(*offset);
973 /* format a more readable time */
974 proto_item_append_text ( time_item, "%04d/%03d:%02d:%02d:%02d", year + 1900, jday, hour, minute, second );
976 /* proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_unused4, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
977 *offset += 2;
979 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_pkts_xmtd, tvb, *offset, 2, ENC_BIG_ENDIAN );
980 *offset += 2;
982 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_vcdu_seqerrs, tvb, *offset, 2, ENC_BIG_ENDIAN );
983 *offset += 2;
985 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_pkt_seqerrs, tvb, *offset, 2, ENC_BIG_ENDIAN );
986 *offset += 2;
988 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_pktlen_errors, tvb, *offset, 2, ENC_BIG_ENDIAN );
989 *offset += 2;
991 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_event, tvb, *offset, 1, ENC_BIG_ENDIAN );
992 ++(*offset);
994 proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_pkts_xmtd_rollover, tvb, *offset, 1, ENC_BIG_ENDIAN );
995 ++(*offset);
1000 /* data zone dissector */
1001 static void
1002 ehs_data_zone_dissector ( int protocol, proto_tree* ehs_tree, tvbuff_t* tvb, int* offset, packet_info* pinfo )
1004 /* the data zone of certain protocols such as AOS/LOS and UDSM is well known.
1006 switch ( protocol )
1008 case EHS_PROTOCOL__TDM_TELEMETRY:
1009 break;
1011 case EHS_PROTOCOL__NASCOM_TELEMETRY:
1012 break;
1014 case EHS_PROTOCOL__PSEUDO_TELEMETRY:
1015 break;
1017 case EHS_PROTOCOL__TDS_DATA:
1018 break;
1020 case EHS_PROTOCOL__TEST_DATA:
1021 break;
1023 case EHS_PROTOCOL__GSE_DATA:
1024 break;
1026 case EHS_PROTOCOL__CUSTOM_DATA:
1027 break;
1029 case EHS_PROTOCOL__HDRS_DQ:
1030 break;
1032 case EHS_PROTOCOL__CSS:
1033 break;
1035 case EHS_PROTOCOL__AOS_LOS:
1036 aoslos_data_zone_dissector ( ehs_tree, tvb, offset, pinfo );
1037 break;
1039 case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
1040 break;
1042 case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
1043 break;
1045 case EHS_PROTOCOL__PDSS_PAYLOAD_BPDU:
1046 break;
1048 case EHS_PROTOCOL__PDSS_UDSM:
1049 udsm_data_zone_dissector ( ehs_tree, tvb, offset, pinfo );
1050 break;
1052 case EHS_PROTOCOL__PDSS_RPSM:
1053 break;
1055 default:
1056 break;
1061 /* Code to actually dissect the packets */
1062 static int
1063 dissect_ehs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1065 int offset = 0;
1066 uint16_t first_word;
1068 tvbuff_t *new_tvb;
1070 proto_item *ehs_packet;
1071 proto_tree *ehs_tree;
1073 proto_tree* time_tree;
1074 proto_item* time_item;
1075 proto_tree *ehs_primary_header_tree;
1076 proto_tree *ehs_secondary_header_tree;
1078 int protocol;
1079 int year, jday, hour, minute, second, tenths;
1081 col_set_str(pinfo->cinfo, COL_PROTOCOL, "EHS");
1082 col_set_str(pinfo->cinfo, COL_INFO, "EHS");
1084 ehs_packet = proto_tree_add_item ( tree, proto_ehs, tvb, 0, -1, ENC_NA );
1085 ehs_tree = proto_item_add_subtree ( ehs_packet, ett_ehs );
1087 /* build the ehs primary header tree */
1088 ehs_primary_header_tree = proto_tree_add_subtree( ehs_tree, tvb, offset, EHS_PRIMARY_HEADER_SIZE,
1089 ett_ehs_primary_header, NULL, "Primary EHS Header" );
1091 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_version, tvb, offset, 1, ENC_BIG_ENDIAN );
1092 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_project, tvb, offset, 1, ENC_BIG_ENDIAN );
1093 ++offset;
1095 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_support_mode, tvb, offset, 1, ENC_BIG_ENDIAN );
1096 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_data_mode, tvb, offset, 1, ENC_BIG_ENDIAN );
1097 ++offset;
1099 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_mission, tvb, offset, 1, ENC_BIG_ENDIAN );
1100 ++offset;
1102 /* save protocol for use later on */
1103 protocol = tvb_get_uint8 ( tvb, offset );
1104 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_protocol, tvb, offset, 1, ENC_BIG_ENDIAN );
1105 ++offset;
1107 time_tree = proto_tree_add_subtree(ehs_primary_header_tree, tvb, offset, 7, ett_ehs_ground_receipt_time, &time_item, "EHS Ground Receipt Time: ");
1108 year = tvb_get_uint8 ( tvb, offset );
1109 proto_tree_add_item ( time_tree, hf_ehs_ph_year, tvb, offset, 1, ENC_BIG_ENDIAN );
1110 ++offset;
1112 jday = tvb_get_ntohs ( tvb, offset );
1113 proto_tree_add_item ( time_tree, hf_ehs_ph_jday, tvb, offset, 2, ENC_BIG_ENDIAN );
1114 offset += 2;
1116 hour = tvb_get_uint8 ( tvb, offset );
1117 proto_tree_add_item ( time_tree, hf_ehs_ph_hour, tvb, offset, 1, ENC_BIG_ENDIAN );
1118 ++offset;
1120 minute = tvb_get_uint8 ( tvb, offset );
1121 proto_tree_add_item ( time_tree, hf_ehs_ph_minute, tvb, offset, 1, ENC_BIG_ENDIAN );
1122 ++offset;
1124 second = tvb_get_uint8 ( tvb, offset );
1125 proto_tree_add_item ( time_tree, hf_ehs_ph_second, tvb, offset, 1, ENC_BIG_ENDIAN );
1126 ++offset;
1128 tenths = tvb_get_uint8 ( tvb, offset ) >> 4;
1129 proto_tree_add_item ( time_tree, hf_ehs_ph_tenths, tvb, offset, 1, ENC_BIG_ENDIAN );
1131 /* format a more readable ground receipt time string */
1132 proto_item_append_text ( time_item, "%04d/%03d:%02d:%02d:%02d.%1d", year + 1900, jday, hour, minute, second, tenths );
1134 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_new_data_flag, tvb, offset, 1, ENC_BIG_ENDIAN );
1135 /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad1, tvb, offset, 1, ENC_BIG_ENDIAN ); */
1136 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hold_flag, tvb, offset, 1, ENC_BIG_ENDIAN );
1137 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_sign_flag, tvb, offset, 1, ENC_BIG_ENDIAN );
1138 ++offset;
1140 /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad2, tvb, offset, 1, ENC_BIG_ENDIAN ); */
1141 ++offset;
1142 /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad3, tvb, offset, 1, ENC_BIG_ENDIAN ); */
1143 ++offset;
1144 /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad4, tvb, offset, 1, ENC_BIG_ENDIAN ); */
1145 ++offset;
1147 proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hosc_packet_size, tvb, offset, 2, ENC_BIG_ENDIAN );
1148 offset += 2;
1150 /* build the ehs secondary header tree */
1151 ehs_secondary_header_tree = proto_tree_add_subtree( ehs_tree, tvb, offset, ehs_secondary_header_size ( protocol, tvb, offset ),
1152 ett_ehs_secondary_header, NULL, "Secondary EHS Header" );
1154 /* since each protocol can have a different ehs secondary header structure, we will offload
1155 * this processing to lower levels of code so we don't have to insert all of that complexity
1156 * directly inline here, which would no doubt make this difficult to read at best.
1158 ehs_secondary_header_dissector ( protocol, ehs_secondary_header_tree, tvb, &offset );
1160 /* for ccsds protocol types pass the remaining packet off to the ccsds packet dissector */
1161 switch ( protocol )
1163 case EHS_PROTOCOL__TDM_TELEMETRY:
1164 case EHS_PROTOCOL__PSEUDO_TELEMETRY:
1165 case EHS_PROTOCOL__AOS_LOS:
1166 case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
1167 case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
1168 case EHS_PROTOCOL__PDSS_UDSM:
1169 new_tvb = tvb_new_subset_remaining ( tvb, offset);
1170 call_dissector ( ccsds_handle, new_tvb, pinfo, ehs_tree );
1172 /* bump the offset to the data zone area */
1173 first_word = tvb_get_ntohs ( tvb, offset );
1175 offset += CCSDS_PRIMARY_HEADER_LENGTH;
1176 if ( first_word & HDR_SECHDR ) offset += CCSDS_SECONDARY_HEADER_LENGTH;
1177 break;
1180 default:
1181 break;
1184 /* build the ehs data zone tree for well known protocols such as AOS/LOS and UDSM */
1185 ehs_data_zone_dissector ( protocol, ehs_tree, tvb, &offset, pinfo );
1187 return tvb_captured_length(tvb);
1191 /* Register the protocol with Wireshark
1192 * this format is require because a script is used to build the C function
1193 * that calls all the protocol registration.
1195 void
1196 proto_register_ehs(void)
1198 /* Setup list of header fields See Section 1.6.1 for details*/
1199 static hf_register_info hf[] =
1201 /* primary ehs header */
1202 { &hf_ehs_ph_version,
1203 { "Version", "ehs.version",
1204 FT_UINT8, BASE_DEC, NULL, 0xf0,
1205 NULL, HFILL }
1207 { &hf_ehs_ph_project,
1208 { "Project", "ehs.project",
1209 FT_UINT8, BASE_DEC, VALS(ehs_primary_header_project), 0x0f,
1210 NULL, HFILL }
1213 { &hf_ehs_ph_support_mode,
1214 { "Support Mode", "ehs.support_mode",
1215 FT_UINT8, BASE_DEC, VALS(ehs_primary_header_support_mode), 0xf0,
1216 NULL, HFILL }
1218 { &hf_ehs_ph_data_mode,
1219 { "Data Mode", "ehs.data_mode",
1220 FT_UINT8, BASE_DEC, VALS(ehs_primary_header_data_mode), 0x0f,
1221 NULL, HFILL }
1224 { &hf_ehs_ph_mission,
1225 { "Mission", "ehs.mission",
1226 FT_UINT8, BASE_DEC, NULL, 0x0,
1227 NULL, HFILL }
1230 { &hf_ehs_ph_protocol,
1231 { "Protocol", "ehs.protocol",
1232 FT_UINT8, BASE_DEC, VALS(ehs_primary_header_protocol), 0x0,
1233 NULL, HFILL }
1236 { &hf_ehs_ph_year,
1237 { "Years since 1900", "ehs.year",
1238 FT_UINT8, BASE_DEC, NULL, 0x0,
1239 NULL, HFILL }
1242 { &hf_ehs_ph_jday,
1243 { "Julian Day of Year", "ehs.jday",
1244 FT_UINT16, BASE_DEC, NULL, 0x0,
1245 NULL, HFILL }
1248 { &hf_ehs_ph_hour,
1249 { "Hour", "ehs.hour",
1250 FT_UINT8, BASE_DEC, NULL, 0x0,
1251 NULL, HFILL }
1254 { &hf_ehs_ph_minute,
1255 { "Minute", "ehs.minute",
1256 FT_UINT8, BASE_DEC, NULL, 0x0,
1257 NULL, HFILL }
1260 { &hf_ehs_ph_second,
1261 { "Second", "ehs.second",
1262 FT_UINT8, BASE_DEC, NULL, 0x0,
1263 NULL, HFILL }
1266 { &hf_ehs_ph_tenths,
1267 { "Tenths", "ehs.tenths",
1268 FT_UINT8, BASE_DEC, NULL, 0xf0,
1269 NULL, HFILL }
1271 { &hf_ehs_ph_new_data_flag,
1272 { "New Data Flag", "ehs.new_data_flag",
1273 FT_BOOLEAN, 8, NULL, 0x08,
1274 NULL, HFILL }
1276 #if 0
1277 { &hf_ehs_ph_pad1,
1278 { "Pad1", "ehs.pad1",
1279 FT_UINT8, BASE_DEC, NULL, 0x04,
1280 NULL, HFILL }
1282 #endif
1283 { &hf_ehs_ph_hold_flag,
1284 { "Hold Flag", "ehs.hold_flag",
1285 FT_BOOLEAN, 8, NULL, 0x02,
1286 NULL, HFILL }
1288 { &hf_ehs_ph_sign_flag,
1289 { "Sign Flag (1->CDT)", "ehs.sign_flag",
1290 FT_UINT8, BASE_DEC, NULL, 0x01,
1291 NULL, HFILL }
1294 #if 0
1295 { &hf_ehs_ph_pad2,
1296 { "Pad2", "ehs.pad2",
1297 FT_UINT8, BASE_DEC, NULL, 0xff,
1298 NULL, HFILL }
1301 { &hf_ehs_ph_pad3,
1302 { "Pad3", "ehs.pad3",
1303 FT_UINT8, BASE_DEC, NULL, 0xff,
1304 NULL, HFILL }
1307 { &hf_ehs_ph_pad4,
1308 { "Pad4", "ehs.pad4",
1309 FT_UINT8, BASE_DEC, NULL, 0xff,
1310 NULL, HFILL }
1312 #endif
1314 { &hf_ehs_ph_hosc_packet_size,
1315 { "HOSC Packet Size", "ehs.hosc_packet_size",
1316 FT_UINT16, BASE_DEC, NULL, 0x0,
1317 NULL, HFILL }
1321 /* secondary ehs header */
1322 { &hf_ehs_sh_version,
1323 { "Version", "ehs2.version",
1324 FT_UINT8, BASE_DEC, NULL, 0xc0,
1325 NULL, HFILL }
1327 { &hf_ehs_sh_data_status_bit_5,
1328 { "Data Status Bit 5", "ehs2.data_status_bit_5",
1329 FT_UINT8, BASE_DEC, NULL, 0x20,
1330 NULL, HFILL }
1332 { &hf_ehs_sh_data_status_bit_4,
1333 { "Data Status Bit 4", "ehs2.data_status_bit_4",
1334 FT_UINT8, BASE_DEC, NULL, 0x10,
1335 NULL, HFILL }
1337 { &hf_ehs_sh_data_status_bit_3,
1338 { "Data Status Bit 3", "ehs2.data_status_bit_3",
1339 FT_UINT8, BASE_DEC, NULL, 0x08,
1340 NULL, HFILL }
1342 { &hf_ehs_sh_data_status_bit_2,
1343 { "Data Status Bit 2", "ehs2.data_status_bit_2",
1344 FT_UINT8, BASE_DEC, NULL, 0x04,
1345 NULL, HFILL }
1347 { &hf_ehs_sh_data_status_bit_1,
1348 { "Data Status Bit 1", "ehs2.data_status_bit_1",
1349 FT_UINT8, BASE_DEC, NULL, 0x02,
1350 NULL, HFILL }
1352 { &hf_ehs_sh_data_status_bit_0,
1353 { "Data Status Bit 0", "ehs2.data_status_bit_0",
1354 FT_UINT8, BASE_DEC, NULL, 0x01,
1355 NULL, HFILL }
1359 /* other common remappings of the data status bits specific to certain secondary ehs header values */
1360 { &hf_ehs_sh_parent_stream_error,
1361 { "Parent Stream Error", "ehs2.parent_stream_error",
1362 FT_BOOLEAN, 8, NULL, 0x08,
1363 NULL, HFILL }
1365 { &hf_ehs_sh_vcdu_sequence_error,
1366 { "VCDU Sequence Error", "ehs2.vcdu_sequence_error",
1367 FT_BOOLEAN, 8, NULL, 0x04,
1368 NULL, HFILL }
1370 { &hf_ehs_sh_packet_sequence_error,
1371 { "Packet Sequence Error", "ehs2.packet_sequence_error",
1372 FT_UINT8, BASE_DEC, NULL, 0x02,
1373 NULL, HFILL }
1377 /* common ehs secondary header values */
1378 { &hf_ehs_sh_vcdu_sequence_number,
1379 { "VCDU Sequence Number", "ehs2.vcdu_seqno",
1380 FT_UINT24, BASE_DEC, NULL, 0x0,
1381 NULL, HFILL }
1384 { &hf_ehs_sh_data_stream_id,
1385 { "Data Stream ID", "ehs2.data_stream_id",
1386 FT_UINT8, BASE_DEC, VALS(ehs_secondary_header_data_stream_id), 0x80,
1387 NULL, HFILL }
1389 #if 0
1390 { &hf_ehs_sh_pdss_reserved_1,
1391 { "Pdss Reserved 1", "ehs2.pdss_reserved_1",
1392 FT_UINT8, BASE_DEC, NULL, 0x7f,
1393 NULL, HFILL }
1396 { &hf_ehs_sh_pdss_reserved_2,
1397 { "Pdss Reserved 2", "ehs2.pdss_reserved_2",
1398 FT_UINT8, BASE_DEC, NULL, 0xff,
1399 NULL, HFILL }
1402 { &hf_ehs_sh_pdss_reserved_3,
1403 { "Pdss Reserved 3", "ehs2.pdss_reserved_3",
1404 FT_UINT16, BASE_DEC, NULL, 0xe000,
1405 NULL, HFILL }
1407 #endif
1408 { &hf_ehs_sh_gse_pkt_id,
1409 { "GSE Packet ID (1=GSE)", "ehs2.gse_pkt_id",
1410 FT_UINT16, BASE_DEC, NULL, 0x1000,
1411 NULL, HFILL }
1413 { &hf_ehs_sh_payload_vs_core_id,
1414 { "Payload vs Core ID", "ehs2.payload_vs_core_id",
1415 FT_UINT16, BASE_DEC, VALS(ehs_secondary_header_payload_vs_core_id), 0x0800,
1416 NULL, HFILL }
1418 { &hf_ehs_sh_apid,
1419 { "APID", "ehs2.apid",
1420 FT_UINT16, BASE_DEC, NULL, 0x07ff,
1421 NULL, HFILL }
1424 { &hf_ehs_sh_virtual_channel,
1425 { "Virtual Channel", "ehs2.vcid",
1426 FT_UINT16, BASE_DEC, NULL, 0x0,
1427 NULL, HFILL }
1430 { &hf_ehs_sh_pdss_reserved_sync,
1431 { "Pdss Reserved Sync", "ehs2.sync",
1432 FT_UINT16, BASE_HEX, NULL, 0x0,
1433 NULL, HFILL }
1437 /* tdm ehs secondary header values */
1438 { &hf_ehs_sh_tdm_secondary_header_length,
1439 { "Secondary Header Length", "ehs2.tdm_secondary_header_length",
1440 FT_UINT16, BASE_DEC, NULL, 0x0,
1441 NULL, HFILL }
1444 { &hf_ehs_sh_tdm_extra_data_packet,
1445 { "Extra Data Packet", "ehs2.tdm_extra_data_packet",
1446 FT_BOOLEAN, 8, NULL, 0x80,
1447 NULL, HFILL }
1449 { &hf_ehs_sh_tdm_backup_stream_id_number,
1450 { "Backup Stream ID Number", "ehs2.tdm_backup_stream_id_number",
1451 FT_UINT8, BASE_DEC, VALS(ehs_secondary_header_tdm_backup_stream_id), 0x60,
1452 NULL, HFILL }
1454 { &hf_ehs_sh_tdm_end_of_data_flag,
1455 { "End of Data Flag", "ehs2.tdm_end_of_data_flag",
1456 FT_UINT8, BASE_DEC, VALS(ehs_secondary_header_tdm_end_of_data_flag), 0x18,
1457 NULL, HFILL }
1459 { &hf_ehs_sh_tdm_parent_frame_error,
1460 { "Parent Frame Error", "ehs2.tdm_parent_frame_error",
1461 FT_BOOLEAN, 8, NULL, 0x04,
1462 NULL, HFILL }
1464 { &hf_ehs_sh_tdm_checksum_error,
1465 { "Checksum Error", "ehs2.tdm_checksum_error",
1466 FT_BOOLEAN, 8, NULL, 0x02,
1467 NULL, HFILL }
1469 { &hf_ehs_sh_tdm_fixed_value_error,
1470 { "Fixed Value Error", "ehs2.tdm_fixed_value_error",
1471 FT_BOOLEAN, 8, NULL, 0x01,
1472 NULL, HFILL }
1475 { &hf_ehs_sh_tdm_minor_frame_counter_error,
1476 { "Minor Frame Counter Error", "ehs2.tdm_minor_frame_counter_error",
1477 FT_BOOLEAN, 8, NULL, 0x80,
1478 NULL, HFILL }
1480 { &hf_ehs_sh_tdm_format_id_error,
1481 { "Format ID Error", "ehs2.tdm_format_id_error",
1482 FT_BOOLEAN, 8, NULL, 0x40,
1483 NULL, HFILL }
1485 { &hf_ehs_sh_tdm_bit_slip_error,
1486 { "Bit Slip Error", "ehs2.tdm_bit_slip_error",
1487 FT_BOOLEAN, 8, NULL, 0x20,
1488 NULL, HFILL }
1490 { &hf_ehs_sh_tdm_sync_error,
1491 { "Sync Error", "ehs2.tdm_sync_error",
1492 FT_BOOLEAN, 8, NULL, 0x10,
1493 NULL, HFILL }
1495 { &hf_ehs_sh_tdm_aoslos_flag,
1496 { "AOS/LOS Flag", "ehs2.tdm_aoslos_flag",
1497 FT_BOOLEAN, 8, TFS(&ehs_tfs_secondary_header_tdm_aoslos_flag), 0x08,
1498 NULL, HFILL }
1500 { &hf_ehs_sh_tdm_override_errors_flag,
1501 { "Override Errors", "ehs2.tdm_override_errors_flag",
1502 FT_BOOLEAN, 8, NULL, 0x04,
1503 NULL, HFILL }
1505 { &hf_ehs_sh_tdm_data_status,
1506 { "Data Status", "ehs2.tdm_data_status",
1507 FT_UINT8, BASE_DEC, VALS(ehs_secondary_header_tdm_data_status), 0x03,
1508 NULL, HFILL }
1511 { &hf_ehs_sh_tdm_idq,
1512 { "IDQ", "ehs2.tdm_idq",
1513 FT_UINT16, BASE_DEC, NULL, 0x0,
1514 NULL, HFILL }
1517 { &hf_ehs_sh_tdm_cdq,
1518 { "CDQ", "ehs2.tdm_cdq",
1519 FT_UINT16, BASE_DEC, NULL, 0x0,
1520 NULL, HFILL }
1523 { &hf_ehs_sh_tdm_adq,
1524 { "ADQ", "ehs2.tdm_adq",
1525 FT_UINT16, BASE_DEC, NULL, 0x0,
1526 NULL, HFILL }
1529 { &hf_ehs_sh_tdm_data_dq,
1530 { "Data DQ", "ehs2.tdm_data_dq",
1531 FT_UINT16, BASE_DEC, NULL, 0x0,
1532 NULL, HFILL }
1535 #if 0
1536 { &hf_ehs_sh_tdm_unused,
1537 { "Unused", "ehs2.tdm_unused",
1538 FT_UINT16, BASE_DEC, NULL, 0x0,
1539 NULL, HFILL }
1541 #endif
1543 { &hf_ehs_sh_tdm_format_id,
1544 { "Format ID", "ehs2.tdm_format_id",
1545 FT_UINT16, BASE_HEX, NULL, 0x0,
1546 NULL, HFILL }
1549 { &hf_ehs_sh_tdm_major_frame_packet_index,
1550 { "Major Frame Packet Index", "ehs2.tdm_major_frame_packet_index",
1551 FT_UINT8, BASE_DEC, NULL, 0x0,
1552 NULL, HFILL }
1555 { &hf_ehs_sh_tdm_numpkts_per_major_frame,
1556 { "Num Packets per Major Frame", "ehs2.tdm_numpkts_per_major_frame",
1557 FT_UINT8, BASE_DEC, NULL, 0x0,
1558 NULL, HFILL }
1561 { &hf_ehs_sh_tdm_num_minor_frames_per_packet,
1562 { "Num Minor Frames per Packet", "ehs2.tdm_num_minor_frame_per_packet",
1563 FT_UINT8, BASE_DEC, NULL, 0x0,
1564 NULL, HFILL }
1567 { &hf_ehs_sh_tdm_cntmet_present,
1568 { "CNT or MET Present", "ehs2.tdm_cntmet_present",
1569 FT_BOOLEAN, 8, NULL, 0x80,
1570 NULL, HFILL }
1572 { &hf_ehs_sh_tdm_obt_present,
1573 { "OBT Present", "ehs2.tdm_obt_present",
1574 FT_BOOLEAN, 8, NULL, 0x40,
1575 NULL, HFILL }
1577 { &hf_ehs_sh_tdm_major_frame_status_present,
1578 { "Major Frame Status Present", "ehs2.tdm_major_frame_status_present",
1579 FT_BOOLEAN, 8, NULL, 0x20,
1580 NULL, HFILL }
1582 #if 0
1583 { &hf_ehs_sh_tdm_reserved,
1584 { "Reserved", "ehs2.tdm_reserved",
1585 FT_UINT8, BASE_DEC, NULL, 0x1f,
1586 NULL, HFILL }
1588 #endif
1590 { &hf_ehs_sh_tdm_cnt_year,
1591 { "CNT Years since 1900", "ehs2.tdm_cnt_year",
1592 FT_UINT8, BASE_DEC, NULL, 0x0,
1593 NULL, HFILL }
1595 { &hf_ehs_sh_tdm_cnt_jday,
1596 { "CNT Julian Day of Year", "ehs2.tdm_cnt_jday",
1597 FT_UINT16, BASE_DEC, NULL, 0x0,
1598 NULL, HFILL }
1600 { &hf_ehs_sh_tdm_cnt_hour,
1601 { "CNT Hour", "ehs2.tdm_cnt_hour",
1602 FT_UINT8, BASE_DEC, NULL, 0x0,
1603 NULL, HFILL }
1605 { &hf_ehs_sh_tdm_cnt_minute,
1606 { "CNT Minute", "ehs2.tdm_cnt_minute",
1607 FT_UINT8, BASE_DEC, NULL, 0x0,
1608 NULL, HFILL }
1610 { &hf_ehs_sh_tdm_cnt_second,
1611 { "CNT Second", "ehs2.tdm_cnt_second",
1612 FT_UINT8, BASE_DEC, NULL, 0x0,
1613 NULL, HFILL }
1615 { &hf_ehs_sh_tdm_cnt_tenths,
1616 { "CNT Tenths", "ehs2.tdm_cnt_tenths",
1617 FT_UINT8, BASE_DEC, NULL, 0xf0,
1618 NULL, HFILL }
1621 { &hf_ehs_sh_tdm_obt_year,
1622 { "OBT Years since 1900", "ehs2.tdm_cnt_year",
1623 FT_UINT8, BASE_DEC, NULL, 0x0,
1624 NULL, HFILL }
1626 { &hf_ehs_sh_tdm_obt_jday,
1627 { "OBT Julian Day of Year", "ehs2.tdm_cnt_jday",
1628 FT_UINT16, BASE_DEC, NULL, 0x0,
1629 NULL, HFILL }
1631 { &hf_ehs_sh_tdm_obt_hour,
1632 { "OBT Hour", "ehs2.tdm_cnt_hour",
1633 FT_UINT8, BASE_DEC, NULL, 0x0,
1634 NULL, HFILL }
1636 { &hf_ehs_sh_tdm_obt_minute,
1637 { "OBT Minute", "ehs2.tdm_cnt_minute",
1638 FT_UINT8, BASE_DEC, NULL, 0x0,
1639 NULL, HFILL }
1641 { &hf_ehs_sh_tdm_obt_second,
1642 { "OBT Second", "ehs2.tdm_cnt_second",
1643 FT_UINT8, BASE_DEC, NULL, 0x0,
1644 NULL, HFILL }
1646 { &hf_ehs_sh_tdm_obt_tenths,
1647 { "OBT Tenths", "ehs2.tdm_cnt_tenths",
1648 FT_UINT8, BASE_DEC, NULL, 0xf0,
1649 NULL, HFILL }
1652 { &hf_ehs_sh_tdm_obt_delta_time_flag,
1653 { "OBT is Delta Time Instead of GMT", "ehs2.tdm_obt_delta_time_flag",
1654 FT_BOOLEAN, 16, NULL, 0x8000,
1655 NULL, HFILL }
1657 { &hf_ehs_sh_tdm_obt_computed_flag,
1658 { "OBT Computed", "ehs2.tdm_obt_computed_flag",
1659 FT_BOOLEAN, 16, NULL, 0x4000,
1660 NULL, HFILL }
1662 { &hf_ehs_sh_tdm_obt_not_retrieved_flag,
1663 { "OBT Not Retrieved", "ehs2.tdm_obt_not_retrieved_flag",
1664 FT_BOOLEAN, 16, NULL, 0x2000,
1665 NULL, HFILL }
1667 #if 0
1668 { &hf_ehs_sh_tdm_obt_reserved,
1669 { "OBT Reserved", "ehs2.tdm_obt_reserved",
1670 FT_BOOLEAN, 16, NULL, 0x1800,
1671 NULL, HFILL }
1673 #endif
1674 { &hf_ehs_sh_tdm_obt_source_apid,
1675 { "OBT Source APID", "ehs2.tdm_obt_source_apid",
1676 FT_UINT16, BASE_DEC, NULL, 0x07ff,
1677 NULL, HFILL }
1680 { &hf_ehs_sh_tdm_num_major_frame_status_words,
1681 { "Number of Major Frame Status Words", "ehs2.tdm_num_major_frame_status_words",
1682 FT_UINT8, BASE_DEC, NULL, 0x0,
1683 NULL, HFILL }
1686 #if 0
1687 { &hf_ehs_sh_tdm_mjfs_reserved,
1688 { "Reserved", "ehs2.tdm_mjfs_reserved",
1689 FT_UINT8, BASE_DEC, NULL, 0xf8,
1690 NULL, HFILL }
1692 #endif
1693 { &hf_ehs_sh_tdm_mjfs_parent_frame_error,
1694 { "Parent Frame Error", "ehs2.tdm_mjfs_parent_frame_error",
1695 FT_BOOLEAN, 8, NULL, 0x04,
1696 NULL, HFILL }
1698 { &hf_ehs_sh_tdm_mjfs_checksum_error,
1699 { "Checksum Error", "ehs2.tdm_mjfs_checksum_error",
1700 FT_BOOLEAN, 8, NULL, 0x02,
1701 NULL, HFILL }
1703 { &hf_ehs_sh_tdm_mjfs_fixed_value_error,
1704 { "Fixed Value Error", "ehs2.tdm_mjfs_fixed_value_error",
1705 FT_BOOLEAN, 8, NULL, 0x01,
1706 NULL, HFILL }
1709 { &hf_ehs_sh_tdm_mnfs_parent_frame_error,
1710 { "Parent Frame Error", "ehs2.tdm_mnfs_parent_frame_error",
1711 FT_BOOLEAN, 8, NULL, 0x80,
1712 NULL, HFILL }
1714 { &hf_ehs_sh_tdm_mnfs_data_not_available,
1715 { "Data Not Available", "ehs2.tdm_mnfs_data_not_available",
1716 FT_BOOLEAN, 8, NULL, 0x40,
1717 NULL, HFILL }
1719 { &hf_ehs_sh_tdm_mnfs_checksum_error,
1720 { "Checksum Error", "ehs2.tdm_mnfs_checksum_error",
1721 FT_BOOLEAN, 8, NULL, 0x20,
1722 NULL, HFILL }
1724 { &hf_ehs_sh_tdm_mnfs_fixed_value_error,
1725 { "Fixed Value Error", "ehs2.tdm_mnfs_fixed_value_error",
1726 FT_BOOLEAN, 8, NULL, 0x10,
1727 NULL, HFILL }
1729 { &hf_ehs_sh_tdm_mnfs_counter_error,
1730 { "Counter Error", "ehs2.tdm_mnfs_counter_error",
1731 FT_BOOLEAN, 8, NULL, 0x08,
1732 NULL, HFILL }
1734 { &hf_ehs_sh_tdm_mnfs_format_id_error,
1735 { "Format ID Error", "ehs2.tdm_mnfs_format_id_error",
1736 FT_BOOLEAN, 8, NULL, 0x04,
1737 NULL, HFILL }
1739 { &hf_ehs_sh_tdm_mnfs_bit_slip_error,
1740 { "Bit Slip Error", "ehs2.tdm_mnfs_bit_slip_error",
1741 FT_BOOLEAN, 8, NULL, 0x02,
1742 NULL, HFILL }
1744 { &hf_ehs_sh_tdm_mnfs_sync_error,
1745 { "Sync Error", "ehs2.tdm_mnfs_sync_error",
1746 FT_BOOLEAN, 8, NULL, 0x01,
1747 NULL, HFILL }
1751 /* pseudo secondary header */
1752 #if 0
1753 { &hf_ehs_sh_pseudo_unused,
1754 { "Unused", "ehs2.pseudo_unused",
1755 FT_UINT16, BASE_DEC, NULL, 0xffff,
1756 NULL, HFILL }
1758 #endif
1759 { &hf_ehs_sh_pseudo_workstation_id,
1760 { "Workstation ID", "ehs2.pseudo_workstation_id",
1761 FT_UINT16, BASE_DEC, NULL, 0x0,
1762 NULL, HFILL }
1764 { &hf_ehs_sh_pseudo_user_id,
1765 { "User ID", "ehs2.pseudo_user_id",
1766 FT_UINT16, BASE_DEC, NULL, 0x0,
1767 NULL, HFILL }
1769 { &hf_ehs_sh_pseudo_comp_id,
1770 { "Comp ID", "ehs2.pseudo_comp_id",
1771 FT_UINT16, BASE_DEC, NULL, 0x0,
1772 NULL, HFILL }
1776 /* aos/los protocol data zone */
1777 { &hf_ehs_dz_aoslos_indicator,
1778 { "AOS/LOS Indicator", "ehs.dz.aoslos_indicator",
1779 FT_UINT8, BASE_DEC, VALS(ehs_data_zone_aoslos_indicator), 0x03,
1780 NULL, HFILL }
1784 /* udsm protocol data zone */
1785 { &hf_ehs_dz_udsm_ccsds_vs_bpdu,
1786 { "CCSDS vs BPDU", "ehs.dz.udsm_ccsds_vs_bpdu",
1787 FT_UINT8, BASE_DEC, VALS(ehs_data_zone_udsm_ccsds_vs_bpdu), 0x80,
1788 NULL, HFILL }
1790 #if 0
1791 { &hf_ehs_dz_udsm_unused1,
1792 { "Unused 1", "ehs.dz.udsm_unused1",
1793 FT_UINT8, BASE_DEC, NULL, 0x7f,
1794 NULL, HFILL }
1797 { &hf_ehs_dz_udsm_unused2,
1798 { "Unused 2", "ehs.dz.udsm_unused2",
1799 FT_UINT8, BASE_DEC, NULL, 0xff,
1800 NULL, HFILL }
1803 { &hf_ehs_dz_udsm_unused3,
1804 { "Unused 3", "ehs.dz.udsm_unused3",
1805 FT_UINT16, BASE_DEC, NULL, 0xe000,
1806 NULL, HFILL }
1808 #endif
1809 { &hf_ehs_dz_udsm_gse_pkt_id,
1810 { "GSE Pkt ID", "ehs.dz.udsm_gse_pkt_id",
1811 FT_BOOLEAN, 16, NULL, 0x1000,
1812 NULL, HFILL }
1814 { &hf_ehs_dz_udsm_payload_vs_core,
1815 { "Payload vs Core", "ehs.dz.udsm_payload_vs_core",
1816 FT_UINT16, BASE_DEC, VALS(ehs_data_zone_udsm_payload_vs_core), 0x0800,
1817 NULL, HFILL }
1819 { &hf_ehs_dz_udsm_apid,
1820 { "APID", "ehs.dz.udsm_apid",
1821 FT_UINT16, BASE_DEC, NULL, 0x07ff,
1822 NULL, HFILL }
1825 { &hf_ehs_dz_udsm_start_time_year,
1826 { "Start Time Years since 1900", "ehs.dz.udsm_start_time_year",
1827 FT_UINT8, BASE_DEC, NULL, 0x0,
1828 NULL, HFILL }
1830 { &hf_ehs_dz_udsm_start_time_jday,
1831 { "Start Time Julian Day", "ehs.dz.udsm_start_time_jday",
1832 FT_UINT16, BASE_DEC, NULL, 0x0,
1833 NULL, HFILL }
1835 { &hf_ehs_dz_udsm_start_time_hour,
1836 { "Start Time Hour", "ehs.dz.udsm_start_time_hour",
1837 FT_UINT8, BASE_DEC, NULL, 0x0,
1838 NULL, HFILL }
1840 { &hf_ehs_dz_udsm_start_time_minute,
1841 { "Start Time Minute", "ehs.dz.udsm_start_time_minute",
1842 FT_UINT8, BASE_DEC, NULL, 0x0,
1843 NULL, HFILL }
1845 { &hf_ehs_dz_udsm_start_time_second,
1846 { "Start Time Second", "ehs.dz.udsm_start_time_second",
1847 FT_UINT8, BASE_DEC, NULL, 0x0,
1848 NULL, HFILL }
1851 { &hf_ehs_dz_udsm_stop_time_year,
1852 { "Stop Time Years since 1900", "ehs.dz.udsm_stop_time_year",
1853 FT_UINT8, BASE_DEC, NULL, 0x0,
1854 NULL, HFILL }
1856 { &hf_ehs_dz_udsm_stop_time_jday,
1857 { "Stop Time Julian Day", "ehs.dz.udsm_stop_time_jday",
1858 FT_UINT16, BASE_DEC, NULL, 0x0,
1859 NULL, HFILL }
1861 { &hf_ehs_dz_udsm_stop_time_hour,
1862 { "Stop Time Hour", "ehs.dz.udsm_stop_time_hour",
1863 FT_UINT8, BASE_DEC, NULL, 0x0,
1864 NULL, HFILL }
1866 { &hf_ehs_dz_udsm_stop_time_minute,
1867 { "Stop Time Minute", "ehs.dz.udsm_stop_time_minute",
1868 FT_UINT8, BASE_DEC, NULL, 0x0,
1869 NULL, HFILL }
1871 { &hf_ehs_dz_udsm_stop_time_second,
1872 { "Stop Time Second", "ehs.dz.udsm_stop_time_second",
1873 FT_UINT8, BASE_DEC, NULL, 0x0,
1874 NULL, HFILL }
1877 #if 0
1878 { &hf_ehs_dz_udsm_unused4,
1879 { "Unused 4", "ehs.dz.udsm_unused4",
1880 FT_UINT16, BASE_DEC, NULL, 0xffff,
1881 NULL, HFILL }
1883 #endif
1885 { &hf_ehs_dz_udsm_num_pkts_xmtd,
1886 { "Num Pkts Transmitted", "ehs.dz.udsm_num_pkts_xmtd",
1887 FT_UINT16, BASE_DEC, NULL, 0x0,
1888 NULL, HFILL }
1891 { &hf_ehs_dz_udsm_num_vcdu_seqerrs,
1892 { "Num VCDU Sequence Errors", "ehs.dz.udsm_num_vcdu_seqerrs",
1893 FT_UINT16, BASE_DEC, NULL, 0x0,
1894 NULL, HFILL }
1897 { &hf_ehs_dz_udsm_num_pkt_seqerrs,
1898 { "Num Packet Sequence Errors", "ehs.dz.udsm_num_pkt_seqerrs",
1899 FT_UINT16, BASE_DEC, NULL, 0x0,
1900 NULL, HFILL }
1903 { &hf_ehs_dz_udsm_num_pktlen_errors,
1904 { "Num Pkt Length Errors", "ehs.dz.udsm_num_pktlen_errors",
1905 FT_UINT16, BASE_DEC, NULL, 0x0,
1906 NULL, HFILL }
1909 { &hf_ehs_dz_udsm_event,
1910 { "UDSM Event Code", "ehs.dz.udsm_event",
1911 FT_UINT8, BASE_DEC, VALS(ehs_data_zone_udsm_event), 0x0,
1912 NULL, HFILL }
1915 { &hf_ehs_dz_udsm_num_pkts_xmtd_rollover,
1916 { "Num Pkts Transmitted Rollover Counter", "ehs.dz.udsm_num_pkts_xmtd_rollover",
1917 FT_UINT8, BASE_DEC, NULL, 0x0,
1918 NULL, HFILL }
1923 /* Setup protocol subtree array */
1924 static int *ett[] = {
1925 &ett_ehs,
1926 &ett_ehs_primary_header,
1927 &ett_ehs_secondary_header,
1928 &ett_ehs_data_zone,
1929 &ett_ehs_cnt_time,
1930 &ett_ehs_obt_time,
1931 &ett_ehs_udsm_start_time,
1932 &ett_ehs_udsm_stop_time,
1933 &ett_ehs_ground_receipt_time,
1934 &ett_ehs_major_frame,
1935 &ett_ehs_minor_frame,
1938 /* Register the protocol name and description */
1939 proto_ehs = proto_register_protocol("EHS", "EHS", "ehs");
1941 /* Required function calls to register the header fields and subtrees used */
1942 proto_register_field_array(proto_ehs, hf, array_length(hf));
1943 proto_register_subtree_array(ett, array_length(ett));
1945 /* XX: Does this dissector need to be publicly registered ?? */
1946 ehs_handle = register_dissector ( "ehs", dissect_ehs, proto_ehs );
1949 void
1950 proto_reg_handoff_ehs(void)
1952 dissector_add_for_decode_as_with_preference( "udp.port", ehs_handle );
1953 ccsds_handle = find_dissector_add_dependency ( "ccsds", proto_ehs );
1957 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1959 * Local Variables:
1960 * c-basic-offset: 2
1961 * tab-width: 8
1962 * indent-tabs-mode: nil
1963 * End:
1965 * ex: set shiftwidth=2 tabstop=8 expandtab:
1966 * :indentSize=2:tabSize=8:noTabs=true: