aboutsummaryrefslogtreecommitdiff
path: root/src/ats/test_ats_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-08-29 16:17:28 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-08-29 16:17:28 +0000
commit3c9b3f415156a699558e7494862c4bbbe22c31f0 (patch)
tree5ca8885e1e2fa72df234ebc8df111bd7e6a336cf /src/ats/test_ats_api.c
parent98e9dc065ff9f863d1e53264bb770d0a9c3954a9 (diff)
downloadgnunet-3c9b3f415156a699558e7494862c4bbbe22c31f0.tar.gz
gnunet-3c9b3f415156a699558e7494862c4bbbe22c31f0.zip
fundamentals for an ats test
Diffstat (limited to 'src/ats/test_ats_api.c')
-rw-r--r--src/ats/test_ats_api.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/ats/test_ats_api.c b/src/ats/test_ats_api.c
new file mode 100644
index 000000000..0d4d65e94
--- /dev/null
+++ b/src/ats/test_ats_api.c
@@ -0,0 +1,92 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010,2011 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20/**
21 * @file ats/ats_api.c
22 * @brief automatic transport selection API
23 * @author Christian Grothoff
24 * @author Matthias Wachs
25 *
26 * TODO:
27 * - write test case
28 * - extend API to get performance data
29 * - implement simplistic strategy based on say 'lowest latency' or strict ordering
30 * - extend API to get peer preferences, implement proportional bandwidth assignment
31 * - re-implement API against a real ATS service (!)
32 */
33#include "platform.h"
34#include "gnunet_ats_service.h"
35
36#define VERBOSE GNUNET_NO
37
38#define VERBOSE_ARM GNUNET_NO
39
40#define START_ARM GNUNET_YES
41
42
43static struct GNUNET_CONFIGURATION_Handle *cfg;
44
45static struct GNUNET_ATS_Handle *ats;
46
47static void
48alloc_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
49 const char *plugin_name, struct Session *session,
50 const void *plugin_addr, size_t plugin_addr_len,
51 struct GNUNET_BANDWIDTH_Value32NBO bandwidth)
52{
53
54}
55
56static int
57check ()
58{
59 int ret = 0;
60
61 cfg = GNUNET_CONFIGURATION_create ();
62 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, "test_ats_api.conf"))
63 {
64 GNUNET_CONFIGURATION_destroy (cfg);
65 return -1;
66 }
67
68 ats = GNUNET_ATS_init (cfg, alloc_cb, NULL);
69 GNUNET_assert (ats != NULL);
70 GNUNET_ATS_shutdown (ats);
71
72 GNUNET_CONFIGURATION_destroy (cfg);
73 return ret;
74}
75
76int
77main (int argc, char *argv[])
78{
79 int ret;
80
81 GNUNET_log_setup ("test-ats-api",
82#if VERBOSE
83 "DEBUG",
84#else
85 "WARNING",
86#endif
87 NULL);
88
89 ret = check ();
90
91 return ret;
92}