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