diff options
Diffstat (limited to 'epan/dissectors/packet-stanag4607.c')
-rw-r--r-- | epan/dissectors/packet-stanag4607.c | 295 |
1 files changed, 151 insertions, 144 deletions
diff --git a/epan/dissectors/packet-stanag4607.c b/epan/dissectors/packet-stanag4607.c index 86cec7e05d..605e2ce8f6 100644 --- a/epan/dissectors/packet-stanag4607.c +++ b/epan/dissectors/packet-stanag4607.c @@ -14,133 +14,133 @@ void proto_register_stanag4607(void); void proto_reg_handoff_stanag4607(void); -static int proto_stanag4607 = -1; - -static int hf_4607_version = -1; -static int hf_4607_packet_size = -1; -static int hf_4607_nationality = -1; -static int hf_4607_sec_class = -1; -static int hf_4607_sec_system = -1; -static int hf_4607_sec_code = -1; -static int hf_4607_exercise_indicator = -1; -static int hf_4607_platform_id = -1; -static int hf_4607_mission_id = -1; -static int hf_4607_job_id = -1; - -static int hf_4607_segment_type = -1; -static int hf_4607_segment_size = -1; +static int proto_stanag4607; + +static int hf_4607_version; +static int hf_4607_packet_size; +static int hf_4607_nationality; +static int hf_4607_sec_class; +static int hf_4607_sec_system; +static int hf_4607_sec_code; +static int hf_4607_exercise_indicator; +static int hf_4607_platform_id; +static int hf_4607_mission_id; +static int hf_4607_job_id; + +static int hf_4607_segment_type; +static int hf_4607_segment_size; /* Mission Segment */ -static int hf_4607_mission_plan = -1; -static int hf_4607_mission_flight_plan = -1; -static int hf_4607_mission_platform = -1; -static int hf_4607_mission_platform_config = -1; -static int hf_4607_mission_time_year = -1; -static int hf_4607_mission_time_month = -1; -static int hf_4607_mission_time_day = -1; +static int hf_4607_mission_plan; +static int hf_4607_mission_flight_plan; +static int hf_4607_mission_platform; +static int hf_4607_mission_platform_config; +static int hf_4607_mission_time_year; +static int hf_4607_mission_time_month; +static int hf_4607_mission_time_day; /* Dwell Segment */ -static int hf_4607_dwell_mask = -1; -static int hf_4607_dwell_revisit_index = -1; -static int hf_4607_dwell_dwell_index = -1; -static int hf_4607_dwell_last_dwell = -1; -static int hf_4607_dwell_count = -1; -static int hf_4607_dwell_time = -1; -static int hf_4607_dwell_sensor_lat = -1; -static int hf_4607_dwell_sensor_lon = -1; -static int hf_4607_dwell_sensor_alt = -1; -static int hf_4607_dwell_scale_lat = -1; -static int hf_4607_dwell_scale_lon = -1; -static int hf_4607_dwell_unc_along = -1; -static int hf_4607_dwell_unc_cross = -1; -static int hf_4607_dwell_unc_alt = -1; -static int hf_4607_dwell_track = -1; -static int hf_4607_dwell_speed = -1; -static int hf_4607_dwell_vert_velocity = -1; -static int hf_4607_dwell_track_unc = -1; -static int hf_4607_dwell_speed_unc = -1; -static int hf_4607_dwell_vv_unc = -1; - -static int hf_4607_dwell_plat_heading = -1; -static int hf_4607_dwell_plat_pitch = -1; -static int hf_4607_dwell_plat_roll = -1; -static int hf_4607_dwell_da_lat = -1; -static int hf_4607_dwell_da_lon = -1; -static int hf_4607_dwell_da_range = -1; -static int hf_4607_dwell_da_angle = -1; -static int hf_4607_dwell_sensor_heading = -1; -static int hf_4607_dwell_sensor_pitch = -1; -static int hf_4607_dwell_sensor_roll = -1; -static int hf_4607_dwell_mdv = -1; +static int hf_4607_dwell_mask; +static int hf_4607_dwell_revisit_index; +static int hf_4607_dwell_dwell_index; +static int hf_4607_dwell_last_dwell; +static int hf_4607_dwell_count; +static int hf_4607_dwell_time; +static int hf_4607_dwell_sensor_lat; +static int hf_4607_dwell_sensor_lon; +static int hf_4607_dwell_sensor_alt; +static int hf_4607_dwell_scale_lat; +static int hf_4607_dwell_scale_lon; +static int hf_4607_dwell_unc_along; +static int hf_4607_dwell_unc_cross; +static int hf_4607_dwell_unc_alt; +static int hf_4607_dwell_track; +static int hf_4607_dwell_speed; +static int hf_4607_dwell_vert_velocity; +static int hf_4607_dwell_track_unc; +static int hf_4607_dwell_speed_unc; +static int hf_4607_dwell_vv_unc; + +static int hf_4607_dwell_plat_heading; +static int hf_4607_dwell_plat_pitch; +static int hf_4607_dwell_plat_roll; +static int hf_4607_dwell_da_lat; +static int hf_4607_dwell_da_lon; +static int hf_4607_dwell_da_range; +static int hf_4607_dwell_da_angle; +static int hf_4607_dwell_sensor_heading; +static int hf_4607_dwell_sensor_pitch; +static int hf_4607_dwell_sensor_roll; +static int hf_4607_dwell_mdv; /* Target Report */ -static int hf_4607_dwell_report_index = -1; -static int hf_4607_dwell_report_lat = -1; -static int hf_4607_dwell_report_lon = -1; -static int hf_4607_dwell_report_delta_lat = -1; -static int hf_4607_dwell_report_delta_lon = -1; -static int hf_4607_dwell_report_height = -1; -static int hf_4607_dwell_report_radial = -1; -static int hf_4607_dwell_report_wrap = -1; -static int hf_4607_dwell_report_snr = -1; -static int hf_4607_dwell_report_class = -1; -static int hf_4607_dwell_report_prob = -1; -static int hf_4607_dwell_report_unc_slant = -1; -static int hf_4607_dwell_report_unc_cross = -1; -static int hf_4607_dwell_report_unc_height = -1; -static int hf_4607_dwell_report_unc_radial = -1; -static int hf_4607_dwell_report_tag_app = -1; -static int hf_4607_dwell_report_tag_entity = -1; -static int hf_4607_dwell_report_section = -1; +static int hf_4607_dwell_report_index; +static int hf_4607_dwell_report_lat; +static int hf_4607_dwell_report_lon; +static int hf_4607_dwell_report_delta_lat; +static int hf_4607_dwell_report_delta_lon; +static int hf_4607_dwell_report_height; +static int hf_4607_dwell_report_radial; +static int hf_4607_dwell_report_wrap; +static int hf_4607_dwell_report_snr; +static int hf_4607_dwell_report_class; +static int hf_4607_dwell_report_prob; +static int hf_4607_dwell_report_unc_slant; +static int hf_4607_dwell_report_unc_cross; +static int hf_4607_dwell_report_unc_height; +static int hf_4607_dwell_report_unc_radial; +static int hf_4607_dwell_report_tag_app; +static int hf_4607_dwell_report_tag_entity; +static int hf_4607_dwell_report_section; /* Job Definition Segment */ -static int hf_4607_jobdef_job_id = -1; -static int hf_4607_jobdef_sensor_type = -1; -static int hf_4607_jobdef_sensor_model = -1; -static int hf_4607_jobdef_filter = -1; -static int hf_4607_jobdef_priority = -1; -static int hf_4607_jobdef_ba_lat_a = -1; -static int hf_4607_jobdef_ba_lon_a = -1; -static int hf_4607_jobdef_ba_lat_b = -1; -static int hf_4607_jobdef_ba_lon_b = -1; -static int hf_4607_jobdef_ba_lat_c = -1; -static int hf_4607_jobdef_ba_lon_c = -1; -static int hf_4607_jobdef_ba_lat_d = -1; -static int hf_4607_jobdef_ba_lon_d = -1; -static int hf_4607_jobdef_radar_mode = -1; -static int hf_4607_jobdef_revisit_interval = -1; -static int hf_4607_jobdef_unc_along = -1; -static int hf_4607_jobdef_unc_cross = -1; -static int hf_4607_jobdef_unc_alt = -1; -static int hf_4607_jobdef_unc_heading = -1; -static int hf_4607_jobdef_unc_speed = -1; -static int hf_4607_jobdef_sense_slant = -1; -static int hf_4607_jobdef_sense_cross = -1; -static int hf_4607_jobdef_sense_vlos = -1; -static int hf_4607_jobdef_sense_mdv = -1; -static int hf_4607_jobdef_sense_prob = -1; -static int hf_4607_jobdef_sense_alarm = -1; -static int hf_4607_jobdef_terrain_model = -1; -static int hf_4607_jobdef_geoid_model = -1; +static int hf_4607_jobdef_job_id; +static int hf_4607_jobdef_sensor_type; +static int hf_4607_jobdef_sensor_model; +static int hf_4607_jobdef_filter; +static int hf_4607_jobdef_priority; +static int hf_4607_jobdef_ba_lat_a; +static int hf_4607_jobdef_ba_lon_a; +static int hf_4607_jobdef_ba_lat_b; +static int hf_4607_jobdef_ba_lon_b; +static int hf_4607_jobdef_ba_lat_c; +static int hf_4607_jobdef_ba_lon_c; +static int hf_4607_jobdef_ba_lat_d; +static int hf_4607_jobdef_ba_lon_d; +static int hf_4607_jobdef_radar_mode; +static int hf_4607_jobdef_revisit_interval; +static int hf_4607_jobdef_unc_along; +static int hf_4607_jobdef_unc_cross; +static int hf_4607_jobdef_unc_alt; +static int hf_4607_jobdef_unc_heading; +static int hf_4607_jobdef_unc_speed; +static int hf_4607_jobdef_sense_slant; +static int hf_4607_jobdef_sense_cross; +static int hf_4607_jobdef_sense_vlos; +static int hf_4607_jobdef_sense_mdv; +static int hf_4607_jobdef_sense_prob; +static int hf_4607_jobdef_sense_alarm; +static int hf_4607_jobdef_terrain_model; +static int hf_4607_jobdef_geoid_model; /* Platform Location Segment */ -static int hf_4607_platloc_time = -1; -static int hf_4607_platloc_latitude = -1; -static int hf_4607_platloc_longitude = -1; -static int hf_4607_platloc_altitude = -1; -static int hf_4607_platloc_track = -1; -static int hf_4607_platloc_speed = -1; -static int hf_4607_platloc_vertical_velocity = -1; +static int hf_4607_platloc_time; +static int hf_4607_platloc_latitude; +static int hf_4607_platloc_longitude; +static int hf_4607_platloc_altitude; +static int hf_4607_platloc_track; +static int hf_4607_platloc_speed; +static int hf_4607_platloc_vertical_velocity; /* Subtree pointers */ -static gint ett_4607_hdr = -1; -static gint ett_4607_seg = -1; -static gint ett_4607_rpt = -1; +static gint ett_4607_hdr; +static gint ett_4607_seg; +static gint ett_4607_rpt; /* Error pointers */ -static expert_field ei_bad_length = EI_INIT; -static expert_field ei_too_short = EI_INIT; -static expert_field ei_bad_packet_size = EI_INIT; +static expert_field ei_bad_length; +static expert_field ei_too_short; +static expert_field ei_bad_packet_size; static dissector_handle_t stanag4607_handle; @@ -251,8 +251,8 @@ static const value_string stanag4607_terrain_vals[] = { static const value_string stanag4607_geoid_vals[] = { { 0, "None Specified" }, - { 1, "EGM96 (Earth Gravitional Model, Version 1996)" }, - { 2, "GEO96 (Geoid Gravitional Model, Version 1996)" }, + { 1, "EGM96 (Earth Gravitational Model, Version 1996)" }, + { 2, "GEO96 (Geoid Gravitational Model, Version 1996)" }, { 3, "Flat Earth" }, { 0, NULL } }; @@ -281,7 +281,7 @@ static const value_string stanag4607_target_vals[] = { { 131, "Rotary Wing Aircraft, Simulated Target" }, { 132, "Fixed Wing Aircraft, Simulated Target" }, { 133, "Stationary Rotator, Simulated Target" }, - { 134, "Maritme, Simulated Target" }, + { 134, "Maritime, Simulated Target" }, { 135, "Beacon, Simulated Target" }, { 136, "Amphibious, Simulated Target" }, { 137, "Person, Simulated Target" }, @@ -353,7 +353,7 @@ prt_sa32(gchar *buff, guint32 val) min = floor(60.0 * (x - deg)); sec = 60.0 * (60.0 * (x - deg) - min); /* checkAPI.pl doesn't like the unicode degree symbol, I don't know what to do... */ - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.8f degrees (%.0f %.0f\' %.2f\")", x, deg, min, sec); + snprintf(buff, ITEM_LABEL_LENGTH, "%.8f degrees (%.0f %.0f\' %.2f\")", x, deg, min, sec); } static void @@ -367,7 +367,7 @@ prt_ba32(gchar *buff, guint32 val) min = floor(60.0 * (x - deg)); sec = 60.0 * (60.0 * (x - deg) - min); /* checkAPI.pl doesn't like the unicode degree symbol, I don't know what to do... */ - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.8f degrees (%.0f %.0f\' %.2f\")", x, deg, min, sec); + snprintf(buff, ITEM_LABEL_LENGTH, "%.8f degrees (%.0f %.0f\' %.2f\")", x, deg, min, sec); } static void @@ -376,7 +376,7 @@ prt_sa16(gchar *buff, guint32 val) double x = (double) ((gint32) val); x /= (double) (1<<14); x *= 90.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.3f degrees", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.3f degrees", x); } static void @@ -385,7 +385,7 @@ prt_ba16(gchar *buff, guint32 val) double x = (double) val; x /= (double) (1<<14); x *= 90.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.3f degrees", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.3f degrees", x); } static void @@ -395,9 +395,9 @@ prt_ba16_none(gchar *buff, guint32 val) x /= (double) (1<<14); x *= 90.0; if (val <= 65536) - g_snprintf(buff, ITEM_LABEL_LENGTH, "No Statement"); + snprintf(buff, ITEM_LABEL_LENGTH, "No Statement"); else - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.3f degrees", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.3f degrees", x); } static void @@ -405,14 +405,14 @@ prt_kilo(gchar *buff, guint32 val) { double x = (double) ((gint32) val); x /= 128.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.2f kilometers", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.2f kilometers", x); } static void prt_meters(gchar *buff, guint32 val) { double x = (double) ((gint32) val); - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.0f meters", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.0f meters", x); } static void @@ -420,7 +420,7 @@ prt_decimeters(gchar *buff, guint32 val) { double x = (double) ((gint32) val); x /= 10.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.1f meters", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.1f meters", x); } static void @@ -428,7 +428,7 @@ prt_centimeters(gchar *buff, guint32 val) { double x = (double) ((gint32) val); x /= 100.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.2f meters", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.2f meters", x); } static void @@ -436,7 +436,7 @@ prt_speed(gchar *buff, guint32 val) { double x = (double) val; x /= 1000.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.3f meters/second", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.3f meters/second", x); } static void @@ -444,7 +444,7 @@ prt_speed_centi(gchar *buff, guint32 val) { double x = (double) ((gint32) val); x /= 100.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.2f meters/second", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.2f meters/second", x); } static void @@ -453,7 +453,7 @@ prt_speed_deci(gchar *buff, guint32 val) /* Usually 8-bit, signed */ double x = (double) ((gint32) val); x /= 10.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.1f meters/second", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.1f meters/second", x); } static void @@ -461,38 +461,38 @@ prt_millisec(gchar *buff, guint32 val) { double x = (double) val; x /= 1000.0; - g_snprintf(buff, ITEM_LABEL_LENGTH, "%.3f seconds", x); + snprintf(buff, ITEM_LABEL_LENGTH, "%.3f seconds", x); } static void prt_none8(gchar *buff, guint32 val) { if (0xff == val) - g_snprintf(buff, ITEM_LABEL_LENGTH, "No Statement"); + snprintf(buff, ITEM_LABEL_LENGTH, "No Statement"); else - g_snprintf(buff, ITEM_LABEL_LENGTH, "%d", val); + snprintf(buff, ITEM_LABEL_LENGTH, "%d", val); } static void prt_none16(gchar *buff, guint32 val) { if (0xffff == val) - g_snprintf(buff, ITEM_LABEL_LENGTH, "No Statement"); + snprintf(buff, ITEM_LABEL_LENGTH, "No Statement"); else - g_snprintf(buff, ITEM_LABEL_LENGTH, "%d", val); + snprintf(buff, ITEM_LABEL_LENGTH, "%d", val); } static gint dissect_mission(tvbuff_t *tvb, proto_tree *seg_tree, gint offset) { - proto_tree_add_item(seg_tree, hf_4607_mission_plan, tvb, offset, 12, ENC_ASCII|ENC_NA); + proto_tree_add_item(seg_tree, hf_4607_mission_plan, tvb, offset, 12, ENC_ASCII); offset += 12; - proto_tree_add_item(seg_tree, hf_4607_mission_flight_plan, tvb, offset, 12, ENC_ASCII|ENC_NA); + proto_tree_add_item(seg_tree, hf_4607_mission_flight_plan, tvb, offset, 12, ENC_ASCII); offset += 12; proto_tree_add_item(seg_tree, hf_4607_mission_platform, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_item(seg_tree, hf_4607_mission_platform_config, tvb, offset, 10, ENC_ASCII|ENC_NA); + proto_tree_add_item(seg_tree, hf_4607_mission_platform_config, tvb, offset, 10, ENC_ASCII); offset += 10; proto_tree_add_item(seg_tree, hf_4607_mission_time_year, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; @@ -519,6 +519,8 @@ dissect_mission(tvbuff_t *tvb, proto_tree *seg_tree, gint offset) #define D21 5*8+4 #define D24 5*8+1 #define D28 4*8+5 +#define D29 4*8+4 +#define D30 4*8+3 #define D31 4*8+2 #define D32_1 4*8+1 #define D32_2 4*8+0 @@ -688,9 +690,12 @@ dissect_dwell(tvbuff_t *tvb, proto_tree *seg_tree, gint offset) if (SET(mask, D28)) { proto_tree_add_item(seg_tree, hf_4607_dwell_sensor_heading, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; + } + if (SET(mask, D29)) { proto_tree_add_item(seg_tree, hf_4607_dwell_sensor_pitch, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; + } + if (SET(mask, D30)) { proto_tree_add_item(seg_tree, hf_4607_dwell_sensor_roll, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; } @@ -714,7 +719,7 @@ dissect_jobdef(tvbuff_t *tvb, proto_tree *seg_tree, gint offset) offset += 4; proto_tree_add_item(seg_tree, hf_4607_jobdef_sensor_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_item(seg_tree, hf_4607_jobdef_sensor_model, tvb, offset, 6, ENC_ASCII|ENC_NA); + proto_tree_add_item(seg_tree, hf_4607_jobdef_sensor_model, tvb, offset, 6, ENC_ASCII); offset += 6; proto_tree_add_item(seg_tree, hf_4607_jobdef_filter, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -847,14 +852,14 @@ dissect_stanag4607(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da if (tree) { ti = proto_tree_add_item(tree, proto_stanag4607, tvb, 0, -1, ENC_NA); hdr_tree = proto_item_add_subtree(ti, ett_4607_hdr); - proto_tree_add_item(hdr_tree, hf_4607_version, tvb, 0, 2, ENC_ASCII|ENC_NA); + proto_tree_add_item(hdr_tree, hf_4607_version, tvb, 0, 2, ENC_ASCII); ti = proto_tree_add_item(hdr_tree, hf_4607_packet_size, tvb, 2, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(hdr_tree, hf_4607_nationality, tvb, 6, 2, ENC_ASCII|ENC_NA); + proto_tree_add_item(hdr_tree, hf_4607_nationality, tvb, 6, 2, ENC_ASCII); proto_tree_add_item(hdr_tree, hf_4607_sec_class, tvb, 8, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(hdr_tree, hf_4607_sec_system, tvb, 9, 2, ENC_ASCII|ENC_NA); + proto_tree_add_item(hdr_tree, hf_4607_sec_system, tvb, 9, 2, ENC_ASCII); proto_tree_add_item(hdr_tree, hf_4607_sec_code, tvb, 11, 2, ENC_BIG_ENDIAN); proto_tree_add_item(hdr_tree, hf_4607_exercise_indicator, tvb, 13, 1, ENC_BIG_ENDIAN); - proto_tree_add_item(hdr_tree, hf_4607_platform_id, tvb, 14, 10, ENC_ASCII|ENC_NA); + proto_tree_add_item(hdr_tree, hf_4607_platform_id, tvb, 14, 10, ENC_ASCII); proto_tree_add_item(hdr_tree, hf_4607_mission_id, tvb, 24, 4, ENC_BIG_ENDIAN); proto_tree_add_item(hdr_tree, hf_4607_job_id, tvb, 28, 4, ENC_BIG_ENDIAN); } @@ -1623,13 +1628,15 @@ proto_register_stanag4607(void) expert_4607 = expert_register_protocol(proto_stanag4607); expert_register_field_array(expert_4607, ei, array_length(ei)); - stanag4607_handle = register_dissector("STANAG 4607", dissect_stanag4607, proto_stanag4607); + stanag4607_handle = register_dissector("stanag4607", dissect_stanag4607, proto_stanag4607); /* prefs_register_protocol(proto_stanag4607, proto_reg_handoff_stanag4607); */ } void proto_reg_handoff_stanag4607(void) { + dissector_add_for_decode_as("tcp.port", stanag4607_handle); + dissector_add_for_decode_as("udp.port", stanag4607_handle); dissector_add_uint("wtap_encap", WTAP_ENCAP_STANAG_4607, stanag4607_handle); } |