gnudir 3.0 KB

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