Qpid Proton C++ API  0.32.0
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 #include "./symbol.hpp"
31 
32 #include <proton/type_compat.h>
33 
34 #include <string>
35 
38 
39 struct pn_connection_t;
40 
41 namespace proton {
42 
44 class
45 PN_CPP_CLASS_EXTERN connection : public internal::object<pn_connection_t>, public endpoint {
47  PN_CPP_EXTERN connection(pn_connection_t* c) : internal::object<pn_connection_t>(c) {}
49 
50  public:
52  connection() : internal::object<pn_connection_t>(0) {}
53 
54  PN_CPP_EXTERN ~connection();
55 
56  PN_CPP_EXTERN bool uninitialized() const;
57  PN_CPP_EXTERN bool active() const;
58  PN_CPP_EXTERN bool closed() const;
59 
60  PN_CPP_EXTERN class error_condition error() const;
61 
66  PN_CPP_EXTERN class container& container() const;
67 
69  PN_CPP_EXTERN class work_queue& work_queue() const;
70 
72  PN_CPP_EXTERN class transport transport() const;
73 
75  PN_CPP_EXTERN std::string virtual_host() const;
76 
78  PN_CPP_EXTERN std::string container_id() const;
79 
82  PN_CPP_EXTERN std::string user() const;
83 
86  PN_CPP_EXTERN void open();
87 
89  PN_CPP_EXTERN void open(const connection_options&);
90 
93  PN_CPP_EXTERN void close();
94 
96  PN_CPP_EXTERN void close(const error_condition&);
97 
99  PN_CPP_EXTERN session open_session();
100 
102  PN_CPP_EXTERN session open_session(const session_options&);
103 
106  PN_CPP_EXTERN session default_session();
107 
109  PN_CPP_EXTERN sender open_sender(const std::string& addr);
110 
112  PN_CPP_EXTERN sender open_sender(const std::string& addr, const sender_options&);
113 
115  PN_CPP_EXTERN receiver open_receiver(const std::string& addr);
116 
118  PN_CPP_EXTERN receiver open_receiver(const std::string& addr,
119  const receiver_options&);
120 
122  PN_CPP_EXTERN class sender_options sender_options() const;
123 
125  PN_CPP_EXTERN class receiver_options receiver_options() const;
126 
128  PN_CPP_EXTERN session_range sessions() const;
129 
131  PN_CPP_EXTERN receiver_range receivers() const;
132 
134  PN_CPP_EXTERN sender_range senders() const;
135 
139  PN_CPP_EXTERN uint32_t max_frame_size() const;
140 
145  PN_CPP_EXTERN uint16_t max_sessions() const;
146 
148  PN_CPP_EXTERN std::vector<symbol> offered_capabilities() const;
149 
151  PN_CPP_EXTERN std::vector<symbol> desired_capabilities() const;
152 
156  PN_CPP_EXTERN uint32_t idle_timeout() const;
157 
176  PN_CPP_EXTERN void wake() const;
177 
182  PN_CPP_EXTERN bool reconnected() const;
183 
195  PN_CPP_EXTERN void update_options(const connection_options&);
196 
198  friend class internal::factory<connection>;
199  friend class container;
201 };
202 
203 } // proton
204 
205 #endif // PROTON_CONNECTION_HPP
proton::error_condition
Describes an endpoint error state.
Definition: error_condition.hpp:40
proton::connection::container
class container & container() const
Get the container.
proton::connection::max_frame_size
uint32_t max_frame_size() const
Get the maximum frame size allowed by the remote peer.
proton::connection::connection
connection()
Create an empty connection.
Definition: connection.hpp:52
session.hpp
A container of senders and receivers.
proton::connection::sessions
session_range sessions() const
Return all sessions on this connection.
symbol.hpp
A string that represents the AMQP symbol type.
proton::connection::wake
void wake() const
Unsettled API - Trigger an event from another thread.
proton::connection::container_id
std::string container_id() const
Return the remote container ID for the connection.
proton::connection::open
void open(const connection_options &)
Open the connection.
proton::error
The base Proton error.
Definition: error.hpp:41
proton::container
A top-level container of connections, sessions, and links.
Definition: container.hpp:50
proton::connection::reconnected
bool reconnected() const
Unsettled API - True if this connection has been automatically re-connected.
fwd.hpp
Forward declarations.
proton::connection::work_queue
class work_queue & work_queue() const
Get the work_queue for the connection.
proton::endpoint
The base class for session, connection, and link.
Definition: endpoint.hpp:37
proton::connection::open_sender
sender open_sender(const std::string &addr, const sender_options &)
Open a sender for addr on default_session().
proton::connection::offered_capabilities
std::vector< symbol > offered_capabilities() const
Unsettled API - Extension capabilities offered by the remote peer.
proton::receiver_options
Options for creating a receiver.
Definition: receiver_options.hpp:56
proton::connection
A connection to a remote AMQP peer.
Definition: connection.hpp:45
proton::connection::virtual_host
std::string virtual_host() const
Return the remote AMQP hostname attribute for the connection.
proton::receiver
A channel for receiving messages.
Definition: receiver.hpp:41
proton::connection_options
Options for creating a connection.
Definition: connection_options.hpp:67
proton::connection::close
void close()
Close the connection.
proton::connection::open
void open()
Open the connection.
proton::connection::user
std::string user() const
Return authenticated user for the connection Note: The value returned is not stable until the on_tran...
proton::connection::open_session
session open_session(const session_options &)
Open a new session.
endpoint.hpp
The base class for session, connection, and link.
proton::sender_options
Options for creating a sender.
Definition: sender_options.hpp:57
proton::session_options
Options for creating a session.
Definition: session_options.hpp:40
proton::connection::update_options
void update_options(const connection_options &)
Unsettled API - Update the connection options for this connection
proton::sender
A channel for sending messages.
Definition: sender.hpp:40
proton::connection::open_receiver
receiver open_receiver(const std::string &addr)
Open a receiver for addr on default_session().
proton::transport
A network channel supporting an AMQP connection.
Definition: transport.hpp:37
proton::connection::close
void close(const error_condition &)
Close the connection.
proton::connection::open_sender
sender open_sender(const std::string &addr)
Open a sender for addr on default_session().
proton::connection::desired_capabilities
std::vector< symbol > desired_capabilities() const
Unsettled API - Extension capabilities desired by the remote peer.
proton::connection::uninitialized
bool uninitialized() const
True if the local end is uninitialized.
proton
The main Proton namespace.
Definition: annotation_key.hpp:33
proton::connection::receivers
receiver_range receivers() const
Return all receivers on this connection.
proton::connection::active
bool active() const
True if the local end is active.
proton::connection::senders
sender_range senders() const
Return all senders on this connection.
proton::session
A container of senders and receivers.
Definition: session.hpp:42
proton::connection::idle_timeout
uint32_t idle_timeout() const
Get the idle timeout set by the remote peer.
proton::connection::max_sessions
uint16_t max_sessions() const
Get the maximum number of open sessions allowed by the remote peer.
proton::connection::open_session
session open_session()
Open a new session.
proton::work_queue
Unsettled API - A context for thread-safe execution of work.
Definition: work_queue.hpp:339
proton::connection::default_session
session default_session()
Get the default session.