X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccore%2Fsilcpacket.h;fp=lib%2Fsilccore%2Fsilcpacket.h;h=c7527a43fa4a2656acc536124be1143ae72d14de;hb=4bd6360cc9903e6c53a461bb8ad5c0da8b869e29;hp=b9ecfef3fb0f0cd6f35c7b1c77704ffab940626c;hpb=0162cc800a7ca6f21bffe5f4c66f3c8ee357b564;p=silc.git diff --git a/lib/silccore/silcpacket.h b/lib/silccore/silcpacket.h index b9ecfef3..c7527a43 100644 --- a/lib/silccore/silcpacket.h +++ b/lib/silccore/silcpacket.h @@ -611,6 +611,39 @@ void silc_packet_stream_unlink(SilcPacketStream stream, SilcPacketCallbacks *callbacks, void *callback_context); +/****f* silccore/SilcPacketAPI/silc_packet_stream_wrap + * + * SYNOPSIS + * + * SilcStream silc_packet_stream_wrap(SilcPacketStream stream, + * SilcPacketType type, + * SilcPacketFlags flags); + * + * 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. + * + * The silc_stream_set_notifier must be called before the returned stream + * can be used to receive packets. The 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 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); + /****f* silccore/SilcPacketAPI/silc_packet_get_sender * * SYNOPSIS