Skip Headers

Oracle Email Application Developer's Guide
Release 2 (9.0.4)

Part Number B10721-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

3
SMTP Scanner Interface APIs

This chapter describes the Oracle Email SMTP scanner interface APIs that can be used to create customized clients, integrate applications, and support certain extensions.

This chapter contains the following topics:

Overview

SMTP server can be integrated with custom procedures for filtering and scanning. These procedures are implemented as C language functions and linked with the server. Each filter or scanner must implement a set of functions that the server calls at different stages of processing. Within each scanner, there is a set of callback functions that can be called to retrieve message headers and data.

Format and Entry

Format and typical entry in the LDAP server parameter specifying the list of scanner interfaces:

shared-library-path, when-to-call, [internal | host:port], function set:   
(initialization, register callback, scan  message, send, receive, 
close),scanner_flags,system_flags

where:

Example
/work/orahome/lib/libsym.so,DATA,host9999:6000,(essym_init,essym_registercb,    
essym_scanmsg, essym_send, essym_recv, essym_close),0, repair_msg=1

Scanner Interface APIs

The following functions must be implemented by each scanner:

Initialization()

Parameters: void **vgctx, char *host, sb4 port, char *system_flags, char *scanner_flags

Retcode: int

Description:

This is called once during the lifetime of by the server at startup, once during the lifetime of the process. Perform scanner initialzation with minimal step of creating a global context for scanner use (return pointer a void in vgctx for subsequent use by the framework.

register_callback()

Parameters: void *vgctx, int (*cb)(void*, void*,void*), unsigned int flags)

Retcode: int

Description:

The server provides a set of functions that the scanner can call to get message information. The function names of these are not predefined but are passed by the server to this function. After the call to initialization(), the server calls this for each of sever functions available to get message data. Store call back routine cb for later use in scan message.

The flags parameter specifies the kind of callback with following values:

scan_message()

Parameters: (void *vgctx, void *smtplctx, char *msgin, char *errmsg)

Retcode: int

Description:

Return Value:

send()

Parameters: (void *vlctx, char *buf, int buflen)

Retcode: int

Description:

recv()

Parameters: (void *vlctx, char *buf, int *buflen)

Retcode: int

Description:

close()

Parameters: (void *vgctx);

Retcode: void

Description: This is called once at server exit. Perform any cleanup necessary, such as close connections, and free memory.

Callback Routine Descriptions

These functions are available to retrieve message data. The signature of all callbacks is generic. For example, int (*cb) (void *, void *, void *). The parameter value types are given below for each call back.

Send Message

Fetches the message for the scanner.

Parameters: (void *vgctx, void *vlctx, void *smtplctx)

Receive Message

Reads the changed message from the scanner.

Parameters: (void *vgctx, void *vlctx, void *smtplctx)

Get Envelope

Gets the message envelope.

Parameters: (void *vgctx, void *output, void *smtplctx)

where:

output is of type char ** (memory allocated in framework) with the envelope information in the format host=hostname|mailfrom=sender info|rcptto=(rcpt1,rcpt2,...).

Get Message Size

Retrieves the message size.

Parameters: (void *vgctx, void *output, void *smtplctx)

where output is pointer to integer with the result containing the message size.

Free Memory

Frees the output parameter of the Get Envelope callback.

Parameters: (void *vgctx, void *input, void *smtplctx)

where:

input is the pointer to the buffer to be freed. This buffer must have been allocated earlier by the framework.

Set Version Definition

Sets the version of the scanner which was used to scan the message.

Parameters: (void *vgctx, void *input, void *smtplctx)

where:

input is a string containing version definition string for virus scanner. This routine should be called by the scanner API if the version definition information is available from virus scanner.