src/include/win32/http/Win32TransportAgent.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 
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 Jun 15 11:38:31 2007 for Funambol C++ Client Library by  doxygen 1.5.2