[keystone-rtos/netapi.git] / ti / runtime / netapi / applications / ipsec_offload / ipsecmgr / src / netapilib_interface.h
1 /*
2 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
15 * distribution.
16 *
17 * Neither the name of Texas Instruments Incorporated nor the names of
18 * its contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
35 #ifndef __FPLIB_INTERFACE_H__
36 #define __FPLIB_INTERFACE_H__
38 #include "ti/runtime/netapi/netapi.h"
39 #include <netdb.h>
42 /* Container for applicaion ID's for offloaded SA's */
43 typedef struct {
44 int in_use;
45 uint32_t saAppId;
46 uint32_t spAppId;
47 int iface;
48 } ipsecMgrAppId_T;
50 typedef struct {
51 int flowId[16];
52 int qNum[16];
53 PKTIO_HANDLE_T* pktio_channel[16];
55 /* list to store offloaded RX SA appIds and RX Policies */
56 ipsecMgrAppId_T rx_sa[64];
57 /* list to store offloaded TX SA appIds */
58 ipsecMgrAppId_T tx_sa[64];
59 } ipsecMgrMcb_t;
62 /* Container for applicaion ID's for offloaded SA's */
63 typedef struct {
64 char name[NI_MAXHOST];
65 char ip[16];
66 int iface;
67 } ipsecMgrIfConfigEntry_T;
72 int netapilib_ifAddSA
73 (
74 ipsecmgr_af_t af,
75 ipsecmgr_sa_id_t *sa_id,
76 ipsecmgr_sa_info_t *sa_info,
77 ipsecmgr_sa_dscp_map_cfg_t *dscp_map_cfg,
78 ipsecmgr_ifname_t *if_name,
79 ipsecmgr_sa_encap_tmpl_t *encap,
80 ipsecmgr_fp_handle_t *sa_handle
81 );
83 int netapilib_ifAddSP
84 (
85 ipsecmgr_af_t af,
86 ipsecmgr_selector_t *sel,
87 ipsecmgr_dir_t dir,
88 uint32_t reqid,
89 ipsecmgr_fp_handle_t sa_handle,
90 ipsecmgr_policy_id_t policy_id,
91 ipsecmgr_fp_handle_t *sp_handle
92 );
94 int netapilib_ifDeleteSP
95 (
96 ipsecmgr_fp_handle_t sp_handle,
97 ipsecmgr_policy_id_t policy_id,
98 ipsecmgr_dir_t dir
99 );
101 int netapilib_ifDeleteSA
102 (
103 ipsecmgr_fp_handle_t sa_handle
104 );
106 int netapilib_ifGetSACtx
107 (
108 ipsecmgr_fp_handle_t sa_handle,
109 ipsecmgr_sa_hw_ctx_t *hw_ctx
110 );
112 #endif