Qpid Proton C++  0.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
link_options.hpp
1 #ifndef PROTON_CPP_LINK_OPTIONS_H
2 #define PROTON_CPP_LINK_OPTIONS_H
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 "proton/config.hpp"
26 #include "proton/export.hpp"
27 #include "proton/pn_unique_ptr.hpp"
28 #include "proton/types.hpp"
29 #include "proton/terminus.hpp"
30 
31 #include <vector>
32 #include <string>
33 
34 namespace proton {
35 
36 class proton_handler;
37 class link;
38 
60 class link_options {
61  public:
64  // No set policy. The application must settle messages itself
65  // according to its own policy.
66  DELIVERY_MODE_NONE = 0,
67  // Outgoing messages are settled immediately by the link.
68  // There are no duplicates.
69  AT_MOST_ONCE,
70  // The receiver settles the delivery first with an
71  // accept/reject/release disposition. The sender waits to
72  // settle until after the disposition notification is
73  // received.
74  AT_LEAST_ONCE
75  };
76 
79  UNSETTLED = PN_SND_UNSETTLED,
80  SETTLED = PN_SND_SETTLED,
81  MIXED = PN_SND_MIXED
82  };
83 
87  enum receiver_settle_mode {
88  SETTLE_ALWAYS = PN_RCV_FIRST,
89  SETTLE_SECOND= PN_RCV_SECOND
90  };
92 
95  // The policy is unspecified.
96  LIFETIME_UNSPECIFIED = 0,
97  // The lifetime of the dynamic node is scoped to lifetime of
98  // the creating link.
99  DELETE_ON_CLOSE = 0x2B,
100  // The node will be deleted when it is neither the source nor
101  // the target of any link.
102  DELETE_ON_NO_LINKS = 0x2C,
103  // The node will be deleted when the creating link no longer
104  // exists and no messages remain at the node.
105  DELETE_ON_NO_MESSAGES = 0x2D,
106  // The node will be deleted when there are no links which have
107  // this node as their source or target, and there remain no
108  // messages at the node.
109  DELETE_ON_NO_LINKS_OR_MESSAGES = 0x2E
110  };
111 
113  PN_CPP_EXTERN link_options();
114 
116  PN_CPP_EXTERN link_options(const link_options&);
117 
118  PN_CPP_EXTERN ~link_options();
119 
121  PN_CPP_EXTERN link_options& operator=(const link_options&);
122 
124  PN_CPP_EXTERN void override(const link_options& other);
125 
128  PN_CPP_EXTERN link_options& handler(class handler *);
129 
134  PN_CPP_EXTERN link_options& browsing(bool);
135 
138 
143  PN_CPP_EXTERN link_options& durable_subscription(bool);
144 
146  PN_CPP_EXTERN link_options& delivery_mode(delivery_mode);
147 
149  PN_CPP_EXTERN link_options& dynamic_address(bool);
150 
154 
156  PN_CPP_EXTERN link_options& local_address(const std::string &addr);
157 
164  PN_CPP_EXTERN link_options& selector(const std::string &str);
166 
167  private:
168  void apply(link&) const;
169  proton_handler* handler() const;
170 
171  class impl;
172  pn_unique_ptr<impl> impl_;
173 
175  friend class link;
177 };
178 
179 }
180 
181 #endif // PROTON_CPP_LINK_OPTIONS_H
distribution_mode
Distribution mode.
Definition: terminus.hpp:72
Defines C++ types representing AMQP types.
Callback functions for handling proton events.
Definition: handler.hpp:40