main.cpp File Reference

IPR classification sample that takes a list if IP addresses from a text file and classifies them. More...

#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <ctime>
#include "dca/dca_base.h"
#include "dca/dca_ipr_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 &strRedistFolder, InitData &aInitData)
 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 &strTicket, const std::string &strProduct, LicenseData &aLicenseData)
 Sets up the given licenseData by copying the given ticket and product strings.
static void SetupConnectionData (DbConnectionData &aDbConnectionData)
 Sets up the given cData to use a local database.
static void PrintDbConnectionInfo (const DbConnection &aDbConnection)
 Prints out the version and datestamp of the local IPR database.
static void PrintLicenseInfo (const License &aLicense)
 Prints out the information about the provided License.
static void PrintToolHeader ()
 Prints out the name and the version of this sample.
static void PrintUsage (const char *pSampleName)
 Prints out the syntax of the sample.
void PrintResult (const IprClassificationResult &aIprClassificationResult, const IprCategories &aIprCategories, const IprEnums &aIprEnums, const std::string &strIndent="")
 Prints out one result item of the IPR classification (and translate ids to names).
void PrintResults (const IprClassificationResults &aIprClassificationResults, const IprCategoriesInfo &aIprCategoriesInfo)
 Prints out the results of the IPR classification.
void DoCallIprClassification (const std::vector< std::string > &aIpStrings, const IprClassifier &aIprClassifier, const IprCategoriesInfo &aIprCategoriesInfo)
 Performs the classification and in case of an error prints out the details.
void TestIprClassification (const IprClassifier &aIprClassifier, const IprCategoriesInfo &aIprCategoriesInfo, const std::string &strFileName)
 Reads in IP input data from a file, calls the IPR classifier on this data and prints out the results.
int main (int argc, char *argv[])
 The main routine.


const std::string S_ToolName = "iprsample"
const std::string S_ToolVersion = "1.3"
const std::string S_UsageString
 Usage string, displayed if a parameter is missing.

Detailed Description

IPR classification sample that takes a list if IP addresses from a text file and classifies them.

Definition in file ipr_samples/iprsample/main.cpp.

Generated on 26 Sep 2016 for dca_interface by  doxygen 1.6.1