src/include/common/spds/AccessConfig.h

00001 /*
00002  * Funambol is a mobile platform developed by Funambol, Inc. 
00003  * Copyright (C) 2003 - 2007 Funambol, Inc.
00004  * 
00005  * This program is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Affero General Public License version 3 as published by
00007  * the Free Software Foundation with the addition of the following permission 
00008  * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
00009  * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
00010  * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00015  * details.
00016  * 
00017  * You should have received a copy of the GNU Affero General Public License 
00018  * along with this program; if not, see http://www.gnu.org/licenses or write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00020  * MA 02110-1301 USA.
00021  * 
00022  * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 
00023  * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
00024  * 
00025  * The interactive user interfaces in modified source and object code versions
00026  * of this program must display Appropriate Legal Notices, as required under
00027  * Section 5 of the GNU Affero General Public License version 3.
00028  * 
00029  * In accordance with Section 7(b) of the GNU Affero General Public License
00030  * version 3, these Appropriate Legal Notices must retain the display of the
00031  * "Powered by Funambol" logo. If the display of the logo is not reasonably 
00032  * feasible for technical reasons, the Appropriate Legal Notices must display
00033  * the words "Powered by Funambol".
00034  */
00035 #ifndef INCL_ACCESS_CONFIG
00036 #define INCL_ACCESS_CONFIG
00037 
00039 #include "base/fscapi.h"
00040 #include "spds/constants.h"
00041 
00042 
00043 /*
00044  * -------------------------- AccessConfig class -----------------------------
00045  * This class groups all configuration properties to estabilish a
00046  * connection with a sync server.
00047  * AccessConfig is a part of SyncManagerConfig (along with DeviceConfig
00048  * and an array of SyncSourceConfig).
00049  *
00050  * Class members:
00051  * --------------
00052  * username             : string for username
00053  * password             : string for password
00054  * useProxy             : Should the sync engine use a HTTP proxy?
00055  * proxyHost            : the host for proxy connection
00056  * proxyPort            : the port for proxy connection
00057  * proxyUsername        : the proxy username (if proxy needs authentication)
00058  * proxyPassword        : the proxy password (if proxy needs authentication)
00059  * beginTimestamp       : The beginSync timestamp
00060  * endTimestamp         : The endSync timestamp
00061  * firstTimeSyncMode    : The SyncMode that the sync engine should use
00062  *                        the first time a source is synced
00063  * serverNonce          : The server nonce value: from client to server
00064  * clientNonce          : The client nonce value: from server to client
00065  * serverID             : the server ID value
00066  * serverPWD            : the server password
00067  * clientAuthType       : the type of client authentication used by client
00068  * isServerAuthRequired : Does the server require authentication?
00069  * maxMsgSize           : The maximum message size (Byte) accepted for XML
00070  *                        messages received from server (server to client)
00071  * readBufferSize       : Specifies the value for the size of the buffer used
00072  *                        to store the incoming stream from server (byte)
00073  * userAgent            : The user agent string, will be attached to http
00074  *                        messages to identify the client on server side.
00075  *                        It shoud be a short description with the client
00076  *                        name plus its version
00077  * checkConn            : Do we need to check if the GPRS connection is available?          <-- **** still used? ****
00078  * responseTimeout      : The number of seconds of waiting response timeout
00079  * dirty                : The dirty flag, used to select which properties
00080  *                        have been modified. Not used by now (T.B.D)
00081  */
00082 class AccessConfig {
00083     private:
00084         char*           username            ;
00085         char*           password            ;
00086         BOOL            useProxy            ;
00087         char*           proxyHost           ;
00088         int             proxyPort           ;
00089         char*           proxyUsername       ;
00090         char*           proxyPassword       ;
00091         char*           syncURL             ;
00092         unsigned long   beginTimestamp      ;
00093         unsigned long   endTimestamp        ;
00094         SyncMode        firstTimeSyncMode   ;
00095         char*           serverNonce         ;
00096         char*           clientNonce         ;
00097         char*           serverID            ;
00098         char*           serverPWD           ;
00099         char*           clientAuthType      ;
00100         char*           serverAuthType      ;
00101         BOOL            isServerAuthRequired;
00102         unsigned long   maxMsgSize          ;
00103         unsigned long   readBufferSize      ;
00104         char*           userAgent           ;
00105         BOOL            checkConn           ;
00106         unsigned int    responseTimeout     ;
00107         BOOL            compression         ;
00108 
00109         unsigned int dirty;
00110 
00118         void set(char* * buf, const char*  v);
00119 
00120     public:
00121 
00122         AccessConfig();
00123         AccessConfig(AccessConfig& s);
00124         ~AccessConfig();
00125 
00133         const char*  getUsername() const;
00134 
00142         void setUsername(const char*  username);
00143 
00147         const char*  getPassword() const;
00148 
00156         void setPassword(const char*  password);
00157 
00162         SyncMode getFirstTimeSyncMode() const;
00163 
00170         void setFirstTimeSyncMode(SyncMode syncMode);
00171 
00175         BOOL getUseProxy() const;
00176 
00182         void setUseProxy(BOOL useProxy);
00183 
00187         const char*  getProxyHost() const;
00188 
00194         void setProxyHost(const char*  proxyHost);
00195 
00196         int getProxyPort() const;
00197         void setProxyPort(int v);
00198 
00202         const char* getProxyUsername() const;
00203 
00209         void setProxyUsername(const char*  proxyUsername);
00210 
00214         const char* getProxyPassword() const;
00215 
00221         void setProxyPassword(const char*  proxyPassword);
00222 
00228         const char*  getSyncURL() const;
00229 
00237         void setSyncURL(const char*  syncURL);
00238 
00244         void setBeginSync(unsigned long timestamp);
00245 
00249         unsigned long getBeginSync() const;
00250 
00256         void setEndSync(unsigned long timestamp);
00257 
00261         unsigned long getEndSync() const;
00262 
00263         BOOL getServerAuthRequired() const;
00264 
00265         void setServerAuthRequired(BOOL v);
00266 
00267         const char*  getClientAuthType() const;
00268 
00269         void setClientAuthType(const char*  v);
00270 
00271         const char*  getServerAuthType() const;
00272 
00273         void setServerAuthType(const char*  v);
00274 
00275         const char*  getServerPWD() const;
00276 
00277         void setServerPWD(const char*  v);
00278 
00279         const char*  getServerID() const;
00280 
00281         void setServerID(const char*  v);
00282 
00283         const char*  getServerNonce() const;
00284 
00285         void setServerNonce(const char*  v);
00286 
00287         const char*  getClientNonce() const;
00288 
00289         void setClientNonce(const char*  v);
00290 
00291         void setMaxMsgSize(unsigned long msgSize);
00292 
00293         unsigned long getMaxMsgSize() const;
00294 
00295         void setReadBufferSize(unsigned long bufferSize);
00296 
00297         unsigned long getReadBufferSize() const;
00298 
00299         const char*  getUserAgent() const;
00300 
00301         void setUserAgent(const char*  v);
00302 
00303         void setCompression(BOOL  v);
00304 
00305         BOOL  getCompression() const;
00306 
00307         //void setCompression(BOOL v);
00308 
00309 
00310         void setCheckConn(BOOL v);
00311         BOOL getCheckConn() const;
00312 
00313         void setResponseTimeout(unsigned int bufferSize)   ;
00314         unsigned int getResponseTimeout() const            ;
00315 
00319         unsigned int getDirty() const;
00320 
00327         void assign(const AccessConfig& s);
00328 
00329         /*
00330          * Assign operator
00331          */
00332         AccessConfig& operator = (const AccessConfig& ac) {
00333             assign(ac);
00334             return *this;
00335         }
00336 
00337 };
00338 
00340 #endif

Generated on Thu Mar 6 14:25:04 2008 for Funambol C++ Client Library by  doxygen 1.5.2