| 1 |
#ifndef PROTON_SOURCE_OPTIONS_HPP |
| 2 |
#define PROTON_SOURCE_OPTIONS_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 "./duration.hpp" |
| 27 |
#include "./source.hpp" |
| 28 |
|
| 29 |
#include <map> |
| 30 |
#include <memory> |
| 31 |
#include <string> |
| 32 |
#include <vector> |
| 33 |
|
| 34 |
/// @file |
| 35 |
/// @copybrief proton::source_options |
| 36 |
|
| 37 |
namespace proton { |
| 38 |
|
| 39 |
/// Options for creating a source node for a sender or receiver. |
| 40 |
/// |
| 41 |
/// Options can be "chained". For more information see @ref |
| 42 |
/// proton::connection_options. |
| 43 |
/// |
| 44 |
/// Normal value semantics: copy or assign creates a separate copy of |
| 45 |
/// the options. |
| 46 |
class source_options { |
| 47 |
public: |
| 48 |
/// Create an empty set of options. |
| 49 |
PN_CPP_EXTERN source_options(); |
| 50 |
|
| 51 |
/// Copy options. |
| 52 |
PN_CPP_EXTERN source_options(const source_options&); |
| 53 |
|
| 54 |
PN_CPP_EXTERN ~source_options(); |
| 55 |
|
| 56 |
/// Copy options. |
| 57 |
PN_CPP_EXTERN source_options& operator=(const source_options&); |
| 58 |
|
| 59 |
/// Set the address for the source. It is unset by default. The |
| 60 |
/// address is ignored if dynamic() is true. |
| 61 |
PN_CPP_EXTERN source_options& address(const std::string&); |
| 62 |
|
| 63 |
/// Request that a node be dynamically created by the remote peer. |
| 64 |
/// The default is false. Any specified source address() is |
| 65 |
/// ignored. |
| 66 |
PN_CPP_EXTERN source_options& dynamic(bool); |
| 67 |
|
| 68 |
/// Request an anonymous node on the remote peer. |
| 69 |
/// The default is false. Any specified target address() is |
| 70 |
/// ignored if true. |
| 71 |
PN_CPP_EXTERN source_options& anonymous(bool); |
| 72 |
|
| 73 |
/// Control whether messages are browsed or consumed. The |
| 74 |
/// default is source::MOVE, meaning consumed. |
| 75 |
PN_CPP_EXTERN source_options& distribution_mode(enum source::distribution_mode); |
| 76 |
|
| 77 |
/// Control the persistence of the source node. The default is |
| 78 |
/// source::NONDURABLE, meaning non-persistent. |
| 79 |
PN_CPP_EXTERN source_options& durability_mode(enum source::durability_mode); |
| 80 |
|
| 81 |
/// The expiry period after which the source is discarded. The |
| 82 |
/// default is no timeout. |
| 83 |
PN_CPP_EXTERN source_options& timeout(duration); |
| 84 |
|
| 85 |
/// Control when the clock for expiration begins. The default is |
| 86 |
/// source::LINK_CLOSE. |
| 87 |
PN_CPP_EXTERN source_options& expiry_policy(enum source::expiry_policy); |
| 88 |
|
| 89 |
/// **Unsettled API** - Specify a filter mechanism on the source |
| 90 |
/// that restricts message flow to a subset of the available |
| 91 |
/// messages. |
| 92 |
PN_CPP_EXTERN source_options& filters(const source::filter_map&); |
| 93 |
|
| 94 |
/// **Unsettled API** Extension capabilities that are supported/requested |
| 95 |
PN_CPP_EXTERN source_options& capabilities(const std::vector<symbol>&); |
| 96 |
|
| 97 |
/// **Unsettled API** Set the dynamic node properties. |
| 98 |
PN_CPP_EXTERN source_options& dynamic_properties(const source::dynamic_property_map&); |
| 99 |
|
| 100 |
private: |
| 101 |
void apply(source&) const; |
| 102 |
|
| 103 |
class impl; |
| 104 |
std::unique_ptr<impl> impl_; |
| 105 |
|
| 106 |
/// @cond INTERNAL |
| 107 |
friend class source; |
| 108 |
friend class sender_options; |
| 109 |
friend class receiver_options; |
| 110 |
/// @endcond |
| 111 |
}; |
| 112 |
|
| 113 |
} // proton |
| 114 |
|
| 115 |
#endif // PROTON_SOURCE_OPTIONS_HPP |