PxeBcMtftp.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /** @file
  2. Functions declaration related with Mtftp for UefiPxeBc Driver.
  3. Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef __EFI_PXEBC_MTFTP_H__
  7. #define __EFI_PXEBC_MTFTP_H__
  8. #define PXE_MTFTP_OPTION_BLKSIZE_INDEX 0
  9. #define PXE_MTFTP_OPTION_TIMEOUT_INDEX 1
  10. #define PXE_MTFTP_OPTION_TSIZE_INDEX 2
  11. #define PXE_MTFTP_OPTION_MULTICAST_INDEX 3
  12. #define PXE_MTFTP_OPTION_WINDOWSIZE_INDEX 4
  13. #define PXE_MTFTP_OPTION_MAXIMUM_INDEX 5
  14. #define PXE_MTFTP_OPTBUF_MAXNUM_INDEX 128
  15. #define PXE_MTFTP_ERROR_STRING_LENGTH 127 // refer to definition of struct EFI_PXE_BASE_CODE_TFTP_ERROR.
  16. #define PXE_MTFTP_DEFAULT_BLOCK_SIZE 512 // refer to rfc-1350.
  17. /**
  18. This function is wrapper to get the file size using TFTP.
  19. @param[in] Private Pointer to PxeBc private data.
  20. @param[in] Config Pointer to configure data.
  21. @param[in] Filename Pointer to boot file name.
  22. @param[in] BlockSize Pointer to required block size.
  23. @param[in] WindowSize Pointer to required window size.
  24. @param[in, out] BufferSize Pointer to buffer size.
  25. @retval EFI_SUCCESS Successfully obtained the size of file.
  26. @retval EFI_NOT_FOUND Parse the tftp options failed.
  27. @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
  28. @retval Others Did not obtain the size of the file.
  29. **/
  30. EFI_STATUS
  31. PxeBcTftpGetFileSize (
  32. IN PXEBC_PRIVATE_DATA *Private,
  33. IN VOID *Config,
  34. IN UINT8 *Filename,
  35. IN UINTN *BlockSize,
  36. IN UINTN *WindowSize,
  37. IN OUT UINT64 *BufferSize
  38. );
  39. /**
  40. This function is a wrapper to get a file using TFTP.
  41. @param[in] Private Pointer to PxeBc private data.
  42. @param[in] Config Pointer to config data.
  43. @param[in] Filename Pointer to boot file name.
  44. @param[in] BlockSize Pointer to required block size.
  45. @param[in] WindowSize Pointer to required window 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 UINTN *WindowSize,
  60. IN UINT8 *BufferPtr,
  61. IN OUT UINT64 *BufferSize,
  62. IN BOOLEAN DontUseBuffer
  63. );
  64. /**
  65. This function is a wrapper to put file with TFTP.
  66. @param[in] Private Pointer to PxeBc private data.
  67. @param[in] Config Pointer to config data.
  68. @param[in] Filename Pointer to boot file name.
  69. @param[in] Overwrite Indicates whether to use an overwrite attribute.
  70. @param[in] BlockSize Pointer to required block size.
  71. @param[in] BufferPtr Pointer to buffer.
  72. @param[in, out] BufferSize Pointer to buffer size.
  73. @retval EFI_SUCCESS Successfully wrote the data into the special file.
  74. @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
  75. @retval other Write data into file failed.
  76. **/
  77. EFI_STATUS
  78. PxeBcTftpWriteFile (
  79. IN PXEBC_PRIVATE_DATA *Private,
  80. IN VOID *Config,
  81. IN UINT8 *Filename,
  82. IN BOOLEAN Overwrite,
  83. IN UINTN *BlockSize,
  84. IN UINT8 *BufferPtr,
  85. IN OUT UINT64 *BufferSize
  86. );
  87. /**
  88. This function is a wrapper to get the data (file) from a directory using TFTP.
  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] BlockSize Pointer to required block size.
  93. @param[in] WindowSize Pointer to required window size.
  94. @param[in] BufferPtr Pointer to buffer.
  95. @param[in, out] BufferSize Pointer to buffer size.
  96. @param[in] DontUseBuffer Indicates whether with a receive buffer.
  97. @retval EFI_SUCCESS Successfully obtained the data from the file included in directory.
  98. @retval EFI_DEVICE_ERROR The network device encountered an error during this operation.
  99. @retval Others Operation failed.
  100. **/
  101. EFI_STATUS
  102. PxeBcTftpReadDirectory (
  103. IN PXEBC_PRIVATE_DATA *Private,
  104. IN VOID *Config,
  105. IN UINT8 *Filename,
  106. IN UINTN *BlockSize,
  107. IN UINTN *WindowSize,
  108. IN UINT8 *BufferPtr,
  109. IN OUT UINT64 *BufferSize,
  110. IN BOOLEAN DontUseBuffer
  111. );
  112. #endif