Qpid Proton C++  0.14.0
link.hpp
1 #ifndef PROTON_LINK_HPP
2 #define PROTON_LINK_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 "./endpoint.hpp"
26 #include "./internal/export.hpp"
27 #include "./message.hpp"
28 #include "./source.hpp"
29 #include "./target.hpp"
30 #include "./internal/object.hpp"
31 #include "./sender_options.hpp"
32 #include "./receiver_options.hpp"
33 
34 #include <proton/types.h>
35 
36 #include <string>
37 
38 namespace proton {
39 
40 class sender;
41 class receiver;
42 class error_condition;
43 class link_context;
44 class proton_event;
45 class messaging_adapter;
46 class proton_handler;
47 class delivery;
48 class connection;
49 class container;
50 class session;
51 class sender_iterator;
52 class receiver_iterator;
53 
56 class
57 PN_CPP_CLASS_EXTERN link : public internal::object<pn_link_t> , public endpoint {
59  link(pn_link_t* l) : internal::object<pn_link_t>(l) {}
61 
62  public:
64  link() : internal::object<pn_link_t>(0) {}
65 
66  PN_CPP_EXTERN bool uninitialized() const;
67  PN_CPP_EXTERN bool active() const;
68  PN_CPP_EXTERN bool closed() const;
69 
70  PN_CPP_EXTERN class error_condition error() const;
71 
72  PN_CPP_EXTERN void close();
73  PN_CPP_EXTERN void close(const error_condition&);
74 
79  // XXX Should take error condition
80  PN_CPP_EXTERN void detach();
81 
83  PN_CPP_EXTERN int credit() const;
84 
91  PN_CPP_EXTERN bool draining();
92 
94  PN_CPP_EXTERN std::string name() const;
95 
97  PN_CPP_EXTERN class container &container() const;
98 
100  PN_CPP_EXTERN class connection connection() const;
101 
103  PN_CPP_EXTERN class session session() const;
104 
105  protected:
107 
108  // Initiate the AMQP attach frame.
109  void attach();
110 
111  friend class internal::factory<link>;
112 
114 };
115 
116 }
117 
118 #endif // PROTON_LINK_HPP
A top-level container of connections, sessions, senders, and receivers.
Definition: container.hpp:62
A connection to a remote AMQP peer.
Definition: connection.hpp:48
The base class for session, connection, and link.
Definition: endpoint.hpp:33
A container of senders and receivers.
Definition: session.hpp:46
Type traits for mapping between AMQP and C++ types.
Definition: annotation_key.hpp:28
Describes an endpoint error state.
Definition: error_condition.hpp:37