void proto_register_ethertype(void) { /* Decode As handling */ static build_valid_func eth_da_build_value[1] = {eth_value}; static decode_as_value_t eth_da_values = {eth_prompt, 1, eth_da_build_value}; static decode_as_t ethertype_da = {"ethertype", "Link", "ethertype", 1, 0, ð_da_values, NULL, NULL, decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; proto_ethertype = proto_register_protocol("Ethertype", "Ethertype", "ethertype"); new_register_dissector("ethertype", dissect_ethertype, proto_ethertype); /* subdissector code */ ethertype_dissector_table = register_dissector_table("ethertype", "Ethertype", FT_UINT16, BASE_HEX); register_decode_as(ðertype_da); }
void proto_register_ethertype(void) { /* Decode As handling */ static build_valid_func eth_da_build_value[1] = {eth_value}; static decode_as_value_t eth_da_values = {eth_prompt, 1, eth_da_build_value}; static decode_as_t ethertype_da = {"ethertype", "Link", "ethertype", 1, 0, ð_da_values, NULL, NULL, decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; proto_ethertype = proto_register_protocol("Ethertype", "Ethertype", "ethertype"); /* This isn't a real protocol, so you can't disable its dissection. */ proto_set_cant_toggle(proto_ethertype); register_dissector("ethertype", dissect_ethertype, proto_ethertype); /* subdissector code */ ethertype_dissector_table = register_dissector_table("ethertype", "Ethertype", proto_ethertype, FT_UINT16, BASE_HEX, DISSECTOR_TABLE_NOT_ALLOW_DUPLICATE); register_capture_dissector_table("ethertype", "Ethertype"); register_decode_as(ðertype_da); }
void proto_register_udp(void) { module_t *udp_module; module_t *udplite_module; expert_module_t* expert_udp; #ifndef HAVE_HFI_SECTION_INIT static header_field_info *hfi[] = { &hfi_udp_srcport, &hfi_udp_dstport, &hfi_udp_port, &hfi_udp_stream, &hfi_udp_length, &hfi_udp_checksum, &hfi_udp_checksum_calculated, &hfi_udp_checksum_good, &hfi_udp_checksum_bad, &hfi_udp_proc_src_uid, &hfi_udp_proc_src_pid, &hfi_udp_proc_src_uname, &hfi_udp_proc_src_cmd, &hfi_udp_proc_dst_uid, &hfi_udp_proc_dst_pid, &hfi_udp_proc_dst_uname, &hfi_udp_proc_dst_cmd, }; static header_field_info *hfi_lite[] = { &hfi_udplite_checksum_coverage_bad, &hfi_udplite_checksum_coverage, }; #endif static gint *ett[] = { &ett_udp, &ett_udp_checksum, &ett_udp_process_info }; static ei_register_info ei[] = { { &ei_udp_possible_traceroute, { "udp.possible_traceroute", PI_SEQUENCE, PI_CHAT, "Possible traceroute", EXPFILL }}, { &ei_udp_length, { "udp.length.bad", PI_MALFORMED, PI_ERROR, "Bad length value", EXPFILL }}, { &ei_udplite_checksum_coverage, { "udp.checksum_coverage.expert", PI_MALFORMED, PI_ERROR, "Bad checksum coverage length value", EXPFILL }}, { &ei_udp_checksum_zero, { "udp.checksum.zero", PI_CHECKSUM, PI_ERROR, "Illegal Checksum value (0)", EXPFILL }}, { &ei_udp_checksum_bad, { "udp.checksum_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; static build_valid_func udp_da_src_values[1] = {udp_src_value}; static build_valid_func udp_da_dst_values[1] = {udp_dst_value}; static build_valid_func udp_da_both_values[2] = {udp_src_value, udp_dst_value}; static decode_as_value_t udp_da_values[3] = {{udp_src_prompt, 1, udp_da_src_values}, {udp_dst_prompt, 1, udp_da_dst_values}, {udp_both_prompt, 2, udp_da_both_values}}; static decode_as_t udp_da = {"udp", "Transport", "udp.port", 3, 2, udp_da_values, "UDP", "port(s) as", decode_as_default_populate_list, decode_as_default_reset, decode_as_default_change, NULL}; int proto_udp, proto_udplite; proto_udp = proto_register_protocol("User Datagram Protocol", "UDP", "udp"); hfi_udp = proto_registrar_get_nth(proto_udp); udp_handle = register_dissector("udp", dissect_udp, proto_udp); expert_udp = expert_register_protocol(proto_udp); proto_register_fields(proto_udp, hfi, array_length(hfi)); proto_udplite = proto_register_protocol("Lightweight User Datagram Protocol", "UDPlite", "udplite"); udplite_handle = create_dissector_handle(dissect_udplite, proto_udplite); hfi_udplite = proto_registrar_get_nth(proto_udplite); proto_register_fields(proto_udplite, hfi_lite, array_length(hfi_lite)); proto_register_subtree_array(ett, array_length(ett)); expert_register_field_array(expert_udp, ei, array_length(ei)); /* subdissector code */ udp_dissector_table = register_dissector_table("udp.port", "UDP port", FT_UINT16, BASE_DEC); register_heur_dissector_list("udp", &heur_subdissector_list); register_heur_dissector_list("udplite", &heur_subdissector_list); /* Register configuration preferences */ udp_module = prefs_register_protocol(proto_udp, NULL); prefs_register_bool_preference(udp_module, "summary_in_tree", "Show UDP summary in protocol tree", "Whether the UDP summary line should be shown in the protocol tree", &udp_summary_in_tree); prefs_register_bool_preference(udp_module, "try_heuristic_first", "Try heuristic sub-dissectors first", "Try to decode a packet using an heuristic sub-dissector" " before using a sub-dissector registered to a specific port", &try_heuristic_first); prefs_register_bool_preference(udp_module, "check_checksum", "Validate the UDP checksum if possible", "Whether to validate the UDP checksum", &udp_check_checksum); prefs_register_bool_preference(udp_module, "process_info", "Collect process flow information", "Collect process flow information from IPFIX", &udp_process_info); udplite_module = prefs_register_protocol(proto_udplite, NULL); prefs_register_bool_preference(udplite_module, "ignore_checksum_coverage", "Ignore UDPlite checksum coverage", "Ignore an invalid checksum coverage field and continue dissection", &udplite_ignore_checksum_coverage); prefs_register_bool_preference(udplite_module, "check_checksum", "Validate the UDPlite checksum if possible", "Whether to validate the UDPlite checksum", &udplite_check_checksum); register_decode_as(&udp_da); register_init_routine(udp_init); }