]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / NetworkPkg / UefiPxeBcDxe / PxeBcMtftp.h
1 /** @file
2 Functions declaration related with Mtftp for UefiPxeBc Driver.
3
4 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef __EFI_PXEBC_MTFTP_H__
11 #define __EFI_PXEBC_MTFTP_H__
12
13 #define PXE_MTFTP_OPTION_BLKSIZE_INDEX 0
14 #define PXE_MTFTP_OPTION_TIMEOUT_INDEX 1
15 #define PXE_MTFTP_OPTION_TSIZE_INDEX 2
16 #define PXE_MTFTP_OPTION_MULTICAST_INDEX 3
17 #define PXE_MTFTP_OPTION_WINDOWSIZE_INDEX 4
18 #define PXE_MTFTP_OPTION_MAXIMUM_INDEX 5
19 #define PXE_MTFTP_OPTBUF_MAXNUM_INDEX 128
20
21 #define PXE_MTFTP_ERROR_STRING_LENGTH 127 // refer to definition of struct EFI_PXE_BASE_CODE_TFTP_ERROR.
22 #define PXE_MTFTP_DEFAULT_BLOCK_SIZE 512 // refer to rfc-1350.
23
24 /**
25 This function is wrapper to get the file size using TFTP.
26
27 @param[in] Private Pointer to PxeBc private data.
28 @param[in] Config Pointer to configure data.
29 @param[in] Filename Pointer to boot file name.
30 @param[in] BlockSize Pointer to required block size.
31 @param[in] WindowSize Pointer to required window size.
32 @param[in, out] BufferSize Pointer to buffer size.
33
34 @retval EFI_SUCCESS Successfully obtained the size of file.
35 @retval EFI_NOT_FOUND Parse the tftp options failed.
36 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
37 @retval Others Did not obtain the size of the file.
38
39 **/
40 EFI_STATUS
41 PxeBcTftpGetFileSize (
42 IN PXEBC_PRIVATE_DATA *Private,
43 IN VOID *Config,
44 IN UINT8 *Filename,
45 IN UINTN *BlockSize,
46 IN UINTN *WindowSize,
47 IN OUT UINT64 *BufferSize
48 );
49
50 /**
51 This function is a wrapper to get a file using TFTP.
52
53 @param[in] Private Pointer to PxeBc private data.
54 @param[in] Config Pointer to config data.
55 @param[in] Filename Pointer to boot file name.
56 @param[in] BlockSize Pointer to required block size.
57 @param[in] WindowSize Pointer to required window size.
58 @param[in] BufferPtr Pointer to buffer.
59 @param[in, out] BufferSize Pointer to buffer size.
60 @param[in] DontUseBuffer Indicates whether to use a receive buffer.
61
62 @retval EFI_SUCCESS Successfully read the data from the special file.
63 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
64 @retval Others Read data from file failed.
65
66 **/
67 EFI_STATUS
68 PxeBcTftpReadFile (
69 IN PXEBC_PRIVATE_DATA *Private,
70 IN VOID *Config,
71 IN UINT8 *Filename,
72 IN UINTN *BlockSize,
73 IN UINTN *WindowSize,
74 IN UINT8 *BufferPtr,
75 IN OUT UINT64 *BufferSize,
76 IN BOOLEAN DontUseBuffer
77 );
78
79 /**
80 This function is a wrapper to put file with TFTP.
81
82 @param[in] Private Pointer to PxeBc private data.
83 @param[in] Config Pointer to config data.
84 @param[in] Filename Pointer to boot file name.
85 @param[in] Overwrite Indicates whether to use an overwrite attribute.
86 @param[in] BlockSize Pointer to required block size.
87 @param[in] BufferPtr Pointer to buffer.
88 @param[in, out] BufferSize Pointer to buffer size.
89
90 @retval EFI_SUCCESS Successfully wrote the data into the special file.
91 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
92 @retval other Write data into file failed.
93
94 **/
95 EFI_STATUS
96 PxeBcTftpWriteFile (
97 IN PXEBC_PRIVATE_DATA *Private,
98 IN VOID *Config,
99 IN UINT8 *Filename,
100 IN BOOLEAN Overwrite,
101 IN UINTN *BlockSize,
102 IN UINT8 *BufferPtr,
103 IN OUT UINT64 *BufferSize
104 );
105
106 /**
107 This function is a wrapper to get the data (file) from a directory using TFTP.
108
109 @param[in] Private Pointer to PxeBc private data.
110 @param[in] Config Pointer to config data.
111 @param[in] Filename Pointer to boot file name.
112 @param[in] BlockSize Pointer to required block size.
113 @param[in] WindowSize Pointer to required window size.
114 @param[in] BufferPtr Pointer to buffer.
115 @param[in, out] BufferSize Pointer to buffer size.
116 @param[in] DontUseBuffer Indicates whether with a receive buffer.
117
118 @retval EFI_SUCCESS Successfully obtained the data from the file included in directory.
119 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
120 @retval Others Operation failed.
121
122 **/
123 EFI_STATUS
124 PxeBcTftpReadDirectory (
125 IN PXEBC_PRIVATE_DATA *Private,
126 IN VOID *Config,
127 IN UINT8 *Filename,
128 IN UINTN *BlockSize,
129 IN UINTN *WindowSize,
130 IN UINT8 *BufferPtr,
131 IN OUT UINT64 *BufferSize,
132 IN BOOLEAN DontUseBuffer
133 );
134
135 #endif