/* This file is part of GNUnet. Copyright (C) 2012, 2013, 2014 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.*//** * @file gnunet-namestore.c * @brief command line tool to manipulate the local zone * @author Christian Grothoff * * TODO: * - test */#include"platform.h"#include<gnunet_util_lib.h>#include<gnunet_dnsparser_lib.h>#include<gnunet_identity_service.h>#include<gnunet_gnsrecord_lib.h>#include<gnunet_gns_service.h>#include<gnunet_namestore_service.h>/** * Handle to the namestore. */staticstructGNUNET_NAMESTORE_Handle*ns;/** * Private key for the our zone. */staticstructGNUNET_CRYPTO_EcdsaPrivateKeyzone_pkey;/** * Handle to identity lookup. */staticstructGNUNET_IDENTITY_EgoLookup*el;/** * Identity service handle */staticstructGNUNET_IDENTITY_Handle*idh;/** * Obtain default ego */structGNUNET_IDENTITY_Operation*get_default;/** * Name of the ego controlling the zone. */staticchar*ego_name;/** * Desired action is to add a record. */staticintadd;/** * Queue entry for the 'add-uri' operation. */staticstructGNUNET_NAMESTORE_QueueEntry*add_qe_uri;/** * Queue entry for the 'add' operation. */staticstructGNUNET_NAMESTORE_QueueEntry*add_qe;/** * Queue entry for the 'lookup' operation. */staticstructGNUNET_NAMESTORE_QueueEntry*get_qe;/** * Queue entry for the 'reverse lookup' operation (in combination with a name). */staticstructGNUNET_NAMESTORE_QueueEntry*reverse_qe;/** * Desired action is to list records. */staticintlist;/** * List iterator for the 'list' operation. */staticstructGNUNET_NAMESTORE_ZoneIterator*list_it;/** * Desired action is to remove a record. */staticintdel;/** * Is record public (opposite of #GNUNET_GNSRECORD_RF_PRIVATE) */staticintis_public;/** * Is record a shadow record (#GNUNET_GNSRECORD_RF_SHADOW_RECORD) */staticintis_shadow;/** * Queue entry for the 'del' operation. */staticstructGNUNET_NAMESTORE_QueueEntry*del_qe;/** * Name of the records to add/list/remove. */staticchar*name;/** * Value of the record to add/remove. */staticchar*value;/** * URI to import. */staticchar*uri;/** * Reverse lookup to perform. */staticchar*reverse_pkey;/** * Type of the record to add/remove, NULL to remove all. */staticchar*typestring;/** * Desired expiration time. */staticchar*expirationstring;/** * Desired nick name. */staticchar*nickstring;/** * Global return value */static