]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/netapi.git/blob - ti/runtime/netapi/netapi_sec.h
d88473a6810d1037e639bab3aee8855ab3783af0
[keystone-rtos/netapi.git] / ti / runtime / netapi / netapi_sec.h
1 /**************************************************************
2  * FILE PURPOSE :  NETAPI SECURITY CONFIGURATION-
3  *         user space access to security transport resources on SOC
4  **************************************************************
5  * @file netapi_sec.h
6  * 
7  * @brief DESCRIPTION:  netapi security  header file for user space transport
8  *               library
9  * 
10  * REVISION HISTORY:  rev 0.0.1 
11  *
12  *  Copyright (c) Texas Instruments Incorporated 2010-2011
13  * 
14  *  Redistribution and use in source and binary forms, with or without 
15  *  modification, are permitted provided that the following conditions 
16  *  are met:
17  *
18  *    Redistributions of source code must retain the above copyright 
19  *    notice, this list of conditions and the following disclaimer.
20  *
21  *    Redistributions in binary form must reproduce the above copyright
22  *    notice, this list of conditions and the following disclaimer in the 
23  *    documentation and/or other materials provided with the   
24  *    distribution.
25  *
26  *    Neither the name of Texas Instruments Incorporated nor the names of
27  *    its contributors may be used to endorse or promote products derived
28  *    from this software without specific prior written permission.
29  *
30  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
31  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
32  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
34  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
35  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
36  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
39  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
40  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 *****************************************************************************/
42 #ifndef __NETAPI_SEC__H
43 #define __NETAPI_SEC__H
44 #include "netapi.h"
45 #include "ti/runtime/pktlib/pktlib.h"
46 #include "ti/drv/nwal/nwal.h"
47 #include <ti/drv/sa/salld.h>
49 // To hold SA info */
50 typedef struct NETAPI_SEC_SA_INFO_tag
51 {
52     nwal_SaDir          dir;            /** Direction for the channel. Inbound or Outbound */
53     uint32_t            spi;               /**< IPSec Security Parameter index */
54     nwal_IpSecProto     proto;              /**< IpSec Proto (ESP/AH) */
55     nwal_saMode         saMode;         /**< Tunnel/ Transport mode */
56     nwal_IpType         ipType;             /**< IPV4 or V6 */
57     nwalIpAddr_t        src;            /**< Source IP Address (remote) */
58     nwalIpAddr_t        dst;           /**< DST IP Address (local) */
59     uint32_t            replayWindow;   /**< Replay Window Size */
60     nwal_saAALG         authMode;       /**< Authentication Algorithm */
61     nwal_saEALG         cipherMode;       /**< Encryption Algorithm */
62     uint32_t            esnLo;          /**< Initial Value of Extended Sequence Number LSB */
63     uint32_t            esnHi;          /**< Initial Value of Extended Sequence Number MSB */
64 } NETAPI_SEC_SA_INFO_T;
67 #define NETAPI_SEC_SA_INFLOW   0x2 
68 #define NETAPI_SEC_SA_SIDEBAND 0x1 
70 /******************************************************
71  ************************API***************************
72  *****************************************************/
74 //**********************************
75 //add SA
76 //*******************************************
77 NETCP_CFG_SA_T netapi_secAddSA(NETAPI_T h, //the  netapi handle
78                                 int iface_no, //inteface to attach to
79                                 NETAPI_SEC_SA_INFO_T *sa_info   ,//info on the SA
80                                 nwalSecKeyParams_t *key_params, //keys,etc
81                                 int mode, //SA implementation mode: inflow or sideband or both
82                                 NETCP_CFG_ROUTE_HANDLE_T  route,  //Optional route
83                                 void ** data_mode_handle, //returned data mode handle for pktio
84                                 void ** inflow_mode_handle,//returned inflow mode handle for pktio
85                                 int * perr);
87 //*****************************************
88 //delete SA
89 //*****************************************
90 void netapi_secDelSA(NETAPI_T h,int iface_no, NETCP_CFG_SA_T  sa_app_id,  int *perr);
92 //******************************************
93 // Add RX Security Policy
94 //******************************************
95 NETCP_CFG_IPSEC_POLICY_T netapi_secAddRxPolicy(NETAPI_T h, //the  netapi handle
96                                 NETCP_CFG_SA_T sa,  //tunnel to attach to
97                                 nwal_IpType ipType,     //V4 or V6
98                                 nwalIpAddr_t  * src_ip_addr,  //src (from where)
99                                 nwalIpAddr_t  * dst_ip_addr,  //dst (us)
100                                 nwalIpOpt_t * ip_qualifiers,  //other qualifiers
101                                 NETCP_CFG_ROUTE_HANDLE_T  route,  //Optional route
102                                 int * perr);
104 //******************************************
105 // Delete RX Security Policy
106 //******************************************
107 void netapi_secDelRxPolicy(NETAPI_T h,
108                               NETCP_CFG_IPSEC_POLICY_T policy_app_id, 
109                               int *perr);
114 #endif