00001 #ifndef _XMLRPCSERVERCONNECTION_H_ 00002 #define _XMLRPCSERVERCONNECTION_H_ 00003 // 00004 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley 00005 // 00006 00012 #if defined(_MSC_VER) 00013 # pragma warning(disable:4786) // identifier was truncated in debug info 00014 #endif 00015 00016 #ifndef MAKEDEPEND 00017 # include <string> 00018 #endif 00019 00020 #include "XmlRpcValue.h" 00021 #include "XmlRpcSource.h" 00022 00023 namespace XmlRpc { 00024 00025 00026 // The server waits for client connections and provides support for executing methods 00027 class XmlRpcServer; 00028 class XmlRpcServerMethod; 00029 00031 class XmlRpcServerConnection : public XmlRpcSource { 00032 public: 00033 00035 XmlRpcServerConnection(int fd, XmlRpcServer* server, bool deleteOnClose = false); 00037 virtual ~XmlRpcServerConnection(); 00038 00039 // XmlRpcSource interface implementation 00042 virtual unsigned handleEvent(unsigned eventType); 00043 00044 protected: 00045 00047 bool readHeader(); 00048 00050 bool readRequest(); 00051 00053 bool writeResponse(); 00054 00055 00057 virtual void executeRequest(); 00058 00059 00061 XmlRpcServer* _server; 00062 00064 enum ServerConnectionState { READ_HEADER, READ_REQUEST, WRITE_RESPONSE }; 00066 ServerConnectionState _connectionState; 00067 00069 std::string _header; 00070 00072 int _contentLength; 00073 00075 std::string _request; 00076 00078 std::string _response; 00079 00081 int _bytesWritten; 00082 00084 bool _keepAlive; 00085 }; 00086 } // namespace XmlRpc 00087 00088 #endif // _XMLRPCSERVERCONNECTION_H_