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