diff options
Diffstat (limited to 'src/fs/gnunet-pseudonym.c')
-rw-r--r-- | src/fs/gnunet-pseudonym.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c index a692917da..dd3c9d4a2 100644 --- a/src/fs/gnunet-pseudonym.c +++ b/src/fs/gnunet-pseudonym.c | |||
@@ -95,19 +95,37 @@ progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info) | |||
95 | 95 | ||
96 | 96 | ||
97 | static void | 97 | static void |
98 | ns_printer (void *cls, const char *name, const struct GNUNET_HashCode * id) | 98 | ns_printer (void *cls, const char *name, const struct GNUNET_PseudonymIdentifier *pseudonym) |
99 | { | 99 | { |
100 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; | 100 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; |
101 | struct GNUNET_HashCode hc; | ||
101 | 102 | ||
102 | GNUNET_CRYPTO_hash_to_enc (id, &enc); | 103 | GNUNET_CRYPTO_hash (pseudonym, |
104 | sizeof (struct GNUNET_PseudonymIdentifier), | ||
105 | &hc); | ||
106 | GNUNET_CRYPTO_hash_to_enc (&hc, &enc); | ||
103 | FPRINTF (stdout, "%s (%s)\n", name, (const char *) &enc); | 107 | FPRINTF (stdout, "%s (%s)\n", name, (const char *) &enc); |
104 | } | 108 | } |
105 | 109 | ||
106 | 110 | ||
111 | /** | ||
112 | * Output information about a pseudonym. | ||
113 | * | ||
114 | * @param cls closure | ||
115 | * @param pseudonym hash code of public key of pseudonym | ||
116 | * @param name name of the pseudonym (might be NULL) | ||
117 | * @param unique_name unique name of the pseudonym (might be NULL) | ||
118 | * @param md meta data known about the pseudonym | ||
119 | * @param rating the local rating of the pseudonym | ||
120 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | ||
121 | */ | ||
107 | static int | 122 | static int |
108 | pseudo_printer (void *cls, const struct GNUNET_HashCode * pseudonym, | 123 | pseudo_printer (void *cls, |
109 | const char *name, const char *unique_name, | 124 | const struct GNUNET_PseudonymIdentifier *pseudonym, |
110 | const struct GNUNET_CONTAINER_MetaData *md, int rating) | 125 | const char *name, |
126 | const char *unique_name, | ||
127 | const struct GNUNET_CONTAINER_MetaData *md, | ||
128 | int32_t rating) | ||
111 | { | 129 | { |
112 | char *id; | 130 | char *id; |
113 | char *unique_id; | 131 | char *unique_id; |
@@ -136,7 +154,7 @@ pseudo_printer (void *cls, const struct GNUNET_HashCode * pseudonym, | |||
136 | static void | 154 | static void |
137 | post_advertising (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) | 155 | post_advertising (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) |
138 | { | 156 | { |
139 | struct GNUNET_HashCode nsid; | 157 | struct GNUNET_PseudonymIdentifier nsid; |
140 | char *set; | 158 | char *set; |
141 | int delta; | 159 | int delta; |
142 | 160 | ||
@@ -203,6 +221,7 @@ static void | |||
203 | run (void *cls, char *const *args, const char *cfgfile, | 221 | run (void *cls, char *const *args, const char *cfgfile, |
204 | const struct GNUNET_CONFIGURATION_Handle *c) | 222 | const struct GNUNET_CONFIGURATION_Handle *c) |
205 | { | 223 | { |
224 | struct GNUNET_FS_Uri *sks_uri; | ||
206 | char *emsg; | 225 | char *emsg; |
207 | 226 | ||
208 | cfg = c; | 227 | cfg = c; |
@@ -239,9 +258,13 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
239 | ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/namespace", &emsg); | 258 | ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/namespace", &emsg); |
240 | GNUNET_assert (NULL == emsg); | 259 | GNUNET_assert (NULL == emsg); |
241 | } | 260 | } |
242 | GNUNET_FS_namespace_advertise (h, ksk_uri, ns, adv_metadata, &bo, | 261 | sks_uri = GNUNET_FS_uri_sks_create (ns, root_identifier, &emsg); |
243 | root_identifier, &post_advertising, | 262 | GNUNET_assert (NULL == emsg); |
244 | NULL); | 263 | GNUNET_FS_publish_ksk (h, ksk_uri, adv_metadata, sks_uri, |
264 | &bo, | ||
265 | GNUNET_FS_PUBLISH_OPTION_NONE, | ||
266 | &post_advertising, NULL); | ||
267 | GNUNET_FS_uri_destroy (sks_uri); | ||
245 | return; | 268 | return; |
246 | } | 269 | } |
247 | else | 270 | else |