refactor DHT for new service API
[oweals/gnunet.git] / src / cadet / gnunet-service-cadet_channel.h
index f5a89a4233016e7b48e8000c25beb1c9faea737b..eeea02712f098311440c1a9cd783d03590e85628 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2013 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
@@ -14,8 +14,8 @@
 
      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.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -59,7 +59,7 @@ struct CadetChannel;
  * @param ch Channel to destroy.
  */
 void
-GMCH_destroy (struct CadetChannel *ch);
+GCCH_destroy (struct CadetChannel *ch);
 
 
 /**
@@ -70,7 +70,7 @@ GMCH_destroy (struct CadetChannel *ch);
  * @return ID used to identify the channel with the remote peer.
  */
 CADET_ChannelNumber
-GMCH_get_id (const struct CadetChannel *ch);
+GCCH_get_id (const struct CadetChannel *ch);
 
 /**
  * Get the channel tunnel.
@@ -79,8 +79,8 @@ GMCH_get_id (const struct CadetChannel *ch);
  *
  * @return tunnel of the channel.
  */
-struct CadetTunnel3 *
-GMCH_get_tunnel (const struct CadetChannel *ch);
+struct CadetTunnel *
+GCCH_get_tunnel (const struct CadetChannel *ch);
 
 /**
  * Get free buffer space towards the client on a specific channel.
@@ -91,7 +91,7 @@ GMCH_get_tunnel (const struct CadetChannel *ch);
  * @return Free buffer space [0 - 64]
  */
 unsigned int
-GMCH_get_buffer (struct CadetChannel *ch, int fwd);
+GCCH_get_buffer (struct CadetChannel *ch, int fwd);
 
 
 /**
@@ -103,7 +103,7 @@ GMCH_get_buffer (struct CadetChannel *ch, int fwd);
  * @return #GNUNET_YES if client is allowed to send us data.
  */
 int
-GMCH_get_allowed (struct CadetChannel *ch, int fwd);
+GCCH_get_allowed (struct CadetChannel *ch, int fwd);
 
 
 /**
@@ -115,7 +115,7 @@ GMCH_get_allowed (struct CadetChannel *ch, int fwd);
  * @return #GNUNET_YES in case it is.
  */
 int
-GMCH_is_origin (struct CadetChannel *ch, int fwd);
+GCCH_is_origin (struct CadetChannel *ch, int fwd);
 
 /**
  * Is the destination client for this channel on this peer?
@@ -126,7 +126,7 @@ GMCH_is_origin (struct CadetChannel *ch, int fwd);
  * @return #GNUNET_YES in case it is.
  */
 int
-GMCH_is_terminal (struct CadetChannel *ch, int fwd);
+GCCH_is_terminal (struct CadetChannel *ch, int fwd);
 
 /**
  * Send an end-to-end ACK message for the most recent in-sequence payload.
@@ -137,7 +137,7 @@ GMCH_is_terminal (struct CadetChannel *ch, int fwd);
  * @param fwd Is for FWD traffic? (ACK dest->owner)
  */
 void
-GMCH_send_data_ack (struct CadetChannel *ch, int fwd);
+GCCH_send_data_ack (struct CadetChannel *ch, int fwd);
 
 /**
  * Notify the destination client that a new incoming channel was created.
@@ -145,7 +145,7 @@ GMCH_send_data_ack (struct CadetChannel *ch, int fwd);
  * @param ch Channel that was created.
  */
 void
-GMCH_send_create (struct CadetChannel *ch);
+GCCH_send_create (struct CadetChannel *ch);
 
 /**
  * Allow a client to send us more data, in case it was choked.
@@ -154,15 +154,16 @@ GMCH_send_create (struct CadetChannel *ch);
  * @param fwd Is this about FWD traffic? (Root client).
  */
 void
-GMCH_allow_client (struct CadetChannel *ch, int fwd);
+GCCH_allow_client (struct CadetChannel *ch, int fwd);
 
 /**
  * Log channel info.
  *
  * @param ch Channel.
+ * @param level Debug level to use.
  */
 void
-GMCH_debug (struct CadetChannel *ch);
+GCCH_debug (struct CadetChannel *ch, enum GNUNET_ErrorType level);
 
 /**
  * Handle an ACK given by a client.
@@ -173,7 +174,7 @@ GMCH_debug (struct CadetChannel *ch);
  * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by root and go BCK)
  */
 void
-GMCH_handle_local_ack (struct CadetChannel *ch, int fwd);
+GCCH_handle_local_ack (struct CadetChannel *ch, int fwd);
 
 /**
  * Handle data given by a client.
@@ -184,16 +185,17 @@ GMCH_handle_local_ack (struct CadetChannel *ch, int fwd);
  *
  * @param ch Channel.
  * @param c Client which sent the data.
- * @param message Message.
  * @param fwd Is this a FWD data?
+ * @param message Data message.
+ * @param size Size of data.
  *
  * @return GNUNET_OK if everything goes well, GNUNET_SYSERR in case of en error.
  */
 int
