aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/test_conversation_api_reject.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-06-03 00:44:25 +0200
committerChristian Grothoff <christian@grothoff.org>2019-06-03 00:44:25 +0200
commit34c8bfb80b82a1a7f7d3db3c41e705b09a1fad7e (patch)
tree601520ce682cf786bc4f34b6e4d95a9061bd48af /src/conversation/test_conversation_api_reject.c
parent3d9f1acfb62cd53fc7d1441eb33e1341c9ff3790 (diff)
downloadgnunet-34c8bfb80b82a1a7f7d3db3c41e705b09a1fad7e.tar.gz
gnunet-34c8bfb80b82a1a7f7d3db3c41e705b09a1fad7e.zip
fix build issues
Diffstat (limited to 'src/conversation/test_conversation_api_reject.c')
-rw-r--r--src/conversation/test_conversation_api_reject.c96
1 files changed, 38 insertions, 58 deletions
diff --git a/src/conversation/test_conversation_api_reject.c b/src/conversation/test_conversation_api_reject.c
index dc4785258..49dc854ed 100644
--- a/src/conversation/test_conversation_api_reject.c
+++ b/src/conversation/test_conversation_api_reject.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -74,9 +74,7 @@ disable_speaker (void *cls)
74 74
75 75
76static void 76static void
77play (void *cls, 77play (void *cls, size_t data_size, const void *data)
78 size_t data_size,
79 const void *data)
80{ 78{
81 (void) cls; 79 (void) cls;
82 (void) data_size; 80 (void) data_size;
@@ -92,13 +90,11 @@ destroy_speaker (void *cls)
92} 90}
93 91
94 92
95static struct GNUNET_SPEAKER_Handle call_speaker = { 93static struct GNUNET_SPEAKER_Handle call_speaker = {&enable_speaker,
96 &enable_speaker, 94 &play,
97 &play, 95 &disable_speaker,
98 &disable_speaker, 96 &destroy_speaker,
99 &destroy_speaker, 97 "caller"};
100 "caller"
101};
102 98
103 99
104static int 100static int
@@ -129,12 +125,10 @@ destroy_mic (void *cls)
129} 125}
130 126
131 127
132static struct GNUNET_MICROPHONE_Handle call_mic = { 128static struct GNUNET_MICROPHONE_Handle call_mic = {&enable_mic,
133 &enable_mic, 129 &disable_mic,
134 &disable_mic, 130 &destroy_mic,
135 &destroy_mic, 131 "caller"};
136 "caller"
137};
138 132
139 133
140/** 134/**
@@ -159,8 +153,7 @@ end_test (void *cls)
159 } 153 }
160 if (NULL != phone) 154 if (NULL != phone)
161 { 155 {
162 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from PHONE service.\n");
163 "Disconnecting from PHONE service.\n");
164 GNUNET_CONVERSATION_phone_destroy (phone); 157 GNUNET_CONVERSATION_phone_destroy (phone);
165 phone = NULL; 158 phone = NULL;
166 } 159 }
@@ -188,8 +181,8 @@ phone_event_handler (void *cls,
188 struct GNUNET_CONVERSATION_Caller *caller, 181 struct GNUNET_CONVERSATION_Caller *caller,
189 const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id) 182 const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id)
190{ 183{
191 static enum GNUNET_CONVERSATION_PhoneEventCode expect 184 static enum GNUNET_CONVERSATION_PhoneEventCode expect =
192 = GNUNET_CONVERSATION_EC_PHONE_RING; 185 GNUNET_CONVERSATION_EC_PHONE_RING;
193 186
194 (void) cls; 187 (void) cls;
195 (void) caller_id; 188 (void) caller_id;
@@ -207,11 +200,10 @@ phone_event_handler (void *cls,
207 200
208 201
209static void 202static void
210call_event_handler (void *cls, 203call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
211 enum GNUNET_CONVERSATION_CallEventCode code)
212{ 204{
213 static enum GNUNET_CONVERSATION_CallEventCode expect 205 static enum GNUNET_CONVERSATION_CallEventCode expect =
214 = GNUNET_CONVERSATION_EC_CALL_RINGING; 206 GNUNET_CONVERSATION_EC_CALL_RINGING;
215 207
216 (void) cls; 208 (void) cls;
217 GNUNET_break (code == expect); 209 GNUNET_break (code == expect);
@@ -242,6 +234,7 @@ call_event_handler (void *cls,
242 234
243static void 235static void
244caller_ego_create_cont (void *cls, 236caller_ego_create_cont (void *cls,
237 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk,
245 const char *emsg) 238 const char *emsg)
246{ 239{
247 (void) cls; 240 (void) cls;
@@ -251,19 +244,14 @@ caller_ego_create_cont (void *cls,
251 244
252 245
253static void 246static void
254namestore_put_cont (void *cls, 247namestore_put_cont (void *cls, int32_t success, const char *emsg)
255 int32_t success,
256 const char *emsg)
257{ 248{
258 (void) cls; 249 (void) cls;
259 qe = NULL; 250 qe = NULL;
260 GNUNET_assert (GNUNET_YES == success); 251 GNUNET_assert (GNUNET_YES == success);
261 GNUNET_assert (NULL == emsg); 252 GNUNET_assert (NULL == emsg);
262 GNUNET_assert (NULL == op); 253 GNUNET_assert (NULL == op);
263 op = GNUNET_IDENTITY_create (id, 254 op = GNUNET_IDENTITY_create (id, "caller-ego", &caller_ego_create_cont, NULL);
264 "caller-ego",
265 &caller_ego_create_cont,
266 NULL);
267} 255}
268 256
269 257
@@ -288,23 +276,21 @@ identity_cb (void *cls,
288 GNUNET_asprintf (&gns_name, 276 GNUNET_asprintf (&gns_name,
289 "phone.%s", 277 "phone.%s",
290 GNUNET_GNSRECORD_pkey_to_zkey (&pub)); 278 GNUNET_GNSRECORD_pkey_to_zkey (&pub));
291 phone = GNUNET_CONVERSATION_phone_create (cfg, 279 phone =
292 ego, 280 GNUNET_CONVERSATION_phone_create (cfg, ego, &phone_event_handler, NULL);
293 &phone_event_handler,
294 NULL);
295 GNUNET_assert (NULL != phone); 281 GNUNET_assert (NULL != phone);
296 memset (&rd, 0, sizeof (rd)); 282 memset (&rd, 0, sizeof (rd));
297 GNUNET_CONVERSATION_phone_get_record (phone, 283 GNUNET_CONVERSATION_phone_get_record (phone, &rd);
298 &rd);
299 GNUNET_assert (rd.record_type == GNUNET_GNSRECORD_TYPE_PHONE); 284 GNUNET_assert (rd.record_type == GNUNET_GNSRECORD_TYPE_PHONE);
300 rd.expiration_time = UINT64_MAX; 285 rd.expiration_time = UINT64_MAX;
301 qe = GNUNET_NAMESTORE_records_store (ns, 286 qe =
302 GNUNET_IDENTITY_ego_get_private_key (ego), 287 GNUNET_NAMESTORE_records_store (ns,
303 "phone" /* GNS label */, 288 GNUNET_IDENTITY_ego_get_private_key (ego),
304 1, 289 "phone" /* GNS label */,
305 &rd, 290 1,
306 &namestore_put_cont, 291 &rd,
307 NULL); 292 &namestore_put_cont,
293 NULL);
308 return; 294 return;
309 } 295 }
310 if (0 == strcmp (name, "caller-ego")) 296 if (0 == strcmp (name, "caller-ego"))
@@ -326,8 +312,7 @@ identity_cb (void *cls,
326 312
327 313
328static void 314static void
329phone_ego_create_cont (void *cls, 315phone_ego_create_cont (void *cls, const char *emsg)
330 const char *emsg)
331{ 316{
332 (void) cls; 317 (void) cls;
333 op = NULL; 318 op = NULL;
@@ -343,15 +328,9 @@ run (void *cls,
343 (void) cls; 328 (void) cls;
344 (void) peer; 329 (void) peer;
345 cfg = c; 330 cfg = c;
346 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, 331 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, NULL);
347 NULL); 332 id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
348 id = GNUNET_IDENTITY_connect (cfg, 333 op = GNUNET_IDENTITY_create (id, "phone-ego", &phone_ego_create_cont, NULL);
349 &identity_cb,
350 NULL);
351 op = GNUNET_IDENTITY_create (id,
352 "phone-ego",
353 &phone_ego_create_cont,
354 NULL);
355 ns = GNUNET_NAMESTORE_connect (cfg); 334 ns = GNUNET_NAMESTORE_connect (cfg);
356} 335}
357 336
@@ -362,8 +341,9 @@ main (int argc, char *argv[])
362 (void) argc; 341 (void) argc;
363 (void) argv; 342 (void) argv;
364 if (0 != GNUNET_TESTING_peer_run ("test_conversation_api", 343 if (0 != GNUNET_TESTING_peer_run ("test_conversation_api",
365 "test_conversation.conf", 344 "test_conversation.conf",
366 &run, NULL)) 345 &run,
346 NULL))
367 return 1; 347 return 1;
368 return ok; 348 return ok;
369} 349}