]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/Application/IpsecConfig/PolicyEntryOperation.h
NetworkPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / NetworkPkg / Application / IpsecConfig / PolicyEntryOperation.h
1 /** @file
2 The function declaration of policy entry operation in IpSecConfig application.
3
4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _POLICY_ENTRY_OPERATION_H_
11 #define _POLICY_ENTRY_OPERATION_H_
12
13 #define LOCAL BIT(0)
14 #define REMOTE BIT(1)
15 #define PROTO BIT(2)
16 #define LOCAL_PORT BIT(3)
17 #define REMOTE_PORT BIT(4)
18 #define ICMP_TYPE BIT(5)
19 #define ICMP_CODE BIT(6)
20 #define NAME BIT(7)
21 #define PACKET_FLAG BIT(8)
22 #define ACTION BIT(9)
23 #define EXT_SEQUENCE BIT(10)
24 #define SEQUENCE_OVERFLOW BIT(11)
25 #define FRAGMENT_CHECK BIT(12)
26 #define LIFEBYTE BIT(13)
27 #define LIFETIME_SOFT BIT(14)
28 #define LIFETIME BIT(15)
29 #define MODE BIT(16)
30 #define TUNNEL_LOCAL BIT(17)
31 #define TUNNEL_REMOTE BIT(18)
32 #define DONT_FRAGMENT BIT(19)
33 #define IPSEC_PROTO BIT(20)
34 #define AUTH_ALGO BIT(21)
35 #define ENCRYPT_ALGO BIT(22)
36 #define SPI BIT(23)
37 #define DEST BIT(24)
38 #define SEQUENCE_NUMBER BIT(25)
39 #define ANTIREPLAY_WINDOW BIT(26)
40 #define AUTH_KEY BIT(27)
41 #define ENCRYPT_KEY BIT(28)
42 #define PATH_MTU BIT(29)
43 #define SOURCE BIT(30)
44
45 #define PEER_ID BIT(0)
46 #define PEER_ADDRESS BIT(1)
47 #define AUTH_PROTO BIT(2)
48 #define AUTH_METHOD BIT(3)
49 #define IKE_ID BIT(4)
50 #define AUTH_DATA BIT(5)
51 #define REVOCATION_DATA BIT(6)
52
53 typedef struct {
54 EFI_IPSEC_CONFIG_DATA_TYPE DataType;
55 EFI_IPSEC_CONFIG_SELECTOR *Selector; // Data to be inserted.
56 VOID *Data;
57 UINT32 Mask;
58 POLICY_ENTRY_INDEXER Indexer;
59 EFI_STATUS Status; // Indicate whether insertion succeeds.
60 } EDIT_POLICY_ENTRY_CONTEXT;
61
62 typedef struct {
63 EFI_IPSEC_CONFIG_DATA_TYPE DataType;
64 EFI_IPSEC_CONFIG_SELECTOR *Selector; // Data to be inserted.
65 VOID *Data;
66 POLICY_ENTRY_INDEXER Indexer;
67 EFI_STATUS Status; // Indicate whether insertion succeeds.
68 } INSERT_POLICY_ENTRY_CONTEXT;
69
70 /**
71 The prototype for the CreateSpdEntry()/CreateSadEntry()/CreatePadEntry().
72 Fill in EFI_IPSEC_CONFIG_SELECTOR and corresponding data thru ParamPackage list.
73
74 @param[out] Selector The pointer to the EFI_IPSEC_CONFIG_SELECTOR union.
75 @param[out] Data The pointer to corresponding data.
76 @param[in] ParamPackage The pointer to the ParamPackage list.
77 @param[out] Mask The pointer to the Mask.
78 @param[in] CreateNew The switch to create new.
79
80 @retval EFI_SUCCESS Filled in EFI_IPSEC_CONFIG_SELECTOR and corresponding data successfully.
81 @retval EFI_INVALID_PARAMETER Invalid user input parameter.
82
83 **/
84 typedef
85 EFI_STATUS
86 (*CREATE_POLICY_ENTRY) (
87 OUT EFI_IPSEC_CONFIG_SELECTOR **Selector,
88 OUT VOID **Data,
89 IN LIST_ENTRY *ParamPackage,
90 OUT UINT32 *Mask,
91 IN BOOLEAN CreateNew
92 );
93
94 /**
95 The prototype for the CombineSpdEntry()/CombineSadEntry()/CombinePadEntry().
96 Combine old SPD/SAD/PAD entry with new SPD/SAD/PAD entry.
97
98 @param[in, out] OldSelector The pointer to the old EFI_IPSEC_CONFIG_SELECTOR union.
99 @param[in, out] OldData The pointer to the corresponding old data.
100 @param[in] NewSelector The pointer to the new EFI_IPSEC_CONFIG_SELECTOR union.
101 @param[in] NewData The pointer to the corresponding new data.
102 @param[in] Mask The pointer to the Mask.
103 @param[out] CreateNew The switch to create new.
104
105 @retval EFI_SUCCESS Combined successfully.
106 @retval EFI_INVALID_PARAMETER Invalid user input parameter.
107
108 **/
109 typedef
110 EFI_STATUS
111 (* COMBINE_POLICY_ENTRY) (
112 IN OUT EFI_IPSEC_CONFIG_SELECTOR *OldSelector,
113 IN OUT VOID *OldData,
114 IN EFI_IPSEC_CONFIG_SELECTOR *NewSelector,
115 IN VOID *NewData,
116 IN UINT32 Mask,
117 OUT BOOLEAN *CreateNew
118 );
119
120 /**
121 Insert or add entry information in database according to datatype.
122
123 @param[in] DataType The value of EFI_IPSEC_CONFIG_DATA_TYPE.
124 @param[in] ParamPackage The pointer to the ParamPackage list.
125
126 @retval EFI_SUCCESS Insert or add entry information successfully.
127 @retval EFI_NOT_FOUND Can't find the specified entry.
128 @retval EFI_BUFFER_TOO_SMALL The entry already existed.
129 @retval EFI_UNSUPPORTED The operation is not supported./
130 @retval Others Some mistaken case.
131 **/
132 EFI_STATUS
133 AddOrInsertPolicyEntry (
134 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType,
135 IN LIST_ENTRY *ParamPackage
136 );
137
138 /**
139 Edit entry information in the database according to datatype.
140
141 @param[in] DataType The value of EFI_IPSEC_CONFIG_DATA_TYPE.
142 @param[in] ParamPackage The pointer to the ParamPackage list.
143
144 @retval EFI_SUCCESS Edit entry information successfully.
145 @retval EFI_NOT_FOUND Can't find the specified entry.
146 @retval Others Some mistaken case.
147 **/
148 EFI_STATUS
149 EditPolicyEntry (
150 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType,
151 IN LIST_ENTRY *ParamPackage
152 );
153 #endif