You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2017/01/10 15:58:39 UTC
[18/55] [partial] qpid-proton-j git commit: PROTON-1385: retain
proton-j content only, the rest remains in the other repo at:
https://git-wip-us.apache.org/repos/asf/qpid-proton.git
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/delivery.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/delivery.rb b/proton-c/bindings/ruby/lib/core/delivery.rb
deleted file mode 100644
index 5c0b25c..0000000
--- a/proton-c/bindings/ruby/lib/core/delivery.rb
+++ /dev/null
@@ -1,271 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # A Delivery maintains detail on the delivery of data to an endpoint.
- #
- # A Delivery has a single parent Qpid::Proton::Link
- #
- # @example
- #
- # # SCENARIO: An event comes in notifying that data has been delivered to
- # # the local endpoint. A Delivery object can be used to check
- # # the details of the delivery.
- #
- # delivery = @event.delivery
- # if delivery.readable? && !delivery.partial?
- # # decode the incoming message
- # msg = Qpid::Proton::Message.new
- # msg.decode(link.receive(delivery.pending))
- # end
- #
- class Delivery
-
- # @private
- include Util::Wrapper
-
- # @private
- def self.wrap(impl) # :nodoc:
- return nil if impl.nil?
- self.fetch_instance(impl, :pn_delivery_attachments) || Delivery.new(impl)
- end
-
- # @private
- def initialize(impl)
- @impl = impl
- @local = Disposition.new(Cproton.pn_delivery_local(impl), true)
- @remote = Disposition.new(Cproton.pn_delivery_remote(impl), false)
- self.class.store_instance(self, :pn_delivery_attachments)
- end
-
- # @private
- include Util::SwigHelper
-
- # @private
- PROTON_METHOD_PREFIX = "pn_delivery"
-
- # @!attribute [r] tag
- #
- # @return [String] The tag for the delivery.
- #
- proton_caller :tag
-
- # @!attribute [r] writable?
- #
- # A delivery is considered writable if it is the current delivery on an
- # outgoing link, and the link has positive credit.
- #
- # @return [Boolean] Returns if a delivery is writable.
- #
- proton_caller :writable?
-
- # @!attribute [r] readable?
- #
- # A delivery is considered readable if it is the current delivery on an
- # incoming link.
- #
- # @return [Boolean] Returns if a delivery is readable.
- #
- proton_caller :readable?
- # @!attribute [r] updated?
- #
- # A delivery is considered updated whenever the peer communicates a new
- # disposition for the dlievery. Once a delivery becomes updated, it will
- # remain so until cleared.
- #
- # @return [Boolean] Returns if a delivery is updated.
- #
- # @see #clear
- #
- proton_caller :updated?
-
- # @!method clear
- #
- # Clear the updated flag for a delivery.
- #
- proton_caller :clear
-
- # @!attribute [r] pending
- #
- # @return [Fixnum] Return the amount of pending message data for the
- # delivery.
- #
- proton_caller :pending
-
- # @!attribute [r] partial?
- #
- # @return [Boolean] Returns if the delivery has only partial message data.
- #
- proton_caller :partial?
-
- # @!attribute [r] settled?
- #
- # @return [Boolean] Returns if the delivery is remotely settled.
- #
- proton_caller :settled?
-
-
- # @!method settle
- #
- # Settles a delivery.
- #
- # A settled delivery can never be used again.
- #
- proton_caller :settle
-
- # @!method dump
- #
- # Utility function for printing details of a delivery.
- #
- proton_caller :dump
-
- # @!attribute [r] buffered?
- #
- # A delivery that is buffered has not yet been written to the wire.
- #
- # Note that returning false does not imply that a delivery was definitely
- # written to the wire. If false is returned, it is not known whether the
- # delivery was actually written to the wire or not.
- #
- # @return [Boolean] Returns if the delivery is buffered.
- #
- proton_caller :buffered?
-
- include Util::Engine
-
- def update(state)
- impl = @local.impl
- object_to_data(@local.data, Cproton.pn_disposition_data(impl))
- object_to_data(@local.annotations, Cproton.pn_disposition_annotations(impl))
- object_to_data(@local.condition, Cproton.pn_disposition_condition(impl))
- Cproton.pn_delivery_update(@impl, state)
- end
-
- # Returns the local disposition state for the delivery.
- #
- # @return [Disposition] The local disposition state.
- #
- def local_state
- Cproton.pn_delivery_local_state(@impl)
- end
-
- # Returns the remote disposition state for the delivery.
- #
- # @return [Disposition] The remote disposition state.
- #
- def remote_state
- Cproton.pn_delivery_remote_state(@impl)
- end
-
- # Returns the next delivery on the connection that has pending operations.
- #
- # @return [Delivery, nil] The next delivery, or nil if there are none.
- #
- # @see Connection#work_head
- #
- def work_next
- Delivery.wrap(Cproton.pn_work_next(@impl))
- end
-
- # Returns the parent link.
- #
- # @return [Link] The parent link.
- #
- def link
- Link.wrap(Cproton.pn_delivery_link(@impl))
- end
-
- # Returns the parent session.
- #
- # @return [Session] The session.
- #
- def session
- self.link.session
- end
-
- # Returns the parent connection.
- #
- # @return [Connection] The connection.
- #
- def connection
- self.session.connection
- end
-
- # Returns the parent transport.
- #
- # @return [Transport] The transport.
- #
- def transport
- self.connection.transport
- end
-
- # @private
- def local_received?
- self.local_state == Disposition::RECEIVED
- end
-
- # @private
- def remote_received?
- self.remote_state == Disposition::RECEIVED
- end
-
- # @private
- def local_accepted?
- self.local_state == Disposition::ACCEPTED
- end
-
- # @private
- def remote_accepted?
- self.remote_state == Disposition::ACCEPTED
- end
-
- # @private
- def local_rejected?
- self.local_state == Disposition::REJECTED
- end
-
- # @private
- def remote_rejected?
- self.remote_state == Disposition::REJECTED
- end
-
- # @private
- def local_released?
- self.local_state == Disposition::RELEASED
- end
-
- # @private
- def remote_released?
- self.remote_state == Disposition::RELEASED
- end
-
- # @private
- def local_modified?
- self.local_state == Disposition::MODIFIED
- end
-
- # @private
- def remote_modified?
- self.remote_state == Disposition::MODIFIED
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/disposition.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/disposition.rb b/proton-c/bindings/ruby/lib/core/disposition.rb
deleted file mode 100644
index 20dafd7..0000000
--- a/proton-c/bindings/ruby/lib/core/disposition.rb
+++ /dev/null
@@ -1,158 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # Disposition records the current state and/or final outcome of a transfer.
- #
- # Every delivery contains both a local and a remote disposition. The local
- # disposition holds the local state of the delivery, and the remote
- # disposition holds the *last known* remote state of the delivery.
- #
- class Disposition
-
- include Util::Constants
-
- # Indicates the delivery was received.
- self.add_constant(:RECEIVED, Cproton::PN_RECEIVED)
- # Indicates the delivery was accepted.
- self.add_constant(:ACCEPTED, Cproton::PN_ACCEPTED)
- # Indicates the delivery was rejected.
- self.add_constant(:REJECTED, Cproton::PN_REJECTED)
- # Indicates the delivery was released.
- self.add_constant(:RELEASED, Cproton::PN_RELEASED)
- # Indicates the delivery was modified.
- self.add_constant(:MODIFIED, Cproton::PN_MODIFIED)
-
- # @private
- include Util::Engine
-
- attr_reader :impl
-
- # @private
- def initialize(impl, local)
- @impl = impl
- @local = local
- @data = nil
- @condition = nil
- @annotations = nil
- end
-
- # @private
- include Util::SwigHelper
-
- # @private
- PROTON_METHOD_PREFIX = "pn_disposition"
-
- # @!attribute section_number
- #
- # @return [Fixnum] The section number of the disposition.
- #
- proton_accessor :section_number
-
- # @!attribute section_offset
- #
- # @return [Fixnum] The section offset of the disposition.
- #
- proton_accessor :section_offset
-
- # @!attribute failed?
- #
- # @return [Boolean] The failed flag.
- #
- proton_accessor :failed, :is_or_get => :is
-
- # @!attribute undeliverable?
- #
- # @return [Boolean] The undeliverable flag.
- #
- proton_accessor :undeliverable, :is_or_get => :is
-
- # Sets the data for the disposition.
- #
- # @param data [Codec::Data] The data.
- #
- # @raise [AttributeError] If the disposition is remote.
- #
- def data=(data)
- raise AttributeError.new("data attribute is read-only") unless @local
- @data = data
- end
-
- # Returns the data for the disposition.
- #
- # @return [Codec::Data] The data.
- #
- def data
- if @local
- @data
- else
- data_to_object(Cproton.pn_disposition_data(@impl))
- end
- end
-
- # Sets the annotations for the disposition.
- #
- # @param annotations [Codec::Data] The annotations.
- #
- # @raise [AttributeError] If the disposition is remote.
- #
- def annotations=(annotations)
- raise AttributeError.new("annotations attribute is read-only") unless @local
- @annotations = annotations
- end
-
- # Returns the annotations for the disposition.
- #
- # @return [Codec::Data] The annotations.
- #
- def annotations
- if @local
- @annotations
- else
- data_to_object(Cproton.pn_disposition_annotations(@impl))
- end
- end
-
- # Sets the condition for the disposition.
- #
- # @param condition [Codec::Data] The condition.
- #
- # @raise [AttributeError] If the disposition is remote.
- #
- def condition=(condition)
- raise AttributeError.new("condition attribute is read-only") unless @local
- @condition = condition
- end
-
- # Returns the condition of the disposition.
- #
- # @return [Codec::Data] The condition of the disposition.
- #
- def condition
- if @local
- @condition
- else
- condition_to_object(Cproton.pn_disposition_condition(@impl))
- end
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/endpoint.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/endpoint.rb b/proton-c/bindings/ruby/lib/core/endpoint.rb
deleted file mode 100644
index f3ddbcb..0000000
--- a/proton-c/bindings/ruby/lib/core/endpoint.rb
+++ /dev/null
@@ -1,140 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # Endpoint is the parent classes for Link and Session.
- #
- # It provides a namespace for constant values that relate to the current
- # state of both links and sessions.
- #
- # @example
- #
- # conn = Qpid::Proton::Connection.new
- # puts "Local connection flags : #{conn.state || Qpid::Proton::Endpoint::LOCAL_MASK}"
- # puts "Remote connection flags: #{conn.state || Qpid::Proton::Endpoint::REMOTE_MASK}"
- #
- class Endpoint
-
- # The local connection is uninitialized.
- LOCAL_UNINIT = Cproton::PN_LOCAL_UNINIT
- # The local connection is active.
- LOCAL_ACTIVE = Cproton::PN_LOCAL_ACTIVE
- # The local connection is closed.
- LOCAL_CLOSED = Cproton::PN_LOCAL_CLOSED
-
- # The remote connection is unitialized.
- REMOTE_UNINIT = Cproton::PN_REMOTE_UNINIT
- # The remote connection is active.
- REMOTE_ACTIVE = Cproton::PN_REMOTE_ACTIVE
- # The remote connection is closed.
- REMOTE_CLOSED = Cproton::PN_REMOTE_CLOSED
-
- # Bitmask for the local-only flags.
- LOCAL_MASK = Cproton::PN_LOCAL_UNINIT |
- Cproton::PN_LOCAL_ACTIVE |
- Cproton::PN_LOCAL_CLOSED
-
- # Bitmask for the remote-only flags.
- REMOTE_MASK = Cproton::PN_REMOTE_UNINIT |
- Cproton::PN_REMOTE_ACTIVE |
- Cproton::PN_REMOTE_CLOSED
-
- # @private
- include Util::Engine
-
- # @private
- def initialize
- @condition = nil
- end
-
- # @private
- def _update_condition
- object_to_condition(@condition, self._local_condition)
- end
-
- # @private
- def remote_condition
- condition_to_object(self._remote_condition)
- end
-
- # Return the transport associated with this endpoint.
- #
- # @return [Transport] The transport.
- #
- def transport
- self.connection.transport
- end
-
- def local_uninit?
- check_state(LOCAL_UNINIT)
- end
-
- def local_active?
- check_state(LOCAL_ACTIVE)
- end
-
- def local_closed?
- check_state(LOCAL_CLOSED)
- end
-
- def remote_uninit?
- check_state(REMOTE_UNINIT)
- end
-
- def remote_active?
- check_state(REMOTE_ACTIVE)
- end
-
- def remote_closed?
- check_state(REMOTE_CLOSED)
- end
-
- def check_state(state_mask)
- !(self.state & state_mask).zero?
- end
-
- def handler
- reactor = Qpid::Proton::Reactor::Reactor.wrap(Cproton.pn_object_reactor(@impl))
- if reactor.nil?
- on_error = nil
- else
- on_error = reactor.method(:on_error)
- end
- record = self.attachments
- puts "record=#{record}"
- WrappedHandler.wrap(Cproton.pn_record_get_handler(record), on_error)
- end
-
- def handler=(handler)
- reactor = Qpid::Proton::Reactor::Reactor.wrap(Cproton.pn_object_reactor(@impl))
- if reactor.nil?
- on_error = nil
- else
- on_error = reactor.method(:on_error)
- end
- impl = chandler(handler, on_error)
- record = self.attachments
- Cproton.pn_record_set_handler(record, impl)
- Cproton.pn_decref(impl)
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/exceptions.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/exceptions.rb b/proton-c/bindings/ruby/lib/core/exceptions.rb
deleted file mode 100644
index 75d6552..0000000
--- a/proton-c/bindings/ruby/lib/core/exceptions.rb
+++ /dev/null
@@ -1,126 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid
-
- module Proton
-
- module Error
-
- NONE = 0
- EOS = Cproton::PN_EOS
- ERROR = Cproton::PN_ERR
- OVERFLOW = Cproton::PN_OVERFLOW
- UNDERFLOW = Cproton::PN_UNDERFLOW
- STATE = Cproton::PN_STATE_ERR
- ARGUMENT = Cproton::PN_ARG_ERR
- TIMEOUT = Cproton::PN_TIMEOUT
- INTERRUPTED = Cproton::PN_INTR
- INPROGRESS = Cproton::PN_INPROGRESS
-
- end
-
- # Represents a generic error at the messaging level.
- #
- class ProtonError < RuntimeError
- end
-
- # Represents an end-of-stream error while messaging.
- #
- class EOSError < ProtonError
- end
-
- # Represents a data overflow exception while messaging.
- #
- class OverflowError < ProtonError
- end
-
- # Represents a data underflow exception while messaging.
- #
- class UnderflowError < ProtonError
- end
-
- # Represents an invalid, missing or illegal argument while messaging.
- #
- class ArgumentError < ProtonError
- end
-
- # Represents that the client has got into an unexpected state during
- # messaging.
- #
- class StateError < ProtonError
- end
-
- # Represents a timeout during messaging.
- #
- class TimeoutError < ProtonError
- end
-
- # Represents an interrupting during a blocking I/O operation.
- #
- class InterruptedError < ProtonError
- end
-
- class InProgressError < ProtonError
- end
-
- # Raised by instances of Transport.
- #
- class TransportError < ProtonError
- end
-
- # Raised by instances of SASL
- #
- class SASLError < TransportError
- end
-
- # Raised by Session.
- #
- class SessionError < ProtonError
- end
-
- # Raised when an attempt is made to change an attribute that is read-only.
- #
- class AttributeError < ProtonError
- end
-
- # Raised by link components.
- #
- class LinkError < ProtonError
- end
-
- class SSLError < TransportError
- end
-
- class SSLUnavailableError < SSLError
- end
-
- # Raised when a message is rejected.
- #
- class Reject < ProtonError
- end
-
- # Raised when a message is released.
- #
- class Release < ProtonError
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/link.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/link.rb b/proton-c/bindings/ruby/lib/core/link.rb
deleted file mode 100644
index 86a307a..0000000
--- a/proton-c/bindings/ruby/lib/core/link.rb
+++ /dev/null
@@ -1,387 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # The base for both Sender and Receiver, providing common functionality
- # between both ends.
- #
- # A Link has a single parent Qpid::Proton::Session instance.
- #
- class Link < Endpoint
-
- # The sender will send all deliveries initially unsettled.
- SND_UNSETTLED = Cproton::PN_SND_UNSETTLED
- # The sender will send all deliveries settled to the receiver.
- SND_SETTLED = Cproton::PN_SND_SETTLED
- # The sender may send a mixture of settled and unsettled deliveries.
- SND_MIXED = Cproton::PN_SND_MIXED
-
- # The receiver will settle deliveries regardless of what the sender does.
- RCV_FIRST = Cproton::PN_RCV_FIRST
- # The receiver will only settle deliveries after the sender settles.
- RCV_SECOND = Cproton::PN_RCV_SECOND
-
- # @private
- include Util::SwigHelper
-
- # @private
- PROTON_METHOD_PREFIX = "pn_link"
-
- # @!attribute [r] state
- #
- # Returns the endpoint state flags.
- #
- proton_caller :state
-
- # @!method open
- #
- # Opens the link. Once this operation has completed, the state flag will be
- # set.
- #
- # @see Endpoint::LOCAL_ACTIVE
- proton_caller :open
-
- # @!method close
- #
- # Closes the link.
- #
- # Once this operation has completed, the state flag will be set.
- # This may be called without first calling #open, which is the equivalent to
- # calling #open and then #close.
- #
- # @see Endpoint::LOCAL_CLOSED
- proton_caller :close
-
- # @!method detach
- #
- # Detaches the link.
- proton_caller :detach
-
- # Advance the current delivery to the next on the link.
- #
- # For sending links, this operation is used to finish sending message data
- # for the current outgoing delivery and move on to the next outgoing
- # delivery (if any).
- #
- # For receiving links, this operatoin is used to finish accessing message
- # data from the current incoming delivery and move on to the next incoming
- # delivery (if any).
- #
- # @return [Boolean] True if the current delivery was changed.
- #
- # @see #current
- #
- proton_caller :advance
-
- proton_caller :unsettled
-
- # @!attribute [r] credit
- #
- # Returns the credit balance for a link.
- #
- # Links use a credit based flow control scheme. Every receiver maintains a
- # credit balance that corresponds to the number of deliveries that the
- # receiver can accept at any given moment.
- #
- # As more capacity becomes available at the receiver, it adds credit to this
- # balance and communicates the new balance to the sender. Whenever a
- # delivery is sent/received, the credit balance maintained by the link is
- # decremented by one.
- #
- # Once the credit balance at the sender reaches zero, the sender must pause
- # sending until more credit is obtained from the receiver.
- #
- # NOte that a sending link may still be used to send deliveries eve if
- # credit reaches zero. However those deliveries will end up being buffer by
- # the link until enough credit is obtained from the receiver to send them
- # over the wire. In this case the balance reported will go negative.
- #
- # @return [Fixnum] The credit balance.
- #
- # @see #flow
- #
- proton_caller :credit
-
- # @!attribute [r] remote_credit
- #
- # Returns the remote view of the credit.
- #
- # The remote view of the credit for a link differs from the local view of
- # credit for a link by the number of queued deliveries. In other words,
- # remote credit is defined as credit - queued.
- #
- # @see #queued
- # @see #credit
- #
- # @return [Fixnum] The remove view of the credit.
- #
- proton_caller :remote_credit
-
- # @!attribute [r] available
- #
- # Returns the available deliveries hint for a link.
- #
- # The available count for a link provides a hint as to the number of
- # deliveries that might be able to be sent if sufficient credit were issued
- # by the receiving link endpoint.
- #
- # @return [Fixnum] The available deliveries hint.
- #
- # @see Sender#offered
- #
- proton_caller :available
-
- # @!attribute [r] queued
- #
- # Returns the number of queued deliveries for a link.
- #
- # Links may queue deliveries for a number of reasons. For example, there may
- # be insufficient credit to send them to the receiver, or they simply may
- # not have yet had a chance to be written to the wire.
- #
- # @return [Fixnum] The number of queued deliveries.
- #
- # @see #credit
- #
- proton_caller :queued
-
- # @!attribute [r] name
- #
- # Returns the name of the link.
- #
- # @return [String] The name.
- #
- proton_caller :name
-
- # @!attribute [r] sender?
- #
- # Returns if the link is a sender.
- #
- # @return [Boolean] True if the link is a sender.
- #
- proton_reader :sender, :is_or_get => :is
-
- # @!attribute [r] receiver?
- #
- # Returns if the link is a receiver.
- #
- # @return [Boolean] True if the link is a receiver.
- #
- proton_reader :receiver, :is_or_get => :is
-
- # @private
- proton_reader :attachments
-
- # Drains excess credit.
- #
- # When a link is in drain mode, the sender must use all excess credit
- # immediately and release any excess credit back to the receiver if there
- # are no deliveries available to send.
- #
- # When invoked on a Sender that is in drain mode, this operation will
- # release all excess credit back to the receiver and return the number of
- # credits released back to the sender. If the link is not in drain mode,
- # this operation is a noop.
- #
- # When invoked on a Receiver, this operation will return and reset the
- # number of credits the sender has released back to it.
- #
- # @return [Fixnum] The number of credits drained.
- #
- proton_caller :drained
-
- # @private
- include Util::Wrapper
-
- # @private
- def self.wrap(impl)
- return nil if impl.nil?
-
- result = self.fetch_instance(impl, :pn_link_attachments)
- return result unless result.nil?
- if Cproton.pn_link_is_sender(impl)
- return Sender.new(impl)
- elsif Cproton.pn_link_is_receiver(impl)
- return Receiver.new(impl)
- end
- end
-
- # @private
- def initialize(impl)
- @impl = impl
- self.class.store_instance(self, :pn_link_attachments)
- end
-
- # Returns additional error information.
- #
- # Whenever a link operation fails (i.e., returns an error code) additional
- # error details can be obtained from this method. Ther error object that is
- # returned may also be used to clear the error condition.
- #
- # @return [Error] The error.
- #
- def error
- Cproton.pn_link_error(@impl)
- end
-
- # Returns the next link that matches the given state mask.
- #
- # @param state_mask [Fixnum] The state mask.
- #
- # @return [Sender, Receiver] The next link.
- #
- def next(state_mask)
- return Link.wrap(Cproton.pn_link_next(@impl, state_mask))
- end
-
- # Returns the locally defined source terminus.
- #
- # @return [Terminus] The terminus
- def source
- Terminus.new(Cproton.pn_link_source(@impl))
- end
-
- # Returns the locally defined target terminus.
- #
- # @return [Terminus] The terminus.
- #
- def target
- Terminus.new(Cproton.pn_link_target(@impl))
- end
-
- # Returns a representation of the remotely defined source terminus.
- #
- # @return [Terminus] The terminus.
- #
- def remote_source
- Terminus.new(Cproton.pn_link_remote_source(@impl))
- end
-
- # Returns a representation of the remotely defined target terminus.
- #
- # @return [Terminus] The terminus.
- #
- def remote_target
- Terminus.new(Cproton.pn_link_remote_target(@impl))
- end
-
- # Returns the parent session.
- #
- # @return [Session] The session.
- #
- def session
- Session.wrap(Cproton.pn_link_session(@impl))
- end
-
- # Returns the parent connection.
- #
- # @return [Connection] The connection.
- #
- def connection
- self.session.connection
- end
-
- # Returns the parent delivery.
- #
- # @return [Delivery] The delivery.
- #
- def delivery(tag)
- Delivery.new(Cproton.pn_delivery(@impl, tag))
- end
-
- # Returns the current delivery.
- #
- # Each link maintains a sequence of deliveries in the order they were
- # created, along with a reference to the *current* delivery. All send and
- # receive operations on a link take place on the *current* delivery. If a
- # link has no current delivery, the current delivery is automatically
- # pointed to the *next* delivery created on the link.
- #
- # Once initialized, the current delivery remains the same until it is
- # changed by advancing, or until it is settled.
- #
- # @see #next
- # @see Delivery#settle
- #
- # @return [Delivery] The current delivery.
- #
- def current
- Delivery.wrap(Cproton.pn_link_current(@impl))
- end
-
- # Sets the local sender settle mode.
- #
- # @param mode [Fixnum] The settle mode.
- #
- # @see #SND_UNSETTLED
- # @see #SND_SETTLED
- # @see #SND_MIXED
- #
- def snd_settle_mode=(mode)
- Cproton.pn_link_set_snd_settle_mode(@impl, mode)
- end
-
- # Returns the local sender settle mode.
- #
- # @return [Fixnum] The local sender settle mode.
- #
- # @see #snd_settle_mode
- #
- def snd_settle_mode
- Cproton.pn_link_snd_settle_mode(@impl)
- end
-
- # Sets the local receiver settle mode.
- #
- # @param mode [Fixnum] The settle mode.
- #
- # @see #RCV_FIRST
- # @see #RCV_SECOND
- #
- def rcv_settle_mode=(mode)
- Cproton.pn_link_set_rcv_settle_mode(@impl, mode)
- end
-
- # Returns the local receiver settle mode.
- #
- # @return [Fixnum] The local receiver settle mode.
- #
- def rcv_settle_mode
- Cproton.pn_link_rcv_settle_mode(@impl)
- end
-
- # @private
- def _local_condition
- Cproton.pn_link_condition(@impl)
- end
-
- # @private
- def _remote_condition
- Cproton.pn_link_remote_condition(@impl)
- end
-
- def ==(other)
- other.respond_to?(:impl) &&
- (Cproton.pni_address_of(other.impl) == Cproton.pni_address_of(@impl))
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/message.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/message.rb b/proton-c/bindings/ruby/lib/core/message.rb
deleted file mode 100644
index 53e7092..0000000
--- a/proton-c/bindings/ruby/lib/core/message.rb
+++ /dev/null
@@ -1,633 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # A Message represents an addressable quantity of data.
- #
- # ==== Message Body
- #
- # The message body can be set using the #body= method. The message will
- # then attempt to determine how exactly to encode the content.
- #
- # ==== Examples
- #
- # To create a message for sending:
- #
- # # send a simple text message
- # msg = Qpid::Proton::Message.new
- # msg.body = "STATE: update"
- #
- # # send a binary chunk of data
- # data = File.binread("/home/qpid/binfile.tar.gz")
- # msg = Qpid::Proton::Message.new
- # msg.body = Qpid::Proton::BinaryString.new(data)
- #
- class Message
-
- # @private
- def proton_send(sender, tag = nil)
- dlv = sender.delivery(tag || sender.delivery_tag)
- encoded = self.encode
- sender.stream(encoded)
- sender.advance
- dlv.settle if sender.snd_settle_mode == Link::SND_SETTLED
- return dlv
- end
-
- # Decodes a message from supplied AMQP data and returns the number
- # of bytes consumed.
- #
- # ==== Options
- #
- # * encoded - the encoded data
- #
- def decode(encoded)
- check(Cproton.pn_message_decode(@impl, encoded, encoded.length))
-
- post_decode
- end
-
- def post_decode # :nodoc:
- # decode elements from the message
- @properties = {}
- props = Codec::Data.new(Cproton::pn_message_properties(@impl))
- if props.next
- @properties = props.type.get(props)
- end
- @instructions = nil
- insts = Codec::Data.new(Cproton::pn_message_instructions(@impl))
- if insts.next
- @instructions = insts.type.get(insts)
- end
- @annotations = nil
- annts = Codec::Data.new(Cproton::pn_message_annotations(@impl))
- if annts.next
- @annotations = annts.type.get(annts)
- end
- @body = nil
- body = Codec::Data.new(Cproton::pn_message_body(@impl))
- if body.next
- @body = body.type.get(body)
- end
- end
-
- # Encodes the message.
- def encode
- pre_encode
- size = 16
- loop do
- error, data = Cproton::pn_message_encode(@impl, size)
- if error == Qpid::Proton::Error::OVERFLOW
- size *= 2
- else
- check(error)
- return data
- end
- end
- end
-
- def pre_encode # :nodoc:
- # encode elements from the message
- props = Codec::Data.new(Cproton::pn_message_properties(@impl))
- props.clear
- Codec::Mapping.for_class(@properties.class).put(props, @properties) unless @properties.empty?
- insts = Codec::Data.new(Cproton::pn_message_instructions(@impl))
- insts.clear
- if !@instructions.nil?
- mapping = Codec::Mapping.for_class(@instructions.class)
- mapping.put(insts, @instructions)
- end
- annts = Codec::Data.new(Cproton::pn_message_annotations(@impl))
- annts.clear
- if !@annotations.nil?
- mapping = Codec::Mapping.for_class(@annotations.class)
- mapping.put(annts, @annotations, :keys => :SYMBOL)
- end
- body = Codec::Data.new(Cproton::pn_message_body(@impl))
- body.clear
- if !@body.nil?
- mapping = Codec::Mapping.for_class(@body.class)
- mapping.put(body, @body)
- end
- end
-
- # Creates a new +Message+ instance.
- def initialize
- @impl = Cproton.pn_message
- ObjectSpace.define_finalizer(self, self.class.finalize!(@impl))
- @properties = {}
- @instructions = {}
- @annotations = {}
- @body = nil
- end
-
- def to_s
- tmp = Cproton.pn_string("")
- Cproton.pn_inspect(@impl, tmp)
- result = Cproton.pn_string_get(tmp)
- Cproton.pn_free(tmp)
- return result
- end
-
- # Invoked by garbage collection to clean up resources used
- # by the underlying message implementation.
- def self.finalize!(impl) # :nodoc:
- proc {
- Cproton.pn_message_free(impl)
- }
- end
-
- # Returns the underlying message implementation.
- def impl # :nodoc:
- @impl
- end
-
- # Clears the state of the +Message+. This allows a single instance of
- # +Message+ to be reused.
- #
- def clear
- Cproton.pn_message_clear(@impl)
- @properties.clear unless @properties.nil?
- @instructions.clear unless @instructions.nil?
- @annotations.clear unless @annotations.nil?
- @body = nil
- end
-
- # Returns the most recent error number.
- #
- def errno
- Cproton.pn_message_errno(@impl)
- end
-
- # Returns the most recent error message.
- #
- def error
- Cproton.pn_error_text(Cproton.pn_message_error(@impl))
- end
-
- # Returns whether there is currently an error reported.
- #
- def error?
- !Cproton.pn_message_errno(@impl).zero?
- end
-
- # Sets the durable flag.
- #
- # See ::durable for more details on message durability.
- #
- # ==== Options
- #
- # * state - the durable state
- #
- def durable=(state)
- raise TypeError.new("state cannot be nil") if state.nil?
- Cproton.pn_message_set_durable(@impl, state)
- end
-
- # Returns the durable property.
- #
- # The durable property indicates that the emessage should be held durably
- # by any intermediaries taking responsibility for the message.
- #
- # ==== Examples
- #
- # msg = Qpid::Proton::Message.new
- # msg.durable = true
- #
- def durable
- Cproton.pn_message_is_durable(@impl)
- end
-
- # Sets the priority.
- #
- # +NOTE:+ Priority values are limited to the range [0,255].
- #
- # ==== Options
- #
- # * priority - the priority value
- #
- def priority=(priority)
- raise TypeError.new("invalid priority: #{priority}") if priority.nil? || !([Float, Fixnum].include?(priority.class))
- raise RangeError.new("priority out of range: #{priority}") if ((priority > 255) || (priority < 0))
- Cproton.pn_message_set_priority(@impl, priority.floor)
- end
-
- # Returns the priority.
- #
- def priority
- Cproton.pn_message_get_priority(@impl)
- end
-
- # Sets the time-to-live for the message.
- #
- # ==== Options
- #
- # * time - the time in milliseconds
- #
- def ttl=(time)
- raise TypeError.new("invalid ttl: #{time}") if time.nil? || !([Float, Fixnum].include?(time.class))
- raise RangeError.new("time out of range: #{time}") if ((time < 0))
- Cproton.pn_message_set_ttl(@impl, time.floor)
- end
-
- # Returns the time-to-live, in milliseconds.
- #
- def ttl
- Cproton.pn_message_get_ttl(@impl)
- end
-
- # Sets whether this is the first time the message was acquired.
- #
- # See ::first_acquirer? for more details.
- #
- # ==== Options
- #
- # * state - true if claiming the message
- #
- def first_acquirer=(state)
- raise TypeError.new("invalid state: #{state}") if state.nil? || !([TrueClass, FalseClass].include?(state.class))
- Cproton.pn_message_set_first_acquirer(@impl, state)
- end
-
- # Sets the delivery count for the message.
- #
- # See ::delivery_count for more details.
- #
- # ==== Options
- #
- # * count - the delivery count
- #
- def delivery_count=(count)
- raise ::ArgumentError.new("invalid count: #{count}") if count.nil? || !([Float, Fixnum].include?(count.class))
- raise RangeError.new("count out of range: #{count}") if count < 0
-
- Cproton.pn_message_set_delivery_count(@impl, count.floor)
- end
-
- # Returns the delivery count for the message.
- #
- # This is the number of delivery attempts for the given message.
- #
- def delivery_count
- Cproton.pn_message_get_delivery_count(@impl)
- end
-
- # Returns whether this is the first acquirer.
- #
- #
- def first_acquirer?
- Cproton.pn_message_is_first_acquirer(@impl)
- end
-
- # Sets the message id.
- #
- # ==== Options
- #
- # * id = the id
- #
- def id=(id)
- Cproton.pn_message_set_id(@impl, id)
- end
-
- # Returns the message id.
- #
- def id
- Cproton.pn_message_get_id(@impl)
- end
-
- # Sets the user id.
- #
- # ==== Options
- #
- # * id - the user id
- #
- def user_id=(id)
- Cproton.pn_message_set_user_id(@impl, id)
- end
-
- # Returns the user id.
- #
- def user_id
- Cproton.pn_message_get_user_id(@impl)
- end
-
- # Sets the destination address.
- #
- # ==== Options
- #
- # * address - the address
- #
- def address=(address)
- Cproton.pn_message_set_address(@impl, address)
- end
-
- # Returns the destination address.
- #
- def address
- Cproton.pn_message_get_address(@impl)
- end
-
- # Sets the subject.
- #
- # ==== Options
- #
- # * subject - the subject
- #
- def subject=(subject)
- Cproton.pn_message_set_subject(@impl, subject)
- end
-
- # Returns the subject
- #
- def subject
- Cproton.pn_message_get_subject(@impl)
- end
-
- # Sets the reply-to address.
- #
- # ==== Options
- #
- # * address - the reply-to address
- #
- def reply_to=(address)
- Cproton.pn_message_set_reply_to(@impl, address)
- end
-
- # Returns the reply-to address
- #
- def reply_to
- Cproton.pn_message_get_reply_to(@impl)
- end
-
- # Sets the correlation id.
- #
- # ==== Options
- #
- # * id - the correlation id
- #
- def correlation_id=(id)
- Cproton.pn_message_set_correlation_id(@impl, id)
- end
-
- # Returns the correlation id.
- #
- def correlation_id
- Cproton.pn_message_get_correlation_id(@impl)
- end
-
- # Sets the content type.
- #
- # ==== Options
- #
- # * content_type - the content type
- #
- def content_type=(content_type)
- Cproton.pn_message_set_content_type(@impl, content_type)
- end
-
- # Returns the content type
- #
- def content_type
- Cproton.pn_message_get_content_type(@impl)
- end
-
- # Sets the message content.
- #
- # *WARNING:* This method has been deprecated. Please use #body= instead to
- # set the content of a message.
- #
- # ==== Options
- #
- # * content - the content
- #
- def content=(content)
- Cproton.pn_message_load(@impl, content)
- end
-
- # Returns the message content.
- #
- # *WARNING:* This method has been deprecated. Please use #body instead to
- # retrieve the content of a message.
- #
- def content
- size = 16
- loop do
- result = Cproton.pn_message_save(@impl, size)
- error = result[0]
- data = result[1]
- if error == Qpid::Proton::Error::OVERFLOW
- size = size * 2
- else
- check(error)
- return data
- end
- end
- end
-
- # Sets the content encoding type.
- #
- # ==== Options
- #
- # * encoding - the content encoding
- #
- def content_encoding=(encoding)
- Cproton.pn_message_set_content_encoding(@impl, encoding)
- end
-
- # Returns the content encoding type.
- #
- def content_encoding
- Cproton.pn_message_get_content_encoding(@impl)
- end
-
- # Sets the expiration time.
- #
- # ==== Options
- #
- # * time - the expiry time
- #
- def expires=(time)
- raise TypeError.new("invalid expiry time: #{time}") if time.nil?
- raise ::ArgumentError.new("expiry time cannot be negative: #{time}") if time < 0
- Cproton.pn_message_set_expiry_time(@impl, time)
- end
-
- # Returns the expiration time.
- #
- def expires
- Cproton.pn_message_get_expiry_time(@impl)
- end
-
- # Sets the creation time.
- #
- # ==== Options
- #
- # * time - the creation time
- #
- def creation_time=(time)
- raise TypeError.new("invalid time: #{time}") if time.nil?
- raise ::ArgumentError.new("time cannot be negative") if time < 0
- Cproton.pn_message_set_creation_time(@impl, time)
- end
-
- # Returns the creation time.
- #
- def creation_time
- Cproton.pn_message_get_creation_time(@impl)
- end
-
- # Sets the group id.
- #
- # ==== Options
- #
- # * id - the group id
- #
- def group_id=(id)
- Cproton.pn_message_set_group_id(@impl, id)
- end
-
- # Returns the group id.
- #
- def group_id
- Cproton.pn_message_get_group_id(@impl)
- end
-
- # Sets the group sequence number.
- #
- # ==== Options
- #
- # * seq - the sequence number
- #
- def group_sequence=(seq)
- raise TypeError.new("invalid seq: #{seq}") if seq.nil?
- Cproton.pn_message_set_group_sequence(@impl, seq)
- end
-
- # Returns the group sequence number.
- #
- def group_sequence
- Cproton.pn_message_get_group_sequence(@impl)
- end
-
- # Sets the reply-to group id.
- #
- # ==== Options
- #
- # * id - the id
- #
- def reply_to_group_id=(id)
- Cproton.pn_message_set_reply_to_group_id(@impl, id)
- end
-
- # Returns the reply-to group id.
- #
- def reply_to_group_id
- Cproton.pn_message_get_reply_to_group_id(@impl)
- end
-
- # Returns the list of property names for associated with this message.
- #
- # ==== Examples
- #
- # msg.properties.each do |name|
- # end
- #
- def properties
- @properties
- end
-
- # Replaces the entire set of properties with the specified hash.
- #
- def properties=(properties)
- @properties = properties
- end
-
- # Assigns the value given to the named property.
- #
- # ==== Arguments
- #
- # * name - the property name
- # * value - the property value
- #
- def []=(name, value)
- @properties[name] = value
- end
-
- # Retrieves the value for the specified property name. If not found, then
- # it returns nil.
- #
- def [](name)
- @properties[name]
- end
-
- # Deletes the named property.
- #
- def delete_property(name)
- @properties.delete(name)
- end
-
- # Returns the instructions for this message.
- #
- def instructions
- @instructions
- end
-
- # Assigns instructions to this message.
- #
- def instructions=(instr)
- @instructions = instr
- end
-
- # Returns the annotations for this message.
- #
- def annotations
- @annotations
- end
-
- # Assigns annotations to this message.
- #
- def annotations=(annotations)
- @annotations = annotations
- end
-
- # Returns the body property of the message.
- #
- def body
- @body
- end
-
- # Assigns a new value to the body of the message.
- #
- def body=(body)
- @body = body
- end
-
- private
-
- def check(err) # :nodoc:
- if err < 0
- raise DataError, "[#{err}]: #{Cproton.pn_message_error(@data)}"
- else
- return err
- end
- end
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/receiver.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/receiver.rb b/proton-c/bindings/ruby/lib/core/receiver.rb
deleted file mode 100644
index ca7c5e1..0000000
--- a/proton-c/bindings/ruby/lib/core/receiver.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # The receiving endpoint.
- #
- # @see Sender
- #
- class Receiver < Link
-
- # @private
- include Util::SwigHelper
-
- # @private
- PROTON_METHOD_PREFIX = "pn_link"
-
- # @!attribute drain
- #
- # The drain mode.
- #
- # If a receiver is in drain mode, then the sending endpoint of a link must
- # immediately use up all available credit on the link. If this is not
- # possible, the excess credit must be returned by invoking #drained.
- #
- # Only the receiving endpoint can set the drain mode.
- #
- # @return [Boolean] True if drain mode is set.
- #
- proton_accessor :drain
-
- # @!attribute [r] draining?
- #
- # Returns if a link is currently draining.
- #
- # A link is defined to be draining when drain mode is set to true and
- # the sender still has excess credit.
- #
- # @return [Boolean] True if the receiver is currently draining.
- #
- proton_caller :draining?
-
- # Grants credit for incoming deliveries.
- #
- # @param n [Fixnum] The amount to increment the link credit.
- #
- def flow(n)
- Cproton.pn_link_flow(@impl, n)
- end
-
- # Allows receiving up to the specified limit of data from the remote
- # endpoint.
- #
- # Note that large messages can be streamed across the network, so just
- # because there is no data to read does not imply the message is complete.
- #
- # To ensure the entirety of the message data has been read, either call
- # #receive until nil is returned, or verify that #partial? is false and
- # Delivery#pending is 0.
- #
- # @param limit [Fixnum] The maximum bytes to receive.
- #
- # @return [Fixnum, nil] The number of bytes received, or nil if the end of
- # the stream was reached.t
- #
- # @see Deliver#pending To see how much buffer space is needed.
- #
- # @raise [LinkError] If an error occurs.
- #
- def receive(limit)
- (n, bytes) = Cproton.pn_link_recv(@impl, limit)
- return nil if n == Qpid::Proton::Error::EOS
- raise LinkError.new("[#{n}]: #{Cproton.pn_link_error(@impl)}") if n < 0
- return bytes
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/sasl.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/sasl.rb b/proton-c/bindings/ruby/lib/core/sasl.rb
deleted file mode 100644
index 7870652..0000000
--- a/proton-c/bindings/ruby/lib/core/sasl.rb
+++ /dev/null
@@ -1,94 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # The SASL layer is responsible for establishing an authenticated and/or
- # encrypted tunnel over which AMQP frames are passed between peers.
- #
- # The peer acting as the SASL client must provide authentication
- # credentials.
- #
- # The peer acting as the SASL server must provide authentication against the
- # received credentials.
- #
- # @example
- # # SCENARIO: the remote endpoint has not initialized their connection
- # # then the local endpoint, acting as a SASL server, decides
- # # to allow an anonymous connection.
- # #
- # # The SASL layer locally assumes the role of server and then
- # # enables anonymous authentication for the remote endpoint.
- # #
- # sasl = @transport.sasl
- # sasl.server
- # sasl.mechanisms("ANONYMOUS")
- # sasl.done(Qpid::Proton::SASL::OK)
- #
- class SASL
-
- # Negotation has not completed.
- NONE = Cproton::PN_SASL_NONE
- # Authentication succeeded.
- OK = Cproton::PN_SASL_OK
- # Authentication failed due to bad credentials.
- AUTH = Cproton::PN_SASL_AUTH
-
- # Constructs a new instance for the given transport.
- #
- # @param transport [Transport] The transport.
- #
- # @private A SASL should be fetched only from its Transport
- #
- def initialize(transport)
- @impl = Cproton.pn_sasl(transport.impl)
- end
-
- # Sets the acceptable SASL mechanisms.
- #
- # @param mechanisms [String] The space-delimited set of mechanisms.
- #
- # @example Use anonymous SASL authentication.
- # @sasl.mechanisms("GSSAPI CRAM-MD5 PLAIN")
- #
- def mechanisms(mechanisms)
- Cproton.pn_sasl_mechanisms(@impl, mechanisms)
- end
-
- # Returns the outcome of the SASL negotiation.
- #
- # @return [Fixnum] The outcome.
- #
- def outcome
- outcome = Cprotn.pn_sasl_outcome(@impl)
- return nil if outcome == NONE
- outcome
- end
-
- # Set the condition of the SASL negotiation.
- #
- # @param outcome [Fixnum] The outcome.
- #
- def done(outcome)
- Cproton.pn_sasl_done(@impl, outcome)
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/selectable.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/selectable.rb b/proton-c/bindings/ruby/lib/core/selectable.rb
deleted file mode 100644
index 0ae2efe..0000000
--- a/proton-c/bindings/ruby/lib/core/selectable.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # Selectable enables accessing the underlying file descriptors
- # for Messenger.
- #
- # @private
- class Selectable
-
- # @private
- include Util::SwigHelper
-
- # @private
- PROTON_METHOD_PREFIX = "pn_selectable"
-
- # Returns the underlying file descriptor.
- #
- # This can be used in conjunction with the IO class.
- #
- def fileno
- Cproton.pn_selectable_get_fd(@impl)
- end
-
- proton_reader :reading, :is_or_get => :is
-
- proton_reader :writing, :is_or_get => :is
-
- proton_caller :readable
-
- proton_caller :writable
-
- proton_caller :expired
-
- proton_accessor :registered, :is_or_get => :is
-
- proton_accessor :terminal, :is_or_get => :is
-
- proton_caller :terminate
-
- proton_caller :release
-
- # @private
- def self.wrap(impl)
- return nil if impl.nil?
-
- self.fetch_instance(impl, :pn_selectable_attachments) || Selectable.new(impl)
- end
-
- # @private
- include Util::Wrapper
-
- # @private
- def initialize(impl)
- @impl = impl
- self.class.store_instance(self, :pn_selectable_attachments)
- end
-
- private
-
- DEFAULT = Object.new
-
- public
-
- def fileno(fd = DEFAULT)
- if fd == DEFAULT
- Cproton.pn_selectable_get_fd(@impl)
- elsif fd.nil?
- Cproton.pn_selectable_set_fd(@impl, Cproton::PN_INVALID_SOCKET)
- else
- Cproton.pn_selectable_set_fd(@impl, fd)
- end
- end
-
- def reading=(reading)
- if reading.nil?
- reading = false
- elsif reading == "0"
- reading = false
- else
- reading = true
- end
- Cproton.pn_selectable_set_reading(@impl, reading ? true : false)
- end
-
- def writing=(writing)
- if writing.nil?
- writing = false
- elsif writing == "0"
- writing = false
- else
- writing = true
- end
- Cproton.pn_selectable_set_writing(@impl, writing ? true : false)
- end
-
- def deadline
- tstamp = Cproton.pn_selectable_get_deadline(@impl)
- return nil if tstamp.nil?
- mills_to_sec(tstamp)
- end
-
- def deadline=(deadline)
- Cproton.pn_selectable_set_deadline(sec_to_millis(deadline))
- end
-
- def to_io
- @io ||= IO.new(fileno)
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/sender.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/sender.rb b/proton-c/bindings/ruby/lib/core/sender.rb
deleted file mode 100644
index 9ddcaa0..0000000
--- a/proton-c/bindings/ruby/lib/core/sender.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # The sending endpoint.
- #
- # @see Receiver
- #
- class Sender < Link
-
- # @private
- include Util::ErrorHandler
-
- # @private
- can_raise_error :stream, :error_class => Qpid::Proton::LinkError
-
- # Signals the availability of deliveries.
- #
- # @param n [Fixnum] The number of deliveries potentially available.
- #
- def offered(n)
- Cproton.pn_link_offered(@impl, n)
- end
-
- # Sends the specified data to the remote endpoint.
- #
- # @param object [Object] The content to send.
- # @param tag [Object] The tag
- #
- # @return [Fixnum] The number of bytes sent.
- #
- def send(object, tag = nil)
- if object.respond_to? :proton_send
- object.proton_send(self, tag)
- else
- stream(object)
- end
- end
-
- # Send the specified bytes as part of the current delivery.
- #
- # @param bytes [Array] The bytes to send.
- #
- # @return n [Fixnum] The number of bytes sent.
- #
- def stream(bytes)
- Cproton.pn_link_send(@impl, bytes)
- end
-
- def delivery_tag
- @tag_count ||= 0
- result = @tag_count.succ
- @tag_count = result
- return "#{result}"
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/session.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/session.rb b/proton-c/bindings/ruby/lib/core/session.rb
deleted file mode 100644
index 2c9c3a1..0000000
--- a/proton-c/bindings/ruby/lib/core/session.rb
+++ /dev/null
@@ -1,163 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # A session is the parent for senders and receivers.
- #
- # A Session has a single parent Qpid::Proton::Connection instance.
- #
- class Session < Endpoint
-
- # @private
- include Util::Wrapper
-
- # @private
- include Util::SwigHelper
-
- # @private
- PROTON_METHOD_PREFIX = "pn_session"
-
- # @!attribute incoming_capacity
- #
- # The incoming capacity of a session determines how much incoming message
- # data the session will buffer. Note that if this value is less than the
- # negotatied frame size of the transport, it will be rounded up to one full
- # frame.
- #
- # @return [Fixnum] The incoing capacity of the session, measured in bytes.
- #
- proton_accessor :incoming_capacity
-
- # @private
- proton_reader :attachments
-
- # @!attribute [r] outgoing_bytes
- #
- # @return [Fixnum] The number of outgoing bytes currently being buffered.
- #
- proton_caller :outgoing_bytes
-
- # @!attribute [r] incoming_bytes
- #
- # @return [Fixnum] The number of incomign bytes currently being buffered.
- #
- proton_caller :incoming_bytes
-
- # @!method open
- # Opens the session.
- #
- # Once this operaton has completed, the state flag is updated.
- #
- # @see LOCAL_ACTIVE
- #
- proton_caller :open
-
- # @!attribute [r] state
- #
- # @return [Fixnum] The endpoint state.
- #
- proton_caller :state
-
- # @private
- def self.wrap(impl)
- return nil if impl.nil?
- self.fetch_instance(impl, :pn_session_attachments) || Session.new(impl)
- end
-
- # @private
- def initialize(impl)
- @impl = impl
- self.class.store_instance(self, :pn_session_attachments)
- end
-
- # Closed the session.
- #
- # Once this operation has completed, the state flag will be set. This may be
- # called without calling #open, in which case it is the equivalence of
- # calling #open and then close immediately.
- #
- def close
- self._update_condition
- Cproton.pn_session_close(@impl)
- end
-
- # Retrieves the next session from a given connection that matches the
- # specified state mask.
- #
- # When uses with Connection#session_head an application can access all of
- # the session son the connection that match the given state.
- #
- # @param state_mask [Fixnum] The state mask to match.
- #
- # @return [Session, nil] The next session if one matches, or nil.
- #
- def next(state_mask)
- Session.wrap(Cproton.pn_session_next(@impl, state_mask))
- end
-
- # Returns the parent connection.
- #
- # @return [Connection] The connection.
- #
- def connection
- Connection.wrap(Cproton.pn_session_connection(@impl))
- end
-
- # Constructs a new sender.
- #
- # Each sender between two AMQP containers must be uniquely named. Note that
- # this uniqueness cannot be enforced at the library level, so some
- # consideration should be taken in choosing link names.
- #
- # @param name [String] The link name.
- #
- # @return [Sender, nil] The sender, or nil if an error occurred.
- #
- def sender(name)
- Sender.new(Cproton.pn_sender(@impl, name))
- end
-
- # Constructs a new receiver.
- #
- # Each receiver between two AMQP containers must be uniquely named. Note
- # that this uniqueness cannot be enforced at the library level, so some
- # consideration should be taken in choosing link names.
- #
- # @param name [String] The link name.
- #
- # @return [Receiver, nil] The receiver, or nil if an error occurred.
- #
- def receiver(name)
- Receiver.new(Cproton.pn_receiver(@impl, name))
- end
-
- # @private
- def _local_condition
- Cproton.pn_session_condition(@impl)
- end
-
- # @private
- def _remote_condition # :nodoc:
- Cproton.pn_session_remote_condition(@impl)
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/ssl.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/ssl.rb b/proton-c/bindings/ruby/lib/core/ssl.rb
deleted file mode 100644
index 0b16075..0000000
--- a/proton-c/bindings/ruby/lib/core/ssl.rb
+++ /dev/null
@@ -1,164 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # The SSL support for Transport.
- #
- # A Transport may be configured ot use SLL for encryption and/or
- # authentication. A Transport can be configured as either the SSL
- # client or the server. An SSL client is the party that proctively
- # establishes a connection to an SSL server. An SSL server is the
- # party that accepts a connection request from the remote SSL client.
- #
- # If either the client or the server needs to identify itself with the
- # remote node, it must have its SSL certificate configured.
- #
- # @see SSLDomain#credentials For setting the SSL certificate.
- #
- # If either the client or the server needs to verify the identify of the
- # remote node, it must have its database of trusted CAs configured.
- #
- # @see SSLDomain#trusted_ca_db Setting the CA database.
- #
- # An SSL server connection may allow the remote client to connect without
- # SS (i.e., "in the clear").
- #
- # @see SSLDomain#allow_unsecured_client Allowing unsecured clients.
- #
- # The level of verification required of the remote may be configured.
- #
- # @see SSLDomain#peer_authentication Setting peer authentication.
- #
- # Support for SSL client session resume is provided as well.
- #
- # @see SSLDomain
- # @see #resume_status
- #
- class SSL
-
- # Session resume state is unkonnwn or not supported.
- RESUME_UNKNOWN = Cproton::PN_SSL_RESUME_UNKNOWN
- # Session renegotiated and not resumed.
- RESUME_NEW = Cproton::PN_SSL_RESUME_NEW
- # Session resumed from the previous session.
- RESUME_REUSED = Cproton::PN_SSL_RESUME_REUSED
-
- # @private
- include Util::SwigHelper
-
- # @private
- PROTON_METHOD_PREFIX = "pn_ssl"
-
- # @private
- include Util::ErrorHandler
-
- can_raise_error :peer_hostname=, :error_class => SSLError
-
- # Returns whether SSL is supported.
- #
- # @return [Boolean] True if SSL support is available.
- #
- def self.present?
- Cproton.pn_ssl_present
- end
-
- # @private
- def self.create(transport, domain, session_details = nil)
- result = nil
- # like python, make sure we're not creating a different SSL
- # object for a transport with an existing SSL object
- if transport.ssl?
- transport.instance_eval { result = @ssl }
- if ((!domain.nil? && (result.domain != domain)) ||
- (!session_details.nil? && (result.session_details != session_details)))
- raise SSLException.new("cannot re-configure existing SSL object")
- end
- else
- impl = Cproton.pn_ssl(transport.impl)
- session_id = nil
- session_id = session_details.session_id unless session_details.nil?
- result = SSL.new(impl, domain, session_details, session_id)
- end
- return result
- end
-
- private
-
- def initialize(impl, domain, session_details, session_id)
- @impl = impl
- @domain = domain.impl unless domain.nil?
- @session_details = session_details
- @session_id = session_id
- Cproton.pn_ssl_init(@impl, @domain, @session_id)
- end
-
- public
-
- # Returns the cipher name that is currently in used.
- #
- # Gets the text description of the cipher that is currently active, or
- # returns nil if SSL is not active. Note that the cipher in use my change
- # over time due to renegotiation or other changes to the SSL layer.
- #
- # @return [String, nil] The cipher name.
- #
- def cipher_name
- rc, name = Cproton.pn_ssl_get_cipher_name(@impl, 128)
- return name if rc
- nil
- end
-
- # Returns the name of the SSL protocol that is currently active, or
- # returns nil if SSL is nota ctive. Not that the protocol may change over
- # time due to renegotation.
- #
- # @return [String, nil] The protocol name.
- #
- def protocol_name
- rc, name = Cproton.pn_ssl_get_protocol_name(@impl, 128)
- retur name if rc
- nil
- end
-
- # Checks whether or not the state has resumed.
- #
- # Used for client session resume. When called on an active session, it
- # indicates wehther the state has been resumed from a previous session.
- #
- # *NOTE:* This is a best-effort service - there is no guarantee that the
- # remote server will accept the resumed parameters. The remote server may
- # choose to ignore these parameters, and request a renegotation instead.
- #
- def resume_status
- Cproton.pn_ssl_resume_status(@impl)
- end
-
- # Gets the peer hostname.
- #
- # @return [String] The peer hostname.
- def peer_hostname
- (error, name) = Cproton.pn_ssl_get_peer_hostname(@impl, 1024)
- raise SSLError.new if error < 0
- return name
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/ssl_details.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/ssl_details.rb b/proton-c/bindings/ruby/lib/core/ssl_details.rb
deleted file mode 100644
index 5367c80..0000000
--- a/proton-c/bindings/ruby/lib/core/ssl_details.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # @private
- class SSLSessionDetails
-
- attr_reader :session_id
-
- def initialize(session_id)
- @session_id = session_id
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/ssl_domain.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/ssl_domain.rb b/proton-c/bindings/ruby/lib/core/ssl_domain.rb
deleted file mode 100644
index ef3c03c..0000000
--- a/proton-c/bindings/ruby/lib/core/ssl_domain.rb
+++ /dev/null
@@ -1,156 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # The top-level object that stores the configuration used by one or more
- # SSL sessions.
- #
- # @see SSL
- #
- class SSLDomain
-
- # The local connection endpoint is an SSL client.
- # @private
- MODE_CLIENT = Cproton::PN_SSL_MODE_CLIENT
- # The local connection endpoint is an SSL server.
- # @private
- MODE_SERVER = Cproton::PN_SSL_MODE_SERVER
-
- # Require the peer to provide a valid identifying certificate.
- VERIFY_PEER = Cproton::PN_SSL_VERIFY_PEER
- # Do no require a certificate nor a cipher authorization.
- ANONYMOUS_PEER = Cproton::PN_SSL_ANONYMOUS_PEER
- # Require a valid certficate and matching name.
- VERIFY_PEER_NAME = Cproton::PN_SSL_VERIFY_PEER_NAME
-
- # @private
- include Util::ErrorHandler
-
- can_raise_error :credentials, :error_class => Qpid::Proton::SSLError
- can_raise_error :trusted_ca_db, :error_class => Qpid::Proton::SSLError
- can_raise_error :peer_authentication, :error_class => Qpid::Proton::SSLError
- can_raise_error :allow_unsecured_client, :error_class => Qpid::Proton::SSLError
-
- # @private
- attr_reader :impl
-
- # @private
- def initialize(mode)
- @impl = Cproton.pn_ssl_domain(mode)
- raise SSLUnavailable.new if @impl.nil?
- end
-
- # Set the certificate that identifies the local node to the remote.
- #
- # This certificate establishes the identity for thelocal node for all SSL
- # sessions created from this domain. It will be sent to the remote if the
- # remote needs to verify the dientify of this node. This may be used for
- # both SSL servers and SSL clients (if client authentication is required by
- # the server).
- #
- # *NOTE:* This setting affects only those instances of SSL created *after*
- # this call returns. SSL objects created before invoking this method will
- # use the domain's previous settings.
- #
- # @param cert_file [String] The filename containing the identify
- # certificate. For OpenSSL users, this is a PEM file. For Windows SChannel
- # users, this is the PKCS\#12 file or system store.
- # @param key_file [String] An option key to access the identifying
- # certificate. For OpenSSL users, this is an optional PEM file containing
- # the private key used to sign the certificate. For Windows SChannel users,
- # this is the friendly name of the self-identifying certficate if there are
- # multiple certfificates in the store.
- # @param password [String] The password used to sign the key, or *nil* if
- # the key is not protected.
- #
- # @raise [SSLError] If an error occurs.
- #
- def credentials(cert_file, key_file, password)
- Cproton.pn_ssl_domain_set_credentials(@impl,
- cert_file, key_file, password)
- end
-
- # Configures the set of trusted CA certificates used by this domain to
- # verify peers.
- #
- # If the local SSL client/server needs to verify the identify of the remote,
- # it must validate the signature of the remote's certificate. This function
- # sets the database of trusted CAs that will be used to verify the signature
- # of the remote's certificate.
- #
- # *NOTE:# This setting affects only those SSL instances created *after* this
- # call returns. SSL objects created before invoking this method will use the
- # domain's previous setting.
- #
- # @param certificate_db [String] The filename for the databse of trusted
- # CAs, used to authenticate the peer.
- #
- # @raise [SSLError] If an error occurs.
- #
- def trusted_ca_db(certificate_db)
- Cproton.pn_ssl_domain_set_trusted_ca_db(@impl, certificate_db)
- end
-
- # Configures the level of verification used on the peer certificate.
- #
- # This method congtrols how the peer's certificate is validated, if at all.
- # By default, neither servers nor clients attempt to verify their peers
- # (*ANONYMOUS_PEER*). Once certficates and trusted CAs are configured, peer
- # verification can be enabled.
- #
- # *NOTE:* In order to verify a peer, a trusted CA must be configured.
- #
- # *NOTE:* Servers must provide their own certficate when verifying a peer.
- #
- # *NOTE:* This setting affects only those SSL instances created after this
- # call returns. SSL instances created before invoking this method will use
- # the domain's previous setting.
- #
- # @param verify_mode [Fixnum] The level of validation to apply to the peer.
- # @param trusted_CAs [String] The path to a database of trusted CAs that
- # the server will advertise to the peer client if the server has been
- # configured to verify its peer.
- #
- # @see VERIFY_PEER
- # @see ANONYMOUS_PEER
- # @see VERIFY_PEER_NAME
- #
- # @raise [SSLError] If an error occurs.
- #
- def peer_authentication(verify_mode, trusted_CAs = nil)
- Cproton.pn_ssl_domain_set_peer_authentication(@impl,
- verify_mode, trusted_CAs)
- end
-
- # Permit a server to accept connection requests from non-SSL clients.
- #
- # This configures the server to "sniff" the incomfing client data stream and
- # dynamically determine whether SSL/TLS is being used. This option is
- # disabled by default: only clients using SSL/TLS are accepted by default.
- #
- # @raise [SSLError] If an error occurs.
- #
- def allow_unsecured_client
- Cproton.pn_ssl_domain_allow_unsecured_client(@impl);
- end
-
- end
-
-end
http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/bindings/ruby/lib/core/terminus.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/terminus.rb b/proton-c/bindings/ruby/lib/core/terminus.rb
deleted file mode 100644
index 4bd22d7..0000000
--- a/proton-c/bindings/ruby/lib/core/terminus.rb
+++ /dev/null
@@ -1,218 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Qpid::Proton
-
- # Represents an endpoint for an AMQP connection..
- #
- # An AMQP terminus acts as either a source or a target for messages,
- # but never as both. Every Link is associated iwth both a source and
- # a target Terminus that is negotiated during link establishment.
- #
- # A terminus is composed of an AMQP address along with a number of
- # other properties defining the quality of service and behavior of
- # the Link.
- #
- class Terminus
-
- # Indicates a non-existent source or target terminus.
- UNSPECIFIED = Cproton::PN_UNSPECIFIED
- # Indicates a source for messages.
- SOURCE = Cproton::PN_SOURCE
- # Indicates a target for messages.
- TARGET = Cproton::PN_TARGET
- # A special target identifying a transaction coordinator.
- COORDINATOR = Cproton::PN_COORDINATOR
-
- # The terminus is orphaned when the parent link is closed.
- EXPIRE_WITH_LINK = Cproton::PN_EXPIRE_WITH_LINK
- # The terminus is orphaned whent he parent sessio is closed.
- EXPIRE_WITH_SESSION = Cproton::PN_EXPIRE_WITH_SESSION
- # The terminus is orphaned when the parent connection is closed.
- EXPIRE_WITH_CONNECTION = Cproton::PN_EXPIRE_WITH_CONNECTION
- # The terminus is never considered orphaned.
- EXPIRE_NEVER = Cproton::PN_EXPIRE_NEVER
-
- # Indicates a non-durable Terminus.
- NONDURABLE = Cproton::PN_NONDURABLE
- # Indicates a Terminus with durably held configuration, but
- # not the delivery state.
- CONFIGURATION = Cproton::PN_CONFIGURATION
- # Indicates a Terminus with both durably held configuration and
- # durably held delivery states.
- DELIVERIES = Cproton::PN_DELIVERIES
-
- # The behavior is defined by the nod.e
- DIST_MODE_UNSPECIFIED = Cproton::PN_DIST_MODE_UNSPECIFIED
- # The receiver gets all messages.
- DIST_MODE_COPY = Cproton::PN_DIST_MODE_COPY
- # The receives compete for messages.
- DIST_MODE_MOVE = Cproton::PN_DIST_MODE_MOVE
-
- # @private
- include Util::SwigHelper
-
- # @private
- PROTON_METHOD_PREFIX = "pn_terminus"
-
- # @!attribute type
- #
- # @return [Fixnum] The terminus type.
- #
- # @see SOURCE
- # @see TARGET
- # @see COORDINATOR
- #
- proton_accessor :type
-
- # @!attribute address
- #
- # @return [String] The terminus address.
- #
- proton_accessor :address
-
- # @!attribute durability
- #
- # @return [Fixnum] The durability mode of the terminus.
- #
- # @see NONDURABLE
- # @see CONFIGURATION
- # @see DELIVERIES
- #
- proton_accessor :durability
-
- # @!attribute expiry_policy
- #
- # @return [Fixnum] The expiry policy.
- #
- # @see EXPIRE_WITH_LINK
- # @see EXPIRE_WITH_SESSION
- # @see EXPIRE_WITH_CONNECTION
- # @see EXPIRE_NEVER
- #
- proton_accessor :expiry_policy
-
- # @!attribute timeout
- #
- # @return [Fixnum] The timeout period.
- #
- proton_accessor :timeout
-
- # @!attribute dynamic?
- #
- # @return [Boolean] True if the terminus is dynamic.
- #
- proton_accessor :dynamic, :is_or_get => :is
-
- # @!attribute distribution_mode
- #
- # @return [Fixnum] The distribution mode.
- #
- # @see DIST_MODE_UNSPECIFIED
- # @see DIST_MODE_COPY
- # @see DIST_MODE_MOVE
- #
- proton_accessor :distribution_mode
-
- # @private
- include Util::ErrorHandler
-
- can_raise_error [:type=, :address=, :durability=, :expiry_policy=,
- :timeout=, :dynamic=, :distribution_mode=, :copy],
- :error_class => Qpid::Proton::LinkError
-
- # @private
- attr_reader :impl
-
- # @private
- def initialize(impl)
- @impl = impl
- end
-
- # Access and modify the AMQP properties data for the Terminus.
- #
- # This operation will return an instance of Data that is valid until the
- # Terminus is freed due to its parent being freed. Any data contained in
- # the object will be sent as the AMQP properties for the parent Terminus
- # instance.
- #
- # NOTE: this MUST take the form of a symbol keyed map to be valid.
- #
- # @return [Data] The terminus properties.
- #
- def properties
- Data.new(Cproton.pn_terminus_properties(@impl))
- end
-
- # Access and modify the AMQP capabilities data for the Terminus.
- #
- # This operation will return an instance of Data that is valid until the
- # Terminus is freed due to its parent being freed. Any data contained in
- # the object will be sent as the AMQP properties for the parent Terminus
- # instance.
- #
- # NOTE: this MUST take the form of a symbol keyed map to be valid.
- #
- # @return [Data] The terminus capabilities.
- #
- def capabilities
- Data.new(Cproton.pn_terminus_capabilities(@impl))
- end
-
- # Access and modify the AMQP outcomes for the Terminus.
- #
- # This operaiton will return an instance of Data that is valid until the
- # Terminus is freed due to its parent being freed. Any data contained in
- # the object will be sent as the AMQP properties for the parent Terminus
- # instance.
- #
- # NOTE: this MUST take the form of a symbol keyed map to be valid.
- #
- # @return [Data] The terminus outcomes.
- #
- def outcomes
- Data.new(Cproton.pn_terminus_outcomes(@impl))
- end
-
- # Access and modify the AMQP filter set for the Terminus.
- #
- # This operation will return an instance of Data that is valid until the
- # Terminus is freed due to its parent being freed. Any data contained in
- # the object will be sent as the AMQP properties for the parent Terminus
- # instance.
- #
- # NOTE: this MUST take the form of a symbol keyed map to be valid.
- #
- # @return [Data] The terminus filter.
- #
- def filter
- Data.new(Cproton.pn_terminus_filter(@impl))
- end
-
- # Copy another Terminus into this instance.
- #
- # @param source [Terminus] The source instance.
- #
- def copy(source)
- Cproton.pn_terminus_copy(@impl,source.impl)
- end
-
- end
-
-end
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org