src/include/common/spds/CredentialHandler.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
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 as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  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() EXTRA_SECTION_01;
00050         void  generateNonce(char nonce[16]) EXTRA_SECTION_01;
00051 
00052     public:
00053         /*
00054          * Default constructor
00055          */
00056         CredentialHandler() EXTRA_SECTION_01;
00057 
00058         ~CredentialHandler() EXTRA_SECTION_01;
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) EXTRA_SECTION_01;
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) EXTRA_SECTION_01;
00077         const char*  getUsername() EXTRA_SECTION_01;
00078         void setPassword(const char*  t) EXTRA_SECTION_01;
00079         const char*  getPassword() EXTRA_SECTION_01;
00080         void setClientAuthType(const char*  t) EXTRA_SECTION_01;
00081         void setClientNonce(const char*  t) EXTRA_SECTION_01;
00082         const char*  getClientAuthType() EXTRA_SECTION_01;
00083         const char*  getClientNonce() EXTRA_SECTION_01;
00084 
00085         void setServerID(const char*  t) EXTRA_SECTION_01;
00086         void setServerPWD(const char*  t) EXTRA_SECTION_01;
00087         void setServerAuthType(const char*  t) EXTRA_SECTION_01;
00088         void setServerNonce(const char*  t) EXTRA_SECTION_01;
00089         const char*  getServerAuthType() EXTRA_SECTION_01;
00090         const char*  getServerNonce() EXTRA_SECTION_01;
00091         
00092         void setServerAuthRequired(BOOL t) EXTRA_SECTION_01;
00093         BOOL getServerAuthRequired() EXTRA_SECTION_01;
00094         
00095         Cred* getClientCredential() EXTRA_SECTION_01;
00096         Cred* getServerCredential() EXTRA_SECTION_01;
00097         Chal* getServerChal(BOOL isServerAuthenticated) EXTRA_SECTION_01;
00098         BOOL  performServerAuth(Cred* cred) EXTRA_SECTION_01;
00099 
00100     };
00101 
00103 #endif

Generated on Fri Apr 27 12:29:18 2007 for Funambol C++ Client Library by  doxygen 1.5.2