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