dca_interface  6.3.4
Getting started with the XFE SDK

Overview

If you did not actually installed the 3rd party libraries, refer to Requirements for using the XFE SDK first.

The Getting started chapter wants you to enable to setup your development system to successfully build the samples provided by the SCA.

The following section describes the files provided by the SCA, and gives an overview of the directory organization of the distribution packages.

File organization

Common Setup/Initialization Tasks

You will need to include the given header files into your C++ project, and link your project with the provided linker libraries.

To use the SCA you will need to set up process-wide initialization functions for 3rd party libraries in order to properly run the update function and license mechanisms.

Initialization of 3rd party libraries

The first step when using the SCA API is to create the dca::DcaInstance.

Initializing and Deinitializing the API

In the next step, a dca::License object must be created that is required for the initialization of the various classification modules and toolboxes.

Set up a license object

Classifications

When using the URL Classification module (or other modules that require a signature database), you will first need to set up a database connection. This defines where the requests will be sent to.

Setting up a Database Connection

The next section describes how to use the URL Classification module.

URL Classification

The next section describes how to use the HTML Text Classification module.

HTML Text Classification

The next section describes how to use the ZLA (Zero Level Analysis) Classification module.

Zero Level Analysis (ZLA)

The next section describes how to use the WAC (Web Application Classification) module.

Web Application Classification (WAC)

The next section describes how to use the IPR (IP Reputation Classification) module.

IP Reputation Classification (IPR)

The next section describes how to use the Malware (Malware Classification) module.

Malware Classification

Updates

You will need to establish the required update tasks. The next section shows how to do this.

Content and Engine Updates, and how to implement the required tasks

Custom Database Toolbox

The SCA supports the use of a Custom Database that can be used additionally or instead of the internal URL signature database used in the URL Classification module.

