/****************************************************************************** * FILE PURPOSE: local defines for net_test application. ****************************************************************************** * FILE NAME: net_test.h * * DESCRIPTION: NET TEST definitions and defines * * REVISION HISTORY: * * Copyright (c) Texas Instruments Incorporated 2010-2011 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* ============================================================= */ //IPSEC MODE(only choose one rx and one tx) #define IPSEC_MODE_RX_INFLOW 1 #define IPSEC_MODE_TX_INFLOW 2 #define IPSEC_MODE_RX_SIDEBAND 3 #define IPSEC_MODE_TX_SIDEBAND 4 #define MAX_SEC_INDEX 4 #define netTest_MAC_HEADER_LEN 14 #define netTest_IP_HEADER_LEN 20 #define netTest_UDP_HEADER_LEN 8 #define netTest_ESP_HEADER_LEN 8 #define netTest_AES_CBC_IV_LEN 16 #define netTest_AES_CTR_IV_CONTEXT_LEN 16 #define netTest_AES_CTR_IV_PACKET_LEN 8 #define netTest_3DES_CBC_IV_LEN 8 #define netTest_NULL_IV_LEN 0 #define netTest_ICV_LEN 12 /* The input strings for the input config file is given below */ #define INIT_CONFIG_MAC0 "mac0" #define INIT_CONFIG_MAC1 "mac1" #define INIT_CONFIG_IP0 "ip0" #define INIT_CONFIG_IP1 "ip1" #define INIT_CONFIG_IP2 "ip2" #define INIT_CONFIG_LOCAL_IPSEC_IP "local_ipsec_ip" #define INIT_CONFIG_REMOTE_IPSEC_IP "remote_ipsec_ip" #define INIT_CONFIG_IPSEC_MODE_RX "ipsec_mode_rx" #define INIT_CONFIG_IPSEC_MODE_TX "ipsec_mode_tx" #define INIT_CONFIG_IPSEC_IF_NO "ipsec_if" #define CONFIG_STRING_LEN 25 #define MAX_ROUTES 16 /* tmannan - begin */ typedef struct { nwalDmTxPayloadInfo_t tx_payload_info; uint8_t inner_ip_offset; NETCP_CFG_SA_T rx_tunnel; void * rx_data_mode_handle; void * rx_inflow_mode_handle; NETCP_CFG_SA_T tx_tunnel; void * tx_data_mode_handle; void * tx_inflow_mode_handle; uint8_t enc_key_length; uint8_t auth_tag_size; nwalTxPktInfo_t tx_pkt_info; nwal_saEALG cipherMode; /*stuff for routing use case */ unsigned int src; //BE unsigned int dst; //BE unsigned int spi; //BE unsigned int seq; //BE int iv_len; //iv len (size of iv in pkt) int bl; //block len (for padding calc) } netTestSA_t; typedef struct{ char mac0[CONFIG_STRING_LEN]; char mac1[CONFIG_STRING_LEN]; char ip0[CONFIG_STRING_LEN]; char ip1[CONFIG_STRING_LEN]; char ip2[CONFIG_STRING_LEN]; char local_ipsec_ip[CONFIG_STRING_LEN]; char remote_ipsec_ip[CONFIG_STRING_LEN]; char ipsec_mode_rx[CONFIG_STRING_LEN]; char ipsec_mode_tx[CONFIG_STRING_LEN]; char routes[MAX_ROUTES][CONFIG_STRING_LEN]; char ports[MAX_ROUTES][CONFIG_STRING_LEN]; char dst_ips[MAX_ROUTES][CONFIG_STRING_LEN]; char paths[MAX_ROUTES][CONFIG_STRING_LEN]; char ipsec_if_no[CONFIG_STRING_LEN]; } netTestConfigFile_t; typedef struct { unsigned char mac0[6]; unsigned char mac1[6]; nwalIpAddr_t ip0; nwalIpAddr_t ip1; nwalIpAddr_t ip2; nwalIpAddr_t local_ipsec_ip; nwalIpAddr_t remote_ipsec_ip; uint8_t ipsec_mode_rx; uint8_t ipsec_mode_tx; int ipsec_if_no; /* 0 if mac0, 1 if mac 1 */ } netTestConfig_t; typedef struct stats_t { long itx; //initially generated long itx2; long rx; long tx; long n_bad; long n_new; long n_class0_rx; //count of pkts classified long n_class1_rx; //count of pkts classified long n_class2_rx; //count of pkts classified long n_t1; long n_t2; long n_t3; long sec_tx; long sec_rx; long sb_tx; long sb_rx; long secp_rx; long n_auth_ok; unsigned long long app_cycles; unsigned long long send_cycles; unsigned long long tx_cache_cycles; unsigned long long total_decrypt_time; unsigned long long total_encrypt_time; long rx_min; long tx_min; } STATS_T; typedef struct head_t { long ip[5]; long udp[2]; } HEAD_T; typedef struct key_t { long src_ip; long dst_ip; short src_port; short dst_port; } KEY_T;