activemq-cpp-3.8.2
SocketImpl.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 _DECAF_NET_SOCKETIMPL_H_
19 #define _DECAF_NET_SOCKETIMPL_H_
20 
21 #include <decaf/util/Config.h>
22 
23 #include <decaf/io/IOException.h>
24 #include <decaf/io/InputStream.h>
25 #include <decaf/io/OutputStream.h>
27 
31 
32 #include <string>
33 
34 namespace decaf {
35 namespace net {
36 
43  protected:
44 
48  int port;
49 
53  int localPort;
54 
58  std::string address;
59 
64 
65  private:
66 
67  SocketImpl( const SocketImpl& );
68  SocketImpl& operator= ( const SocketImpl& );
69 
70  public:
71 
72  SocketImpl();
73 
74  virtual ~SocketImpl();
75 
76  public:
77 
84  virtual void create() = 0;
85 
96  virtual void accept( SocketImpl* socket ) = 0;
97 
112  virtual void connect( const std::string& hostname, int port, int timeout ) = 0;
113 
124  virtual void bind( const std::string& ipaddress, int port ) = 0;
125 
136  virtual void listen( int backlog ) = 0;
137 
145  virtual decaf::io::InputStream* getInputStream() = 0;
146 
154  virtual decaf::io::OutputStream* getOutputStream() = 0;
155 
163  virtual int available() = 0;
164 
170  virtual void close() = 0;
171 
179  virtual void shutdownInput() = 0;
180 
189  virtual void shutdownOutput() = 0;
190 
201  virtual int getOption( int option ) const = 0;
202 
213  virtual void setOption( int option, int value ) = 0;
214 
220  int getPort() const {
221  return this->port;
222  }
223 
229  int getLocalPort() const {
230  return this->localPort;
231  }
232 
238  std::string getInetAddress() const {
239  return this->address;
240  }
241 
249  return this->fd;
250  }
251 
258  virtual std::string getLocalAddress() const = 0;
259 
265  std::string toString() const;
266 
271  virtual bool supportsUrgentData() const {
272  return false;
273  }
274 
283  virtual void sendUrgentData( int data );
284 
285  };
286 
287 }}
288 
289 #endif /* _DECAF_NET_SOCKETIMPL_H_ */
virtual bool supportsUrgentData() const
Definition: SocketImpl.h:271
const decaf::io::FileDescriptor * getFileDescriptor() const
Gets the FileDescriptor for this Socket, the Object is owned by this Socket and should not be deleted...
Definition: SocketImpl.h:248
std::string address
The Remote Address that the Socket is connected to.
Definition: SocketImpl.h:58
int getPort() const
Gets the port that this socket has been assigned.
Definition: SocketImpl.h:220
Definition: SocketOptions.h:30
A base class that must be implemented by all classes wishing to provide a class that reads in a strea...
Definition: InputStream.h:39
int getLocalPort() const
Gets the value of this SocketImpl&#39;s local port field.
Definition: SocketImpl.h:229
std::string getInetAddress() const
Gets the value of this SocketImpl&#39;s address field.
Definition: SocketImpl.h:238
This class servers as an opaque wrapper around an underlying OS level resource that can be used as a ...
Definition: FileDescriptor.h:32
int port
The remote port that this Socket is connected to.
Definition: SocketImpl.h:48
Acts as a base class for all physical Socket implementations.
Definition: SocketImpl.h:42
io::FileDescriptor * fd
The File Descriptor for this Socket.
Definition: SocketImpl.h:63
#define DECAF_API
Definition: Config.h:29
Base interface for any class that wants to represent an output stream of bytes.
Definition: OutputStream.h:39
int localPort
The port on the Local Machine that this Socket is Bound to.
Definition: SocketImpl.h:53
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: AprPool.h:25