command line tool to manipulate the local zone More...
#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_identity_service.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_gns_service.h>
#include <gnunet_namestore_service.h>
#include <inttypes.h>
Go to the source code of this file.
Data Structures | |
struct | RecordSetEntry |
Entry in record set for bulk processing. More... | |
struct | MarkedRecord |
The record marked for deletion. More... | |
struct | EgoEntry |
The ego list. More... | |
Macros | |
#define | WARN_RELATIVE_EXPIRATION_LIMIT |
The upper bound for the zone iteration interval (per record). More... | |
#define | MAX_LINE_LEN 4086 |
#define | MAX_ARGS 20 |
Functions | |
static int | parse_expiration (const char *expirationstring, int *etime_is_rel, uint64_t *etime) |
Parse expiration time. More... | |
static int | parse_recordline (const char *line) |
static void | reset_handles (void) |
static void | do_shutdown (void *cls) |
Task run on shutdown. More... | |
static void | commit_cb (void *cls, enum GNUNET_ErrorCode ec) |
static void | process_command_stdin () |
static void | finish_command (void) |
static void | add_continuation (void *cls, enum GNUNET_ErrorCode ec) |
static void | del_continuation (void *cls, enum GNUNET_ErrorCode ec) |
static void | purge_next_record (void *cls) |
static void | marked_deleted (void *cls, enum GNUNET_ErrorCode ec) |
static void | zone_iteration_finished (void *cls) |
Function called when we are done with a zone iteration. More... | |
static void | zone_iteration_error_cb (void *cls) |
Function called when we encountered an error in a zone iteration. More... | |
static void | collect_zone_records_to_purge (const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd) |
static void | collect_orphans (const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd) |
static void | display_record (const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd) |
Process a record that was stored in the namestore. More... | |
static void | purge_zone_iterator (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expiry) |
static void | purge_orphans_iterator (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expiry) |
static void | display_record_iterator (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expiry) |
Process a record that was stored in the namestore. More... | |
static void | display_record_monitor (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd, struct GNUNET_TIME_Absolute expiry) |
Process a record that was stored in the namestore. More... | |
static void | display_record_lookup (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rname, unsigned int rd_len, const struct GNUNET_GNSRECORD_Data *rd) |
Process a record that was stored in the namestore. More... | |
static void | sync_cb (void *cls) |
Function called once we are in sync in monitor mode. More... | |
static void | monitor_error_cb (void *cls) |
Function called on errors while monitoring. More... | |
static void | lookup_error_cb (void *cls) |
Function called on errors while monitoring. More... | |
static void | add_error_cb (void *cls) |
Function called if lookup fails. More... | |
static void | get_existing_record (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone_key, const char *rec_name, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
We're storing a record; this function is given the existing record so that we can merge the information. More... | |
static void | reverse_error_cb (void *cls) |
Function called if we encountered an error in zone-to-name. More... | |
static void | handle_reverse_lookup (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
Function called with the result of our attempt to obtain a name for a given public key. More... | |
static void | del_lookup_error_cb (void *cls) |
Function called if lookup for deletion fails. More... | |
static void | del_monitor (void *cls, const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd) |
We were asked to delete something; this function is called with the existing records. More... | |
static void | replace_cont (void *cls, enum GNUNET_ErrorCode ec) |
static void | run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg) |
We have obtained the zone's private key, so now process the main commands using it. More... | |
static int | get_identity_for_string (const char *str, struct GNUNET_IDENTITY_PrivateKey *zk) |
static void | begin_cb (void *cls, enum GNUNET_ErrorCode ec) |
static void | id_connect_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name) |
Function called with ALL of the egos known to the identity service, used on startup if the user did not specify a zone on the command-line. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *_cfg) |
Main function that will be run. More... | |
int | main (int argc, char *const *argv) |
The main function for gnunet-namestore. More... | |
Variables | |
static struct GNUNET_NAMESTORE_Handle * | ns |
Handle to the namestore. More... | |
static struct GNUNET_IDENTITY_PrivateKey | zone_pkey |
Private key for the our zone. More... | |
static struct GNUNET_IDENTITY_Handle * | idh |
Identity service handle. More... | |
static char * | ego_name |
Name of the ego controlling the zone. More... | |
static struct GNUNET_NAMESTORE_QueueEntry * | add_qe_uri |
Queue entry for the 'add-uri' operation. More... | |
static struct GNUNET_NAMESTORE_QueueEntry * | add_qe |
Queue entry for the 'add' operation. More... | |
static struct GNUNET_NAMESTORE_QueueEntry * | get_qe |
Queue entry for the 'lookup' operation. More... | |
static struct GNUNET_NAMESTORE_QueueEntry * | reverse_qe |
Queue entry for the 'reverse lookup' operation (in combination with a name). More... | |
static struct MarkedRecord * | marked_head |
Marked record list. More... | |
static struct MarkedRecord * | marked_tail |
Marked record list. More... | |
const struct GNUNET_CONFIGURATION_Handle * | cfg |
Configuration handle. More... | |
static struct EgoEntry * | ego_head |
Ego list. More... | |
static struct EgoEntry * | ego_tail |
Ego list. More... | |
static struct GNUNET_NAMESTORE_ZoneIterator * | list_it |
List iterator for the 'list' operation. More... | |
static int | read_from_stdin |
Run in read from stdin mode. More... | |
static int | list |
Desired action is to list records. More... | |
static int | add |
Desired action is to add a record. More... | |
static int | del |
Desired action is to remove a record. More... | |
static int | is_public |
Is record public (opposite of GNUNET_GNSRECORD_RF_PRIVATE) More... | |
static int | is_shadow |
Is record a shadow record (GNUNET_GNSRECORD_RF_SHADOW) More... | |
static int | omit_private |
Filter private records. More... | |
static int | output_recordline |
Output in recordline format. More... | |
static int | purge_zone |
Purge zone contents. More... | |
static int | include_maintenance |
Do not filter maintenance records. More... | |
static int | purge_orphaned |
Purge orphaned records. More... | |
static int | list_orphaned |
List records and zone keys of orphaned records. More... | |
static struct GNUNET_NAMESTORE_QueueEntry * | del_qe |
Queue entry for the 'del' operation. More... | |
static struct GNUNET_NAMESTORE_QueueEntry * | set_qe |
Queue entry for the 'set/replace' operation. More... | |
static struct GNUNET_NAMESTORE_QueueEntry * | ns_qe |
Queue entry for begin/commit. More... | |
static char * | name |
Name of the records to add/list/remove. More... | |
static char * | value |
Value of the record to add/remove. More... | |
static char * | uri |
URI to import. More... | |
static char * | reverse_pkey |
Reverse lookup to perform. More... | |
static char * | typestring |
Type of the record to add/remove, NULL to remove all. More... | |
static char * | expirationstring |
Desired expiration time. More... | |
static char * | nickstring |
Desired nick name. More... | |
static int | ret |
Global return value. More... | |
static uint32_t | type |
Type string converted to DNS type value. More... | |
static void * | data |
Value in binary format. More... | |
static size_t | data_size |
Number of bytes in data. More... | |
static uint64_t | etime |
Expiration string converted to numeric value. More... | |
static int | etime_is_rel = GNUNET_SYSERR |
Is expiration time relative or absolute time? More... | |
static struct GNUNET_NAMESTORE_ZoneMonitor * | zm |
Monitor handle. More... | |
static int | monitor |
Enables monitor mode. More... | |
static struct RecordSetEntry * | recordset |
Entry in record set for processing records in bulk. More... | |
static struct GNUNET_SCHEDULER_Task * | purge_task |
Purge task. More... | |
#define WARN_RELATIVE_EXPIRATION_LIMIT |
The upper bound for the zone iteration interval (per record).
Definition at line 40 of file gnunet-namestore.c.
#define MAX_LINE_LEN 4086 |
Definition at line 1734 of file gnunet-namestore.c.
#define MAX_ARGS 20 |
Definition at line 1736 of file gnunet-namestore.c.
|
static |
Parse expiration time.
expirationstring | text to parse | |
[out] | etime_is_rel | set to GNUNET_YES if time is relative |
[out] | etime | set to expiration time (abs or rel) |
Definition at line 351 of file gnunet-namestore.c.
References GNUNET_TIME_Absolute::abs_value_us, etime, etime_is_rel, expirationstring, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_absolute_time_to_string(), GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_SYSERR, GNUNET_TIME_relative_cmp, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_YES, GNUNET_TIME_Relative::rel_value_us, and WARN_RELATIVE_EXPIRATION_LIMIT.
Referenced by run_with_zone_pkey().
|
static |
Definition at line 396 of file gnunet-namestore.c.
References _, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_RF_CRITICAL, GNUNET_GNSRECORD_RF_NONE, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW, GNUNET_GNSRECORD_RF_SUPPLEMENTAL, GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_typename_to_number(), GNUNET_log, GNUNET_malloc, GNUNET_OK, GNUNET_strdup, GNUNET_SYSERR, head, line, RecordSetEntry::next, record(), RecordSetEntry::record, and recordset.
Referenced by process_command_stdin().
|
static |
Definition at line 483 of file gnunet-namestore.c.
References add_qe, add_qe_uri, data, del_qe, ego_name, expirationstring, get_qe, GNUNET_free, GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_zone_iteration_stop(), GNUNET_NAMESTORE_zone_monitor_stop(), GNUNET_SCHEDULER_cancel(), is_public, is_shadow, list, list_it, marked_head, MarkedRecord::name, name, RecordSetEntry::next, MarkedRecord::next, purge_task, purge_zone, recordset, reverse_qe, set_qe, typestring, uri, value, zm, and zone_pkey.
Referenced by do_shutdown(), and finish_command().
|
static |
Task run on shutdown.
Cleans up everything.
cls | unused |
Definition at line 598 of file gnunet-namestore.c.
References ego_head, GNUNET_free, GNUNET_IDENTITY_disconnect(), GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_disconnect(), EgoEntry::identifier, idh, EgoEntry::next, ns, ns_qe, and reset_handles().
Referenced by run().
|
static |
Definition at line 630 of file gnunet-namestore.c.
References GNUNET_EC_NONE, GNUNET_ErrorCode_get_hint(), GNUNET_SCHEDULER_shutdown(), ns_qe, and ret.
Referenced by finish_command(), and process_command_stdin().
|
static |
Check if this is a new name. If yes, and we have records, store them.
one last time
Definition at line 1777 of file gnunet-namestore.c.
References buf, cfg, commit_cb(), get_identity_for_string(), GNUNET_DNSPARSER_MAX_NAME_LENGTH, GNUNET_free, GNUNET_NAMESTORE_transaction_commit(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, GNUNET_YES, MAX_LINE_LEN, name, ns, ns_qe, parse_recordline(), recordset, ret, run_with_zone_pkey(), and zone_pkey.
Referenced by begin_cb(), and finish_command().
|
static |
Definition at line 647 of file gnunet-namestore.c.
References commit_cb(), GNUNET_NAMESTORE_transaction_commit(), ns, ns_qe, process_command_stdin(), read_from_stdin, and reset_handles().
Referenced by add_continuation(), add_error_cb(), del_continuation(), del_lookup_error_cb(), del_monitor(), display_record_lookup(), get_existing_record(), handle_reverse_lookup(), lookup_error_cb(), purge_next_record(), replace_cont(), run_with_zone_pkey(), zone_iteration_error_cb(), and zone_iteration_finished().
|
static |
Definition at line 660 of file gnunet-namestore.c.
References _, finish_command(), GNUNET_EC_NAMESTORE_RECORD_EXISTS, GNUNET_EC_NONE, GNUNET_ErrorCode_get_hint(), qe, and ret.
Referenced by get_existing_record(), and run_with_zone_pkey().
|
static |
Definition at line 679 of file gnunet-namestore.c.
References _, del_qe, finish_command(), GNUNET_EC_NAMESTORE_RECORD_NOT_FOUND, and GNUNET_ErrorCode_get_hint().
Referenced by del_monitor().
|
static |
Definition at line 710 of file gnunet-namestore.c.
References del_qe, finish_command(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_NAMESTORE_records_store(), MarkedRecord::key, marked_deleted(), marked_head, marked_tail, MarkedRecord::name, ns, purge_task, and ret.
Referenced by marked_deleted(), and zone_iteration_finished().
|
static |
Definition at line 696 of file gnunet-namestore.c.
References _, del_qe, GNUNET_EC_NONE, GNUNET_ErrorCode_get_hint(), GNUNET_SCHEDULER_add_now(), purge_next_record(), and purge_task.
Referenced by purge_next_record().
|
static |
Function called when we are done with a zone iteration.
Definition at line 739 of file gnunet-namestore.c.
References finish_command(), GNUNET_SCHEDULER_add_now(), list_it, purge_next_record(), purge_orphaned, purge_task, purge_zone, and ret.
Referenced by run_with_zone_pkey().
|
static |
Function called when we encountered an error in a zone iteration.
Definition at line 757 of file gnunet-namestore.c.
References finish_command(), list_it, and ret.
Referenced by run_with_zone_pkey().
|
static |
Definition at line 767 of file gnunet-namestore.c.
References GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_strdup, MarkedRecord::key, marked_head, marked_tail, MarkedRecord::name, and zone_key.
Referenced by purge_zone_iterator().
|
static |
Definition at line 785 of file gnunet-namestore.c.
References EgoEntry::ego, ego_head, GNUNET_CONTAINER_DLL_insert, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_new, GNUNET_strdup, MarkedRecord::key, marked_head, marked_tail, MarkedRecord::name, EgoEntry::next, and zone_key.
Referenced by purge_orphans_iterator().
|
static |
Process a record that was stored in the namestore.
rname | name that is being mapped (at most 255 characters long) |
rd_len | number of entries in rd array |
rd | array of records with data to store |
Definition at line 823 of file gnunet-namestore.c.
References _, GNUNET_TIME_Absolute::abs_value_us, data, data_size, EgoEntry::ego, ego_head, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_free, GNUNET_GNS_EMPTY_LABEL_AT, GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_RF_CRITICAL, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW, GNUNET_GNSRECORD_RF_SUPPLEMENTAL, GNUNET_GNSRECORD_TYPE_ANY, GNUNET_GNSRECORD_TYPE_NICK, GNUNET_GNSRECORD_typename_to_number(), GNUNET_GNSRECORD_value_to_string(), GNUNET_IDENTITY_ego_get_private_key(), GNUNET_IDENTITY_private_key_to_string(), GNUNET_NO, GNUNET_STRINGS_absolute_time_to_string(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_YES, list_orphaned, name, output_recordline, rd, GNUNET_TIME_Relative::rel_value_us, type, typestring, and zone_key.
Referenced by display_record_iterator(), display_record_lookup(), and display_record_monitor().
|
static |
Definition at line 933 of file gnunet-namestore.c.
References collect_zone_records_to_purge(), GNUNET_NAMESTORE_zone_iterator_next(), list_it, rd, and zone_key.
Referenced by run_with_zone_pkey().
|
static |
Definition at line 949 of file gnunet-namestore.c.
References collect_orphans(), GNUNET_NAMESTORE_zone_iterator_next(), list_it, rd, and zone_key.
Referenced by run_with_zone_pkey().
|
static |
Process a record that was stored in the namestore.
cls | closure |
zone_key | private key of the zone |
rname | name that is being mapped (at most 255 characters long) |
rd_len | number of entries in rd array |
rd | array of records with data to store |
Definition at line 974 of file gnunet-namestore.c.
References display_record(), GNUNET_NAMESTORE_zone_iterator_next(), list_it, rd, and zone_key.
Referenced by run_with_zone_pkey().
|
static |
Process a record that was stored in the namestore.
cls | closure |
zone_key | private key of the zone |
rname | name that is being mapped (at most 255 characters long) |
rd_len | number of entries in rd array |
rd | array of records with data to store |
Definition at line 999 of file gnunet-namestore.c.
References display_record(), GNUNET_NAMESTORE_zone_monitor_next(), rd, zm, and zone_key.
Referenced by run_with_zone_pkey().
|
static |
Process a record that was stored in the namestore.
cls | closure |
zone_key | private key of the zone |
rname | name that is being mapped (at most 255 characters long) |
rd_len | number of entries in rd array |
rd | array of records with data to store |
Definition at line 1024 of file gnunet-namestore.c.
References display_record(), finish_command(), get_qe, rd, and zone_key.
Referenced by run_with_zone_pkey().
|
static |
Function called once we are in sync in monitor mode.
cls | NULL |
Definition at line 1044 of file gnunet-namestore.c.
Referenced by GNUNET_NAMESTORE_zone_monitor_start(), GNUNET_NAMESTORE_zone_monitor_start2(), and run_with_zone_pkey().
|
static |
Function called on errors while monitoring.
cls | NULL |
Definition at line 1057 of file gnunet-namestore.c.
Referenced by run_with_zone_pkey().
|
static |
Function called on errors while monitoring.
cls | NULL |
Definition at line 1070 of file gnunet-namestore.c.
References finish_command(), and get_qe.
Referenced by run_with_zone_pkey().
|
static |
Function called if lookup fails.
Definition at line 1083 of file gnunet-namestore.c.
References add_qe, finish_command(), GNUNET_break, and ret.
Referenced by run_with_zone_pkey().
|
static |
We're storing a record; this function is given the existing record so that we can merge the information.
cls | closure, unused |
zone_key | private key of the zone |
rec_name | name that is being mapped (at most 255 characters long) |
rd_count | number of entries in rd array |
rd | array of records with data to store |
Definition at line 1104 of file gnunet-namestore.c.
References _, add_continuation(), add_qe, GNUNET_GNSRECORD_Data::data, data, GNUNET_GNSRECORD_Data::data_size, data_size, etime, etime_is_rel, GNUNET_GNSRECORD_Data::expiration_time, finish_command(), GNUNET_GNSRECORD_Data::flags, GNUNET_assert, GNUNET_break, GNUNET_DNSPARSER_TYPE_SOA, GNUNET_ERROR_TYPE_DEBUG, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW, GNUNET_log, GNUNET_memcpy, GNUNET_NAMESTORE_records_store(), GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_YES, is_public, is_shadow, name, ns, rd, rd_count, GNUNET_GNSRECORD_Data::record_type, ret, type, zone_key, and zone_pkey.
Referenced by run_with_zone_pkey().
|
static |
Function called if we encountered an error in zone-to-name.
Definition at line 1177 of file gnunet-namestore.c.
References reverse_pkey, and reverse_qe.
Referenced by run_with_zone_pkey().
|
static |
Function called with the result of our attempt to obtain a name for a given public key.
cls | NULL |
zone | private key of the zone; NULL on disconnect |
label | label of the records; NULL on disconnect |
rd_count | number of entries in rd array, 0 if label was deleted |
rd | array of records with data to store |
Definition at line 1196 of file gnunet-namestore.c.
References ego_name, finish_command(), rd, rd_count, reverse_pkey, reverse_qe, and zone.
Referenced by run_with_zone_pkey().
|
static |
Function called if lookup for deletion fails.
Definition at line 1219 of file gnunet-namestore.c.
References del_qe, finish_command(), GNUNET_break, and ret.
Referenced by run_with_zone_pkey().
|
static |
We were asked to delete something; this function is called with the existing records.
Now we should determine what should be deleted and then issue the deletion operation.
cls | NULL |
zone | private key of the zone we are deleting from |
label | name of the records we are editing |
rd_count | size of the rd array |
rd | existing records |
Definition at line 1241 of file gnunet-namestore.c.
References _, data, data_size, del_continuation(), del_qe, finish_command(), GNUNET_free, GNUNET_GNSRECORD_TYPE_ANY, GNUNET_GNSRECORD_typename_to_number(), GNUNET_GNSRECORD_value_to_string(), GNUNET_NAMESTORE_records_store(), name, ns, rd, rd_count, GNUNET_GNSRECORD_Data::record_type, ret, type, typestring, value, zone, and zone_pkey.
Referenced by run_with_zone_pkey().
|
static |
Definition at line 1319 of file gnunet-namestore.c.
References _, finish_command(), GNUNET_EC_NONE, GNUNET_ERROR_TYPE_MESSAGE, GNUNET_ErrorCode_get_hint(), GNUNET_log, ret, and set_qe.
Referenced by run_with_zone_pkey().
|
static |
We have obtained the zone's private key, so now process the main commands using it.
cfg | configuration to use |
Definition at line 1342 of file gnunet-namestore.c.
References _, add, add_continuation(), add_error_cb(), add_qe, add_qe_uri, cfg, GNUNET_GNSRECORD_Data::data, data, GNUNET_GNSRECORD_Data::data_size, data_size, del, del_lookup_error_cb(), del_monitor(), del_qe, display_record_iterator(), display_record_lookup(), display_record_monitor(), e, ego_name, etime, etime_is_rel, GNUNET_GNSRECORD_Data::expiration_time, expirationstring, finish_command(), GNUNET_GNSRECORD_Data::flags, get_existing_record(), get_qe, GNUNET_DNSPARSER_TYPE_OPENPGPKEY, GNUNET_DNSPARSER_TYPE_SRV, GNUNET_DNSPARSER_TYPE_TLSA, GNUNET_free, GNUNET_GNS_EMPTY_LABEL_AT, GNUNET_GNSRECORD_FILTER_INCLUDE_MAINTENANCE, GNUNET_GNSRECORD_FILTER_NONE, GNUNET_GNSRECORD_FILTER_OMIT_PRIVATE, GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_GNSRECORD_RF_SHADOW, GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_TYPE_NICK, GNUNET_GNSRECORD_typename_to_number(), GNUNET_IDENTITY_public_key_from_string(), GNUNET_IDENTITY_public_key_get_length(), GNUNET_NAMESTORE_records_lookup(), GNUNET_NAMESTORE_records_store(), GNUNET_NAMESTORE_zone_iteration_start2(), GNUNET_NAMESTORE_zone_monitor_start2(), GNUNET_NAMESTORE_zone_to_name(), GNUNET_new_array, GNUNET_OK, GNUNET_strdup, GNUNET_YES, handle_reverse_lookup(), include_maintenance, is_public, is_shadow, list, list_it, list_orphaned, lookup_error_cb(), monitor, monitor_error_cb(), name, nickstring, ns, omit_private, parse_expiration(), pkey, pubkey, purge_orphaned, purge_orphans_iterator(), purge_zone, purge_zone_iterator(), rd, rd_count, GNUNET_GNSRECORD_Data::record_type, recordset, replace_cont(), ret, reverse_error_cb(), reverse_pkey, reverse_qe, set_qe, sh, sync_cb(), type, typestring, uri, value, zm, zone_iteration_error_cb(), zone_iteration_finished(), and zone_pkey.
Referenced by begin_cb(), and process_command_stdin().
|
static |
FIXME: Check for zTLD?
Definition at line 1739 of file gnunet-namestore.c.
References EgoEntry::ego, ego_head, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_IDENTITY_ego_get_public_key(), GNUNET_IDENTITY_public_key_from_string(), GNUNET_NO, GNUNET_OK, EgoEntry::identifier, EgoEntry::next, and pubkey.
Referenced by process_command_stdin().
|
static |
Definition at line 1865 of file gnunet-namestore.c.
References cfg, GNUNET_EC_NONE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ErrorCode_get_hint(), GNUNET_log, GNUNET_SCHEDULER_shutdown(), ns_qe, process_command_stdin(), read_from_stdin, and run_with_zone_pkey().
Referenced by id_connect_cb().
|
static |
Function called with ALL of the egos known to the identity service, used on startup if the user did not specify a zone on the command-line.
Once the iteration is done (ego is NULL), we ask for the default ego for "namestore".
cls | a struct GNUNET_CONFIGURATION_Handle |
ego | an ego, NULL for end of iteration |
ctx | NULL |
name | name associated with ego |
Definition at line 1898 of file gnunet-namestore.c.
References begin_cb(), cfg, ctx, EgoEntry::ego, ego_head, ego_name, ego_tail, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_IDENTITY_ego_get_public_key(), GNUNET_NAMESTORE_transaction_begin(), GNUNET_new, GNUNET_strdup, EgoEntry::identifier, name, ns, ns_qe, pk, and zone_pkey.
Referenced by run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 1940 of file gnunet-namestore.c.
References _, consensus-simulation::args, cfg, do_shutdown(), GNUNET_ERROR_TYPE_WARNING, GNUNET_IDENTITY_connect(), GNUNET_log, GNUNET_NAMESTORE_connect(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), id_connect_cb(), idh, ns, and ret.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
The main function for gnunet-namestore.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 1982 of file gnunet-namestore.c.
References _, add, del, ego_name, expirationstring, gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_log_setup(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), include_maintenance, is_public, is_shadow, list, list_orphaned, monitor, name, nickstring, omit_private, options, output_recordline, purge_orphaned, purge_zone, read_from_stdin, ret, reverse_pkey, run(), typestring, uri, and value.
|
static |
Handle to the namestore.
Definition at line 114 of file gnunet-namestore.c.
Referenced by del_monitor(), do_shutdown(), finish_command(), get_existing_record(), id_connect_cb(), process_command_stdin(), purge_next_record(), run(), and run_with_zone_pkey().
|
static |
Private key for the our zone.
Definition at line 114 of file gnunet-namestore.c.
Referenced by del_monitor(), get_existing_record(), id_connect_cb(), process_command_stdin(), reset_handles(), and run_with_zone_pkey().
|
static |
Identity service handle.
Definition at line 124 of file gnunet-namestore.c.
Referenced by do_shutdown(), and run().
|
static |
Name of the ego controlling the zone.
Definition at line 129 of file gnunet-namestore.c.
Referenced by handle_reverse_lookup(), id_connect_cb(), main(), reset_handles(), and run_with_zone_pkey().
|
static |
Queue entry for the 'add-uri' operation.
Definition at line 134 of file gnunet-namestore.c.
Referenced by reset_handles(), and run_with_zone_pkey().
|
static |
Queue entry for the 'add' operation.
Definition at line 139 of file gnunet-namestore.c.
Referenced by add_error_cb(), get_existing_record(), reset_handles(), and run_with_zone_pkey().
|
static |
Queue entry for the 'lookup' operation.
Definition at line 144 of file gnunet-namestore.c.
Referenced by display_record_lookup(), lookup_error_cb(), reset_handles(), and run_with_zone_pkey().
|
static |
Queue entry for the 'reverse lookup' operation (in combination with a name).
Definition at line 149 of file gnunet-namestore.c.
Referenced by handle_reverse_lookup(), reset_handles(), reverse_error_cb(), and run_with_zone_pkey().
|
static |
Marked record list.
Definition at line 154 of file gnunet-namestore.c.
Referenced by collect_orphans(), collect_zone_records_to_purge(), purge_next_record(), and reset_handles().
|
static |
Marked record list.
Definition at line 159 of file gnunet-namestore.c.
Referenced by collect_orphans(), collect_zone_records_to_purge(), and purge_next_record().
const struct GNUNET_CONFIGURATION_Handle* cfg |
Configuration handle.
Handle to our configuration.
Definition at line 164 of file gnunet-namestore.c.
Referenced by begin_cb(), id_connect_cb(), process_command_stdin(), run(), and run_with_zone_pkey().
|
static |
Ego list.
Definition at line 169 of file gnunet-namestore.c.
Referenced by collect_orphans(), display_record(), do_shutdown(), get_identity_for_string(), and id_connect_cb().
|
static |
|
static |
List iterator for the 'list' operation.
Definition at line 179 of file gnunet-namestore.c.
Referenced by display_record_iterator(), purge_orphans_iterator(), purge_zone_iterator(), reset_handles(), run_with_zone_pkey(), zone_iteration_error_cb(), and zone_iteration_finished().
|
static |
Run in read from stdin mode.
Definition at line 184 of file gnunet-namestore.c.
Referenced by begin_cb(), finish_command(), and main().
|
static |
Desired action is to list records.
Definition at line 189 of file gnunet-namestore.c.
Referenced by main(), reset_handles(), and run_with_zone_pkey().
|
static |
Desired action is to add a record.
Definition at line 194 of file gnunet-namestore.c.
Referenced by check_ipv4_listed(), check_notify_client(), main(), notify_client(), notify_client_external_ipv4_change(), notify_clients(), notify_clients_stun_change(), notify_monitors_external_ipv4_change(), run_with_zone_pkey(), and solver_info_cb().
|
static |
Desired action is to remove a record.
Definition at line 199 of file gnunet-namestore.c.
Referenced by forward_resolution(), GNUNET_ABD_delegate_issue(), main(), run_with_zone_pkey(), and send_lookup_response().
|
static |
Is record public (opposite of GNUNET_GNSRECORD_RF_PRIVATE)
Definition at line 204 of file gnunet-namestore.c.
Referenced by get_existing_record(), main(), reset_handles(), and run_with_zone_pkey().
|
static |
Is record a shadow record (GNUNET_GNSRECORD_RF_SHADOW)
Definition at line 209 of file gnunet-namestore.c.
Referenced by get_existing_record(), main(), reset_handles(), and run_with_zone_pkey().
|
static |
Filter private records.
Definition at line 214 of file gnunet-namestore.c.
Referenced by main(), and run_with_zone_pkey().
|
static |
Output in recordline format.
Definition at line 219 of file gnunet-namestore.c.
Referenced by display_record(), and main().
|
static |
Purge zone contents.
Definition at line 225 of file gnunet-namestore.c.
Referenced by main(), reset_handles(), run_with_zone_pkey(), and zone_iteration_finished().
|
static |
Do not filter maintenance records.
Definition at line 230 of file gnunet-namestore.c.
Referenced by main(), and run_with_zone_pkey().
|
static |
Purge orphaned records.
Definition at line 235 of file gnunet-namestore.c.
Referenced by main(), run_with_zone_pkey(), and zone_iteration_finished().
|
static |
List records and zone keys of orphaned records.
Definition at line 240 of file gnunet-namestore.c.
Referenced by display_record(), main(), and run_with_zone_pkey().
|
static |
Queue entry for the 'del' operation.
Definition at line 245 of file gnunet-namestore.c.
Referenced by del_continuation(), del_lookup_error_cb(), del_monitor(), marked_deleted(), purge_next_record(), reset_handles(), and run_with_zone_pkey().
|
static |
Queue entry for the 'set/replace' operation.
Definition at line 250 of file gnunet-namestore.c.
Referenced by replace_cont(), reset_handles(), and run_with_zone_pkey().
|
static |
Queue entry for begin/commit.
Definition at line 255 of file gnunet-namestore.c.
Referenced by begin_cb(), commit_cb(), do_shutdown(), finish_command(), id_connect_cb(), and process_command_stdin().
|
static |
Name of the records to add/list/remove.
Definition at line 260 of file gnunet-namestore.c.
Referenced by del_monitor(), display_record(), get_existing_record(), id_connect_cb(), main(), process_command_stdin(), reset_handles(), and run_with_zone_pkey().
|
static |
Value of the record to add/remove.
Definition at line 265 of file gnunet-namestore.c.
Referenced by add_section_contents(), add_sections(), add_setter_action(), add_to_tc(), age_values(), attr_in_claims_request(), auto_conf_iter(), bandwidth_stats_iterator(), barrier_destroy_iterator(), bind_loose_channel(), blacklist_cfg_iter(), build_result_set(), bulk_tx_start(), cache_clear_iterator(), call_iterator(), cancel_pending_request(), cfg_copy_iterator(), change_peer_respect(), channel_destroy_iterator(), check_connection_quality(), check_known_address(), check_known_challenge(), check_validation_request_pending(), check_vectors(), clean_local_client(), clean_request(), cleanup_channel(), cleanup_destination(), cleanup_hashmap(), cleanup_iterator(), cleanup_url_map(), cleanup_validation_entry(), client_disconnect_it(), client_release_ports(), close_files_iter(), collector(), compare_entries(), compute_service_response(), compute_square_sum_mpi_elements(), con_val_iter(), consume_cont(), cookie_identity_interpretation(), copy_element_cb(), copy_entry(), create_randomized_element_iterator(), create_response(), database_setup(), debug_channel(), del_monitor(), delete_entries(), delete_value(), destroy_active_client_request(), destroy_ai_cb(), destroy_all_address_it(), destroy_channel_cb(), destroy_elements_iterator(), destroy_it(), destroy_iterator_cb(), destroy_key_to_element_iter(), destroy_paths_now(), destroy_port_cb(), destroy_remaining_channels(), destroy_session_cb(), destroy_session_shutdown_cb(), destroy_tunnels_now(), destroy_watch(), determinate_avg_element_size_iterator(), determinate_done_message_iterator(), disconnect_all_neighbours(), disconnect_and_free_it(), disconnect_and_free_peer_entry(), dns_string_to_value(), dns_value_to_string(), do_restart_typemap_message(), drop_client_entries(), dv_neighbour_selection(), dv_neighbour_transmission(), execute_get(), execute_select(), expire_blocks(), expire_entries(), filter_all(), filtered_map_initialization(), find_address_cb(), find_address_it(), find_advertisable_hello(), find_ai_cb(), find_ai_no_session_cb(), find_best_address_it(), find_by_message_uuid(), find_result_set(), find_sender_by_address(), find_trees(), flush_respect(), free_ack_cummulator_cb(), free_addr_it(), free_all_it(), free_backtalker_cb(), free_barrier_node_cb(), free_barriers_cb(), free_blacklist_entry(), free_dv_routes_cb(), free_ego(), free_element_cb(), free_entry(), free_host_entry(), free_item(), free_iterate(), free_matching_requests(), free_namespaces_cb(), free_neighbour_cb(), free_nodes_cb(), free_peer(), free_pending_ack_cb(), free_preference(), free_reassembly_cb(), free_request(), free_request_it(), free_result(), free_service_record(), free_sug_handle(), free_tmps(), free_tracker(), free_validation_state_cb(), free_value(), free_waiting_entry(), full_sync_plausibility_check(), get_active_address_it(), get_all_peers_iterator(), get_all_tunnels_iterator(), get_iterator(), get_lt_delete_it(), get_queue_delete_it(), get_rand_peer_iterator(), get_receiver_delete_it(), get_result_present(), get_sender_delete_it(), get_session_delete_it(), get_url_parameter_copy(), GNUNET_CONFIGURATION_append_value_filename(), GNUNET_CONFIGURATION_config_tool_run(), GNUNET_CONFIGURATION_set_value_string(), GNUNET_CONTAINER_multihashmap32_contains_value(), GNUNET_CONTAINER_multihashmap32_iterator_next(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_CONTAINER_multihashmap_contains_value(), GNUNET_CONTAINER_multihashmap_iterator_next(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CONTAINER_multipeermap_contains_value(), GNUNET_CONTAINER_multipeermap_iterator_next(), GNUNET_CONTAINER_multipeermap_put(), GNUNET_CONTAINER_multipeermap_remove(), GNUNET_CONTAINER_multishortmap_contains_value(), GNUNET_CONTAINER_multishortmap_iterator_next(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_CONTAINER_multiuuidmap_contains_value(), GNUNET_CONTAINER_multiuuidmap_iterator_next(), GNUNET_CONTAINER_multiuuidmap_put(), GNUNET_CONTAINER_multiuuidmap_remove(), GNUNET_FS_GETOPT_KEYWORDS(), GNUNET_FS_GETOPT_METADATA(), GNUNET_NETWORK_socket_disable_corking(), GNUNET_PEERSTORE_store(), GNUNET_STATISTICS_set(), GNUNET_TESTING_get_topo_from_string(), GSF_cadet_release_clients(), handle_ack(), handle_alice_client_message(), handle_bob_client_message(), handle_set(), hash_hosts(), header_iterator(), heap_plugin_get_expiration(), heap_plugin_get_replication(), heap_plugin_get_zero_anonymity(), heap_plugin_put(), incrementBit(), init_key_to_element_iterator(), initialize_map_unfiltered(), inspect_attrs(), iterate_addresses(), iterate_channels_cb(), iterate_close_room(), iterate_copy_history(), iterate_create_ego(), iterate_destroy_contacts(), iterate_destroy_egos(), iterate_destroy_entries(), iterate_destroy_links(), iterate_destroy_members(), iterate_destroy_message(), iterate_destroy_messages(), iterate_destroy_operations(), iterate_destroy_room(), iterate_destroy_rooms(), iterate_destroy_session(), iterate_destroy_tunnels(), iterate_entries(), iterate_find_member(), iterate_find_room(), iterate_free_member_ids(), iterate_load_next_member_sessions(), iterate_load_next_session(), iterate_local_members(), iterate_member_sessions_it(), iterate_reachables(), iterate_reset_room(), iterate_save_entries(), iterate_save_links(), iterate_save_member_session_history_hentries(), iterate_save_members(), iterate_save_messages(), iterate_save_operations(), iterate_save_rooms(), iterate_save_session(), iterate_search_session(), iterate_send_room_message(), iterate_store_members_it(), iterate_sync_member_contacts(), iterate_sync_session_contact(), iterate_zones(), iterator(), iterator_bf_create(), iterator_bf_reduce(), iterator_cb(), jwt_parse_attributes(), locate_by_id(), log_namespaces(), log_nodes(), lookup_queue_it(), lookup_session_it(), main(), make_json(), mark_match_down(), mark_peer_down(), migrate_and_drop_keywords(), migrate_and_drop_metadata(), move_to_pending(), move_to_queue(), mpi_to_sexp(), neighbour_delete(), neighbours_iterate(), nibble_to_regex(), node_connections(), normalize_address(), notify_change(), notify_client_about_session(), notify_client_connect_info(), notify_client_queues(), notify_tunnel_up_cb(), num_to_regex(), op_get_element_iterator(), opc_free_iterator(), opc_search_iterator(), open_port_cb(), parse_jwt(), parse_record(), parse_record_data(), peerinfo_it(), peermap_clear_iterator(), PEERSTORE_create_record_mq_envelope(), peerstore_flat_store_record(), peerstore_sqlite_store_record(), pending_reversals_delete_it(), prepare_ibf_iterator(), print_option(), printer(), printer_watch(), process_reply(), process_result_with_request(), process_stat(), process_stat_in(), process_stats(), process_update_node(), rcop_cleanup_iterator(), reachability_iterator(), read_service_conf(), regex_cancel_dht_get(), regex_free_result(), regex_result_iterator(), reghost_free_iterator(), remove_all(), remove_iterator(), reschedule_hellos(), reset_handles(), rewatch_it(), rsa_sign_mpi(), run(), run_with_zone_pkey(), schedule_current_round(), search_iterator(), search_result_free(), search_result_freeze_probes(), search_result_resume_probes(), search_result_stop(), search_result_suspend(), send_full_element_iterator(), send_missing_full_elements_iter(), send_offers_iterator(), send_session_info_iter(), send_simple_cb(), send_utilization_data(), session_cmp_it(), session_disconnect_it(), session_lookup_client_by_address(), session_lookup_it(), session_tag_it(), set_cont(), set_insert_iterator(), set_value(), signal_result_resume(), socket_set_nodelay(), stat_iterator(), statistics_cb(), statistics_result(), stats_iterator(), stop_peer_request(), store_and_free_entries(), store_peer_presistently_iterator(), stun_attr2str(), stun_msg2str(), sum_relative_preferences(), test_blacklisted(), test_exist_cb(), test_result_present(), ticket_collect(), tld_iter(), transmit_client_response(), transmit_suggestion(), try_add_peers(), update_abs_sum(), update_config(), update_flood_times(), update_iterator(), update_rel_sum(), update_sre_result_maps(), url_iterator(), valid_peer_iterator(), validation_entry_match(), watch_notifier_it(), write_item(), and zone_to_name().
|
static |
URI to import.
Definition at line 270 of file gnunet-namestore.c.
Referenced by main(), reset_handles(), and run_with_zone_pkey().
|
static |
Reverse lookup to perform.
Definition at line 275 of file gnunet-namestore.c.
Referenced by handle_reverse_lookup(), main(), reverse_error_cb(), and run_with_zone_pkey().
|
static |
Type of the record to add/remove, NULL to remove all.
Definition at line 280 of file gnunet-namestore.c.
Referenced by del_monitor(), display_record(), main(), reset_handles(), and run_with_zone_pkey().
|
static |
Desired expiration time.
Definition at line 285 of file gnunet-namestore.c.
Referenced by main(), parse_expiration(), reset_handles(), and run_with_zone_pkey().
|
static |
Desired nick name.
Definition at line 290 of file gnunet-namestore.c.
Referenced by main(), and run_with_zone_pkey().
|
static |
Global return value.
Definition at line 295 of file gnunet-namestore.c.
Referenced by add_continuation(), add_error_cb(), commit_cb(), del_lookup_error_cb(), del_monitor(), get_existing_record(), main(), process_command_stdin(), purge_next_record(), replace_cont(), run(), run_with_zone_pkey(), zone_iteration_error_cb(), and zone_iteration_finished().
|
static |
Type string converted to DNS type value.
Definition at line 300 of file gnunet-namestore.c.
Referenced by del_monitor(), display_record(), get_existing_record(), and run_with_zone_pkey().
|
static |
Value in binary format.
Definition at line 305 of file gnunet-namestore.c.
Referenced by del_monitor(), display_record(), get_existing_record(), reset_handles(), and run_with_zone_pkey().
|
static |
Number of bytes in data.
Definition at line 310 of file gnunet-namestore.c.
Referenced by del_monitor(), display_record(), get_existing_record(), and run_with_zone_pkey().
|
static |
Expiration string converted to numeric value.
Definition at line 315 of file gnunet-namestore.c.
Referenced by get_existing_record(), parse_expiration(), and run_with_zone_pkey().
|
static |
Is expiration time relative or absolute time?
Definition at line 320 of file gnunet-namestore.c.
Referenced by get_existing_record(), parse_expiration(), and run_with_zone_pkey().
|
static |
Monitor handle.
Definition at line 325 of file gnunet-namestore.c.
Referenced by check_monitor_start(), check_result(), client_disconnect_cb(), continue_store_activity(), display_record_monitor(), GNUNET_NAMESTORE_zone_monitor_next(), GNUNET_NAMESTORE_zone_monitor_start(), GNUNET_NAMESTORE_zone_monitor_start2(), GNUNET_NAMESTORE_zone_monitor_stop(), handle_monitor_next(), handle_monitor_start(), handle_result(), handle_sync(), monitor_iteration_next(), monitor_sync(), monitor_unblock(), mq_error_handler(), reconnect(), reset_handles(), run_with_zone_pkey(), and warn_monitor_slow().
|
static |
Enables monitor mode.
Definition at line 330 of file gnunet-namestore.c.
Referenced by main(), and run_with_zone_pkey().
|
static |
Entry in record set for processing records in bulk.
Definition at line 335 of file gnunet-namestore.c.
Referenced by parse_recordline(), process_command_stdin(), reset_handles(), and run_with_zone_pkey().
|
static |
Purge task.
Definition at line 340 of file gnunet-namestore.c.
Referenced by marked_deleted(), purge_next_record(), reset_handles(), and zone_iteration_finished().