PageRenderTime 36ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/NetworkPkg/UefiPxeBcDxe/PxeBcMtftp.h

https://bitbucket.org/incubaid/edk2
C Header | 136 lines | 48 code | 11 blank | 77 comment | 0 complexity | cbc623d849b972d54e94742e08024e06 MD5 | raw file
  1. /** @file
  2. Functions declaration related with Mtftp for UefiPxeBc Driver.
  3. Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
  4. This program and the accompanying materials
  5. are licensed and made available under the terms and conditions of the BSD License
  6. which accompanies this distribution. The full text of the license may be found at
  7. http://opensource.org/licenses/bsd-license.php.
  8. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  10. **/
  11. #ifndef __EFI_PXEBC_MTFTP_H__
  12. #define __EFI_PXEBC_MTFTP_H__
  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_MAXIMUM_INDEX 4
  18. #define PXE_MTFTP_ERROR_STRING_LENGTH 127 // refer to definition of struct EFI_PXE_BASE_CODE_TFTP_ERROR.
  19. #define PXE_MTFTP_DEFAULT_BLOCK_SIZE 512 // refer to rfc-1350.
  20. /**
  21. This function is wrapper to get the file size using TFTP.
  22. @param[in] Private Pointer to PxeBc private data.
  23. @param[in] Config Pointer to configure data.
  24. @param[in] Filename Pointer to boot file name.
  25. @param[in] BlockSize Pointer to required block size.
  26. @param[in, out] BufferSize Pointer to buffer size.
  27. @retval EFI_SUCCESS Successfully obtained the size of file.
  28. @retval EFI_NOT_FOUND Parse the tftp ptions failed.
  29. @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
  30. @retval Others Did not obtain the size of the file.
  31. **/
  32. EFI_STATUS
  33. PxeBcTftpGetFileSize (
  34. IN PXEBC_PRIVATE_DATA *Private,
  35. IN VOID *Config,
  36. IN UINT8 *Filename,
  37. IN UINTN *BlockSize,
  38. IN OUT UINT64 *BufferSize
  39. );
  40. /**
  41. This function is a wrapper to get a file using TFTP.
  42. @param[in] Private Pointer to PxeBc private data.
  43. @param[in] Config Pointer to config data.
  44. @param[in] Filename Pointer to boot file name.
  45. @param[in] BlockSize Pointer to required block size.
  46. @param[in] BufferPtr Pointer to buffer.
  47. @param[in, out] BufferSize Pointer to buffer size.
  48. @param[in] DontUseBuffer Indicates whether to use a receive buffer.
  49. @retval EFI_SUCCESS Successfully read the data from the special file.
  50. @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
  51. @retval Others Read data from file failed.
  52. **/
  53. EFI_STATUS
  54. PxeBcTftpReadFile (
  55. IN PXEBC_PRIVATE_DATA *Private,
  56. IN VOID *Config,
  57. IN UINT8 *Filename,
  58. IN UINTN *BlockSize,
  59. IN UINT8 *BufferPtr,
  60. IN OUT UINT64 *BufferSize,
  61. IN BOOLEAN DontUseBuffer
  62. );
  63. /**
  64. This function is a wrapper to put file with TFTP.
  65. @param[in] Private Pointer to PxeBc private data.
  66. @param[in] Config Pointer to config data.
  67. @param[in] Filename Pointer to boot file name.
  68. @param[in] Overwrite Indicates whether to use an overwrite attribute.
  69. @param[in] BlockSize Pointer to required block size.
  70. @param[in] BufferPtr Pointer to buffer.
  71. @param[in, out] BufferSize Pointer to buffer size.
  72. @retval EFI_SUCCESS Successfully wrote the data into the special file.
  73. @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
  74. @retval other Write data into file failed.
  75. **/
  76. EFI_STATUS
  77. PxeBcTftpWriteFile (
  78. IN PXEBC_PRIVATE_DATA *Private,
  79. IN VOID *Config,
  80. IN UINT8 *Filename,
  81. IN BOOLEAN Overwrite,
  82. IN UINTN *BlockSize,
  83. IN UINT8 *BufferPtr,
  84. IN OUT UINT64 *BufferSize
  85. );
  86. /**
  87. This function is a wrapper to get the data (file) from a directory using TFTP.
  88. @param[in] Private Pointer to PxeBc private data.
  89. @param[in] Config Pointer to config data.
  90. @param[in] Filename Pointer to boot file name.
  91. @param[in] BlockSize Pointer to required block size.
  92. @param[in] BufferPtr Pointer to buffer.
  93. @param[in, out] BufferSize Pointer to buffer size.
  94. @param[in] DontUseBuffer Indicates whether with a receive buffer.
  95. @retval EFI_SUCCES Successfully obtained the data from the file included in directory.
  96. @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
  97. @retval Others Operation failed.
  98. **/
  99. EFI_STATUS
  100. PxeBcTftpReadDirectory (
  101. IN PXEBC_PRIVATE_DATA *Private,
  102. IN VOID *Config,
  103. IN UINT8 *Filename,
  104. IN UINTN *BlockSize,
  105. IN UINT8 *BufferPtr,
  106. IN OUT UINT64 *BufferSize,
  107. IN BOOLEAN DontUseBuffer
  108. );
  109. #endif