- fix
authorMatthias Wachs <wachs@net.in.tum.de>
Thu, 26 Jan 2012 15:43:25 +0000 (15:43 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Thu, 26 Jan 2012 15:43:25 +0000 (15:43 +0000)
src/transport/gnunet-service-transport_neighbours.c
src/transport/plugin_transport_udp.c
src/transport/plugin_transport_unix.c

index d1b68be2fa8809bac55df293c1cad2fb31f074b6..786dca9f99d3925a2dc3e939b497a3dc9dd12562 100644 (file)
@@ -63,7 +63,7 @@
 
 #define SETUP_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
 
-#define  TEST_NEW_CODE GNUNET_YES
+#define  TEST_NEW_CODE GNUNET_NO
 
 /**
  * Entry in neighbours.
index 7e28dd98b77840a6f19b0dbd87ba1ee8887c084d..486f72364f5993005b77f4023169fc69aa5436d7 100644 (file)
@@ -617,6 +617,67 @@ udp_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
 }
 
 
+/**
+ * Creates a new outbound session the transport service will use to send data to the
+ * peer
+ *
+ * @param cls the plugin
+ * @param address the address
+ * @return the session or NULL of max connections exceeded
+ */
+
+static struct Session *
+udp_plugin_get_session (void *cls,
+                  const struct GNUNET_HELLO_Address *address)
+{
+  struct Session * s = NULL;
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "To be implemented\n");
+  GNUNET_break (0);
+  return s;
+}
+
+/**
+ * Function that can be used by the transport service to transmit
+ * a message using the plugin.   Note that in the case of a
+ * peer disconnecting, the continuation MUST be called
+ * prior to the disconnect notification itself.  This function
+ * will be called with this peer's HELLO message to initiate
+ * a fresh connection to another peer.
+ *
+ * @param cls closure
+ * @param session which session must be used
+ * @param msgbuf the message to transmit
+ * @param msgbuf_size number of bytes in 'msgbuf'
+ * @param priority how important is the message (most plugins will
+ *                 ignore message priority and just FIFO)
+ * @param to how long to wait at most for the transmission (does not
+ *                require plugins to discard the message after the timeout,
+ *                just advisory for the desired delay; most plugins will ignore
+ *                this as well)
+ * @param cont continuation to call once the message has
+ *        been transmitted (or if the transport is ready
+ *        for the next transmission call; or if the
+ *        peer disconnected...); can be NULL
+ * @param cont_cls closure for cont
+ * @return number of bytes used (on the physical network, with overheads);
+ *         -1 on hard errors (i.e. address invalid); 0 is a legal value
+ *         and does NOT mean that the message was not transmitted (DV)
+ */
+static ssize_t
+udp_plugin_send (void *cls,
+                  struct Session *session,
+                  const char *msgbuf, size_t msgbuf_size,
+                  unsigned int priority,
+                  struct GNUNET_TIME_Relative to,
+                  GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
+{
+  ssize_t sent = -1;
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "To be implemented\n");
+  GNUNET_break (0);
+  return sent;
+}
+
+
 /**
  * Actually send out the message.
  *
@@ -799,7 +860,7 @@ udp_call_continuation (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
  *         still be transmitted later!)
  */
 static ssize_t
