fix bad free
[oweals/gnunet.git] / src / include / gnunet_ats_plugin.h
index e57b95a0f218fb1df86e23c26fd0cca30612fcad..d414d5f4ccec7ac6eceadb4eb09551482c8798db 100644 (file)
@@ -1,32 +1,36 @@
 /*
  This file is part of GNUnet
- Copyright (C) 2009-2015 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009-2015 GNUnet e.V.
 
- GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
 
  GNUnet is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- General Public License for more details.
Affero General Public License for more details.
 
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING.  If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ You should have received a copy of the GNU Affero General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /**
- * @file include/gnunet_ats_plugin.h
- * @brief API for the ATS solvers.  This header
- *        specifies the struct that is given to the plugin's entry
- *        method and the other struct that must be returned.
- *        Note that the destructors of ATS plugins will
- *        be given the value returned by the constructor
- *        and is expected to return a NULL pointer.
  * @author Christian Grothoff
+ *
+ * @file
+ * API for the ATS solvers.
+ *
+ * @defgroup ats-plugin  ATS service plugin API
+ * Plugin API for the ATS service.
+ *
+ * Specifies the struct that is given to the plugin's entry method and the other
+ * struct that must be returned.  Note that the destructors of ATS plugins will
+ * be given the value returned by the constructor and is expected to return a
+ * NULL pointer.
+ *
+ * @{
  */
 #ifndef PLUGIN_ATS_H
 #define PLUGIN_ATS_H
 #include "gnunet_ats_service.h"
 #include "gnunet_statistics_service.h"
 
-
 /**
  * Representation of an address the plugin can choose from.
  */
 struct ATS_Address;
 
-
 /**
  * Change the preference for a peer
  *
@@ -70,7 +72,7 @@ typedef void
  */
 typedef void
 (*GAS_solver_address_feedback_preference) (void *solver,
-                                           struct GNUNET_SERVER_Client *application,
+                                           struct GNUNET_SERVICE_Client *application,
                                            const struct GNUNET_PeerIdentity *peer,
                                            const struct GNUNET_TIME_Relative scope,
                                            enum GNUNET_ATS_PreferenceKind kind,
@@ -114,12 +116,10 @@ typedef void
  *
  * @param solver the solver Handle
  * @param address the address to delete
- * @param session_only remove address or just session
  */
 typedef void
 (*GAS_solver_address_delete) (void *solver,
-                              struct ATS_Address *address,
-                              int session_only);
+                              struct ATS_Address *address);
 
 
 /**
@@ -127,16 +127,10 @@ typedef void
  *
  * @param solver solver handle
  * @param address the address
- * @param type the ATSI type in HBO
- * @param abs_value the absolute value of the property
- * @param rel_value the normalized value
  */
 typedef void
 (*GAS_solver_address_property_changed) (void *solver,
-                                        struct ATS_Address *address,
-                                        uint32_t type,
-                                        uint32_t abs_value,
-                                        double rel_value);
+                                        struct ATS_Address *address);
 
 
 /**
@@ -145,7 +139,7 @@ typedef void
  * @param solver the solver to use
  * @param peer the peer
  */
-typedef const struct ATS_Address *
+typedef void
 (*GAS_solver_get_preferred_address) (void *solver,
                                      const struct GNUNET_PeerIdentity *peer);
 
@@ -388,8 +382,8 @@ typedef void
 
 
 /**
- * Callback to call from solver to obtain application preference values for a
- * peer
+ * Callback to call from solver to obtain application preference
+ * values for a peer.
  *
  * @param cls the cls
  * @param id the peer id
@@ -402,17 +396,17 @@ typedef const double *
 
 
 /**
- * Callback to call from solver to obtain transport properties for an
- * address
+ * Callback to call from solver to obtain application connectivity
+ * preferences for a peer.
  *
  * @param cls the cls
- * @param address the address
- * @return carry of double values containing the preferences with
- *      GNUNET_ATS_PreferenceCount elements
+ * @param id the peer id
+ * @return 0 if connectivity is not desired, non-null if address
+ *      suggestions are requested
  */
-typedef const double *
-(*GAS_get_properties) (void *cls,
-                       const struct ATS_Address *address);
+typedef unsigned int
+(*GAS_get_connectivity) (void *cls,
+                         const struct GNUNET_PeerIdentity *id);
 
 
 /**
@@ -453,9 +447,9 @@ struct GNUNET_ATS_PluginEnvironment
   GAS_get_preferences get_preferences;
 
   /**
-   * ATS addresses function to obtain property values
+   * ATS addresses function to obtain preference values
    */
-  GAS_get_properties get_property;
+  GAS_get_connectivity get_connectivity;
 
   /**
    * Callback for solver to call with status information,
@@ -483,3 +477,5 @@ struct GNUNET_ATS_PluginEnvironment
 };
 
 #endif
+
+/** @} */  /* end of group */