diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-07-17 10:44:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-07-17 10:44:55 +0000 |
commit | dad8ccb2bacdea35b803737cdaf0a7b6605d2e14 (patch) | |
tree | d9efced9623be9b65723cf6eb6491dd467b3707a /src/transport/test_plugin_transport.c | |
parent | bc2398b056ea557c86173c2bb2823fbdf788c067 (diff) | |
download | gnunet-dad8ccb2bacdea35b803737cdaf0a7b6605d2e14.tar.gz gnunet-dad8ccb2bacdea35b803737cdaf0a7b6605d2e14.zip |
indentation
Diffstat (limited to 'src/transport/test_plugin_transport.c')
-rw-r--r-- | src/transport/test_plugin_transport.c | 110 |
1 files changed, 45 insertions, 65 deletions
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 180e7c073..378425471 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c | |||
@@ -1,4 +1,4 @@ | |||
1 | 1 | /* | |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2009 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
@@ -92,62 +92,55 @@ struct GNUNET_TRANSPORT_PluginFunctions *api; | |||
92 | 92 | ||
93 | /** | 93 | /** |
94 | * Initialize Environment for this plugin | 94 | * Initialize Environment for this plugin |
95 | * | ||
96 | * | ||
97 | */ | 95 | */ |
98 | 96 | struct ReadyList * | |
99 | struct ReadyList * receive(void *cls,void *plugin_context, | 97 | receive(void *cls,void *plugin_context, |
100 | struct ReadyList * | 98 | struct ReadyList * |
101 | service_context, | 99 | service_context, |
102 | struct GNUNET_TIME_Relative | 100 | struct GNUNET_TIME_Relative |
103 | latency, | 101 | latency, |
104 | const struct GNUNET_PeerIdentity | 102 | const struct GNUNET_PeerIdentity |
105 | * peer, | 103 | * peer, |
106 | const struct GNUNET_MessageHeader | 104 | const struct GNUNET_MessageHeader |
107 | * message){ | 105 | * message) |
108 | 106 | { | |
109 | return NULL; | 107 | return NULL; |
110 | } | 108 | } |
111 | 109 | ||
112 | void notify_address(void *cls, | 110 | void notify_address(void *cls, |
113 | const char *name, | 111 | const char *name, |
114 | const void *addr, | 112 | const void *addr, |
115 | size_t addrlen, | 113 | size_t addrlen, |
116 | struct | 114 | struct |
117 | GNUNET_TIME_Relative | 115 | GNUNET_TIME_Relative |
118 | expires) | 116 | expires) |
119 | { | 117 | { |
120 | |||
121 | |||
122 | |||
123 | } | 118 | } |
124 | 119 | ||
125 | void lookup (void *cls, | 120 | void lookup (void *cls, |
126 | struct GNUNET_TIME_Relative | 121 | struct GNUNET_TIME_Relative |
127 | timeout, | 122 | timeout, |
128 | const struct | 123 | const struct |
129 | GNUNET_PeerIdentity * target, | 124 | GNUNET_PeerIdentity * target, |
130 | GNUNET_TRANSPORT_AddressCallback | 125 | GNUNET_TRANSPORT_AddressCallback |
131 | iter, void *iter_cls){ | 126 | iter, void *iter_cls) |
132 | 127 | { | |
133 | |||
134 | } | 128 | } |
135 | 129 | ||
136 | 130 | ||
137 | static void setup_plugin_environment() | 131 | static void setup_plugin_environment() |
138 | { | 132 | { |
139 | 133 | env.cfg = cfg; | |
140 | 134 | env.sched = sched; | |
141 | env.cfg = cfg; | 135 | env.my_public_key = my_public_key; |
142 | env.sched = sched; | 136 | env.cls=&env; |
143 | env.my_public_key = my_public_key; | 137 | env.receive=&receive; |
144 | env.cls=&env; | 138 | env.lookup=&lookup; |
145 | env.receive=&receive; | 139 | env.notify_address=¬ify_address; |
146 | env.lookup=&lookup; | 140 | env.max_connections = max_connect_per_transport; |
147 | env.notify_address=¬ify_address; | ||
148 | env.max_connections = max_connect_per_transport; | ||
149 | |||
150 | } | 141 | } |
142 | |||
143 | |||
151 | /** | 144 | /** |
152 | * Initiate transport service. | 145 | * Initiate transport service. |
153 | * | 146 | * |
@@ -160,11 +153,10 @@ static void | |||
160 | run (void *cls, | 153 | run (void *cls, |
161 | struct GNUNET_SCHEDULER_Handle *s, | 154 | struct GNUNET_SCHEDULER_Handle *s, |
162 | struct GNUNET_SERVER_Handle *serv, struct GNUNET_CONFIGURATION_Handle *c) | 155 | struct GNUNET_SERVER_Handle *serv, struct GNUNET_CONFIGURATION_Handle *c) |
163 | { | 156 | { |
164 | |||
165 | |||
166 | unsigned long long tneigh; | 157 | unsigned long long tneigh; |
167 | char *keyfile; | 158 | char *keyfile; |
159 | char *libname; | ||
168 | 160 | ||
169 | sched = s; | 161 | sched = s; |
170 | cfg = c; | 162 | cfg = c; |
@@ -181,8 +173,7 @@ run (void *cls, | |||
181 | "HOSTKEY", &keyfile))) | 173 | "HOSTKEY", &keyfile))) |
182 | { | 174 | { |
183 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 175 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
184 | _ | 176 | _("Transport service is lacking key configuration settings. Exiting.\n")); |
185 | ("Transport service is lacking key configuration settings. Exiting.\n")); | ||
186 | GNUNET_SCHEDULER_shutdown (s); | 177 | GNUNET_SCHEDULER_shutdown (s); |
187 | return; | 178 | return; |
188 | } | 179 | } |
@@ -192,8 +183,7 @@ run (void *cls, | |||
192 | if (my_private_key == NULL) | 183 | if (my_private_key == NULL) |
193 | { | 184 | { |
194 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 185 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
195 | _ | 186 | _("Transport service could not access hostkey. Exiting.\n")); |
196 | ("Transport service could not access hostkey. Exiting.\n")); | ||
197 | GNUNET_SCHEDULER_shutdown (s); | 187 | GNUNET_SCHEDULER_shutdown (s); |
198 | return; | 188 | return; |
199 | } | 189 | } |
@@ -203,25 +193,19 @@ run (void *cls, | |||
203 | 193 | ||
204 | 194 | ||
205 | 195 | ||
206 | /* load plugins... */ | 196 | /* load plugins... */ |
207 | |||
208 | |||
209 | |||
210 | setup_plugin_environment(); | 197 | setup_plugin_environment(); |
211 | char *libname; | ||
212 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 198 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
213 | _("Loading tcp transport plugin\n")); | 199 | _("Loading tcp transport plugin\n")); |
214 | GNUNET_asprintf (&libname, "libgnunet_plugin_transport_tcp"); | 200 | GNUNET_asprintf (&libname, "libgnunet_plugin_transport_tcp"); |
215 | 201 | ||
216 | api = GNUNET_PLUGIN_load(libname,&env); | 202 | api = GNUNET_PLUGIN_load(libname, &env); |
217 | |||
218 | if (api == NULL) | 203 | if (api == NULL) |
219 | { | 204 | { |
220 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 205 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
221 | _("Failed to load transport plugin for tcp\n")); | 206 | _("Failed to load transport plugin for tcp\n")); |
222 | } | 207 | } |
223 | 208 | ||
224 | |||
225 | } | 209 | } |
226 | 210 | ||
227 | 211 | ||
@@ -234,8 +218,7 @@ run (void *cls, | |||
234 | */ | 218 | */ |
235 | static void | 219 | static void |
236 | unload_plugins (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg) | 220 | unload_plugins (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg) |
237 | { | 221 | { |
238 | |||
239 | GNUNET_assert (NULL == GNUNET_PLUGIN_unload ("libgnunet_plugin_transport_tcp",api)); | 222 | GNUNET_assert (NULL == GNUNET_PLUGIN_unload ("libgnunet_plugin_transport_tcp",api)); |
240 | if (my_private_key != NULL) | 223 | if (my_private_key != NULL) |
241 | GNUNET_CRYPTO_rsa_key_free (my_private_key); | 224 | GNUNET_CRYPTO_rsa_key_free (my_private_key); |
@@ -259,10 +242,7 @@ main (int argc, char *const *argv) | |||
259 | #else | 242 | #else |
260 | "WARNING", | 243 | "WARNING", |
261 | #endif | 244 | #endif |
262 | NULL); | 245 | NULL); |
263 | |||
264 | |||
265 | |||
266 | return (GNUNET_OK == | 246 | return (GNUNET_OK == |
267 | GNUNET_SERVICE_run (argc, | 247 | GNUNET_SERVICE_run (argc, |
268 | argv, | 248 | argv, |