*/
-/****h* silccore/SilcChannelAPI
+/****h* silccore/SILC Channel Interface
*
* DESCRIPTION
*
typedef SilcUInt16 SilcMessageFlags;
/* The message flags (shared by both channel and private messages) */
-#define SILC_MESSAGE_FLAG_NONE 0x0000
-#define SILC_MESSAGE_FLAG_AUTOREPLY 0x0001
-#define SILC_MESSAGE_FLAG_NOREPLY 0x0002
-#define SILC_MESSAGE_FLAG_ACTION 0x0004
-#define SILC_MESSAGE_FLAG_NOTICE 0x0008
-#define SILC_MESSAGE_FLAG_REQUEST 0x0010
-#define SILC_MESSAGE_FLAG_SIGNED 0x0020
-#define SILC_MESSAGE_FLAG_RESERVED 0x0040 /* to 0x0200 */
-#define SILC_MESSAGE_FLAG_PRIVATE 0x0400 /* to 0x8000 */
+#define SILC_MESSAGE_FLAG_NONE 0x0000 /* No flags */
+#define SILC_MESSAGE_FLAG_AUTOREPLY 0x0001 /* Automatically replied */
+#define SILC_MESSAGE_FLAG_NOREPLY 0x0002 /* Send no reply to this */
+#define SILC_MESSAGE_FLAG_ACTION 0x0004 /* Action message */
+#define SILC_MESSAGE_FLAG_NOTICE 0x0008 /* Notice message */
+#define SILC_MESSAGE_FLAG_REQUEST 0x0010 /* A request */
+#define SILC_MESSAGE_FLAG_SIGNED 0x0020 /* Message is signed */
+#define SILC_MESSAGE_FLAG_REPLY 0x0040 /* A reply */
+#define SILC_MESSAGE_FLAG_DATA 0x0080 /* MIME object */
+#define SILC_MESSAGE_FLAG_UTF8 0x0100 /* UTF-8 string */
+#define SILC_MESSAGE_FLAG_RESERVED 0x0200 /* to 0x0800 */
+#define SILC_MESSAGE_FLAG_PRIVATE 0x1000 /* to 0x8000 */
/***/
/* Prototypes */
SilcCipher cipher,
SilcHmac hmac);
+/****f* silccore/SilcChannelAPI/silc_channel_message_payload_encrypt
+ *
+ * SYNOPSIS
+ *
+ * bool silc_channel_message_payload_encrypt(unsigned char *data,
+ * SilcUInt32 data_len,
+ * SilcUInt32 true_len,
+ * unsigned char *iv,
+ * SilcUInt32 iv_len,
+ * SilcCipher cipher,
+ * SilcHmac hmac);
+ *
+ * DESCRIPTION
+ *
+ * This function is used to encrypt the Channel Messsage Payload which is
+ * the `data' and `data_len'. The `data_len' is the data length which is
+ * used to create MAC out of. The `true_len' is the true length of `data'
+ * message payload and is used assemble rest of the packet after MAC
+ * creation. The `true_len' length packet will then be encrypted.
+ *
+ * This is usually used by the Channel Message interface itself but can
+ * be called by the appliation if separate encryption process is required.
+ * For example server might need to call this directly in some
+ * circumstances. The `cipher' is used to encrypt the payload.
+ *
+ ***/
+bool silc_channel_message_payload_encrypt(unsigned char *data,
+ SilcUInt32 data_len,
+ SilcUInt32 true_len,
+ unsigned char *iv,
+ SilcUInt32 iv_len,
+ SilcCipher cipher,
+ SilcHmac hmac);
+
/****f* silccore/SilcChannelAPI/silc_channel_message_payload_encode
*
* SYNOPSIS
* SilcUInt16 iv_len,
* unsigned char *iv,
* SilcCipher cipher,
- * SilcHmac hmac);
+ * SilcHmac hmac.
+ * SilcRng rng);
*
* DESCRIPTION
*
* 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.
+ * payload. If `rng' is NULL then global RNG is used, if non-NULL then
+ * the `rng' is used.
*
***/
SilcBuffer silc_channel_message_payload_encode(SilcUInt16 flags,
SilcUInt16 iv_len,
unsigned char *iv,
SilcCipher cipher,
- SilcHmac hmac);
+ SilcHmac hmac,
+ SilcRng rng);
/****f* silccore/SilcChannelAPI/silc_channel_message_payload_free
*