- * This is optional function which can be used to set specific callbacks
- * for the packet stream indicated by `stream'. If these are set then
- * `callbacks' will be used instead of the ones set for the function
- * silc_packet_engine_start. To reset the normal behaviour call this
- * function again with `callbacks' as NULL. Note that the responsibility
- * of handling end of stream, and error conditions moves to the layer
- * calling this function since the original callbacks set in the
- * silc_packet_engine_start will not be called.
+ * Links the packet processing callbacks indicated by `callbacks' into
+ * the packet stream indicated by `stream' with priority `priority' for
+ * the packet types given in the variable argument list. This function
+ * can be used to link to the packet stream for specific packet types
+ * and receive them in the specified callbacks. This way, a third party,
+ * for example some library may attach itself into the packet stream
+ * and receive and process certain packets. The variable argument
+ * list is ended with -1. To link to receive all packets use
+ * SILC_PACKET_ANY.
+ *
+ * The default packet processing callbacks given as argument to the
+ * silc_packet_engine_start has the priority 0. Any priority higher
+ * than 0 will then take precedence over the default callbacks. Any
+ * priority lower than 0 (negative value) will be processed after the
+ * default callbacks.
+ *
+ * Note that setting only the 'packet_receive' callback in the `callbacks'
+ * is required.
+ *
+ * EXAMPLE
+ *
+ * // Link to this packet stream, with high priority, for
+ * // SILC_PACKET_CONNECTION_AUTH and SILC_PACKET_CONNECTION_AUTH_REQUEST
+ * // packets. We don't care about other packets.
+ * silc_packet_stream_link(stream, our_callbacks, our_context,
+ * 1000000, SILC_PACKET_CONNECTION_AUTH,
+ * SILC_PACKET_CONNECTION_AUTH_REQUEST, -1);