qpid_proton 0.9.0 → 0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codec/data.rb +912 -0
- data/lib/codec/mapping.rb +169 -0
- data/lib/{qpid_proton/tracker.rb → core/base_handler.rb} +4 -15
- data/lib/core/connection.rb +328 -0
- data/lib/core/delivery.rb +271 -0
- data/lib/core/disposition.rb +158 -0
- data/lib/core/endpoint.rb +140 -0
- data/lib/{qpid_proton → core}/exceptions.rb +43 -2
- data/lib/core/link.rb +387 -0
- data/lib/core/message.rb +633 -0
- data/lib/core/receiver.rb +95 -0
- data/lib/core/sasl.rb +94 -0
- data/lib/core/selectable.rb +130 -0
- data/lib/core/sender.rb +76 -0
- data/lib/core/session.rb +163 -0
- data/lib/core/ssl.rb +164 -0
- data/lib/{qpid_proton/version.rb → core/ssl_details.rb} +7 -6
- data/lib/core/ssl_domain.rb +156 -0
- data/lib/core/terminus.rb +218 -0
- data/lib/core/transport.rb +411 -0
- data/lib/core/url.rb +77 -0
- data/lib/event/collector.rb +148 -0
- data/lib/event/event.rb +318 -0
- data/lib/event/event_base.rb +91 -0
- data/lib/event/event_type.rb +71 -0
- data/lib/handler/acking.rb +70 -0
- data/lib/handler/c_adaptor.rb +47 -0
- data/lib/handler/c_flow_controller.rb +33 -0
- data/lib/handler/endpoint_state_handler.rb +217 -0
- data/lib/handler/incoming_message_handler.rb +74 -0
- data/lib/handler/messaging_handler.rb +218 -0
- data/lib/handler/outgoing_message_handler.rb +98 -0
- data/lib/handler/wrapped_handler.rb +76 -0
- data/lib/messenger/messenger.rb +702 -0
- data/lib/messenger/subscription.rb +37 -0
- data/lib/messenger/tracker.rb +38 -0
- data/lib/messenger/tracker_status.rb +69 -0
- data/lib/qpid_proton.rb +106 -16
- data/lib/reactor/acceptor.rb +41 -0
- data/lib/reactor/backoff.rb +41 -0
- data/lib/reactor/connector.rb +98 -0
- data/lib/reactor/container.rb +272 -0
- data/lib/reactor/global_overrides.rb +44 -0
- data/lib/reactor/link_option.rb +90 -0
- data/lib/reactor/reactor.rb +198 -0
- data/lib/reactor/session_per_connection.rb +45 -0
- data/lib/reactor/ssl_config.rb +41 -0
- data/lib/reactor/task.rb +39 -0
- data/lib/{qpid_proton/subscription.rb → reactor/urls.rb} +12 -13
- data/lib/{qpid_proton → types}/array.rb +28 -29
- data/lib/types/described.rb +63 -0
- data/lib/{qpid_proton → types}/hash.rb +4 -3
- data/lib/types/strings.rb +62 -0
- data/lib/util/class_wrapper.rb +54 -0
- data/lib/util/condition.rb +45 -0
- data/lib/util/constants.rb +85 -0
- data/lib/util/engine.rb +82 -0
- data/lib/util/error_handler.rb +127 -0
- data/lib/util/handler.rb +41 -0
- data/lib/util/reactor.rb +32 -0
- data/lib/util/swig_helper.rb +114 -0
- data/lib/util/timeout.rb +50 -0
- data/lib/util/uuid.rb +32 -0
- data/lib/util/version.rb +30 -0
- data/lib/util/wrapper.rb +124 -0
- metadata +67 -21
- data/ext/cproton/cproton.c +0 -22196
- data/lib/qpid_proton/data.rb +0 -788
- data/lib/qpid_proton/described.rb +0 -66
- data/lib/qpid_proton/exception_handling.rb +0 -127
- data/lib/qpid_proton/filters.rb +0 -67
- data/lib/qpid_proton/mapping.rb +0 -170
- data/lib/qpid_proton/message.rb +0 -621
- data/lib/qpid_proton/messenger.rb +0 -702
- data/lib/qpid_proton/selectable.rb +0 -126
- data/lib/qpid_proton/strings.rb +0 -65
- data/lib/qpid_proton/tracker_status.rb +0 -73
data/lib/core/ssl.rb
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
#--
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Qpid::Proton
|
21
|
+
|
22
|
+
# The SSL support for Transport.
|
23
|
+
#
|
24
|
+
# A Transport may be configured ot use SLL for encryption and/or
|
25
|
+
# authentication. A Transport can be configured as either the SSL
|
26
|
+
# client or the server. An SSL client is the party that proctively
|
27
|
+
# establishes a connection to an SSL server. An SSL server is the
|
28
|
+
# party that accepts a connection request from the remote SSL client.
|
29
|
+
#
|
30
|
+
# If either the client or the server needs to identify itself with the
|
31
|
+
# remote node, it must have its SSL certificate configured.
|
32
|
+
#
|
33
|
+
# @see SSLDomain#credentials For setting the SSL certificate.
|
34
|
+
#
|
35
|
+
# If either the client or the server needs to verify the identify of the
|
36
|
+
# remote node, it must have its database of trusted CAs configured.
|
37
|
+
#
|
38
|
+
# @see SSLDomain#trusted_ca_db Setting the CA database.
|
39
|
+
#
|
40
|
+
# An SSL server connection may allow the remote client to connect without
|
41
|
+
# SS (i.e., "in the clear").
|
42
|
+
#
|
43
|
+
# @see SSLDomain#allow_unsecured_client Allowing unsecured clients.
|
44
|
+
#
|
45
|
+
# The level of verification required of the remote may be configured.
|
46
|
+
#
|
47
|
+
# @see SSLDomain#peer_authentication Setting peer authentication.
|
48
|
+
#
|
49
|
+
# Support for SSL client session resume is provided as well.
|
50
|
+
#
|
51
|
+
# @see SSLDomain
|
52
|
+
# @see #resume_status
|
53
|
+
#
|
54
|
+
class SSL
|
55
|
+
|
56
|
+
# Session resume state is unkonnwn or not supported.
|
57
|
+
RESUME_UNKNOWN = Cproton::PN_SSL_RESUME_UNKNOWN
|
58
|
+
# Session renegotiated and not resumed.
|
59
|
+
RESUME_NEW = Cproton::PN_SSL_RESUME_NEW
|
60
|
+
# Session resumed from the previous session.
|
61
|
+
RESUME_REUSED = Cproton::PN_SSL_RESUME_REUSED
|
62
|
+
|
63
|
+
# @private
|
64
|
+
include Util::SwigHelper
|
65
|
+
|
66
|
+
# @private
|
67
|
+
PROTON_METHOD_PREFIX = "pn_ssl"
|
68
|
+
|
69
|
+
# @private
|
70
|
+
include Util::ErrorHandler
|
71
|
+
|
72
|
+
can_raise_error :peer_hostname=, :error_class => SSLError
|
73
|
+
|
74
|
+
# Returns whether SSL is supported.
|
75
|
+
#
|
76
|
+
# @return [Boolean] True if SSL support is available.
|
77
|
+
#
|
78
|
+
def self.present?
|
79
|
+
Cproton.pn_ssl_present
|
80
|
+
end
|
81
|
+
|
82
|
+
# @private
|
83
|
+
def self.create(transport, domain, session_details = nil)
|
84
|
+
result = nil
|
85
|
+
# like python, make sure we're not creating a different SSL
|
86
|
+
# object for a transport with an existing SSL object
|
87
|
+
if transport.ssl?
|
88
|
+
transport.instance_eval { result = @ssl }
|
89
|
+
if ((!domain.nil? && (result.domain != domain)) ||
|
90
|
+
(!session_details.nil? && (result.session_details != session_details)))
|
91
|
+
raise SSLException.new("cannot re-configure existing SSL object")
|
92
|
+
end
|
93
|
+
else
|
94
|
+
impl = Cproton.pn_ssl(transport.impl)
|
95
|
+
session_id = nil
|
96
|
+
session_id = session_details.session_id unless session_details.nil?
|
97
|
+
result = SSL.new(impl, domain, session_details, session_id)
|
98
|
+
end
|
99
|
+
return result
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def initialize(impl, domain, session_details, session_id)
|
105
|
+
@impl = impl
|
106
|
+
@domain = domain.impl unless domain.nil?
|
107
|
+
@session_details = session_details
|
108
|
+
@session_id = session_id
|
109
|
+
Cproton.pn_ssl_init(@impl, @domain, @session_id)
|
110
|
+
end
|
111
|
+
|
112
|
+
public
|
113
|
+
|
114
|
+
# Returns the cipher name that is currently in used.
|
115
|
+
#
|
116
|
+
# Gets the text description of the cipher that is currently active, or
|
117
|
+
# returns nil if SSL is not active. Note that the cipher in use my change
|
118
|
+
# over time due to renegotiation or other changes to the SSL layer.
|
119
|
+
#
|
120
|
+
# @return [String, nil] The cipher name.
|
121
|
+
#
|
122
|
+
def cipher_name
|
123
|
+
rc, name = Cproton.pn_ssl_get_cipher_name(@impl, 128)
|
124
|
+
return name if rc
|
125
|
+
nil
|
126
|
+
end
|
127
|
+
|
128
|
+
# Returns the name of the SSL protocol that is currently active, or
|
129
|
+
# returns nil if SSL is nota ctive. Not that the protocol may change over
|
130
|
+
# time due to renegotation.
|
131
|
+
#
|
132
|
+
# @return [String, nil] The protocol name.
|
133
|
+
#
|
134
|
+
def protocol_name
|
135
|
+
rc, name = Cproton.pn_ssl_get_protocol_name(@impl, 128)
|
136
|
+
retur name if rc
|
137
|
+
nil
|
138
|
+
end
|
139
|
+
|
140
|
+
# Checks whether or not the state has resumed.
|
141
|
+
#
|
142
|
+
# Used for client session resume. When called on an active session, it
|
143
|
+
# indicates wehther the state has been resumed from a previous session.
|
144
|
+
#
|
145
|
+
# *NOTE:* This is a best-effort service - there is no guarantee that the
|
146
|
+
# remote server will accept the resumed parameters. The remote server may
|
147
|
+
# choose to ignore these parameters, and request a renegotation instead.
|
148
|
+
#
|
149
|
+
def resume_status
|
150
|
+
Cproton.pn_ssl_resume_status(@impl)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Gets the peer hostname.
|
154
|
+
#
|
155
|
+
# @return [String] The peer hostname.
|
156
|
+
def peer_hostname
|
157
|
+
(error, name) = Cproton.pn_ssl_get_peer_hostname(@impl, 1024)
|
158
|
+
raise SSLError.new if error < 0
|
159
|
+
return name
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
@@ -17,15 +17,16 @@
|
|
17
17
|
# under the License.
|
18
18
|
#++
|
19
19
|
|
20
|
-
module Qpid
|
20
|
+
module Qpid::Proton
|
21
21
|
|
22
|
-
|
22
|
+
# @private
|
23
|
+
class SSLSessionDetails
|
23
24
|
|
24
|
-
|
25
|
-
VERSION_MAJOR = Cproton::PN_VERSION_MAJOR
|
25
|
+
attr_reader :session_id
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
def initialize(session_id)
|
28
|
+
@session_id = session_id
|
29
|
+
end
|
29
30
|
|
30
31
|
end
|
31
32
|
|
@@ -0,0 +1,156 @@
|
|
1
|
+
#--
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Qpid::Proton
|
21
|
+
|
22
|
+
# The top-level object that stores the configuration used by one or more
|
23
|
+
# SSL sessions.
|
24
|
+
#
|
25
|
+
# @see SSL
|
26
|
+
#
|
27
|
+
class SSLDomain
|
28
|
+
|
29
|
+
# The local connection endpoint is an SSL client.
|
30
|
+
# @private
|
31
|
+
MODE_CLIENT = Cproton::PN_SSL_MODE_CLIENT
|
32
|
+
# The local connection endpoint is an SSL server.
|
33
|
+
# @private
|
34
|
+
MODE_SERVER = Cproton::PN_SSL_MODE_SERVER
|
35
|
+
|
36
|
+
# Require the peer to provide a valid identifying certificate.
|
37
|
+
VERIFY_PEER = Cproton::PN_SSL_VERIFY_PEER
|
38
|
+
# Do no require a certificate nor a cipher authorization.
|
39
|
+
ANONYMOUS_PEER = Cproton::PN_SSL_ANONYMOUS_PEER
|
40
|
+
# Require a valid certficate and matching name.
|
41
|
+
VERIFY_PEER_NAME = Cproton::PN_SSL_VERIFY_PEER_NAME
|
42
|
+
|
43
|
+
# @private
|
44
|
+
include Util::ErrorHandler
|
45
|
+
|
46
|
+
can_raise_error :credentials, :error_class => Qpid::Proton::SSLError
|
47
|
+
can_raise_error :trusted_ca_db, :error_class => Qpid::Proton::SSLError
|
48
|
+
can_raise_error :peer_authentication, :error_class => Qpid::Proton::SSLError
|
49
|
+
can_raise_error :allow_unsecured_client, :error_class => Qpid::Proton::SSLError
|
50
|
+
|
51
|
+
# @private
|
52
|
+
attr_reader :impl
|
53
|
+
|
54
|
+
# @private
|
55
|
+
def initialize(mode)
|
56
|
+
@impl = Cproton.pn_ssl_domain(mode)
|
57
|
+
raise SSLUnavailable.new if @impl.nil?
|
58
|
+
end
|
59
|
+
|
60
|
+
# Set the certificate that identifies the local node to the remote.
|
61
|
+
#
|
62
|
+
# This certificate establishes the identity for thelocal node for all SSL
|
63
|
+
# sessions created from this domain. It will be sent to the remote if the
|
64
|
+
# remote needs to verify the dientify of this node. This may be used for
|
65
|
+
# both SSL servers and SSL clients (if client authentication is required by
|
66
|
+
# the server).
|
67
|
+
#
|
68
|
+
# *NOTE:* This setting affects only those instances of SSL created *after*
|
69
|
+
# this call returns. SSL objects created before invoking this method will
|
70
|
+
# use the domain's previous settings.
|
71
|
+
#
|
72
|
+
# @param cert_file [String] The filename containing the identify
|
73
|
+
# certificate. For OpenSSL users, this is a PEM file. For Windows SChannel
|
74
|
+
# users, this is the PKCS\#12 file or system store.
|
75
|
+
# @param key_file [String] An option key to access the identifying
|
76
|
+
# certificate. For OpenSSL users, this is an optional PEM file containing
|
77
|
+
# the private key used to sign the certificate. For Windows SChannel users,
|
78
|
+
# this is the friendly name of the self-identifying certficate if there are
|
79
|
+
# multiple certfificates in the store.
|
80
|
+
# @param password [String] The password used to sign the key, or *nil* if
|
81
|
+
# the key is not protected.
|
82
|
+
#
|
83
|
+
# @raise [SSLError] If an error occurs.
|
84
|
+
#
|
85
|
+
def credentials(cert_file, key_file, password)
|
86
|
+
Cproton.pn_ssl_domain_set_credentials(@impl,
|
87
|
+
cert_file, key_file, password)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Configures the set of trusted CA certificates used by this domain to
|
91
|
+
# verify peers.
|
92
|
+
#
|
93
|
+
# If the local SSL client/server needs to verify the identify of the remote,
|
94
|
+
# it must validate the signature of the remote's certificate. This function
|
95
|
+
# sets the database of trusted CAs that will be used to verify the signature
|
96
|
+
# of the remote's certificate.
|
97
|
+
#
|
98
|
+
# *NOTE:# This setting affects only those SSL instances created *after* this
|
99
|
+
# call returns. SSL objects created before invoking this method will use the
|
100
|
+
# domain's previous setting.
|
101
|
+
#
|
102
|
+
# @param certificate_db [String] The filename for the databse of trusted
|
103
|
+
# CAs, used to authenticate the peer.
|
104
|
+
#
|
105
|
+
# @raise [SSLError] If an error occurs.
|
106
|
+
#
|
107
|
+
def trusted_ca_db(certificate_db)
|
108
|
+
Cproton.pn_ssl_domain_set_trusted_ca_db(@impl, certificate_db)
|
109
|
+
end
|
110
|
+
|
111
|
+
# Configures the level of verification used on the peer certificate.
|
112
|
+
#
|
113
|
+
# This method congtrols how the peer's certificate is validated, if at all.
|
114
|
+
# By default, neither servers nor clients attempt to verify their peers
|
115
|
+
# (*ANONYMOUS_PEER*). Once certficates and trusted CAs are configured, peer
|
116
|
+
# verification can be enabled.
|
117
|
+
#
|
118
|
+
# *NOTE:* In order to verify a peer, a trusted CA must be configured.
|
119
|
+
#
|
120
|
+
# *NOTE:* Servers must provide their own certficate when verifying a peer.
|
121
|
+
#
|
122
|
+
# *NOTE:* This setting affects only those SSL instances created after this
|
123
|
+
# call returns. SSL instances created before invoking this method will use
|
124
|
+
# the domain's previous setting.
|
125
|
+
#
|
126
|
+
# @param verify_mode [Fixnum] The level of validation to apply to the peer.
|
127
|
+
# @param trusted_CAs [String] The path to a database of trusted CAs that
|
128
|
+
# the server will advertise to the peer client if the server has been
|
129
|
+
# configured to verify its peer.
|
130
|
+
#
|
131
|
+
# @see VERIFY_PEER
|
132
|
+
# @see ANONYMOUS_PEER
|
133
|
+
# @see VERIFY_PEER_NAME
|
134
|
+
#
|
135
|
+
# @raise [SSLError] If an error occurs.
|
136
|
+
#
|
137
|
+
def peer_authentication(verify_mode, trusted_CAs = nil)
|
138
|
+
Cproton.pn_ssl_domain_set_peer_authentication(@impl,
|
139
|
+
verify_mode, trusted_CAs)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Permit a server to accept connection requests from non-SSL clients.
|
143
|
+
#
|
144
|
+
# This configures the server to "sniff" the incomfing client data stream and
|
145
|
+
# dynamically determine whether SSL/TLS is being used. This option is
|
146
|
+
# disabled by default: only clients using SSL/TLS are accepted by default.
|
147
|
+
#
|
148
|
+
# @raise [SSLError] If an error occurs.
|
149
|
+
#
|
150
|
+
def allow_unsecured_client
|
151
|
+
Cproton.pn_ssl_domain_allow_unsecured_client(@impl);
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
@@ -0,0 +1,218 @@
|
|
1
|
+
#--
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Qpid::Proton
|
21
|
+
|
22
|
+
# Represents an endpoint for an AMQP connection..
|
23
|
+
#
|
24
|
+
# An AMQP terminus acts as either a source or a target for messages,
|
25
|
+
# but never as both. Every Link is associated iwth both a source and
|
26
|
+
# a target Terminus that is negotiated during link establishment.
|
27
|
+
#
|
28
|
+
# A terminus is composed of an AMQP address along with a number of
|
29
|
+
# other properties defining the quality of service and behavior of
|
30
|
+
# the Link.
|
31
|
+
#
|
32
|
+
class Terminus
|
33
|
+
|
34
|
+
# Indicates a non-existent source or target terminus.
|
35
|
+
UNSPECIFIED = Cproton::PN_UNSPECIFIED
|
36
|
+
# Indicates a source for messages.
|
37
|
+
SOURCE = Cproton::PN_SOURCE
|
38
|
+
# Indicates a target for messages.
|
39
|
+
TARGET = Cproton::PN_TARGET
|
40
|
+
# A special target identifying a transaction coordinator.
|
41
|
+
COORDINATOR = Cproton::PN_COORDINATOR
|
42
|
+
|
43
|
+
# The terminus is orphaned when the parent link is closed.
|
44
|
+
EXPIRE_WITH_LINK = Cproton::PN_EXPIRE_WITH_LINK
|
45
|
+
# The terminus is orphaned whent he parent sessio is closed.
|
46
|
+
EXPIRE_WITH_SESSION = Cproton::PN_EXPIRE_WITH_SESSION
|
47
|
+
# The terminus is orphaned when the parent connection is closed.
|
48
|
+
EXPIRE_WITH_CONNECTION = Cproton::PN_EXPIRE_WITH_CONNECTION
|
49
|
+
# The terminus is never considered orphaned.
|
50
|
+
EXPIRE_NEVER = Cproton::PN_EXPIRE_NEVER
|
51
|
+
|
52
|
+
# Indicates a non-durable Terminus.
|
53
|
+
NONDURABLE = Cproton::PN_NONDURABLE
|
54
|
+
# Indicates a Terminus with durably held configuration, but
|
55
|
+
# not the delivery state.
|
56
|
+
CONFIGURATION = Cproton::PN_CONFIGURATION
|
57
|
+
# Indicates a Terminus with both durably held configuration and
|
58
|
+
# durably held delivery states.
|
59
|
+
DELIVERIES = Cproton::PN_DELIVERIES
|
60
|
+
|
61
|
+
# The behavior is defined by the nod.e
|
62
|
+
DIST_MODE_UNSPECIFIED = Cproton::PN_DIST_MODE_UNSPECIFIED
|
63
|
+
# The receiver gets all messages.
|
64
|
+
DIST_MODE_COPY = Cproton::PN_DIST_MODE_COPY
|
65
|
+
# The receives compete for messages.
|
66
|
+
DIST_MODE_MOVE = Cproton::PN_DIST_MODE_MOVE
|
67
|
+
|
68
|
+
# @private
|
69
|
+
include Util::SwigHelper
|
70
|
+
|
71
|
+
# @private
|
72
|
+
PROTON_METHOD_PREFIX = "pn_terminus"
|
73
|
+
|
74
|
+
# @!attribute type
|
75
|
+
#
|
76
|
+
# @return [Fixnum] The terminus type.
|
77
|
+
#
|
78
|
+
# @see SOURCE
|
79
|
+
# @see TARGET
|
80
|
+
# @see COORDINATOR
|
81
|
+
#
|
82
|
+
proton_accessor :type
|
83
|
+
|
84
|
+
# @!attribute address
|
85
|
+
#
|
86
|
+
# @return [String] The terminus address.
|
87
|
+
#
|
88
|
+
proton_accessor :address
|
89
|
+
|
90
|
+
# @!attribute durability
|
91
|
+
#
|
92
|
+
# @return [Fixnum] The durability mode of the terminus.
|
93
|
+
#
|
94
|
+
# @see NONDURABLE
|
95
|
+
# @see CONFIGURATION
|
96
|
+
# @see DELIVERIES
|
97
|
+
#
|
98
|
+
proton_accessor :durability
|
99
|
+
|
100
|
+
# @!attribute expiry_policy
|
101
|
+
#
|
102
|
+
# @return [Fixnum] The expiry policy.
|
103
|
+
#
|
104
|
+
# @see EXPIRE_WITH_LINK
|
105
|
+
# @see EXPIRE_WITH_SESSION
|
106
|
+
# @see EXPIRE_WITH_CONNECTION
|
107
|
+
# @see EXPIRE_NEVER
|
108
|
+
#
|
109
|
+
proton_accessor :expiry_policy
|
110
|
+
|
111
|
+
# @!attribute timeout
|
112
|
+
#
|
113
|
+
# @return [Fixnum] The timeout period.
|
114
|
+
#
|
115
|
+
proton_accessor :timeout
|
116
|
+
|
117
|
+
# @!attribute dynamic?
|
118
|
+
#
|
119
|
+
# @return [Boolean] True if the terminus is dynamic.
|
120
|
+
#
|
121
|
+
proton_accessor :dynamic, :is_or_get => :is
|
122
|
+
|
123
|
+
# @!attribute distribution_mode
|
124
|
+
#
|
125
|
+
# @return [Fixnum] The distribution mode.
|
126
|
+
#
|
127
|
+
# @see DIST_MODE_UNSPECIFIED
|
128
|
+
# @see DIST_MODE_COPY
|
129
|
+
# @see DIST_MODE_MOVE
|
130
|
+
#
|
131
|
+
proton_accessor :distribution_mode
|
132
|
+
|
133
|
+
# @private
|
134
|
+
include Util::ErrorHandler
|
135
|
+
|
136
|
+
can_raise_error [:type=, :address=, :durability=, :expiry_policy=,
|
137
|
+
:timeout=, :dynamic=, :distribution_mode=, :copy],
|
138
|
+
:error_class => Qpid::Proton::LinkError
|
139
|
+
|
140
|
+
# @private
|
141
|
+
attr_reader :impl
|
142
|
+
|
143
|
+
# @private
|
144
|
+
def initialize(impl)
|
145
|
+
@impl = impl
|
146
|
+
end
|
147
|
+
|
148
|
+
# Access and modify the AMQP properties data for the Terminus.
|
149
|
+
#
|
150
|
+
# This operation will return an instance of Data that is valid until the
|
151
|
+
# Terminus is freed due to its parent being freed. Any data contained in
|
152
|
+
# the object will be sent as the AMQP properties for the parent Terminus
|
153
|
+
# instance.
|
154
|
+
#
|
155
|
+
# NOTE: this MUST take the form of a symbol keyed map to be valid.
|
156
|
+
#
|
157
|
+
# @return [Data] The terminus properties.
|
158
|
+
#
|
159
|
+
def properties
|
160
|
+
Data.new(Cproton.pn_terminus_properties(@impl))
|
161
|
+
end
|
162
|
+
|
163
|
+
# Access and modify the AMQP capabilities data for the Terminus.
|
164
|
+
#
|
165
|
+
# This operation will return an instance of Data that is valid until the
|
166
|
+
# Terminus is freed due to its parent being freed. Any data contained in
|
167
|
+
# the object will be sent as the AMQP properties for the parent Terminus
|
168
|
+
# instance.
|
169
|
+
#
|
170
|
+
# NOTE: this MUST take the form of a symbol keyed map to be valid.
|
171
|
+
#
|
172
|
+
# @return [Data] The terminus capabilities.
|
173
|
+
#
|
174
|
+
def capabilities
|
175
|
+
Data.new(Cproton.pn_terminus_capabilities(@impl))
|
176
|
+
end
|
177
|
+
|
178
|
+
# Access and modify the AMQP outcomes for the Terminus.
|
179
|
+
#
|
180
|
+
# This operaiton will return an instance of Data that is valid until the
|
181
|
+
# Terminus is freed due to its parent being freed. Any data contained in
|
182
|
+
# the object will be sent as the AMQP properties for the parent Terminus
|
183
|
+
# instance.
|
184
|
+
#
|
185
|
+
# NOTE: this MUST take the form of a symbol keyed map to be valid.
|
186
|
+
#
|
187
|
+
# @return [Data] The terminus outcomes.
|
188
|
+
#
|
189
|
+
def outcomes
|
190
|
+
Data.new(Cproton.pn_terminus_outcomes(@impl))
|
191
|
+
end
|
192
|
+
|
193
|
+
# Access and modify the AMQP filter set for the Terminus.
|
194
|
+
#
|
195
|
+
# This operation will return an instance of Data that is valid until the
|
196
|
+
# Terminus is freed due to its parent being freed. Any data contained in
|
197
|
+
# the object will be sent as the AMQP properties for the parent Terminus
|
198
|
+
# instance.
|
199
|
+
#
|
200
|
+
# NOTE: this MUST take the form of a symbol keyed map to be valid.
|
201
|
+
#
|
202
|
+
# @return [Data] The terminus filter.
|
203
|
+
#
|
204
|
+
def filter
|
205
|
+
Data.new(Cproton.pn_terminus_filter(@impl))
|
206
|
+
end
|
207
|
+
|
208
|
+
# Copy another Terminus into this instance.
|
209
|
+
#
|
210
|
+
# @param source [Terminus] The source instance.
|
211
|
+
#
|
212
|
+
def copy(source)
|
213
|
+
Cproton.pn_terminus_copy(@impl,source.impl)
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|