45337b40c5486e5a8dea6eed0835a6f9bf28e1ea
[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 } ipsecMgrAppId_T;
49 typedef struct {
50 int flowId;
51 int qNum;
52 PKTIO_HANDLE_T* pktio_channel;
54 /* list to store offloaded RX SA appIds and RX Policies */
55 ipsecMgrAppId_T rx_sa[64];
56 /* list to store offloaded TX SA appIds */
57 ipsecMgrAppId_T tx_sa[64];
58 uint32_t oseq_offset; /* offset to outbound/egress sequence number */
59 int sa_tx_flow; /* flow SA to use to transmit packet */
60 int ipc_id; /* ipc_id to give name uniqueness to socket
61 connection with command shell */
62 int masterType; /* Specifies to run the daemon as NETAPI_SYS_MASTER or
63 NETAPI_PROC_MASTER */
64 } ipsecMgrMcb_t;
66 int netapilib_ifAddSA
67 (
68 ipsecmgr_af_t af,
69 ipsecmgr_sa_id_t *sa_id,
70 ipsecmgr_sa_info_t *sa_info,
71 ipsecmgr_sa_dscp_map_cfg_t *dscp_map_cfg,
72 ipsecmgr_ifname_t *if_name,
73 ipsecmgr_sa_encap_tmpl_t *encap,
74 ipsecmgr_fp_handle_t *sa_handle
75 );
77 int netapilib_ifAddSP
78 (
79 ipsecmgr_af_t af,
80 ipsecmgr_selector_t *sel,
81 ipsecmgr_dir_t dir,
82 uint32_t reqid,
83 ipsecmgr_fp_handle_t sa_handle,
84 ipsecmgr_policy_id_t policy_id,
85 ipsecmgr_fp_handle_t *sp_handle
86 );
88 int netapilib_ifDeleteSP
89 (
90 ipsecmgr_fp_handle_t sp_handle,
91 ipsecmgr_policy_id_t policy_id,
92 ipsecmgr_dir_t dir
93 );
95 int netapilib_ifDeleteSA
96 (
97 ipsecmgr_fp_handle_t sa_handle
98 );
100 int netapilib_ifGetSACtx
101 (
102 ipsecmgr_fp_handle_t sa_handle,
103 ipsecmgr_sa_hw_ctx_t *hw_ctx
104 );
106 #endif