main.cpp File Reference

URL Classification using a remote URL database sample program. More...

#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include "dca/dca_base.h"
#include "dca/dca_url_classification.h"
#include "dca/dca_callbacks.h"

Go to the source code of this file.


#define DCA_BINDIR   "bin/linux"
 DCA subdirectory of the DCA binaries.
#define DCA_INITDIR   "init"
 DCA subdirectory of the DCA initialization data.
#define DCA_LOGDIR   "./logs"
 Relative directory for logfile(s).


static void SetupInitData (const std::string &redist_folder, InitData &initData)
 Sets up the given initData by substituting the given redist_folder with DCA subdirectories.
static bool StartupLibraries ()
 Initializes 3rd party library libcurl and set up open ssl callbacks to startdard implementation.
static void ShutdownLibraries ()
 Shuts down 3rd party libraries. On Windows also WSACleanup is called to shutdown Windows sockets for this process.
static void SetupLicense (const std::string &ticket, const std::string &product, LicenseData &licenseData)
 Sets up the given licenseData by copying the given ticket and product strings.
static bool SetupConnectionData (const std::string &encData, const std::string &encKey, DbConnectionData &cData)
 Sets up the given cData to use a remote URL database.
static void PrintResults (const CategoriesInfo &catinfos, const UrlClassificationResults &cats)
 Prints out the classification results and uses the categories info for textual representation of the matched categories.
static void PrintToolHeader ()
 Prints out the name and the version of this sample.
static void PrintUsage ()
 Prints out the syntax of the sample.
static void PrintDbConnectionInfo (const DbConnection &aDbConnection)
 Prints out the version and datestamp of the remote database.
static void PrintLicenseInfo (const License &aLicense)
 Prints out the information about the provided License.
static void LoadUrlFile (const std::string &fileName, std::vector< std::string > &urlList)
 Loads given fileName and puts each line to given urlList (by deleting trailing CRLFs).
void TestUrlClassification (const std::string &aUrlListFile, const DcaInstance &myDca, const UrlDbClassifier &myUrlDbClassifier, const CategoriesInfo &myCategoriesInfo)
 Performs the URL database classification with URLs contained in a given text file.
std::string HexToString (const std::string &arg)
 Takes the provided hexstring and returns it as decoded string. If you supply a common string (not started with 0x) this is returned without modifications.
int main (int argc, char *argv[])
 The main routine.


const std::string S_ToolName = "urldbsample_remote"
const std::string S_ToolVersion = "1.3"
std::string G_Locale = "en_US"
LogLevel G_LogLevel = LOG_Notice
const std::string S_UsageString
 Usage string, displayed if a parameter is missing.

Detailed Description

URL Classification using a remote URL database sample program.

Definition in file url_samples/urldbsample_remote/main.cpp.

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1