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