src/include/winmobile/http/WMTransportAgent.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 
00044 #ifndef INCL_WM_TRANSPORT_AGENT
00045 #define INCL_WM_TRANSPORT_AGENT
00046 
00048 #include "base/fscapi.h"
00049 #include "http/URL.h"
00050 #include "http/Proxy.h"
00051 #include "http/TransportAgent.h"
00052 
00054 #define MAX_RETRIES             3
00055 
00056 // FIXME: should these go to http/errors.h ?
00057 #define ERR_HTTP_TIME_OUT       ERR_TRANSPORT_BASE+ 7
00058 #define ERR_HTTP_NOT_FOUND      ERR_TRANSPORT_BASE+60
00059 #define ERR_HTTP_INFLATE        ERR_TRANSPORT_BASE+70
00060 #define ERR_HTTP_DEFLATE        ERR_TRANSPORT_BASE+71
00061 
00062 
00063 /*
00064  * This class is the transport agent responsible for messages exchange
00065  * over an HTTP connection.
00066  * This is a generic abtract class which is not bound to any paltform
00067  */
00068 
00069 class WMTransportAgent : public TransportAgent {
00070 
00071 
00072 public:
00073     WMTransportAgent();
00074     WMTransportAgent(URL& url, Proxy& proxy, 
00075                      unsigned int responseTimeout = DEFAULT_MAX_TIMEOUT,
00076                      unsigned int maxmsgsize = DEFAULT_MAX_MSG_SIZE);
00077     ~WMTransportAgent();
00078 
00079     /*
00080      * Sends the given SyncML message to the server specified
00081      * by the install property 'url'. Returns the server's response.
00082      * The response string has to be freed with delete [].
00083      * In case of an error, NULL is returned and lastErrorCode/Msg
00084      * is set.
00085      */
00086     char*  sendMessage(const char*  msg);
00087 
00088 private:
00089 
00090 #ifdef USE_ZLIB
00091     BOOL isToDeflate;           // to be zipped
00092     BOOL isFirstMessage;        // first message is clear
00093     BOOL isToInflate;           // to be unzipped
00094 #endif
00095 
00096 };
00097 
00099 #endif

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