/*
This file is part of GNUnet.
- (C) 2001 - 2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2001 - 2011 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
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.
*/
/**
GNUNET_NETWORK_STRUCT_BEGIN
+
/**
- * Message for a client to register to the service
+ * Message for a client to create and destroy channels.
*/
-struct GNUNET_CADET_ClientConnect
+struct GNUNET_CADET_PortMessage
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_CONNECT
- *
- * Size: sizeof(struct GNUNET_CADET_ClientConnect) +
- * sizeof(CADET_ApplicationType) * applications +
- * sizeof(uint16_t) * types
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN
+ * or #GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE
+ *
+ * Size: sizeof(struct GNUNET_CADET_ChannelMessage)
+ */
struct GNUNET_MessageHeader header;
- /* uint32_t list_ports[] */
-};
+ /**
+ * Port to open/close.
+ */
+ struct GNUNET_HashCode port GNUNET_PACKED;
+};
/**
* Type for channel numbering.
/**
- * Message for a client to create and destroy channels.
+ * Message for a client to create channels.
*/
-struct GNUNET_CADET_ChannelMessage
+struct GNUNET_CADET_ChannelCreateMessage
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_[CREATE|DESTROY]
- *
- * Size: sizeof(struct GNUNET_CADET_ChannelMessage)
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE
+ *
+ * Size: sizeof(struct GNUNET_CADET_ChannelCreateMessage)
+ */
struct GNUNET_MessageHeader header;
- /**
- * ID of a channel controlled by this client.
- */
+ /**
+ * ID of a channel controlled by this client.
+ */
CADET_ChannelNumber channel_id GNUNET_PACKED;
- /**
- * Channel's peer
- */
+ /**
+ * Channel's peer
+ */
struct GNUNET_PeerIdentity peer;
- /**
- * Port of the channel.
- */
- uint32_t port GNUNET_PACKED;
+ /**
+ * Port of the channel.
+ */
+ struct GNUNET_HashCode port;
- /**
- * Options.
- */
+ /**
+ * Options.
+ */
uint32_t opt GNUNET_PACKED;
};
+/**
+ * Message for a client to destroy channels.
+ */
+struct GNUNET_CADET_ChannelDestroyMessage
+{
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY
+ *
+ * Size: sizeof(struct GNUNET_CADET_ChannelDestroyMessage)
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * ID of a channel controlled by this client.
+ */
+ CADET_ChannelNumber channel_id GNUNET_PACKED;
+};
+
+
/**
* Message for cadet data traffic.
*/
struct GNUNET_CADET_LocalData
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA
+ */
struct GNUNET_MessageHeader header;
- /**
- * ID of the channel
- */
+ /**
+ * ID of the channel
+ */
uint32_t id GNUNET_PACKED;
- /**
- * Payload follows
- */
+ /**
+ * Payload follows
+ */
};
*/
struct GNUNET_CADET_LocalAck
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK
- */
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK
+ */
struct GNUNET_MessageHeader header;
- /**
- * ID of the channel allowed to send more data.
- */
+ /**
+ * ID of the channel allowed to send more data.
+ */
CADET_ChannelNumber channel_id GNUNET_PACKED;
};
struct GNUNET_CADET_LocalInfo
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO[_TUNNEL,_PEER]
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL or
+ * #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER
*/
struct GNUNET_MessageHeader header;
struct GNUNET_CADET_LocalInfoPeer
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER[S]
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEER or
+ * #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS
*/
struct GNUNET_MessageHeader header;
int16_t tunnel GNUNET_PACKED;
/**
- * ID of the destination of the tunnel (can be local peer).
+ * ID of the peer (can be local peer).
*/
struct GNUNET_PeerIdentity destination;
struct GNUNET_CADET_LocalInfoTunnel
{
/**
- * Type: GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL[S]
+ * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL
+ * or #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNELS
*/
struct GNUNET_MessageHeader header;
GNUNET_NETWORK_STRUCT_END
-
/**
* @brief Translate a fwd variable into a string representation, for logging.
*
const char *
GC_h2s (const struct GNUNET_CADET_Hash *id);
+
+/**
+ * Allocate a string with a hexdump of any binary data.
+ *
+ * @param bin Arbitrary binary data.
+ * @param len Length of @a bin in bytes.
+ * @param output Where to write the output (if *output be NULL it's allocated).
+ *
+ * @return The size of the output.
+ */
+size_t
+GC_bin2s (void *bin, unsigned int len, char **output);
+
/**
* Convert a message type into a string to help debug
* Generated with: