36 #define TIMEOUT_STATUS_CODE 40 137 if (NULL != create_op)
142 if (NULL != delete_op)
163 if ( (NULL == create_op) &&
164 (NULL == delete_op) &&
191 fprintf (stderr,
"%s\n",
gettext (emsg));
214 _ (
"Failed to create ego: %s\n"),
230 fprintf (stdout,
"%s - %s\n", pubs, privs);
235 fprintf (stdout,
"%s\n", pubs);
255 fprintf (stderr,
_ (
"Failed to set default ego: %s\n"), emsg);
299 const char *identifier)
308 (NULL != identifier) &&
309 (0 == strcmp (identifier,
set_ego)))
321 if ( (NULL == ego) &&
326 "Could not set ego to `%s' for subsystem `%s', ego not known\n",
334 if ((NULL == ego) && (!
monitor))
342 if ( (NULL == ego) ||
343 (NULL == identifier) )
346 (0 != strcmp (identifier,
353 if ((
monitor) || (NULL != identifier))
358 fprintf (stdout,
"%s - %s\n", s, privs);
360 fprintf (stdout,
"%s\n", s);
365 fprintf (stdout,
"%s - %s - %s - %s\n",
366 identifier, s, privs,
370 fprintf (stdout,
"%s - %s - %s\n",
398 fprintf (stderr,
"Option -s requires option -e to be specified as well.\n");
456 main (
int argc,
char *
const *argv)
473 "set the private key for the identity to PRIVATE_KEY (use together with -C)"),
478 "generate an EdDSA identity. (use together with -C) EXPERIMENTAL"),
493 "set default identity to NAME for a subsystem SUBSYSTEM (use together with -s) or restrict results to NAME (use together with -d)"),
508 "set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"),
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
static int global_ret
Value to return from main().
void GNUNET_IDENTITY_cancel(struct GNUNET_IDENTITY_Operation *op)
Cancel an identity operation.
static char * set_ego
-s option.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
static void shutdown_task(void *cls)
Task run on shutdown.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static void create_finished(void *cls, const struct GNUNET_IDENTITY_PrivateKey *pk, const char *emsg)
Creation operation finished.
uint32_t type
Type of public key.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_delete(struct GNUNET_IDENTITY_Handle *h, const char *name, GNUNET_IDENTITY_Continuation cb, void *cb_cls)
Delete an existing identity.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_verbose(unsigned int *level)
Define the '-V' verbosity option.
int GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
char * GNUNET_IDENTITY_public_key_to_string(const struct GNUNET_IDENTITY_PublicKey *key)
Creates a (Base32) string representation of the public key.
static void delete_finished(void *cls, const char *emsg)
Deletion operation finished.
static int private_keys
Was "private" specified?
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_set(struct GNUNET_IDENTITY_Handle *h, const char *service_name, struct GNUNET_IDENTITY_Ego *ego, GNUNET_IDENTITY_Continuation cont, void *cont_cls)
Set the preferred/default identity for a service.
A private key for an identity as per LSD0001.
static int monitor
Was "monitor" specified?
Definition of a command line option.
static struct GNUNET_IDENTITY_Operation * set_op
Operation handle for set operation.
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_IDENTITY_PublicKey *pk)
Get the identifier (public key) of an ego.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
static char * privkey_ego
-P option
Handle for an operation with the identity service.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
char * GNUNET_IDENTITY_private_key_to_string(const struct GNUNET_IDENTITY_PrivateKey *key)
Creates a (Base32) string representation of the private key.
static void test_finished(void)
Test if we are finished yet.
struct GNUNET_IDENTITY_Operation * GNUNET_IDENTITY_create(struct GNUNET_IDENTITY_Handle *h, const char *name, const struct GNUNET_IDENTITY_PrivateKey *privkey, enum GNUNET_IDENTITY_KeyType ktype, GNUNET_IDENTITY_CreateContinuation cont, void *cont_cls)
Create a new ego with the given name.
#define TIMEOUT_STATUS_CODE
Return value from main on timeout.
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
static struct GNUNET_IDENTITY_Handle * sh
Handle to IDENTITY service.
static void set_done(void *cls, const char *emsg)
Function called by GNUNET_IDENTITY_set up on completion.
#define GNUNET_free_nz(ptr)
Wrapper around free.
static char * set_subsystem
-S option.
static int quiet
Was "quiet" specified?
static struct GNUNET_IDENTITY_Operation * create_op
Handle for create operation.
int main(int argc, char *const *argv)
The main function.
static unsigned int verbose
Was "verbose" specified?
An identity key as per LSD0001.
struct GNUNET_IDENTITY_PrivateKey pk
Private key from command line option, or NULL.
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
void * cls
Closure for cont or cb.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
static int type_eddsa
Was "eddsa" specified?
static char * create_ego
-C option
static struct GNUNET_IDENTITY_Operation * delete_op
Handle for delete operation.
static struct GNUNET_ARM_Operation * op
Current operation.
static char * delete_ego
-D option
static int list
Was "list" specified?
int GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
#define GNUNET_free(ptr)
Wrapper around free.
static void print_ego(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier)
If listing is enabled, prints information about the egos.
#define gettext_noop(String)