aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-11-13 09:31:07 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-11-13 09:31:07 +0000
commitbe479981b97e8eeeb4ac251bb413a08b425a0fdd (patch)
tree2c658781f2d8701350cfd1697eefe741f122d0b2 /src/namestore
parent61d402d7aa5419bae7e0e6f0fbadfac08e4be27c (diff)
downloadgnunet-be479981b97e8eeeb4ac251bb413a08b425a0fdd.tar.gz
gnunet-be479981b97e8eeeb4ac251bb413a08b425a0fdd.zip
renaming PSEU to NICK
gnunet-namestore can set nick name in namestore
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-namestore.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 5becf0e6c..f8ad83259 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -135,6 +135,11 @@ static char *typestring;
135static char *expirationstring; 135static char *expirationstring;
136 136
137/** 137/**
138 * Desired nick name.
139 */
140static char *nickstring;
141
142/**
138 * Global return value 143 * Global return value
139 */ 144 */
140static int ret; 145static int ret;
@@ -521,7 +526,7 @@ testservice_task (void *cls,
521 "namestore"); 526 "namestore");
522 return; 527 return;
523 } 528 }
524 if (! (add|del|list|(NULL != uri)|(NULL != reverse_pkey)) ) 529 if (! (add|del|list|(NULL != nickstring)|(NULL != uri)|(NULL != reverse_pkey)) )
525 { 530 {
526 /* nothing more to be done */ 531 /* nothing more to be done */
527 fprintf (stderr, 532 fprintf (stderr,
@@ -705,6 +710,7 @@ testservice_task (void *cls,
705 rd.expiration_time = etime_abs.abs_value_us; 710 rd.expiration_time = etime_abs.abs_value_us;
706 else 711 else
707 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 712 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
713
708 if (1 != shadow) 714 if (1 != shadow)
709 rd.flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD; 715 rd.flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
710 add_qe_uri = GNUNET_NAMESTORE_records_store (ns, 716 add_qe_uri = GNUNET_NAMESTORE_records_store (ns,
@@ -715,6 +721,31 @@ testservice_task (void *cls,
715 &add_continuation, 721 &add_continuation,
716 &add_qe_uri); 722 &add_qe_uri);
717 } 723 }
724 if (NULL != nickstring)
725 {
726 if (0 == strlen(nickstring))
727 {
728 fprintf (stderr,
729 _("Invalid nick `%s'\n"),
730 nickstring);
731 GNUNET_SCHEDULER_shutdown ();
732 ret = 1;
733 return;
734 }
735 memset (&rd, 0, sizeof (rd));
736 rd.data = nickstring;
737 rd.data_size = strlen(nickstring);
738 rd.record_type = GNUNET_GNSRECORD_TYPE_NICK;
739 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
740 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
741 add_qe_uri = GNUNET_NAMESTORE_records_store (ns,
742 &zone_pkey,
743 "+",
744 1,
745 &rd,
746 &add_continuation,
747 &add_qe_uri);
748 }
718 if (monitor) 749 if (monitor)
719 { 750 {
720 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, 751 zm = GNUNET_NAMESTORE_zone_monitor_start (cfg,
@@ -777,6 +808,7 @@ run (void *cls, char *const *args, const char *cfgfile,
777 _("You must specify which zone should be accessed\n")); 808 _("You must specify which zone should be accessed\n"));
778 return; 809 return;
779 } 810 }
811
780 if ( (NULL != args[0]) && (NULL == uri) ) 812 if ( (NULL != args[0]) && (NULL == uri) )
781 uri = GNUNET_strdup (args[0]); 813 uri = GNUNET_strdup (args[0]);
782 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 814 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -814,6 +846,9 @@ main (int argc, char *const *argv)
814 {'e', "expiration", "TIME", 846 {'e', "expiration", "TIME",
815 gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1, 847 gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1,
816 &GNUNET_GETOPT_set_string, &expirationstring}, 848 &GNUNET_GETOPT_set_string, &expirationstring},
849 {'i', "nick", "NICKNAME",
850 gettext_noop ("set the desired nick name for the zone"), 1,
851 &GNUNET_GETOPT_set_string, &nickstring},
817 {'m', "monitor", NULL, 852 {'m', "monitor", NULL,
818 gettext_noop ("monitor changes in the namestore"), 0, 853 gettext_noop ("monitor changes in the namestore"), 0,
819 &GNUNET_GETOPT_set_one, &monitor}, 854 &GNUNET_GETOPT_set_one, &monitor},