int scanFile(char* FilePath, int Setup)

This function scans an SMTP message from a file. A scan result block is allocated for the scan and a handle representing the results is returned. The application can then use this handle to retrieve the scan results using the get...() functions. When the application is finished it MUST release the scan result block with a call to closeScan().

The scanFile() function is nearly identical to the scanBuffer() function except that this function accepts the path to a file (null terminated string) instead of a pointer to a message buffer.

One other key difference with between scanBuffer() and scanFile() is that the SNF engine can be configured to inject its X- headers when scanFile() is used. These same X- headers are available to the calling application when using scanBuffer(), however if the application wishes to pass the message file on to other additional scanners and external processes then scanFile() might be more convenient.

NOTE: There are significant performance implications to scanning files and injecting headers. Each time headers are injected into a message the message file must be rewritten. For optimal performance, it is best to collect headers from scanning tools before writing the message to disk so that the message only needs to be written once. Extra file IO is the cost of the convenience of passing a message file to external processes.

The Setup time passed to scanFile() will be added to the time required to open and read the message file prior to scanning. This value will be passed on to the logging system. For example, the calling application might include the number of milliseconds required to perform any previous message testing and the time it has taken to create a temporary message file for scanning. The log will then reflect the complete setup time separately from the time required to perform the SNF message scan.

The FilePath will be passed on to the logging system to identify this message scan in the logs.

FilePath = The full path (a null terminated string) to the message file to be scanned.
Setup = The time in milliseconds spent so far preparing this message to be scanned.
returns a handle to the scan result block upon success otherwise an error code:
snf_ERROR_NO_HANDLE - There was a problem allocating a scan result block.
snf_ERROR_SCAN_FAILED - There was a problem performing the scan.

In general a result > 0 indicates a valid scan handle and a result <= 0 indicates an error. NOTE that the scan may have failed even if you get a valid handle. The scan result code you retrieve from get...() may indicate an error. See Result Codes for details.

Related Topics