src/include/win32/http/Win32TransportAgent.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_WIN32_TRANSPORT_AGENT
00045 #define INCL_WIN32_TRANSPORT_AGENT
00046 
00048 #include "base/fscapi.h"
00049 #include "http/URL.h"
00050 #include "http/Proxy.h"
00051 #include "http/TransportAgent.h"
00052 
00053 
00054 #define MAX_AUTH_ATTEMPT        5       // Max number of attempts sending http requests.
00055 
00056 #define ERR_HTTP_NOT_FOUND      ERR_TRANSPORT_BASE+60
00057 #define ERR_HTTP_INFLATE        ERR_TRANSPORT_BASE+70
00058 #define ERR_HTTP_DEFLATE        ERR_TRANSPORT_BASE+71
00059 
00060 
00061 /*
00062 * This class is the transport agent responsible for messages exchange
00063 * over an HTTP connection.
00064 * This is a generic abtract class which is not bound to any paltform
00065 */
00066 
00067 class Win32TransportAgent : public TransportAgent {
00068 
00069 
00070 public:
00071     Win32TransportAgent();
00072     Win32TransportAgent(URL& url, Proxy& proxy, 
00073         unsigned int responseTimeout = DEFAULT_MAX_TIMEOUT, 
00074         unsigned int maxmsgsize = DEFAULT_MAX_MSG_SIZE);
00075     ~Win32TransportAgent();
00076 
00077     /*
00078     * Sends the given SyncML message to the server specified
00079     * by the install property 'url'. Returns the response status code.
00080     */
00081     char*  sendMessage(const char*  msg);
00082 
00083 private:
00084     BOOL isToDeflate;           // to be zipped
00085     BOOL isFirstMessage;        // first message is clear
00086     BOOL isToInflate;           // to be unzipped
00087 
00088     char* createHttpErrorMessage(DWORD errorCode);
00089 };
00090 
00092 #endif

Generated on Mon Apr 16 16:40:15 2007 for Funambol C++ Client Library by  doxygen 1.5.2