]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/Application/IpsecConfig/Helper.h
MdeModulePkg/StatusCodeHandlerRuntimeDxe: make global variable static
[mirror_edk2.git] / NetworkPkg / Application / IpsecConfig / Helper.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 The assistant function declaration for IpSecConfig application.\r
3\r
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
5\r
ecf98fbc 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
a3bcde70
HT
7\r
8**/\r
9\r
10#ifndef _HELPER_H_\r
11#define _HELPER_H_\r
12\r
13#define FORMAT_NUMBER 0x1\r
14#define FORMAT_STRING 0x2\r
15\r
16/**\r
17 Helper function called to change input parameter in string format to number.\r
18\r
19 @param[in] FlagStr The pointer to the flag string.\r
20 @param[in] Maximum most value number.\r
21 @param[in, out] ValuePtr The pointer to the input parameter in string format.\r
22 @param[in] ByteCount The valid byte count\r
23 @param[in] Map The pointer to the STR2INT table.\r
24 @param[in] ParamPackage The pointer to the ParamPackage list.\r
25 @param[in] FormatMask The bit mask.\r
26 BIT 0 set indicates the value of flag might be number.\r
27 BIT 1 set indicates the value of flag might be a string that needs to be looked up.\r
28\r
29 @retval EFI_SUCCESS The operation completed successfully.\r
30 @retval EFI_NOT_FOUND The input parameter can't be found.\r
31 @retval EFI_INVALID_PARAMETER The input parameter is an invalid input.\r
32**/\r
33EFI_STATUS\r
34GetNumber (\r
35 IN CHAR16 *FlagStr,\r
36 IN UINT64 Maximum,\r
37 IN OUT VOID *ValuePtr,\r
38 IN UINTN ByteCount,\r
39 IN STR2INT *Map,\r
40 IN LIST_ENTRY *ParamPackage,\r
41 IN UINT32 FormatMask\r
42 );\r
43\r
44/**\r
45 Helper function called to convert a string containing an (Ipv4) Internet Protocol dotted address\r
46 into a proper address for the EFI_IP_ADDRESS structure.\r
47\r
48 @param[in] Ptr The pointer to the string containing an (Ipv4) Internet Protocol dotted address.\r
49 @param[out] Ip The pointer to the Ip address structure to contain the result.\r
50\r
51 @retval EFI_SUCCESS The operation completed successfully.\r
52 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
53**/\r
54EFI_STATUS\r
55EfiInetAddr2 (\r
56 IN CHAR16 *Ptr,\r
57 OUT EFI_IP_ADDRESS *Ip\r
58 );\r
59\r
60/**\r
61 Helper function called to calculate the prefix length associated with the string\r
62 containing an Ipv4 or Ipv6 Internet Protocol address.\r
63\r
64 @param[in] Ptr The pointer to the string containing an Ipv4 or Ipv6 Internet Protocol address.\r
65 @param[out] Addr The pointer to the EFI_IP_ADDRESS_INFO structure to contain the result.\r
66\r
67 @retval EFI_SUCCESS The operation completed successfully.\r
68 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
69 @retval Others Other mistake case.\r
70**/\r
71EFI_STATUS\r
72EfiInetAddrRange (\r
73 IN CHAR16 *Ptr,\r
74 OUT EFI_IP_ADDRESS_INFO *Addr\r
75 );\r
76\r
77/**\r
78 Helper function called to calculate the port range associated with the string.\r
79\r
80 @param[in] Ptr The pointer to the string containing a port and range.\r
81 @param[out] Port The pointer to the Port to contain the result.\r
82 @param[out] PortRange The pointer to the PortRange to contain the result.\r
83\r
84 @retval EFI_SUCCESS The operation completed successfully.\r
85 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
86 @retval Others Other mistake case.\r
87**/\r
88EFI_STATUS\r
89EfiInetPortRange (\r
90 IN CHAR16 *Ptr,\r
91 OUT UINT16 *Port,\r
92 OUT UINT16 *PortRange\r
93 );\r
94\r
95/**\r
96 Helper function called to transfer a string to an unsigned integer.\r
97\r
98 @param[in] Str The pointer to the string.\r
99 @param[out] Status The operation status.\r
100\r
101 @return The integer value of a converted str.\r
102**/\r
103UINT64\r
104StrToUInteger (\r
105 IN CONST CHAR16 *Str,\r
106 OUT EFI_STATUS *Status\r
107 );\r
108\r
109/**\r
110 Helper function called to transfer a string to an unsigned integer according to the map table.\r
111\r
112 @param[in] Str The pointer to the string.\r
113 @param[in] Map The pointer to the map table.\r
114\r
115 @return The integer value of converted str. If not found, then return -1.\r
116**/\r
117UINT32\r
118MapStringToInteger (\r
119 IN CONST CHAR16 *Str,\r
120 IN STR2INT *Map\r
121 );\r
122\r
123/**\r
124 Helper function called to transfer an unsigned integer to a string according to the map table.\r
125\r
126 @param[in] Integer The pointer to the string.\r
127 @param[in] Map The pointer to the map table.\r
128\r
129 @return The converted str. If not found, then return NULL.\r
130**/\r
131CHAR16 *\r
132MapIntegerToString (\r
133 IN UINT32 Integer,\r
134 IN STR2INT *Map\r
135 );\r
136\r
137#endif\r