src/include/common/spds/AccessConfig.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 #ifndef INCL_ACCESS_CONFIG
00019 #define INCL_ACCESS_CONFIG
00020 
00022 #include "base/fscapi.h"
00023 #include "spds/constants.h"
00024 
00025 
00026 /*
00027  * -------------------------- AccessConfig class -----------------------------
00028  * This class groups all configuration properties to estabilish a
00029  * connection with a sync server.
00030  * AccessConfig is a part of SyncManagerConfig (along with DeviceConfig
00031  * and an array of SyncSourceConfig).
00032  *
00033  * Class members:
00034  * --------------
00035  * username             : string for username
00036  * password             : string for password
00037  * useProxy             : Should the sync engine use a HTTP proxy?
00038  * proxyHost            : the host for proxy connection
00039  * proxyPort            : the port for proxy connection
00040  * proxyUsername        : the proxy username (if proxy needs authentication)
00041  * proxyPassword        : the proxy password (if proxy needs authentication)
00042  * beginTimestamp       : The beginSync timestamp
00043  * endTimestamp         : The endSync timestamp
00044  * firstTimeSyncMode    : The SyncMode that the sync engine should use
00045  *                        the first time a source is synced
00046  * serverNonce          : The server nonce value: from client to server
00047  * clientNonce          : The client nonce value: from server to client
00048  * serverID             : the server ID value
00049  * serverPWD            : the server password
00050  * clientAuthType       : the type of client authentication used by client
00051  * isServerAuthRequired : Does the server require authentication?
00052  * maxMsgSize           : The maximum message size (Byte) accepted for XML
00053  *                        messages received from server (server to client)
00054  * readBufferSize       : Specifies the value for the size of the buffer used
00055  *                        to store the incoming stream from server (byte)
00056  * userAgent            : The user agent string, will be attached to http
00057  *                        messages to identify the client on server side.
00058  *                        It shoud be a short description with the client
00059  *                        name plus its version
00060  * checkConn            : Do we need to check if the GPRS connection is available?          <-- **** still used? ****
00061  * responseTimeout      : The number of seconds of waiting response timeout
00062  * dirty                : The dirty flag, used to select which properties
00063  *                        have been modified. Not used by now (T.B.D)
00064  */
00065 class AccessConfig {
00066     private:
00067         char*           username            ;
00068         char*           password            ;
00069         BOOL            useProxy            ;
00070         char*           proxyHost           ;
00071         int             proxyPort           ;
00072         char*           proxyUsername       ;
00073         char*           proxyPassword       ;
00074         char*           syncURL             ;
00075         unsigned long   beginTimestamp      ;
00076         unsigned long   endTimestamp        ;
00077         SyncMode        firstTimeSyncMode   ;
00078         char*           serverNonce         ;
00079         char*           clientNonce         ;
00080         char*           serverID            ;
00081         char*           serverPWD           ;
00082         char*           clientAuthType      ;
00083         char*           serverAuthType      ;
00084         BOOL            isServerAuthRequired;
00085         unsigned long   maxMsgSize          ;
00086         unsigned long   readBufferSize      ;
00087         char*           userAgent           ;
00088         BOOL            checkConn           ;
00089         unsigned int    responseTimeout     ;
00090         BOOL            compression         ;
00091 
00092         unsigned int dirty;
00093 
00101         void set(char* * buf, const char*  v);
00102 
00103     public:
00104 
00105         AccessConfig();
00106         AccessConfig(AccessConfig& s);
00107         ~AccessConfig();
00108 
00116         const char*  getUsername() const;
00117 
00125         void setUsername(const char*  username);
00126 
00130         const char*  getPassword() const;
00131 
00139         void setPassword(const char*  password);
00140 
00145         SyncMode getFirstTimeSyncMode() const;
00146 
00153         void setFirstTimeSyncMode(SyncMode syncMode);
00154 
00158         BOOL getUseProxy() const;
00159 
00165         void setUseProxy(BOOL useProxy);
00166 
00170         const char*  getProxyHost() const;
00171 
00177         void setProxyHost(const char*  proxyHost);
00178 
00179         int getProxyPort() const;
00180         void setProxyPort(int v);
00181 
00185         const char* getProxyUsername() const;
00186 
00192         void setProxyUsername(const char*  proxyUsername);
00193 
00197         const char* getProxyPassword() const;
00198 
00204         void setProxyPassword(const char*  proxyPassword);
00205 
00211         const char*  getSyncURL() const;
00212 
00220         void setSyncURL(const char*  syncURL);
00221 
00227         void setBeginSync(unsigned long timestamp);
00228 
00232         unsigned long getBeginSync() const;
00233 
00239         void setEndSync(unsigned long timestamp);
00240 
00244         unsigned long getEndSync() const;
00245 
00246         BOOL getServerAuthRequired() const;
00247 
00248         void setServerAuthRequired(BOOL v);
00249 
00250         const char*  getClientAuthType() const;
00251 
00252         void setClientAuthType(const char*  v);
00253 
00254         const char*  getServerAuthType() const;
00255 
00256         void setServerAuthType(const char*  v);
00257 
00258         const char*  getServerPWD() const;
00259 
00260         void setServerPWD(const char*  v);
00261 
00262         const char*  getServerID() const;
00263 
00264         void setServerID(const char*  v);
00265 
00266         const char*  getServerNonce() const;
00267 
00268         void setServerNonce(const char*  v);
00269 
00270         const char*  getClientNonce() const;
00271 
00272         void setClientNonce(const char*  v);
00273 
00274         void setMaxMsgSize(unsigned long msgSize);
00275 
00276         unsigned long getMaxMsgSize() const;
00277 
00278         void setReadBufferSize(unsigned long bufferSize);
00279 
00280         unsigned long getReadBufferSize() const;
00281 
00282         const char*  getUserAgent() const;
00283 
00284         void setUserAgent(const char*  v);
00285 
00286         void setCompression(BOOL  v);
00287 
00288         BOOL  getCompression() const;
00289 
00290         //void setCompression(BOOL v);
00291 
00292 
00293         void setCheckConn(BOOL v);
00294         BOOL getCheckConn() const;
00295 
00296         void setResponseTimeout(unsigned int bufferSize)   ;
00297         unsigned int getResponseTimeout() const            ;
00298 
00302         unsigned int getDirty() const;
00303 
00310         void assign(const AccessConfig& s);
00311 
00312         /*
00313          * Assign operator
00314          */
00315         AccessConfig& operator = (const AccessConfig& ac) {
00316             assign(ac);
00317             return *this;
00318         }
00319 
00320 };
00321 
00323 #endif

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