]>
Commit | Line | Data |
---|---|---|
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 | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _HELPER_H_\r | |
17 | #define _HELPER_H_\r | |
18 | \r | |
19 | #define FORMAT_NUMBER 0x1\r | |
20 | #define FORMAT_STRING 0x2\r | |
21 | \r | |
22 | /**\r | |
23 | Helper function called to change input parameter in string format to number.\r | |
24 | \r | |
25 | @param[in] FlagStr The pointer to the flag string.\r | |
26 | @param[in] Maximum most value number.\r | |
27 | @param[in, out] ValuePtr The pointer to the input parameter in string format.\r | |
28 | @param[in] ByteCount The valid byte count\r | |
29 | @param[in] Map The pointer to the STR2INT table.\r | |
30 | @param[in] ParamPackage The pointer to the ParamPackage list.\r | |
31 | @param[in] FormatMask The bit mask.\r | |
32 | BIT 0 set indicates the value of flag might be number.\r | |
33 | BIT 1 set indicates the value of flag might be a string that needs to be looked up.\r | |
34 | \r | |
35 | @retval EFI_SUCCESS The operation completed successfully.\r | |
36 | @retval EFI_NOT_FOUND The input parameter can't be found.\r | |
37 | @retval EFI_INVALID_PARAMETER The input parameter is an invalid input.\r | |
38 | **/\r | |
39 | EFI_STATUS\r | |
40 | GetNumber (\r | |
41 | IN CHAR16 *FlagStr,\r | |
42 | IN UINT64 Maximum,\r | |
43 | IN OUT VOID *ValuePtr,\r | |
44 | IN UINTN ByteCount,\r | |
45 | IN STR2INT *Map,\r | |
46 | IN LIST_ENTRY *ParamPackage,\r | |
47 | IN UINT32 FormatMask\r | |
48 | );\r | |
49 | \r | |
50 | /**\r | |
51 | Helper function called to convert a string containing an (Ipv4) Internet Protocol dotted address\r | |
52 | into a proper address for the EFI_IP_ADDRESS structure.\r | |
53 | \r | |
54 | @param[in] Ptr The pointer to the string containing an (Ipv4) Internet Protocol dotted address.\r | |
55 | @param[out] Ip The pointer to the Ip address structure to contain the result.\r | |
56 | \r | |
57 | @retval EFI_SUCCESS The operation completed successfully.\r | |
58 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
59 | **/\r | |
60 | EFI_STATUS\r | |
61 | EfiInetAddr2 (\r | |
62 | IN CHAR16 *Ptr,\r | |
63 | OUT EFI_IP_ADDRESS *Ip\r | |
64 | );\r | |
65 | \r | |
66 | /**\r | |
67 | Helper function called to calculate the prefix length associated with the string\r | |
68 | containing an Ipv4 or Ipv6 Internet Protocol address.\r | |
69 | \r | |
70 | @param[in] Ptr The pointer to the string containing an Ipv4 or Ipv6 Internet Protocol address.\r | |
71 | @param[out] Addr The pointer to the EFI_IP_ADDRESS_INFO structure to contain the result.\r | |
72 | \r | |
73 | @retval EFI_SUCCESS The operation completed successfully.\r | |
74 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
75 | @retval Others Other mistake case.\r | |
76 | **/\r | |
77 | EFI_STATUS\r | |
78 | EfiInetAddrRange (\r | |
79 | IN CHAR16 *Ptr,\r | |
80 | OUT EFI_IP_ADDRESS_INFO *Addr\r | |
81 | );\r | |
82 | \r | |
83 | /**\r | |
84 | Helper function called to calculate the port range associated with the string.\r | |
85 | \r | |
86 | @param[in] Ptr The pointer to the string containing a port and range.\r | |
87 | @param[out] Port The pointer to the Port to contain the result.\r | |
88 | @param[out] PortRange The pointer to the PortRange to contain the result.\r | |
89 | \r | |
90 | @retval EFI_SUCCESS The operation completed successfully.\r | |
91 | @retval EFI_INVALID_PARAMETER Invalid parameter.\r | |
92 | @retval Others Other mistake case.\r | |
93 | **/\r | |
94 | EFI_STATUS\r | |
95 | EfiInetPortRange (\r | |
96 | IN CHAR16 *Ptr,\r | |
97 | OUT UINT16 *Port,\r | |
98 | OUT UINT16 *PortRange\r | |
99 | );\r | |
100 | \r | |
101 | /**\r | |
102 | Helper function called to transfer a string to an unsigned integer.\r | |
103 | \r | |
104 | @param[in] Str The pointer to the string.\r | |
105 | @param[out] Status The operation status.\r | |
106 | \r | |
107 | @return The integer value of a converted str.\r | |
108 | **/\r | |
109 | UINT64\r | |
110 | StrToUInteger (\r | |
111 | IN CONST CHAR16 *Str,\r | |
112 | OUT EFI_STATUS *Status\r | |
113 | );\r | |
114 | \r | |
115 | /**\r | |
116 | Helper function called to transfer a string to an unsigned integer according to the map table.\r | |
117 | \r | |
118 | @param[in] Str The pointer to the string.\r | |
119 | @param[in] Map The pointer to the map table.\r | |
120 | \r | |
121 | @return The integer value of converted str. If not found, then return -1.\r | |
122 | **/\r | |
123 | UINT32\r | |
124 | MapStringToInteger (\r | |
125 | IN CONST CHAR16 *Str,\r | |
126 | IN STR2INT *Map\r | |
127 | );\r | |
128 | \r | |
129 | /**\r | |
130 | Helper function called to transfer an unsigned integer to a string according to the map table.\r | |
131 | \r | |
132 | @param[in] Integer The pointer to the string.\r | |
133 | @param[in] Map The pointer to the map table.\r | |
134 | \r | |
135 | @return The converted str. If not found, then return NULL.\r | |
136 | **/\r | |
137 | CHAR16 *\r | |
138 | MapIntegerToString (\r | |
139 | IN UINT32 Integer,\r | |
140 | IN STR2INT *Map\r | |
141 | );\r | |
142 | \r | |
143 | #endif\r |