update tests to use new MQ API
[oweals/gnunet.git] / src / ats / gnunet-service-ats_preferences.h
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2011-2014 GNUnet e.V.
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., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19  */
20 /**
21  * @file ats/gnunet-service-ats_preferences.h
22  * @brief manage preferences expressed by clients
23  * @author Matthias Wachs
24  * @author Christian Grothoff
25  */
26 #ifndef GNUNET_SERVICE_ATS_PREFERENCES_H
27 #define GNUNET_SERVICE_ATS_PREFERENCES_H
28
29 #include "gnunet_util_lib.h"
30 #include "gnunet_ats_service.h"
31 #include "gnunet-service-ats.h"
32 #include "gnunet_statistics_service.h"
33 #include "ats.h"
34
35 /**
36  * Default preference value we assume if we know nothing.
37  */
38 #define DEFAULT_ABS_PREFERENCE 0.0
39
40 /**
41  * Default relative preference value we assume if we know nothing.
42  */
43 #define DEFAULT_REL_PREFERENCE 0.0
44
45
46 /**
47  * Handle 'preference change' messages from clients.
48  *
49  * @param cls unused, NULL
50  * @param client client that sent the request
51  * @param message the request message
52  */
53 void
54 GAS_handle_preference_change (void *cls,
55                               struct GNUNET_SERVER_Client *client,
56                               const struct GNUNET_MessageHeader *message);
57
58
59 /**
60  * Initialize preferences subsystem.
61  */
62 void
63 GAS_preference_init (void);
64
65
66 /**
67  * Shutdown preferences subsystem.
68  */
69 void
70 GAS_preference_done (void);
71
72
73 /**
74  * Get the normalized preference values for a specific peer.
75  *
76  * @param cls ignored
77  * @param id the peer
78  * @return pointer to the values, can be indexed
79  *  with `enum GNUNET_ATS_PreferenceKind`, never NULL
80  */
81 const double *
82 GAS_preference_get_by_peer (void *cls,
83                             const struct GNUNET_PeerIdentity *id);
84
85
86 /**
87  * A performance client disconnected
88  *
89  * @param client the disconnecting client
90  */
91 void
92 GAS_preference_client_disconnect (struct GNUNET_SERVER_Client *client);
93
94
95 #endif