aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-dht-put.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-dht-put.c')
-rw-r--r--src/dht/gnunet-dht-put.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c
index 4c26f98a5..0432dc4a0 100644
--- a/src/dht/gnunet-dht-put.c
+++ b/src/dht/gnunet-dht-put.c
@@ -107,8 +107,7 @@ shutdown_task (void *cls)
107static void 107static void
108message_sent_cont (void *cls) 108message_sent_cont (void *cls)
109{ 109{
110 GNUNET_SCHEDULER_add_now (&shutdown_task, 110 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
111 NULL);
112} 111}
113 112
114 113
@@ -131,26 +130,25 @@ run (void *cls,
131 cfg = c; 130 cfg = c;
132 if ((NULL == query_key) || (NULL == data)) 131 if ((NULL == query_key) || (NULL == data))
133 { 132 {
134 FPRINTF (stderr, "%s", _("Must provide KEY and DATA for DHT put!\n")); 133 fprintf (stderr, "%s", _ ("Must provide KEY and DATA for DHT put!\n"));
135 ret = 1; 134 ret = 1;
136 return; 135 return;
137 } 136 }
138 137
139 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1))) 138 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg, 1)))
140 { 139 {
141 FPRINTF (stderr, 140 fprintf (stderr, _ ("Could not connect to DHT service!\n"));
142 _("Could not connect to DHT service!\n"));
143 ret = 1; 141 ret = 1;
144 return; 142 return;
145 } 143 }
146 if (GNUNET_BLOCK_TYPE_ANY == query_type) /* Type of data not set */ 144 if (GNUNET_BLOCK_TYPE_ANY == query_type) /* Type of data not set */
147 query_type = GNUNET_BLOCK_TYPE_TEST; 145 query_type = GNUNET_BLOCK_TYPE_TEST;
148 146
149 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key); 147 GNUNET_CRYPTO_hash (query_key, strlen (query_key), &key);
150 148
151 if (verbose) 149 if (verbose)
152 FPRINTF (stderr, 150 fprintf (stderr,
153 _("Issuing put request for `%s' with data `%s'!\n"), 151 _ ("Issuing put request for `%s' with data `%s'!\n"),
154 query_key, 152 query_key,
155 data); 153 data);
156 ro = GNUNET_DHT_RO_NONE; 154 ro = GNUNET_DHT_RO_NONE;
@@ -181,60 +179,62 @@ int
181main (int argc, char *const *argv) 179main (int argc, char *const *argv)
182{ 180{
183 181
184 struct GNUNET_GETOPT_CommandLineOption options[] = { 182 struct GNUNET_GETOPT_CommandLineOption options[] =
185 GNUNET_GETOPT_option_string ('d', 183 {GNUNET_GETOPT_option_string ('d',
186 "data", 184 "data",
187 "DATA", 185 "DATA",
188 gettext_noop ("the data to insert under the key"), 186 gettext_noop (
189 &data), 187 "the data to insert under the key"),
190 GNUNET_GETOPT_option_relative_time ('e', 188 &data),
191 "expiration", 189 GNUNET_GETOPT_option_relative_time (
192 "EXPIRATION", 190 'e',
193 gettext_noop ("how long to store this entry in the dht (in seconds)"), 191 "expiration",
194 &expiration), 192 "EXPIRATION",
195 GNUNET_GETOPT_option_string ('k', 193 gettext_noop ("how long to store this entry in the dht (in seconds)"),
196 "key", 194 &expiration),
197 "KEY", 195 GNUNET_GETOPT_option_string ('k',
198 gettext_noop ("the query key"), 196 "key",
199 &query_key), 197 "KEY",
200 GNUNET_GETOPT_option_flag ('x', 198 gettext_noop ("the query key"),
201 "demultiplex", 199 &query_key),
202 gettext_noop ("use DHT's demultiplex everywhere option"), 200 GNUNET_GETOPT_option_flag ('x',
203 &demultixplex_everywhere), 201 "demultiplex",
204 GNUNET_GETOPT_option_uint ('r', 202 gettext_noop (
205 "replication", 203 "use DHT's demultiplex everywhere option"),
206 "LEVEL", 204 &demultixplex_everywhere),
207 gettext_noop ("how many replicas to create"), 205 GNUNET_GETOPT_option_uint ('r',
208 &replication), 206 "replication",
209 GNUNET_GETOPT_option_flag ('R', 207 "LEVEL",
210 "record", 208 gettext_noop ("how many replicas to create"),
211 gettext_noop ("use DHT's record route option"), 209 &replication),
212 &record_route), 210 GNUNET_GETOPT_option_flag ('R',
213 GNUNET_GETOPT_option_uint ('t', 211 "record",
214 "type", 212 gettext_noop ("use DHT's record route option"),
215 "TYPE", 213 &record_route),
216 gettext_noop ("the type to insert data as"), 214 GNUNET_GETOPT_option_uint ('t',
217 &query_type), 215 "type",
218 GNUNET_GETOPT_option_verbose (&verbose), 216 "TYPE",
219 GNUNET_GETOPT_OPTION_END 217 gettext_noop ("the type to insert data as"),
220 }; 218 &query_type),
221 219 GNUNET_GETOPT_option_verbose (&verbose),
222 220 GNUNET_GETOPT_OPTION_END};
223 if (GNUNET_OK != 221
224 GNUNET_STRINGS_get_utf8_args (argc, argv, 222
225 &argc, &argv)) 223 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
226 return 2; 224 return 2;
227 expiration = GNUNET_TIME_UNIT_HOURS; 225 expiration = GNUNET_TIME_UNIT_HOURS;
228 return (GNUNET_OK == 226 return (GNUNET_OK ==
229 GNUNET_PROGRAM_run (argc, 227 GNUNET_PROGRAM_run (
230 argv, 228 argc,
231 "gnunet-dht-put", 229 argv,
232 gettext_noop 230 "gnunet-dht-put",
233 ("Issue a PUT request to the GNUnet DHT insert DATA under KEY."), 231 gettext_noop (
234 options, 232 "Issue a PUT request to the GNUnet DHT insert DATA under KEY."),
235 &run, 233 options,
236 NULL)) 234 &run,
237 ? ret : 1; 235 NULL))
236 ? ret
237 : 1;
238} 238}
239 239
240/* end of gnunet-dht-put.c */ 240/* end of gnunet-dht-put.c */