-typedef struct {
- SilcUInt16 truelen;
- SilcPacketFlags flags;
- SilcPacketType type;
-
- unsigned char *src_id;
- unsigned char *dst_id;
- unsigned int src_id_len : 5;
- unsigned int src_id_type : 2;
- unsigned int dst_id_len : 5;
- unsigned int dst_id_type : 2;
- unsigned int long_pad : 1; /* Set when maximum padding in packet */
- unsigned int users : 9; /* Reference counter */
- unsigned int padlen : 8;
-
- SilcUInt32 sequence;
- SilcBuffer buffer;
-} SilcPacketContext;
-
-/****s* silccore/SilcPacketAPI/SilcPacketParserContext
+typedef SilcBool (*SilcPacketReceiveCb)(SilcPacketEngine engine,
+ SilcPacketStream stream,
+ SilcPacket packet,
+ void *callback_context,
+ void *stream_context);
+
+/****f* silccore/SilcPacketAPI/SilcPacketEosCb
+ *
+ * SYNOPSIS
+ *
+ * typedef void (*SilcPacketEosCb)(SilcPacketEngine engine,
+ * SilcPacketStream stream,
+ * void *callback_context,
+ * void *stream_context);
+ *
+ * DESCRIPTION
+ *
+ * The End Of Stream (EOS) callback, that is called by the packet engine
+ * when the underlaying stream has ended. No more data can be sent to
+ * the stream or read from it. The `stream' must be destroyed by
+ * calling the silc_packet_stream_destroy. This callback is set in the
+ * SilcPacketCallbacks structure.
+ *
+ ***/
+typedef void (*SilcPacketEosCb)(SilcPacketEngine engine,
+ SilcPacketStream stream,
+ void *callback_context,
+ void *stream_context);
+
+/****f* silccore/SilcPacketAPI/SilcPacketErrorCb
+ *
+ * SYNOPSIS
+ *
+ * typedef void (*SilcPacketErrorCb)(SilcPacketEngine engine,
+ * SilcPacketStream stream,
+ * SilcPacketError error,
+ * void *callback_context,
+ * void *stream_context);
+ *
+ * DESCRIPTION
+ *
+ * The error callback that is called by the packet engine if an error
+ * occurs. The `error' will indicate the error. This callback is set
+ * in the SilcPacketCallbacks structure.
+ *
+ ***/
+typedef void (*SilcPacketErrorCb)(SilcPacketEngine engine,
+ SilcPacketStream stream,
+ SilcPacketError error,
+ void *callback_context,
+ void *stream_context);
+
+/****s* silccore/SilcPacketAPI/SilcPacketStream