diff options
Diffstat (limited to 'epan/dissectors/packet-pktc.c')
-rw-r--r-- | epan/dissectors/packet-pktc.c | 211 |
1 files changed, 112 insertions, 99 deletions
diff --git a/epan/dissectors/packet-pktc.c b/epan/dissectors/packet-pktc.c index 299af7a9cb..a9d17333d1 100644 --- a/epan/dissectors/packet-pktc.c +++ b/epan/dissectors/packet-pktc.c @@ -39,8 +39,8 @@ #include "packet-kerberos.h" #include "packet-snmp.h" -#define PKTC_PORT 1293 -#define PKTC_MTAFQDN_PORT 2246 +#define PKTC_PORT 1293 +#define PKTC_MTAFQDN_PORT 2246 void proto_register_pktc(void); void proto_reg_handoff_pktc(void); @@ -95,43 +95,43 @@ static gint ett_pktc_mtafqdn = -1; static expert_field ei_pktc_unknown_kmmid = EI_INIT; static expert_field ei_pktc_unknown_doi = EI_INIT; -#define KMMID_WAKEUP 0x01 -#define KMMID_AP_REQUEST 0x02 -#define KMMID_AP_REPLY 0x03 -#define KMMID_SEC_PARAM_REC 0x04 -#define KMMID_REKEY 0x05 -#define KMMID_ERROR_REPLY 0x06 +#define KMMID_WAKEUP 0x01 +#define KMMID_AP_REQUEST 0x02 +#define KMMID_AP_REPLY 0x03 +#define KMMID_SEC_PARAM_REC 0x04 +#define KMMID_REKEY 0x05 +#define KMMID_ERROR_REPLY 0x06 static const value_string kmmid_types[] = { - { KMMID_WAKEUP , "Wake Up" }, - { KMMID_AP_REQUEST , "AP Request" }, - { KMMID_AP_REPLY , "AP Reply" }, - { KMMID_SEC_PARAM_REC , "Security Parameter Recovered" }, - { KMMID_REKEY , "Rekey" }, - { KMMID_ERROR_REPLY , "Error Reply" }, + { KMMID_WAKEUP , "Wake Up" }, + { KMMID_AP_REQUEST , "AP Request" }, + { KMMID_AP_REPLY , "AP Reply" }, + { KMMID_SEC_PARAM_REC , "Security Parameter Recovered" }, + { KMMID_REKEY , "Rekey" }, + { KMMID_ERROR_REPLY , "Error Reply" }, { 0, NULL } }; -#define DOI_IPSEC 1 -#define DOI_SNMPv3 2 -#define SNMPv3_NULL 0x20 -#define SNMPv3_DES 0x21 -#define SNMPv3_HMAC_MD5 0x21 +#define DOI_IPSEC 0x01 +#define DOI_SNMPv3 0x02 +#define SNMPv3_NULL 0x20 +#define SNMPv3_DES 0x21 +#define SNMPv3_HMAC_MD5 0x21 #define SNMPv3_HMAC_SHA1 0x22 -#define ESP_3DES 0x03 -#define ESP_RC5 0x04 -#define ESP_IDEA 0x05 -#define ESP_CAST 0x06 -#define ESP_BLOWFISH 0x07 -#define ESP_NULL 0x0b -#define ESP_AES 0x0c -#define HMAC_MD5_96 0x01 -#define HMAC_SHA1_96 0x02 +#define ESP_3DES 0x03 +#define ESP_RC5 0x04 +#define ESP_IDEA 0x05 +#define ESP_CAST 0x06 +#define ESP_BLOWFISH 0x07 +#define ESP_NULL 0x0b +#define ESP_AES 0x0c +#define HMAC_MD5_96 0x01 +#define HMAC_SHA1_96 0x02 /* Domain of Interpretation */ static const value_string doi_types[] = { - { DOI_IPSEC , "IPsec" }, - { DOI_SNMPv3 , "SNMPv3" }, + { DOI_IPSEC , "IPsec" }, + { DOI_SNMPv3 , "SNMPv3" }, { 0, NULL } }; @@ -156,7 +156,7 @@ static const value_string ipsec_transform_id_vals[] = { { ESP_BLOWFISH , "BLOWFISH" }, { ESP_NULL , "NULL" }, /* no encryption, RFC 2410 */ { ESP_AES , "AES-128" }, - { 0 , NULL } + { 0 , NULL } }; static const value_string ipsec_authentication_algorithm_vals[] = { @@ -173,7 +173,7 @@ static const value_string pktc_mtafqdn_msgtype_vals[] = { { PKTC_MTAFQDN_REQ, "MTA FQDN Request" }, { PKTC_MTAFQDN_REP, "MTA FQDN Reply" }, { PKTC_MTAFQDN_ERR, "MTA FQDN Error Reply" }, - { 0 , NULL } + { 0 , NULL } }; static int @@ -234,8 +234,8 @@ dissect_pktc_app_specific_data(packet_info *pinfo, proto_tree *parent_tree, tvbu case DOI_IPSEC: switch(kmmid){ /* we don't distinguish between SPIs for inbound Security Associations - of the client (AP-REQ) vs. server (AP-REP, REKEY). Feel free to add - separation for this if it is imporant enough for you. */ + of the client (AP-REQ) vs. server (AP-REP, REKEY). Feel free to add + separation for this if it is imporant enough for you. */ case KMMID_AP_REQUEST: case KMMID_AP_REPLY: case KMMID_REKEY: @@ -243,12 +243,12 @@ dissect_pktc_app_specific_data(packet_info *pinfo, proto_tree *parent_tree, tvbu proto_tree_add_item(tree, hf_pktc_ipsec_spi, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; - break; + break; default: proto_tree_add_expert(tree, pinfo, &ei_pktc_unknown_kmmid, tvb, offset, 1); THROW(ReportedBoundsError); /* bail out and inform user we can't dissect the packet */ }; - break; + break; default: proto_tree_add_expert(tree, pinfo, &ei_pktc_unknown_doi, tvb, offset, 1); THROW(ReportedBoundsError); /* bail out and inform user we can't dissect the packet */ @@ -290,8 +290,8 @@ dissect_pktc_list_of_ciphersuites(packet_info *pinfo _U_, proto_tree *parent_tre proto_tree_add_item(tree, hf_pktc_snmpEncryptionTransformID, tvb, offset, 1, ENC_BIG_ENDIAN); proto_item_append_text(tree, "/%s", val_to_str(tvb_get_guint8(tvb, offset), snmp_transform_id_vals, "%0x")); offset+=1; - } - break; + } + break; case DOI_IPSEC: for(i=0;i<len;i++){ /* IPsec authentication algorithm */ @@ -303,11 +303,11 @@ dissect_pktc_list_of_ciphersuites(packet_info *pinfo _U_, proto_tree *parent_tre proto_tree_add_item(tree, hf_pktc_ipsecEncryptionTransformID, tvb, offset, 1, ENC_BIG_ENDIAN); proto_item_append_text(tree, "/%s", val_to_str(tvb_get_guint8(tvb, offset), ipsec_transform_id_vals, "%0x")); offset+=1; - } + } break; default: proto_tree_add_expert(tree, pinfo, &ei_pktc_unknown_doi, tvb, offset, 1); - THROW(ReportedBoundsError); /* bail out and inform user we can't dissect the packet */ + THROW(ReportedBoundsError); /* bail out and inform user we can't dissect the packet */ } proto_item_set_len(item, offset-old_offset); @@ -438,7 +438,7 @@ dissect_pktc_rekey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs timestr=tvb_get_ptr(tvb, offset, 13); proto_tree_add_string_format_value(tree, hf_pktc_timestamp, tvb, offset, 13, timestr, "%.2s-%.2s-%.2s %.2s:%.2s:%.2s", - timestr, timestr+2, timestr+4, timestr+6, timestr+8, timestr+10); + timestr, timestr+2, timestr+4, timestr+6, timestr+8, timestr+10); offset+=13; /* app specific data */ @@ -607,14 +607,14 @@ dissect_pktc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* fill COL_INFO */ col_add_str(pinfo->cinfo, COL_INFO, - val_to_str(kmmid, kmmid_types, "Unknown KMMID %#x")); - col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", - val_to_str(doi, doi_types, "Unknown DOI %#x")); + val_to_str(kmmid, kmmid_types, "Unknown KMMID %#x")); + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", + val_to_str(doi, doi_types, "Unknown DOI %#x")); switch(kmmid){ case KMMID_WAKEUP: offset=dissect_pktc_wakeup(pktc_tree, tvb, offset); - break; + break; case KMMID_AP_REQUEST: offset=dissect_pktc_ap_request(pinfo, pktc_tree, tvb, offset, doi); break; @@ -623,13 +623,13 @@ dissect_pktc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case KMMID_SEC_PARAM_REC: offset=dissect_pktc_sec_param_rec(pktc_tree, tvb, offset); - break; + break; case KMMID_REKEY: offset=dissect_pktc_rekey(pinfo, pktc_tree, tvb, offset, doi); - break; + break; case KMMID_ERROR_REPLY: offset=dissect_pktc_error_reply(pinfo, pktc_tree, tvb, offset); - break; + break; }; proto_item_set_len(item, offset); @@ -639,84 +639,84 @@ void proto_register_pktc(void) { static hf_register_info hf[] = { - { &hf_pktc_kmmid, { - "Key Management Message ID", "pktc.kmmid", FT_UINT8, BASE_HEX, - VALS(kmmid_types), 0, NULL, HFILL }}, - { &hf_pktc_doi, { - "Domain of Interpretation", "pktc.doi", FT_UINT8, BASE_DEC, - VALS(doi_types), 0, NULL, HFILL }}, - { &hf_pktc_version_major, { - "Major version", "pktc.version.major", FT_UINT8, BASE_DEC, - NULL, 0xF0, "Major version of PKTC", HFILL }}, - { &hf_pktc_version_minor, { - "Minor version", "pktc.version.minor", FT_UINT8, BASE_DEC, - NULL, 0x0F, "Minor version of PKTC", HFILL }}, - { &hf_pktc_server_nonce, { - "Server Nonce", "pktc.server_nonce", FT_UINT32, BASE_HEX, - NULL, 0, "Server Nonce random number", HFILL }}, - { &hf_pktc_server_principal, { - "Server Kerberos Principal Identifier", "pktc.server_principal", FT_STRING, BASE_NONE, - NULL, 0, NULL, HFILL }}, - { &hf_pktc_timestamp, { - "Timestamp", "pktc.timestamp", FT_STRING, BASE_NONE, - NULL, 0, "Timestamp (UTC)", HFILL }}, - { &hf_pktc_app_spec_data, { - "Application Specific Data", "pktc.asd", FT_NONE, BASE_NONE, - NULL, 0, "KMMID/DOI application specific data", HFILL }}, - { &hf_pktc_list_of_ciphersuites, { + { &hf_pktc_kmmid, { + "Key Management Message ID", "pktc.kmmid", FT_UINT8, BASE_HEX, + VALS(kmmid_types), 0, NULL, HFILL }}, + { &hf_pktc_doi, { + "Domain of Interpretation", "pktc.doi", FT_UINT8, BASE_DEC, + VALS(doi_types), 0, NULL, HFILL }}, + { &hf_pktc_version_major, { + "Major version", "pktc.version.major", FT_UINT8, BASE_DEC, + NULL, 0xF0, "Major version of PKTC", HFILL }}, + { &hf_pktc_version_minor, { + "Minor version", "pktc.version.minor", FT_UINT8, BASE_DEC, + NULL, 0x0F, "Minor version of PKTC", HFILL }}, + { &hf_pktc_server_nonce, { + "Server Nonce", "pktc.server_nonce", FT_UINT32, BASE_HEX, + NULL, 0, "Server Nonce random number", HFILL }}, + { &hf_pktc_server_principal, { + "Server Kerberos Principal Identifier", "pktc.server_principal", FT_STRING, BASE_NONE, + NULL, 0, NULL, HFILL }}, + { &hf_pktc_timestamp, { + "Timestamp", "pktc.timestamp", FT_STRING, BASE_NONE, + NULL, 0, "Timestamp (UTC)", HFILL }}, + { &hf_pktc_app_spec_data, { + "Application Specific Data", "pktc.asd", FT_NONE, BASE_NONE, + NULL, 0, "KMMID/DOI application specific data", HFILL }}, + { &hf_pktc_list_of_ciphersuites, { "List of Ciphersuites", "pktc.ciphers", FT_NONE, BASE_NONE, - NULL, 0, NULL, HFILL }}, - { &hf_pktc_list_of_ciphersuites_len, { + NULL, 0, NULL, HFILL }}, + { &hf_pktc_list_of_ciphersuites_len, { "Number of Ciphersuites", "pktc.ciphers.len", FT_UINT8, BASE_DEC, - NULL, 0, NULL, HFILL }}, - { &hf_pktc_snmpAuthenticationAlgorithm, { + NULL, 0, NULL, HFILL }}, + { &hf_pktc_snmpAuthenticationAlgorithm, { "SNMPv3 Authentication Algorithm", "pktc.asd.snmp_auth_alg", FT_UINT8, BASE_HEX, VALS(snmp_authentication_algorithm_vals), 0, NULL, HFILL }}, - { &hf_pktc_snmpEncryptionTransformID, { + { &hf_pktc_snmpEncryptionTransformID, { "SNMPv3 Encryption Transform ID", "pktc.asd.snmp_enc_alg", FT_UINT8, BASE_HEX, VALS(snmp_transform_id_vals), 0, NULL, HFILL }}, - { &hf_pktc_ipsecAuthenticationAlgorithm, { + { &hf_pktc_ipsecAuthenticationAlgorithm, { "IPsec Authentication Algorithm", "pktc.asd.ipsec_auth_alg", FT_UINT8, BASE_HEX, VALS(ipsec_authentication_algorithm_vals), 0, NULL, HFILL }}, - { &hf_pktc_ipsecEncryptionTransformID, { + { &hf_pktc_ipsecEncryptionTransformID, { "IPsec Encryption Transform ID", "pktc.asd.ipsec_enc_alg", FT_UINT8, BASE_HEX, VALS(ipsec_transform_id_vals), 0, NULL, HFILL }}, - { &hf_pktc_snmpEngineID_len, { + { &hf_pktc_snmpEngineID_len, { "SNMPv3 Engine ID Length", "pktc.asd.snmp_engine_id.len", FT_UINT8, BASE_DEC, NULL, 0, "Length of SNMPv3 Engine ID", HFILL }}, - { &hf_pktc_snmpEngineID, { + { &hf_pktc_snmpEngineID, { "SNMPv3 Engine ID", "pktc.asd.snmp_engine_id", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, - { &hf_pktc_snmpEngineBoots, { + { &hf_pktc_snmpEngineBoots, { "SNMPv3 Engine Boots", "pktc.asd.snmp_engine_boots", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, - { &hf_pktc_snmpEngineTime, { + { &hf_pktc_snmpEngineTime, { "SNMPv3 Engine Time", "pktc.asd.snmp_engine_time", FT_UINT32, BASE_DEC, NULL, 0, "SNMPv3 Engine ID Time", HFILL }}, - { &hf_pktc_usmUserName_len, { + { &hf_pktc_usmUserName_len, { "SNMPv3 USM User Name Length", "pktc.asd.snmp_usm_username.len", FT_UINT8, BASE_DEC, NULL, 0, "Length of SNMPv3 USM User Name", HFILL }}, - { &hf_pktc_usmUserName, { + { &hf_pktc_usmUserName, { "SNMPv3 USM User Name", "pktc.asd.snmp_usm_username", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, - { &hf_pktc_ipsec_spi, { + { &hf_pktc_ipsec_spi, { "IPsec Security Parameter Index", "pktc.asd.ipsec_spi", FT_UINT32, BASE_HEX, NULL, 0, "Security Parameter Index for inbound Security Association (IPsec)", HFILL }}, - { &hf_pktc_reestablish_flag, { - "Re-establish Flag", "pktc.reestablish", FT_BOOLEAN, BASE_NONE, - NULL, 0x0, NULL, HFILL }}, - { &hf_pktc_ack_required_flag, { - "ACK Required Flag", "pktc.ack_required", FT_BOOLEAN, BASE_NONE, - NULL, 0x0, NULL, HFILL }}, - { &hf_pktc_sec_param_lifetime, { - "Security Parameter Lifetime", "pktc.spl", FT_UINT32, BASE_DEC, - NULL, 0, "Lifetime in seconds of security parameter", HFILL }}, + { &hf_pktc_reestablish_flag, { + "Re-establish Flag", "pktc.reestablish", FT_BOOLEAN, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + { &hf_pktc_ack_required_flag, { + "ACK Required Flag", "pktc.ack_required", FT_BOOLEAN, BASE_NONE, + NULL, 0x0, NULL, HFILL }}, + { &hf_pktc_sec_param_lifetime, { + "Security Parameter Lifetime", "pktc.spl", FT_UINT32, BASE_DEC, + NULL, 0, "Lifetime in seconds of security parameter", HFILL }}, { &hf_pktc_sha1_hmac, { "SHA-1 HMAC", "pktc.sha1_hmac", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, - { &hf_pktc_grace_period, { - "Grace Period", "pktc.grace_period", FT_UINT32, BASE_DEC, - NULL, 0, "Grace Period in seconds", HFILL }}, + { &hf_pktc_grace_period, { + "Grace Period", "pktc.grace_period", FT_UINT32, BASE_DEC, + NULL, 0, "Grace Period in seconds", HFILL }}, }; static gint *ett[] = { &ett_pktc, @@ -797,3 +797,16 @@ proto_reg_handoff_pktc_mtafqdn(void) pktc_mtafqdn_handle = create_dissector_handle(dissect_pktc_mtafqdn, proto_pktc); dissector_add_uint("udp.port", PKTC_MTAFQDN_PORT, pktc_mtafqdn_handle); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ |