+
+/****f* silccore/SilcChannelAPI/silc_channel_payload_list_free
+ *
+ * SYNOPSIS
+ *
+ * void silc_channel_payload_list_free(SilcDList list);
+ *
+ * DESCRIPTION
+ *
+ * Frees list of Channel Payloads and all data in them.
+ *
+ ***/
+void silc_channel_payload_list_free(SilcDList list);
+
+/****f* silccore/SilcChannelAPI/silc_channel_get_name
+ *
+ * SYNOPSIS
+ *
+ * unsigned char *silc_channel_get_name(SilcChannelPayload payload,
+ * SilcUInt32 *channel_name_len);
+ *
+ * DESCRIPTION
+ *
+ * Return the channel name from the payload. The caller must not free it.
+ *
+ ***/
+unsigned char *silc_channel_get_name(SilcChannelPayload payload,
+ SilcUInt32 *channel_name_len);
+
+/****f* silccore/SilcChannelAPI/silc_channel_get_id
+ *
+ * SYNOPSIS
+ *
+ * unsigned char *silc_channel_get_id(SilcChannelPayload payload,
+ * SilcUInt32 *channel_id_len);
+ *
+ * DESCRIPTION
+ *
+ * Return the Channel ID data from the payload. The caller must not free it.
+ *
+ ***/
+unsigned char *silc_channel_get_id(SilcChannelPayload payload,
+ SilcUInt32 *channel_id_len);
+
+/****f* silccore/SilcChannelAPI/silc_channel_get_id_parse
+ *
+ * SYNOPSIS
+ *
+ * SilcChannelID *silc_channel_get_id_parse(SilcChannelPayload payload);
+ *
+ * DESCRIPTION
+ *
+ * Return the Channel ID as parsed ID. This is equivalent to the
+ * silc_channel_get_id execpt that the ID is already parsed. The caller
+ * must free the parsed Channel ID.
+ *
+ ***/
+SilcChannelID *silc_channel_get_id_parse(SilcChannelPayload payload);
+
+/****f* silccore/SilcChannelAPI/silc_channel_get_mode
+ *
+ * SYNOPSIS
+ *
+ * SilcUInt32 silc_channel_get_mode(SilcChannelPayload payload);
+ *
+ * DESCRIPTION
+ *
+ * Return the mode. The mode is arbitrary. It can be the mode of the
+ * channel or perhaps the mode of the client on the channel. The protocol
+ * dictates what the usage of the mode is in different circumstances.
+ *
+ ***/
+SilcUInt32 silc_channel_get_mode(SilcChannelPayload payload);
+
+/****f* silccore/SilcChannelAPI/silc_channel_message_payload_decrypt
+ *
+ * SYNOPSIS
+ *
+ * bool silc_channel_message_payload_decrypt(unsigned char *data,
+ * size_t data_len,
+ * SilcCipher cipher,
+ * SilcHmac hmac);
+ *
+ * DESCRIPTION
+ *
+ * Decrypt the channel message. First push the IV out of the packet `data'.
+ * The IV is used in the decryption process. Then decrypt the message.
+ * After decryption, take the MAC from the decrypted packet, compute MAC
+ * and compare the MACs. If they match, the decryption was successful
+ * and we have the channel message ready to be displayed.
+ *
+ * This is usually used by the Channel Message interface itself but can
+ * be called by the appliation if separate decryption process is required.
+ * For example server might need to call this directly in some
+ * circumstances. The `cipher' is used to decrypt the payload.
+ *
+ * If the `hmac' is no provided then the MAC of the channel message is
+ * not verified.
+ *
+ ***/
+bool silc_channel_message_payload_decrypt(unsigned char *data,
+ size_t data_len,
+ SilcCipher cipher,
+ SilcHmac hmac);
+
+/****f* silccore/SilcChannelAPI/silc_channel_message_payload_parse
+ *
+ * SYNOPSIS
+ *
+ * SilcChannelMessagePayload
+ * silc_channel_message_payload_parse(const unsigned char *payload,
+ * SilcUInt32 payload_len,
+ * SilcCipher cipher,
+ * SilcHmac hmac);
+ *
+ * DESCRIPTION
+ *
+ * Parses channel message payload returning new channel payload structure.
+ * This also decrypts it and checks the MAC. The `cipher's is used to
+ * decrypt the payload.
+ *
+ * If the `hmac' is no provided then the MAC of the channel message is
+ * not verified.
+ *
+ ***/
+SilcChannelMessagePayload
+silc_channel_message_payload_parse(unsigned char *payload,
+ SilcUInt32 payload_len,
+ SilcCipher cipher,
+ SilcHmac hmac);
+
+/****f* silccore/SilcChannelAPI/silc_channel_message_payload_encode
+ *
+ * SYNOPSIS
+ *
+ * SilcBuffer silc_channel_message_payload_encode(SilcUInt16 flags,
+ * SilcUInt16 data_len,
+ * const unsigned char *data,
+ * SilcUInt16 iv_len,
+ * unsigned char *iv,
+ * SilcCipher cipher,
+ * SilcHmac hmac);
+ *
+ * DESCRIPTION
+ *
+ * Encodes channel message payload into a buffer and returns it. This
+ * is used to add channel message payload into a packet. As the channel
+ * payload is encrypted separately from other parts of the packet padding
+ * must be applied to the payload. The function generates the padding
+ * automatically from random data. The `cipher' is the cipher used
+ * encrypt the payload and `hmac' is used to compute the MAC for the
+ * payload.
+ *
+ ***/
+SilcBuffer silc_channel_message_payload_encode(SilcUInt16 flags,
+ SilcUInt16 data_len,
+ const unsigned char *data,
+ SilcUInt16 iv_len,
+ unsigned char *iv,
+ SilcCipher cipher,
+ SilcHmac hmac);
+
+/****f* silccore/SilcChannelAPI/silc_channel_message_payload_free
+ *
+ * SYNOPSIS
+ *
+ * void
+ * silc_channel_message_payload_free(SilcChannelMessagePayload payload);
+ *
+ * DESCRIPTION
+ *
+ * Free's Channel Message Payload and all data in it.
+ *
+ ***/
+void silc_channel_message_payload_free(SilcChannelMessagePayload payload);
+
+/****f* silccore/SilcChannelAPI/silc_channel_message_get_flags
+ *
+ * SYNOPSIS
+ *
+ * SilcMessageFlags
+ * silc_channel_message_get_flags(SilcChannelMessagePayload payload);
+ *
+ * DESCRIPTION
+ *
+ * Returns the message flags from the payload.
+ *
+ ***/
+SilcMessageFlags
+silc_channel_message_get_flags(SilcChannelMessagePayload payload);
+
+/****f* silccore/SilcChannelAPI/silc_channel_message_get_data
+ *
+ * SYNOPSIS
+ *
+ * unsigned char *
+ * silc_channel_message_get_data(SilcChannelMessagePayload payload,
+ * SilcUInt32 *data_len);
+ *
+ * DESCRIPTION
+ *
+ * Return the data in the payload, that is, the actual channel message.
+ * The caller must not free it.
+ *
+ ***/
+unsigned char *silc_channel_message_get_data(SilcChannelMessagePayload payload,
+ SilcUInt32 *data_len);
+
+/****f* silccore/SilcChannelAPI/silc_channel_message_get_mac
+ *
+ * SYNOPSIS
+ *
+ * unsigned char *
+ * silc_channel_message_get_mac(SilcChannelMessagePayload payload);
+ *
+ * DESCRIPTION
+ *
+ * Return the MAC of the payload. The caller must already know the
+ * length of the MAC. The caller must not free the MAC.
+ *
+ ***/
+unsigned char *silc_channel_message_get_mac(SilcChannelMessagePayload payload);
+
+/****f* silccore/SilcChannelAPI/silc_channel_message_get_iv
+ *
+ * SYNOPSIS
+ *
+ * unsigned char *
+ * silc_channel_message_get_iv(SilcChannelMessagePayload payload);
+ *
+ * DESCRIPTION
+ *
+ * Return the IV of the payload. The caller must already know the
+ * length of the IV. The caller must not free the IV.
+ *
+ ***/
+unsigned char *silc_channel_message_get_iv(SilcChannelMessagePayload payload);
+
+/****f* silccore/SilcChannelAPI/silc_channel_key_payload_parse
+ *
+ * SYNOPSIS
+ *
+ * SilcChannelKeyPayload
+ * silc_channel_key_payload_parse(const unsigned char *payload,
+ * uin32 payload_len);
+ *
+ * DESCRIPTION
+ *
+ * Parses channel key payload returning new channel key payload
+ * structure.
+ *
+ ***/
+SilcChannelKeyPayload
+silc_channel_key_payload_parse(const unsigned char *payload,
+ SilcUInt32 payload_len);
+
+/****f* silccore/SilcChannelAPI/silc_channel_key_payload_encode
+ *
+ * SYNOPSIS
+ *
+ * SilcBuffer silc_channel_key_payload_encode(SilcUInt16 id_len,
+ * const unsigned char *id,
+ * SilcUInt16 cipher_len,
+ * const unsigned char *cipher,
+ * SilcUInt16 key_len,
+ * const unsigned char *key);
+ *
+ * DESCRIPTION
+ *
+ * Encodes channel key payload into a buffer and returns it. This is used
+ * to add channel key payload into a packet.
+ *
+ ***/
+SilcBuffer silc_channel_key_payload_encode(SilcUInt16 id_len,
+ const unsigned char *id,
+ SilcUInt16 cipher_len,
+ const unsigned char *cipher,
+ SilcUInt16 key_len,
+ const unsigned char *key);
+
+/****f* silccore/SilcChannelAPI/silc_channel_key_payload_free
+ *
+ * SYNOPSIS
+ *
+ * void silc_channel_key_payload_free(SilcChannelKeyPayload payload);
+ *
+ * DESCRIPTION
+ *
+ * Frees the Channel Key Payload and all data in it.
+ *
+ ***/