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_REQUEST_TIMEOUT        ERR_TRANSPORT_BASE+61
00058 #define ERR_HTTP_INFLATE                ERR_TRANSPORT_BASE+70
00059 #define ERR_HTTP_DEFLATE                ERR_TRANSPORT_BASE+71
00060 
00061 #define ERROR_INTERNET_OFFLINE_MODE     0x0002                  // Not sure why it's not defined under wininet.h ...
00062 
00063 
00064 /*
00065 * This class is the transport agent responsible for messages exchange
00066 * over an HTTP connection.
00067 * This is a generic abtract class which is not bound to any paltform
00068 */
00069 
00070 class Win32TransportAgent : public TransportAgent {
00071 
00072 
00073 public:
00074     Win32TransportAgent();
00075     Win32TransportAgent(URL& url, Proxy& proxy, 
00076         unsigned int responseTimeout = DEFAULT_MAX_TIMEOUT, 
00077         unsigned int maxmsgsize = DEFAULT_MAX_MSG_SIZE);
00078     ~Win32TransportAgent();
00079 
00080     /*
00081     * Sends the given SyncML message to the server specified
00082     * by the install property 'url'. Returns the response status code.
00083     */
00084     char*  sendMessage(const char*  msg);
00085 
00086 private:
00087     BOOL isToDeflate;           // to be zipped
00088     BOOL isFirstMessage;        // first message is clear
00089     BOOL isToInflate;           // to be unzipped
00090 
00091     char* createHttpErrorMessage(DWORD errorCode);
00092 };
00093 
00095 #endif

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