1 /** @file
2   Provides interface to shell functionality for shell commands and applications.
3 
4   Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _UEFI_SHELL_LIB_INTERNAL_H_
16 #define _UEFI_SHELL_LIB_INTERNAL_H_
17 
18 #include <Uefi.h>
19 
20 #include <Guid/FileInfo.h>
21 
22 #include <Protocol/SimpleFileSystem.h>
23 #include <Protocol/LoadedImage.h>
24 #include <Protocol/EfiShellInterface.h>
25 #include <Protocol/EfiShellEnvironment2.h>
26 #include <Protocol/EfiShell.h>
27 #include <Protocol/EfiShellParameters.h>
28 
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/BaseLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/DevicePathLib.h>
35 #include <Library/PcdLib.h>
36 #include <Library/FileHandleLib.h>
37 #include <Library/PrintLib.h>
38 #include <Library/UefiLib.h>
39 #include <Library/HiiLib.h>
40 #include <Library/ShellLib.h>
41 
42 typedef struct  {
43   EFI_SHELL_GET_FILE_INFO                   GetFileInfo;
44   EFI_SHELL_SET_FILE_INFO                   SetFileInfo;
45   EFI_SHELL_READ_FILE                       ReadFile;
46   EFI_SHELL_WRITE_FILE                      WriteFile;
47   EFI_SHELL_CLOSE_FILE                      CloseFile;
48   EFI_SHELL_DELETE_FILE                     DeleteFile;
49   EFI_SHELL_GET_FILE_POSITION               GetFilePosition;
50   EFI_SHELL_SET_FILE_POSITION               SetFilePosition;
51   EFI_SHELL_FLUSH_FILE                      FlushFile;
52   EFI_SHELL_GET_FILE_SIZE                   GetFileSize;
53 } FILE_HANDLE_FUNCTION_MAP;
54 
55 /**
56   Function to determin if an entire string is a valid number.
57 
58   If Hex it must be preceeded with a 0x or has ForceHex, set TRUE.
59 
60   @param[in] String       The string to evaluate.
61   @param[in] ForceHex     TRUE - always assume hex.
62   @param[in] StopAtSpace  TRUE to halt upon finding a space, FALSE to keep going.
63   @param[in] TimeNumbers  TRUE to allow numbers with ":", FALSE otherwise.
64 
65   @retval TRUE        It is all numeric (dec/hex) characters.
66   @retval FALSE       There is a non-numeric character.
67 **/
68 BOOLEAN
69 EFIAPI
70 InternalShellIsHexOrDecimalNumber (
71   IN CONST CHAR16   *String,
72   IN CONST BOOLEAN  ForceHex,
73   IN CONST BOOLEAN  StopAtSpace,
74   IN CONST BOOLEAN  TimeNumbers
75   );
76 
77 /**
78   Cleans off all the quotes in the string.
79 
80   @param[in]     OriginalString   pointer to the string to be cleaned.
81   @param[out]   CleanString      The new string with all quotes removed.
82                                                   Memory allocated in the function and free
83                                                   by caller.
84 
85   @retval EFI_SUCCESS   The operation was successful.
86 **/
87 EFI_STATUS
88 EFIAPI
89 InternalShellStripQuotes (
90   IN  CONST CHAR16     *OriginalString,
91   OUT CHAR16           **CleanString
92   );
93 
94 
95 #endif
96 
97