API Overview
    • PDF

    API Overview

    • PDF

    Article Summary

    Glossary

    TermDescription
    SessionA session encapsulates the processing of a single file, specified either as a file path or a pointer to a memory image of the file.
    Base nameThe base name is the component left after all leading directory components have been removed. The base name can refer to a directory or file.

    Glasswall Technology

    Glasswall provides file inspection, remediation, sanitisation and reporting. The Glasswall API functions give third-party users the ability to fine-tune an interface to the Glasswall functionality.

    The Application Programming Interface (API) is session based. Session is a type that represents a file and the mechanisms used to process that file. You create a Session object by calling GW2OpenSession which returns a session handle. You pass the session handle to other API functions to register the inputs and outputs, the forms of the inputs and outputs (memory or a file) and which processing mode is required (Analysis, Manage & Protect, Import, Export). You then process the file by calling function GW2RunSession and close the session calling GW2CloseSession, after processing any non-persistent storage, or saving non-persistent storage.

    Note: Processing files using multiple threads is not supported. Spawning multiple processes is advised in order to facilitate parallel processing.

    Types

    The API makes available two enumerations for use by clients as argument types to certain API functions. Include the header file “glasswall.core2.api.h” in your source file and use the enumerators when calling the API functions.

    Policy_format

    The enumeration Policy_format is used to specify the format of the policies file. The following enumerator is available:

    PF_XML

    Analysis_format

    The enumeration Analysis_format is used to specify the format of the analysis file. The following enumerator is available:

    AF_XML

    ft_t

    The enumeration Ft_t is used to indicate the file type (file format) of a file. Include header file “filetype.h” in your source code files to use them.

    Note: This is marked for change to 'Ft_t'. Examples in the document use 'Ft_t'.

    Session

    Session is a type that represents a file and the mechanisms used to process that file. It is used by all Glasswall file processing A.P.I. functions.

    Note: this is marked for change to 'SessionHandle'.

    Return Types

    Most of the functions in the Glasswall API return a value that indicates success or failure. The values and their meaning are listed below.

    ValueSystem nameMeaningProcessing Response
    1gw2ret_ok_withcleaningThe file was processed successfully and sanitization applied.Managed File Produced
    0gw2ret_okThe file was processed successfully, some remedies may have been applied.Managed File Produced
    -1gw2ret_generalfailGeneral failure during processing, a system or resource problemEngine Error.
    -2gw2ret_unexpectedEndOfFileEnd of file, or End of file marker was detected unexpectedly.File Processed but discarded.
    -3gw2ret_licenseExpiredLicense file expired, data incorrect or missing.Engine Error.
    -4gw2ret_incorrectSessionSetupA policy file setting is not a valid value (see XSD). Or a registration is incompatible. e.g. trying to register and input file and input buffer when you can only have one source.Engine Error.
    -5gw2ret_incorrectPolicySetupPolicy file unable to be loaded or content error.Engine Error.
    -6gw2ret_unableToLoadInputUnable to load input file or access the buffer containing it.Engine Error.
    -7gw2ret_fileTypeUnknownUnable to determine filetypeUnrecognized File.
    -8gw2ret_unknownSessionIDSession ID used in API call did not appear in list of active Sessions. Session either not created or already deleted.Engine Error.
    -9gw2ret_argumentErrorOne of the arguments in a API call was invalid.Engine Error.
    -10gw2ret_unableToLoadImportUnable to load import data file or access the buffer containing it.Engine Error.
    -11gw2ret_cameraDidNotInitialiseA camera plugin failed to initialize.Engine Error.
    -12gw2ret_noCamerasConnectedNo camera plugins have been loaded.Engine Error.
    -13gw2ret_engineeringOnlyGoesToFileUnused. Reserved for future use.Engine Error.
    -14gw2ret_unableToWriteOutputUnable to write output file or the buffer expecting it.Engine Error.
    -15gw2ret_unableToWriteExportUnable to write export data file or the buffer expecting it.Engine Error.
    -16gw2ret_fileRejectedFile was Processed successfully but disallowed by policy setting. See analysis or GW2FileErrorMsg API call.File Processed but discarded.
    -17gw2ret_unableToWriteExportTextDumpUnable to write text export output file.Engine Error.
    -18gw2ret_unableToWriteAnalysisReportUnable to write analysis report output file.Engine Error.
    -19gw2ret_inputTooLargeInput file is above 2GiB limit.Invalid File.
    -20gw2ret_inputZeroBytesInput file size is 0 bytes.Invalid File.

    Clean Recognised

    ValueSystem name
    1gw2ret_ok_withcleaning
    0gw2ret_ok

    CorruptedRecognised

    ValueSystem name
    -2gw2ret_unexpectedEndOfFile
    -16gw2ret_fileRejected

    Unrecognised File

    ValueSystem name
    -7gw2ret_fileTypeUnknown

    Engine Error

    ValueSystem name
    -1gw2ret_generalfail
    -3gw2ret_licenseExpired
    -4gw2ret_incorrectSessionSetup
    -5gw2ret_incorrectPolicySetup
    -6gw2ret_unableToLoadInput
    -8gw2ret_unknownSessionID
    -9gw2ret_argumentError
    -10gw2ret_unableToLoadImport
    -11gw2ret_cameraDidNotInitialise
    -12gw2ret_noCamerasConnected
    -13gw2ret_engineeringOnlyGoesToFile
    -14gw2ret_unableToWriteOutput
    -15gw2ret_unableToWriteExport
    -17gw2ret_unableToWriteExportTextDump
    -18gw2ret_unableToWriteAnalysisReport

    Invalid File

    ValueSystem name
    -19gw2ret_inputTooLarge
    -20gw2ret_inputZeroBytes

    Each of the API Functions described assumes that one of these values is returned unless stated otherwise in the detailed description.


    Was this article helpful?

    What's Next