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_ABSTRACT_SYNC_CONFIG 00036 #define INCL_ABSTRACT_SYNC_CONFIG 00037 /** @cond API */ 00038 /** @addtogroup Client */ 00039 /** @{ */ 00040 00041 #include "base/fscapi.h" 00042 #include "spds/AbstractSyncSourceConfig.h" 00043 #include "base/globalsdef.h" 00044 00045 BEGIN_NAMESPACE 00046 00047 /** 00048 * This class provides access to all attributes of the client and its 00049 * sources which the sync engine needs to read and (in a few cases) 00050 * also write. 00051 * 00052 * @todo The documentation of these properties was copied more or less 00053 * verbatim from the older AccessConfig.h and DeviceConfig.h and does not 00054 * really explain much about these properties. It should be considerably 00055 * enhanced. 00056 */ 00057 class AbstractSyncConfig { 00058 public: 00059 00060 virtual ~AbstractSyncConfig() {} 00061 00062 virtual AbstractSyncSourceConfig* getAbstractSyncSourceConfig(const char* name) const = 0; 00063 virtual AbstractSyncSourceConfig* getAbstractSyncSourceConfig(unsigned int i) const = 0; 00064 virtual unsigned int getAbstractSyncSourceConfigsCount() const = 0; 00065 00066 /** 00067 * Returns the username value. 00068 * 00069 * @return The username value. The caller MUST NOT release 00070 * the memory itself. 00071 * 00072 */ 00073 virtual const char* getUsername() const = 0; 00074 00075 /** 00076 * Returns the password value. 00077 */ 00078 virtual const char* getPassword() const = 0; 00079 00080 /** 00081 * Should the sync engine use a HTTP proxy? 00082 */ 00083 virtual bool getUseProxy() const = 0; 00084 00085 /** 00086 * Returns the proxyHost value. 00087 */ 00088 virtual const char* getProxyHost() const = 0; 00089 00090 virtual int getProxyPort() const = 0; 00091 00092 /** 00093 * Returns the proxyUsername value. 00094 */ 00095 virtual const char* getProxyUsername() const = 0; 00096 00097 /** 00098 * Returns the proxyPassword value. 00099 */ 00100 virtual const char* getProxyPassword() const = 0; 00101 00102 /** 00103 * Returns the syncURL value. If the URL does not start with http:// 00104 * (or HTTP://) or https:// (or HTTPS://), http:// is prepended to the 00105 * given string. 00106 */ 00107 virtual const char* getSyncURL() const = 0; 00108 00109 /** 00110 * Sets the new "beginSync" timestamp. 00111 * 00112 * The client can use this value if it wants to, but 00113 * it doesn't have to store it persistently. 00114 * 00115 * @param timestamp the beginSync timestamp 00116 */ 00117 virtual void setBeginSync(unsigned long /* timestamp */) {} 00118 00119 /** 00120 * Sets the new "endSync" timestamp. 00121 * 00122 * The client can use this value if it wants to, but 00123 * it doesn't have to store it persistently. 00124 * 00125 * @param timestamp the endSync timestamp 00126 */ 00127 virtual void setEndSync(unsigned long /* timestamp */) {} 00128 00129 /** Does the server require authentication? */ 00130 virtual bool getServerAuthRequired() const = 0; 00131 00132 /** 00133 * the type of client authentication used by client: 00134 * - syncml:basic-auth 00135 * - syncml:md5-auth 00136 */ 00137 virtual const char* getClientAuthType() const = 0; 00138 00139 /** same as for client? */ 00140 virtual const char* getServerAuthType() const = 0; 00141 00142 /** the server password */ 00143 virtual const char* getServerPWD() const = 0; 00144 00145 /** the server ID value */ 00146 virtual const char* getServerID() const = 0; 00147 00148 /** The server nonce value: from client to server */ 00149 virtual const char* getServerNonce() const = 0; 00150 virtual void setServerNonce(const char* v) = 0; 00151 00152 /** The client nonce value: from server to client */ 00153 virtual const char* getClientNonce() const = 0; 00154 virtual void setClientNonce(const char* v) = 0; 00155 00156 /** 00157 * The maximum message size (Byte) accepted for XML 00158 * messages received from server (server to client) 00159 */ 00160 virtual unsigned long getMaxMsgSize() const = 0; 00161 00162 /** 00163 * Specifies the value for the size of the buffer used to store 00164 * the incoming stream from server (byte). 00165 */ 00166 virtual unsigned long getReadBufferSize() const = 0; 00167 00168 /** 00169 * The user agent string, will be attached to http messages to 00170 * identify the client on server side. It should be a short 00171 * description with the client name plus its version 00172 */ 00173 virtual const char* getUserAgent() const = 0; 00174 00175 /** 00176 * A platform specific string specifying the location of the 00177 * certificates used to authenticate the server. When empty, the 00178 * system's default location will be searched. 00179 */ 00180 virtual const char* getSSLServerCertificates() const { return ""; } 00181 00182 /** 00183 * Enabled by default: the client refuses to establish the 00184 * connection unless the server presents a valid 00185 * certificate. Disabling this option considerably reduces the 00186 * security of SSL (man-in-the-middle attacks become possible) and 00187 * is not recommended. 00188 */ 00189 virtual bool getSSLVerifyServer() const { return true; } 00190 00191 /** 00192 * Enabled by default: the client refuses to establish the 00193 * connection unless the server's certificate matches its host 00194 * name. In cases where the certificate still seems to be valid it 00195 * might make sense to disable this option and allow such 00196 * connections. 00197 */ 00198 virtual bool getSSLVerifyHost() const { return true; } 00199 00200 virtual bool getCompression() const = 0; 00201 00202 /** The number of seconds of waiting response timeout */ 00203 virtual unsigned int getResponseTimeout() const = 0; 00204 00205 /** 00206 * Specifies the name of the manufacturer of the device. This 00207 * property is optional. 00208 */ 00209 virtual const char* getMan() const = 0; 00210 00211 /** 00212 * Specifies the model name or model number of the device. This 00213 * property is optional. 00214 */ 00215 virtual const char* getMod() const = 0; 00216 00217 /** 00218 * Specifies the OEM (Original Equipment Manufacturer) of the 00219 * device. This property is optional. 00220 */ 00221 virtual const char* getOem() const = 0; 00222 00223 /** 00224 * Specifies the firmware version of the device. This property is 00225 * optional. 00226 */ 00227 virtual const char* getFwv() const = 0; 00228 00229 /** 00230 * Specifies the software version of the device. 00231 * This property is optional. 00232 */ 00233 virtual const char* getSwv() const = 0; 00234 00235 /** 00236 * Specifies the hardware version of the device. 00237 * This property is optional. 00238 */ 00239 virtual const char* getHwv() const = 0; 00240 00241 /** 00242 * Specifies the identifier of the source synchronization device. 00243 * The content information MUST specify an identifier which is unique 00244 * among all devices accessing the same data on a SyncML server. 00245 */ 00246 virtual const char* getDevID() const = 0; 00247 00248 /** 00249 * Specifies the type of the source synchronization device. Type 00250 * values for this element type can be e.g. "pager", "handheld", 00251 * "pda", "phone", "smartphone", "server", "workstation". Other 00252 * values can also be specified. This property is mandatory. 00253 */ 00254 virtual const char* getDevType() const = 0; 00255 00256 /** Specifies the implemented DS version. This property is optional. */ 00257 virtual const char* getDsV() const = 0; 00258 00259 /** 00260 * Specifies that the device supports UTC based time. 00261 * If utc = true, the server SHOULD send time in UTC format, 00262 * else MUST send in local time. 00263 */ 00264 virtual bool getUtc() const = 0; 00265 00266 /** 00267 * Specifies that the device supports handling of large objects. 00268 */ 00269 virtual bool getLoSupport() const = 0; 00270 00271 /** 00272 * Specifies that the device supports number of changes. 00273 * Must be false. 00274 */ 00275 virtual bool getNocSupport() const = 0; 00276 00277 /** 00278 * Specifies the maximum object size allowed by the device. 00279 * Value 0 means "no maxObjSize set". 00280 */ 00281 virtual unsigned int getMaxObjSize() const = 0; 00282 00283 /** 00284 * This is a hash value generated from all properties that are used 00285 * for the <DevInf> element, plus the syncURL property. If the hash 00286 * changes between sync sessions the information has changed and must 00287 * be resent. 00288 */ 00289 virtual const char* getDevInfHash() const = 0; 00290 virtual void setDevInfHash(const char *hash) = 0; 00291 }; 00292 00293 00294 END_NAMESPACE 00295 00296 /** @} */ 00297 /** @endcond */ 00298 #endif