Custom destination type

The custom destination type interface consists of these functions:

distribution.new
Syntax:
     function extern long distribution.new(ref string o.error.msg)
Description:
     Use this function to program the actions to be done before the distribution is created.
Arguments:
     o.error.msg: output parameter, which can be filled with an error message if anything 
       went wrong.
Return value: 0 if processing without errors, otherwise the error code
distribution.set.document.file
Syntax:
     function extern long distribution.set.document.file(
                       const string i.filename,
                       const string i.displayname,
                       const string i.mime.type,
                       ref string o.error.msg)
Description:
     Use this function to program the actions to be done to add the document to the 
        distribution.
Arguments:
     i.filename: input argument with the file name of the document file.
     i.displayname: input argument with the display name of the document file.
     i.mime.type: input parameter with the mime type of the document file.
     o.error.msg: output parameter, which can be filled with an error message if anything 
         went wrong.
Return value: 0 if processing without errors, otherwise the error code
distribution.add.attachment
Syntax:
     function extern long distribution.add.attachment(
                        const string i.filename,
                        const string i.displayname,
                        const string i.mime.type,
                        ref string o.error.msg)
Description:
     Use this function to program the actions to be done to add an attachment to the 
        distribution.
Arguments:
     i.filename: input argument with the file name of the attachment file.
     i.displayname: input argument with the display name of the attachment file.
     i.mime.type: input parameter with the mime type of the attachment file.
     o.error.msg: output parameter, which can be filled with an error message if anything 
         went wrong.
Return value: 0 if processing without errors, otherwise the error code
distribution.set.destination
Syntax:
     function extern long distribution.set.destination(
                        const string i.address, 
                        ref string o.error.msg)
Description:
     Use this function to program the actions to be done to add a destination address to the 
        distribution.
Arguments: 
     i.address: input argument with the address of the destination.
     o.error.msg: output parameter, which can be filled with an error message if anything 
        went wrong.
Return value: 0 if processing without errors, otherwise the error code
distribution.send
Syntax:
     function extern long distribution.send(ref string o.error.msg)
Description:
     Use this function to program the actions to be done in case the distribution is sent.
Arguments:
     o.error.msg: output parameter, which can be filled with an error message if anything 
        went wrong.
Return value: 0 if processing without errors, otherwise the error code
distribution.end
Syntax:
     function extern long distribution.end(ref string o.error.msg)
Description:
     Use this function to program the actions to be done before the distribution is finalized.
Arguments:
     o.error.msg: output parameter, which can be filled with an error message if anything 
        went wrong.
Return value: 0 if processing without errors, otherwise the error code
distribution.cancel
Syntax:
     function extern long distribution.cancel(ref string o.error.msg)
Description:
     Use this function to program the actions to be done before the distribution is cancelled.
Arguments:
     o.error.msg: output parameter, which can be filled with an error message if anything went wrong.
Return value: 0 if processing without errors, otherwise the error code