src/include/common/spds/CredentialHandler.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol, Inc
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 2 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00016  * 02111-1307  USA
00017  */
00018 
00019  #ifndef INCL_CREDENTIAL_HANDLER
00020     #define INCL_CREDENTIAL_HANDLER
00021 
00023     #include "base/fscapi.h"
00024     #include "base/constants.h"
00025     #include "base/util/utils.h"
00026     #include "spds/constants.h"
00027     #include "syncml/core/TagNames.h"
00028     #include "syncml/core/ObjectDel.h"
00029 
00030     class CredentialHandler{
00031 
00032     private:
00033 
00034         char*  username;
00035         char*  password;
00036         char*  clientAuthType;
00037         char*  clientNonce;
00038 
00039         char*  serverID;
00040         char*  serverPWD;
00041         char*  serverAuthType;
00042         char*  serverNonce;
00043 
00044         BOOL isServerAuthRequired;
00045 
00049         void initialize();
00050         void  generateNonce(char nonce[16]);
00051 
00052     public:
00053         /*
00054          * Default constructor
00055          */
00056         CredentialHandler();
00057 
00058         ~CredentialHandler();
00059 
00060         /*
00061          * Constructs a new SyncItem identified by the given key. The key must
00062          * not be longer than DIM_KEY (see SPDS Constants).
00063          *
00064          * @param key - the key
00065          */
00066         CredentialHandler(const char*  key);
00067 
00068         /*
00069          * Returns the SyncItem's key. If key is NULL, the internal buffer is
00070          * returned; if key is not NULL, the value is copied in the caller
00071          * allocated buffer and the given buffer pointer is returned.
00072          *
00073          * @param key - buffer where the key will be stored
00074          */
00075 
00076         void setUsername(const char*  t);
00077         const char*  getUsername();
00078         void setPassword(const char*  t);
00079         const char*  getPassword();
00080         void setClientAuthType(const char*  t);
00081         void setClientNonce(const char*  t);
00082         const char*  getClientAuthType();
00083         const char*  getClientNonce();
00084 
00085         void setServerID(const char*  t);
00086         void setServerPWD(const char*  t);
00087         void setServerAuthType(const char*  t);
00088         void setServerNonce(const char*  t);
00089         const char*  getServerAuthType();
00090         const char*  getServerNonce();
00091 
00092         void setServerAuthRequired(BOOL t);
00093         BOOL getServerAuthRequired();
00094 
00095         Cred* getClientCredential();
00096         Cred* getServerCredential();
00097         Chal* getServerChal(BOOL isServerAuthenticated);
00098         BOOL  performServerAuth(Cred* cred);
00099 
00100     };
00101 
00103 #endif

Generated on Fri Nov 9 12:21:24 2007 for Funambol Outlook Plug-in Library by  doxygen 1.5.2