-/**
- * Perform the actual resolution, starting with the zone
- * identified by the given public key and the shorten zone.
- *
- * @param pkey public key to use for the zone, can be NULL
- * @param shorten_key private key used for shortening, can be NULL
- */
-static void
-lookup_with_keys (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_key)
-{
- if (NULL != lookup_type)
- rtype = GNUNET_GNSRECORD_typename_to_number (lookup_type);
- else
- rtype = GNUNET_DNSPARSER_TYPE_A;
-
- if (NULL != lookup_name)
- {
- lookup_request = GNUNET_GNS_lookup (gns,
- lookup_name,
- pkey,
- rtype,
- GNUNET_NO, /* Use DHT */
- shorten_key,
- &process_lookup_result,
- lookup_name);
- }
- else
- {
- fprintf (stderr,
- _("Please specify name to lookup!\n"));
- GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
- return;
- }
-}
-
-
-/**
- * Method called to with the ego we are to use for shortening
- * during the lookup.
- *
- * @param cls closure contains the public key to use
- * @param ego ego handle, NULL if not found
- * @param ctx context for application to store data for this ego
- * (during the lifetime of this process, initially NULL)
- * @param name name assigned by the user for this ego,
- * NULL if the user just deleted the ego and it
- * must thus no longer be used
- */
-static void
-identity_shorten_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
-{
- struct GNUNET_CRYPTO_EcdsaPublicKey *pkeym = cls;
-
- id_op = NULL;
- if (NULL == ego)
- lookup_with_keys (pkeym, NULL);
- else
- lookup_with_keys (pkeym,
- GNUNET_IDENTITY_ego_get_private_key (ego));
- GNUNET_free (pkeym);
-}
-
-
-/**
- * Perform the actual resolution, starting with the zone
- * identified by the given public key.
- *
- * @param pkey public key to use for the zone
- */
-static void
-lookup_with_public_key (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
-{
- struct GNUNET_CRYPTO_EcdsaPublicKey *pkeym;
-
- GNUNET_assert (NULL != pkey);
- pkeym = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey);
- *pkeym = *pkey;
- id_op = GNUNET_IDENTITY_get (identity,
- "gns-short",
- &identity_shorten_cb,
- pkeym);
- if (NULL == id_op)
- {
- GNUNET_break (0);
- lookup_with_keys (pkey, NULL);
- }
-}
-
-
-/**
- * Method called to with the ego we are to use for the lookup,
- * when the ego is determined by a name.
- *
- * @param cls closure (NULL, unused)
- * @param ego ego handle, NULL if not found
- */
-static void
-identity_zone_cb (void *cls,
- const struct GNUNET_IDENTITY_Ego *ego)
-{
- struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
-
- el = NULL;
- if (NULL == ego)
- {
- fprintf (stderr,
- _("Ego for `%s' not found, cannot perform lookup.\n"),
- zone_ego_name);
- GNUNET_SCHEDULER_shutdown ();
- }
- else
- {
- GNUNET_IDENTITY_ego_get_public_key (ego, &pkey);
- lookup_with_public_key (&pkey);
- }
- GNUNET_free_non_null (zone_ego_name);
- zone_ego_name = NULL;
-}
-
-
-/**
- * Method called to with the ego we are to use for the lookup,
- * when the ego is the one for the default master zone.
- *
- * @param cls closure (NULL, unused)
- * @param ego ego handle, NULL if not found
- * @param ctx context for application to store data for this ego
- * (during the lifetime of this process, initially NULL)
- * @param name name assigned by the user for this ego,
- * NULL if the user just deleted the ego and it
- * must thus no longer be used
- */
-static void
-identity_master_cb (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
-{
- struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
-
- id_op = NULL;
- if (NULL == ego)
- {
- fprintf (stderr,
- _("Ego for `master-zone' not found, cannot perform lookup. Did you run gnunet-gns-import.sh?\n"));
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- GNUNET_IDENTITY_ego_get_public_key (ego, &pkey);
- lookup_with_public_key (&pkey);
-}
-
-