2 The implementation of delete policy entry function in IpSecConfig application.
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "IpSecConfig.h"
23 Private function to delete entry information in database.
25 @param[in] Selector The pointer to EFI_IPSEC_CONFIG_SELECTOR structure.
26 @param[in] Data The pointer to Data.
27 @param[in] Context The pointer to DELETE_POLICY_ENTRY_CONTEXT.
29 @retval EFI_ABORTED Abort the iteration.
30 @retval EFI_SUCCESS Continue the iteration.
34 IN EFI_IPSEC_CONFIG_SELECTOR
*Selector
,
36 IN DELETE_POLICY_ENTRY_CONTEXT
*Context
39 if (mMatchPolicyEntry
[Context
->DataType
] (Selector
, Data
, &Context
->Indexer
)) {
40 Context
->Status
= mIpSecConfig
->SetData (
48 // Abort the iteration after the insertion.
57 Flush or delete entry information in the database according to datatype.
59 @param[in] DataType The value of EFI_IPSEC_CONFIG_DATA_TYPE.
60 @param[in] ParamPackage The pointer to the ParamPackage list.
62 @retval EFI_SUCCESS Delete entry information successfully.
63 @retval EFI_NOT_FOUND Can't find the specified entry.
64 @retval Others Some mistaken case.
67 FlushOrDeletePolicyEntry (
68 IN EFI_IPSEC_CONFIG_DATA_TYPE DataType
,
69 IN LIST_ENTRY
*ParamPackage
73 DELETE_POLICY_ENTRY_CONTEXT Context
;
74 CONST CHAR16
*ValueStr
;
77 // If user wants to remove all.
79 if (ShellCommandLineGetFlag (ParamPackage
, L
"-f")) {
80 Status
= mIpSecConfig
->SetData (
88 ValueStr
= ShellCommandLineGetValue (ParamPackage
, L
"-d");
89 if (ValueStr
== NULL
) {
90 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_IPSEC_CONFIG_INDEX_NOT_SPECIFIED
), mHiiHandle
, mAppName
, ValueStr
);
94 Status
= mConstructPolicyEntryIndexer
[DataType
] (&Context
.Indexer
, ParamPackage
);
95 if (!EFI_ERROR (Status
)) {
96 Context
.DataType
= DataType
;
97 Context
.Status
= EFI_NOT_FOUND
;
98 ForeachPolicyEntry (DataType
, (VISIT_POLICY_ENTRY
) DeletePolicyEntry
, &Context
);
99 Status
= Context
.Status
;
101 if (Status
== EFI_NOT_FOUND
) {
102 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_IPSEC_CONFIG_INDEX_NOT_FOUND
), mHiiHandle
, mAppName
, ValueStr
);
103 } else if (EFI_ERROR (Status
)) {
104 ShellPrintHiiEx (-1, -1, NULL
, STRING_TOKEN (STR_IPSEC_CONFIG_DELETE_FAILED
), mHiiHandle
, mAppName
);