+/****f* silccore/SilcPacketAPI/SilcPacketWrapCoder
+ *
+ * SYNOPSIS
+ *
+ * typedef SilcBool (*SilcPacketWrapCoder)(SilcStream stream,
+ * SilcStreamStatus status,
+ * SilcBuffer buffer,
+ * void *context);
+ *
+ * DESCRIPTION
+ *
+ * The encoder/decoder callback for silc_packet_stream_wrap. If the
+ * `status' is SILC_STREAM_CAN_WRITE then additional data can be added
+ * to `buffer'. It is added before the data that is written with
+ * silc_stream_write. The silc_buffer_enlarge should be called to verify
+ * there is enough room in `buffer' before adding data to it. The `buffer'
+ * must not be freed.
+ *
+ * If the `status' is SILC_STREAM_CAN_READ then data from the `buffer'
+ * may be read before it is passed to readed when silc_stream_read is
+ * called. The `buffer' may be advanced also to hide data in it.
+ *
+ * This function returns FALSE in case of error.
+ *
+ ***/
+typedef SilcBool (*SilcPacketWrapCoder)(SilcStream stream,
+ SilcStreamStatus status,
+ SilcBuffer buffer,
+ void *context);
+
+/****f* silccore/SilcPacketAPI/silc_packet_stream_wrap
+ *
+ * SYNOPSIS
+ *
+ * SilcStream silc_packet_stream_wrap(SilcPacketStream stream,
+ * SilcPacketType type,
+ * SilcPacketFlags flags,
+ * SilcBool blocking_mode,
+ * SilcPacketWrapCoder coder,
+ * void *context);
+ *
+ * DESCRIPTION
+ *
+ * Wraps the packet stream indicated by `stream' into a SilcStream for
+ * the packet type indicated by `type' with packet flags indicated by
+ * `flags'. The returned SilcStream can be used to read and write the
+ * specified SILC packets with the specified packet flags, by calling
+ * silc_stream_read and silc_stream_write, respectively. The returned
+ * stream can be destroyed by calling silc_stream_destroy. It does not
+ * destroy the wrapped packet stream.
+ *
+ * If the `blocking_mode' mode is TRUE then the silc_stream_read and
+ * silc_stream_write may block the calling process or thread until SILC
+ * packet is read or written. If it is FALSE the stream is in non-blocking
+ * mode and the calls never block. The returned stream is thread-safe and
+ * packets may be read and written in multi-threaded environment.
+ *
+ * In non-blocking mode the silc_stream_set_notifier must be called before
+ * the returned stream can be used to read packets. The stream status
+ * SILC_STREAM_CAN_READ will be returned to the notifier callback to
+ * indicate that a packet is ready for reading. Calling silc_stream_read
+ * once returns one complete SILC packet data payload (which is of type of
+ * `type').
+ *
+ * The `coder' is optional encoder/decoder callback which the packet engine
+ * will call if it is non-NULL. It can be used to encode additional data
+ * into each packet when silc_stream_write is called or decode data before
+ * it is passed to reader when silc_stream_read is called. The `context'
+ * is passed to `coder'.
+ *
+ * The returned SilcStream can be used as any normal stream and all
+ * SilcStream API functions may be used with the stream. This returns
+ * NULL on error.
+ *
+ ***/
+SilcStream silc_packet_stream_wrap(SilcPacketStream stream,
+ SilcPacketType type,
+ SilcPacketFlags flags,
+ SilcBool blocking_mode,
+ SilcPacketWrapCoder coder,
+ void *context);
+
+/****f* silccore/SilcPacketAPI/silc_packet_stream_is_udp
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_packet_stream_is_udp(SilcPacketStream stream);
+ *
+ * DESCRIPTION
+ *
+ * Returns TRUE if the packet stream indicated by `stream' is using
+ * UDP transport.
+ *
+ ***/
+SilcBool silc_packet_stream_is_udp(SilcPacketStream stream);
+
+/****f* silccore/SilcPacketAPI/silc_packet_get_sender
+ *
+ * SYNOPSIS
+ *
+ * SilcBool silc_packet_get_sender(SilcPacket packet,
+ * const char **sender_ip,
+ * SilcUInt16 *sender_port);
+ *
+ * DESCRIPTION
+ *
+ * Returns the packet sender's IP address and port from UDP packet
+ * indicated by `packet'. This can be called only from the packet
+ * callback to retrieve the information of the packet's sender. Returns
+ * FALSE if the information is not available.
+ *
+ ***/
+SilcBool silc_packet_get_sender(SilcPacket packet,
+ const char **sender_ip,
+ SilcUInt16 *sender_port);
+
+/****f* silccore/SilcPacketAPI/silc_packet_stream_ref
+ *
+ * SYNOPSIS
+ *
+ * void silc_packet_stream_ref(SilcPacketStream stream);
+ *
+ * DESCRIPTION
+ *
+ * Increase reference counter for the stream indicated by `stream'. This
+ * can be used to take a reference for the stream. To unreference the
+ * stream call silc_packet_stream_unref function.
+ *
+ ***/
+void silc_packet_stream_ref(SilcPacketStream stream);
+
+/****f* silccore/SilcPacketAPI/silc_packet_stream_unref
+ *
+ * SYNOPSIS
+ *
+ * void silc_packet_stream_unref(SilcPacketStream stream);
+ *
+ * DESCRIPTION
+ *
+ * Decrease reference counter for the stream indicated by `stream'. If
+ * the counter hits zero the stream will be destroyed automatically.
+ *
+ ***/
+void silc_packet_stream_unref(SilcPacketStream stream);
+
+/****f* silccore/SilcPacketAPI/silc_packet_get_engine
+ *
+ * SYNOPSIS
+ *
+ * SilcPacketEngine silc_packet_get_engine(SilcPacketStream stream);
+ *
+ * DESCRIPTION
+ *
+ * Returns the packet engine from the `stream'.
+ *
+ ***/
+SilcPacketEngine silc_packet_get_engine(SilcPacketStream stream);
+
+/****f* silccore/SilcPacketAPI/silc_packet_set_context