Chapter 2. Programming with libkavclient

Table of Contents

Overview
Allocating session context
Error handling
Setting connection parameters
Checking files
Checking multiple files and specifying options
Checking memory regions
Advanced functions for memory checking
Interpreting check results
Deallocating session context
libkavclient error codes

Overview

The kavclientAPI is declared in the header file kavclient.h and implemented in libkavclient.so shared library or libkavclient.a static library. A typical application that is using the libkavclient library would have the line #include <kavclient.h> in its source code and link with -lkavclient option.

A typical scenario of using the libkavclient library includes the following steps.

  1. Allocating a session context, which is a data structure that links together relalated kavclient™ calls.

  2. Setting KAVDaemon connection parameters (optionally; only if non-default settings are needed).

  3. Checking one or more files and/or memory regions.

  4. Interpreting the results of the check.

  5. Deallocating the session context.

The following sections detail how to perform each of these steps with libkavclient.