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