*/
#include "platform.h"
#include "gnunet_fs_service.h"
+#include "gnunet_getopt_lib.h"
#include "fs_api.h"
/* ******************** command-line option parsing API ******************** */
* @param value command line argument given
* @return GNUNET_OK on success
*/
-int
-GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
- *ctx, void *scls, const char *option,
- const char *value)
+static int
+getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext
+ *ctx, void *scls, const char *option,
+ const char *value)
{
struct GNUNET_FS_Uri **uri = scls;
struct GNUNET_FS_Uri *u = *uri;
return GNUNET_OK;
}
+/**
+ * Allow user to specify keywords.
+ *
+ * @param shortName short name of the option
+ * @param name long name of the option
+ * @param argumentHelp help text for the option argument
+ * @param description long help text for the option
+ * @param[out] topKeywords set to the desired value
+ */
+struct GNUNET_GETOPT_CommandLineOption
+GNUNET_FS_GETOPT_KEYWORDS (char shortName,
+ const char *name,
+ const char *argumentHelp,
+ const char *description,
+ struct GNUNET_FS_Uri **topKeywords)
+{
+ struct GNUNET_GETOPT_CommandLineOption clo = {
+ .shortName = shortName,
+ .name = name,
+ .argumentHelp = argumentHelp,
+ .description = description,
+ .require_argument = 1,
+ .processor = &getopt_set_keywords,
+ .scls = (void *) topKeywords
+ };
+
+ return clo;
+}
/**
* Command-line option parser function that allows the user to specify
* @param value command line argument given
* @return #GNUNET_OK on success
*/
-int
-GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
- void *scls,
- const char *option,
- const char *value)
+static int
+getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
+ void *scls,
+ const char *option,
+ const char *value)
{
struct GNUNET_CONTAINER_MetaData **mm = scls;
#if HAVE_EXTRACTOR_H && HAVE_LIBEXTRACTOR
return GNUNET_OK;
}
+/**
+ * Allow user to specify metadata.
+ *
+ * @param shortName short name of the option
+ * @param name long name of the option
+ * @param argumentHelp help text for the option argument
+ * @param description long help text for the option
+ * @param[out] metadata set to the desired value
+ */
+struct GNUNET_GETOPT_CommandLineOption
+GNUNET_FS_GETOPT_METADATA (char shortName,
+ const char *name,
+ const char *argumentHelp,
+ const char *description,
+ struct GNUNET_CONTAINER_MetaData **meta)
+{
+ struct GNUNET_GETOPT_CommandLineOption clo = {
+ .shortName = shortName,
+ .name = name,
+ .argumentHelp = argumentHelp,
+ .description = description,
+ .require_argument = 1,
+ .processor = &getopt_set_metadata,
+ .scls = (void *) meta
+ };
+
+ return clo;
+}
+
+
+
+
/* end of fs_getopt.c */
/**
* Are we running 'verbosely'?
*/
-static int verbose;
+static unsigned int verbose;
/**
* Configuration to use.
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'a', "anonymity", "LEVEL",
- gettext_noop ("set the desired LEVEL of sender-anonymity"),
- 1, &GNUNET_GETOPT_set_uint, &anonymity_level},
- {'d', "disable-creation-time", NULL,
- gettext_noop
- ("disable adding the creation time to the metadata of the uploaded file"),
- 0, &GNUNET_GETOPT_set_one, &do_disable_creation_time},
- {'D', "disable-extractor", NULL,
- gettext_noop ("do not use libextractor to add keywords or metadata"),
- 0, &GNUNET_GETOPT_set_one, &disable_extractor},
- {'p', "priority", "PRIORITY",
- gettext_noop ("specify the priority of the content"),
- 1, &GNUNET_GETOPT_set_uint, &content_priority},
- {'r', "replication", "LEVEL",
- gettext_noop ("set the desired replication LEVEL"),
- 1, &GNUNET_GETOPT_set_uint, &replication_level},
- {'V', "verbose", NULL,
- gettext_noop ("be verbose (print progress information)"),
- 0, &GNUNET_GETOPT_set_one, &verbose},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('a',
+ "anonymity",
+ "LEVEL",
+ gettext_noop ("set the desired LEVEL of sender-anonymity"),
+ &anonymity_level),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('d',
+ "disable-creation-time",
+ gettext_noop ("disable adding the creation time to the metadata of the uploaded file"),
+ &do_disable_creation_time),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('D',
+ "disable-extractor",
+ gettext_noop ("do not use libextractor to add keywords or metadata"),
+ &disable_extractor),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('p',
+ "priority",
+ "PRIORITY",
+ gettext_noop ("specify the priority of the content"),
+ &content_priority),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('r',
+ "replication",
+ "LEVEL",
+ gettext_noop ("set the desired replication LEVEL"),
+ &replication_level),
+
+ GNUNET_GETOPT_OPTION_VERBOSE (&verbose),
+
GNUNET_GETOPT_OPTION_END
};
struct WorkItem *wi;
static int ret;
-static int verbose;
+static unsigned int verbose;
static int delete_incomplete;
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'a', "anonymity", "LEVEL",
- gettext_noop ("set the desired LEVEL of receiver-anonymity"),
- 1, &GNUNET_GETOPT_set_uint, &anonymity},
- {'D', "delete-incomplete", NULL,
- gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
- 0, &GNUNET_GETOPT_set_one, &delete_incomplete},
- {'n', "no-network", NULL,
- gettext_noop ("only search the local peer (no P2P network search)"),
- 0, &GNUNET_GETOPT_set_one, &local_only},
- {'o', "output", "FILENAME",
- gettext_noop ("write the file to FILENAME"),
- 1, &GNUNET_GETOPT_set_string, &filename},
- {'p', "parallelism", "DOWNLOADS",
- gettext_noop
- ("set the maximum number of parallel downloads that is allowed"),
- 1, &GNUNET_GETOPT_set_uint, ¶llelism},
- {'r', "request-parallelism", "REQUESTS",
- gettext_noop
- ("set the maximum number of parallel requests for blocks that is allowed"),
- 1, &GNUNET_GETOPT_set_uint, &request_parallelism},
- {'R', "recursive", NULL,
- gettext_noop ("download a GNUnet directory recursively"),
- 0, &GNUNET_GETOPT_set_one, &do_recursive},
- {'V', "verbose", NULL,
- gettext_noop ("be verbose (print progress information)"),
- 0, &GNUNET_GETOPT_increment_value, &verbose},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_SET_UINT ('a',
+ "anonymity",
+ "LEVEL",
+ gettext_noop ("set the desired LEVEL of receiver-anonymity"),
+ &anonymity),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('D',
+ "delete-incomplete",
+ gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
+ &delete_incomplete),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('n',
+ "no-network",
+ gettext_noop ("only search the local peer (no P2P network search)"),
+ &local_only),
+
+ GNUNET_GETOPT_OPTION_STRING ('o',
+ "output",
+ "FILENAME",
+ gettext_noop ("write the file to FILENAME"),
+ &filename),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('p',
+ "parallelism",
+ "DOWNLOADS",
+ gettext_noop ("set the maximum number of parallel downloads that is allowed"),
+ ¶llelism),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('r',
+ "request-parallelism",
+ "REQUESTS",
+ gettext_noop ("set the maximum number of parallel requests for blocks that is allowed"),
+ &request_parallelism),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('R',
+ "recursive",
+ gettext_noop ("download a GNUnet directory recursively"),
+ &do_recursive),
+
+ GNUNET_GETOPT_OPTION_INCREMENT_VALUE ('V',
+ "verbose",
+ gettext_noop ("be verbose (print progress information)"),
+ &verbose),
+
GNUNET_GETOPT_OPTION_END
};
/**
* Command line option 'verbose' set
*/
-static int verbose;
+static unsigned int verbose;
/**
* Handle to our configuration.
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'a', "anonymity", "LEVEL",
- gettext_noop ("set the desired LEVEL of sender-anonymity"),
- 1, &GNUNET_GETOPT_set_uint, &bo.anonymity_level},
- {'d', "disable-creation-time", NULL,
- gettext_noop
- ("disable adding the creation time to the metadata of the uploaded file"),
- 0, &GNUNET_GETOPT_set_one, &do_disable_creation_time},
- {'D', "disable-extractor", NULL,
- gettext_noop ("do not use libextractor to add keywords or metadata"),
- 0, &GNUNET_GETOPT_set_one, &disable_extractor},
- {'e', "extract", NULL,
- gettext_noop
- ("print list of extracted keywords that would be used, but do not perform upload"),
- 0, &GNUNET_GETOPT_set_one, &extract_only},
- {'k', "key", "KEYWORD",
- gettext_noop
- ("add an additional keyword for the top-level file or directory"
- " (this option can be specified multiple times)"),
- 1, &GNUNET_FS_getopt_set_keywords, &topKeywords},
- {'m', "meta", "TYPE:VALUE",
- gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
- 1, &GNUNET_FS_getopt_set_metadata, &meta},
- {'n', "noindex", NULL,
- gettext_noop ("do not index, perform full insertion (stores entire "
- "file in encrypted form in GNUnet database)"),
- 0, &GNUNET_GETOPT_set_one, &do_insert},
- {'N', "next", "ID",
- gettext_noop
- ("specify ID of an updated version to be published in the future"
- " (for namespace insertions only)"),
- 1, &GNUNET_GETOPT_set_string, &next_id},
- {'p', "priority", "PRIORITY",
- gettext_noop ("specify the priority of the content"),
- 1, &GNUNET_GETOPT_set_uint, &bo.content_priority},
- {'P', "pseudonym", "NAME",
- gettext_noop
- ("publish the files under the pseudonym NAME (place file into namespace)"),
- 1, &GNUNET_GETOPT_set_string, &pseudonym},
- {'r', "replication", "LEVEL",
- gettext_noop ("set the desired replication LEVEL"),
- 1, &GNUNET_GETOPT_set_uint, &bo.replication_level},
- {'s', "simulate-only", NULL,
- gettext_noop ("only simulate the process but do not do any "
- "actual publishing (useful to compute URIs)"),
- 0, &GNUNET_GETOPT_set_one, &do_simulate},
- {'t', "this", "ID",
- gettext_noop ("set the ID of this version of the publication"
- " (for namespace insertions only)"),
- 1, &GNUNET_GETOPT_set_string, &this_id},
- {'u', "uri", "URI",
- gettext_noop ("URI to be published (can be used instead of passing a "
- "file to add keywords to the file with the respective URI)"),
- 1, &GNUNET_GETOPT_set_string, &uri_string},
- {'V', "verbose", NULL,
- gettext_noop ("be verbose (print progress information)"),
- 0, &GNUNET_GETOPT_set_one, &verbose},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_SET_UINT ('a',
+ "anonymity",
+ "LEVEL",
+ gettext_noop ("set the desired LEVEL of sender-anonymity"),
+ &bo.anonymity_level),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('d',
+ "disable-creation-time",
+ gettext_noop ("disable adding the creation time to the "
+ "metadata of the uploaded file"),
+ &do_disable_creation_time),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('D',
+ "disable-extractor",
+ gettext_noop ("do not use libextractor to add keywords or metadata"),
+ &disable_extractor),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('e',
+ "extract",
+ gettext_noop ("print list of extracted keywords that would "
+ "be used, but do not perform upload"),
+ &extract_only),
+
+ GNUNET_FS_GETOPT_KEYWORDS ('k',
+ "key",
+ "KEYWORD",
+ gettext_noop ("add an additional keyword for the top-level "
+ "file or directory (this option can be specified multiple times)"),
+ &topKeywords),
+
+ GNUNET_FS_GETOPT_METADATA ('m',
+ "meta",
+ "TYPE:VALUE",
+ gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
+ &meta),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('n',
+ "noindex",
+ gettext_noop ("do not index, perform full insertion (stores "
+ "entire file in encrypted form in GNUnet database)"),
+ &do_insert),
+
+ GNUNET_GETOPT_OPTION_STRING ('N',
+ "next",
+ "ID",
+ gettext_noop ("specify ID of an updated version to be "
+ "published in the future (for namespace insertions only)"),
+ &next_id),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('p',
+ "priority",
+ "PRIORITY",
+ gettext_noop ("specify the priority of the content"),
+ &bo.content_priority),
+
+ GNUNET_GETOPT_OPTION_STRING ('P',
+ "pseudonym",
+ "NAME",
+ gettext_noop ("publish the files under the pseudonym "
+ "NAME (place file into namespace)"),
+ &pseudonym),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('r',
+ "replication",
+ "LEVEL",
+ gettext_noop ("set the desired replication LEVEL"),
+ &bo.replication_level),
+
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('s',
+ "simulate-only",
+ gettext_noop ("only simulate the process but do not do "
+ "any actual publishing (useful to compute URIs)"),
+ &do_simulate),
+
+ GNUNET_GETOPT_OPTION_STRING ('t',
+ "this",
+ "ID",
+ gettext_noop ("set the ID of this version of the publication "
+ "(for namespace insertions only)"),
+ &this_id),
+
+ GNUNET_GETOPT_OPTION_STRING ('u',
+ "uri",
+ "URI",
+ gettext_noop ("URI to be published (can be used instead of passing a "
+ "file to add keywords to the file with the respective URI)"),
+ &uri_string),
+
+ GNUNET_GETOPT_OPTION_VERBOSE (&verbose),
+
GNUNET_GETOPT_OPTION_END
};
bo.expiration_time =
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'p', "port", "PORT",
- gettext_noop ("Run HTTP serve on port PORT (default is 8888)"), 1,
- &GNUNET_GETOPT_set_uint, &port},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('p',
+ "port",
+ "PORT",
+ gettext_noop ("Run HTTP serve on port PORT (default is 8888)"),
+ &port),
+
GNUNET_GETOPT_OPTION_END
};
int ret;
main (int argc,
char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'d', "dns", "IP",
- gettext_noop ("IP of recursive DNS resolver to use (required)"), 1,
- &GNUNET_GETOPT_set_string, &dns_ip},
- {'f', "fcfs", "NAME",
- gettext_noop ("Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu"), 1,
- &GNUNET_GETOPT_set_string, &fcfs_suffix},
- {'s', "suffix", "SUFFIX",
- gettext_noop ("Authoritative DNS suffix to use (optional); default: zkey.eu"), 1,
- &GNUNET_GETOPT_set_string, &dns_suffix},
- {'p', "port", "UDPPORT",
- gettext_noop ("UDP port to listen on for inbound DNS requests; default: 2853"), 1,
- &GNUNET_GETOPT_set_uint, &listen_port},
- {'z', "zone", "PUBLICKEY",
- gettext_noop ("Public key of the GNS zone to use (overrides default)"), 1,
- &GNUNET_GETOPT_set_string, &gns_zone_str},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_STRING ('d',
+ "dns",
+ "IP",
+ gettext_noop ("IP of recursive DNS resolver to use (required)"),
+ &dns_ip),
+
+ GNUNET_GETOPT_OPTION_STRING ('f',
+ "fcfs",
+ "NAME",
+ gettext_noop ("Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu"),
+ &fcfs_suffix),
+
+ GNUNET_GETOPT_OPTION_STRING ('s',
+ "suffix",
+ "SUFFIX",
+ gettext_noop ("Authoritative DNS suffix to use (optional); default: zkey.eu"),
+ &dns_suffix),
+
+ GNUNET_GETOPT_OPTION_SET_UINT ('p',
+ "port",
+ "UDPPORT",
+ gettext_noop ("UDP port to listen on for inbound DNS requests; default: 2853"),
+ &listen_port),
+
+ GNUNET_GETOPT_OPTION_STRING ('z',
+ "zone",
+ "PUBLICKEY",
+ gettext_noop ("Public key of the GNS zone to use (overrides default)"),
+ &gns_zone_str),
+
GNUNET_GETOPT_OPTION_END
};
int ret;
/**
* The port the proxy is running on (default 7777)
*/
-static unsigned long port = GNUNET_GNS_PROXY_PORT;
+static unsigned long long port = GNUNET_GNS_PROXY_PORT;
/**
* The CA file (pem) to use for the proxy CA
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Proxy listens on port %lu\n",
+ "Proxy listens on port %llu\n",
port);
/* start MHD daemon for HTTP */
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'p', "port", NULL,
- gettext_noop ("listen on specified port (default: 7777)"), 1,
- &GNUNET_GETOPT_set_ulong, &port},
- {'a', "authority", NULL,
- gettext_noop ("pem file to use as CA"), 1,
- &GNUNET_GETOPT_set_string, &cafile_opt},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_SET_ULONG ('p',
+ "port",
+ NULL,
+ gettext_noop ("listen on specified port (default: 7777)"),
+ &port),
+
+ GNUNET_GETOPT_OPTION_STRING ('a',
+ "authority",
+ NULL,
+ gettext_noop ("pem file to use as CA"),
+ &cafile_opt),
+
GNUNET_GETOPT_OPTION_END
};
static const char* page =
main (int argc,
char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'u', "lookup", "NAME",
- gettext_noop ("Lookup a record for the given name"), 1,
- &GNUNET_GETOPT_set_string, &lookup_name},
- {'t', "type", "TYPE",
- gettext_noop ("Specify the type of the record to lookup"), 1,
- &GNUNET_GETOPT_set_string, &lookup_type},
- { 'T', "timeout", "DELAY",
- gettext_noop ("Specify timeout for the lookup"), 1,
- &GNUNET_GETOPT_set_relative_time, &timeout },
- {'r', "raw", NULL,
- gettext_noop ("No unneeded output"), 0,
- &GNUNET_GETOPT_set_one, &raw},
- {'p', "public-key", "PKEY",
- gettext_noop ("Specify the public key of the zone to lookup the record in"), 1,
- &GNUNET_GETOPT_set_string, &public_key},
- {'z', "zone", "NAME",
- gettext_noop ("Specify the name of the ego of the zone to lookup the record in"), 1,
- &GNUNET_GETOPT_set_string, &zone_ego_name},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_STRING ('u',
+ "lookup",
+ "NAME",
+ gettext_noop ("Lookup a record for the given name"),
+ &lookup_name),
+
+ GNUNET_GETOPT_OPTION_STRING ('t',
+ "type",
+ "TYPE",
+ gettext_noop ("Specify the type of the record to lookup"),
+ &lookup_type),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T',
+ "timeout",
+ "DELAY",
+ gettext_noop ("Specify timeout for the lookup"),
+ &timeout),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('r',
+ "raw",
+ gettext_noop ("No unneeded output"),
+ &raw),
+
+ GNUNET_GETOPT_OPTION_STRING ('p',
+ "public-key",
+ "PKEY",
+ gettext_noop ("Specify the public key of the zone to lookup the record in"),
+ &public_key),
+
+ GNUNET_GETOPT_OPTION_STRING ('z',
+ "zone",
+ "NAME",
+ gettext_noop ("Specify the name of the ego of the zone to lookup the record in"),
+ &zone_ego_name),
+
GNUNET_GETOPT_OPTION_END
};
int ret;
/* ******************** command-line option parsing API *********************** */
/**
- * Command-line option parser function that allows the user
- * to specify one or more '-k' options with keywords. Each
- * specified keyword will be added to the URI. A pointer to
- * the URI must be passed as the "scls" argument.
- *
- * @param ctx command line processor context
- * @param scls must be of type "struct GNUNET_FS_Uri **"
- * @param option name of the option (typically 'k')
- * @param value command line argument given
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx,
- void *scls,
- const char *option,
- const char *value);
-
+ * Allow user to specify keywords.
+ *
+ * @param shortName short name of the option
+ * @param name long name of the option
+ * @param argumentHelp help text for the option argument
+ * @param description long help text for the option
+ * @param[out] topKeywords set to the desired value
+ */
+struct GNUNET_GETOPT_CommandLineOption
+GNUNET_FS_GETOPT_KEYWORDS (char shortName,
+ const char *name,
+ const char *argumentHelp,
+ const char *description,
+ struct GNUNET_FS_Uri **topKeywords);
+
+/**
+ * Allow user to specify metadata.
+ *
+ * @param shortName short name of the option
+ * @param name long name of the option
+ * @param argumentHelp help text for the option argument
+ * @param description long help text for the option
+ * @param[out] metadata set to the desired value
+ */
+struct GNUNET_GETOPT_CommandLineOption
+GNUNET_FS_GETOPT_METADATA (char shortName,
+ const char *name,
+ const char *argumentHelp,
+ const char *description,
+ struct GNUNET_CONTAINER_MetaData **meta);
/**
* Command-line option parser function that allows the user to specify
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'f', "filename", "NAME",
- gettext_noop ("use NAME for the name of the revocation file"),
- 1, &GNUNET_GETOPT_set_string, &filename},
- {'R', "revoke", "NAME",
- gettext_noop ("revoke the private key associated for the the private key associated with the ego NAME "),
- 1, &GNUNET_GETOPT_set_string, &revoke_ego},
- {'p', "perform", NULL,
- gettext_noop ("actually perform revocation, otherwise we just do the precomputation"),
- 0, &GNUNET_GETOPT_set_one, &perform},
- {'t', "test", "KEY",
- gettext_noop ("test if the public key KEY has been revoked"),
- 1, &GNUNET_GETOPT_set_string, &test_ego},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+
+ GNUNET_GETOPT_OPTION_STRING ('f',
+ "filename",
+ "NAME",
+ gettext_noop ("use NAME for the name of the revocation file"),
+ &filename),
+
+ GNUNET_GETOPT_OPTION_STRING ('R',
+ "revoke",
+ "NAME",
+ gettext_noop ("revoke the private key associated for the the private key associated with the ego NAME "),
+ &revoke_ego),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('p',
+ "perform",
+ gettext_noop ("actually perform revocation, otherwise we just do the precomputation"),
+ &perform),
+
+ GNUNET_GETOPT_OPTION_STRING ('t',
+ "test",
+ "KEY",
+ gettext_noop ("test if the public key KEY has been revoked"),
+ &test_ego),
+
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_STRING ('e',
"elements",
gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."),
&input_elements),
- {'e', "elements", "\"key1,val1;key2,val2;...,keyn,valn;\"",
- gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."),
- 1, &GNUNET_GETOPT_set_string, &input_elements},
- {'p', "peer", "PEERID",
- gettext_noop ("[Optional] peer to calculate our scalarproduct with. If this parameter is not given, the service will wait for a remote peer to compute the request."),
- 1, &GNUNET_GETOPT_set_string, &input_peer_id},
- {'k', "key", "TRANSACTION_ID",
- gettext_noop ("Transaction ID shared with peer."),
- 1, &GNUNET_GETOPT_set_string, &input_session_key},
+ GNUNET_GETOPT_OPTION_STRING ('e',
+ "elements",
+ "\"key1,val1;key2,val2;...,keyn,valn;\"",
+ gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."),
+ &input_elements),
+
+ GNUNET_GETOPT_OPTION_STRING ('p',
+ "peer",
+ "PEERID",
+ gettext_noop ("[Optional] peer to calculate our scalarproduct with. If this parameter is not given, the service will wait for a remote peer to compute the request."),
+ &input_peer_id),
+
+ GNUNET_GETOPT_OPTION_STRING ('k',
+ "key",
+ "TRANSACTION_ID",
+ gettext_noop ("Transaction ID shared with peer."),
+ &input_session_key),
+
GNUNET_GETOPT_OPTION_END
};
/**
* Selected level of verbosity.
*/
-static int verbosity;
+static unsigned int verbosity;
/**
* Global return value.
int
main (int argc, char *const *argv)
{
- static const struct GNUNET_GETOPT_CommandLineOption options[] = {
- {'4', "ipv4", NULL,
- gettext_noop ("request that result should be an IPv4 address"),
- 0, &GNUNET_GETOPT_set_one, &ipv4},
- {'6', "ipv6", NULL,
- gettext_noop ("request that result should be an IPv6 address"),
- 0, &GNUNET_GETOPT_set_one, &ipv6},
- {'d', "duration", "TIME",
- gettext_noop ("how long should the mapping be valid for new tunnels?"),
- 1, &GNUNET_GETOPT_set_relative_time, &duration},
- {'i', "ip", "IP",
- gettext_noop ("destination IP for the tunnel"),
- 1, &GNUNET_GETOPT_set_string, &target_ip},
- {'p', "peer", "PEERID",
- gettext_noop ("peer offering the service we would like to access"),
- 1, &GNUNET_GETOPT_set_string, &peer_id},
- {'s', "service", "NAME",
- gettext_noop ("name of the service we would like to access"),
- 1, &GNUNET_GETOPT_set_string, &service_name},
- {'t', "tcp", NULL,
- gettext_noop ("service is offered via TCP"),
- 0, &GNUNET_GETOPT_set_one, &tcp},
- {'u', "udp", NULL,
- gettext_noop ("service is offered via UDP"),
- 0, &GNUNET_GETOPT_set_one, &udp},
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_SET_ONE ('4',
+ "ipv4",
+ gettext_noop ("request that result should be an IPv4 address"),
+ &ipv4),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('6',
+ "ipv6",
+ gettext_noop ("request that result should be an IPv6 address"),
+ &ipv6),
+
+ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('d',
+ "duration",
+ "TIME",
+ gettext_noop ("how long should the mapping be valid for new tunnels?"),
+ &duration),
+
+ GNUNET_GETOPT_OPTION_STRING ('i',
+ "ip",
+ "IP",
+ gettext_noop ("destination IP for the tunnel"),
+ &target_ip),
+
+ GNUNET_GETOPT_OPTION_STRING ('p',
+ "peer",
+ "PEERID",
+ gettext_noop ("peer offering the service we would like to access"),
+ &peer_id),
+
+ GNUNET_GETOPT_OPTION_STRING ('s',
+ "service",
+ "NAME",
+ gettext_noop ("name of the service we would like to access"),
+ &service_name),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('t',
+ "tcp",
+ gettext_noop ("service is offered via TCP"),
+ &tcp),
+
+ GNUNET_GETOPT_OPTION_SET_ONE ('u',
+ "udp",
+ gettext_noop ("service is offered via UDP"),
+ &udp),
GNUNET_GETOPT_OPTION_VERBOSE (&verbosity),
+
GNUNET_GETOPT_OPTION_END
};
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))