From: Marcello Stanisci Date: Thu, 16 Mar 2017 15:27:38 +0000 (+0100) Subject: porting social X-Git-Tag: gnunet-0.11.0rc0~280^2~3^2~14^2~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b92543a726e5f0df8c29788badae049923f3b35a;p=oweals%2Fgnunet.git porting social --- 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; /** * Should we try to decrypt a value after the key generation? */ -static unsigned int decrypt = GNUNET_NO; +static int decrypt = GNUNET_NO; /** * When would we like to see the operation finished? @@ -88,7 +88,7 @@ static unsigned int num_decrypted; static struct GNUNET_HashCode session_id; -static int verbose; +static unsigned int verbose; static struct GNUNET_SECRETSHARING_Plaintext reference_plaintext; @@ -602,26 +602,41 @@ run (void *cls, char *const *args, const char *cfgfile, int main (int argc, char **argv) { - static const struct GNUNET_GETOPT_CommandLineOption options[] = { - { 'n', "num-peers", NULL, - gettext_noop ("number of peers in consensus"), - GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_peers }, - { 'D', "delay", NULL, - gettext_noop ("dkg start delay"), - GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &delay }, - { 't', "timeout", NULL, - gettext_noop ("dkg timeout"), - GNUNET_YES, &GNUNET_GETOPT_set_relative_time, &timeout }, - { 'k', "threshold", NULL, - gettext_noop ("threshold"), - GNUNET_YES, &GNUNET_GETOPT_set_uint, &threshold }, - { 'd', "decrypt", NULL, - gettext_noop ("also profile decryption"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &decrypt }, - { 'V', "verbose", NULL, - gettext_noop ("be more verbose (print received values)"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &verbose }, - GNUNET_GETOPT_OPTION_END + struct GNUNET_GETOPT_CommandLineOption options[] = { + + GNUNET_GETOPT_OPTION_SET_UINT ('n', + "num-peers", + NULL, + gettext_noop ("number of peers in consensus"), + &num_peers), + + GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('D', + "delay", + NULL, + gettext_noop ("dkg start delay"), + &delay), + + GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', + "timeout", + NULL, + gettext_noop ("dkg timeout"), + &timeout), + + GNUNET_GETOPT_OPTION_SET_UINT ('k', + "threshold", + NULL, + gettext_noop ("threshold"), + &threshold), + + GNUNET_GETOPT_OPTION_SET_ONE ('d', + "descrypt", + gettext_noop ("also profile decryption"), + &decrypt), + + + GNUNET_GETOPT_OPTION_VERBOSE (&verbose), + + GNUNET_GETOPT_OPTION_END }; delay = GNUNET_TIME_UNIT_ZERO; 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 main (int argc, char *const *argv) { int res; - static const struct GNUNET_GETOPT_CommandLineOption options[] = { + struct GNUNET_GETOPT_CommandLineOption options[] = { /* * gnunet program options in addition to the ones below: * @@ -1212,120 +1212,165 @@ main (int argc, char *const *argv) /* operations */ - { 'A', "host-assign", NULL, - gettext_noop ("assign --name in state to --data"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_assign }, - - { 'B', "guest-leave", NULL, - gettext_noop ("say good-bye and leave somebody else's place"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_leave }, - - { 'C', "host-enter", NULL, - gettext_noop ("create a place"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_enter }, - - { 'D', "host-leave", NULL, - gettext_noop ("destroy a place we were hosting"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_leave }, - - { 'E', "guest-enter", NULL, - gettext_noop ("enter somebody else's place"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_enter }, - - { 'F', "look-for", NULL, - gettext_noop ("find state matching name prefix"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_look_for }, - - { 'H', "replay-latest", NULL, - gettext_noop ("replay history of messages up to the given --limit"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_replay_latest }, - - { 'N', "host-reconnect", NULL, - gettext_noop ("reconnect to a previously created place"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_reconnect }, - - { 'P', "host-announce", NULL, - gettext_noop ("publish something to a place we are hosting"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_host_announce }, - - { 'R', "guest-reconnect", NULL, - gettext_noop ("reconnect to a previously entered place"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_reconnect }, - - { 'S', "look-at", NULL, - gettext_noop ("search for state matching exact name"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_look_at }, - - { 'T', "guest-talk", NULL, - gettext_noop ("submit something to somebody's place"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_guest_talk }, - - { 'U', "status", NULL, - gettext_noop ("list of egos and subscribed places"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_status }, - - { 'X', "replay", NULL, - gettext_noop ("extract and replay history between message IDs --start and --until"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &op_replay }, + GNUNET_GETOPT_OPTION_SET_ONE ('A', + "host-assign", + gettext_noop ("assign --name in state to --data"), + &op_host_assign), + + GNUNET_GETOPT_OPTION_SET_ONE ('B', + "guest-leave", + gettext_noop ("say good-bye and leave somebody else's place"), + &op_guest_leave), + + GNUNET_GETOPT_OPTION_SET_ONE ('C', + "host-enter", + gettext_noop ("create a place"), + &op_host_enter), + + GNUNET_GETOPT_OPTION_SET_ONE ('C', + "host-enter", + gettext_noop ("create a place"), + &op_host_enter), + + GNUNET_GETOPT_OPTION_SET_ONE ('D', + "host-leave", + gettext_noop ("destroy a place we were hosting"), + &op_host_leave), + + GNUNET_GETOPT_OPTION_SET_ONE ('E', + "guest-enter", + gettext_noop ("enter somebody else's place"), + &op_guest_enter), + + + GNUNET_GETOPT_OPTION_SET_ONE ('F', + "look-for", + gettext_noop ("find state matching name prefix"), + &op_look_for), + + GNUNET_GETOPT_OPTION_SET_ONE ('H', + "replay-latest", + gettext_noop ("replay history of messages up to the given --limit"), + &op_replay_latest), + + GNUNET_GETOPT_OPTION_SET_ONE ('N', + "host-reconnect", + gettext_noop ("reconnect to a previously created place"), + &op_host_reconnect), + + GNUNET_GETOPT_OPTION_SET_ONE ('P', + "host-announce", + gettext_noop ("publish something to a place we are hosting"), + &op_host_announce), + + GNUNET_GETOPT_OPTION_SET_ONE ('R', + "guest-reconnect", + gettext_noop ("reconnect to a previously entered place"), + &op_guest_reconnect), + + GNUNET_GETOPT_OPTION_SET_ONE ('S', + "look-at", + gettext_noop ("search for state matching exact name"), + &op_look_at), + + GNUNET_GETOPT_OPTION_SET_ONE ('T', + "guest-talk", + gettext_noop ("submit something to somebody's place"), + &op_guest_talk), + + GNUNET_GETOPT_OPTION_SET_ONE ('U', + "status", + gettext_noop ("list of egos and subscribed places"), + &op_status), + + GNUNET_GETOPT_OPTION_SET_ONE ('X', + "replay", + gettext_noop ("extract and replay history between message IDs --start and --until"), + &op_replay), /* options */ - { 'a', "app", "APPLICATION_ID", - gettext_noop ("application ID to use when connecting"), - GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_app }, - - { 'd', "data", "DATA", - gettext_noop ("message body or state value"), - GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_data }, - - { 'e', "ego", "NAME|PUBKEY", - gettext_noop ("name or public key of ego"), - GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_ego }, - - { 'f', "follow", NULL, - gettext_noop ("wait for incoming messages"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_follow }, - - { 'g', "gns", "GNS_NAME", - gettext_noop ("GNS name"), - GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_gns }, - - { 'i', "peer", "PEER_ID", - gettext_noop ("peer ID for --guest-enter"), - GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_peer }, - - { 'k', "name", "VAR_NAME", - gettext_noop ("name (key) to query from state"), - GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_name }, - - { 'm', "method", "METHOD_NAME", - gettext_noop ("method name"), - GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_method }, - - { 'n', "limit", NULL, - gettext_noop ("number of messages to replay from history"), - GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_limit }, - - { 'p', "place", "PUBKEY", - gettext_noop ("key address of place"), - GNUNET_YES, &GNUNET_GETOPT_set_string, &opt_place }, - - { 's', "start", NULL, - gettext_noop ("start message ID for history replay"), - GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_start }, - - { 'w', "welcome", NULL, - gettext_noop ("respond to entry requests by admitting all guests"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_welcome }, - - { 'u', "until", NULL, - gettext_noop ("end message ID for history replay"), - GNUNET_YES, &GNUNET_GETOPT_set_ulong, &opt_until }, - - { 'y', "deny", NULL, - gettext_noop ("respond to entry requests by refusing all guests"), - GNUNET_NO, &GNUNET_GETOPT_set_one, &opt_deny }, + GNUNET_GETOPT_OPTION_STRING ('a', + "app", + "APPLICATION_ID", + gettext_noop ("application ID to use when connecting"), + &opt_app), + + GNUNET_GETOPT_OPTION_STRING ('d', + "data", + "DATA", + gettext_noop ("message body or state value"), + &opt_data), + + GNUNET_GETOPT_OPTION_STRING ('e', + "ego", + "NAME|PUBKEY", + gettext_noop ("name or public key of ego"), + &opt_ego), + + GNUNET_GETOPT_OPTION_SET_ONE ('f', + "follow", + gettext_noop ("wait for incoming messages"), + &opt_follow), + + GNUNET_GETOPT_OPTION_STRING ('g', + "gns", + "GNS_NAME", + gettext_noop ("GNS name"), + &opt_gns), + + GNUNET_GETOPT_OPTION_STRING ('i', + "peer", + "PEER_ID", + gettext_noop ("peer ID for --guest-enter"), + &opt_peer), + + GNUNET_GETOPT_OPTION_STRING ('k', + "name", + "VAR_NAME", + gettext_noop ("name (key) to query from state"), + &opt_name), + + GNUNET_GETOPT_OPTION_STRING ('m', + "method", + "METHOD_NAME", + gettext_noop ("method name"), + &opt_method), + + GNUNET_GETOPT_OPTION_SET_ULONG ('n', + "limit", + NULL, + gettext_noop ("number of messages to replay from history"), + &opt_limit), + + GNUNET_GETOPT_OPTION_STRING ('p', + "place", + "PUBKEY", + gettext_noop ("key address of place"), + &opt_place), + + GNUNET_GETOPT_OPTION_SET_ULONG ('s', + "start", + NULL, + gettext_noop ("start message ID for history replay"), + &opt_start), + + GNUNET_GETOPT_OPTION_SET_ONE ('w', + "welcome", + gettext_noop ("respond to entry requests by admitting all guests"), + &opt_welcome), + + GNUNET_GETOPT_OPTION_SET_ULONG ('u', + "until", + NULL, + gettext_noop ("end message ID for history replay"), + &opt_until), + + GNUNET_GETOPT_OPTION_SET_ONE ('y', + "deny", + gettext_noop ("respond to entry requests by refusing all guests"), + &opt_deny), GNUNET_GETOPT_OPTION_END };