antfs_directory.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. This software is subject to the license described in the License.txt file
  3. included with this software distribution. You may not use this file except
  4. in compliance with this license.
  5. Copyright (c) Dynastream Innovations Inc. 2016
  6. All rights reserved.
  7. */
  8. #if !defined(ANTFS_DIRECTORY_H)
  9. #define ANTFS_DIRECTORY_H
  10. #include "types.h"
  11. #define ANTFS_GENERAL_FLAG_READ ((UCHAR)0x80)
  12. #define ANTFS_GENERAL_FLAG_WRITE ((UCHAR)0x40)
  13. #define ANTFS_GENERAL_FLAG_ERASE ((UCHAR)0x20)
  14. #define ANTFS_GENERAL_FLAG_ARCHIVE ((UCHAR)0x10)
  15. #define ANTFS_GENERAL_FLAG_APPEND ((UCHAR)0x08)
  16. #define ANTFS_GENERAL_FLAG_CRYPTO ((UCHAR)0x04)
  17. #define ANTFS_SPECIFIC_FLAG_SELECTED ((UCHAR)0x01)
  18. //////////////////////////////////////////////////////////////////////////////////
  19. // Public Definitions
  20. //////////////////////////////////////////////////////////////////////////////////
  21. typedef struct
  22. {
  23. UCHAR ucVersion;
  24. UCHAR ucElementLength;
  25. UCHAR ucTimeFormat;
  26. UCHAR ucReserved01;
  27. UCHAR ucReserved02;
  28. UCHAR ucReserved03;
  29. UCHAR ucReserved04;
  30. UCHAR ucReserved05;
  31. ULONG ulSystemTime;
  32. ULONG ulTimeStamp;
  33. } ANTFS_DIRECTORY_HEADER;
  34. typedef struct
  35. {
  36. USHORT usFileIndex;
  37. UCHAR ucFileDataType;
  38. UCHAR ucFileSubType;
  39. USHORT usFileNumber;
  40. UCHAR ucSpecificFlags;
  41. UCHAR ucGeneralFlags;
  42. ULONG ulFileSize;
  43. ULONG ulTimeStamp;
  44. } ANTFSP_DIRECTORY;
  45. #define MAX_DATA_SIZE 65535
  46. //////////////////////
  47. #if defined(__cplusplus)
  48. extern "C" {
  49. #endif
  50. ULONG ANTFSDir_GetNumberOfFileEntries(void *pvDirectory_, ULONG ulDirectoryFileLength_);
  51. /////////////////////////////////////////////////////////////////
  52. // Returns the number of file entries contained in the direcotry.
  53. //
  54. // Parameters:
  55. // *pvDirectory_ : Pointer to the downloaded directory file
  56. // ulDirectoryFileLength_ : Length of the downloaded directory file
  57. //
  58. // Returns the number of file entries contained in the directory.
  59. /////////////////////////////////////////////////////////////////
  60. BOOL ANTFSDir_LookupFileEntry(void *pvDirectory_, ULONG ulDirectoryFileLength_, ULONG ulFileEntry_, ANTFSP_DIRECTORY *pusDirectoryStruct_);
  61. /////////////////////////////////////////////////////////////////
  62. // Fills in the directory struct with information from the directory
  63. // file.
  64. //
  65. // Parameters:
  66. // *pvDirectory_ : Pointer to the downloaded directory file
  67. // ulDirectoryFileLength_ : Length of the downloaded directory file
  68. // ulFileEntry_ : Entry number of the file that needs to be looked up (this parameter is zero based).
  69. // *pusDirectoryStruct_ : Pointer to a ANTFSP_DIRECTORY struct where
  70. // the information from the directory will be filled in.
  71. // The calling applicaiton should allocate an
  72. // ANTFSP_DIRECTORY struct and provide the pointer to it.
  73. // Returns TRUE if successful. Otherwise, it returns FALSE.
  74. /////////////////////////////////////////////////////////////////
  75. BOOL ANTFSDir_GetNewFileList(void *pvDirectory_, ULONG ulDirectoryFileLength_, USHORT *pusFileIndexList, USHORT * pusListLength);
  76. /////////////////////////////////////////////////////////////////
  77. // Decodes the directory and generates a list of files that needs
  78. // that needs to be downloaded.
  79. //
  80. // Parameters:
  81. // *pvDirectory_ : Pointer to the downloaded directory file
  82. // ulDirectoryFileLength_ : Length of the downloaded directory file
  83. // *pusFileIndexList : Pointer to a USHORT array where the list
  84. // of file indexes will be written. NULL can be
  85. // passed to this parameter so that the size can
  86. // be returned without actually writing the list.
  87. // The application can then call this function again
  88. // after it has allocated an array of sufficient
  89. // size to handle the list.
  90. // *pusListLength : Pointer to a USHORT that will receive
  91. // the number of files the list will contain.
  92. // Returns TRUE if successful. Otherwise, it returns FALSE.
  93. /////////////////////////////////////////////////////////////////
  94. BOOL ANTFSDir_LookupFileIndex(void *pvDirectory_, ULONG ulDirectoryFileLength_, USHORT usFileIndex_, ANTFSP_DIRECTORY *pusDirectoryStruct_);
  95. /////////////////////////////////////////////////////////////////
  96. // Fills in the directory struct with information from the directory
  97. // file.
  98. //
  99. // Parameters:
  100. // *pvDirectory_ : Pointer to the downloaded directory file
  101. // ulDirectoryFileLength_ : Length of the downloaded directory file
  102. // usFileIndex_ : Indext of the file that needs to be looked up.
  103. // *pusDirectoryStruct_ : Pointer to a ANTFSP_DIRECTORY struct where
  104. // the information from the directory will be filled in.
  105. // The calling applicaiton should allocate an
  106. // ANTFSP_DIRECTORY struct and provide the pointer to it.
  107. // Returns TRUE if successful. Otherwise, it returns FALSE.
  108. /////////////////////////////////////////////////////////////////
  109. #if defined(__cplusplus)
  110. }
  111. #endif
  112. #endif // !defined(ANTFS_DIRECTORY_H)