To organize operating of the KAV SDK in the service mode, you need to perform the following successive steps:
kavehost service configuration file—kavehost.xml.By default, it is located at SDK_folder/etc. The SDK_folder here is the folder where the SDK package is extracted.
For more information, see section "Kavehost service configuration file".
For more information, see section "Kavehost service init script".
kavehost service init script. The kavehost service is now running and waiting for the scanning tasks.kaveInitializeService function.After all scanning tasks are performed, you should call the kaveUninitialize function and stop the kavehost service.
Please use the SIGTERM system signal to terminate kavehost processes. Due to limitations of operating system, using SIGKILL or SIGSTOP signals to terminate kavehost processes is not recommended as it may leave zombie processes.
The following functions are not supported in the KAV_SHT_OUTPROC and KAV_SHT_SERVICE modes of KAV SDK:
kaveSetCallbackIntervalkaveGetCallbackIntervalkaveEnableInprogressEventskaveIsEnabledInprogressEvents.The following functions are not supported in the KAV_SHT_SERVICE mode of KAV SDK:
kaveReloadDatabasesTo reload the anti-virus database, use either init script for the kavehost service or send a user-defined signal such as SIGUSR1 or SIGUSR2 to the service. For more details, see section "Kavehost service init script".
By default, KAV SDK handles both user-defined signals, and thus sending either of the two (SIGUSR1 or SIGUSR2) to the kavehost service will cause reloading of the anti-virus database and start the scanning process with new anti-virus database. This behavior may be overridden using kaveSetAutoReloadSignal function that allows you to specify what user-defined signal your want to be used for reloading of anti-virus database. For more information about specifying user-defined signals for handling by KAV SDK, see kaveSetAutoReloadSignal.
When a user-defined signal is sent to the kavehost service, the service forks a new child process. This child process loads updated anti-virus database. Once loading of the database files is finished, the child service process replaces its parent and scanning continues with updated malware definitions.
kaveEnableAutoreloadIn the service mode, automatic reloading of the anti-virus database is turned on by default and does not require using kaveEnableAutoreload function to enable this feature.
kaveGetDatabasesPathkaveSetTempFolderkaveGetTempFolderkaveGetKsnSettingskaveSetKsnSettings
Customizing service startup
The Kaspersky Anti-Virus Software Development Kit allows you to tailor kavehost service startup to ensure optimal fit-to-environment start conditions.
The following options are available for your use with the kavehost in the command line.
Kavehost server start options
Name |
Description |
|---|---|
-n |
Enables the nodaemon mode for In this mode, the If the |
Handling errors in service mode
When you work with KAV library as a service, errors occurred on the server side may be specifically handled by KAV client. For example, when the server side hosted by kavehost process ends unexpectedly, the client side of KAS library returns the KAV_S_R_NONSCANNED error code on every attempt scan an email following the termination of the kavehost host process.