aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-09-13 03:18:26 +0000
committerChristian Grothoff <christian@grothoff.org>2010-09-13 03:18:26 +0000
commit2e9791b5b713120238ea95113537fa55ff49b95d (patch)
tree98c0c6e0171109e7e4403fc50b6cae03a5c26c15 /src/include
parenta42b4e0ed22b65631caea4bb456f3d8fc21f11b1 (diff)
downloadgnunet-2e9791b5b713120238ea95113537fa55ff49b95d.tar.gz
gnunet-2e9791b5b713120238ea95113537fa55ff49b95d.zip
new block lib
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am3
-rw-r--r--src/include/block_fs.h165
-rw-r--r--src/include/gnunet_block_lib.h156
3 files changed, 167 insertions, 157 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 01e42fe3a..4e7fb8b7b 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -3,7 +3,8 @@ SUBDIRS = .
3gnunetincludedir = $(includedir)/gnunet 3gnunetincludedir = $(includedir)/gnunet
4 4
5nodist_gnunetinclude_HEADERS = \ 5nodist_gnunetinclude_HEADERS = \
6 gnunet_directories.h 6 gnunet_directories.h \
7 block_fs.h
7 8
8if MINGW 9if MINGW
9 WINPROC = winproc.h 10 WINPROC = winproc.h
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 */
34struct 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 */
62struct 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 */
100struct 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 */
147struct 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
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index ace4f23bb..7d06d592f 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -83,163 +83,7 @@ enum GNUNET_BLOCK_Type
83 }; 83 };
84 84
85 85
86/* **************** FIXME: move these to block_fs.h or so ***************** */
87 86
88/**
89 * @brief keyword block (advertising data under a keyword)
90 */
91struct KBlock
92{
93
94 /**
95 * GNUNET_RSA_Signature using RSA-key generated from search keyword.
96 */
97 struct GNUNET_CRYPTO_RsaSignature signature;
98
99 /**
100 * What is being signed and why?
101 */
102 struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
103
104 /**
105 * Key generated (!) from the H(keyword) as the seed!
106 */
107 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
108
109 /* 0-terminated URI here */
110
111 /* variable-size Meta-Data follows here */
112
113};
114
115
116/**
117 * @brief namespace content block (advertising data under an identifier in a namespace)
118 */
119struct SBlock
120{
121
122 /**
123 * GNUNET_RSA_Signature using RSA-key of the namespace
124 */
125 struct GNUNET_CRYPTO_RsaSignature signature;
126
127 /**
128 * What is being signed and why?
129 */
130 struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
131
132 /**
133 * Hash of the hash of the human-readable identifier used for
134 * this entry (the hash of the human-readable identifier is
135 * used as the key for decryption; the xor of this identifier
136 * and the hash of the "keyspace" is the datastore-query hash).
137 */
138 GNUNET_HashCode identifier;
139
140 /**
141 * Public key of the namespace.
142 */
143 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
144
145 /* 0-terminated update-identifier here */
146
147 /* 0-terminated URI here (except for NBlocks) */
148
149 /* variable-size Meta-Data follows here */
150
151};
152
153
154/**
155 * @brief namespace advertisement block (advertising root of a namespace)
156 */
157struct NBlock
158{
159
160 /**
161 * GNUNET_RSA_Signature using RSA-key generated from search keyword.
162 */
163 struct GNUNET_CRYPTO_RsaSignature ksk_signature;
164
165 /**
166 * What is being signed and why?
167 */
168 struct GNUNET_CRYPTO_RsaSignaturePurpose ksk_purpose;
169
170 /**
171 * Key generated (!) from the H(keyword) as the seed!
172 */
173 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded keyspace;
174
175 /**
176 * GNUNET_RSA_Signature using RSA-key of the namespace
177 */
178 struct GNUNET_CRYPTO_RsaSignature ns_signature;
179
180 /**
181 * What is being signed and why?
182 */
183 struct GNUNET_CRYPTO_RsaSignaturePurpose ns_purpose;
184
185 /**
186 * Public key of the namespace.
187 */
188 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded subspace;
189
190 /* from here on, data is encrypted with H(keyword) */
191
192 /* 0-terminated root identifier here */
193
194 /* variable-size Meta-Data follows here */
195
196};
197
198
199/**
200 * @brief index block (indexing a DBlock that
201 * can be obtained directly from reading
202 * the plaintext file)
203 */
204struct OnDemandBlock
205{
206 /**
207 * Hash code of the entire content of the
208 * file that was indexed (used to uniquely
209 * identify the plaintext file).
210 */
211 GNUNET_HashCode file_id;
212
213 /**
214 * At which offset should we be able to find
215 * this on-demand encoded block? (in NBO)
216 */
217 uint64_t offset GNUNET_PACKED;
218
219};
220
221
222/* **************** OLD API ***************** */
223
224/**
225 * Check if the given block is well-formed (and of the given type).
226 *
227 * @param type type of the block
228 * @param block the block data (or at least "size" bytes claiming to be one)
229 * @param size size of "kb" in bytes; check that it is large enough
230 * @param query where to store the query that this block answers
231 * @return GNUNET_OK if this is actually a well-formed KBlock
232 * GNUNET_NO if we could not determine the query,
233 * GNUNET_SYSERR if the block is malformed
234 */
235int
236GNUNET_BLOCK_check_block (enum GNUNET_BLOCK_Type type,
237 const void *block,
238 size_t size,
239 GNUNET_HashCode *query);
240
241
242/* **************** NEW API ***************** */
243 87
244/** 88/**
245 * Possible ways for how a block may relate to a query. 89 * Possible ways for how a block may relate to a query.