-GMCH_handle_local_data (struct CadetChannel *ch,
-                        struct CadetClient *c,
-                        struct GNUNET_MessageHeader *message,
-                        int fwd);
+GCCH_handle_local_data (struct CadetChannel *ch,
+                        struct CadetClient *c, int fwd,
+                        const struct GNUNET_MessageHeader *message,
+                        size_t size);
 
 /**
  * Handle a channel destroy requested by a client.
@@ -205,10 +207,11 @@ GMCH_handle_local_data (struct CadetChannel *ch,
  * @param is_root Is the request coming from root?
  */
 void
-GMCH_handle_local_destroy (struct CadetChannel *ch,
+GCCH_handle_local_destroy (struct CadetChannel *ch,
                            struct CadetClient *c,
                            int is_root);
 
+
 /**
  * Handle a channel create requested by a client.
  *
@@ -217,11 +220,11 @@ GMCH_handle_local_destroy (struct CadetChannel *ch,
  * @param c Client that requested the creation (will be the root).
  * @param msg Create Channel message.
  *
- * @return GNUNET_OK if everything went fine, GNUNET_SYSERR otherwise.
+ * @return #GNUNET_OK if everything went fine, #GNUNET_SYSERR otherwise.
  */
 int
-GMCH_handle_local_create (struct CadetClient *c,
-                          struct GNUNET_CADET_ChannelMessage *msg);
+GCCH_handle_local_create (struct CadetClient *c,
+                          struct GNUNET_CADET_ChannelCreateMessage *msg);
 
 /**
  * Handler for cadet network payload traffic.
@@ -234,10 +237,11 @@ GMCH_handle_local_create (struct CadetClient *c,
  *            #GNUNET_SYSERR if message on a one-ended channel (remote)
  */
 void
-GMCH_handle_data (struct CadetChannel *ch,
+GCCH_handle_data (struct CadetChannel *ch,
                   const struct GNUNET_CADET_Data *msg,
                   int fwd);
 
+
 /**
  * Handler for cadet network traffic end-to-end ACKs.
  *
@@ -249,10 +253,11 @@ GMCH_handle_data (struct CadetChannel *ch,
  *            #GNUNET_SYSERR if message on a one-ended channel (remote)
  */
 void
-GMCH_handle_data_ack (struct CadetChannel *ch,
+GCCH_handle_data_ack (struct CadetChannel *ch,
                       const struct GNUNET_CADET_DataACK *msg,
                       int fwd);
 
+
 /**
  * Handler for channel create messages.
  *
@@ -262,9 +267,10 @@ GMCH_handle_data_ack (struct CadetChannel *ch,
  * @param msg Channel crate message.
  */
 struct CadetChannel *
-GMCH_handle_create (struct CadetTunnel3 *t,
+GCCH_handle_create (struct CadetTunnel *t,
                     const struct GNUNET_CADET_ChannelCreate *msg);
 
+
 /**
  * Handler for channel NACK messages.
  *
@@ -273,7 +279,8 @@ GMCH_handle_create (struct CadetTunnel3 *t,
  * @param ch Channel.
  */
 void
-GMCH_handle_nack (struct CadetChannel *ch);
+GCCH_handle_nack (struct CadetChannel *ch);
+
 
 /**
  * Handler for channel ack messages.
@@ -286,10 +293,11 @@ GMCH_handle_nack (struct CadetChannel *ch);
  *            #GNUNET_SYSERR if message on a one-ended channel (remote)
  */
 void
-GMCH_handle_ack (struct CadetChannel *ch,
+GCCH_handle_ack (struct CadetChannel *ch,
                  const struct GNUNET_CADET_ChannelManage *msg,
                  int fwd);
 
+
 /**
  * Handler for channel destroy messages.
  *
@@ -301,10 +309,11 @@ GMCH_handle_ack (struct CadetChannel *ch,
  *            #GNUNET_SYSERR if message on a one-ended channel (remote)
  */
 void
-GMCH_handle_destroy (struct CadetChannel *ch,
+GCCH_handle_destroy (struct CadetChannel *ch,
                      const struct GNUNET_CADET_ChannelManage *msg,
                      int fwd);
 
+
 /**
  * Sends an already built message on a channel.
  *
@@ -322,10 +331,11 @@ GMCH_handle_destroy (struct CadetChannel *ch,
  * @param existing_copy This is a retransmission, don't save a copy.
  */
 void
-GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
+GCCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
                             struct CadetChannel *ch, int fwd,
                             void *existing_copy);
 
+
 /**
  * Get the static string for identification of the channel.
  *
@@ -334,7 +344,7 @@ GMCH_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
  * @return Static string with the channel IDs.
  */
 const char *
-GMCH_2s (const struct CadetChannel *ch);
+GCCH_2s (const struct CadetChannel *ch);
 
 
 #if 0                           /* keep Emacsens' auto-indent happy */