]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h
OvmfPkg/MptScsiDxe: Build and decode DevicePath
[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 /**
26 This function is wrapper to get the file size using TFTP.
27
28 @param[in] Private Pointer to PxeBc private data.
29 @param[in] Config Pointer to configure data.
30 @param[in] Filename Pointer to boot file name.
31 @param[in] BlockSize Pointer to required block size.
32 @param[in] WindowSize Pointer to required window size.
33 @param[in, out] BufferSize Pointer to buffer size.
34
35 @retval EFI_SUCCESS Successfully obtained the size of file.
36 @retval EFI_NOT_FOUND Parse the tftp options failed.
37 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
38 @retval Others Did not obtain the size of the file.
39
40 **/
41 EFI_STATUS
42 PxeBcTftpGetFileSize (
43 IN PXEBC_PRIVATE_DATA *Private,
44 IN VOID *Config,
45 IN UINT8 *Filename,
46 IN UINTN *BlockSize,
47 IN UINTN *WindowSize,
48 IN OUT UINT64 *BufferSize
49 );
50
51
52 /**
53 This function is a wrapper to get a file using TFTP.
54
55 @param[in] Private Pointer to PxeBc private data.
56 @param[in] Config Pointer to config data.
57 @param[in] Filename Pointer to boot file name.
58 @param[in] BlockSize Pointer to required block size.
59 @param[in] WindowSize Pointer to required window size.
60 @param[in] BufferPtr Pointer to buffer.
61 @param[in, out] BufferSize Pointer to buffer size.
62 @param[in] DontUseBuffer Indicates whether to use a receive buffer.
63
64 @retval EFI_SUCCESS Successfully read the data from the special file.
65 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
66 @retval Others Read data from file failed.
67
68 **/
69 EFI_STATUS
70 PxeBcTftpReadFile (
71 IN PXEBC_PRIVATE_DATA *Private,
72 IN VOID *Config,
73 IN UINT8 *Filename,
74 IN UINTN *BlockSize,
75 IN UINTN *WindowSize,
76 IN UINT8 *BufferPtr,
77 IN OUT UINT64 *BufferSize,
78 IN BOOLEAN DontUseBuffer
79 );
80
81
82 /**
83 This function is a wrapper to put file with TFTP.
84
85 @param[in] Private Pointer to PxeBc private data.
86 @param[in] Config Pointer to config data.
87 @param[in] Filename Pointer to boot file name.
88 @param[in] Overwrite Indicates whether to use an overwrite attribute.
89 @param[in] BlockSize Pointer to required block size.
90 @param[in] BufferPtr Pointer to buffer.
91 @param[in, out] BufferSize Pointer to buffer size.
92
93 @retval EFI_SUCCESS Successfully wrote the data into the special file.
94 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
95 @retval other Write data into file failed.
96
97 **/
98 EFI_STATUS
99 PxeBcTftpWriteFile (
100 IN PXEBC_PRIVATE_DATA *Private,
101 IN VOID *Config,
102 IN UINT8 *Filename,
103 IN BOOLEAN Overwrite,
104 IN UINTN *BlockSize,
105 IN UINT8 *BufferPtr,
106 IN OUT UINT64 *BufferSize
107 );
108
109
110 /**
111 This function is a wrapper to get the data (file) from a directory using TFTP.
112
113 @param[in] Private Pointer to PxeBc private data.
114 @param[in] Config Pointer to config data.
115 @param[in] Filename Pointer to boot file name.
116 @param[in] BlockSize Pointer to required block size.
117 @param[in] WindowSize Pointer to required window size.
118 @param[in] BufferPtr Pointer to buffer.
119 @param[in, out] BufferSize Pointer to buffer size.
120 @param[in] DontUseBuffer Indicates whether with a receive buffer.
121
122 @retval EFI_SUCCESS Successfully obtained the data from the file included in directory.
123 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
124 @retval Others Operation failed.
125
126 **/
127 EFI_STATUS
128 PxeBcTftpReadDirectory (
129 IN PXEBC_PRIVATE_DATA *Private,
130 IN VOID *Config,
131 IN UINT8 *Filename,
132 IN UINTN *BlockSize,
133 IN UINTN *WindowSize,
134 IN UINT8 *BufferPtr,
135 IN OUT UINT64 *BufferSize,
136 IN BOOLEAN DontUseBuffer
137 );
138 #endif