Below are presented the functions that were described and some detailes of using them:

///Struct defining a char* elements array.
/**
* Struct stringArray used for holding the RCPTs list, and the scannedReject() messages
*/
struct stringArray {
        char **elements;
        int length;
};
///Struct defining the virus or spam results for the current mail
/**
  * An instance of the virus_spam structure will be passed to the write functions to be
  * used for the Sieve virustest and spamtest extension
  *
  * Thus, if the filter implementing this library is an anti-virus, it MUST set the virusTest member
  * and if it is an anti-spam filter, the spamTest member. In the case the filter is both,
  * it must set both the virusTest and spamTest members. If the filter is neither an anti-virus,
  * nor an anti-spam filter, it will pass an instance with the members set to 0.
  *
  * The values which are to be set are described as follows: (as defined in RFC 3685)
  *
  * SPAMTEST:
  *   0          message was not tested for spam
  *   1          message was tested and is clear of spam
  *   2 - 9      message was tested and has a varying likelihood of
  *              containing spam in increasing order
  *   10         message was tested and definitely contains spam
  *
  * VIRUSTEST:
  *   0          message was not tested for viruses
  *   1          message was tested and contains no known viruses
  *   2          message was tested and contained a known virus which
  *              was replaced with harmless content
  *   3          message was tested and contained a known virus
  *              which was "cured" such that it is now harmless
  *   4          message was tested and possibly contains a
  *              known virus
  *   5          message was tested and definitely contains a
  *              known virus
  */
struct virus_spam {
        int virusTest;
        int spamTest;
        virus_spam():virusTest(0),spamTest(0) {}
};
///Enum of return types.
/**
  * Enum that defines the return types of most of the functions, and also defines the
  * error codes that will be passed as an argument in the virtual functions error() and warning()
  */
enum ReturnTypes {
        //error return types
        RT_INVALID_STATE 		= -11,	/*!< functions were not called in the correct order (WILL NOT CALL error()) */
        RT_COMPLETE_ERROR 		= -10,	/*!< the function complete() returned -1 */
        RT_PROCESSING_ERROR 	        = -9,	/*!< the function process() returned -1 */
        RT_INVALID_ARGUMENTS 	        = -8,	/*!< invalid arguments were passed to a function */
        RT_UNKNOWN_ERROR 		= -7,	/*!< unknown error */
        RT_ERROR_QUEUE 			= -6,	/*!< error while creating/accessing mail queue */
        RT_ERROR_INTERNAL 		= -5,	/*!< structures used in this library were not in correct state */
        RT_ERROR_PROTOCOL 		= -4,	/*!< an error occurred in the communication protocol */
        RT_ERROR_SOCKET_WRITE 	        = -2,	/*!< socket write error */
        RT_ERROR_SOCKET_READ 	        = -1,	/*!< socket read error */
        RT_ERROR_CONN_CLOSED	        = -12,	/*!< connection closed by the client*/
        RT_READ_TIMEOUT			= 0,    /*!< timeout on read operation */
        RT_WRITE_TIMEOUT		= 10,    /*!< timeout on write operation */
        //success return types
        RT_CLEAN_COMPLETE 		= 15,	/*!< reseting the connector's state completed */
        RT_WRITE_AND_CLEAN_COMPLETE     = 16, /*!< writing information and reseting the connector's state completed */
        RT_PROCESSING_COMPLETE 	        = 14,	/*!< reading information and processing completed */
        //reserved return types
        RT_READ_COMPLETE 		= 11,	/*!< reading information from axigen completed (for a certain mail). will not appear in current version */
        RT_WRITE_COMPLETE 		= 13,	/*!< writing information to axigen completed (for a certain mail). will not appear in current version */
};
/// Constructor
/**
* constructs an AxigenFilter connector
* \param filterName name of the filter (must have max. 128 chars) and MUST not contain spaces
* \param fileDescriptor the socket fileDescriptor used for communicating with axigen 
* (must be valid)
* \param queuePath location where the mail queue should be created if it cannot connect
* with axigen's queue (must not be NULL)
* \param bindTimeout the timeout used when trying to bind a mail in the queue (used if it shares
* the queue with axigen), default -1 (infinite)
* \param socketTimeout the socket timeout in milisecconds
*/
AxigenFilter(const char *filterName, int descriptor, const char *queuePath, 
                          int bindTimeout = -1, int socketTimeout = 500);
/// Destructor
/** 
  * destructs an AxigenFilter connector
  */
~AxigenFilter();
///Initialises the library.
/**
  * This function initialises the library and MUST be called once per process, before any
  * other function (this includes the constructor) is called
  */
static void init();
///Cleanup of the library.
/**
  * This function performes the cleanup of the library, it MUST be called after all other functions
  * and before the process ends, it also must be called once per process
  */
static void cleanup();
///Reads information from axigen, for a certain mail.
/**
  * This function also connects to axigen for retrieving queue information. It should be
  * called when data is available for reading on the socket. This function writes on socket
  * \return the error or success code as defined above. It also calls error() with the 
  * respective error code when any error. If the error is RT_INVALID_ARGUMENTS, it refers to 
  * an argument error in the constructor. For some of the codes defined above, for example, 
  * RT_READ_TIMEOUT and RT_WRITE TIMEOUT, the error() function will not be called 
  */
ReturnTypes read();
/// Resets the connector state and prepares for the next mail
/**
  * This function is called by any write function except when complete() returns -1,
  * then it must be called manually.
  * \param when true, it removes the mail form the local queue (if the queue is not shared)
  * MUST always be set to true, except the case when writeNeedsCleaning() is the write function
  * and complete() returns -1
  * \return error or success code defined above
  */
ReturnTypes clean(bool remove = true);
/// Writes a response to axigen for a certain mail
/**
  * The message was modified, cleaned and can be delivered to the user's mailbox
  * \warning Implementations MUST call only one write function for a given mail
  * \param a message to the axigen
  * \return an error or success code as defined above
  */
ReturnTypes writeCleannedOk(const char *message,virus_spam test);
/// Writes a response to axigen for a certain mail
/**
  * The message was modified, cleaned and because the respective operation was
  * unsuccessful or because of other reasons,  the message is not safe to be delivered
  * to the user's mailbox (this does not necessary mean that it will not be delivered)
  * \warning Implementations MUST call only one write function for a given mail
  * \param a message to the axigen
  * \return an error or success code as defined above
  */
ReturnTypes writeCleannedReject(const char *message, virus_spam test);
/// Writes a response to axigen for a certain mail
/**
  * The message was scanned, NOT modified and can be delivered to the user's mailbox
  * \warning Implementations MUST call only one write function for a given mail
  * \param a message to the axigen
  * \return an error or success code as defined above
  */
ReturnTypes writeScannedOk(const char *message, virus_spam test);
/// Writes a response to axigen for a certain mail
/**
  * The message was scanned, NOT modified and because something was found wrong
  * or because of other reasons,  the message is not safe to be delivered to the user's
  * mailbox (this does not necessary mean that it will not be delivered)
  * \warning Implementations MUST call only one write function for a given mail
  * \param a list of messages to be send to axigen, for example the list of viruses found
  * \return an error or success code as defined above
  */
ReturnTypes writeScannedReject(stringArray *messages, virus_spam test);
/// Writes a response to axigen for a certain mail
/**
  * The message was scanned, NOT modified and the implementation, needs to clean it
  * or take some other action, in any case, needs to MODIFY the mail message
  * \warning Implementations MUST call only one write function for a given mail
  * \return an error or success code as defined above
  */
ReturnTypes writeNeedsCleaning();
/// Error callback function
/** 
  * Virtual function that will be called when an error occurs
  * \param errorCode, the error code as defined above
  */
virtual void error(ReturnTypes errorCode) = 0;
/// Warning callback function
/** 
  * virtual function that will be called when a warning occurs
  * \param errorCode, the error code as defined above
  */
virtual void warning(ReturnTypes warningCode) = 0;
/// Mail processing callback function
/** 
  * Virtual function that will be called from the function read() if no error has occurred
  * it should be used for the processing of the mail
  * \param filename, the path to the mail stream, can be opened for write.
  * \param rpath, the return path from the mail envelope
  * \param rcpts[], the list of rcpts from the mail envelope
  * \param allowclean, tells if the implementation is allowed to clean the mail. If allowclean
  * is false, the impl. MUST not modyfy the file but call writeNeedsCleaning as the write function
  * if it needs to. If allowclean is true, the impl. MUST not call allowclean as the write function.
  * \return should return 0 on success and -1 on error, it it return -1, the function error()
  * will be called with the parameter: RT_PROCESSING_ERROR
  * \retval 0 on success
  * \retval 1 on error
  */
virtual int process(const char *filename, const char *rpath, stringArray *rcpts,
                                        bool allowclean) = 0;
/// Cleanup callback function
/**
  * Virtual function that will be called from any of the write function if the writing on
  * the socket was successful. The function should return 0 on success and -1 on error
  * If the function returns -1, the function error() will be called with the argument set to:
  * RT_COMPLETE_ERROR. In it returns 0, clean() will be called that will reset the state for the
  * next mail. If it returns -1, the write function does not call clean() which MUST be called
  * by the implementation at a later time but before the next call to read()
  * \return should return 0 on success and -1 on error or if it is wanted the clean()
  * function not to be called
  * \retval 0 on success
  * \retval 1 on error
  */
virtual int complete() = 0;

