-/**
- * Request information about a specific channel of the running cadet peer.
- *
- * WARNING: unstable API, likely to change in the future!
- * FIXME Add destination option.
- *
- * @param h Handle to the cadet peer.
- * @param initiator ID of the owner of the channel.
- * @param channel_number Channel number.
- * @param callback Function to call with the requested data.
- * @param callback_cls Closure for @c callback.
- *
- * @return #GNUNET_OK / #GNUNET_SYSERR
- */
-int
-GNUNET_CADET_show_channel (struct GNUNET_CADET_Handle *h,
- struct GNUNET_PeerIdentity *initiator,
- unsigned int channel_number,
- GNUNET_CADET_ChannelCB callback,
- void *callback_cls)
-{
- struct GNUNET_CADET_LocalInfo *msg;
- struct GNUNET_MQ_Envelope *env;
-
- if (NULL != h->info_cb.channel_cb)
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
-
- env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_CHANNEL);
- msg->peer = *initiator;
- msg->ccn.channel_of_client = htonl (channel_number);
- GNUNET_MQ_send (h->mq, env);
-
- h->info_cb.channel_cb = callback;
- h->info_cls = callback_cls;
- return GNUNET_OK;
-}
-
-
-/**
- * Function called to notify a client about the connection
- * begin ready to queue more data. "buf" will be
- * NULL and "size" zero if the connection was closed for
- * writing in the meantime.
- *
- * @param cls closure
- * @param size number of bytes available in buf
- * @param buf where the callee should write the message
- * @return number of bytes written to buf
- */
-static size_t
-cadet_mq_ntr (void *cls, size_t size,
- void *buf)
-{
- struct GNUNET_MQ_Handle *mq = cls;
- struct CadetMQState *state = GNUNET_MQ_impl_state (mq);
- const struct GNUNET_MessageHeader *msg = GNUNET_MQ_impl_current (mq);
- uint16_t msize;
-
- state->th = NULL;
- if (NULL == buf)
- {
- GNUNET_MQ_inject_error (mq, GNUNET_MQ_ERROR_WRITE);
- return 0;
- }
- msize = ntohs (msg->size);
- GNUNET_assert (msize <= size);
- GNUNET_memcpy (buf, msg, msize);
- GNUNET_MQ_impl_send_continue (mq);
- return msize;
-}
-
-
-/**
- * Signature of functions implementing the
- * sending functionality of a message queue.
- *
- * @param mq the message queue
- * @param msg the message to send
- * @param impl_state state of the implementation
- */
-static void
-cadet_mq_send_impl_old (struct GNUNET_MQ_Handle *mq,
- const struct GNUNET_MessageHeader *msg,
- void *impl_state)
-{
- struct CadetMQState *state = impl_state;
-
- GNUNET_assert (NULL == state->th);
- state->th =
- GNUNET_CADET_notify_transmit_ready (state->channel,
- /* FIXME: add option for corking */
- GNUNET_NO,
- GNUNET_TIME_UNIT_FOREVER_REL,
- ntohs (msg->size),
- &cadet_mq_ntr, mq);
-
-}
-
-
-/**
- * Signature of functions implementing the
- * destruction of a message queue.
- * Implementations must not free 'mq', but should
- * take care of 'impl_state'.
- *
- * @param mq the message queue to destroy
- * @param impl_state state of the implementation
- */
-static void
-cadet_mq_destroy_impl_old (struct GNUNET_MQ_Handle *mq,
- void *impl_state)
-{
- struct CadetMQState *state = impl_state;
-
- if (NULL != state->th)
- GNUNET_CADET_notify_transmit_ready_cancel (state->th);
-
- GNUNET_free (state);
-}
-
-
-/**
- * Create a message queue for a cadet channel.
- * The message queue can only be used to transmit messages,
- * not to receive them.
- *
- * @param channel the channel to create the message qeue for
- * @return a message queue to messages over the channel
- */
-struct GNUNET_MQ_Handle *
-GNUNET_CADET_mq_create (struct GNUNET_CADET_Channel *channel)
-{
- struct GNUNET_MQ_Handle *mq;
- struct CadetMQState *state;
-
- state = GNUNET_new (struct CadetMQState);
- state->channel = channel;
-
- mq = GNUNET_MQ_queue_for_callbacks (&cadet_mq_send_impl_old,
- &cadet_mq_destroy_impl_old,
- NULL, /* FIXME: cancel impl. */
- state,
- NULL, /* no msg handlers */
- NULL, /* no err handlers */
- NULL); /* no handler cls */
- return mq;
-}
-
-