aboutsummaryrefslogtreecommitdiff
path: root/doc/gnudir
blob: cc78149a98f946bdbf278fe7967e2cb301fdb7c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
;;   This file is part of scheme-GNUnet, a partial Scheme port of GNUnet.
;;   Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2021 GNUnet e.V.
;;
;;   GNUnet is free software: you can redistribute it and/or modify it
;;   under the terms of the GNU Affero General Public License as published
;;   by the Free Software Foundation, either version 3 of the License,
;;   or (at your option) any later version.
;;
;;   GNUnet is distributed in the hope that it will be useful, but
;;   WITHOUT ANY WARRANTY; without even the implied warranty of
;;   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;   Affero General Public License for more details.
;;
;;   You should have received a copy of the GNU Affero General Public License
;;   along with this program.  If not, see <http://www.gnu.org/licenses/>.
;;
;;   SPDX-License-Identifier: AGPL-3.0-or-later
;;
;;   As a special exception to the GNU Affero General Public License,
;;   the file may be relicensed under any license used for
;;   most source code of GNUnet 0.13.1, or later versions, as published by
;;   GNUnet e.V.

** Definitions
uint32/be: big endian uint32_t (network order)

** Directory TODO
Magic constant: "\211GND\r\n\032\n"

structure:
  magic;
  meta-data-size as uint32;
  meta-data (size: meta-data-size);
  entry ...

entry:
  ??? alignment padding
  uri
  ??? force to next aligment?
  meta-data-size as uint32;
  meta-data (size: meta-data-size)

uri is null-terminated

** Metadata

struct meta_data_header {
  ;; The version of the MD serialization.  The highest bit is used to
  ;; indicate compression.
  ;;
  ;; Version 0 is traditional (pre-0.9) meta data (unsupported)
  ;; Version is 1 for a NULL pointer
  ;; Version 2 is for 0.9.x (and possibly higher)
  ;; Other version numbers are not yet defined.
  version as uint32/be;
  ;; How many MD entries are there?
  entries as uint32/be;
  ;; Number of bytes of meta data
  size    as uint32/be;
}

struct meta_data {
  struct meta_data_header header;
  switch header.version {
  case 0: ???
  case 1: ???
  /* Current version! */
  case 2:
    (the following compressed iff header.version & COMPRESSION):

     a list mde (length entries) (type: struct MetaDataEntry);
     ;; XXX verify
     foreach (e in mde, in reverse) {
      /* length 0 is allowed for strings. This means the string is NULL */
      mime_type as \0 terminated ASCII (length including \0: e.mime_type_length);
      plugin_name as \0 terminated ASCII (length including \0: e.plugin_name_length);
      data as a block of byte (length: e.data_size)
     }
    break;
  default: ???
}

struct meta_data_entry {
  ;; Meta data type
  type as uint32_t
  ;; Meta data format (UTF8, binary, ...)
  format as uint32_t
  ;; Number of bytes in meta data.
  data_size as uint32_t/be
  ;; Number of bytes in the plugin name including 0-terminator.
  ;; 0 for no plugin name.
  plugin_name_length as uint32_t/be
  ;; Number of bytes in the mime type including 0-terminator.
  ;; 0 for NULL.
  mime_type_length as uint32_t/be
}