wac_samples/wacsample/main.cpp
4 /* US Government Users Restricted Rights - Use duplication or disclosure restricted by GSA Schedule Contract with IBM Corp. */
285 void PrintResults( const WacClassificationResult& aWacClassificationResult, const WacCategoriesInfo& aCategoriesInfo )
315 void DoCallWacClassification( const WacClassifier& aWacClassifier, const WacInputData& aWacInputData,
438 std::cout << "Given URL '" << urlLine << "' has no WAC related results available so continue with next entry"
549 myWacClassifier = myWacClassification.createClassifier( myDbConnection, myWacClassifierOptions );
551 // create a categories info for printing out the result application and action as string per input data
560 const DbConnection myUrlConnection = myDca.createDbConnection( myLicense, myUrlConnectionData );
573 myUrlClassifier = myUrlClassification.createDbClassifier( myUrlConnection, myUrlDbClassifierOptions );
bool enable_Feedback
This switches the Feedback feature on or off. This feature collects number of matched applications/ac...
Definition: wac_classification.h:45
WacAction byId(DCA_ACTION_ID_TYPE actionId) const
Returns the action with the given action id.
Is used to create a License object. A license first must be created with DcaInstance::createLicense t...
Definition: base_classes.h:547
static Url create(const DcaInstance &aDcaInstance, const std::string &urlString)
Standard Url creation function.
const WacClassificationResult NullWacClassificationResult
Defines a constant unassigned WacClassificationResult you can use for checks. if ( myWacClassificatio...
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
std::string name(const std::string &localeString=std::string()) const
Returns the localized (display) name of the application.
bool wacDetailsAvailable(const dca::UrlClassificationResults &res) const
Returns whether or not a subsequent WAC classification may provide useful WAC information....
int getMaxSessions() const
Returns the maximum allowed sessions associated with your ticket/license.
time_t getExpirationDate() const
Returns the expiration date of the license in UTC.
Definition of the WacClassificationResult class.
Definition: wac_classification_result.h:27
DatabaseInformation getDatabaseInformation() const
Returns information about the underlying database.
Contains information about underlying database.
Definition: base_classes.h:834
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.
static void SetupInitData(const std::string &redist_folder, InitData &initData)
Sets up the given initData by substituting the given redist_folder with DCA subdirectories.
Definition: generic_samples/getversionsample/main.cpp:88
DCA_ACTION_ID_TYPE actionId() const
If the classification was successful this is the matched action.
void setRequestData(const char *data, size_t data_length)
Sets up the buffer containing the (HTTP) request. This is assumed to contain US ASCII 7-Bit character...
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...
Sets up options for embedded URL detection and provided Feedback mechanism.
Definition: url_classification.h:65
void SetOpenSslCallbacks()
Initializes the required callbacks for OpenSSL when using HTTPS or SSL connections in a multi-threade...
void UnsetOpenSslCallbacks()
Unsets the openssl callbacks. Do not call any DCA function after you have called this function.
int getMaxUsers() const
Returns the maximum allowed users associated with your ticket/license.
void DeinitCUrl()
Deinitializes libcurl. Do not call any DCA function after you have called this function.
Database connection class for a local or remote database.
Definition: base_classes.h:859
WacCategoriesInfo getCategoriesInfo() const
Retrieve the WacCategoriesInfo class.
This header includes all header files of the URL Classification Package.
#define DCA_LOGDIR
Relative directory for logfile(s).
Definition: generic_samples/getversionsample/main.cpp:78
Package header file for the WAC (Web Application Classification) Package.
#define DCA_INITDIR
DCA subdirectory of the DCA initialization data.
Definition: generic_samples/getversionsample/main.cpp:73
dca::FunctionResult classify(const WacInputData &input, WacClassificationResult &result) const
Classification function that takes the given input and return its results (if any) in the provided re...
bool enable_Feedback
This switches the Feedback feature on or off. This is switched off by default.
Definition: url_classification.h:99
std::string name(const std::string &localeString=std::string()) const
Returns the localized (display) name of the action.
Results of an URL classification.
Definition: url_classification_result.h:32
bool detect_EmbeddedUrlsInUrlPath
If set to true, you can specify that embedded URL detection is additionally performed in the path par...
Definition: url_classification.h:84
static void PrintToolHeader()
Prints out the name and the version of this sample.
Definition: generic_samples/getversionsample/main.cpp:178
Defintion of the WacClassification class.
Definition: wac_classification.h:62
Use a License to initialize a classification package or a toolbox package.
Definition: base_classes.h:560
WacActions getActions() const
Returns the contained WacActions.
const DbType DBT_Wac
Used for dca::DbConnection classes for Web Application Classification databases.
Container class for all WAC enumeration objects.
Definition: wac_categoriesinfo.h:39
bool isLicensed(DCA_MODULE_ID_TYPE id=0, bool force=false) const
Checks whether the given License is valid for the given module id.
static void PrintLicenseInfo(const License &aLicense)
Prints out the information about the provided License.
Definition: generic_samples/getversionsample/main.cpp:114
This header includes all header files of the DCA Base Package.
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
WacClassifier createClassifier(const dca::DbConnection &aDbConnection, const WacClassifierOptions &aWacClassifierOptions=WacClassifierOptions()) const
Creates a WacClassifier that is used to classify WacInputData objects.
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
WacApplications getApplications() const
Returns the contained WacApplications.
void setUrlObject(const dca::Url &aUrl)
Sets up the Input Data object by using the given dca::Url object.
static void PrintUsage(const char *name)
Prints out the syntax of the sample.
Definition: generic_samples/getversionsample/main.cpp:188
std::string getLastMessage() const
Returns the last message received from our license server or if none available the last available mes...
void setResponse(const char *data, size_t data_length)
Sets up the buffer containing the (HTTP) response. This is assumed to contain US ASCII 7-Bit characte...
std::string getDescription() const
Returns the description for the error or warning.
WacApplication byId(DCA_APPLICATION_ID_TYPE appid) const
Returns the application with the given application id.
Sets up options for the WAC classification.
Definition: wac_classification.h:33
bool enable_EmbeddedUrlDetection
If set to true embedded URL detection will be used in URL classification. This is switched on by defa...
Definition: url_classification.h:77
#define DCA_BINDIR
DCA subdirectory of the DCA binaries.
Definition: generic_samples/getversionsample/main.cpp:66
DCA_APPLICATION_ID_TYPE applicationId() const
If the classification was successful this is the matched application.
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...
const std::string S_UsageString
Usage string, displayed if a parameter is missing.
Definition: generic_samples/getversionsample/main.cpp:52
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.
static DcaInstance create(const InitData &initData)
Creates a DcaInstance, starts up the DCA API and initializes the required main module.
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.
Definition: generic_samples/getversionsample/main.cpp:102
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.
Definition: generic_samples/getversionsample/main.cpp:201
Generated by
