-/* Prototypes */
-int silc_packet_write(int sock, SilcBuffer src);
-int silc_packet_send(SilcSocketConnection sock, int force_send);
-void silc_packet_encrypt(SilcCipher cipher, SilcHmac hmac,
- SilcBuffer buffer, unsigned int len);
-void silc_packet_assemble(SilcPacketContext *ctx);
-void silc_packet_send_prepare(SilcSocketConnection sock,
- unsigned int header_len,
- unsigned int padlen,
- unsigned int data_len);
-int silc_packet_read(int sock, SilcBuffer dest);
-int silc_packet_receive(SilcSocketConnection sock);
-int silc_packet_decrypt(SilcCipher cipher, SilcHmac hmac,
- SilcBuffer buffer, SilcPacketContext *packet,
- SilcPacketCheckDecrypt check_packet,
- void *context);
-void silc_packet_receive_process(SilcSocketConnection sock,
- SilcCipher cipher, SilcHmac hmac,
- SilcPacketParserCallback parser,
- void *context);
-SilcPacketType silc_packet_parse(SilcPacketContext *ctx);
-SilcPacketType silc_packet_parse_special(SilcPacketContext *ctx);
-SilcPacketContext *silc_packet_context_alloc();
-SilcPacketContext *silc_packet_context_dup(SilcPacketContext *ctx);
-void silc_packet_context_free(SilcPacketContext *ctx);
-
-#endif
+/****f* silccore/SilcPacketAPI/silc_packet_wait_uninit
+ *
+ * SYNOPSIS
+ *
+ * void silc_packet_wait_uninit(void *waiter, SilcPacketStream stream);
+ *
+ * DESCRIPTION
+ *
+ * Uninitializes the waiting context. This may be called also from
+ * another thread while other thread is waiting for packets. This will
+ * inform the waiting thread to stop waiting.
+ *
+ ***/
+void silc_packet_wait_uninit(void *waiter, SilcPacketStream stream);
+
+/****f* silccore/SilcPacketAPI/silc_packet_wait
+ *
+ * SYNOPSIS
+ *
+ * int silc_packet_wait(void *waiter, int timeout,
+ * SilcPacket *return_packet)
+ *
+ * DESCRIPTION
+ *
+ * A special function that can be used to wait for a packet to arrive.
+ * This function will block the calling process or thread until either
+ * a packet is received into the `return_packet' pointer or the specified
+ * timeout value `timeout', which is in milliseconds, will expire. If
+ * the timeout is 0, no timeout exist. Before calling this function the
+ * silc_packet_wait_init must be called. The caller is responsible for
+ * freeing the returned packet with silc_packet_free.
+ *
+ * This function can be used for example from a thread that wants to
+ * block until SILC packet has been received.
+ *
+ * Returns 1 when packet was received, 0 if timeout occurred and -1 if
+ * error occurred.
+ *
+ * EXAMPLE
+ *
+ * static int foo_read_data(FooContext c)
+ * {
+ * SilcPacket packet;
+ * void *waiter;
+ * ...
+ *
+ * // Will wait for private message packets
+ * if (c->initialized == FALSE) {
+ * waiter = silc_packet_wait_init(stream,
+ * SILC_PACKET_PRIVATE_MESSAGE, -1);
+ * c->initialized = TRUE;
+ * }
+ *
+ * ...
+ * // Wait here until private message packet is received
+ * if ((silc_packet_wait(waiter, 0, &packet)) < 0)
+ * return -1;
+ *
+ * ... process packet ...
+ *
+ * return 1;
+ * }
+ *
+ ***/
+int silc_packet_wait(void *waiter, int timeout, SilcPacket *return_packet);
+
+/****f* silccore/SilcPacketAPI/silc_packet_free
+ *
+ * SYNOPSIS
+ *
+ * void silc_packet_free(SilcPacket packet);
+ *
+ * DESCRIPTION
+ *
+ * This function is used to free the SilcPacket pointer that application
+ * receives in the SilcPacketReceive callback. Application must free
+ * the packet if it takes it in to processing.
+ *
+ ***/
+void silc_packet_free(SilcPacket packet);
+
+#endif /* SILCPACKET_H */