Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation |
00001 /* 00002 * 00003 * Licensed to the Apache Software Foundation (ASF) under one 00004 * or more contributor license agreements. See the NOTICE file 00005 * distributed with this work for additional information 00006 * regarding copyright ownership. The ASF licenses this file 00007 * to you under the Apache License, Version 2.0 (the 00008 * "License"); you may not use this file except in compliance 00009 * with the License. You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, 00014 * software distributed under the License is distributed on an 00015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00016 * KIND, either express or implied. See the License for the 00017 * specific language governing permissions and limitations 00018 * under the License. 00019 * 00020 */ 00021 #ifndef _Connector_ 00022 #define _Connector_ 00023 00024 00025 #include "qpid/framing/InputHandler.h" 00026 #include "qpid/framing/OutputHandler.h" 00027 #include "qpid/framing/InitiationHandler.h" 00028 #include "qpid/framing/ProtocolInitiation.h" 00029 #include "qpid/framing/ProtocolVersion.h" 00030 #include "qpid/sys/ShutdownHandler.h" 00031 #include "qpid/sys/TimeoutHandler.h" 00032 #include "qpid/sys/Thread.h" 00033 #include "qpid/sys/Runnable.h" 00034 #include "qpid/sys/Mutex.h" 00035 #include "qpid/sys/Socket.h" 00036 #include "qpid/sys/Time.h" 00037 00038 #include <queue> 00039 #include <boost/weak_ptr.hpp> 00040 #include <boost/shared_ptr.hpp> 00041 00042 namespace qpid { 00043 00044 namespace sys { 00045 class SecurityLayer; 00046 } 00047 00048 namespace client { 00049 00050 struct ConnectionSettings; 00051 class ConnectionImpl; 00052 00054 class Connector : public framing::OutputHandler 00055 { 00056 public: 00057 // Protocol connector factory related stuff (it might be better to separate this code from the TCP Connector in the future) 00058 typedef Connector* Factory(framing::ProtocolVersion, const ConnectionSettings&, ConnectionImpl*); 00059 static Connector* create(const std::string& proto, framing::ProtocolVersion, const ConnectionSettings&, ConnectionImpl*); 00060 static void registerFactory(const std::string& proto, Factory* connectorFactory); 00061 00062 virtual ~Connector() {}; 00063 virtual void connect(const std::string& host, int port) = 0; 00064 virtual void init() {}; 00065 virtual void close() = 0; 00066 virtual void send(framing::AMQFrame& frame) = 0; 00067 virtual void abort() = 0; 00068 00069 virtual void setInputHandler(framing::InputHandler* handler) = 0; 00070 virtual void setShutdownHandler(sys::ShutdownHandler* handler) = 0; 00071 virtual sys::ShutdownHandler* getShutdownHandler() const = 0; 00072 virtual framing::OutputHandler* getOutputHandler() = 0; 00073 virtual const std::string& getIdentifier() const = 0; 00074 00075 virtual void activateSecurityLayer(std::auto_ptr<qpid::sys::SecurityLayer>); 00076 00077 }; 00078 00079 }} 00080 00081 00082 #endif