-udp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
+udp_plugin_send_old (void *cls, const struct GNUNET_PeerIdentity *target,
                  const char *msgbuf, size_t msgbuf_size, unsigned int priority,
                  struct GNUNET_TIME_Relative timeout, struct Session *session,
                  const void *addr, size_t addrlen, int force_address,
@@ -2122,12 +2183,15 @@ libgnunet_plugin_transport_udp_init (void *cls)
   api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
   api->cls = plugin;
 
-  api->send = &udp_plugin_send;
+  api->send = &udp_plugin_send_old;
   api->disconnect = &udp_disconnect;
   api->address_pretty_printer = &udp_plugin_address_pretty_printer;
   api->address_to_string = &udp_address_to_string;
   api->check_address = &udp_plugin_check_address;
 
+  api->get_session = &udp_plugin_get_session;
+  api->send_with_session = &udp_plugin_send;
+
   if (GNUNET_YES ==
       GNUNET_CONFIGURATION_get_value_string (env->cfg, "transport-udp",
                                              "BINDTO", &plugin->bind4_address))
index aebfeb883f2d6f142fd77b9a7a22e495a5a8e2e7..7d41b95a70985dd4a39da4cc582364de7eeb34e4 100644 (file)
@@ -658,6 +658,67 @@ unix_real_send (void *cls, struct RetrySendContext *incoming_retry_context,
 }
 
 
+/**
+ * Creates a new outbound session the transport service will use to send data to the
+ * peer
+ *
+ * @param cls the plugin
+ * @param address the address
+ * @return the session or NULL of max connections exceeded
+ */
+
+static struct Session *
+unix_plugin_get_session (void *cls,
+                  const struct GNUNET_HELLO_Address *address)
+{
+  struct Session * s = NULL;
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "To be implemented\n");
+  GNUNET_break (0);
+  return s;
+}
+
+/**
+ * Function that can be used by the transport service to transmit
+ * a message using the plugin.   Note that in the case of a
+ * peer disconnecting, the continuation MUST be called
+ * prior to the disconnect notification itself.  This function
+ * will be called with this peer's HELLO message to initiate
+ * a fresh connection to another peer.
+ *
+ * @param cls closure
+ * @param session which session must be used
+ * @param msgbuf the message to transmit
+ * @param msgbuf_size number of bytes in 'msgbuf'
+ * @param priority how important is the message (most plugins will
+ *                 ignore message priority and just FIFO)
+ * @param to how long to wait at most for the transmission (does not
+ *                require plugins to discard the message after the timeout,
+ *                just advisory for the desired delay; most plugins will ignore
+ *                this as well)
+ * @param cont continuation to call once the message has
+ *        been transmitted (or if the transport is ready
+ *        for the next transmission call; or if the
+ *        peer disconnected...); can be NULL
+ * @param cont_cls closure for cont
+ * @return number of bytes used (on the physical network, with overheads);
+ *         -1 on hard errors (i.e. address invalid); 0 is a legal value
+ *         and does NOT mean that the message was not transmitted (DV)
+ */
+static ssize_t
+unix_plugin_send (void *cls,
+                  struct Session *session,
+                  const char *msgbuf, size_t msgbuf_size,
+                  unsigned int priority,
+                  struct GNUNET_TIME_Relative to,
+                  GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
+{
+  ssize_t sent = -1;
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "To be implemented\n");
+  GNUNET_break (0);
+  return sent;
+}
+
+
 /**
  * Function that can be used by the transport service to transmit
  * a message using the plugin.
@@ -683,7 +744,7 @@ unix_real_send (void *cls, struct RetrySendContext *incoming_retry_context,
  *         still be transmitted later!)
  */
 static ssize_t
-unix_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
+unix_plugin_send_old (void *cls, const struct GNUNET_PeerIdentity *target,
                   const char *msgbuf, size_t msgbuf_size, unsigned int priority,
                   struct GNUNET_TIME_Relative timeout, struct Session *session,
                   const void *addr, size_t addrlen, int force_address,
@@ -1086,7 +1147,9 @@ libgnunet_plugin_transport_unix_init (void *cls)
   api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
   api->cls = plugin;
 
-  api->send = &unix_plugin_send;
+  api->get_session = &unix_plugin_get_session;
+  api->send_with_session = &unix_plugin_send;
+  api->send = &unix_plugin_send_old;
   api->disconnect = &unix_disconnect;
   api->address_pretty_printer = &unix_plugin_address_pretty_printer;
   api->address_to_string = &unix_address_to_string;