Qpid Proton C++  0.14.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
connection.hpp
1 #ifndef PROTON_CONNECTION_HPP
2 #define PROTON_CONNECTION_HPP
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
25 #include "./internal/export.hpp"
26 #include "./endpoint.hpp"
27 #include "./internal/object.hpp"
28 #include "./session.hpp"
29 
30 #include <proton/types.h>
31 
32 #include <string>
33 
34 struct pn_connection_t;
35 
36 namespace proton {
37 
38 class messaging_handler;
39 class connection_options;
40 class sender;
41 class sender_options;
42 class receiver;
43 class receiver_options;
44 class container;
45 template <class T> class thread_safe;
46 
48 class
49 PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, public endpoint {
51  PN_CPP_EXTERN connection(pn_connection_t* c) : internal::object<pn_connection_t>(c) {}
53 
54  public:
56  connection() : internal::object<pn_connection_t>(0) {}
57 
58  PN_CPP_EXTERN bool uninitialized() const;
59  PN_CPP_EXTERN bool active() const;
60  PN_CPP_EXTERN bool closed() const;
61 
62  PN_CPP_EXTERN class error_condition error() const;
63 
68  PN_CPP_EXTERN class container &container() const;
69 
71  PN_CPP_EXTERN class transport transport() const;
72 
74  PN_CPP_EXTERN std::string virtual_host() const;
75 
77  PN_CPP_EXTERN std::string container_id() const;
78 
81  PN_CPP_EXTERN std::string user() const;
82 
86  PN_CPP_EXTERN void open();
87 
89  PN_CPP_EXTERN void open(const connection_options &);
90 
91  PN_CPP_EXTERN void close();
92  PN_CPP_EXTERN void close(const error_condition&);
93 
95  PN_CPP_EXTERN session open_session();
96 
98  PN_CPP_EXTERN session open_session(const session_options &);
99 
102  PN_CPP_EXTERN session default_session();
103 
105  PN_CPP_EXTERN sender open_sender(const std::string &addr);
106 
108  PN_CPP_EXTERN sender open_sender(const std::string &addr, const sender_options &);
109 
111  PN_CPP_EXTERN receiver open_receiver(const std::string &addr);
112 
114  PN_CPP_EXTERN receiver open_receiver(const std::string &addr,
115  const receiver_options &);
116 
118  PN_CPP_EXTERN session_range sessions() const;
119 
121  PN_CPP_EXTERN receiver_range receivers() const;
122 
124  PN_CPP_EXTERN sender_range senders() const;
125 
129  PN_CPP_EXTERN uint32_t max_frame_size() const;
130 
134  PN_CPP_EXTERN uint16_t max_sessions() const;
135 
139  PN_CPP_EXTERN uint32_t idle_timeout() const;
140 
142  friend class internal::factory<connection>;
143  friend class connector;
144  friend class proton::thread_safe<connection>;
146 };
147 
148 } // proton
149 
150 #endif // PROTON_CONNECTION_HPP
A top-level container of connections, sessions, senders, and receivers.
Definition: container.hpp:62
A channel for sending messages.
Definition: sender.hpp:40
Options for creating a sender.
Definition: sender_options.hpp:64
A connection to a remote AMQP peer.
Definition: connection.hpp:48
Options for creating a connection.
Definition: connection_options.hpp:67
The base class for session, connection, and link.
Definition: endpoint.hpp:33
A container of senders and receivers.
Definition: session.hpp:46
Options for creating a receiver.
Definition: receiver_options.hpp:62
A channel for receiving messages.
Definition: receiver.hpp:39
connection()
Create an empty connection.
Definition: connection.hpp:56
A network channel supporting an AMQP connection.
Definition: transport.hpp:42
The base Proton error.
Definition: error.hpp:37
Options for creating a session.
Definition: session_options.hpp:42
Experimental - A thread-safe object wrapper.
Definition: connection.hpp:45
Describes an endpoint error state.
Definition: error_condition.hpp:37