Qpid Proton C++ API  0.18.1
connection.hpp
Go to the documentation of this file.
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 "./fwd.hpp"
26 #include "./internal/export.hpp"
27 #include "./internal/object.hpp"
28 #include "./endpoint.hpp"
29 #include "./session.hpp"
30 
31 #include <proton/type_compat.h>
32 
33 #include <string>
34 
37 
38 struct pn_connection_t;
39 
40 namespace proton {
41 
43 class
44 PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, public endpoint {
46  PN_CPP_EXTERN connection(pn_connection_t* c) : internal::object<pn_connection_t>(c) {}
48 
49  public:
51  connection() : internal::object<pn_connection_t>(0) {}
52 
53  PN_CPP_EXTERN bool uninitialized() const;
54  PN_CPP_EXTERN bool active() const;
55  PN_CPP_EXTERN bool closed() const;
56 
57  PN_CPP_EXTERN class error_condition error() const;
58 
63  PN_CPP_EXTERN class container& container() const;
64 
66  PN_CPP_EXTERN class work_queue& work_queue() const;
67 
69  PN_CPP_EXTERN class transport transport() const;
70 
72  PN_CPP_EXTERN std::string virtual_host() const;
73 
75  PN_CPP_EXTERN std::string container_id() const;
76 
79  PN_CPP_EXTERN std::string user() const;
80 
84  PN_CPP_EXTERN void open();
85 
87  PN_CPP_EXTERN void open(const connection_options&);
88 
89  PN_CPP_EXTERN void close();
90  PN_CPP_EXTERN void close(const error_condition&);
91 
93  PN_CPP_EXTERN session open_session();
94 
96  PN_CPP_EXTERN session open_session(const session_options&);
97 
100  PN_CPP_EXTERN session default_session();
101 
103  PN_CPP_EXTERN sender open_sender(const std::string& addr);
104 
106  PN_CPP_EXTERN sender open_sender(const std::string& addr, const sender_options&);
107 
109  PN_CPP_EXTERN receiver open_receiver(const std::string& addr);
110 
112  PN_CPP_EXTERN receiver open_receiver(const std::string& addr,
113  const receiver_options&);
114 
116  PN_CPP_EXTERN class sender_options sender_options() const;
117 
119  PN_CPP_EXTERN class receiver_options receiver_options() const;
120 
122  PN_CPP_EXTERN session_range sessions() const;
123 
125  PN_CPP_EXTERN receiver_range receivers() const;
126 
128  PN_CPP_EXTERN sender_range senders() const;
129 
133  PN_CPP_EXTERN uint32_t max_frame_size() const;
134 
139  PN_CPP_EXTERN uint16_t max_sessions() const;
140 
144  PN_CPP_EXTERN uint32_t idle_timeout() const;
145 
164  PN_CPP_EXTERN void wake() const;
165 
167  friend class internal::factory<connection>;
168  friend class container;
170 };
171 
172 } // proton
173 
174 #endif // PROTON_CONNECTION_HPP
A top-level container of connections, sessions, and links.
Definition: container.hpp:55
A channel for sending messages.
Definition: sender.hpp:39
Options for creating a sender.
Definition: sender_options.hpp:56
Forward declarations.
A connection to a remote AMQP peer.
Definition: connection.hpp:43
Options for creating a connection.
Definition: connection_options.hpp:65
The base class for session, connection, and link.
Definition: endpoint.hpp:36
A container of senders and receivers.
Definition: session.hpp:41
Options for creating a receiver.
Definition: receiver_options.hpp:55
A channel for receiving messages.
Definition: receiver.hpp:40
Unsettled API - A context for thread-safe execution of work.
Definition: work_queue.hpp:339
connection()
Create an empty connection.
Definition: connection.hpp:51
A container of senders and receivers.
A network channel supporting an AMQP connection.
Definition: transport.hpp:37
Options for creating a session.
Definition: session_options.hpp:40
The main Proton namespace.
Definition: annotation_key.hpp:33
The base class for session, connection, and link.
Describes an endpoint error state.
Definition: error_condition.hpp:40