EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

NetworkPkg/Application/IpsecConfig/Delete.c

Go to the documentation of this file.
00001 
00016 #include "IpSecConfig.h"
00017 #include "Indexer.h"
00018 #include "Delete.h"
00019 #include "Match.h"
00020 #include "ForEach.h"
00021 
00032 EFI_STATUS
00033 DeletePolicyEntry (
00034   IN EFI_IPSEC_CONFIG_SELECTOR      *Selector,
00035   IN VOID                           *Data,
00036   IN DELETE_POLICY_ENTRY_CONTEXT    *Context
00037   )
00038 {
00039   if (mMatchPolicyEntry[Context->DataType] (Selector, Data, &Context->Indexer)) {
00040     Context->Status = mIpSecConfig->SetData (
00041                                       mIpSecConfig,
00042                                       Context->DataType,
00043                                       Selector,
00044                                       NULL,
00045                                       NULL
00046                                       );
00047     //
00048     // Abort the iteration after the insertion.
00049     //
00050     return EFI_ABORTED;
00051   }
00052 
00053   return EFI_SUCCESS;
00054 }
00055 
00066 EFI_STATUS
00067 FlushOrDeletePolicyEntry (
00068   IN EFI_IPSEC_CONFIG_DATA_TYPE    DataType,
00069   IN LIST_ENTRY                    *ParamPackage
00070   )
00071 {
00072   EFI_STATUS                     Status;
00073   DELETE_POLICY_ENTRY_CONTEXT    Context;
00074   CONST CHAR16                   *ValueStr;
00075 
00076   //
00077   // If user wants to remove all.
00078   //
00079   if (ShellCommandLineGetFlag (ParamPackage, L"-f")) {
00080     Status = mIpSecConfig->SetData (
00081                              mIpSecConfig,
00082                              DataType,
00083                              NULL,
00084                              NULL,
00085                              NULL
00086                              );
00087   } else {
00088     ValueStr = ShellCommandLineGetValue (ParamPackage, L"-d");
00089     if (ValueStr == NULL) {
00090       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INDEX_NOT_SPECIFIED), mHiiHandle, mAppName, ValueStr);
00091       return EFI_NOT_FOUND;
00092     }
00093 
00094     Status = mConstructPolicyEntryIndexer[DataType] (&Context.Indexer, ParamPackage);
00095     if (!EFI_ERROR (Status)) {
00096       Context.DataType  = DataType;
00097       Context.Status    = EFI_NOT_FOUND;
00098       ForeachPolicyEntry (DataType, (VISIT_POLICY_ENTRY) DeletePolicyEntry, &Context);
00099       Status = Context.Status;
00100 
00101       if (Status == EFI_NOT_FOUND) {
00102         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_INDEX_NOT_FOUND), mHiiHandle, mAppName, ValueStr);
00103       } else if (EFI_ERROR (Status)) {
00104         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IPSEC_CONFIG_DELETE_FAILED), mHiiHandle, mAppName);
00105       }
00106     }
00107   }
00108 
00109   return Status;
00110 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines