]>
Commit | Line | Data |
---|---|---|
93e3992d | 1 | /**@file |
2 | Copyright (c) 2007, Intel Corporation | |
3 | ||
4 | All rights reserved. This program and the accompanying materials | |
5 | are licensed and made available under the terms and conditions of the BSD License | |
6 | which accompanies this distribution. The full text of the license may be found at | |
7 | http://opensource.org/licenses/bsd-license.php | |
8 | ||
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
11 | ||
12 | ||
13 | **/ | |
14 | ||
15 | ||
16 | ||
17 | /** | |
18 | Converts binary buffer to Unicode string. | |
19 | At a minimum, any blob of data could be represented as a hex string. | |
20 | ||
21 | @param Str Pointer to the string. | |
22 | @param HexStringBufferLength Length in bytes of buffer to hold the hex string. | |
23 | Includes tailing '\0' character. If routine return | |
24 | with EFI_SUCCESS, containing length of hex string | |
25 | buffer. If routine return with | |
26 | EFI_BUFFER_TOO_SMALL, containg length of hex | |
27 | string buffer desired. | |
28 | @param Buf Buffer to be converted from. | |
29 | @param Len Length in bytes of the buffer to be converted. | |
30 | ||
31 | @retval EFI_SUCCESS Routine success. | |
32 | @retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small. | |
33 | ||
34 | **/ | |
35 | EFI_STATUS | |
36 | R8_BufToHexString ( | |
37 | IN OUT CHAR16 *Str, | |
38 | IN OUT UINTN *HexStringBufferLength, | |
39 | IN UINT8 *Buf, | |
40 | IN UINTN Len | |
41 | ) | |
42 | ; | |
43 | ||
44 | ||
45 | ||
46 | ||
47 | /** | |
48 | Converts Unicode string to binary buffer. | |
49 | The conversion may be partial. | |
50 | The first character in the string that is not hex digit stops the conversion. | |
51 | At a minimum, any blob of data could be represented as a hex string. | |
52 | ||
53 | @param Buf Pointer to buffer that receives the data. | |
54 | @param Len Length in bytes of the buffer to hold converted | |
55 | data. If routine return with EFI_SUCCESS, | |
56 | containing length of converted data. If routine | |
57 | return with EFI_BUFFER_TOO_SMALL, containg length | |
58 | of buffer desired. | |
59 | @param Str String to be converted from. | |
60 | @param ConvertedStrLen Length of the Hex String consumed. | |
61 | ||
62 | @retval EFI_SUCCESS Routine Success. | |
63 | @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data. | |
64 | ||
65 | **/ | |
66 | EFI_STATUS | |
67 | R8_HexStringToBuf ( | |
68 | IN OUT UINT8 *Buf, | |
69 | IN OUT UINTN *Len, | |
70 | IN CHAR16 *Str, | |
71 | OUT UINTN *ConvertedStrLen OPTIONAL | |
72 | ) | |
73 | ; | |
74 | ||
75 | ||
76 | ||
77 | ||
78 | /** | |
79 | Determines if a Unicode character is a hexadecimal digit. | |
80 | The test is case insensitive. | |
81 | ||
82 | @param Digit Pointer to byte that receives the value of the hex | |
83 | character. | |
84 | @param Char Unicode character to test. | |
85 | ||
86 | @retval TRUE If the character is a hexadecimal digit. | |
87 | @retval FALSE Otherwise. | |
88 | ||
89 | **/ | |
90 | BOOLEAN | |
91 | R8_IsHexDigit ( | |
92 | OUT UINT8 *Digit, | |
93 | IN CHAR16 Char | |
94 | ) | |
95 | ; | |
96 | ||
97 |