+/* Sets the callback functions for the SKE session.
+
+ The `send_packet' callback is a function that sends the packet to
+ network. The SKE library will call it at any time packet needs to
+ be sent to the remote host.
+
+ The `payload_receive' callback is called when the remote host's Key
+ Exchange Start Payload has been processed. The payload is saved
+ to ske->start_payload if the application would need it. The application
+ must also provide the payload to the next state of the SKE.
+
+ The `verify_key' callback is called to verify the received public key
+ or certificate. The verification process is most likely asynchronous.
+ That is why the application must call the completion callback when the
+ verification process has been completed. The library then calls the user
+ callback (`proto_continue'), if it is provided to indicate that the SKE
+ protocol may continue.
+
+ The `proto_continue' callback is called to indicate that it is
+ safe to continue the execution of the SKE protocol after executing
+ an asynchronous operation, such as calling the `verify_key' callback
+ function, which is asynchronous. The application should check the
+ ske->status in this function to check whether it is Ok to continue
+ the execution of the protocol.
+
+ The `check_version' callback is called to verify the remote host's
+ version. The application may check its own version against the remote
+ host's version and determine whether supporting the remote host
+ is possible.
+
+ The `context' is passed as argument to all of the above callback
+ functions. */
+
+void silc_ske_set_callbacks(SilcSKE ske,
+ SilcSKESendPacketCb send_packet,
+ SilcSKECb payload_receive,
+ SilcSKEVerifyCb verify_key,
+ SilcSKECb proto_continue,
+ SilcSKECheckVersion check_version,
+ void *context)
+{
+ if (ske->callbacks)
+ silc_free(ske->callbacks);
+ ske->callbacks = silc_calloc(1, sizeof(*ske->callbacks));
+ ske->callbacks->send_packet = send_packet;
+ ske->callbacks->payload_receive = payload_receive;
+ ske->callbacks->verify_key = verify_key;
+ ske->callbacks->proto_continue = proto_continue;
+ ske->callbacks->check_version = check_version;
+ ske->callbacks->context = context;
+}
+