void proto_register_user_encap(void) { module_t *module; expert_module_t* expert_user_encap; static uat_field_t user_flds[] = { UAT_FLD_VS(user_encap,encap,"DLT",user_dlts,"The DLT"), UAT_FLD_PROTO(user_encap,payload_proto,"Payload protocol", "Protocol to be used for the payload of this DLT"), UAT_FLD_DEC(user_encap,header_size,"Header size", "Size of an eventual header that precedes the actual payload, 0 means none"), UAT_FLD_PROTO(user_encap,header_proto,"Header protocol", "Protocol to be used for the header (empty = data)"), UAT_FLD_DEC(user_encap,trailer_size,"Trailer size", "Size of an eventual trailer that follows the actual payload, 0 means none"), UAT_FLD_PROTO(user_encap,trailer_proto,"Trailer protocol", "Protocol to be used for the trailer (empty = data)"), UAT_END_FIELDS }; static ei_register_info ei[] = { { &ei_user_encap_not_handled, { "user_dlt.not_handled", PI_UNDECODED, PI_WARN, "Formatted text", EXPFILL }}, }; proto_user_encap = proto_register_protocol("DLT User","DLT_USER","user_dlt"); expert_user_encap = expert_register_protocol(proto_user_encap); expert_register_field_array(expert_user_encap, ei, array_length(ei)); module = prefs_register_protocol(proto_user_encap, NULL); encaps_uat = uat_new("User DLTs Table", sizeof(user_encap_t), "user_dlts", TRUE, &encaps, &num_encaps, UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */ "ChUserDLTsSection", user_copy_cb, NULL, user_free_cb, NULL, user_flds ); prefs_register_uat_preference(module, "encaps_table", "Encapsulations Table", "A table that enumerates the various protocols to be used against a certain user DLT", encaps_uat); register_dissector("user_dlt",dissect_user,proto_user_encap); /* prefs_register_protocol_obsolete(proto_register_protocol("DLT User A","DLT_USER_A","user_dlt_a")); prefs_register_protocol_obsolete(proto_register_protocol("DLT User B","DLT_USER_B","user_dlt_b")); prefs_register_protocol_obsolete(proto_register_protocol("DLT User C","DLT_USER_C","user_dlt_c")); prefs_register_protocol_obsolete(proto_register_protocol("DLT User D","DLT_USER_D","user_dlt_d")); */ }
/*FUNCTION:------------------------------------------------------ * NAME * zbee_security_register * DESCRIPTION * Called by proto_register_zbee_nwk() to initialize the security * dissectors. * PARAMETERS * module_t zbee_prefs - Prefs module to load preferences under. * RETURNS * none *--------------------------------------------------------------- */ void zbee_security_register(module_t *zbee_prefs, int proto) { static hf_register_info hf[] = { { &hf_zbee_sec_key_id, { "Key Id", "zbee.sec.key", FT_UINT8, BASE_HEX, VALS(zbee_sec_key_names), ZBEE_SEC_CONTROL_KEY, NULL, HFILL }}, { &hf_zbee_sec_nonce, { "Extended Nonce", "zbee.sec.ext_nonce", FT_BOOLEAN, 8, NULL, ZBEE_SEC_CONTROL_NONCE, NULL, HFILL }}, { &hf_zbee_sec_counter, { "Frame Counter", "zbee.sec.counter", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_src64, { "Extended Source", "zbee.sec.src64", FT_EUI64, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_key_seqno, { "Key Sequence Number", "zbee.sec.key_seqno", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_mic, { "Message Integrity Code", "zbee.sec.mic", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_key_origin, { "Key Origin", "zbee.sec.key.origin", FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL }} }; static gint *ett[] = { &ett_zbee_sec, &ett_zbee_sec_control }; static uat_field_t key_uat_fields[] = { UAT_FLD_CSTRING(uat_key_records, string, "Key", "A 16-byte key in hexadecimal with optional dash-,\n" "colon-, or space-separator characters, or a\n" "a 16-character string in double-quotes."), UAT_FLD_VS(uat_key_records, byte_order, "Byte Order", byte_order_vals, "Byte order of key."), UAT_FLD_LSTRING(uat_key_records, label, "Label", "User label for key."), UAT_END_FIELDS }; /* If no prefs module was supplied, register our own. */ if (zbee_prefs == NULL) { zbee_prefs = prefs_register_protocol(proto, NULL); } /* Register preferences */ prefs_register_enum_preference(zbee_prefs, "seclevel", "Security Level", "Specifies the security level to use in the\n" "decryption process. This value is ignored\n" "for ZigBee 2004 and unsecured networks.", &gPREF_zbee_sec_level, zbee_sec_level_enums, FALSE); zbee_sec_key_table_uat = uat_new("Pre-configured Keys", sizeof(uat_key_record_t), "zigbee_pc_keys", TRUE, (void*) &uat_key_records, &num_uat_key_records, UAT_CAT_FFMT, NULL, /* TODO: ptr to help manual? */ uat_key_record_copy_cb, uat_key_record_update_cb, uat_key_record_free_cb, NULL, /* TODO: post_update */ key_uat_fields ); prefs_register_uat_preference(zbee_prefs, "key_table", "Pre-configured Keys", "Pre-configured link or network keys.", zbee_sec_key_table_uat); proto_register_field_array(proto, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); /* Register the init routine. */ register_init_routine(proto_init_zbee_security); } /* zbee_security_register */
void expert_packet_init(void) { module_t *module_expert; uat_t *expert_uat; static hf_register_info hf[] = { { &hf_expert_msg, { "Message", "_ws.expert.message", FT_STRING, BASE_NONE, NULL, 0, "Wireshark expert information", HFILL } }, { &hf_expert_group, { "Group", "_ws.expert.group", FT_UINT32, BASE_HEX, VALS(expert_group_vals), 0, "Wireshark expert group", HFILL } }, { &hf_expert_severity, { "Severity level", "_ws.expert.severity", FT_UINT32, BASE_HEX, VALS(expert_severity_vals), 0, "Wireshark expert severity level", HFILL } } }; static gint *ett[] = { &ett_expert, &ett_subexpert }; /* UAT for overriding severity levels */ static uat_field_t custom_expert_fields[] = { UAT_FLD_CSTRING(uat_expert_entries, field, "Field name", "Expert Info filter name"), UAT_FLD_VS(uat_expert_entries, severity, "Severity", expert_severity_vals, "Custom severity level"), UAT_END_FIELDS }; if (expert_tap == -1) { expert_tap = register_tap("expert"); } if (proto_expert == -1) { proto_expert = proto_register_protocol("Expert Info", "Expert", "_ws.expert"); proto_register_field_array(proto_expert, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); proto_set_cant_toggle(proto_expert); module_expert = prefs_register_protocol(proto_expert, NULL); expert_uat = uat_new("Expert Info Severity Level Configuration", sizeof(expert_level_entry_t), "expert_severity", TRUE, (void **)&uat_expert_entries, &expert_level_entry_count, UAT_AFFECTS_DISSECTION, NULL, uat_expert_copy_cb, uat_expert_update_cb, uat_expert_free_cb, uat_expert_post_update_cb, custom_expert_fields); prefs_register_uat_preference(module_expert, "expert_severity_levels", "Severity Level Configuration", "A table that overrides Expert Info field severity levels to user configured levels", expert_uat); } highest_severity = 0; proto_malformed = proto_get_id_by_filter_name("_ws.malformed"); }
/*FUNCTION:------------------------------------------------------ * NAME * zbee_security_register * DESCRIPTION * Called by proto_register_zbee_nwk() to initialize the security * dissectors. * PARAMETERS * module_t zbee_prefs - Prefs module to load preferences under. * RETURNS * none *--------------------------------------------------------------- */ void zbee_security_register(module_t *zbee_prefs, int proto) { static hf_register_info hf[] = { { &hf_zbee_sec_field, { "Security Control Field", "zbee.sec.field", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_key_id, { "Key Id", "zbee.sec.key_id", FT_UINT8, BASE_HEX, VALS(zbee_sec_key_names), ZBEE_SEC_CONTROL_KEY, NULL, HFILL }}, { &hf_zbee_sec_nonce, { "Extended Nonce", "zbee.sec.ext_nonce", FT_BOOLEAN, 8, NULL, ZBEE_SEC_CONTROL_NONCE, NULL, HFILL }}, { &hf_zbee_sec_counter, { "Frame Counter", "zbee.sec.counter", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_src64, { "Extended Source", "zbee.sec.src64", FT_EUI64, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_key_seqno, { "Key Sequence Number", "zbee.sec.key_seqno", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_mic, { "Message Integrity Code", "zbee.sec.mic", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_key, { "Key", "zbee.sec.key", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_key_origin, { "Key Origin", "zbee.sec.key.origin", FT_FRAMENUM, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_zbee_sec_decryption_key, { "Key Label", "zbee.sec.decryption_key", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }} }; static gint *ett[] = { &ett_zbee_sec, &ett_zbee_sec_control }; static ei_register_info ei[] = { { &ei_zbee_sec_encrypted_payload, { "zbee_sec.encrypted_payload", PI_UNDECODED, PI_WARN, "Encrypted Payload", EXPFILL }}, { &ei_zbee_sec_encrypted_payload_sliced, { "zbee_sec.encrypted_payload_sliced", PI_UNDECODED, PI_WARN, "Encrypted payload, cut short when capturing - can't decrypt", EXPFILL }}, { &ei_zbee_sec_extended_source_unknown, { "zbee_sec.extended_source_unknown", PI_PROTOCOL, PI_NOTE, "Extended Source: Unknown", EXPFILL }}, }; expert_module_t* expert_zbee_sec; static uat_field_t key_uat_fields[] = { UAT_FLD_CSTRING(uat_key_records, string, "Key", "A 16-byte key in hexadecimal with optional dash-,\n" "colon-, or space-separator characters, or a\n" "a 16-character string in double-quotes."), UAT_FLD_VS(uat_key_records, byte_order, "Byte Order", byte_order_vals, "Byte order of key."), UAT_FLD_CSTRING(uat_key_records, label, "Label", "User label for key."), UAT_END_FIELDS }; /* If no prefs module was supplied, register our own. */ if (zbee_prefs == NULL) { zbee_prefs = prefs_register_protocol(proto, NULL); } /* Register preferences */ prefs_register_enum_preference(zbee_prefs, "seclevel", "Security Level", "Specifies the security level to use in the\n" "decryption process. This value is ignored\n" "for ZigBee 2004 and unsecured networks.", &gPREF_zbee_sec_level, zbee_sec_level_enums, FALSE); zbee_sec_key_table_uat = uat_new("Pre-configured Keys", sizeof(uat_key_record_t), "zigbee_pc_keys", TRUE, &uat_key_records, &num_uat_key_records, UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */ NULL, /* TODO: ptr to help manual? */ uat_key_record_copy_cb, uat_key_record_update_cb, uat_key_record_free_cb, uat_key_record_post_update, key_uat_fields ); prefs_register_uat_preference(zbee_prefs, "key_table", "Pre-configured Keys", "Pre-configured link or network keys.", zbee_sec_key_table_uat); proto_register_field_array(proto, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_zbee_sec = expert_register_protocol(proto); expert_register_field_array(expert_zbee_sec, ei, array_length(ei)); } /* zbee_security_register */