diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-12 19:09:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-12 19:09:52 +0000 |
commit | 5e05019536c0d38bf20f965613636f21ae7c2be6 (patch) | |
tree | eda1dee12e49c010171462d618162d28b21c9c6a /src/include/gnunet_namestore_plugin.h | |
parent | 566dfe32be22ed1f071b974be3c4dd8bc5721151 (diff) | |
download | gnunet-5e05019536c0d38bf20f965613636f21ae7c2be6.tar.gz gnunet-5e05019536c0d38bf20f965613636f21ae7c2be6.zip |
-towards namestore support for the new privacy-preserving GNS queries
Diffstat (limited to 'src/include/gnunet_namestore_plugin.h')
-rw-r--r-- | src/include/gnunet_namestore_plugin.h | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h index b4ffc257d..6ac0038ba 100644 --- a/src/include/gnunet_namestore_plugin.h +++ b/src/include/gnunet_namestore_plugin.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | (C) 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2012, 2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published |
@@ -40,25 +40,29 @@ extern "C" | |||
40 | 40 | ||
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Function called for matching blocks. | ||
44 | * | ||
45 | * @param cls closure | ||
46 | * @param block lookup result | ||
47 | */ | ||
48 | typedef void (*GNUNET_NAMESTORE_BlockCallback) (void *cls, | ||
49 | const struct GNUNET_NAMESTORE_Block *block); | ||
50 | |||
51 | |||
52 | /** | ||
43 | * Function called by for each matching record. | 53 | * Function called by for each matching record. |
44 | * | 54 | * |
45 | * @param cls closure | 55 | * @param cls closure |
46 | * @param zone_key public key of the zone | 56 | * @param zone_key private key of the zone |
47 | * @param expire when does the corresponding block in the DHT expire (until | 57 | * @param label name that is being mapped (at most 255 characters long) |
48 | * when should we never do a DHT lookup for the same name again)? | ||
49 | * @param name name that is being mapped (at most 255 characters long) | ||
50 | * @param rd_count number of entries in 'rd' array | 58 | * @param rd_count number of entries in 'rd' array |
51 | * @param rd array of records with data to store | 59 | * @param rd array of records with data to store |
52 | * @param signature signature of the record block, NULL if signature is unavailable (i.e. | ||
53 | * because the user queried for a particular record type only) | ||
54 | */ | 60 | */ |
55 | typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls, | 61 | typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls, |
56 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, | 62 | const struct GNUNET_CRYPTO_EccPrivateKey *private_key, |
57 | struct GNUNET_TIME_Absolute expire, | 63 | const char *label, |
58 | const char *name, | 64 | unsigned int rd_count, |
59 | unsigned int rd_len, | 65 | const struct GNUNET_NAMESTORE_RecordData *rd); |
60 | const struct GNUNET_NAMESTORE_RecordData *rd, | ||
61 | const struct GNUNET_CRYPTO_EccSignature *signature); | ||
62 | 66 | ||
63 | 67 | ||
64 | /** | 68 | /** |
@@ -73,49 +77,58 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
73 | void *cls; | 77 | void *cls; |
74 | 78 | ||
75 | /** | 79 | /** |
76 | * Store a record in the datastore. Removes any existing record in the | 80 | * Cache a block in the datastore. Overwrites (older) existing blocks |
77 | * same zone with the same name. | 81 | * for the same zone and label. |
78 | * | 82 | * |
79 | * @param cls closure (internal context for the plugin) | 83 | * @param cls closure (internal context for the plugin) |
80 | * @param zone_key public key of the zone | 84 | * @param block block to cache |
81 | * @param expire when does the corresponding block in the DHT expire (until | ||
82 | * when should we never do a DHT lookup for the same name again)? | ||
83 | * @param name name that is being mapped (at most 255 characters long) | ||
84 | * @param rd_count number of entries in 'rd' array | ||
85 | * @param rd array of records with data to store | ||
86 | * @param signature signature of the record block, NULL if signature is unavailable (i.e. | ||
87 | * because the user queried for a particular record type only) | ||
88 | * @return GNUNET_OK on success, else GNUNET_SYSERR | 85 | * @return GNUNET_OK on success, else GNUNET_SYSERR |
89 | */ | 86 | */ |
90 | int (*put_records) (void *cls, | 87 | int (*cache_block) (void *cls, |
91 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, | 88 | const struct GNUNET_NAMESTORE_Block *block); |
92 | struct GNUNET_TIME_Absolute expire, | 89 | |
93 | const char *name, | 90 | |
94 | unsigned int rd_len, | 91 | /** |
95 | const struct GNUNET_NAMESTORE_RecordData *rd, | 92 | * Get the block for a particular zone and label in the |
96 | const struct GNUNET_CRYPTO_EccSignature *signature); | 93 | * datastore. Will return at most one result to the iterator. |
94 | * | ||
95 | * @param cls closure (internal context for the plugin) | ||
96 | * @param query hash of public key derived from the zone and the label | ||
97 | * @param iter function to call with the result | ||
98 | * @param iter_cls closure for iter | ||
99 | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error | ||
100 | * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' | ||
101 | */ | ||
102 | int (*lookup_block) (void *cls, | ||
103 | const struct GNUNET_HashCode *query, | ||
104 | GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls); | ||
105 | |||
97 | 106 | ||
98 | 107 | ||
99 | /** | 108 | /** |
100 | * Removes any existing record in the given zone with the same name. | 109 | * Store a record in the datastore for which we are the authority. |
110 | * Removes any existing record in the same zone with the same name. | ||
101 | * | 111 | * |
102 | * @param cls closure (internal context for the plugin) | 112 | * @param cls closure (internal context for the plugin) |
103 | * @param zone hash of the public key of the zone | 113 | * @param zone private key of the zone |
104 | * @param name name to remove (at most 255 characters long) | 114 | * @param label name of the record in the zone |
105 | * @return GNUNET_OK on success | 115 | * @param rd_count number of entries in 'rd' array, 0 to delete all records |
116 | * @param rd array of records with data to store | ||
117 | * @return GNUNET_OK on success, else GNUNET_SYSERR | ||
106 | */ | 118 | */ |
107 | int (*remove_records) (void *cls, | 119 | int (*store_records) (void *cls, |
108 | const struct GNUNET_CRYPTO_ShortHashCode *zone, | 120 | const struct GNUNET_CRYPTO_EccPrivateKey *zone, |
109 | const char *name); | 121 | const char *label, |
122 | unsigned int rd_count, | ||
123 | const struct GNUNET_NAMESTORE_RecordData *rd); | ||
110 | 124 | ||
111 | 125 | ||
112 | /** | 126 | /** |
113 | * Iterate over the results for a particular key and zone in the | 127 | * Iterate over the results for a particular zone in the |
114 | * datastore. Will return at most one result to the iterator. | 128 | * datastore. Will return at most one result to the iterator. |
115 | * | 129 | * |
116 | * @param cls closure (internal context for the plugin) | 130 | * @param cls closure (internal context for the plugin) |
117 | * @param zone hash of public key of the zone, NULL to iterate over all zones | 131 | * @param zone private key of the zone |
118 | * @param name name as '\0' terminated string, NULL to iterate over all records of the zone | ||
119 | * @param offset offset in the list of all matching records | 132 | * @param offset offset in the list of all matching records |
120 | * @param iter function to call with the result | 133 | * @param iter function to call with the result |
121 | * @param iter_cls closure for iter | 134 | * @param iter_cls closure for iter |
@@ -123,8 +136,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
123 | * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' | 136 | * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' |
124 | */ | 137 | */ |
125 | int (*iterate_records) (void *cls, | 138 | int (*iterate_records) (void *cls, |
126 | const struct GNUNET_CRYPTO_ShortHashCode *zone, | 139 | const struct GNUNET_CRYPTO_EccPrivateKey *zone, |
127 | const char *name, | ||
128 | uint64_t offset, | 140 | uint64_t offset, |
129 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); | 141 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); |
130 | 142 | ||
@@ -134,29 +146,19 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
134 | * Returns at most one result to the iterator. | 146 | * Returns at most one result to the iterator. |
135 | * | 147 | * |
136 | * @param cls closure (internal context for the plugin) | 148 | * @param cls closure (internal context for the plugin) |
137 | * @param zone hash of public key of the zone to look up in, never NULL | 149 | * @param zone private key of the zone to look up in, never NULL |
138 | * @param value_zone hash of the public key of the target zone (value), never NULL | 150 | * @param value_zone public key of the target zone (value), never NULL |
139 | * @param iter function to call with the result | 151 | * @param iter function to call with the result |
140 | * @param iter_cls closure for iter | 152 | * @param iter_cls closure for iter |
141 | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error | 153 | * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error |
142 | * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' | 154 | * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' |
143 | */ | 155 | */ |
144 | int (*zone_to_name) (void *cls, | 156 | int (*zone_to_name) (void *cls, |
145 | const struct GNUNET_CRYPTO_ShortHashCode *zone, | 157 | const struct GNUNET_CRYPTO_EccPrivateKey *zone, |
146 | const struct GNUNET_CRYPTO_ShortHashCode *value_zone, | 158 | const struct GNUNET_CRYPTO_EccPublicKey *value_zone, |
147 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); | 159 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); |
148 | 160 | ||
149 | 161 | ||
150 | /** | ||
151 | * Delete an entire zone (all records). Not used in normal operation. | ||
152 | * | ||
153 | * @param cls closure (internal context for the plugin) | ||
154 | * @param zone zone to delete | ||
155 | */ | ||
156 | void (*delete_zone) (void *cls, | ||
157 | const struct GNUNET_CRYPTO_ShortHashCode *zone); | ||
158 | |||
159 | |||
160 | }; | 162 | }; |
161 | 163 | ||
162 | 164 | ||