Function silc_packet_stream_link
SYNOPSIS
SilcBool silc_packet_stream_link(SilcPacketStream stream,
SilcPacketCallbacks *callbacks,
void *callback_context,
int priority, ...);
DESCRIPTION
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);
|