extern void initializeParsing (void) { unsigned int builtInCount; unsigned int i; builtInCount = sizeof (BuiltInParsers) / sizeof (BuiltInParsers [0]); LanguageTable = xMalloc (builtInCount, parserDefinition*); verbose ("Installing parsers: "); for (i = 0 ; i < builtInCount ; ++i) { parserDefinition* const def = (*BuiltInParsers [i]) (); if (def != NULL) { boolean accepted = FALSE; if (def->name == NULL || def->name[0] == '\0') error (FATAL, "parser definition must contain name\n"); else if (def->regex) { #ifdef HAVE_REGEX def->parser = findRegexTags; accepted = TRUE; #endif } else if ((def->parser == NULL) == (def->parser2 == NULL)) error (FATAL, "%s parser definition must define one and only one parsing routine\n", def->name); else accepted = TRUE; if (accepted) { verbose ("%s%s", i > 0 ? ", " : "", def->name); def->id = LanguageCount++; LanguageTable [def->id] = def; } } } verbose ("\n"); enableLanguages (TRUE); initializeParsers (); }
void proto_register_dis(void) { /* registration with the filtering engine */ static hf_register_info hf[] = { { &hf_dis_proto_ver, { "Proto version", "dis.proto_ver", FT_UINT8, BASE_DEC, VALS(DIS_PDU_ProtocolVersion_Strings), 0x0, NULL, HFILL } }, { &hf_dis_exercise_id, { "Excercise ID", "dis.exer_id", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_pdu_type, { "PDU type", "dis.pdu_type", FT_UINT8, BASE_DEC, VALS(DIS_PDU_Type_Strings), 0x0, NULL, HFILL } }, { &hf_dis_proto_fam, { "Proto Family", "dis.proto_fam", FT_UINT8, BASE_DEC, VALS(DIS_PDU_ProtocolFamily_Strings), 0x0, NULL, HFILL } }, { &hf_dis_pdu_length, { "PDU Length", "dis.pdu_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_entity_id_site, { "Entity ID Site", "dis.entity_id_site", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_entity_id_application, { "Entity ID Application", "dis.entity_id_application", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_entity_id_entity, { "Entity ID Entity", "dis.entity_id_entity", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_num_art_params, { "Number of Articulation Parameters", "dis.num_articulation_params", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_entityKind, { "Kind", "dis.entityKind", FT_UINT8, BASE_DEC, VALS(DIS_PDU_EntityKind_Strings), 0x0, NULL, HFILL } }, { &hf_dis_entityDomain, { "Domain", "dis.entityDomain", FT_UINT8, BASE_DEC, VALS(DIS_PDU_Domain_Strings), 0x0, NULL, HFILL } }, { &hf_dis_category_land, { "Category / Land", "dis.category.land", FT_UINT8, BASE_DEC, VALS(DIS_PDU_Category_LandPlatform_Strings), 0x0, NULL, HFILL } }, { &hf_dis_category_air, { "Category / Air", "dis.category.air", FT_UINT8, BASE_DEC, VALS(DIS_PDU_Category_AirPlatform_Strings), 0x0, NULL, HFILL } }, { &hf_dis_category_surface, { "Category / Surface", "dis.category.surface", FT_UINT8, BASE_DEC, VALS(DIS_PDU_Category_SurfacePlatform_Strings), 0x0, NULL, HFILL } }, { &hf_dis_category_subsurface, { "Category / Subsurface", "dis.category.subsurface", FT_UINT8, BASE_DEC, VALS(DIS_PDU_Category_SubsurfacePlatform_Strings), 0x0, NULL, HFILL } }, { &hf_dis_category_space, { "Category / Space", "dis.category.space", FT_UINT8, BASE_DEC, VALS(DIS_PDU_Category_SpacePlatform_Strings), 0x0, NULL, HFILL } }, { &hf_dis_category_radio, { "Category / Radio", "dis.category.radio", FT_UINT8, BASE_DEC, VALS(DIS_PDU_RadioCategory_Strings), 0x0, NULL, HFILL } }, { &hf_dis_emitter_name, { "Emitter Name", "dis.electromagnetic.emitter.name", FT_UINT16, BASE_DEC, VALS(DIS_PDU_EmitterName_Strings), 0x0, NULL, HFILL } }, { &hf_dis_emission_function, { "Emission Function", "dis.electromagnetic.emission.function", FT_UINT8, BASE_DEC, VALS(DIS_PDU_EmissionFunction_Strings), 0x0, NULL, HFILL } }, { &hf_dis_beam_function, { "Beam Function", "dis.electromagnetic.emission.beam.function", FT_UINT8, BASE_DEC, VALS(DIS_PDU_BeamFunction_Strings), 0x0, NULL, HFILL } }, { &hf_dis_num_electromagnetic_emission_systems, { "Number of Electromagnetic Emission Systems", "dis.electromagnetic.num_emission_systems", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_radio_id, { "Radio ID", "dis.radio.radio_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_ens, { "Encoding Scheme", "dis.radio.encoding_scheme", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_dis_ens_class, { "Encoding Class", "dis.radio.encoding_class", FT_UINT16, BASE_DEC, VALS(DIS_PDU_Encoding_Class_Strings), 0xc000, NULL, HFILL } }, { &hf_dis_ens_type, { "Encoding Type", "dis.radio.encoding_type", FT_UINT16, BASE_DEC, VALS(DIS_PDU_Encoding_Type_Strings), 0x3fff, NULL, HFILL } }, { &hf_dis_tdl_type, { "TDL Type", "dis.radio.tdl_type", FT_UINT16, BASE_DEC, VALS(DIS_PDU_TDL_Type_Strings), 0x0, NULL, HFILL } }, { &hf_dis_sample_rate, { "Sample Rate", "dis.radio.sample_rate", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_data_length, { "Data Length", "dis.radio.data_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_num_of_samples, { "Number of Samples", "dis.radio.num_of_samples", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_signal_data, {"Data", "dis.radio.signal_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, { &hf_dis_radio_category, { "Radio Category", "dis.radio.radio_category", FT_UINT8, BASE_DEC, VALS(DIS_PDU_RadioCategory_Strings), 0x0, NULL, HFILL } }, { &hf_dis_nomenclature_version, { "Nomenclature Version", "dis.radio.nomenclature_version", FT_UINT8, BASE_DEC, VALS(DIS_PDU_NomenclatureVersion_Strings), 0x0, NULL, HFILL } }, { &hf_dis_nomenclature, { "Nomenclature", "dis.radio.nomenclature", FT_UINT16, BASE_DEC, VALS(DIS_PDU_Nomenclature_Strings), 0x0, NULL, HFILL } }, { &hf_dis_radio_transmit_state, { "Radio Transmit State", "dis.radio.transmit_state", FT_UINT8, BASE_DEC, VALS(DIS_PDU_RadioTransmitState_Strings), 0x0, NULL, HFILL } }, { &hf_dis_radio_input_source, { "Radio Input Source", "dis.radio.input_source", FT_UINT8, BASE_DEC, VALS(DIS_PDU_RadioInputSource_Strings), 0x0, NULL, HFILL } }, { &hf_dis_antenna_pattern_type, { "Antenna Pattern Type", "dis.radio.antenna_pattern_type", FT_UINT16, BASE_DEC, VALS(DIS_PDU_AntennaPatternType_Strings), 0x0, NULL, HFILL } }, { &hf_dis_antenna_pattern_length, { "Antenna Pattern Length", "dis.radio.antenna_pattern_length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_transmit_frequency, { "Transmit Frequency (Hz)", "dis.radio.frequency", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_spread_spectrum_usage, { "Spread Spectrum", "dis.radio.mod_type.spread_spectrum_usage", FT_BOOLEAN, 16, TFS(&dis_modulation_spread_spectrum),0xFFFF, NULL, HFILL } }, { &hf_dis_frequency_hopping, { "Frequency Hopping modulation", "dis.radio.mod_type.frequency_hopping", FT_BOOLEAN, 16, TFS(&dis_frequency_hopping_value),0x0001, NULL, HFILL } }, { &hf_dis_pseudo_noise_modulation, { "Psuedo noise modulation", "dis.radio.mod_type.pseudo_noise_modulation", FT_BOOLEAN, 16, TFS(&dis_pseudo_noise_value),0x0002, NULL, HFILL } }, { &hf_dis_time_hopping, { "Time Hopping modulation", "dis.radio.mod_type.time_hopping", FT_BOOLEAN, 16, TFS(&dis_time_hopping_value),0x0004, NULL, HFILL } }, { &hf_dis_modulation_major, { "Major Modulation", "dis.radio.mod_type.major", FT_UINT16, BASE_DEC, VALS(DIS_PDU_MajorModulation_Strings), 0x0, NULL, HFILL } }, { &hf_dis_modulation_system, { "System Modulation", "dis.radio.mod_type.system", FT_UINT16, BASE_DEC, VALS(DIS_PDU_SystemModulation_Strings), 0x0, NULL, HFILL } }, { &hf_dis_crypto_system, { "Crypto System", "dis.radio.crypto_system", FT_UINT16, BASE_DEC, VALS(DIS_PDU_CryptoSystem_Strings), 0x0, NULL, HFILL } }, { &hf_dis_crypto_key, { "Encryption Key", "dis.radio.encryption_key", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_dis_encryption_mode, { "Encryption Mode", "dis.radio.encryption_key.mode", FT_BOOLEAN, 16, TFS(&dis_encryption_mode_value),0x8000, NULL, HFILL } }, { &hf_dis_key_identifier, { "Encryption Key ID", "dis.radio.encryption_key.id", FT_UINT16, BASE_DEC, NULL,0x7FFF, NULL, HFILL } }, { &hf_dis_modulation_parameter_length, { "Modulation Parameter Length", "dis.radio.mod_param.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_mod_param_fh_net_id, { "Frequency Hopping Network ID", "dis.radio.mod_param.cctt_cingars.fh_nw_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_mod_param_fh_set_id, { "Frequency Set ID", "dis.radio.mod_param.cctt_cingars.fh_set_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_mod_param_fh_lo_set_id, { "Frequency Lockout Set ID", "dis.radio.mod_param.cctt_cingars.fh_lo_set_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_mod_param_fh_msg_start, { "Start of Message", "dis.radio.mod_param.cctt_cingars.fh_msg_start", FT_UINT8, BASE_DEC, VALS(DIS_PDU_ModParamMsgStart_Strings), 0x0, NULL, HFILL } }, { &hf_dis_mod_param_fh_reserved, { "Reserved", "dis.radio.mod_param.cctt_cingars.fh_reserved", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_mod_param_fh_sync_time_offset, { "Sync Time Offset (Seconds)", "dis.radio.mod_param.cctt_cingars.fh_sync_offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_mod_param_fh_security_key, { "Transmission Security Key", "dis.radio.mod_param.cctt_cingars.fh_securit_key", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_mod_param_fh_clear_channel, { "Clear Channel", "dis.radio.mod_param.cctt_cingars.fh_clr_channel", FT_UINT8, BASE_DEC, VALS(DIS_PDU_ModParamClrChannel_Strings), 0x0, NULL, HFILL } }, { &hf_dis_mod_param_dump, {"Modulation Parameter All", "dis.radio.mod_param.all", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, { &hf_dis_mod_param_ts_allocation_mode, { "Time Slot Allocaton Mode", "dis.radio.mod_param.jtids.ts_alloc_mode", FT_UINT8, BASE_DEC, VALS(DIS_PDU_TSAllocationFidelity_Strings), 0x0, NULL, HFILL } }, { &hf_dis_mod_param_transmitter_prim_mode, { "Transmitter Primary Mode", "dis.radio.mod_param.jtids.transmitter_primary_mode", FT_UINT8, BASE_DEC, VALS(DIS_PDU_TerminalPrimaryMode_Strings), 0x0, NULL, HFILL } }, { &hf_dis_mod_param_transmitter_second_mode, { "Transmitter Primary Mode", "dis.radio.mod_param.jtids.transmitter_secondary_mode", FT_UINT8, BASE_DEC, VALS(DIS_PDU_TerminalSecondaryMode_Strings), 0x0, NULL, HFILL } }, { &hf_dis_mod_param_sync_state, { "Synchronization State", "dis.radio.mod_param.jtids.sync_state", FT_UINT8, BASE_DEC, VALS(DIS_PDU_ModParamSyncState_Strings), 0x0, NULL, HFILL } }, { &hf_dis_mod_param_network_sync_id, { "Network Sync ID", "dis.radio.mod_param.jtids.network_sync_id", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_dis_antenna_pattern_parameter_dump, {"Antenna Pattern Parameter", "dis.radio.antenna_parameter", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL} }, }; /* Setup protocol subtree array */ static gint *ett[] = { &ett_dis, &ett_dis_header, &ett_dis_po_header, &ett_dis_ens, &ett_dis_crypto_key, &ett_dis_payload }; module_t *dis_module; proto_dis = proto_register_protocol(dis_proto_name, dis_proto_name_short, "dis"); proto_register_field_array(proto_dis, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); dis_module = prefs_register_protocol(proto_dis, proto_reg_handoff_dis); /* Create an unsigned integer preference to allow the user to specify the * UDP port on which to capture DIS packets. */ prefs_register_uint_preference(dis_module, "udp.port", "DIS UDP Port", "Set the UDP port for DIS messages", 10, &dis_udp_port); /* Perform the one-time initialization of the DIS parsers. */ initializeParsers(); initializeFieldParsers(); }