]> git.proxmox.com Git - mirror_edk2.git/blame - NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h
NetworkPkg:Replace unsafe string functions.
[mirror_edk2.git] / NetworkPkg / UefiPxeBcDxe / PxeBcMtftp.h
CommitLineData
a3bcde70
HT
1/** @file\r
2 Functions declaration related with Mtftp for UefiPxeBc Driver.\r
3\r
c960bdc2 4 Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
a3bcde70
HT
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __EFI_PXEBC_MTFTP_H__\r
17#define __EFI_PXEBC_MTFTP_H__\r
18\r
19#define PXE_MTFTP_OPTION_BLKSIZE_INDEX 0\r
20#define PXE_MTFTP_OPTION_TIMEOUT_INDEX 1\r
21#define PXE_MTFTP_OPTION_TSIZE_INDEX 2\r
22#define PXE_MTFTP_OPTION_MULTICAST_INDEX 3\r
23#define PXE_MTFTP_OPTION_MAXIMUM_INDEX 4\r
c960bdc2 24#define PXE_MTFTP_OPTBUF_MAXNUM_INDEX 128\r
a3bcde70
HT
25\r
26#define PXE_MTFTP_ERROR_STRING_LENGTH 127 // refer to definition of struct EFI_PXE_BASE_CODE_TFTP_ERROR.\r
27#define PXE_MTFTP_DEFAULT_BLOCK_SIZE 512 // refer to rfc-1350.\r
28\r
29\r
30/**\r
31 This function is wrapper to get the file size using TFTP.\r
32\r
33 @param[in] Private Pointer to PxeBc private data.\r
34 @param[in] Config Pointer to configure data.\r
35 @param[in] Filename Pointer to boot file name.\r
36 @param[in] BlockSize Pointer to required block size.\r
37 @param[in, out] BufferSize Pointer to buffer size.\r
38\r
39 @retval EFI_SUCCESS Successfully obtained the size of file.\r
40 @retval EFI_NOT_FOUND Parse the tftp ptions failed.\r
41 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.\r
42 @retval Others Did not obtain the size of the file.\r
43\r
44**/\r
45EFI_STATUS\r
46PxeBcTftpGetFileSize (\r
47 IN PXEBC_PRIVATE_DATA *Private,\r
48 IN VOID *Config,\r
49 IN UINT8 *Filename,\r
50 IN UINTN *BlockSize,\r
51 IN OUT UINT64 *BufferSize\r
52 );\r
53\r
54\r
55/**\r
56 This function is a wrapper to get a file using TFTP.\r
57\r
58 @param[in] Private Pointer to PxeBc private data.\r
59 @param[in] Config Pointer to config data.\r
60 @param[in] Filename Pointer to boot file name.\r
61 @param[in] BlockSize Pointer to required block size.\r
62 @param[in] BufferPtr Pointer to buffer.\r
63 @param[in, out] BufferSize Pointer to buffer size.\r
64 @param[in] DontUseBuffer Indicates whether to use a receive buffer.\r
65\r
66 @retval EFI_SUCCESS Successfully read the data from the special file.\r
67 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.\r
68 @retval Others Read data from file failed.\r
69\r
70**/\r
71EFI_STATUS\r
72PxeBcTftpReadFile (\r
73 IN PXEBC_PRIVATE_DATA *Private,\r
74 IN VOID *Config,\r
75 IN UINT8 *Filename,\r
76 IN UINTN *BlockSize,\r
77 IN UINT8 *BufferPtr,\r
78 IN OUT UINT64 *BufferSize,\r
79 IN BOOLEAN DontUseBuffer\r
80 );\r
81\r
82\r
83/**\r
84 This function is a wrapper to put file with TFTP.\r
85\r
86 @param[in] Private Pointer to PxeBc private data.\r
87 @param[in] Config Pointer to config data.\r
88 @param[in] Filename Pointer to boot file name.\r
89 @param[in] Overwrite Indicates whether to use an overwrite attribute.\r
90 @param[in] BlockSize Pointer to required block size.\r
91 @param[in] BufferPtr Pointer to buffer.\r
92 @param[in, out] BufferSize Pointer to buffer size.\r
93\r
94 @retval EFI_SUCCESS Successfully wrote the data into the special file.\r
95 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.\r
96 @retval other Write data into file failed.\r
97\r
98**/\r
99EFI_STATUS\r
100PxeBcTftpWriteFile (\r
101 IN PXEBC_PRIVATE_DATA *Private,\r
102 IN VOID *Config,\r
103 IN UINT8 *Filename,\r
104 IN BOOLEAN Overwrite,\r
105 IN UINTN *BlockSize,\r
106 IN UINT8 *BufferPtr,\r
107 IN OUT UINT64 *BufferSize\r
108 );\r
109\r
110\r
111/**\r
112 This function is a wrapper to get the data (file) from a directory using TFTP.\r
113\r
114 @param[in] Private Pointer to PxeBc private data.\r
115 @param[in] Config Pointer to config data.\r
116 @param[in] Filename Pointer to boot file name.\r
117 @param[in] BlockSize Pointer to required block size.\r
118 @param[in] BufferPtr Pointer to buffer.\r
119 @param[in, out] BufferSize Pointer to buffer size.\r
120 @param[in] DontUseBuffer Indicates whether with a receive buffer.\r
121\r
122 @retval EFI_SUCCES Successfully obtained the data from the file included in directory.\r
123 @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.\r
124 @retval Others Operation failed.\r
125\r
126**/\r
127EFI_STATUS\r
128PxeBcTftpReadDirectory (\r
129 IN PXEBC_PRIVATE_DATA *Private,\r
130 IN VOID *Config,\r
131 IN UINT8 *Filename,\r
132 IN UINTN *BlockSize,\r
133 IN UINT8 *BufferPtr,\r
134 IN OUT UINT64 *BufferSize,\r
135 IN BOOLEAN DontUseBuffer\r
136 );\r
137#endif\r