C# Class nClam.ClamClient

Datei anzeigen Open project: tekmaven/nClam Class Usage Examples

Public Methods

Method Description
ClamClient ( string server, int port = 3310 ) : System

A class to connect to a ClamAV server and request virus scans

GetVersionAsync ( ) : Task

Gets the ClamAV server version

GetVersionAsync ( CancellationToken cancellationToken ) : Task

Gets the ClamAV server version

PingAsync ( ) : Task

Executes a PING command on the ClamAV server.

PingAsync ( CancellationToken cancellationToken ) : Task

Executes a PING command on the ClamAV server.

ScanFileOnServerAsync ( string filePath ) : Task

Scans a file/directory on the ClamAV Server.

ScanFileOnServerAsync ( string filePath, CancellationToken cancellationToken ) : Task

Scans a file/directory on the ClamAV Server.

ScanFileOnServerMultithreadedAsync ( string filePath ) : Task

Scans a file/directory on the ClamAV Server using multiple threads on the server.

ScanFileOnServerMultithreadedAsync ( string filePath, CancellationToken cancellationToken ) : Task

Scans a file/directory on the ClamAV Server using multiple threads on the server.

SendAndScanFileAsync ( Stream sourceStream ) : Task

Sends the data to the ClamAV server as a stream.

SendAndScanFileAsync ( Stream sourceStream, CancellationToken cancellationToken ) : Task

Sends the data to the ClamAV server as a stream.

SendAndScanFileAsync ( byte fileData ) : Task

Sends the data to the ClamAV server as a stream.

SendAndScanFileAsync ( byte fileData, CancellationToken cancellationToken ) : Task

Sends the data to the ClamAV server as a stream.

SendAndScanFileAsync ( string filePath ) : Task

Reads the file from the path and then sends it to the ClamAV server as a stream.

SendAndScanFileAsync ( string filePath, CancellationToken cancellationToken ) : Task

Reads the file from the path and then sends it to the ClamAV server as a stream.

Private Methods

Method Description
ExecuteClamCommandAsync ( string command, CancellationToken cancellationToken, Func additionalCommand = null ) : Task

Helper method which connects to the ClamAV Server, performs the command and returns the result.

SendStreamFileChunksAsync ( Stream sourceStream, Stream clamStream, CancellationToken cancellationToken ) : Task

Helper method to send a byte array over the wire to the ClamAV server, split up in chunks.

Method Details

ClamClient() public method

A class to connect to a ClamAV server and request virus scans
public ClamClient ( string server, int port = 3310 ) : System
server string Address to the ClamAV server
port int Port which the ClamAV server is listening on
return System

GetVersionAsync() public method

Gets the ClamAV server version
public GetVersionAsync ( ) : Task
return Task

GetVersionAsync() public method

Gets the ClamAV server version
public GetVersionAsync ( CancellationToken cancellationToken ) : Task
cancellationToken CancellationToken
return Task

PingAsync() public method

Executes a PING command on the ClamAV server.
public PingAsync ( ) : Task
return Task

PingAsync() public method

Executes a PING command on the ClamAV server.
public PingAsync ( CancellationToken cancellationToken ) : Task
cancellationToken CancellationToken
return Task

ScanFileOnServerAsync() public method

Scans a file/directory on the ClamAV Server.
public ScanFileOnServerAsync ( string filePath ) : Task
filePath string Path to the file/directory on the ClamAV server.
return Task

ScanFileOnServerAsync() public method

Scans a file/directory on the ClamAV Server.
public ScanFileOnServerAsync ( string filePath, CancellationToken cancellationToken ) : Task
filePath string Path to the file/directory on the ClamAV server.
cancellationToken CancellationToken cancellation token used for request
return Task

ScanFileOnServerMultithreadedAsync() public method

Scans a file/directory on the ClamAV Server using multiple threads on the server.
public ScanFileOnServerMultithreadedAsync ( string filePath ) : Task
filePath string Path to the file/directory on the ClamAV server.
return Task

ScanFileOnServerMultithreadedAsync() public method

Scans a file/directory on the ClamAV Server using multiple threads on the server.
public ScanFileOnServerMultithreadedAsync ( string filePath, CancellationToken cancellationToken ) : Task
filePath string Path to the file/directory on the ClamAV server.
cancellationToken CancellationToken cancellation token used for request
return Task

SendAndScanFileAsync() public method

Sends the data to the ClamAV server as a stream.
public SendAndScanFileAsync ( Stream sourceStream ) : Task
sourceStream Stream Stream containing the data to scan.
return Task

SendAndScanFileAsync() public method

Sends the data to the ClamAV server as a stream.
public SendAndScanFileAsync ( Stream sourceStream, CancellationToken cancellationToken ) : Task
sourceStream Stream Stream containing the data to scan.
cancellationToken CancellationToken cancellation token used for request
return Task

SendAndScanFileAsync() public method

Sends the data to the ClamAV server as a stream.
public SendAndScanFileAsync ( byte fileData ) : Task
fileData byte Byte array containing the data from a file.
return Task

SendAndScanFileAsync() public method

Sends the data to the ClamAV server as a stream.
public SendAndScanFileAsync ( byte fileData, CancellationToken cancellationToken ) : Task
fileData byte Byte array containing the data from a file.
cancellationToken CancellationToken cancellation token used for request
return Task

SendAndScanFileAsync() public method

Reads the file from the path and then sends it to the ClamAV server as a stream.
public SendAndScanFileAsync ( string filePath ) : Task
filePath string Path to the file/directory.
return Task

SendAndScanFileAsync() public method

Reads the file from the path and then sends it to the ClamAV server as a stream.
public SendAndScanFileAsync ( string filePath, CancellationToken cancellationToken ) : Task
filePath string Path to the file/directory.
cancellationToken CancellationToken cancellation token used for request
return Task