Oracle Email Application Developer's Guide Release 2 (9.0.4) Part Number B10721-01 |
|
|
View PDF |
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:
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 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:
shared-library-path
is the full path of the C shared library. This is loaded by the server at startup.when-to-call
is the point at which the C-interface should be called. The possible values are:
host
and port
specify the host and port at which a virus scanner maybe listening for input.Internal
is used for scanners that do not talk to any external entity for filtering.scanner_flag
any flags the scanner needs to pass to the initialization function.system_flags
are the MTA defined flags. Curently the only value defined is repairmsg=0/1
. If set to 0
, and the message is damaged it is discarded by the scanner interface. If set to True
, the message is repaired. If set to False
, the MTA behaviour is same as failure for damaged messages./work/orahome/lib/libsym.so,DATA,host9999:6000,(essym_init,essym_registercb, essym_scanmsg, essym_send, essym_recv, essym_close),0, repair_msg=1
The following functions must be implemented by each scanner:
vgctx
: Virus scanner interface global context. This is the global context that is initialized and managed by the scanner APIs. It is passed to each scanner interface call.vlctx
: Virus scanner interface local context for each message. This is initialized and used for each message.smtplctx
: SMTP server local context. This is for internal use by the server.msgin
: Buffer containing the message, unused in the current release.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.
system_flags
parameter is set to repairmsg=1
, then repair message is turned onScanner_flags
are the flags set in the scanner definitionParameters: 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:
Parameters: (void
*vgctx,
void
*smtplctx,
char
*msgin,
char
*errmsg
)
Retcode: int
Description:
retrieve-send
and receive-store
message headers and body.msgin
is used to pass the entire message in memory so that callback for retrieve-send
cannot be used to fetch messages from the mail store.errmsg
should be populated with description of error
. errmsg
buffer allocated in the server of size 512 bytes.Return Value:
Parameters: (void
*vlctx
, char
*buf
, int
buflen
)
Retcode: int
Description:
retrieve
and
send
message
for getting the message body. Internally this callback calls this Send()
function multiple times to provide the message to the scanner.buf
.Parameters: (void
*vlctx
, char
*buf
, int
*buflen
)
Retcode: int
Description:
receive
and
store
message
callback for passing any changed message back to the scanner. The callback internally call recv()
function to fetch the message data.recv()
should put in the buffer buf. If fewer than *buflen
bytes received due to EOF, update buflen with the actual number of bytes.Parameters: (void
*vgctx
);
Retcode: void
Description: This is called once at server exit. Perform any cleanup necessary, such as close connections, and free memory.
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.
Fetches the message for the scanner.
Parameters: (void
*vgctx
, void
*vlctx
, void
*smtplctx
)
Reads the changed message from the scanner.
Parameters: (void
*vgctx
, void
*vlctx
, void
*smtplctx
)
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,...)
.
Retrieves the message size.
Parameters: (void
*vgctx
, void
*output
, void
*smtplctx
)
where output is pointer to integer with the result containing the message size.
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.
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.