1 /** @file
2   Provides interface to shell functionality for shell commands and applications.
3 
4   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
5   Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
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 _UEFI_SHELL_LIB_INTERNAL_H_
17 #define _UEFI_SHELL_LIB_INTERNAL_H_
18 
19 #include <Uefi.h>
20 
21 #include <Guid/FileInfo.h>
22 
23 #include <Protocol/SimpleFileSystem.h>
24 #include <Protocol/LoadedImage.h>
25 #include <Protocol/EfiShellInterface.h>
26 #include <Protocol/EfiShellEnvironment2.h>
27 #include <Protocol/Shell.h>
28 #include <Protocol/ShellParameters.h>
29 #include <Protocol/UnicodeCollation.h>
30 
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/BaseLib.h>
33 #include <Library/BaseMemoryLib.h>
34 #include <Library/DebugLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/DevicePathLib.h>
37 #include <Library/PcdLib.h>
38 #include <Library/FileHandleLib.h>
39 #include <Library/PrintLib.h>
40 #include <Library/UefiLib.h>
41 #include <Library/HiiLib.h>
42 #include <Library/ShellLib.h>
43 
44 typedef struct  {
45   EFI_SHELL_GET_FILE_INFO                   GetFileInfo;
46   EFI_SHELL_SET_FILE_INFO                   SetFileInfo;
47   EFI_SHELL_READ_FILE                       ReadFile;
48   EFI_SHELL_WRITE_FILE                      WriteFile;
49   EFI_SHELL_CLOSE_FILE                      CloseFile;
50   EFI_SHELL_DELETE_FILE                     DeleteFile;
51   EFI_SHELL_GET_FILE_POSITION               GetFilePosition;
52   EFI_SHELL_SET_FILE_POSITION               SetFilePosition;
53   EFI_SHELL_FLUSH_FILE                      FlushFile;
54   EFI_SHELL_GET_FILE_SIZE                   GetFileSize;
55 } FILE_HANDLE_FUNCTION_MAP;
56 
57 /**
58   Function to determin if an entire string is a valid number.
59 
60   If Hex it must be preceeded with a 0x or has ForceHex, set TRUE.
61 
62   @param[in] String       The string to evaluate.
63   @param[in] ForceHex     TRUE - always assume hex.
64   @param[in] StopAtSpace  TRUE to halt upon finding a space, FALSE to keep going.
65   @param[in] TimeNumbers  TRUE to allow numbers with ":", FALSE otherwise.
66 
67   @retval TRUE        It is all numeric (dec/hex) characters.
68   @retval FALSE       There is a non-numeric character.
69 **/
70 BOOLEAN
71 InternalShellIsHexOrDecimalNumber (
72   IN CONST CHAR16   *String,
73   IN CONST BOOLEAN  ForceHex,
74   IN CONST BOOLEAN  StopAtSpace,
75   IN CONST BOOLEAN  TimeNumbers
76   );
77 
78 /**
79   Cleans off all the quotes in the string.
80 
81   @param[in]     OriginalString   pointer to the string to be cleaned.
82   @param[out]   CleanString      The new string with all quotes removed.
83                                                   Memory allocated in the function and free
84                                                   by caller.
85 
86   @retval EFI_SUCCESS   The operation was successful.
87 **/
88 EFI_STATUS
89 InternalShellStripQuotes (
90   IN  CONST CHAR16     *OriginalString,
91   OUT CHAR16           **CleanString
92   );
93 
94 
95 #endif
96 
97