gnudir 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. ;; This file is part of scheme-GNUnet, a partial Scheme port of GNUnet.
  2. ;; Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 GNUnet e.V.
  3. ;; Copyright (C) 2021 Maxime Devos <maxime.devos@student.kuleuven.be>
  4. ;;
  5. ;; GNUnet is free software: you can redistribute it and/or modify it
  6. ;; under the terms of the GNU Affero General Public License as published
  7. ;; by the Free Software Foundation, either version 3 of the License,
  8. ;; or (at your option) any later version.
  9. ;;
  10. ;; GNUnet is distributed in the hope that it will be useful, but
  11. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. ;; Affero General Public License for more details.
  14. ;;
  15. ;; You should have received a copy of the GNU Affero General Public License
  16. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;;
  18. ;; SPDX-License-Identifier: AGPL-3.0-or-later
  19. ;;
  20. ;; As a special exception to the GNU Affero General Public License,
  21. ;; the file may be relicensed under any license used for
  22. ;; most source code of GNUnet 0.13.1, or later versions, as published by
  23. ;; GNUnet e.V.
  24. ** Definitions
  25. uint32/be: big endian uint32_t (network order)
  26. ** Directory TODO
  27. Magic constant: "\211GND\r\n\032\n"
  28. structure:
  29. magic;
  30. meta-data-size as uint32;
  31. meta-data (size: meta-data-size);
  32. entry ...
  33. entry:
  34. ??? alignment padding
  35. uri
  36. ??? force to next aligment?
  37. meta-data-size as uint32;
  38. meta-data (size: meta-data-size)
  39. uri is null-terminated
  40. ** Metadata
  41. struct meta_data_header {
  42. ;; The version of the MD serialization. The highest bit is used to
  43. ;; indicate compression.
  44. ;;
  45. ;; Version 0 is traditional (pre-0.9) meta data (unsupported)
  46. ;; Version is 1 for a NULL pointer
  47. ;; Version 2 is for 0.9.x (and possibly higher)
  48. ;; Other version numbers are not yet defined.
  49. version as uint32/be;
  50. ;; How many MD entries are there?
  51. entries as uint32/be;
  52. ;; Number of bytes of meta data
  53. size as uint32/be;
  54. }
  55. struct meta_data {
  56. struct meta_data_header header;
  57. switch header.version {
  58. case 0: ???
  59. case 1: ???
  60. /* Current version! */
  61. case 2:
  62. (the following compressed iff header.version & COMPRESSION):
  63. a list mde (length entries) (type: struct MetaDataEntry);
  64. ;; XXX verify
  65. foreach (e in mde, in reverse) {
  66. /* length 0 is allowed for strings. This means the string is NULL */
  67. mime_type as \0 terminated ASCII (length including \0: e.mime_type_length);
  68. plugin_name as \0 terminated ASCII (length including \0: e.plugin_name_length);
  69. data as a block of byte (length: e.data_size)
  70. }
  71. break;
  72. default: ???
  73. }
  74. struct meta_data_entry {
  75. ;; Meta data type
  76. type as uint32_t
  77. ;; Meta data format (UTF8, binary, ...)
  78. format as uint32_t
  79. ;; Number of bytes in meta data.
  80. data_size as uint32_t/be
  81. ;; Number of bytes in the plugin name including 0-terminator.
  82. ;; 0 for no plugin name.
  83. plugin_name_length as uint32_t/be
  84. ;; Number of bytes in the mime type including 0-terminator.
  85. ;; 0 for NULL.
  86. mime_type_length as uint32_t/be
  87. }