Setting connection parameters

In order to connect to KAVDaemon libkavclient needs to know the path to the KAVDaemon's listening socket. By default this path is /var/run/AvpCtl, and libkavclient will use it automatically. However, if you configured KAVDaemon to use a non-default socket path (you can do so by giving KAVDaemon the -f command-line option), you need to tell libkavclient where the socket is. Use the following function to do so.

void kav_set_socketpath(kav_ctx ctx, const char *socket_path);

The kav_set_socketpath function tells libkavclient to connect to the Unix domain socket socket_path when performing checks within the session context ctx. Note that the setting is context-specific.

To have libkavclient use the default socket path again, call kav_set_socketpath with socket_path parameter set to NULL.

The kav_set_socketpath function makes a copy of the socket_path string, and will free the copy made by a previous call. This copy is also freed when the entire context is freed with kav_free. Thus, it is safe to call this function several times on the same context.

To find out what socket path a given session context uses, call the following function:

const char *kav_get_socketpath(kav_ctx ctx);

The kav_get_socketpath returns the socket path used by the session context ctx. When the default path is used, it returns NULL. You should not modify the string returned by this function.

The libkavclient functions that communicate to KAVDaemon will not wait for KAVDaemon to respond indefinitely. After a certain timeout they will give up and return error. This prevents an application that uses libkavclient from hanging if KAVDaemon process accidentally hangs or terminates. By default, this timeout is 5 seconds, which is adequate for most applications. However, you can change the timeout if you need to. Use the following function to do so:

void kav_set_timeout(kav_ctx ctx, int value);

The kav_set_timeout function sets the timeout used by the ctx session context to value seconds.

To find out what timeout the given session context uses, call the following function:

int kav_get_timeout(kav_ctx ctx);

The kav_get_timeout function returns the timeout used by the session context ctx.

The functions described in this section always succeed (provided they are given a properly allocated parameters), and don't set libkavclient error code.