Custom Database Module
Example implementation of a schedule event subscriber.
Is used to create a License object. A license first must be created with DcaInstance::createLicense t...
Definition: base_classes.h:547
Exception class used in the DCA.
Definition: base_classes.h:237
bool isCategorized() const
Returns whether or not the URL matched one or more categories.
static Url create(const DcaInstance &aDcaInstance, const std::string &urlString)
Standard Url creation function.
Single result of a text classification.
const WacClassificationResult NullWacClassificationResult
Defines a constant unassigned WacClassificationResult you can use for checks. if ( myWacClassificatio...
DCA_ZLA_RESULT result() const
Returns the result for the ZLA classification.
void InitCUrl()
Initializes libcurl. Do not use any DCA function before initializing libcurl.
std::string initDir
the directory in which the DCA init files are stored
Definition: base_classes.h:266
HtmlTextClassifier createHtmlClassifier() const
Creates a HtmlTextClassifier that is used to classify HtmlText objects.
ZLA classifier object for ZLA classification.
This header includes all header files of the Malware Classification Package.
std::string getDescription() const
Returns a description of the error.
static ZlaClassification create(const DcaInstance &aDcaInstance, const License &aLicense)
Initializes the ZlaClassification module.
DCA_RESULT_TYPE getReturnCode() const
Returns the last error code (if any).
FunctionResult classify(const Url &aUrl, UrlClassificationResults &urlResults) const
Performs the URL classification and returns the results.
std::string binDir
the directory in which the DCA binary (*.dca) files are stored
Definition: base_classes.h:265
This header includes initialization/deinitialization support functions for the 3rd party libraries us...
unsigned int encryptionKey
The encryption key to be used (provided with your license)
Definition: base_classes.h:779
Encapsulates the results of an update process.
Definition: base_classes.h:998
void SetOpenSslCallbacks()
Initializes the required callbacks for OpenSSL when using HTTPS or SSL connections in a multi-threade...
Stores the connection data for a database.
Definition: base_classes.h:815
void UnsetOpenSslCallbacks()
Unsets the openssl callbacks. Do not call any DCA function after you have called this function.
ScheduleModuleId
This defines the module id of a schedule event.
Definition: base_classes.h:511
ScheduleActionType
This defines the action type of a schedule event.
Definition: base_classes.h:495
const DCA_ZLA_RESULT ZLA_HAM
The email data is classified as HAM.
void DeinitCUrl()
Deinitializes libcurl. Do not call any DCA function after you have called this function.
The ZLA Classification module class.
bool isUnknownUrl() const
Returns whether a URL is known or unknown. A URL is unknown if it is not contained in the database.
Database connection class for a local or remote database.
Definition: base_classes.h:859
Package header file for the IPR (IP Reputation) Classification Package.
Encapsulates an email object.
Definition: base_email.h:24
This header includes all header files of the URL Classification Package.
virtual void onEvent(dca::ScheduleActionType actionType, dca::ScheduleModuleId moduleId, const std::string &version, const std::string &text)
Implementation of interface class method onEvent.
#define DCA_LOGDIR
Relative directory for logfile(s).
This header includes all header files of the Text Classification Package.
Main class for the URL classification.
Package header file for the WAC (Web Application Classification) Package.
#define DCA_INITDIR
DCA subdirectory of the DCA initialization data.
DCA_RESULT_TYPE getReturnCode() const
Gets the code of the error.
const DCA_ZLA_RESULT ZLA_UNKNOWN
The email data is unknown i.e. there was not enough data for classification or no ZLA match.
Results of an URL classification.
URL database classifier class.
This header includes all header files of the ZLA Classification Package.
double score() const
Returns the score of the classification (if any), range is from 0.0 to 1.0.
Use a License to initialize a classification package or a toolbox package.
Definition: base_classes.h:560
bool isCategorized() const
Returns whether there are any results for the text classification.
const DCA_ZLA_RESULT ZLA_SPAM
The email data is classified as SPAM.
bool isLicensed(DCA_MODULE_ID_TYPE id=0, bool force=false) const
Checks whether the given License is valid for the given module id.
std::string ticket
The ticket as provided in the license.
Definition: base_classes.h:548
This header includes all header files of the DCA Base Package.
Overall result of a ZLA classification.
bool useLocalDatabase
Set to true to connect to a local or custom database, set to false to use a remote database.
Definition: base_classes.h:821
DCA_SIZE_TYPE size() const
Returns the number of results in the container.
static HtmlText create(const DcaInstance &aDcaInstance, const std::string &htmlContent)
Creates an HTML text object, used as an input parameter for text classification.
static Email create(const DcaInstance &aDcaInstance, const std::string &emailContent)
Creates an email object, used as an input parameter for ZLA classification.
Encapsulates the init and deinit of the DCA API.
Definition: base_classes.h:315
HTML text classifier object for text classification.
FunctionResult classify(const HtmlText &aText, TextClassificationResults &aTextResults) const
The HTML Text Classification method. The method takes an initialized HtmlText object and returns the ...
DCA_CATEGORY_ID_TYPE id() const
Returns the category id of the classification (if any).
std::string product
The product code used with the license.
Definition: base_classes.h:549
DCA_ZLA_TYPE module() const
Returns the module type for the ZLA classification.
const DCA_ZLA_RESULT ZLA_NDR
The email data is classified as NDR (non-delivery-report)
FunctionResult classify(const Email &anEmail, ZlaClassificationResult &aZlaResult) const
The email classification method. The method takes an initialized Email object and returns the results...
const DbType DBT_Url
Used for DbConnection classes for URL classification.
static UrlClassification create(const DcaInstance &aDcaInstance, const License &aLicense)
Creates the URL classification module by using the given DcaInstance and License.
std::string logDir
the directory in which the DCA log file should be created
Definition: base_classes.h:267
size_t DCA_INDEX_TYPE
Type for index access (used for arrays and collections).
Definition: base_types.h:66
DbType dbType
The type of the database.
Definition: base_classes.h:820
std::string getDescription() const
Returns the description for the error or warning.
Encapsulates an HTML text object.
Definition: base_htmltext.h:24
Overall results of a text classification.
size_t DCA_SIZE_TYPE
Type for size (used for size of array and collections).
Definition: base_types.h:72
DbConnectionRemoteServerData remoteServerData
If you are creating a remote database connection, this structure must be filled out with the encrypti...
Definition: base_classes.h:824
static TextClassification create(const DcaInstance &aDcaInstance, const License &aLicense)
Initializes the TextClassification module.
#define DCA_BINDIR
DCA subdirectory of the DCA binaries.
Standard function result.
Definition: base_classes.h:148
An interface for schedule event notifications. Derive a class from this interface and implement onEve...
Definition: base_classes.h:526
Encapsulates a URL object.
Definition: base_url.h:44
The HTML Text Classification module class.
UrlDbClassifier createDbClassifier(const DbConnection &aDbConnection, const UrlDbClassifierOptions &options=UrlDbClassifierOptions()) const
Create a URL database classifier. The classifier is created by using the provided database connection...
ZlaClassifier createClassifier(const DbConnection &aDbConnection) const
Creates a ZlaClassifier used to classify Email objects.
DbConnection createDbConnection(const License &aLicense, const DbConnectionData &dbcData, const ProxySettings &proxySettings=ProxySettings(), LogLevel aLogLevel=LOG_Initial) const
Creates a DbConnection object using the given DbConnectionData.
This structure is used to initialize the DcaInstance.
Definition: base_classes.h:264
This header includes all header files of the Custom Database Module Toolbox.
static DcaInstance create(const InitData &initData)
Creates a DcaInstance, starts up the DCA API and initializes the required main module.
std::string encryptionData
The encryption data to be used (provided with your license)
Definition: base_classes.h:778
License createLicense(const LicenseData &licData, const ProxySettings &proxySettings=ProxySettings(), LogLevel aLogLevel=LOG_Initial) const
Creates a License object using the given LicenseData.
int main(int argc, char *argv[])
The main routine.