diff options
Diffstat (limited to 'src/include/block_fs.h')
-rw-r--r-- | src/include/block_fs.h | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/src/include/block_fs.h b/src/include/block_fs.h new file mode 100644 index 000000000..c3dcdeced --- /dev/null +++ b/src/include/block_fs.h | |||
@@ -0,0 +1,165 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2010 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | 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 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file include/block_fs.h | ||
23 | * @brief fs block formats (shared between fs and block) | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef BLOCK_FS_H | ||
27 | #define BLOCK_FS_H | ||
28 | |||
29 | #include "gnunet_util_lib.h" | ||
30 | |||
31 | /** | ||
32 | * @brief keyword block (advertising data under a keyword) | ||
33 | */ | ||
34 | struct KBlock | ||
35 | { | ||
36 | |||
37 | /** | ||
38 | * GNUNET_RSA_Signature using RSA-key generated from search keyword. | ||
39 | */ | ||
40 | struct GNUNET_CRYPTO_RsaSignature signature; | ||
41 | |||
42 | /** | ||
43 | * What is being signed and why? | ||
44 | */ | ||
45 | struct GNUNET_CRYPTO_RsaSignaturePurpose purpose; | ||
46 | |||
47 | /** | ||
48 | * Key generated (!) from the H(keyword) as the seed! | ||
49 | */ | ||
50 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace; | ||
51 | |||
52 | /* 0-terminated URI here */ | ||
53 | |||
54 | /* variable-size Meta-Data follows here */ | ||
55 | |||
56 | }; | ||
57 | |||
58 | |||
59 | /** | ||
60 | * @brief namespace content block (advertising data under an identifier in a namespace) | ||
61 | */ | ||
62 | struct SBlock | ||
63 | { | ||
64 | |||
65 | /** | ||
66 | * GNUNET_RSA_Signature using RSA-key of the namespace | ||
67 | */ | ||
68 | struct GNUNET_CRYPTO_RsaSignature signature; | ||
69 | |||
70 | /** | ||
71 | * What is being signed and why? | ||
72 | */ | ||
73 | struct GNUNET_CRYPTO_RsaSignaturePurpose purpose; | ||
74 | |||
75 | /** | ||
76 | * Hash of the hash of the human-readable identifier used for | ||
77 | * this entry (the hash of the human-readable identifier is | ||
78 | * used as the key for decryption; the xor of this identifier | ||
79 | * and the hash of the "keyspace" is the datastore-query hash). | ||
80 | */ | ||
81 | GNUNET_HashCode identifier; | ||
82 | |||
83 | /** | ||
84 | * Public key of the namespace. | ||
85 | */ | ||
86 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace; | ||
87 | |||
88 | /* 0-terminated update-identifier here */ | ||
89 | |||
90 | /* 0-terminated URI here (except for NBlocks) */ | ||
91 | |||
92 | /* variable-size Meta-Data follows here */ | ||
93 | |||
94 | }; | ||
95 | |||
96 | |||
97 | /** | ||
98 | * @brief namespace advertisement block (advertising root of a namespace) | ||
99 | */ | ||
100 | struct NBlock | ||
101 | { | ||
102 | |||
103 | /** | ||
104 | * GNUNET_RSA_Signature using RSA-key generated from search keyword. | ||
105 | */ | ||
106 | struct GNUNET_CRYPTO_RsaSignature ksk_signature; | ||
107 | |||
108 | /** | ||
109 | * What is being signed and why? | ||
110 | */ | ||
111 | struct GNUNET_CRYPTO_RsaSignaturePurpose ksk_purpose; | ||
112 | |||
113 | /** | ||
114 | * Key generated (!) from the H(keyword) as the seed! | ||
115 | */ | ||
116 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace; | ||
117 | |||
118 | /** | ||
119 | * GNUNET_RSA_Signature using RSA-key of the namespace | ||
120 | */ | ||
121 | struct GNUNET_CRYPTO_RsaSignature ns_signature; | ||
122 | |||
123 | /** | ||
124 | * What is being signed and why? | ||
125 | */ | ||
126 | struct GNUNET_CRYPTO_RsaSignaturePurpose ns_purpose; | ||
127 | |||
128 | /** | ||
129 | * Public key of the namespace. | ||
130 | */ | ||
131 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace; | ||
132 | |||
133 | /* from here on, data is encrypted with H(keyword) */ | ||
134 | |||
135 | /* 0-terminated root identifier here */ | ||
136 | |||
137 | /* variable-size Meta-Data follows here */ | ||
138 | |||
139 | }; | ||
140 | |||
141 | |||
142 | /** | ||
143 | * @brief index block (indexing a DBlock that | ||
144 | * can be obtained directly from reading | ||
145 | * the plaintext file) | ||
146 | */ | ||
147 | struct OnDemandBlock | ||
148 | { | ||
149 | /** | ||
150 | * Hash code of the entire content of the | ||
151 | * file that was indexed (used to uniquely | ||
152 | * identify the plaintext file). | ||
153 | */ | ||
154 | GNUNET_HashCode file_id; | ||
155 | |||
156 | /** | ||
157 | * At which offset should we be able to find | ||
158 | * this on-demand encoded block? (in NBO) | ||
159 | */ | ||
160 | uint64_t offset GNUNET_PACKED; | ||
161 | |||
162 | }; | ||
163 | |||
164 | |||
165 | #endif | ||