RECLAIM/OIDC: code cleanup
[oweals/gnunet.git] / src / include / gnunet_ats_plugin_new.h
index 267477871ab132961176bb244a8099e1eaf58ecf..63334327282f06edd66ab58324901a991a860e15 100644 (file)
@@ -14,6 +14,8 @@
 
  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/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
  */
 
 /**
@@ -35,8 +37,7 @@
 #ifndef PLUGIN_ATS_H
 #define PLUGIN_ATS_H
 
-#include "gnunet_mq_lib.h"
-#include "gnunet_bandwidth_lib.h"
+#include "gnunet_util_lib.h"
 #include "gnunet_ats_application_service.h"
 #include "gnunet_ats_transport_service.h"
 #include "gnunet_statistics_service.h"
@@ -147,16 +148,40 @@ struct GNUNET_ATS_SolverFunctions
                    struct GNUNET_ATS_PreferenceHandle *ph,
                    const struct GNUNET_ATS_Preference *pref);
 
-
+  /**
+   * Transport established a new session with performance
+   * characteristics given in @a data.
+   *
+   * @param cls closure
+   * @param data performance characteristics of @a sh
+   * @param address address information (for debugging)
+   * @return handle by which the plugin will identify this session
+   */
   struct GNUNET_ATS_SessionHandle *
   (*session_add)(void *cls,
-                const struct GNUNET_ATS_SessionData *data);
+                const struct GNUNET_ATS_SessionData *data,
+                const char *address);
 
+  /**
+   * @a data changed for a given @a sh, solver should consider
+   * the updated performance characteristics.
+   *
+   * @param cls closure
+   * @param sh session this is about
+   * @param data performance characteristics of @a sh
+   */
   void
   (*session_update)(void *cls,
                    struct GNUNET_ATS_SessionHandle *sh,
                    const struct GNUNET_ATS_SessionData *data);
 
+  /**
+   * A session went away. Solver should update accordingly.
+   *
+   * @param cls closure
+   * @param sh session this is about
+   * @param data (last) performance characteristics of @a sh
+   */
   void
   (*session_del)(void *cls,
                 struct GNUNET_ATS_SessionHandle *sh,
@@ -164,6 +189,63 @@ struct GNUNET_ATS_SolverFunctions
   
 };
 
+
+/**
+ * The ATS plugin will pass a pointer to a struct
+ * of this type as to the initialization function
+ * of the ATS plugins.
+ */
+struct GNUNET_ATS_PluginEnvironment
+{
+  /**
+   * Configuration handle to be used by the solver
+   */
+  const struct GNUNET_CONFIGURATION_Handle *cfg;
+
+  /**
+   * Statistics handle to be used by the solver
+   */
+  struct GNUNET_STATISTICS_Handle *stats;
+
+  /**
+   * Closure to pass to all callbacks in this struct.
+   */
+  void *cls;
+
+  /**
+   * Suggest to the transport that it should try establishing
+   * a connection using the given address.
+   *
+   * @param cls closure, NULL
+   * @param pid peer this is about
+   * @param address address the transport should try
+   */
+  void
+  (*suggest_cb) (void *cls,
+                const struct GNUNET_PeerIdentity *pid,
+                const char *address);
+
+  /**
+   * Tell the transport that it should allocate the given 
+   * bandwidth to the specified session.
+   *
+   * @param cls closure, NULL
+   * @param session session this is about
+   * @param peer peer this is about
+   * @param bw_in suggested bandwidth for receiving
+   * @param bw_out suggested bandwidth for transmission
+   */
+  void
+  (*allocate_cb) (void *cls,
+                 struct GNUNET_ATS_Session *session,
+                 const struct GNUNET_PeerIdentity *peer,
+                 struct GNUNET_BANDWIDTH_Value32NBO bw_in,
+                 struct GNUNET_BANDWIDTH_Value32NBO bw_out);
+  
+};
+
+
+  
 #endif
 
 /** @} */  /* end of group */