244926f888ca799d47f34460c95e38e68407570f
[mirror_edk2.git] / NetworkPkg / Application / IpsecConfig / IpSecConfig.h
1 /** @file
2 The internal structure and function declaration 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 _IPSEC_CONFIG_H_
17 #define _IPSEC_CONFIG_H_
18
19 #include <Library/BaseMemoryLib.h>
20 #include <Library/UefiLib.h>
21 #include <Library/ShellLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/MemoryAllocationLib.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/UefiHiiServicesLib.h>
26 #include <Library/NetLib.h>
27
28 #include <Protocol/IpSecConfig.h>
29
30 //
31 // String token ID of VConfig command help message text.
32 //
33 GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringIpSecHelpTokenId = STRING_TOKEN (STR_IPSEC_CONFIG_HELP);
34
35 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
36
37 #define IPSECCONFIG_STATUS_NAME L"IpSecStatus"
38
39 #define BIT(x) (UINT32) (1 << (x))
40
41 #define IPSEC_STATUS_DISABLED 0x0
42 #define IPSEC_STATUS_ENABLED 0x1
43
44 #define EFI_IP4_PROTO_ICMP 0x1
45 #define EFI_IP4_PROTO_TCP 0x6
46 #define EFI_IP4_PROTO_UDP 0x11
47
48 #define EFI_IPSEC_ANY_PROTOCOL 0xFFFF
49 #define EFI_IPSEC_ANY_PORT 0
50
51 ///
52 /// IPsec Authentication Algorithm Definition
53 /// The number value definition is aligned to IANA assignment
54 ///
55 #define IPSEC_AALG_NONE 0x00
56 #define IPSEC_AALG_MD5HMAC 0x01
57 #define IPSEC_AALG_SHA1HMAC 0x02
58 #define IPSEC_AALG_SHA2_256HMAC 0x05
59 #define IPSEC_AALG_SHA2_384HMAC 0x06
60 #define IPSEC_AALG_SHA2_512HMAC 0x07
61 #define IPSEC_AALG_AES_XCBC_MAC 0x09
62 #define IPSEC_AALG_NULL 0xFB
63
64 ///
65 /// IPsec Encryption Algorithm Definition
66 /// The number value definition is aligned to IANA assignment
67 ///
68 #define IPSEC_EALG_NONE 0x00
69 #define IPSEC_EALG_DESCBC 0x02
70 #define IPSEC_EALG_3DESCBC 0x03
71 #define IPSEC_EALG_CASTCBC 0x06
72 #define IPSEC_EALG_BLOWFISHCBC 0x07
73 #define IPSEC_EALG_NULL 0x0B
74 #define IPSEC_EALG_AESCBC 0x0C
75 #define IPSEC_EALG_AESCTR 0x0D
76 #define IPSEC_EALG_AES_CCM_ICV8 0x0E
77 #define IPSEC_EALG_AES_CCM_ICV12 0x0F
78 #define IPSEC_EALG_AES_CCM_ICV16 0x10
79 #define IPSEC_EALG_AES_GCM_ICV8 0x12
80 #define IPSEC_EALG_AES_GCM_ICV12 0x13
81 #define IPSEC_EALG_AES_GCM_ICV16 0x14
82
83 typedef struct {
84 CHAR16 *VarName;
85 UINT32 Attribute1;
86 UINT32 Attribute2;
87 UINT32 Attribute3;
88 UINT32 Attribute4;
89 } VAR_CHECK_ITEM;
90
91 typedef struct {
92 LIST_ENTRY Link;
93 CHAR16 *Name;
94 SHELL_PARAM_TYPE Type;
95 CHAR16 *Value;
96 UINTN OriginalPosition;
97 } SHELL_PARAM_PACKAGE;
98
99 typedef struct {
100 CHAR16 *String;
101 UINT32 Integer;
102 } STR2INT;
103
104 extern EFI_IPSEC_CONFIG_PROTOCOL *mIpSecConfig;
105 extern EFI_HII_HANDLE mHiiHandle;
106 extern CHAR16 mAppName[];
107
108 //
109 // -P
110 //
111 extern STR2INT mMapPolicy[];
112
113 //
114 // --proto
115 //
116 extern STR2INT mMapIpProtocol[];
117
118 //
119 // --action
120 //
121 extern STR2INT mMapIpSecAction[];
122
123 //
124 // --mode
125 //
126 extern STR2INT mMapIpSecMode[];
127
128 //
129 // --dont-fragment
130 //
131 extern STR2INT mMapDfOption[];
132
133 //
134 // --ipsec-proto
135 //
136 extern STR2INT mMapIpSecProtocol[];
137 //
138 // --auth-algo
139 //
140 extern STR2INT mMapAuthAlgo[];
141
142 //
143 // --encrypt-algo
144 //
145 extern STR2INT mMapEncAlgo[];
146 //
147 // --auth-proto
148 //
149 extern STR2INT mMapAuthProto[];
150
151 //
152 // --auth-method
153 //
154 extern STR2INT mMapAuthMethod[];
155
156 #endif