activemq-cpp-3.6.0
TcpTransport.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_
19 #define _ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_
20 
23 #include <activemq/util/Config.h>
25 #include <decaf/net/Socket.h>
26 #include <decaf/net/URI.h>
27 #include <decaf/util/Properties.h>
28 #include <decaf/lang/Pointer.h>
33 #include <memory>
34 
35 namespace activemq {
36 namespace transport {
37 namespace tcp {
38 
40 
41  class TcpTransportImpl;
42 
49  private:
50 
51  TcpTransportImpl* impl;
52 
53  private:
54 
55  TcpTransport(const TcpTransport&);
56  TcpTransport& operator=(const TcpTransport&);
57 
58  public:
59 
69  TcpTransport(const Pointer<Transport> next, const decaf::net::URI& location);
70 
71  virtual ~TcpTransport();
72 
73  void setConnectTimeout(int soConnectTimeout);
74  int getConnectTimeout() const;
75 
76  void setOutputBufferSize(int outputBufferSize);
77  int getOutputBufferSize() const;
78 
79  void setInputBufferSize(int inputBufferSize);
80  int getInputBufferSize() const;
81 
82  void setTrace(bool trace);
83  bool isTrace() const;
84 
85  void setLinger(int soLinger);
86  int getLinger() const;
87 
88  void setKeepAlive(bool soKeepAlive);
89  bool isKeepAlive() const;
90 
91  void setReceiveBufferSize(int soReceiveBufferSize);
92  int getReceiveBufferSize() const;
93 
94  void setSendBufferSize(int soSendBufferSize);
95  int getSendBufferSize() const;
96 
97  void setTcpNoDelay(bool tcpNoDelay);
98  bool isTcpNoDelay() const;
99 
100  public: // Transport Methods
101 
102  virtual bool isFaultTolerant() const {
103  return false;
104  }
105 
106  virtual bool isConnected() const;
107 
108  protected:
109 
110  virtual void beforeNextIsStarted();
111 
112  virtual void afterNextIsStopped();
113 
114  virtual void doClose();
115 
120  void connect();
121 
130  virtual decaf::net::Socket* createSocket();
131 
145  virtual void configureSocket(decaf::net::Socket* socket);
146 
147  };
148 
149 }}}
150 
151 #endif /*_ACTIVEMQ_TRANSPORT_TCP_TCPTRANSPORT_H_*/