/**
* ID of the channel
*/
- struct GNUNET_CADET_ChannelTunnelNumber gid;
+ struct GNUNET_CADET_ChannelTunnelNumber chid;
/**
* Payload follows
/**
* ID of the channel
*/
- struct GNUNET_CADET_ChannelTunnelNumber gid;
+ struct GNUNET_CADET_ChannelTunnelNumber chid;
/**
* Bitfield of already-received messages past @e mid.
msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK);
msg.header.size = htons (sizeof (msg));
- msg.gid = ch->chid;
+ msg.chid = ch->chid;
msg.mid.mid = htonl (ntohl (ch->mid_recv.mid) - 1);
msg.futures = GNUNET_htonll (ch->mid_futures);
if (NULL != ch->last_control_qe)
}
+/**
+ * We got an acknowledgement for the creation of the channel
+ * (the port is open on the other side). Begin transmissions.
+ *
+ * @param ch channel to destroy
+ */
+void
+GCCH_handle_channel_create_ack (struct CadetChannel *ch)
+{
+ GNUNET_break (0); // FIXME!
+}
+
+
+/**
+ * We got payload data for a channel. Pass it on to the client.
+ *
+ * @param ch channel that got data
+ */
+void
+GCCH_handle_channel_plaintext_data (struct CadetChannel *ch,
+ const struct GNUNET_CADET_ChannelAppDataMessage *msg)
+{
+ GNUNET_break (0); // FIXME!
+}
+
+
+/**
+ * We got an acknowledgement for payload data for a channel.
+ * Possibly resume transmissions.
+ *
+ * @param ch channel that got the ack
+ * @param ack details about what was received
+ */
+void
+GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch,
+ const struct GNUNET_CADET_ChannelDataAckMessage *ack)
+{
+ GNUNET_break (0); // FIXME!
+}
+
+
/**
* Destroy channel, based on the other peer closing the
* connection. Also needs to remove this channel from
* @param ch channel to destroy
*/
void
-GCCH_channel_remote_destroy (struct CadetChannel *ch)
+GCCH_handle_remote_destroy (struct CadetChannel *ch)
{
GNUNET_break (0); // FIXME!
}
crm->data_message.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA);
ch->mid_send.mid = htonl (ntohl (ch->mid_send.mid) + 1);
crm->data_message.mid = ch->mid_send;
- crm->data_message.gid = ch->chid;
+ crm->data_message.chid = ch->chid;
GNUNET_memcpy (&crm[1],
message,
payload_size);
#include "gnunet-service-cadet-new.h"
#include "gnunet-service-cadet-new_peer.h"
+#include "cadet_protocol.h"
/**
GCCH_channel_incoming_destroy (struct CadetChannel *ch);
+/**
+ * We got payload data for a channel. Pass it on to the client.
+ *
+ * @param ch channel that got data
+ */
+void
+GCCH_handle_channel_plaintext_data (struct CadetChannel *ch,
+ const struct GNUNET_CADET_ChannelAppDataMessage *msg);
+
+
+/**
+ * We got an acknowledgement for payload data for a channel.
+ * Possibly resume transmissions.
+ *
+ * @param ch channel that got the ack
+ * @param ack details about what was received
+ */
+void
+GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch,
+ const struct GNUNET_CADET_ChannelDataAckMessage *ack);
+
+
+/**
+ * We got an acknowledgement for the creation of the channel
+ * (the port is open on the other side). Begin transmissions.
+ *
+ * @param ch channel to destroy
+ */
+void
+GCCH_handle_channel_create_ack (struct CadetChannel *ch);
+
+
/**
* Destroy channel, based on the other peer closing the
* connection. Also needs to remove this channel from
* @param ch channel to destroy
*/
void
-GCCH_channel_remote_destroy (struct CadetChannel *ch);
+GCCH_handle_remote_destroy (struct CadetChannel *ch);
/**
#include "gnunet_util_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet_signatures.h"
-#include "cadet_protocol.h"
-#include "cadet_path.h"
#include "gnunet-service-cadet-new.h"
+#include "cadet_protocol.h"
#include "gnunet-service-cadet-new_channel.h"
#include "gnunet-service-cadet-new_connection.h"
#include "gnunet-service-cadet-new_tunnels.h"
ct->is_ready = GNUNET_NO;
GCC_transmit (ct->cc,
tq->env);
- tq->cont (tq->cont_cls);
+ if (NULL != tq->cont)
+ tq->cont (tq->cont_cls);
GNUNET_free (tq);
}
/**
- *
+ * We received payload data for a channel. Locate the channel
+ * and process the data, or return an error if the channel is unknown.
*
* @param cls the `struct CadetTunnel` for which we decrypted the message
* @param msg the message we received on the tunnel
const struct GNUNET_CADET_ChannelAppDataMessage *msg)
{
struct CadetTunnel *t = cls;
- GNUNET_break (0); // FIXME!
+ struct CadetChannel *ch;
+
+ ch = lookup_channel (t,
+ msg->chid);
+ if (NULL == ch)
+ {
+ /* We don't know about such a channel, might have been destroyed on our
+ end in the meantime, or never existed. Send back a DESTROY. */
+ GCT_send_channel_destroy (t,
+ msg->chid);
+ return;
+ }
+ GCCH_handle_channel_plaintext_data (ch,
+ msg);
}
/**
- *
+ * We received an acknowledgement for data we sent on a channel.
+ * Locate the channel and process it, or return an error if the
+ * channel is unknown.
*
* @param cls the `struct CadetTunnel` for which we decrypted the message
* @param ack the message we received on the tunnel
const struct GNUNET_CADET_ChannelDataAckMessage *ack)
{
struct CadetTunnel *t = cls;
- GNUNET_break (0); // FIXME!
+ struct CadetChannel *ch;
+
+ ch = lookup_channel (t,
+ ack->chid);
+ if (NULL == ch)
+ {
+ /* We don't know about such a channel, might have been destroyed on our
+ end in the meantime, or never existed. Send back a DESTROY. */
+ GCT_send_channel_destroy (t,
+ ack->chid);
+ return;
+ }
+ GCCH_handle_channel_plaintext_data_ack (ch,
+ ack);
}
GCT_send_channel_destroy (struct CadetTunnel *t,
struct GNUNET_CADET_ChannelTunnelNumber chid)
{
- GNUNET_break (0); // FIXME!
+ struct GNUNET_CADET_ChannelManageMessage msg;
+
+ msg.header.size = htons (sizeof (msg));
+ msg.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY);
+ msg.reserved = htonl (0);
+ msg.chid = chid;
+ GCT_send (t,
+ &msg.header,
+ NULL,
+ NULL);
}
cm->chid);
return;
}
- GNUNET_break (0); // FIXME!
+ GCCH_handle_channel_create_ack (ch);
}
struct CadetChannel *cc = lookup_channel (t,
cm->chid);
- GCCH_channel_remote_destroy (cc);
+ GCCH_handle_remote_destroy (cc);
}