diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/peerinfo-tool | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/peerinfo-tool')
-rw-r--r-- | src/peerinfo-tool/gnunet-peerinfo.c | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index 951eecce8..c61b6abbf 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c | |||
@@ -87,8 +87,8 @@ process_resolved_address (void *cls, const char *address) | |||
87 | dump_pc (pc); | 87 | dump_pc (pc); |
88 | return; | 88 | return; |
89 | } | 89 | } |
90 | GNUNET_array_append (pc->address_list, | 90 | GNUNET_array_append (pc->address_list, pc->num_addresses, |
91 | pc->num_addresses, GNUNET_strdup (address)); | 91 | GNUNET_strdup (address)); |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
@@ -103,10 +103,9 @@ process_resolved_address (void *cls, const char *address) | |||
103 | * @return GNUNET_OK to keep the address and continue | 103 | * @return GNUNET_OK to keep the address and continue |
104 | */ | 104 | */ |
105 | static int | 105 | static int |
106 | count_address (void *cls, | 106 | count_address (void *cls, const char *tname, |
107 | const char *tname, | 107 | struct GNUNET_TIME_Absolute expiration, const void *addr, |
108 | struct GNUNET_TIME_Absolute expiration, | 108 | uint16_t addrlen) |
109 | const void *addr, uint16_t addrlen) | ||
110 | { | 109 | { |
111 | struct PrintContext *pc = cls; | 110 | struct PrintContext *pc = cls; |
112 | 111 | ||
@@ -126,18 +125,13 @@ count_address (void *cls, | |||
126 | * @return GNUNET_OK to keep the address and continue | 125 | * @return GNUNET_OK to keep the address and continue |
127 | */ | 126 | */ |
128 | static int | 127 | static int |
129 | print_address (void *cls, | 128 | print_address (void *cls, const char *tname, |
130 | const char *tname, | 129 | struct GNUNET_TIME_Absolute expiration, const void *addr, |
131 | struct GNUNET_TIME_Absolute expiration, | 130 | uint16_t addrlen) |
132 | const void *addr, uint16_t addrlen) | ||
133 | { | 131 | { |
134 | struct PrintContext *pc = cls; | 132 | struct PrintContext *pc = cls; |
135 | 133 | ||
136 | GNUNET_TRANSPORT_address_lookup (cfg, | 134 | GNUNET_TRANSPORT_address_lookup (cfg, addr, addrlen, no_resolve, tname, |
137 | addr, | ||
138 | addrlen, | ||
139 | no_resolve, | ||
140 | tname, | ||
141 | GNUNET_TIME_relative_multiply | 135 | GNUNET_TIME_relative_multiply |
142 | (GNUNET_TIME_UNIT_SECONDS, 10), | 136 | (GNUNET_TIME_UNIT_SECONDS, 10), |
143 | &process_resolved_address, pc); | 137 | &process_resolved_address, pc); |
@@ -151,8 +145,7 @@ print_address (void *cls, | |||
151 | * Could of course do more (e.g. resolve via DNS). | 145 | * Could of course do more (e.g. resolve via DNS). |
152 | */ | 146 | */ |
153 | static void | 147 | static void |
154 | print_peer_info (void *cls, | 148 | print_peer_info (void *cls, const struct GNUNET_PeerIdentity *peer, |
155 | const struct GNUNET_PeerIdentity *peer, | ||
156 | const struct GNUNET_HELLO_Message *hello, const char *err_msg) | 149 | const struct GNUNET_HELLO_Message *hello, const char *err_msg) |
157 | { | 150 | { |
158 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; | 151 | struct GNUNET_CRYPTO_HashAsciiEncoded enc; |
@@ -192,9 +185,8 @@ print_peer_info (void *cls, | |||
192 | * @param c configuration | 185 | * @param c configuration |
193 | */ | 186 | */ |
194 | static void | 187 | static void |
195 | run (void *cls, | 188 | run (void *cls, char *const *args, const char *cfgfile, |
196 | char *const *args, | 189 | const struct GNUNET_CONFIGURATION_Handle *c) |
197 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) | ||
198 | { | 190 | { |
199 | struct GNUNET_CRYPTO_RsaPrivateKey *priv; | 191 | struct GNUNET_CRYPTO_RsaPrivateKey *priv; |
200 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; | 192 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; |
@@ -216,20 +208,18 @@ run (void *cls, | |||
216 | fprintf (stderr, _("Could not access PEERINFO service. Exiting.\n")); | 208 | fprintf (stderr, _("Could not access PEERINFO service. Exiting.\n")); |
217 | return; | 209 | return; |
218 | } | 210 | } |
219 | GNUNET_PEERINFO_iterate (peerinfo, | 211 | GNUNET_PEERINFO_iterate (peerinfo, NULL, |
220 | NULL, | ||
221 | GNUNET_TIME_relative_multiply | 212 | GNUNET_TIME_relative_multiply |
222 | (GNUNET_TIME_UNIT_SECONDS, 5), | 213 | (GNUNET_TIME_UNIT_SECONDS, 5), &print_peer_info, |
223 | &print_peer_info, NULL); | 214 | NULL); |
224 | } | 215 | } |
225 | else | 216 | else |
226 | { | 217 | { |
227 | if (GNUNET_OK != | 218 | if (GNUNET_OK != |
228 | GNUNET_CONFIGURATION_get_value_filename (cfg, | 219 | GNUNET_CONFIGURATION_get_value_filename (cfg, "GNUNETD", "HOSTKEY", |
229 | "GNUNETD", "HOSTKEY", &fn)) | 220 | &fn)) |
230 | { | 221 | { |
231 | fprintf (stderr, | 222 | fprintf (stderr, _("Could not find option `%s:%s' in configuration.\n"), |
232 | _("Could not find option `%s:%s' in configuration.\n"), | ||
233 | "GNUNETD", "HOSTKEYFILE"); | 223 | "GNUNETD", "HOSTKEYFILE"); |
234 | return; | 224 | return; |
235 | } | 225 | } |
@@ -276,9 +266,7 @@ main (int argc, char *const *argv) | |||
276 | GNUNET_GETOPT_OPTION_END | 266 | GNUNET_GETOPT_OPTION_END |
277 | }; | 267 | }; |
278 | return (GNUNET_OK == | 268 | return (GNUNET_OK == |
279 | GNUNET_PROGRAM_run (argc, | 269 | GNUNET_PROGRAM_run (argc, argv, "gnunet-peerinfo", |
280 | argv, | ||
281 | "gnunet-peerinfo", | ||
282 | gettext_noop ("Print information about peers."), | 270 | gettext_noop ("Print information about peers."), |
283 | options, &run, NULL)) ? 0 : 1; | 271 | options, &run, NULL)) ? 0 : 1; |
284 | } | 272 | } |