HTTPS (almost) everywhere.
[metze/wireshark/wip.git] / epan / dissectors / packet-ehs.c
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
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12
13 #include "config.h"
14
15 #include <epan/packet.h>
16
17 void proto_register_ehs(void);
18 void proto_reg_handoff_ehs(void);
19
20 /* Initialize the protocol and registered fields */
21 static int proto_ehs = -1;
22
23 static int hf_ehs_ph_version = -1;
24 static int hf_ehs_ph_project = -1;
25 static int hf_ehs_ph_support_mode = -1;
26 static int hf_ehs_ph_data_mode = -1;
27 static int hf_ehs_ph_mission = -1;
28 static int hf_ehs_ph_protocol = -1;
29
30 static int hf_ehs_ph_year = -1;            /* numeric year as years since 1900 */
31 static int hf_ehs_ph_jday = -1;            /* julian day of year */
32 static int hf_ehs_ph_hour = -1;
33 static int hf_ehs_ph_minute = -1;
34 static int hf_ehs_ph_second = -1;
35 static int hf_ehs_ph_tenths = -1;
36
37 static int hf_ehs_ph_new_data_flag = -1;   /* indicates the time has changed */
38 /* static int hf_ehs_ph_pad1 = -1; */
39 static int hf_ehs_ph_hold_flag = -1;       /* indicates a hold condition */
40 static int hf_ehs_ph_sign_flag = -1;       /* indicates pre-mission, i.e. countdown, time */
41
42 /* static int hf_ehs_ph_pad2 = -1; */
43 /* static int hf_ehs_ph_pad3 = -1; */
44 /* static int hf_ehs_ph_pad4 = -1; */
45
46 static int hf_ehs_ph_hosc_packet_size = -1;
47
48 /* generic ehs secondary header values */
49 static int hf_ehs_sh_version = -1;
50 static int hf_ehs_sh_data_status_bit_5 = -1;
51 static int hf_ehs_sh_data_status_bit_4 = -1;
52 static int hf_ehs_sh_data_status_bit_3 = -1;
53 static int hf_ehs_sh_data_status_bit_2 = -1;
54 static int hf_ehs_sh_data_status_bit_1 = -1;
55 static int hf_ehs_sh_data_status_bit_0 = -1;
56
57 /* other common remappings of the data status bits specific to certain secondary ehs header values */
58 static int hf_ehs_sh_parent_stream_error = -1;      /* data status bit 3 */
59 static int hf_ehs_sh_vcdu_sequence_error = -1;      /* data status bit 2 */
60 static int hf_ehs_sh_packet_sequence_error = -1;    /* data status bit 1 */
61
62 /* common ehs secondary header values */
63 static int hf_ehs_sh_vcdu_sequence_number = -1;
64 static int hf_ehs_sh_data_stream_id = -1;
65 /* static int hf_ehs_sh_pdss_reserved_1 = -1; */
66 /* static int hf_ehs_sh_pdss_reserved_2 = -1; */
67 /* static int hf_ehs_sh_pdss_reserved_3 = -1; */
68 static int hf_ehs_sh_gse_pkt_id = -1;
69 static int hf_ehs_sh_payload_vs_core_id = -1;
70 static int hf_ehs_sh_apid = -1;
71 static int hf_ehs_sh_virtual_channel = -1;
72 static int hf_ehs_sh_pdss_reserved_sync = -1;
73
74 /* tdm ehs secondary header values */
75 static int hf_ehs_sh_tdm_secondary_header_length = -1;
76
77 static int hf_ehs_sh_tdm_extra_data_packet = -1;
78 static int hf_ehs_sh_tdm_backup_stream_id_number = -1;
79 static int hf_ehs_sh_tdm_end_of_data_flag = -1;
80 static int hf_ehs_sh_tdm_parent_frame_error = -1;
81 static int hf_ehs_sh_tdm_checksum_error = -1;
82 static int hf_ehs_sh_tdm_fixed_value_error = -1;
83
84 static int hf_ehs_sh_tdm_minor_frame_counter_error = -1;
85 static int hf_ehs_sh_tdm_format_id_error = -1;
86 static int hf_ehs_sh_tdm_bit_slip_error = -1;
87 static int hf_ehs_sh_tdm_sync_error = -1;
88 static int hf_ehs_sh_tdm_aoslos_flag = -1;
89 static int hf_ehs_sh_tdm_override_errors_flag = -1;
90 static int hf_ehs_sh_tdm_data_status = -1;
91
92 static int hf_ehs_sh_tdm_idq = -1;
93 static int hf_ehs_sh_tdm_cdq = -1;
94 static int hf_ehs_sh_tdm_adq = -1;
95 static int hf_ehs_sh_tdm_data_dq = -1;
96 /* static int hf_ehs_sh_tdm_unused = -1; */
97 static int hf_ehs_sh_tdm_format_id = -1;
98
99 static int hf_ehs_sh_tdm_major_frame_packet_index = -1;
100 static int hf_ehs_sh_tdm_numpkts_per_major_frame = -1;
101 static int hf_ehs_sh_tdm_num_minor_frames_per_packet = -1;
102
103 static int hf_ehs_sh_tdm_cntmet_present = -1;
104 static int hf_ehs_sh_tdm_obt_present = -1;
105 static int hf_ehs_sh_tdm_major_frame_status_present = -1;
106 /* static int hf_ehs_sh_tdm_reserved = -1; */
107
108 static int hf_ehs_sh_tdm_cnt_year = -1;            /* numeric year as years since 1900 */
109 static int hf_ehs_sh_tdm_cnt_jday = -1;            /* julian day of year */
110 static int hf_ehs_sh_tdm_cnt_hour = -1;
111 static int hf_ehs_sh_tdm_cnt_minute = -1;
112 static int hf_ehs_sh_tdm_cnt_second = -1;
113 static int hf_ehs_sh_tdm_cnt_tenths = -1;
114
115 static int hf_ehs_sh_tdm_obt_year = -1;            /* numeric year as years since 1900 */
116 static int hf_ehs_sh_tdm_obt_jday = -1;            /* julian day of year */
117 static int hf_ehs_sh_tdm_obt_hour = -1;
118 static int hf_ehs_sh_tdm_obt_minute = -1;
119 static int hf_ehs_sh_tdm_obt_second = -1;
120 static int hf_ehs_sh_tdm_obt_tenths = -1;
121
122 static int hf_ehs_sh_tdm_obt_delta_time_flag = -1;
123 static int hf_ehs_sh_tdm_obt_computed_flag = -1;
124 static int hf_ehs_sh_tdm_obt_not_retrieved_flag = -1;
125 /* static int hf_ehs_sh_tdm_obt_reserved = -1; */
126 static int hf_ehs_sh_tdm_obt_source_apid = -1;
127
128 static int hf_ehs_sh_tdm_num_major_frame_status_words = -1;
129
130 /* static int hf_ehs_sh_tdm_mjfs_reserved = -1; */
131 static int hf_ehs_sh_tdm_mjfs_parent_frame_error = -1;
132 static int hf_ehs_sh_tdm_mjfs_checksum_error = -1;
133 static int hf_ehs_sh_tdm_mjfs_fixed_value_error = -1;
134
135 static int hf_ehs_sh_tdm_mnfs_parent_frame_error = -1;
136 static int hf_ehs_sh_tdm_mnfs_data_not_available = -1;
137 static int hf_ehs_sh_tdm_mnfs_checksum_error = -1;
138 static int hf_ehs_sh_tdm_mnfs_fixed_value_error = -1;
139 static int hf_ehs_sh_tdm_mnfs_counter_error = -1;
140 static int hf_ehs_sh_tdm_mnfs_format_id_error = -1;
141 static int hf_ehs_sh_tdm_mnfs_bit_slip_error = -1;
142 static int hf_ehs_sh_tdm_mnfs_sync_error = -1;
143
144 /* pseudo ehs secondary header values */
145 /* static int hf_ehs_sh_pseudo_unused = -1; */
146 static int hf_ehs_sh_pseudo_workstation_id = -1;
147 static int hf_ehs_sh_pseudo_user_id = -1;
148 static int hf_ehs_sh_pseudo_comp_id = -1;
149
150 /* data zone values for well known protocol AOS/LOS */
151 static int hf_ehs_dz_aoslos_indicator = -1;
152
153 /* data zone values for well known protocol UDSM */
154 static int hf_ehs_dz_udsm_ccsds_vs_bpdu = -1;
155 /* static int hf_ehs_dz_udsm_unused1 = -1; */
156
157 /* static int hf_ehs_dz_udsm_unused2 = -1; */
158
159 /* static int hf_ehs_dz_udsm_unused3 = -1; */
160 static int hf_ehs_dz_udsm_gse_pkt_id = -1;
161 static int hf_ehs_dz_udsm_payload_vs_core = -1;
162 static int hf_ehs_dz_udsm_apid = -1;
163
164 static int hf_ehs_dz_udsm_start_time_year = -1;
165 static int hf_ehs_dz_udsm_start_time_jday = -1;
166 static int hf_ehs_dz_udsm_start_time_hour = -1;
167 static int hf_ehs_dz_udsm_start_time_minute = -1;
168 static int hf_ehs_dz_udsm_start_time_second = -1;
169
170 static int hf_ehs_dz_udsm_stop_time_year = -1;
171 static int hf_ehs_dz_udsm_stop_time_jday = -1;
172 static int hf_ehs_dz_udsm_stop_time_hour = -1;
173 static int hf_ehs_dz_udsm_stop_time_minute = -1;
174 static int hf_ehs_dz_udsm_stop_time_second = -1;
175
176 /* static int hf_ehs_dz_udsm_unused4 = -1; */
177
178 static int hf_ehs_dz_udsm_num_pkts_xmtd = -1;
179
180 static int hf_ehs_dz_udsm_num_vcdu_seqerrs = -1;
181
182 static int hf_ehs_dz_udsm_num_pkt_seqerrs = -1;
183
184 static int hf_ehs_dz_udsm_num_pktlen_errors = -1;
185
186 static int hf_ehs_dz_udsm_event = -1;
187
188 static int hf_ehs_dz_udsm_num_pkts_xmtd_rollover = -1;
189
190
191 static dissector_handle_t ehs_handle;
192
193 /* handle to ccsds packet dissector */
194 static dissector_handle_t ccsds_handle;
195
196 /* Initialize the subtree pointers */
197 static gint ett_ehs = -1;
198 static gint ett_ehs_primary_header = -1;
199 static gint ett_ehs_secondary_header = -1;
200 static gint ett_ehs_data_zone = -1;
201 static gint ett_ehs_cnt_time = -1;
202 static gint ett_ehs_obt_time = -1;
203 static gint ett_ehs_udsm_start_time = -1;
204 static gint ett_ehs_udsm_stop_time = -1;
205 static gint ett_ehs_ground_receipt_time = -1;
206 static gint ett_ehs_major_frame = -1;
207 static gint ett_ehs_minor_frame = -1;
208
209 /* EHS protocol types */
210 typedef enum EHS_Protocol_Type
211 {
212   EHS_PROTOCOL__ALL_PROTOCOLS,
213   EHS_PROTOCOL__TDM_TELEMETRY,
214   EHS_PROTOCOL__NASCOM_TELEMETRY,
215   EHS_PROTOCOL__PSEUDO_TELEMETRY,
216   EHS_PROTOCOL__TDS_DATA,
217   EHS_PROTOCOL__TEST_DATA,
218   EHS_PROTOCOL__GSE_DATA,
219   EHS_PROTOCOL__CUSTOM_DATA,
220   EHS_PROTOCOL__HDRS_DQ,
221   EHS_PROTOCOL__CSS,
222   EHS_PROTOCOL__AOS_LOS,
223   EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET,
224   EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET,
225   EHS_PROTOCOL__PDSS_PAYLOAD_BPDU,
226   EHS_PROTOCOL__PDSS_UDSM,
227   EHS_PROTOCOL__PDSS_RPSM,
228   NUMBER_PROTOCOLS = 15
229 } EHS_Protocol_Type_t;
230
231
232 /* some basic sizing parameters */
233 enum
234 {
235   IP_HEADER_LENGTH              = 48,
236   CCSDS_PRIMARY_HEADER_LENGTH   =  6,
237   CCSDS_SECONDARY_HEADER_LENGTH = 10,
238   EHS_PRIMARY_HEADER_SIZE       = 16,
239   EHS_SECONDARY_HEADER_SIZE     = 12
240 };
241
242 /* determine if a ccsds primary header indicates a secondary exists */
243 #define HDR_SECHDR   0x0800
244
245
246 static const value_string ehs_primary_header_project[] =
247 {
248   { 0, "All" },
249   { 1, "STS" },
250   { 2, "SL" },
251   { 3, "ISS" },
252   { 4, "AXAF" },
253   { 0, NULL }
254 };
255
256 static const value_string ehs_primary_header_support_mode[] =
257 {
258   { 0, "All" },
259   { 1, "Flight" },
260   { 2, "Test" },
261   { 3, "Sim" },
262   { 4, "Validation" },
263   { 5, "Development" },
264   { 6, "Training" },
265   { 7, "Offline" },
266   { 0, NULL }
267 };
268
269 static const value_string ehs_primary_header_data_mode[] =
270 {
271   { 0,  "Unused" },
272   { 1,  "Realtime" },
273   { 2,  "Dump1" },
274   { 3,  "Dump2" },
275   { 4,  "Dump3" },
276   { 5,  "Playback1" },
277   { 6,  "Playback2" },
278   { 7,  "Playback3" },
279   { 8,  "Playback4" },
280   { 9,  "Playback5" },
281   { 10, "Playback6" },
282   { 11, "Playback7" },
283   { 12, "Playback8" },
284   { 13, "Playback9" },
285   { 14, "Playback10" },
286   { 15, "Playback11" },
287   { 16, "Mode Independent" },
288   { 0, NULL }
289 };
290
291 static const value_string ehs_primary_header_protocol[] =
292 {
293   { 0,  "All" },
294   { 1,  "TDM" },
295   { 2,  "NASCOM" },
296   { 3,  "PSEUDO" },
297   { 4,  "Time" },
298   { 5,  "Test" },
299   { 6,  "GSE" },
300   { 7,  "Custom_Data" },
301   { 8,  "HDRS_DQ" },
302   { 9,  "CSS" },
303   { 10, "AOS_LOS" },
304   { 11, "PDSS_PAYLOAD_CCSDS" },
305   { 12, "PDSS_CORE_CCSDS" },
306   { 13, "PDSS_PAYLOAD_BPDU" },
307   { 14, "PDSS_UDSM" },
308   { 15, "PDSS_RPSM" },
309   { 0, NULL }
310 };
311
312 static const value_string ehs_secondary_header_data_stream_id[] =
313 {
314   { 0, "CCSDS" },
315   { 1, "BPDU" },
316   { 0, NULL }
317 };
318
319 static const value_string ehs_secondary_header_payload_vs_core_id[] =
320 {
321   { 0, "Core" },
322   { 1, "Payload" },
323   { 0, NULL }
324 };
325
326 static const value_string ehs_secondary_header_tdm_backup_stream_id[] =
327 {
328   { 0, "Stream A / KMTS-A" },
329   { 1, "Stream B / KMTS-B" },
330   { 2, "SKR" },
331   { 0, NULL }
332 };
333
334 static const value_string ehs_secondary_header_tdm_end_of_data_flag[] =
335 {
336   { 0, "OK" },
337   { 1, "Loss of Clock" },
338   { 2, "Watchdog Timeout" },
339   { 3, "Loss of Sync" },
340   { 0, NULL }
341 };
342
343 static const true_false_string ehs_tfs_secondary_header_tdm_aoslos_flag =
344 {
345    "AOS" ,
346    "LOS"
347 };
348
349 static const value_string ehs_secondary_header_tdm_data_status[] =
350 {
351   { 0, "OK" },
352   { 1, "Suspect" },
353   { 2, "DQ Failed" },
354   { 3, "No Data" },
355   { 0, NULL }
356 };
357
358 static const value_string ehs_data_zone_aoslos_indicator[] =
359 {
360   { 0, "S-band LOS" },
361   { 1, "S-band AOS" },
362   { 2, "Ku-band LOS" },
363   { 3, "Ku-band AOS" },
364   { 0, NULL }
365 };
366
367 static const value_string ehs_data_zone_udsm_ccsds_vs_bpdu[] =
368 {
369   { 0, "CCSDS" },
370   { 1, "BPDU" },
371   { 0, NULL }
372 };
373
374 static const value_string ehs_data_zone_udsm_payload_vs_core[] =
375 {
376   { 0, "Core" },
377   { 1, "Payload" },
378   { 0, NULL }
379 };
380
381 static const value_string ehs_data_zone_udsm_event[] =
382 {
383   { 0, "Undefined" },
384   { 1, "Actual LOS" },
385   { 2, "Scheduled End of Data" },
386   { 3, "Operator Requested" },
387   { 0, NULL }
388 };
389
390
391 /* function to return EHS secondary header size according to protocol.
392  * the buffer pointer tvb should be pointing to the packets ehs primary
393  * header, and the offset should be set to the start of the ehs secondary
394  * header on input.
395  */
396 static int
397 ehs_secondary_header_size ( int protocol, tvbuff_t* tvb, int offset )
398 {
399   /* for most protocols the ehs secondary header is a standard size */
400   int size = EHS_SECONDARY_HEADER_SIZE;
401
402   switch ( protocol )
403   {
404   case EHS_PROTOCOL__TDM_TELEMETRY:
405     /* the TDM secondary header size is variable.  its value is actually
406      * contained in the first two bytes of the secondary header itself.
407      */
408     size = tvb_get_ntohs ( tvb, offset );
409     break;
410
411   case EHS_PROTOCOL__NASCOM_TELEMETRY:
412     break;
413
414   case EHS_PROTOCOL__PSEUDO_TELEMETRY:
415     size = 8;
416     break;
417
418   case EHS_PROTOCOL__TDS_DATA:
419     break;
420
421   case EHS_PROTOCOL__TEST_DATA:
422     break;
423
424   case EHS_PROTOCOL__GSE_DATA:
425     size = 16;
426     break;
427
428   case EHS_PROTOCOL__CUSTOM_DATA:
429     break;
430
431   case EHS_PROTOCOL__HDRS_DQ:
432     break;
433
434   case EHS_PROTOCOL__CSS:
435     break;
436
437   case EHS_PROTOCOL__AOS_LOS:
438     break;
439
440   case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
441     break;
442
443   case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
444     break;
445
446   case EHS_PROTOCOL__PDSS_PAYLOAD_BPDU:
447     break;
448
449   case EHS_PROTOCOL__PDSS_UDSM:
450     break;
451
452   case EHS_PROTOCOL__PDSS_RPSM:
453     break;
454
455   default:
456     break;
457   }
458
459   return size;
460
461 }
462
463
464 /* common EHS secondary header dissector */
465 static void
466 common_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
467 {
468   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_vcdu_sequence_number, tvb, *offset, 3, ENC_BIG_ENDIAN );
469   *offset += 3;
470
471   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_stream_id, tvb, *offset, 1, ENC_BIG_ENDIAN );
472   /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pdss_reserved_1, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
473   ++(*offset);
474
475   /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pdss_reserved_2, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
476   ++(*offset);
477
478   /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pdss_reserved_3, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
479   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_gse_pkt_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
480   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_payload_vs_core_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
481   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_apid, tvb, *offset, 2, ENC_BIG_ENDIAN );
482   *offset += 2;
483
484   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_virtual_channel, tvb, *offset, 2, ENC_BIG_ENDIAN );
485   *offset += 2;
486
487   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pdss_reserved_sync, tvb, *offset, 2, ENC_BIG_ENDIAN );
488   *offset += 2;
489
490 }
491
492
493 /* AOS/LOS EHS secondary header dissector */
494 static void
495 aoslos_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
496 {
497   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
498   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
499   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
500   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_3, tvb, *offset, 1, ENC_BIG_ENDIAN );
501   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_2, tvb, *offset, 1, ENC_BIG_ENDIAN );
502   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_1, tvb, *offset, 1, ENC_BIG_ENDIAN );
503   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
504   ++(*offset);
505
506   common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
507 }
508
509
510 /* payload ccsds secondary header dissector */
511 static void
512 payload_ccsds_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
513 {
514   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
515   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
516   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
517   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_3, tvb, *offset, 1, ENC_BIG_ENDIAN );
518   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_vcdu_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
519   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_packet_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
520   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
521   ++(*offset);
522
523   common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
524 }
525
526
527 /* core ccsds secondary header dissector */
528 static void
529 core_ccsds_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
530 {
531   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
532   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
533   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
534   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_parent_stream_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
535   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_vcdu_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
536   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_packet_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
537   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
538   ++(*offset);
539
540   common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
541 }
542
543
544 /* payload bpdu secondary header dissector */
545 static void
546 payload_bpdu_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
547 {
548   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
549   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
550   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
551   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_3, tvb, *offset, 1, ENC_BIG_ENDIAN );
552   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_vcdu_sequence_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
553   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_1, tvb, *offset, 1, ENC_BIG_ENDIAN );
554   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
555   ++(*offset);
556
557   common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
558 }
559
560
561 /* udsm secondary header dissector */
562 static void
563 udsm_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
564 {
565   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_version, tvb, *offset, 1, ENC_BIG_ENDIAN );
566   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_5, tvb, *offset, 1, ENC_BIG_ENDIAN );
567   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_4, tvb, *offset, 1, ENC_BIG_ENDIAN );
568   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_3, tvb, *offset, 1, ENC_BIG_ENDIAN );
569   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_2, tvb, *offset, 1, ENC_BIG_ENDIAN );
570   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_1, tvb, *offset, 1, ENC_BIG_ENDIAN );
571   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_data_status_bit_0, tvb, *offset, 1, ENC_BIG_ENDIAN );
572   ++(*offset);
573
574   common_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
575 }
576
577
578 /* tdm secondary header dissector */
579 static void
580 tdm_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
581 {
582   int j;
583   int num_major_frames = 0;
584   int num_minor_frames = 0;
585   int cntmet_present   = 0;
586   int obt_present      = 0;
587   int mjfs_present     = 0;
588
589   proto_tree* time_tree;
590   proto_item* time_item;
591   int year, jday, hour, minute, second, tenths;
592
593   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_secondary_header_length, tvb, *offset, 2, ENC_BIG_ENDIAN );
594   *offset += 2;
595
596   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_extra_data_packet, tvb, *offset, 1, ENC_BIG_ENDIAN );
597   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_backup_stream_id_number, tvb, *offset, 1, ENC_BIG_ENDIAN );
598   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_end_of_data_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
599   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_parent_frame_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
600   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_checksum_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
601   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_fixed_value_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
602   ++(*offset);
603
604   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_minor_frame_counter_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
605   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_format_id_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
606   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_bit_slip_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
607   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_sync_error, tvb, *offset, 1, ENC_BIG_ENDIAN );
608   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_aoslos_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
609   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_override_errors_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
610   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_data_status, tvb, *offset, 1, ENC_BIG_ENDIAN );
611   ++(*offset);
612
613   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_idq, tvb, *offset, 2, ENC_BIG_ENDIAN );
614   *offset += 2;
615
616   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_cdq, tvb, *offset, 2, ENC_BIG_ENDIAN );
617   *offset += 2;
618
619   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_adq, tvb, *offset, 2, ENC_BIG_ENDIAN );
620   *offset += 2;
621
622   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_data_dq, tvb, *offset, 2, ENC_BIG_ENDIAN );
623   *offset += 2;
624
625   /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_unused, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
626   *offset += 2;
627
628   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_format_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
629   *offset += 2;
630
631   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_major_frame_packet_index, tvb, *offset, 1, ENC_BIG_ENDIAN );
632   ++(*offset);
633
634   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_numpkts_per_major_frame, tvb, *offset, 1, ENC_BIG_ENDIAN );
635   ++(*offset);
636
637   num_minor_frames = 1 + tvb_get_guint8 ( tvb, *offset );
638   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_num_minor_frames_per_packet, tvb, *offset, 1, ENC_BIG_ENDIAN );
639   ++(*offset);
640
641   cntmet_present = tvb_get_guint8 ( tvb, *offset ) & 0x80;
642   obt_present = tvb_get_guint8 ( tvb, *offset ) & 0x40;
643   mjfs_present = tvb_get_guint8 ( tvb, *offset ) & 0x20;
644   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_cntmet_present, tvb, *offset, 1, ENC_BIG_ENDIAN );
645   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_present, tvb, *offset, 1, ENC_BIG_ENDIAN );
646   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_major_frame_status_present, tvb, *offset, 1, ENC_BIG_ENDIAN );
647   /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_reserved, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
648   ++(*offset);
649
650   if ( cntmet_present )
651   {
652     time_tree = proto_tree_add_subtree(ehs_secondary_header_tree, tvb, *offset, 7, ett_ehs_cnt_time, &time_item, "CNT/MET Time: ");
653
654     year = tvb_get_guint8 ( tvb, *offset );
655     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_year, tvb, *offset, 1, ENC_BIG_ENDIAN );
656     ++(*offset);
657
658     jday = tvb_get_ntohs ( tvb, *offset );
659     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_jday, tvb, *offset, 2, ENC_BIG_ENDIAN );
660     *offset += 2;
661
662     hour = tvb_get_guint8 ( tvb, *offset );
663     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_hour, tvb, *offset, 1, ENC_BIG_ENDIAN );
664     ++(*offset);
665
666     minute = tvb_get_guint8 ( tvb, *offset );
667     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_minute, tvb, *offset, 1, ENC_BIG_ENDIAN );
668     ++(*offset);
669
670     second = tvb_get_guint8 ( tvb, *offset );
671     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_second, tvb, *offset, 1, ENC_BIG_ENDIAN );
672     ++(*offset);
673
674     tenths = tvb_get_guint8 ( tvb, *offset ) >> 4;
675     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_cnt_tenths, tvb, *offset, 1, ENC_BIG_ENDIAN );
676     ++(*offset);
677
678     /* format a more readable time */
679     proto_item_append_text(time_item,  "%04d/%03d:%02d:%02d:%02d.%1d", year + 1900, jday, hour, minute, second, tenths );
680   }
681
682
683   if ( obt_present )
684   {
685     time_tree = proto_tree_add_subtree(ehs_secondary_header_tree, tvb, *offset, 7, ett_ehs_obt_time, &time_item, "OBT Time: ");
686
687     year = tvb_get_guint8 ( tvb, *offset );
688     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_year, tvb, *offset, 1, ENC_BIG_ENDIAN );
689     ++(*offset);
690
691     jday = tvb_get_ntohs ( tvb, *offset );
692     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_jday, tvb, *offset, 2, ENC_BIG_ENDIAN );
693     *offset += 2;
694
695     hour = tvb_get_guint8 ( tvb, *offset );
696     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_hour, tvb, *offset, 1, ENC_BIG_ENDIAN );
697     ++(*offset);
698
699     minute = tvb_get_guint8 ( tvb, *offset );
700     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_minute, tvb, *offset, 1, ENC_BIG_ENDIAN );
701     ++(*offset);
702
703     second = tvb_get_guint8 ( tvb, *offset );
704     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_second, tvb, *offset, 1, ENC_BIG_ENDIAN );
705     ++(*offset);
706
707     tenths = tvb_get_guint8 ( tvb, *offset ) >> 4;
708     proto_tree_add_item ( time_tree, hf_ehs_sh_tdm_obt_tenths, tvb, *offset, 1, ENC_BIG_ENDIAN );
709     ++(*offset);
710
711     /* format a more readable time */
712     proto_item_append_text ( time_item, "%04d/%03d:%02d:%02d:%02d.%1d", year + 1900, jday, hour, minute, second, tenths );
713
714     proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_delta_time_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
715     proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_computed_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
716     proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_not_retrieved_flag, tvb, *offset, 1, ENC_BIG_ENDIAN );
717     /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_reserved, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
718     proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_obt_source_apid, tvb, *offset, 1, ENC_BIG_ENDIAN );
719   }
720
721   if ( mjfs_present )
722   {
723     num_major_frames = 1 + tvb_get_guint8 ( tvb, *offset );
724     proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_tdm_num_major_frame_status_words, tvb, *offset, 1, ENC_BIG_ENDIAN );
725     ++(*offset);
726
727     for ( j=0; j < num_major_frames; ++j )
728     {
729       proto_tree* major_tree;
730       const int * major_fields[] = {
731         /* &hf_ehs_sh_tdm_mjfs_reserved, */
732         &hf_ehs_sh_tdm_mjfs_parent_frame_error,
733         &hf_ehs_sh_tdm_mjfs_checksum_error,
734         &hf_ehs_sh_tdm_mjfs_fixed_value_error,
735         NULL
736       };
737
738       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 );
739       proto_tree_add_bitmask_list(major_tree, tvb, *offset, 1, major_fields, ENC_BIG_ENDIAN);
740       ++(*offset);
741     }
742   }
743
744   for ( j=0; j < num_minor_frames; ++j )
745   {
746     proto_tree* minor_tree;
747     const int * minor_fields[] = {
748         &hf_ehs_sh_tdm_mnfs_parent_frame_error,
749         &hf_ehs_sh_tdm_mnfs_data_not_available,
750         &hf_ehs_sh_tdm_mnfs_checksum_error,
751         &hf_ehs_sh_tdm_mnfs_fixed_value_error,
752         &hf_ehs_sh_tdm_mnfs_counter_error,
753         &hf_ehs_sh_tdm_mnfs_format_id_error,
754         &hf_ehs_sh_tdm_mnfs_bit_slip_error,
755         &hf_ehs_sh_tdm_mnfs_sync_error,
756         NULL
757     };
758
759     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 );
760     proto_tree_add_bitmask_list(minor_tree, tvb, *offset, 1, minor_fields, ENC_BIG_ENDIAN);
761     ++(*offset);
762   }
763
764 }
765
766
767 /* pseudo secondary header dissector */
768 static void
769 pseudo_secondary_header_dissector ( proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
770 {
771   /* proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pseudo_unused, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
772   *offset += 2;
773
774   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pseudo_workstation_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
775   *offset += 2;
776
777   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pseudo_user_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
778   *offset += 2;
779
780   proto_tree_add_item ( ehs_secondary_header_tree, hf_ehs_sh_pseudo_comp_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
781   *offset += 2;
782
783 }
784
785
786
787
788 /* EHS secondary header dissector */
789 static void
790 ehs_secondary_header_dissector ( int protocol, proto_tree* ehs_secondary_header_tree, tvbuff_t* tvb, int* offset )
791 {
792   /* the ehs secondary header structure is potentially different for each and every
793    * protocol type, including its size.  we support certain protocols but not all.
794    * for those protocols which are not supported we simply increment the offset
795    * and return.  support for these other protocols can easily be added at a later
796    * time if and when it becomes necessary to do so.  but for right now, we're only
797    * going to dissect those protocols that we work with on a regular basis in pdss.
798    */
799   switch ( protocol )
800   {
801   case EHS_PROTOCOL__TDM_TELEMETRY:
802     tdm_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
803     break;
804
805   case EHS_PROTOCOL__NASCOM_TELEMETRY:
806     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
807     break;
808
809   case EHS_PROTOCOL__PSEUDO_TELEMETRY:
810     pseudo_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
811     break;
812
813   case EHS_PROTOCOL__TDS_DATA:
814     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
815     break;
816
817   case EHS_PROTOCOL__TEST_DATA:
818     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
819     break;
820
821   case EHS_PROTOCOL__GSE_DATA:
822     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
823     break;
824
825   case EHS_PROTOCOL__CUSTOM_DATA:
826     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
827     break;
828
829   case EHS_PROTOCOL__HDRS_DQ:
830     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
831     break;
832
833   case EHS_PROTOCOL__CSS:
834     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
835     break;
836
837   case EHS_PROTOCOL__AOS_LOS:
838     aoslos_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
839     break;
840
841   case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
842     payload_ccsds_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
843     break;
844
845   case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
846     core_ccsds_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
847     break;
848
849   case EHS_PROTOCOL__PDSS_PAYLOAD_BPDU:
850     payload_bpdu_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
851     break;
852
853   case EHS_PROTOCOL__PDSS_UDSM:
854     udsm_secondary_header_dissector ( ehs_secondary_header_tree, tvb, offset );
855     break;
856
857   case EHS_PROTOCOL__PDSS_RPSM:
858     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
859     break;
860
861   default:
862     *offset += ehs_secondary_header_size ( protocol, tvb, *offset );
863     break;
864   }
865 }
866
867
868 /* AOS/LOS data zone dissector */
869 static void
870 aoslos_data_zone_dissector ( proto_tree* ehs_tree, tvbuff_t* tvb, int* offset, packet_info* pinfo _U_)
871 {
872   proto_tree *ehs_data_zone_tree;
873
874   /* create the data zone tree */
875   ehs_data_zone_tree = proto_tree_add_subtree( ehs_tree, tvb, *offset, tvb_reported_length(tvb) - *offset,
876                                                ett_ehs_data_zone, NULL, "AOS/LOS Data Zone" );
877
878   /* since the aos/los EHS packet data zone is well known, format it for display as well
879    *
880    * The AOS/LOS packet data zone is only 2 bytes in
881    * length and only 2 bits in the first byte are
882    * meaningful -- Ku band or S band and AOS or LOS
883    *
884    * 7-2 - unused
885    * 1-0 - band + AOS/LOS indicator
886    *
887    * bit 1 - 0=sband 1=kuband
888    * bit 0 - 0=LOS 1=AOS
889    *
890    * 0 00 - sband LOS
891    * 1 01 - sband AOS
892    * 2 10 - kuband LOS
893    * 3 11 - kuband AOS
894    */
895   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_aoslos_indicator, tvb, *offset, 1, ENC_BIG_ENDIAN );
896   ++(*offset);
897 }
898
899
900 /* UDSM data zone dissector */
901 static void
902 udsm_data_zone_dissector ( proto_tree* ehs_tree, tvbuff_t* tvb, int* offset, packet_info* pinfo _U_)
903 {
904   proto_tree *ehs_data_zone_tree;
905
906   proto_tree* time_tree;
907   proto_item* time_item;
908   int year, jday, hour, minute, second;
909
910   /* create the data zone tree */
911   ehs_data_zone_tree = proto_tree_add_subtree( ehs_tree, tvb, *offset, tvb_reported_length(tvb) - *offset,
912                                                 ett_ehs_data_zone, NULL, "UDSM Data Zone" );
913
914   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_ccsds_vs_bpdu, tvb, *offset, 1, ENC_BIG_ENDIAN );
915   /* proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_unused1, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
916   ++(*offset);
917
918   /* proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_unused2, tvb, *offset, 1, ENC_BIG_ENDIAN ); */
919   ++(*offset);
920
921   /* proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_unused3, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
922   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_gse_pkt_id, tvb, *offset, 2, ENC_BIG_ENDIAN );
923   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_payload_vs_core, tvb, *offset, 2, ENC_BIG_ENDIAN );
924   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_apid, tvb, *offset, 2, ENC_BIG_ENDIAN );
925   *offset += 2;
926
927   time_tree = proto_tree_add_subtree(ehs_data_zone_tree, tvb, *offset, 7, ett_ehs_udsm_start_time, &time_item, "UDSM Start Time: ");
928   year = tvb_get_guint8 ( tvb, *offset );
929   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_year, tvb, *offset, 1, ENC_BIG_ENDIAN );
930   ++(*offset);
931
932   jday = tvb_get_ntohs ( tvb, *offset );
933   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_jday, tvb, *offset, 2, ENC_BIG_ENDIAN );
934   *offset += 2;
935
936   hour = tvb_get_guint8 ( tvb, *offset );
937   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_hour, tvb, *offset, 1, ENC_BIG_ENDIAN );
938   ++(*offset);
939
940   minute = tvb_get_guint8 ( tvb, *offset );
941   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_minute, tvb, *offset, 1, ENC_BIG_ENDIAN );
942   ++(*offset);
943
944   second = tvb_get_guint8 ( tvb, *offset );
945   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_start_time_second, tvb, *offset, 1, ENC_BIG_ENDIAN );
946   ++(*offset);
947
948   /* format a more readable time */
949   proto_item_append_text( time_item, "%04d/%03d:%02d:%02d:%02d = UDSM Start Time", year + 1900, jday, hour, minute, second );
950
951   time_tree = proto_tree_add_subtree(ehs_data_zone_tree, tvb, *offset, 7, ett_ehs_udsm_stop_time, &time_item, "UDSM Stop Time: ");
952   year = tvb_get_guint8 ( tvb, *offset );
953   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_year, tvb, *offset, 1, ENC_BIG_ENDIAN );
954   ++(*offset);
955
956   jday = tvb_get_ntohs ( tvb, *offset );
957   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_jday, tvb, *offset, 2, ENC_BIG_ENDIAN );
958   *offset += 2;
959
960   hour = tvb_get_guint8 ( tvb, *offset );
961   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_hour, tvb, *offset, 1, ENC_BIG_ENDIAN );
962   ++(*offset);
963
964   minute = tvb_get_guint8 ( tvb, *offset );
965   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_minute, tvb, *offset, 1, ENC_BIG_ENDIAN );
966   ++(*offset);
967
968   second = tvb_get_guint8 ( tvb, *offset );
969   proto_tree_add_item ( time_tree, hf_ehs_dz_udsm_stop_time_second, tvb, *offset, 1, ENC_BIG_ENDIAN );
970   ++(*offset);
971
972   /* format a more readable time */
973   proto_item_append_text ( time_item, "%04d/%03d:%02d:%02d:%02d", year + 1900, jday, hour, minute, second );
974
975   /* proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_unused4, tvb, *offset, 2, ENC_BIG_ENDIAN ); */
976   *offset += 2;
977
978   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_pkts_xmtd, tvb, *offset, 2, ENC_BIG_ENDIAN );
979   *offset += 2;
980
981   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_vcdu_seqerrs, tvb, *offset, 2, ENC_BIG_ENDIAN );
982   *offset += 2;
983
984   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_pkt_seqerrs, tvb, *offset, 2, ENC_BIG_ENDIAN );
985   *offset += 2;
986
987   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_pktlen_errors, tvb, *offset, 2, ENC_BIG_ENDIAN );
988   *offset += 2;
989
990   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_event, tvb, *offset, 1, ENC_BIG_ENDIAN );
991   ++(*offset);
992
993   proto_tree_add_item ( ehs_data_zone_tree, hf_ehs_dz_udsm_num_pkts_xmtd_rollover, tvb, *offset, 1, ENC_BIG_ENDIAN );
994   ++(*offset);
995
996 }
997
998
999 /* data zone dissector */
1000 static void
1001 ehs_data_zone_dissector ( int protocol, proto_tree* ehs_tree, tvbuff_t* tvb, int* offset, packet_info* pinfo )
1002 {
1003   /* the data zone of certain protocols such as AOS/LOS and UDSM is well known.
1004    */
1005   switch ( protocol )
1006   {
1007   case EHS_PROTOCOL__TDM_TELEMETRY:
1008     break;
1009
1010   case EHS_PROTOCOL__NASCOM_TELEMETRY:
1011     break;
1012
1013   case EHS_PROTOCOL__PSEUDO_TELEMETRY:
1014     break;
1015
1016   case EHS_PROTOCOL__TDS_DATA:
1017     break;
1018
1019   case EHS_PROTOCOL__TEST_DATA:
1020     break;
1021
1022   case EHS_PROTOCOL__GSE_DATA:
1023     break;
1024
1025   case EHS_PROTOCOL__CUSTOM_DATA:
1026     break;
1027
1028   case EHS_PROTOCOL__HDRS_DQ:
1029     break;
1030
1031   case EHS_PROTOCOL__CSS:
1032     break;
1033
1034   case EHS_PROTOCOL__AOS_LOS:
1035     aoslos_data_zone_dissector ( ehs_tree, tvb, offset, pinfo );
1036     break;
1037
1038   case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
1039     break;
1040
1041   case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
1042     break;
1043
1044   case EHS_PROTOCOL__PDSS_PAYLOAD_BPDU:
1045     break;
1046
1047   case EHS_PROTOCOL__PDSS_UDSM:
1048     udsm_data_zone_dissector ( ehs_tree, tvb, offset, pinfo );
1049     break;
1050
1051   case EHS_PROTOCOL__PDSS_RPSM:
1052     break;
1053
1054   default:
1055     break;
1056   }
1057 }
1058
1059
1060 /* Code to actually dissect the packets */
1061 static int
1062 dissect_ehs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1063 {
1064   int         offset = 0;
1065   guint16     first_word;
1066
1067   tvbuff_t   *new_tvb;
1068
1069   proto_item *ehs_packet;
1070   proto_tree *ehs_tree;
1071
1072   proto_tree* time_tree;
1073   proto_item* time_item;
1074   proto_tree *ehs_primary_header_tree;
1075   proto_tree *ehs_secondary_header_tree;
1076
1077   int         protocol;
1078   int         year, jday, hour, minute, second, tenths;
1079
1080   col_set_str(pinfo->cinfo, COL_PROTOCOL, "EHS");
1081   col_set_str(pinfo->cinfo, COL_INFO, "EHS");
1082
1083   ehs_packet = proto_tree_add_item ( tree, proto_ehs, tvb, 0, -1, ENC_NA );
1084   ehs_tree = proto_item_add_subtree ( ehs_packet, ett_ehs );
1085
1086   /* build the ehs primary header tree */
1087   ehs_primary_header_tree = proto_tree_add_subtree( ehs_tree, tvb, offset, EHS_PRIMARY_HEADER_SIZE,
1088                                                     ett_ehs_primary_header, NULL, "Primary EHS Header" );
1089
1090   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_version, tvb, offset, 1, ENC_BIG_ENDIAN );
1091   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_project, tvb, offset, 1, ENC_BIG_ENDIAN );
1092   ++offset;
1093
1094   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_support_mode, tvb, offset, 1, ENC_BIG_ENDIAN );
1095   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_data_mode, tvb, offset, 1, ENC_BIG_ENDIAN );
1096   ++offset;
1097
1098   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_mission, tvb, offset, 1, ENC_BIG_ENDIAN );
1099   ++offset;
1100
1101   /* save protocol for use later on */
1102   protocol = tvb_get_guint8 ( tvb, offset );
1103   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_protocol, tvb, offset, 1, ENC_BIG_ENDIAN );
1104   ++offset;
1105
1106   time_tree = proto_tree_add_subtree(ehs_primary_header_tree, tvb, offset, 7, ett_ehs_ground_receipt_time, &time_item, "EHS Ground Receipt Time: ");
1107   year = tvb_get_guint8 ( tvb, offset );
1108   proto_tree_add_item ( time_tree, hf_ehs_ph_year, tvb, offset, 1, ENC_BIG_ENDIAN );
1109   ++offset;
1110
1111   jday = tvb_get_ntohs ( tvb, offset );
1112   proto_tree_add_item ( time_tree, hf_ehs_ph_jday, tvb, offset, 2, ENC_BIG_ENDIAN );
1113   offset += 2;
1114
1115   hour = tvb_get_guint8 ( tvb, offset );
1116   proto_tree_add_item ( time_tree, hf_ehs_ph_hour, tvb, offset, 1, ENC_BIG_ENDIAN );
1117   ++offset;
1118
1119   minute = tvb_get_guint8 ( tvb, offset );
1120   proto_tree_add_item ( time_tree, hf_ehs_ph_minute, tvb, offset, 1, ENC_BIG_ENDIAN );
1121   ++offset;
1122
1123   second = tvb_get_guint8 ( tvb, offset );
1124   proto_tree_add_item ( time_tree, hf_ehs_ph_second, tvb, offset, 1, ENC_BIG_ENDIAN );
1125   ++offset;
1126
1127   tenths = tvb_get_guint8 ( tvb, offset ) >> 4;
1128   proto_tree_add_item ( time_tree, hf_ehs_ph_tenths, tvb, offset, 1, ENC_BIG_ENDIAN );
1129
1130   /* format a more readable ground receipt time string */
1131   proto_item_append_text ( time_item, "%04d/%03d:%02d:%02d:%02d.%1d", year + 1900, jday, hour, minute, second, tenths );
1132
1133   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_new_data_flag, tvb, offset, 1, ENC_BIG_ENDIAN );
1134   /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad1, tvb, offset, 1, ENC_BIG_ENDIAN ); */
1135   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hold_flag, tvb, offset, 1, ENC_BIG_ENDIAN );
1136   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_sign_flag, tvb, offset, 1, ENC_BIG_ENDIAN );
1137   ++offset;
1138
1139   /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad2, tvb, offset, 1, ENC_BIG_ENDIAN ); */
1140   ++offset;
1141   /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad3, tvb, offset, 1, ENC_BIG_ENDIAN ); */
1142   ++offset;
1143   /* proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_pad4, tvb, offset, 1, ENC_BIG_ENDIAN ); */
1144   ++offset;
1145
1146   proto_tree_add_item ( ehs_primary_header_tree, hf_ehs_ph_hosc_packet_size, tvb, offset, 2, ENC_BIG_ENDIAN );
1147   offset += 2;
1148
1149   /* build the ehs secondary header tree */
1150   ehs_secondary_header_tree = proto_tree_add_subtree( ehs_tree, tvb, offset, ehs_secondary_header_size ( protocol, tvb, offset ),
1151                                         ett_ehs_secondary_header, NULL, "Secondary EHS Header" );
1152
1153   /* since each protocol can have a different ehs secondary header structure, we will offload
1154    * this processing to lower levels of code so we don't have to insert all of that complexity
1155    * directly inline here, which would no doubt make this difficult to read at best.
1156    */
1157   ehs_secondary_header_dissector ( protocol, ehs_secondary_header_tree, tvb, &offset );
1158
1159   /* for ccsds protocol types pass the remaining packet off to the ccsds packet dissector */
1160   switch ( protocol )
1161   {
1162   case EHS_PROTOCOL__TDM_TELEMETRY:
1163   case EHS_PROTOCOL__PSEUDO_TELEMETRY:
1164   case EHS_PROTOCOL__AOS_LOS:
1165   case EHS_PROTOCOL__PDSS_PAYLOAD_CCSDS_PACKET:
1166   case EHS_PROTOCOL__PDSS_CORE_CCSDS_PACKET:
1167   case EHS_PROTOCOL__PDSS_UDSM:
1168     new_tvb = tvb_new_subset_remaining ( tvb, offset);
1169     call_dissector ( ccsds_handle, new_tvb, pinfo, ehs_tree );
1170
1171     /* bump the offset to the data zone area */
1172     first_word = tvb_get_ntohs ( tvb, offset );
1173
1174     offset += CCSDS_PRIMARY_HEADER_LENGTH;
1175     if ( first_word & HDR_SECHDR ) offset += CCSDS_SECONDARY_HEADER_LENGTH;
1176     break;
1177
1178
1179   default:
1180     break;
1181   }
1182
1183   /* build the ehs data zone tree for well known protocols such as AOS/LOS and UDSM */
1184   ehs_data_zone_dissector ( protocol, ehs_tree, tvb, &offset, pinfo );
1185
1186   return tvb_captured_length(tvb);
1187 }
1188
1189
1190 /* Register the protocol with Wireshark
1191  * this format is require because a script is used to build the C function
1192  * that calls all the protocol registration.
1193  */
1194 void
1195 proto_register_ehs(void)
1196 {
1197   /* Setup list of header fields  See Section 1.6.1 for details*/
1198   static hf_register_info hf[] =
1199     {
1200       /* primary ehs header */
1201       { &hf_ehs_ph_version,
1202         { "Version", "ehs.version",
1203           FT_UINT8, BASE_DEC, NULL, 0xf0,
1204           NULL, HFILL }
1205       },
1206       { &hf_ehs_ph_project,
1207         { "Project", "ehs.project",
1208           FT_UINT8, BASE_DEC, VALS(ehs_primary_header_project), 0x0f,
1209           NULL, HFILL }
1210       },
1211
1212       { &hf_ehs_ph_support_mode,
1213         { "Support Mode", "ehs.support_mode",
1214           FT_UINT8, BASE_DEC, VALS(ehs_primary_header_support_mode), 0xf0,
1215           NULL, HFILL }
1216       },
1217       { &hf_ehs_ph_data_mode,
1218         { "Data Mode", "ehs.data_mode",
1219           FT_UINT8, BASE_DEC, VALS(ehs_primary_header_data_mode), 0x0f,
1220           NULL, HFILL }
1221       },
1222
1223       { &hf_ehs_ph_mission,
1224         { "Mission", "ehs.mission",
1225           FT_UINT8, BASE_DEC, NULL, 0xff,
1226           NULL, HFILL }
1227       },
1228
1229       { &hf_ehs_ph_protocol,
1230         { "Protocol", "ehs.protocol",
1231           FT_UINT8, BASE_DEC, VALS(ehs_primary_header_protocol), 0xff,
1232           NULL, HFILL }
1233       },
1234
1235       { &hf_ehs_ph_year,
1236         { "Years since 1900", "ehs.year",
1237           FT_UINT8, BASE_DEC, NULL, 0xff,
1238           NULL, HFILL }
1239       },
1240
1241       { &hf_ehs_ph_jday,
1242         { "Julian Day of Year", "ehs.jday",
1243           FT_UINT16, BASE_DEC, NULL, 0xffff,
1244           NULL, HFILL }
1245       },
1246
1247       { &hf_ehs_ph_hour,
1248         { "Hour", "ehs.hour",
1249           FT_UINT8, BASE_DEC, NULL, 0xff,
1250           NULL, HFILL }
1251       },
1252
1253       { &hf_ehs_ph_minute,
1254         { "Minute", "ehs.minute",
1255           FT_UINT8, BASE_DEC, NULL, 0xff,
1256           NULL, HFILL }
1257       },
1258
1259       { &hf_ehs_ph_second,
1260         { "Second", "ehs.second",
1261           FT_UINT8, BASE_DEC, NULL, 0xff,
1262           NULL, HFILL }
1263       },
1264
1265       { &hf_ehs_ph_tenths,
1266         { "Tenths", "ehs.tenths",
1267           FT_UINT8, BASE_DEC, NULL, 0xf0,
1268           NULL, HFILL }
1269       },
1270       { &hf_ehs_ph_new_data_flag,
1271         { "New Data Flag", "ehs.new_data_flag",
1272           FT_BOOLEAN, 8, NULL, 0x08,
1273           NULL, HFILL }
1274       },
1275 #if 0
1276       { &hf_ehs_ph_pad1,
1277         { "Pad1", "ehs.pad1",
1278           FT_UINT8, BASE_DEC, NULL, 0x04,
1279           NULL, HFILL }
1280       },
1281 #endif
1282       { &hf_ehs_ph_hold_flag,
1283         { "Hold Flag", "ehs.hold_flag",
1284           FT_BOOLEAN, 8, NULL, 0x02,
1285           NULL, HFILL }
1286       },
1287       { &hf_ehs_ph_sign_flag,
1288         { "Sign Flag (1->CDT)", "ehs.sign_flag",
1289           FT_UINT8, BASE_DEC, NULL, 0x01,
1290           NULL, HFILL }
1291       },
1292
1293 #if 0
1294       { &hf_ehs_ph_pad2,
1295         { "Pad2", "ehs.pad2",
1296           FT_UINT8, BASE_DEC, NULL, 0xff,
1297           NULL, HFILL }
1298       },
1299
1300       { &hf_ehs_ph_pad3,
1301         { "Pad3", "ehs.pad3",
1302           FT_UINT8, BASE_DEC, NULL, 0xff,
1303           NULL, HFILL }
1304       },
1305
1306       { &hf_ehs_ph_pad4,
1307         { "Pad4", "ehs.pad4",
1308           FT_UINT8, BASE_DEC, NULL, 0xff,
1309           NULL, HFILL }
1310       },
1311 #endif
1312
1313       { &hf_ehs_ph_hosc_packet_size,
1314         { "HOSC Packet Size", "ehs.hosc_packet_size",
1315           FT_UINT16, BASE_DEC, NULL, 0xffff,
1316           NULL, HFILL }
1317       },
1318
1319
1320       /* secondary ehs header */
1321       { &hf_ehs_sh_version,
1322         { "Version", "ehs2.version",
1323           FT_UINT8, BASE_DEC, NULL, 0xc0,
1324           NULL, HFILL }
1325       },
1326       { &hf_ehs_sh_data_status_bit_5,
1327         { "Data Status Bit 5", "ehs2.data_status_bit_5",
1328           FT_UINT8, BASE_DEC, NULL, 0x20,
1329           NULL, HFILL }
1330       },
1331       { &hf_ehs_sh_data_status_bit_4,
1332         { "Data Status Bit 4", "ehs2.data_status_bit_4",
1333           FT_UINT8, BASE_DEC, NULL, 0x10,
1334           NULL, HFILL }
1335       },
1336       { &hf_ehs_sh_data_status_bit_3,
1337         { "Data Status Bit 3", "ehs2.data_status_bit_3",
1338           FT_UINT8, BASE_DEC, NULL, 0x08,
1339           NULL, HFILL }
1340       },
1341       { &hf_ehs_sh_data_status_bit_2,
1342         { "Data Status Bit 2", "ehs2.data_status_bit_2",
1343           FT_UINT8, BASE_DEC, NULL, 0x04,
1344           NULL, HFILL }
1345       },
1346       { &hf_ehs_sh_data_status_bit_1,
1347         { "Data Status Bit 1", "ehs2.data_status_bit_1",
1348           FT_UINT8, BASE_DEC, NULL, 0x02,
1349           NULL, HFILL }
1350       },
1351       { &hf_ehs_sh_data_status_bit_0,
1352         { "Data Status Bit 0", "ehs2.data_status_bit_0",
1353           FT_UINT8, BASE_DEC, NULL, 0x01,
1354           NULL, HFILL }
1355       },
1356
1357
1358       /* other common remappings of the data status bits specific to certain secondary ehs header values */
1359       { &hf_ehs_sh_parent_stream_error,
1360         { "Parent Stream Error", "ehs2.parent_stream_error",
1361           FT_BOOLEAN, 8, NULL, 0x08,
1362           NULL, HFILL }
1363       },
1364       { &hf_ehs_sh_vcdu_sequence_error,
1365         { "VCDU Sequence Error", "ehs2.vcdu_sequence_error",
1366           FT_BOOLEAN, 8, NULL, 0x04,
1367           NULL, HFILL }
1368       },
1369       { &hf_ehs_sh_packet_sequence_error,
1370         { "Packet Sequence Error", "ehs2.packet_sequence_error",
1371           FT_UINT8, BASE_DEC, NULL, 0x02,
1372           NULL, HFILL }
1373       },
1374
1375
1376       /* common ehs secondary header values */
1377       { &hf_ehs_sh_vcdu_sequence_number,
1378         { "VCDU Sequence Number", "ehs2.vcdu_seqno",
1379           FT_UINT24, BASE_DEC, NULL, 0xffffff,
1380           NULL, HFILL }
1381       },
1382
1383       { &hf_ehs_sh_data_stream_id,
1384         { "Data Stream ID", "ehs2.data_stream_id",
1385           FT_UINT8, BASE_DEC, VALS(ehs_secondary_header_data_stream_id), 0x80,
1386           NULL, HFILL }
1387       },
1388 #if 0
1389       { &hf_ehs_sh_pdss_reserved_1,
1390         { "Pdss Reserved 1", "ehs2.pdss_reserved_1",
1391           FT_UINT8, BASE_DEC, NULL, 0x7f,
1392           NULL, HFILL }
1393       },
1394
1395       { &hf_ehs_sh_pdss_reserved_2,
1396         { "Pdss Reserved 2", "ehs2.pdss_reserved_2",
1397           FT_UINT8, BASE_DEC, NULL, 0xff,
1398           NULL, HFILL }
1399       },
1400
1401       { &hf_ehs_sh_pdss_reserved_3,
1402         { "Pdss Reserved 3", "ehs2.pdss_reserved_3",
1403           FT_UINT16, BASE_DEC, NULL, 0xe000,
1404           NULL, HFILL }
1405       },
1406 #endif
1407       { &hf_ehs_sh_gse_pkt_id,
1408         { "GSE Packet ID (1=GSE)", "ehs2.gse_pkt_id",
1409           FT_UINT16, BASE_DEC, NULL, 0x1000,
1410           NULL, HFILL }
1411       },
1412       { &hf_ehs_sh_payload_vs_core_id,
1413         { "Payload vs Core ID", "ehs2.payload_vs_core_id",
1414           FT_UINT16, BASE_DEC, VALS(ehs_secondary_header_payload_vs_core_id), 0x0800,
1415           NULL, HFILL }
1416       },
1417       { &hf_ehs_sh_apid,
1418         { "APID", "ehs2.apid",
1419           FT_UINT16, BASE_DEC, NULL, 0x07ff,
1420           NULL, HFILL }
1421       },
1422
1423       { &hf_ehs_sh_virtual_channel,
1424         { "Virtual Channel", "ehs2.vcid",
1425           FT_UINT16, BASE_DEC, NULL, 0xffff,
1426           NULL, HFILL }
1427       },
1428
1429       { &hf_ehs_sh_pdss_reserved_sync,
1430         { "Pdss Reserved Sync", "ehs2.sync",
1431           FT_UINT16, BASE_HEX, NULL, 0xffff,
1432           NULL, HFILL }
1433       },
1434
1435
1436       /* tdm ehs secondary header values */
1437       { &hf_ehs_sh_tdm_secondary_header_length,
1438         { "Secondary Header Length", "ehs2.tdm_secondary_header_length",
1439           FT_UINT16, BASE_DEC, NULL, 0xffff,
1440           NULL, HFILL }
1441       },
1442
1443       { &hf_ehs_sh_tdm_extra_data_packet,
1444         { "Extra Data Packet", "ehs2.tdm_extra_data_packet",
1445           FT_BOOLEAN, 8, NULL, 0x80,
1446           NULL, HFILL }
1447       },
1448       { &hf_ehs_sh_tdm_backup_stream_id_number,
1449         { "Backup Stream ID Number", "ehs2.tdm_backup_stream_id_number",
1450           FT_UINT8, BASE_DEC, VALS(ehs_secondary_header_tdm_backup_stream_id), 0x60,
1451           NULL, HFILL }
1452       },
1453       { &hf_ehs_sh_tdm_end_of_data_flag,
1454         { "End of Data Flag", "ehs2.tdm_end_of_data_flag",
1455           FT_UINT8, BASE_DEC, VALS(ehs_secondary_header_tdm_end_of_data_flag), 0x18,
1456           NULL, HFILL }
1457       },
1458       { &hf_ehs_sh_tdm_parent_frame_error,
1459         { "Parent Frame Error", "ehs2.tdm_parent_frame_error",
1460           FT_BOOLEAN, 8, NULL, 0x04,
1461           NULL, HFILL }
1462       },
1463       { &hf_ehs_sh_tdm_checksum_error,
1464         { "Checksum Error", "ehs2.tdm_checksum_error",
1465           FT_BOOLEAN, 8, NULL, 0x02,
1466           NULL, HFILL }
1467       },
1468       { &hf_ehs_sh_tdm_fixed_value_error,
1469         { "Fixed Value Error", "ehs2.tdm_fixed_value_error",
1470           FT_BOOLEAN, 8, NULL, 0x01,
1471           NULL, HFILL }
1472       },
1473
1474       { &hf_ehs_sh_tdm_minor_frame_counter_error,
1475         { "Minor Frame Counter Error", "ehs2.tdm_minor_frame_counter_error",
1476           FT_BOOLEAN, 8, NULL, 0x80,
1477           NULL, HFILL }
1478       },
1479       { &hf_ehs_sh_tdm_format_id_error,
1480         { "Format ID Error", "ehs2.tdm_format_id_error",
1481           FT_BOOLEAN, 8, NULL, 0x40,
1482           NULL, HFILL }
1483       },
1484       { &hf_ehs_sh_tdm_bit_slip_error,
1485         { "Bit Slip Error", "ehs2.tdm_bit_slip_error",
1486           FT_BOOLEAN, 8, NULL, 0x20,
1487           NULL, HFILL }
1488       },
1489       { &hf_ehs_sh_tdm_sync_error,
1490         { "Sync Error", "ehs2.tdm_sync_error",
1491           FT_BOOLEAN, 8, NULL, 0x10,
1492           NULL, HFILL }
1493       },
1494       { &hf_ehs_sh_tdm_aoslos_flag,
1495         { "AOS/LOS Flag", "ehs2.tdm_aoslos_flag",
1496           FT_BOOLEAN, 8, TFS(&ehs_tfs_secondary_header_tdm_aoslos_flag), 0x08,
1497           NULL, HFILL }
1498       },
1499       { &hf_ehs_sh_tdm_override_errors_flag,
1500         { "Override Errors", "ehs2.tdm_override_errors_flag",
1501           FT_BOOLEAN, 8, NULL, 0x04,
1502           NULL, HFILL }
1503       },
1504       { &hf_ehs_sh_tdm_data_status,
1505         { "Data Status", "ehs2.tdm_data_status",
1506           FT_UINT8, BASE_DEC, VALS(ehs_secondary_header_tdm_data_status), 0x03,
1507           NULL, HFILL }
1508       },
1509
1510       { &hf_ehs_sh_tdm_idq,
1511         { "IDQ", "ehs2.tdm_idq",
1512           FT_UINT16, BASE_DEC, NULL, 0xffff,
1513           NULL, HFILL }
1514       },
1515
1516       { &hf_ehs_sh_tdm_cdq,
1517         { "CDQ", "ehs2.tdm_cdq",
1518           FT_UINT16, BASE_DEC, NULL, 0xffff,
1519           NULL, HFILL }
1520       },
1521
1522       { &hf_ehs_sh_tdm_adq,
1523         { "ADQ", "ehs2.tdm_adq",
1524           FT_UINT16, BASE_DEC, NULL, 0xffff,
1525           NULL, HFILL }
1526       },
1527
1528       { &hf_ehs_sh_tdm_data_dq,
1529         { "Data DQ", "ehs2.tdm_data_dq",
1530           FT_UINT16, BASE_DEC, NULL, 0xffff,
1531           NULL, HFILL }
1532       },
1533
1534 #if 0
1535       { &hf_ehs_sh_tdm_unused,
1536         { "Unused", "ehs2.tdm_unused",
1537           FT_UINT16, BASE_DEC, NULL, 0xffff,
1538           NULL, HFILL }
1539       },
1540 #endif
1541
1542       { &hf_ehs_sh_tdm_format_id,
1543         { "Format ID", "ehs2.tdm_format_id",
1544           FT_UINT16, BASE_HEX, NULL, 0xffff,
1545           NULL, HFILL }
1546       },
1547
1548       { &hf_ehs_sh_tdm_major_frame_packet_index,
1549         { "Major Frame Packet Index", "ehs2.tdm_major_frame_packet_index",
1550           FT_UINT8, BASE_DEC, NULL, 0xff,
1551           NULL, HFILL }
1552       },
1553
1554       { &hf_ehs_sh_tdm_numpkts_per_major_frame,
1555         { "Num Packets per Major Frame", "ehs2.tdm_numpkts_per_major_frame",
1556           FT_UINT8, BASE_DEC, NULL, 0xff,
1557           NULL, HFILL }
1558       },
1559
1560       { &hf_ehs_sh_tdm_num_minor_frames_per_packet,
1561         { "Num Minor Frames per Packet", "ehs2.tdm_num_minor_frame_per_packet",
1562           FT_UINT8, BASE_DEC, NULL, 0xff,
1563           NULL, HFILL }
1564       },
1565
1566       { &hf_ehs_sh_tdm_cntmet_present,
1567         { "CNT or MET Present", "ehs2.tdm_cntmet_present",
1568           FT_BOOLEAN, 8, NULL, 0x80,
1569           NULL, HFILL }
1570       },
1571       { &hf_ehs_sh_tdm_obt_present,
1572         { "OBT Present", "ehs2.tdm_obt_present",
1573           FT_BOOLEAN, 8, NULL, 0x40,
1574           NULL, HFILL }
1575       },
1576       { &hf_ehs_sh_tdm_major_frame_status_present,
1577         { "Major Frame Status Present", "ehs2.tdm_major_frame_status_present",
1578           FT_BOOLEAN, 8, NULL, 0x20,
1579           NULL, HFILL }
1580       },
1581 #if 0
1582       { &hf_ehs_sh_tdm_reserved,
1583         { "Reserved", "ehs2.tdm_reserved",
1584           FT_UINT8, BASE_DEC, NULL, 0x1f,
1585           NULL, HFILL }
1586       },
1587 #endif
1588
1589       { &hf_ehs_sh_tdm_cnt_year,
1590         { "CNT Years since 1900", "ehs2.tdm_cnt_year",
1591           FT_UINT8, BASE_DEC, NULL, 0xff,
1592           NULL, HFILL }
1593       },
1594       { &hf_ehs_sh_tdm_cnt_jday,
1595         { "CNT Julian Day of Year", "ehs2.tdm_cnt_jday",
1596           FT_UINT16, BASE_DEC, NULL, 0xffff,
1597           NULL, HFILL }
1598       },
1599       { &hf_ehs_sh_tdm_cnt_hour,
1600         { "CNT Hour", "ehs2.tdm_cnt_hour",
1601           FT_UINT8, BASE_DEC, NULL, 0xff,
1602           NULL, HFILL }
1603       },
1604       { &hf_ehs_sh_tdm_cnt_minute,
1605         { "CNT Minute", "ehs2.tdm_cnt_minute",
1606           FT_UINT8, BASE_DEC, NULL, 0xff,
1607           NULL, HFILL }
1608       },
1609       { &hf_ehs_sh_tdm_cnt_second,
1610         { "CNT Second", "ehs2.tdm_cnt_second",
1611           FT_UINT8, BASE_DEC, NULL, 0xff,
1612           NULL, HFILL }
1613       },
1614       { &hf_ehs_sh_tdm_cnt_tenths,
1615         { "CNT Tenths", "ehs2.tdm_cnt_tenths",
1616           FT_UINT8, BASE_DEC, NULL, 0xf0,
1617           NULL, HFILL }
1618       },
1619
1620       { &hf_ehs_sh_tdm_obt_year,
1621         { "OBT Years since 1900", "ehs2.tdm_cnt_year",
1622           FT_UINT8, BASE_DEC, NULL, 0xff,
1623           NULL, HFILL }
1624       },
1625       { &hf_ehs_sh_tdm_obt_jday,
1626         { "OBT Julian Day of Year", "ehs2.tdm_cnt_jday",
1627           FT_UINT16, BASE_DEC, NULL, 0xffff,
1628           NULL, HFILL }
1629       },
1630       { &hf_ehs_sh_tdm_obt_hour,
1631         { "OBT Hour", "ehs2.tdm_cnt_hour",
1632           FT_UINT8, BASE_DEC, NULL, 0xff,
1633           NULL, HFILL }
1634       },
1635       { &hf_ehs_sh_tdm_obt_minute,
1636         { "OBT Minute", "ehs2.tdm_cnt_minute",
1637           FT_UINT8, BASE_DEC, NULL, 0xff,
1638           NULL, HFILL }
1639       },
1640       { &hf_ehs_sh_tdm_obt_second,
1641         { "OBT Second", "ehs2.tdm_cnt_second",
1642           FT_UINT8, BASE_DEC, NULL, 0xff,
1643           NULL, HFILL }
1644       },
1645       { &hf_ehs_sh_tdm_obt_tenths,
1646         { "OBT Tenths", "ehs2.tdm_cnt_tenths",
1647           FT_UINT8, BASE_DEC, NULL, 0xf0,
1648           NULL, HFILL }
1649       },
1650
1651       { &hf_ehs_sh_tdm_obt_delta_time_flag,
1652         { "OBT is Delta Time Instead of GMT", "ehs2.tdm_obt_delta_time_flag",
1653           FT_BOOLEAN, 16, NULL, 0x8000,
1654           NULL, HFILL }
1655       },
1656       { &hf_ehs_sh_tdm_obt_computed_flag,
1657         { "OBT Computed", "ehs2.tdm_obt_computed_flag",
1658           FT_BOOLEAN, 16, NULL, 0x4000,
1659           NULL, HFILL }
1660       },
1661       { &hf_ehs_sh_tdm_obt_not_retrieved_flag,
1662         { "OBT Not Retrieved", "ehs2.tdm_obt_not_retrieved_flag",
1663           FT_BOOLEAN, 16, NULL, 0x2000,
1664           NULL, HFILL }
1665       },
1666 #if 0
1667       { &hf_ehs_sh_tdm_obt_reserved,
1668         { "OBT Reserved", "ehs2.tdm_obt_reserved",
1669           FT_BOOLEAN, 16, NULL, 0x1800,
1670           NULL, HFILL }
1671       },
1672 #endif
1673       { &hf_ehs_sh_tdm_obt_source_apid,
1674         { "OBT Source APID", "ehs2.tdm_obt_source_apid",
1675           FT_UINT16, BASE_DEC, NULL, 0x07ff,
1676           NULL, HFILL }
1677       },
1678
1679       { &hf_ehs_sh_tdm_num_major_frame_status_words,
1680         { "Number of Major Frame Status Words", "ehs2.tdm_num_major_frame_status_words",
1681           FT_UINT8, BASE_DEC, NULL, 0x0ff,
1682           NULL, HFILL }
1683       },
1684
1685 #if 0
1686       { &hf_ehs_sh_tdm_mjfs_reserved,
1687         { "Reserved", "ehs2.tdm_mjfs_reserved",
1688           FT_UINT8, BASE_DEC, NULL, 0xf8,
1689           NULL, HFILL }
1690       },
1691 #endif
1692       { &hf_ehs_sh_tdm_mjfs_parent_frame_error,
1693         { "Parent Frame Error", "ehs2.tdm_mjfs_parent_frame_error",
1694           FT_BOOLEAN, 8, NULL, 0x04,
1695           NULL, HFILL }
1696       },
1697       { &hf_ehs_sh_tdm_mjfs_checksum_error,
1698         { "Checksum Error", "ehs2.tdm_mjfs_checksum_error",
1699           FT_BOOLEAN, 8, NULL, 0x02,
1700           NULL, HFILL }
1701       },
1702       { &hf_ehs_sh_tdm_mjfs_fixed_value_error,
1703         { "Fixed Value Error", "ehs2.tdm_mjfs_fixed_value_error",
1704           FT_BOOLEAN, 8, NULL, 0x01,
1705           NULL, HFILL }
1706       },
1707
1708       { &hf_ehs_sh_tdm_mnfs_parent_frame_error,
1709         { "Parent Frame Error", "ehs2.tdm_mnfs_parent_frame_error",
1710           FT_BOOLEAN, 8, NULL, 0x80,
1711           NULL, HFILL }
1712       },
1713       { &hf_ehs_sh_tdm_mnfs_data_not_available,
1714         { "Data Not Available", "ehs2.tdm_mnfs_data_not_available",
1715           FT_BOOLEAN, 8, NULL, 0x40,
1716           NULL, HFILL }
1717       },
1718       { &hf_ehs_sh_tdm_mnfs_checksum_error,
1719         { "Checksum Error", "ehs2.tdm_mnfs_checksum_error",
1720           FT_BOOLEAN, 8, NULL, 0x20,
1721           NULL, HFILL }
1722       },
1723       { &hf_ehs_sh_tdm_mnfs_fixed_value_error,
1724         { "Fixed Value Error", "ehs2.tdm_mnfs_fixed_value_error",
1725           FT_BOOLEAN, 8, NULL, 0x10,
1726           NULL, HFILL }
1727       },
1728       { &hf_ehs_sh_tdm_mnfs_counter_error,
1729         { "Counter Error", "ehs2.tdm_mnfs_counter_error",
1730           FT_BOOLEAN, 8, NULL, 0x08,
1731           NULL, HFILL }
1732       },
1733       { &hf_ehs_sh_tdm_mnfs_format_id_error,
1734         { "Format ID Error", "ehs2.tdm_mnfs_format_id_error",
1735           FT_BOOLEAN, 8, NULL, 0x04,
1736           NULL, HFILL }
1737       },
1738       { &hf_ehs_sh_tdm_mnfs_bit_slip_error,
1739         { "Bit Slip Error", "ehs2.tdm_mnfs_bit_slip_error",
1740           FT_BOOLEAN, 8, NULL, 0x02,
1741           NULL, HFILL }
1742       },
1743       { &hf_ehs_sh_tdm_mnfs_sync_error,
1744         { "Sync Error", "ehs2.tdm_mnfs_sync_error",
1745           FT_BOOLEAN, 8, NULL, 0x01,
1746           NULL, HFILL }
1747       },
1748
1749
1750       /* pseudo secondary header */
1751 #if 0
1752       { &hf_ehs_sh_pseudo_unused,
1753         { "Unused", "ehs2.pseudo_unused",
1754           FT_UINT16, BASE_DEC, NULL, 0xffff,
1755           NULL, HFILL }
1756       },
1757 #endif
1758       { &hf_ehs_sh_pseudo_workstation_id,
1759         { "Workstation ID", "ehs2.pseudo_workstation_id",
1760           FT_UINT16, BASE_DEC, NULL, 0xffff,
1761           NULL, HFILL }
1762       },
1763       { &hf_ehs_sh_pseudo_user_id,
1764         { "User ID", "ehs2.pseudo_user_id",
1765           FT_UINT16, BASE_DEC, NULL, 0xffff,
1766           NULL, HFILL }
1767       },
1768       { &hf_ehs_sh_pseudo_comp_id,
1769         { "Comp ID", "ehs2.pseudo_comp_id",
1770           FT_UINT16, BASE_DEC, NULL, 0xffff,
1771           NULL, HFILL }
1772       },
1773
1774
1775       /* aos/los protocol data zone */
1776       { &hf_ehs_dz_aoslos_indicator,
1777         { "AOS/LOS Indicator", "ehs.dz.aoslos_indicator",
1778           FT_UINT8, BASE_DEC, VALS(ehs_data_zone_aoslos_indicator), 0x03,
1779           NULL, HFILL }
1780       },
1781
1782
1783       /* udsm protocol data zone */
1784       { &hf_ehs_dz_udsm_ccsds_vs_bpdu,
1785         { "CCSDS vs BPDU", "ehs.dz.udsm_ccsds_vs_bpdu",
1786           FT_UINT8, BASE_DEC, VALS(ehs_data_zone_udsm_ccsds_vs_bpdu), 0x80,
1787           NULL, HFILL }
1788       },
1789 #if 0
1790       { &hf_ehs_dz_udsm_unused1,
1791         { "Unused 1", "ehs.dz.udsm_unused1",
1792           FT_UINT8, BASE_DEC, NULL, 0x7f,
1793           NULL, HFILL }
1794       },
1795
1796       { &hf_ehs_dz_udsm_unused2,
1797         { "Unused 2", "ehs.dz.udsm_unused2",
1798           FT_UINT8, BASE_DEC, NULL, 0xff,
1799           NULL, HFILL }
1800       },
1801
1802       { &hf_ehs_dz_udsm_unused3,
1803         { "Unused 3", "ehs.dz.udsm_unused3",
1804           FT_UINT16, BASE_DEC, NULL, 0xe000,
1805           NULL, HFILL }
1806       },
1807 #endif
1808       { &hf_ehs_dz_udsm_gse_pkt_id,
1809         { "GSE Pkt ID", "ehs.dz.udsm_gse_pkt_id",
1810           FT_BOOLEAN, 16, NULL, 0x1000,
1811           NULL, HFILL }
1812       },
1813       { &hf_ehs_dz_udsm_payload_vs_core,
1814         { "Payload vs Core", "ehs.dz.udsm_payload_vs_core",
1815           FT_UINT16, BASE_DEC, VALS(ehs_data_zone_udsm_payload_vs_core), 0x0800,
1816           NULL, HFILL }
1817       },
1818       { &hf_ehs_dz_udsm_apid,
1819         { "APID", "ehs.dz.udsm_apid",
1820           FT_UINT16, BASE_DEC, NULL, 0x07ff,
1821           NULL, HFILL }
1822       },
1823
1824       { &hf_ehs_dz_udsm_start_time_year,
1825         { "Start Time Years since 1900", "ehs.dz.udsm_start_time_year",
1826           FT_UINT8, BASE_DEC, NULL, 0xff,
1827           NULL, HFILL }
1828       },
1829       { &hf_ehs_dz_udsm_start_time_jday,
1830         { "Start Time Julian Day", "ehs.dz.udsm_start_time_jday",
1831           FT_UINT16, BASE_DEC, NULL, 0xffff,
1832           NULL, HFILL }
1833       },
1834       { &hf_ehs_dz_udsm_start_time_hour,
1835         { "Start Time Hour", "ehs.dz.udsm_start_time_hour",
1836           FT_UINT8, BASE_DEC, NULL, 0xff,
1837           NULL, HFILL }
1838       },
1839       { &hf_ehs_dz_udsm_start_time_minute,
1840         { "Start Time Minute", "ehs.dz.udsm_start_time_minute",
1841           FT_UINT8, BASE_DEC, NULL, 0xff,
1842           NULL, HFILL }
1843       },
1844       { &hf_ehs_dz_udsm_start_time_second,
1845         { "Start Time Second", "ehs.dz.udsm_start_time_second",
1846           FT_UINT8, BASE_DEC, NULL, 0xff,
1847           NULL, HFILL }
1848       },
1849
1850       { &hf_ehs_dz_udsm_stop_time_year,
1851         { "Stop Time Years since 1900", "ehs.dz.udsm_stop_time_year",
1852           FT_UINT8, BASE_DEC, NULL, 0xff,
1853           NULL, HFILL }
1854       },
1855       { &hf_ehs_dz_udsm_stop_time_jday,
1856         { "Stop Time Julian Day", "ehs.dz.udsm_stop_time_jday",
1857           FT_UINT16, BASE_DEC, NULL, 0xffff,
1858           NULL, HFILL }
1859       },
1860       { &hf_ehs_dz_udsm_stop_time_hour,
1861         { "Stop Time Hour", "ehs.dz.udsm_stop_time_hour",
1862           FT_UINT8, BASE_DEC, NULL, 0xff,
1863           NULL, HFILL }
1864       },
1865       { &hf_ehs_dz_udsm_stop_time_minute,
1866         { "Stop Time Minute", "ehs.dz.udsm_stop_time_minute",
1867           FT_UINT8, BASE_DEC, NULL, 0xff,
1868           NULL, HFILL }
1869       },
1870       { &hf_ehs_dz_udsm_stop_time_second,
1871         { "Stop Time Second", "ehs.dz.udsm_stop_time_second",
1872           FT_UINT8, BASE_DEC, NULL, 0xff,
1873           NULL, HFILL }
1874       },
1875
1876 #if 0
1877       { &hf_ehs_dz_udsm_unused4,
1878         { "Unused 4", "ehs.dz.udsm_unused4",
1879           FT_UINT16, BASE_DEC, NULL, 0xffff,
1880           NULL, HFILL }
1881       },
1882 #endif
1883
1884       { &hf_ehs_dz_udsm_num_pkts_xmtd,
1885         { "Num Pkts Transmitted", "ehs.dz.udsm_num_pkts_xmtd",
1886           FT_UINT16, BASE_DEC, NULL, 0xffff,
1887           NULL, HFILL }
1888       },
1889
1890       { &hf_ehs_dz_udsm_num_vcdu_seqerrs,
1891         { "Num VCDU Sequence Errors", "ehs.dz.udsm_num_vcdu_seqerrs",
1892           FT_UINT16, BASE_DEC, NULL, 0xffff,
1893           NULL, HFILL }
1894       },
1895
1896       { &hf_ehs_dz_udsm_num_pkt_seqerrs,
1897         { "Num Packet Sequence Errors", "ehs.dz.udsm_num_pkt_seqerrs",
1898           FT_UINT16, BASE_DEC, NULL, 0xffff,
1899           NULL, HFILL }
1900       },
1901
1902       { &hf_ehs_dz_udsm_num_pktlen_errors,
1903         { "Num Pkt Length Errors", "ehs.dz.udsm_num_pktlen_errors",
1904           FT_UINT16, BASE_DEC, NULL, 0xffff,
1905           NULL, HFILL }
1906       },
1907
1908       { &hf_ehs_dz_udsm_event,
1909         { "UDSM Event Code", "ehs.dz.udsm_event",
1910           FT_UINT8, BASE_DEC, VALS(ehs_data_zone_udsm_event), 0xff,
1911           NULL, HFILL }
1912       },
1913
1914       { &hf_ehs_dz_udsm_num_pkts_xmtd_rollover,
1915         { "Num Pkts Transmitted Rollover Counter", "ehs.dz.udsm_num_pkts_xmtd_rollover",
1916           FT_UINT8, BASE_DEC, NULL, 0xff,
1917           NULL, HFILL }
1918       },
1919
1920     };
1921
1922   /* Setup protocol subtree array */
1923   static gint *ett[] = {
1924     &ett_ehs,
1925     &ett_ehs_primary_header,
1926     &ett_ehs_secondary_header,
1927     &ett_ehs_data_zone,
1928     &ett_ehs_cnt_time,
1929     &ett_ehs_obt_time,
1930     &ett_ehs_udsm_start_time,
1931     &ett_ehs_udsm_stop_time,
1932     &ett_ehs_ground_receipt_time,
1933     &ett_ehs_major_frame,
1934     &ett_ehs_minor_frame,
1935   };
1936
1937   /* Register the protocol name and description */
1938   proto_ehs = proto_register_protocol("EHS", "EHS", "ehs");
1939
1940   /* Required function calls to register the header fields and subtrees used */
1941   proto_register_field_array(proto_ehs, hf, array_length(hf));
1942   proto_register_subtree_array(ett, array_length(ett));
1943
1944   /* XX: Does this dissector need to be publicly registered ?? */
1945   ehs_handle = register_dissector ( "ehs", dissect_ehs, proto_ehs );
1946 }
1947
1948 void
1949 proto_reg_handoff_ehs(void)
1950 {
1951   dissector_add_for_decode_as_with_preference( "udp.port", ehs_handle );
1952   ccsds_handle = find_dissector_add_dependency ( "ccsds", proto_ehs  );
1953 }
1954
1955 /*
1956  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1957  *
1958  * Local Variables:
1959  * c-basic-offset: 2
1960  * tab-width: 8
1961  * indent-tabs-mode: nil
1962  * End:
1963  *
1964  * ex: set shiftwidth=2 tabstop=8 expandtab:
1965  * :indentSize=2:tabSize=8:noTabs=true:
1966  */