aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-01-12 13:23:14 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-01-12 13:23:14 +0000
commit82892f3f69a9d5ba51dc7acc17b4680292b85f5a (patch)
tree4fc4e5ffc065e247dd9bf3a5b52b2a6248f10af0
parent792e574709745c6ebef2bf8d1d003fc527539e1e (diff)
downloadgnunet-82892f3f69a9d5ba51dc7acc17b4680292b85f5a.tar.gz
gnunet-82892f3f69a9d5ba51dc7acc17b4680292b85f5a.zip
- fundamentals for mlp implementation
-rw-r--r--src/ats/Makefile.am2
-rw-r--r--src/ats/gnunet-service-ats_addresses.c6
-rw-r--r--src/ats/gnunet-service-ats_addresses_mlp.c56
-rw-r--r--src/ats/gnunet-service-ats_addresses_mlp.h61
4 files changed, 125 insertions, 0 deletions
diff --git a/src/ats/Makefile.am b/src/ats/Makefile.am
index f2fe12b44..912912a8a 100644
--- a/src/ats/Makefile.am
+++ b/src/ats/Makefile.am
@@ -15,6 +15,7 @@ endif
15 15
16if HAVE_LIBGLPK 16if HAVE_LIBGLPK
17 GN_LIBGLPK = -lglpk 17 GN_LIBGLPK = -lglpk
18 GN_MLP_SRC = gnunet-service-ats_addresses_mlp.c gnunet-service-ats_addresses_mlp.h
18endif 19endif
19 20
20lib_LTLIBRARIES = libgnunetats.la 21lib_LTLIBRARIES = libgnunetats.la
@@ -37,6 +38,7 @@ bin_PROGRAMS = \
37gnunet_service_ats_SOURCES = \ 38gnunet_service_ats_SOURCES = \
38 gnunet-service-ats.c gnunet-service-ats.h\ 39 gnunet-service-ats.c gnunet-service-ats.h\
39 gnunet-service-ats_addresses.c gnunet-service-ats_addresses.h \ 40 gnunet-service-ats_addresses.c gnunet-service-ats_addresses.h \
41 $(GN_MLP_SRC) \
40 gnunet-service-ats_performance.c gnunet-service-ats_performance.h \ 42 gnunet-service-ats_performance.c gnunet-service-ats_performance.h \
41 gnunet-service-ats_scheduling.c gnunet-service-ats_scheduling.h \ 43 gnunet-service-ats_scheduling.c gnunet-service-ats_scheduling.h \
42 gnunet-service-ats_reservations.c gnunet-service-ats_reservations.h 44 gnunet-service-ats_reservations.c gnunet-service-ats_reservations.h
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index de62379f6..5837260b8 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -28,6 +28,7 @@
28#include "gnunet_ats_service.h" 28#include "gnunet_ats_service.h"
29#include "gnunet-service-ats.h" 29#include "gnunet-service-ats.h"
30#include "gnunet-service-ats_addresses.h" 30#include "gnunet-service-ats_addresses.h"
31#include "gnunet-service-ats_addresses_mlp.h"
31#include "gnunet-service-ats_performance.h" 32#include "gnunet-service-ats_performance.h"
32#include "gnunet-service-ats_scheduling.h" 33#include "gnunet-service-ats_scheduling.h"
33#include "gnunet-service-ats_reservations.h" 34#include "gnunet-service-ats_reservations.h"
@@ -506,6 +507,7 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
506 break; 507 break;
507#else 508#else
508 ats_mode = MLP; 509 ats_mode = MLP;
510 GAS_mlp_init ();
509#endif 511#endif
510 break; 512 break;
511 /* MLP = NO */ 513 /* MLP = NO */
@@ -560,6 +562,10 @@ GAS_addresses_done ()
560 GAS_addresses_destroy_all (); 562 GAS_addresses_destroy_all ();
561 GNUNET_CONTAINER_multihashmap_destroy (addresses); 563 GNUNET_CONTAINER_multihashmap_destroy (addresses);
562 addresses = NULL; 564 addresses = NULL;
565 if (ats_mode == MLP)
566 {
567 GAS_mlp_done ();
568 }
563} 569}
564 570
565 571
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c
new file mode 100644
index 000000000..6352412f4
--- /dev/null
+++ b/src/ats/gnunet-service-ats_addresses_mlp.c
@@ -0,0 +1,56 @@
1/*
2 This file is part of GNUnet.
3 (C) 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/**
22 * @file ats/gnunet-service-ats_addresses_mlp.c
23 * @brief ats mlp problem solver
24 * @author Matthias Wachs
25 * @author Christian Grothoff
26 */
27#include "platform.h"
28#include "gnunet_util_lib.h"
29#include "gnunet-service-ats_addresses_mlp.h"
30#if HAVE_LIBGLPK
31#include "glpk.h"
32#endif
33
34struct GAS_MLP_Handle *GAS_mlp;
35
36/**
37 * Init the MLP problem solving component
38 */
39void
40GAS_mlp_init ()
41{
42 GAS_mlp = GNUNET_malloc (sizeof (struct GAS_MLP_Handle));
43 GAS_mlp->prob = NULL;
44}
45
46/**
47 * Shutdown the MLP problem solving component
48 */
49void
50GAS_mlp_done ()
51{
52 GNUNET_free (GAS_mlp);
53}
54
55
56/* end of gnunet-service-ats_addresses_mlp.c */
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.h b/src/ats/gnunet-service-ats_addresses_mlp.h
new file mode 100644
index 000000000..3351ca541
--- /dev/null
+++ b/src/ats/gnunet-service-ats_addresses_mlp.h
@@ -0,0 +1,61 @@
1/*
2 This file is part of GNUnet.
3 (C) 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/**
22 * @file ats/gnunet-service-ats_addresses_mlp.h
23 * @brief ats mlp problem solver
24 * @author Matthias Wachs
25 * @author Christian Grothoff
26 */
27#include "platform.h"
28#if HAVE_LIBGLPK
29#include "glpk.h"
30#endif
31
32#ifndef GNUNET_SERVICE_ATS_ADDRESSES_MLP_H
33#define GNUNET_SERVICE_ATS_ADDRESSES_MLP_H
34
35struct GAS_MLP_Handle
36{
37 /**
38 * GLPK (MLP) problem object
39 */
40#if HAVE_LIBGLPK
41 glp_prob *prob;
42#else
43 void *prob;
44#endif
45
46};
47
48/**
49 * Init the MLP problem solving component
50 */
51void
52GAS_mlp_init ();
53
54/**
55 * Shutdown the MLP problem solving component
56 */
57void
58GAS_mlp_done ();
59
60#endif
61/* end of gnunet-service-ats_addresses_mlp.h */