/* ipmacsec_debug.h - IPMACSEC DEBUG-ONLY header file */ /* * Copyright (c) 2010 Wind River Systems, Inc. * * The right to copy, distribute, modify, or otherwise make use * of this software may be licensed only pursuant to the terms * of an applicable Wind River license agreement. * */ /* modification history -------------------- 01a,09feb10,mry Created */ #ifndef IPMACSEC_DEBUG_H #define IPMACSEC_DEBUG_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* This header file is to be included by internal modules for the purpose of * supporting DEBUG ONLY functionality. * The following APIs and definitions are to be used for debugging purposes ONLY. * They are not part of the official macsec APIs and are not intended for production systems. * Behavior when these APIs are invoked is not guaranteed to be valid * nor safe for normal operation and may have an impact on performance. */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #include #include #ifdef IP_PORT_VWORKS #include #endif #include "ipmacsec_h.h" #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #ifdef _WRS_CONFIG_IPMACSEC_DEBUG #ifndef IPMACSEC_DEBUG #define IPMACSEC_DEBUG #endif #endif #if defined(IP_DEBUG) || defined(IPMACSEC_DEBUG) #define IPMACSEC_USE_DUMP_PACKET #endif #ifdef IPMACSEC_DEBUG /* Define/Undefine some/all of these do increase/reduce debug output */ #undef IPMACSEC_DEBUG_SECY_INIT #undef IPMACSEC_DEBUG_SECY_CFG #undef IPMACSEC_DEBUG_SECY_CTRL #undef IPMACSEC_DEBUG_SECY_MGMT #undef IPMACSEC_DEBUG_SECY_MGMT_VERBOSE #undef IPMACSEC_DEBUG_SECY_IN_PROCESS #undef IPMACSEC_DEBUG_SECY_IN_PARSE #undef IPMACSEC_DEBUG_SECY_UCP_OUT #undef IPMACSEC_DEBUG_SECY_CP_OUT #undef IPMACSEC_DEBUG_SECY_OUT_PREP #undef IPMACSEC_DEBUG_IOCTL #undef IPMACSEC_DEBUG_CRYPTO #undef IPMACSEC_DEBUG_CRYPTO_PROTECT #undef IPMACSEC_DEBUG_CRYPTO_VALIDATE #undef IPMACSEC_DEBUG_CRYPTO_CIPH_GCMAES #undef IPMACSEC_DEBUG_CRYPTO_CIPH_GCMAES_DETAIL #undef IPMACSEC_DEBUG_NL #undef IPMACSEC_DEBUG_NL_VERBOSE #undef IPMACSEC_DEBUG_NL_BCAST #define IPMACSEC_DEBUG_CMD /* Recommend that this be kept on for debug builds */ #undef IPMACSEC_DEBUG_CMD_PARSE #undef IPMACSEC_DEBUG_DUMP_PKT #else #undef IPMACSEC_DEBUG_SECY_INIT #undef IPMACSEC_DEBUG_SECY_CFG #undef IPMACSEC_DEBUG_SECY_CTRL #undef IPMACSEC_DEBUG_SECY_MGMT #undef IPMACSEC_DEBUG_SECY_MGMT_VERBOSE #undef IPMACSEC_DEBUG_SECY_IN_PROCESS #undef IPMACSEC_DEBUG_SECY_IN_PARSE #undef IPMACSEC_DEBUG_SECY_UCP_OUT #undef IPMACSEC_DEBUG_SECY_CP_OUT #undef IPMACSEC_DEBUG_SECY_OUT_PREP #undef IPMACSEC_DEBUG_IOCTL #undef IPMACSEC_DEBUG_CRYPTO #undef IPMACSEC_DEBUG_CRYPTO_PROTECT #undef IPMACSEC_DEBUG_CRYPTO_VALIDATE #undef IPMACSEC_DEBUG_CRYPTO_CIPH_GCMAES #undef IPMACSEC_DEBUG_CRYPTO_CIPH_GCMAES_DETAIL #undef IPMACSEC_DEBUG_NL #undef IPMACSEC_DEBUG_NL_VERBOSE #undef IPMACSEC_DEBUG_NL_BCAST #undef IPMACSEC_DEBUG_CMD #undef IPMACSEC_DEBUG_CMD_PARSE #undef IPMACSEC_DEBUG_DUMP_PKT #endif #ifdef IPMACSEC_DEBUG_DUMP_PKT #define IPMACSEC_DUMP_PKT ipmacsec_dump_packet #else #define IPMACSEC_DUMP_PKT(...) {} #endif #ifdef IPMACSEC_UNIT_TEST #if !defined(_WRS_CONFIG_IPMACSEC_DEBUG) && !defined(IPMACSEC_DEBUG) #error Must Select IPMACSEC_DEBUG VSB component or define IPMACSEC_DEBUG to be able to enable IPMACSEC_UNIT_TEST #endif #warning IPMACSEC_UNIT_TEST SHOULD ONLY BE TURNED ON FOR UNIT TESTING #endif #ifdef IPMACSEC_UNIT_TEST_INLINE_HARDCODED_CONFIG #ifndef IPMACSEC_UNIT_TEST #error IPMACSEC_UNIT_TEST must be defined before IPMACSEC_UNIT_TEST_INLINE_HARDCODED_CONFIG can be defined #endif #warning IPMACSEC_UNIT_TEST SHOULD ONLY BE TURNED ON FOR DEBUGGING PURPOSES ON NON_PRODUCTION SYSTEMS #endif /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ IPMACSEC_PRIVATE void ipmacsec_dump_packet(char *desc, Ipcom_pkt *pkt); IPMACSEC_PRIVATE void ipmacsec_dump_buffer(IP_CONST char *desc, IP_CONST Ip_u8* buf, IP_CONST Ip_u32 len); #ifdef IPMACSEC_UNIT_TEST IP_GLOBAL int ipmacsec_netlink_monitor_test(Ip_u32 timeout); IP_GLOBAL int ipmacsec_secy_monitor_test_start_daemon(char *ifname, Ip_u32 timeout); IP_GLOBAL int ipmacsec_netlink_test(void); IP_GLOBAL int ipmacsec_netlink_multi_test(char *ifname); IP_GLOBAL int ipmacsec_key_test(char *ifname); IP_GLOBAL int ipmacsec_ctrl_cmd_test(char *ifname); IP_GLOBAL int ipmacsec_sc_sa_test(char *ifname); IP_GLOBAL void ipmacsec_counter_format_test(void); IP_GLOBAL int ipmacsec_parse_sci_string_test(void); IP_GLOBAL int ipmacsec_secy_ucp_test(char *ifname, Ip_u32 num_expected_pkts, Ip_u32 timeout); IP_GLOBAL int ipmacsec_secy_ucp_test_start_daemon(char *ifname, Ip_u32 num_expected_pkts, Ip_u32 timeout); IP_GLOBAL Ip_u32 ipmacsec_secy_ucp_test_daemon_num_rcv_pkts(void); IP_GLOBAL Ipmacsec_lmi_error ipmacsec_lmi_secy_setup_ut_profile(char *ifname, Ip_u8 ut_profile_index); #endif #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */