plugin_document.h

Go to the documentation of this file.
00001 /*
00002  * File Name: plugin_document.h
00003  */
00004 
00005 /*
00006  * This file is part of uds-plugin-common.
00007  *
00008  * uds-plugin-common is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * uds-plugin-common is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00020  */
00021  
00022 /**
00023  * Copyright (C) 2008 iRex Technologies B.V.
00024  * All rights reserved.
00025  */
00026 
00027 #ifndef PLUGIN_DOCUMENT_H_
00028 #define PLUGIN_DOCUMENT_H_
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 #include "plugin_type.h"
00035 #include "plugin_unknown.h"
00036 
00037 /**
00038  * @brief Universal Document Shell Plugin Document interface.
00039  * Through IPluginDocument, caller can open and close a specified document,
00040  * estimate whether an interface pointer delegates an opened document object,
00041  * and create a new view object.
00042  */
00043 typedef struct 
00044 {
00045 
00046     /**
00047      * @brief Open specified document. 
00048      * @param thiz IPluginUnknown pointer of document object.
00049      * @param path The path of the document.
00050      * @return TODO. Add return code here.
00051      */
00052     PluginStatus (* open )( IPluginUnknown    *thiz, 
00053                             const UDSString   *path );
00054                             
00055 
00056     /**
00057      * @brief Supply extra credentials for opening the document
00058      *
00059      * This should be called after opening the document, because in most cases only then it is possible
00060      * to determine if a document needs extra credentials (eg. name/password combination) for opening.
00061      * After adding the credentials commit_credentials() should be called to notify the plugin that
00062      * the credentials are complete. 
00063      *
00064      * Please note: Always call either commit_credentials() or reset_credentials() to ensure credential
00065      * information is removed from memory.
00066      *
00067      * @param thiz IPluginUnknown pointer of document object.
00068      * @param string name Name of the credentials (eg. "password" or "name"), depending on plugin implementation
00069      * @param string value Value of the credential depending on plugin implementation
00070      * @return PLUGIN_OK Supplied credential name/value is correct
00071      * @return PLUGIN_FAIL Supplied credential name/value is not correct, programming error
00072      * @return PLUGIN_NOT_SUPPORTED Plugin does not support credentials
00073      */
00074     PluginStatus (* add_credentials )( IPluginUnknown    *thiz, 
00075                                        const UDSString   *name,
00076                                        const UDSString   *value );
00077 
00078 
00079     /**
00080      * @brief Notifies plugin to process the credential information
00081      *
00082      *
00083      * This is called by UDS to notify that the credential information is complete.
00084      * The plugin now has to store the credential information and verify it if possible.
00085      * If the credential information cannot be verified without reopening the document,
00086      * the plugin should return PLUGIN_CREDENTIAL_AUTHORIZATION_PENDING. UDS then will
00087      * reopen the document.
00088      *
00089      * Please note: If the commit fails or if the authorization failed, reset_credentials has to
00090      * be called!
00091      *
00092      * @return PLUGIN_OK Credential information is verified and OK
00093      * @return PLUGIN_CREDENTIAL_AUTHORIZATION_FAILED Credential information is verified but does not match
00094      * @return PLUGIN_CREDENTIAL_AUTHORIZATION_PENDING Credential could not be verified, UDS has to reopen the document
00095      * @return PLUGIN_FAIL Credential information supplied with add_credentials() is not complete
00096      * @return PLUGIN_NOT_SUPPORTED Plugin does not support credentials
00097      */
00098     PluginStatus (* commit_credentials )( IPluginUnknown    *thiz );
00099     
00100     /**
00101      * @brief Notifies plugin to remove all credential information
00102      *
00103      * This function will be called from UDS in these situations:
00104      * <li> If for some reason commit_credentials() was not called and the credential procedure was
00105      *       aborted. This ensures that credential information() is removed from memory.
00106      * <li> If commit_credentials() was called but returned an error
00107      * <li> If commit_credentials() was called but the authorization failed (either reported directly
00108      *      as PLUGIN_CREDENTIAL_AUTHORIZATION_FAILED from commit_credentials() or detected later
00109      *      when reopening the document)
00110      *
00111      * @return PLUGIN_OK Credential information is reset
00112      * @return PLUGIN_FAIL Credential information could not be reset
00113      * @return PLUGIN_NOT_SUPPORTED Plugin does not support resetting of credentials
00114      */
00115     PluginStatus (* reset_credentials )( IPluginUnknown    *thiz );
00116 
00117     /**
00118      * @brief Check whether the current document object has been opened or not.
00119      * @param thiz The IPluginUnknown pointer of document object.
00120      * @return Returns PLUGIN_TRUE if the document has been successfully
00121      * opened, otherwise returns PLUGIN_FALSE.
00122      */
00123     PluginBool (* is_open )( IPluginUnknown    *thiz );
00124 
00125     /**
00126      * @brief Close document. This document object won't be destroyed
00127      * immediately after calling this function. The object can be used to
00128      * open another document.
00129      * @param thiz The IPluginUnknown pointer of document object to be closed.
00130      * @return TODO. Add return code here.
00131      */
00132     PluginStatus (* close )( IPluginUnknown     *thiz );
00133 
00134     /**
00135      * @brief Create view object.
00136      * @param thiz IPluginUnknown pinter of document object.
00137      * @return Returns the IPluginUnknown pointer of new created view object. 
00138      * If the view object is failed to be created, this function returns NULL.
00139      */
00140     IPluginUnknown * (* create_view )( IPluginUnknown   *thiz );
00141 
00142 } IPluginDocument;
00143 
00144 #ifdef __cplusplus
00145 }
00146 #endif 
00147 
00148 #endif
00149 
Generated by  doxygen 1.6.2-20100208