00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_ 00019 #define _ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_ 00020 00021 #include <activemq/io/LoggingInputStream.h> 00022 #include <activemq/io/LoggingOutputStream.h> 00023 #include <activemq/util/Config.h> 00024 #include <activemq/transport/TransportFilter.h> 00025 #include <decaf/net/Socket.h> 00026 #include <decaf/net/URI.h> 00027 #include <decaf/util/Properties.h> 00028 #include <decaf/lang/Pointer.h> 00029 #include <decaf/io/BufferedInputStream.h> 00030 #include <decaf/io/BufferedOutputStream.h> 00031 #include <decaf/io/DataInputStream.h> 00032 #include <decaf/io/DataOutputStream.h> 00033 #include <memory> 00034 00035 namespace activemq { 00036 namespace transport { 00037 namespace tcp { 00038 00039 using decaf::lang::Pointer; 00040 00041 class TcpTransportImpl; 00042 00048 class AMQCPP_API TcpTransport: public TransportFilter { 00049 private: 00050 00051 TcpTransportImpl* impl; 00052 00053 private: 00054 00055 TcpTransport(const TcpTransport&); 00056 TcpTransport& operator=(const TcpTransport&); 00057 00058 public: 00059 00069 TcpTransport(const Pointer<Transport> next, const decaf::net::URI& location); 00070 00071 virtual ~TcpTransport(); 00072 00073 void setConnectTimeout(int soConnectTimeout); 00074 int getConnectTimeout() const; 00075 00076 void setOutputBufferSize(int outputBufferSize); 00077 int getOutputBufferSize() const; 00078 00079 void setInputBufferSize(int inputBufferSize); 00080 int getInputBufferSize() const; 00081 00082 void setTrace(bool trace); 00083 bool isTrace() const; 00084 00085 void setLinger(int soLinger); 00086 int getLinger() const; 00087 00088 void setKeepAlive(bool soKeepAlive); 00089 bool isKeepAlive() const; 00090 00091 void setReceiveBufferSize(int soReceiveBufferSize); 00092 int getReceiveBufferSize() const; 00093 00094 void setSendBufferSize(int soSendBufferSize); 00095 int getSendBufferSize() const; 00096 00097 void setTcpNoDelay(bool tcpNoDelay); 00098 bool isTcpNoDelay() const; 00099 00100 public: // Transport Methods 00101 00102 virtual bool isFaultTolerant() const { 00103 return false; 00104 } 00105 00106 virtual bool isConnected() const; 00107 00108 protected: 00109 00110 decaf::net::URI getLocation() const; 00111 00112 virtual void beforeNextIsStarted(); 00113 00114 virtual void afterNextIsStopped(); 00115 00116 virtual void doClose(); 00117 00122 void connect(); 00123 00132 virtual decaf::net::Socket* createSocket(); 00133 00147 virtual void configureSocket(decaf::net::Socket* socket); 00148 00149 }; 00150 00151 }}} 00152 00153 #endif /*_ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_*/
1.6.1