convert fs publish to MQ
[oweals/gnunet.git] / src / include / gnunet_transport_plugin.h
index 0b0be1fb978c45b858c27b0b94467c528a94b469..a07f8d163147ef8f848aba044105df00eb6037e0 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     Copyright (C) 2009-2014 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009-2014 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
 */
 
 /**
- * @file include/gnunet_transport_plugin.h
- * @brief API for the transport services.  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 transport plugins will
- *        be given the value returned by the constructor
- *        and is expected to return a NULL pointer.
  * @author Christian Grothoff
+ *
+ * @file
+ * Transport service plugin API
+ *
+ * @defgroup transport-plugin  Transport Service plugin API
+ *
+ * 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 transport plugins
+ * will be given the value returned by the constructor and is expected to return
+ * a NULL pointer.
+ *
+ * @{
  */
 #ifndef PLUGIN_TRANSPORT_H
 #define PLUGIN_TRANSPORT_H
  * connection may not have an address that can be used for meaningful
  * distinction between sessions to the same peer.
  *
- * Each 'struct Session' MUST start with the 'struct GNUNET_PeerIdentity'
+ * Each 'struct GNUNET_ATS_Session' MUST start with the 'struct GNUNET_PeerIdentity'
  * of the peer the session is for (which will be used for some error
  * checking by the ATS code).
  */
-struct Session;
+struct GNUNET_ATS_Session;
 
 
 /**
@@ -71,7 +76,7 @@ struct Session;
 typedef void
 (*GNUNET_TRANSPORT_SessionEnd) (void *cls,
                                 const struct GNUNET_HELLO_Address *address,
-                                struct Session *session);
+                                struct GNUNET_ATS_Session *session);
 
 
 /**
@@ -85,7 +90,7 @@ typedef void
 typedef void
 (*GNUNET_TRANSPORT_SessionStart) (void *cls,
                                   const struct GNUNET_HELLO_Address *address,
-                                  struct Session *session,
+                                  struct GNUNET_ATS_Session *session,
                                   enum GNUNET_ATS_Network_Type net);
 
 
@@ -114,7 +119,7 @@ typedef void
 typedef struct GNUNET_TIME_Relative
 (*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls,
                                            const struct GNUNET_HELLO_Address *address,
-                                           struct Session *session,
+                                           struct GNUNET_ATS_Session *session,
                                            const struct GNUNET_MessageHeader *message);
 
 
@@ -334,7 +339,7 @@ typedef void
  */
 typedef ssize_t
 (*GNUNET_TRANSPORT_TransmitFunction) (void *cls,
-                                      struct Session *session,
+                                      struct GNUNET_ATS_Session *session,
                                       const char *msgbuf,
                                       size_t msgbuf_size,
                                       unsigned int priority,
@@ -357,7 +362,7 @@ typedef ssize_t
  */
 typedef int
 (*GNUNET_TRANSPORT_DisconnectSessionFunction) (void *cls,
-                                               struct Session *session);
+                                               struct GNUNET_ATS_Session *session);
 
 
 /**
@@ -463,7 +468,7 @@ typedef int
  * @param address the hello address
  * @return the session if the address is valid, NULL otherwise
  */
-typedef struct Session *
+typedef struct GNUNET_ATS_Session *
 (*GNUNET_TRANSPORT_CreateSession) (void *cls,
                                    const struct GNUNET_HELLO_Address *address);
 
@@ -480,7 +485,7 @@ typedef struct Session *
 typedef void
 (*GNUNET_TRANSPORT_UpdateSessionTimeout) (void *cls,
                                           const struct GNUNET_PeerIdentity *peer,
-                                          struct Session *session);
+                                          struct GNUNET_ATS_Session *session);
 
 
 /**
@@ -496,9 +501,10 @@ typedef void
 typedef void
 (*GNUNET_TRANSPORT_UpdateInboundDelay) (void *cls,
                                         const struct GNUNET_PeerIdentity *peer,
-                                        struct Session *session,
+                                        struct GNUNET_ATS_Session *session,
                                         struct GNUNET_TIME_Relative delay);
 
+
 /**
  * Function called for a quick conversion of the binary address to
  * a numeric address.  Note that the caller must not free the
@@ -545,7 +551,19 @@ typedef int
  */
 typedef enum GNUNET_ATS_Network_Type
 (*GNUNET_TRANSPORT_GetNetworkType) (void *cls,
-                                    struct Session *session);
+                                    struct GNUNET_ATS_Session *session);
+
+
+/**
+ * Function to obtain the network type for an address.
+ *
+ * @param cls closure (`struct Plugin *`)
+ * @param address the address
+ * @return the network type
+ */
+typedef enum GNUNET_ATS_Network_Type
+(*GNUNET_TRANSPORT_GetNetworkTypeForAddress) (void *cls,
+                                              const struct GNUNET_HELLO_Address *address);
 
 
 /**
@@ -562,7 +580,7 @@ typedef enum GNUNET_ATS_Network_Type
  */
 typedef void
 (*GNUNET_TRANSPORT_SessionInfoCallback) (void *cls,
-                                         struct Session *session,
+                                         struct GNUNET_ATS_Session *session,
                                          const struct GNUNET_TRANSPORT_SessionInfo *info);
 
 
@@ -679,6 +697,11 @@ struct GNUNET_TRANSPORT_PluginFunctions
    */
   GNUNET_TRANSPORT_GetNetworkType get_network;
 
+  /**
+   * Function to obtain the network type for an address
+   */
+  GNUNET_TRANSPORT_GetNetworkTypeForAddress get_network_for_address;
+
   /**
    * Function to monitor the sessions managed by the plugin.
    */
@@ -688,4 +711,7 @@ struct GNUNET_TRANSPORT_PluginFunctions
 
 /*#ifndef PLUGIN_TRANSPORT_H*/
 #endif
+
+/** @} */  /* end of group */
+
 /* end of gnunet_transport_plugin.h */