aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2017-03-16 16:27:38 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2017-03-16 16:27:38 +0100
commitb92543a726e5f0df8c29788badae049923f3b35a (patch)
treebd7ee5d653054174441e01f2ae1ab0d178cdf247
parente724ea478e4efe6e2531f81908ce0f9334357d81 (diff)
downloadgnunet-b92543a726e5f0df8c29788badae049923f3b35a.tar.gz
gnunet-b92543a726e5f0df8c29788badae049923f3b35a.zip
porting social
-rw-r--r--src/secretsharing/gnunet-secretsharing-profiler.c59
-rw-r--r--src/social/gnunet-social.c267
2 files changed, 193 insertions, 133 deletions
diff --git a/src/secretsharing/gnunet-secretsharing-profiler.c b/src/secretsharing/gnunet-secretsharing-profiler.c
index 3ff5d7fdd..e66019dc6 100644
--- a/src/secretsharing/gnunet-secretsharing-profiler.c
+++ b/src/secretsharing/gnunet-secretsharing-profiler.c
@@ -41,7 +41,7 @@ static unsigned int threshold = 2;
41/** 41/**
42 * Should we try to decrypt a value after the key generation? 42 * Should we try to decrypt a value after the key generation?
43 */ 43 */
44static unsigned int decrypt = GNUNET_NO; 44static int decrypt = GNUNET_NO;
45 45
46/** 46/**
47 * When would we like to see the operation finished? 47 * When would we like to see the operation finished?
@@ -88,7 +88,7 @@ static unsigned int num_decrypted;
88 88
89static struct GNUNET_HashCode session_id; 89static struct GNUNET_HashCode session_id;
90 90
91static int verbose; 91static unsigned int verbose;
92 92
93static struct GNUNET_SECRETSHARING_Plaintext reference_plaintext; 93static struct GNUNET_SECRETSHARING_Plaintext reference_plaintext;
94 94
@@ -602,26 +602,41 @@ run (void *cls, char *const *args, const char *cfgfile,
602int 602int
603main (int argc, char **argv) 603main (int argc, char **argv)
604{ 604{
605 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 605 struct GNUNET_GETOPT_CommandLineOption options[] = {
606 { 'n', "num-peers", NULL, 606
607 gettext_noop ("number of peers in consensus"), 607 GNUNET_GETOPT_OPTION_SET_UINT ('n',
608 GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_peers }, 608 "num-peers",
609 { 'D', "delay", NULL, 609 NULL,
610 gettext_noop ("dkg start delay"), 610 gettext_noop ("number of peers in consensus"),
611 GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &delay }, 611 &num_peers),
612 { 't', "timeout", NULL, 612
613 gettext_noop ("dkg timeout"), 613 GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('D',
614 GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &timeout }, 614 "delay",
615 { 'k', "threshold", NULL, 615 NULL,
616 gettext_noop ("threshold"), 616 gettext_noop ("dkg start delay"),
617 GNUNET_YES, &GNUNET_GETOPT_set_uint, &threshold }, 617 &delay),
618 { 'd', "decrypt", NULL, 618
619 gettext_noop ("also profile decryption"), 619 GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t',
620 GNUNET_NO, &GNUNET_GETOPT_set_one, &decrypt }, 620 "timeout",
621 { 'V', "verbose", NULL, 621 NULL,
622 gettext_noop ("be more verbose (print received values)"), 622 gettext_noop ("dkg timeout"),
623 GNUNET_NO, &GNUNET_GETOPT_set_one, &verbose }, 623 &timeout),
624 GNUNET_GETOPT_OPTION_END 624
625 GNUNET_GETOPT_OPTION_SET_UINT ('k',
626 "threshold",
627 NULL,
628 gettext_noop ("threshold"),
629 &threshold),
630
631 GNUNET_GETOPT_OPTION_SET_ONE ('d',
632 "descrypt",
633 gettext_noop ("also profile decryption"),
634 &decrypt),
635
636
637 GNUNET_GETOPT_OPTION_VERBOSE (&verbose),
638
639 GNUNET_GETOPT_OPTION_END
625 }; 640 };
626 delay = GNUNET_TIME_UNIT_ZERO; 641 delay = GNUNET_TIME_UNIT_ZERO;
627 timeout = GNUNET_TIME_UNIT_MINUTES; 642 timeout = GNUNET_TIME_UNIT_MINUTES;
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c
index b864b828e..71392d8e9 100644
--- a/src/social/gnunet-social.c
+++ b/src/social/gnunet-social.c
@@ -1199,7 +1199,7 @@ int
1199main (int argc, char *const *argv) 1199main (int argc, char *const *argv)
1200{ 1200{
1201 int res; 1201 int res;
1202 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 1202 struct GNUNET_GETOPT_CommandLineOption options[] = {
1203 /* 1203 /*
1204 * gnunet program options in addition to the ones below: 1204 * gnunet program options in addition to the ones below:
1205 * 1205 *
@@ -1212,120 +1212,165 @@ main (int argc, char *const *argv)
1212 1212
1213 /* operations */ 1213 /* operations */
1214 1214
1215 { 'A', "host-assign", NULL, 1215 GNUNET_GETOPT_OPTION_SET_ONE ('A',
1216 gettext_noop ("assign --name in state to --data"), 1216 "host-assign",
1217 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_assign }, 1217 gettext_noop ("assign --name in state to --data"),
1218 1218 &op_host_assign),
1219 { 'B', "guest-leave", NULL, 1219
1220 gettext_noop ("say good-bye and leave somebody else's place"), 1220 GNUNET_GETOPT_OPTION_SET_ONE ('B',
1221 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_leave }, 1221 "guest-leave",
1222 1222 gettext_noop ("say good-bye and leave somebody else's place"),
1223 { 'C', "host-enter", NULL, 1223 &op_guest_leave),
1224 gettext_noop ("create a place"), 1224
1225 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter }, 1225 GNUNET_GETOPT_OPTION_SET_ONE ('C',
1226 1226 "host-enter",
1227 { 'D', "host-leave", NULL, 1227 gettext_noop ("create a place"),
1228 gettext_noop ("destroy a place we were hosting"), 1228 &op_host_enter),
1229 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_leave }, 1229
1230 1230 GNUNET_GETOPT_OPTION_SET_ONE ('C',
1231 { 'E', "guest-enter", NULL, 1231 "host-enter",
1232 gettext_noop ("enter somebody else's place"), 1232 gettext_noop ("create a place"),
1233 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_enter }, 1233 &op_host_enter),
1234 1234
1235 { 'F', "look-for", NULL, 1235 GNUNET_GETOPT_OPTION_SET_ONE ('D',
1236 gettext_noop ("find state matching name prefix"), 1236 "host-leave",
1237 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_look_for }, 1237 gettext_noop ("destroy a place we were hosting"),
1238 1238 &op_host_leave),
1239 { 'H', "replay-latest", NULL, 1239
1240 gettext_noop ("replay history of messages up to the given --limit"), 1240 GNUNET_GETOPT_OPTION_SET_ONE ('E',
1241 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_replay_latest }, 1241 "guest-enter",
1242 1242 gettext_noop ("enter somebody else's place"),
1243 { 'N', "host-reconnect", NULL, 1243 &op_guest_enter),
1244 gettext_noop ("reconnect to a previously created place"), 1244
1245 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_reconnect }, 1245
1246 1246 GNUNET_GETOPT_OPTION_SET_ONE ('F',
1247 { 'P', "host-announce", NULL, 1247 "look-for",
1248 gettext_noop ("publish something to a place we are hosting"), 1248 gettext_noop ("find state matching name prefix"),
1249 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_announce }, 1249 &op_look_for),
1250 1250
1251 { 'R', "guest-reconnect", NULL, 1251 GNUNET_GETOPT_OPTION_SET_ONE ('H',
1252 gettext_noop ("reconnect to a previously entered place"), 1252 "replay-latest",
1253 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_reconnect }, 1253 gettext_noop ("replay history of messages up to the given --limit"),
1254 1254 &op_replay_latest),
1255 { 'S', "look-at", NULL, 1255
1256 gettext_noop ("search for state matching exact name"), 1256 GNUNET_GETOPT_OPTION_SET_ONE ('N',
1257 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_look_at }, 1257 "host-reconnect",
1258 1258 gettext_noop ("reconnect to a previously created place"),
1259 { 'T', "guest-talk", NULL, 1259 &op_host_reconnect),
1260 gettext_noop ("submit something to somebody's place"), 1260
1261 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_talk }, 1261 GNUNET_GETOPT_OPTION_SET_ONE ('P',
1262 1262 "host-announce",
1263 { 'U', "status", NULL, 1263 gettext_noop ("publish something to a place we are hosting"),
1264 gettext_noop ("list of egos and subscribed places"), 1264 &op_host_announce),
1265 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_status }, 1265
1266 1266 GNUNET_GETOPT_OPTION_SET_ONE ('R',
1267 { 'X', "replay", NULL, 1267 "guest-reconnect",
1268 gettext_noop ("extract and replay history between message IDs --start and --until"), 1268 gettext_noop ("reconnect to a previously entered place"),
1269 GNUNET_NO, &GNUNET_GETOPT_set_one, &op_replay }, 1269 &op_guest_reconnect),
1270
1271 GNUNET_GETOPT_OPTION_SET_ONE ('S',
1272 "look-at",
1273 gettext_noop ("search for state matching exact name"),
1274 &op_look_at),
1275
1276 GNUNET_GETOPT_OPTION_SET_ONE ('T',
1277 "guest-talk",
1278 gettext_noop ("submit something to somebody's place"),
1279 &op_guest_talk),
1280
1281 GNUNET_GETOPT_OPTION_SET_ONE ('U',
1282 "status",
1283 gettext_noop ("list of egos and subscribed places"),
1284 &op_status),
1285
1286 GNUNET_GETOPT_OPTION_SET_ONE ('X',
1287 "replay",
1288 gettext_noop ("extract and replay history between message IDs --start and --until"),
1289 &op_replay),
1270 1290
1271 1291
1272 /* options */ 1292 /* options */
1273 1293
1274 { 'a', "app", "APPLICATION_ID", 1294 GNUNET_GETOPT_OPTION_STRING ('a',
1275 gettext_noop ("application ID to use when connecting"), 1295 "app",
1276 GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_app }, 1296 "APPLICATION_ID",
1277 1297 gettext_noop ("application ID to use when connecting"),
1278 { 'd', "data", "DATA", 1298 &opt_app),
1279 gettext_noop ("message body or state value"), 1299
1280 GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_data }, 1300 GNUNET_GETOPT_OPTION_STRING ('d',
1281 1301 "data",
1282 { 'e', "ego", "NAME|PUBKEY", 1302 "DATA",
1283 gettext_noop ("name or public key of ego"), 1303 gettext_noop ("message body or state value"),
1284 GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_ego }, 1304 &opt_data),
1285 1305
1286 { 'f', "follow", NULL, 1306 GNUNET_GETOPT_OPTION_STRING ('e',
1287 gettext_noop ("wait for incoming messages"), 1307 "ego",
1288 GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_follow }, 1308 "NAME|PUBKEY",
1289 1309 gettext_noop ("name or public key of ego"),
1290 { 'g', "gns", "GNS_NAME", 1310 &opt_ego),
1291 gettext_noop ("GNS name"), 1311
1292 GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_gns }, 1312 GNUNET_GETOPT_OPTION_SET_ONE ('f',
1293 1313 "follow",
1294 { 'i', "peer", "PEER_ID", 1314 gettext_noop ("wait for incoming messages"),
1295 gettext_noop ("peer ID for --guest-enter"), 1315 &opt_follow),
1296 GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_peer }, 1316
1297 1317 GNUNET_GETOPT_OPTION_STRING ('g',
1298 { 'k', "name", "VAR_NAME", 1318 "gns",
1299 gettext_noop ("name (key) to query from state"), 1319 "GNS_NAME",
1300 GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_name }, 1320 gettext_noop ("GNS name"),
1301 1321 &opt_gns),
1302 { 'm', "method", "METHOD_NAME", 1322
1303 gettext_noop ("method name"), 1323 GNUNET_GETOPT_OPTION_STRING ('i',
1304 GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_method }, 1324 "peer",
1305 1325 "PEER_ID",
1306 { 'n', "limit", NULL, 1326 gettext_noop ("peer ID for --guest-enter"),
1307 gettext_noop ("number of messages to replay from history"), 1327 &opt_peer),
1308 GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_limit }, 1328
1309 1329 GNUNET_GETOPT_OPTION_STRING ('k',
1310 { 'p', "place", "PUBKEY", 1330 "name",
1311 gettext_noop ("key address of place"), 1331 "VAR_NAME",
1312 GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_place }, 1332 gettext_noop ("name (key) to query from state"),
1313 1333 &opt_name),
1314 { 's', "start", NULL, 1334
1315 gettext_noop ("start message ID for history replay"), 1335 GNUNET_GETOPT_OPTION_STRING ('m',
1316 GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_start }, 1336 "method",
1317 1337 "METHOD_NAME",
1318 { 'w', "welcome", NULL, 1338 gettext_noop ("method name"),
1319 gettext_noop ("respond to entry requests by admitting all guests"), 1339 &opt_method),
1320 GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_welcome }, 1340
1321 1341 GNUNET_GETOPT_OPTION_SET_ULONG ('n',
1322 { 'u', "until", NULL, 1342 "limit",
1323 gettext_noop ("end message ID for history replay"), 1343 NULL,
1324 GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_until }, 1344 gettext_noop ("number of messages to replay from history"),
1325 1345 &opt_limit),
1326 { 'y', "deny", NULL, 1346
1327 gettext_noop ("respond to entry requests by refusing all guests"), 1347 GNUNET_GETOPT_OPTION_STRING ('p',
1328 GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_deny }, 1348 "place",
1349 "PUBKEY",
1350 gettext_noop ("key address of place"),
1351 &opt_place),
1352
1353 GNUNET_GETOPT_OPTION_SET_ULONG ('s',
1354 "start",
1355 NULL,
1356 gettext_noop ("start message ID for history replay"),
1357 &opt_start),
1358
1359 GNUNET_GETOPT_OPTION_SET_ONE ('w',
1360 "welcome",
1361 gettext_noop ("respond to entry requests by admitting all guests"),
1362 &opt_welcome),
1363
1364 GNUNET_GETOPT_OPTION_SET_ULONG ('u',
1365 "until",
1366 NULL,
1367 gettext_noop ("end message ID for history replay"),
1368 &opt_until),
1369
1370 GNUNET_GETOPT_OPTION_SET_ONE ('y',
1371 "deny",
1372 gettext_noop ("respond to entry requests by refusing all guests"),
1373 &opt_deny),
1329 1374
1330 GNUNET_GETOPT_OPTION_END 1375 GNUNET_GETOPT_OPTION_END
1331 }; 1376 };