SourceForge Logo
Main Page   Class Hierarchy   Compound List   File List   Compound Members  

PasswordCodecPrototype.h

Go to the documentation of this file.
00001 /*!
00002  * \file PasswordCodecPrototype.h
00003  * \brief Defines the password encoding/decoding prototype
00004  *
00005  * \author Frederic RUAUDEL <grumz@users.sf.net>
00006  *
00007  * $Revision: 1.12 $
00008  * $Date: 2003/03/08 09:56:11 $
00009  *
00010  * \b PassGuardFramework
00011  * Copyleft (c) 2002 Frederic RUAUDEL, all rights reversed
00012  *
00013  * This program is free software which I release under the GNU General Public
00014  * License. You may redistribute and/or modify this program under the terms
00015  * of that license as published by the Free Software Foundation; either
00016  * version 2 of the License, or (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.  Version 2 is in the
00022  * COPYING file in the top level directory of this distribution.
00023  *
00024  * To get a copy of the GNU General Public License, write to the Free Software
00025  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  **/
00027 
00028 #ifndef PASSWORD_CODEC_PROTOTYPE_H
00029 #define PASSWORD_CODEC_PROTOTYPE_H
00030 
00031 #include <stdio.h>
00032 #include <unistd.h>
00033 #include <errno.h>
00034 
00035 #include <list>
00036 #include <string>
00037 #include <map>
00038 
00039 #include <PasswordInfos.h>
00040 #include <PassguardErrorManager.h>
00041 
00042 using namespace std;
00043 
00044 /*!
00045  * \brief Password encoding/decoding prototype
00046  **/
00047 class PasswordCodecPrototype : public PassguardErrorManager
00048 {
00049         public:
00050                 virtual ~PasswordCodecPrototype ();
00051 
00052                 virtual PasswordCodecPrototype* clone (void) const = 0;
00053 
00054                 virtual bool loadFile (string filename, string password) = 0;
00055                 virtual bool saveFile (string password) = 0;
00056 
00057                 virtual bool loadDefaultFile (string password);
00058                 virtual bool saveFileAs (string filename, string password);
00059                 virtual bool newFile (string filename, string password);
00060 
00061                 virtual bool hasDefaultFilename (void);
00062                 virtual string getDefaultFilename (void);
00063                 virtual string getCurrentFilename (void);
00064                 virtual bool setFilenameToDefault (void);
00065 
00066                 virtual PasswordInfos* popPasswordInfos (void);
00067                 virtual bool pushPasswordInfos (PasswordInfos* password_infos);
00068 
00069                 virtual bool isEditable (void);
00070                 virtual bool getEditability (void);
00071                 virtual void releaseEditability (void);
00072 
00073                 virtual bool isModified (void) const;
00074 
00075                 virtual bool hasFixedField (void) const = 0;
00076                 virtual int getNbField (void) const = 0;
00077                 virtual PasswordInfos getFieldsName (void) const = 0;
00078                 virtual bool setFieldsName (PasswordInfos fields_name_infos) = 0;
00079 
00080         protected:
00081                 PasswordCodecPrototype ();
00082                 PasswordCodecPrototype (const PasswordCodecPrototype& password_codec_prototype);
00083 
00084                 list<PasswordInfos*> _password_infos_list;
00085                 string _filename;
00086                 bool _is_modified;
00087                 bool _is_editable;
00088                 bool _is_edited;
00089                 string _default_filename;
00090 };
00091 
00092 /*!
00093  * \fn PasswordCodecPrototype* PasswordCodecPrototype::clone (void) const = 0
00094  *
00095  * \brief Create a new password encoding/decoding prototype that is a exact 
00096  *              copy of the current one
00097  *
00098  * \return the new password encoding/decoding prototype clone
00099  **/
00100 
00101 /*!
00102  * \fn bool PasswordCodecPrototype::loadFile (string filename, string password) = 0
00103  *
00104  * \brief Decrypts the password informations and add them in the list in
00105  *      order they can be retreived by the app
00106  *
00107  * \param filename the filename where encrypted passwords are.
00108  * \param password the password to decrypt the file
00109  *
00110  * \return true if the decryption is ok / false otherwise
00111  **/
00112 
00113 /*!
00114  * \fn bool PasswordCodecPrototype::saveFile (string password) = 0
00115  * 
00116  * \brief Encrypts and saves all the password informations present in the list 
00117  *              in the file defined by loadFile() or newFile()
00118  *
00119  * \param password the password to encrypt the data
00120  *
00121  * \return true if the save succeeds / false otherwise
00122  **/
00123 
00124 /*!
00125  * \fn bool PasswordCodecPrototype::hasFixedField (void) const = 0
00126  *
00127  * \brief Defines if this encrypted format supports variable number of field to describe passwords
00128  *
00129  * \return true if the number is fixed / false if it is variable
00130  **/
00131 
00132 /*!
00133  * \fn int PasswordCodecPrototype::getNbField (void) const = 0
00134  *
00135  * \brief Returns the number of fields that describe the password (password and description are not included)
00136  *
00137  * \return the number of fields
00138  **/
00139 
00140 /*!
00141  * \fn PasswordInfos PasswordCodecPrototype::getFieldsName (void) const = 0
00142  *
00143  * \brief Returns the fields name describing what represents each elements of 
00144  *              the password informations
00145  *
00146  * \return a PasswordInfos structure in which each element holds the name 
00147  *              of fields
00148  **/
00149 
00150 /*!
00151  * \fn void PasswordCodecPrototype::setFieldsName (PasswordInfos fields_name_infos) = 0
00152  *
00153  * \brief Defines the fields name describing what represents each elements of 
00154  *              the password informations
00155  *
00156  * \param fields_name_infos a PasswordInfos structure in which each element holds 
00157  *              the name of fields
00158  *
00159  * \return true if formats of PasswordInfos structures are compatible / false otherwise.
00160  **/
00161 
00162 #endif /* PASSWORD_CODEC_PROTOTYPE_H */

Generated on Sun Mar 9 15:36:50 2003 for PassGuardFramework by doxygen1.2.15