Class: Qpid::Proton::Endpoint
- Inherits:
-
Object
- Object
- Qpid::Proton::Endpoint
- Includes:
- Util::Engine
- Defined in:
- lib/core/endpoint.rb
Overview
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.
Direct Known Subclasses
Constant Summary collapse
- LOCAL_UNINIT =
The local connection is uninitialized.
Cproton::PN_LOCAL_UNINIT
- LOCAL_ACTIVE =
The local connection is active.
Cproton::PN_LOCAL_ACTIVE
- LOCAL_CLOSED =
The local connection is closed.
Cproton::PN_LOCAL_CLOSED
- REMOTE_UNINIT =
The remote connection is unitialized.
Cproton::PN_REMOTE_UNINIT
- REMOTE_ACTIVE =
The remote connection is active.
Cproton::PN_REMOTE_ACTIVE
- REMOTE_CLOSED =
The remote connection is closed.
Cproton::PN_REMOTE_CLOSED
- LOCAL_MASK =
Bitmask for the local-only flags.
Cproton::PN_LOCAL_UNINIT | Cproton::PN_LOCAL_ACTIVE | Cproton::PN_LOCAL_CLOSED
- REMOTE_MASK =
Bitmask for the remote-only flags.
Cproton::PN_REMOTE_UNINIT | Cproton::PN_REMOTE_ACTIVE | Cproton::PN_REMOTE_CLOSED
Instance Method Summary collapse
- #_update_condition ⇒ Object
- #check_state(state_mask) ⇒ Object
- #handler ⇒ Object
- #handler=(handler) ⇒ Object
-
#initialize ⇒ Endpoint
constructor
A new instance of Endpoint.
- #local_active? ⇒ Boolean
- #local_closed? ⇒ Boolean
- #local_uninit? ⇒ Boolean
- #remote_active? ⇒ Boolean
- #remote_closed? ⇒ Boolean
- #remote_condition ⇒ Object
- #remote_uninit? ⇒ Boolean
-
#transport ⇒ Transport
Return the transport associated with this endpoint.
Methods included from Util::Engine
#condition_to_object, #data_to_object, #object_to_condition, #object_to_data, receive_message
Constructor Details
#initialize ⇒ Endpoint
Returns a new instance of Endpoint.
63 64 65 |
# File 'lib/core/endpoint.rb', line 63 def initialize @condition = nil end |
Instance Method Details
#_update_condition ⇒ Object
68 69 70 |
# File 'lib/core/endpoint.rb', line 68 def _update_condition object_to_condition(@condition, self._local_condition) end |
#check_state(state_mask) ⇒ Object
109 110 111 |
# File 'lib/core/endpoint.rb', line 109 def check_state(state_mask) !(self.state & state_mask).zero? end |
#handler ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/core/endpoint.rb', line 113 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. puts "record=#{record}" WrappedHandler.wrap(Cproton.pn_record_get_handler(record), on_error) end |
#handler=(handler) ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/core/endpoint.rb', line 125 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. Cproton.pn_record_set_handler(record, impl) Cproton.pn_decref(impl) end |
#local_active? ⇒ Boolean
89 90 91 |
# File 'lib/core/endpoint.rb', line 89 def local_active? check_state(LOCAL_ACTIVE) end |
#local_closed? ⇒ Boolean
93 94 95 |
# File 'lib/core/endpoint.rb', line 93 def local_closed? check_state(LOCAL_CLOSED) end |
#local_uninit? ⇒ Boolean
85 86 87 |
# File 'lib/core/endpoint.rb', line 85 def local_uninit? check_state(LOCAL_UNINIT) end |
#remote_active? ⇒ Boolean
101 102 103 |
# File 'lib/core/endpoint.rb', line 101 def remote_active? check_state(REMOTE_ACTIVE) end |
#remote_closed? ⇒ Boolean
105 106 107 |
# File 'lib/core/endpoint.rb', line 105 def remote_closed? check_state(REMOTE_CLOSED) end |
#remote_condition ⇒ Object
73 74 75 |
# File 'lib/core/endpoint.rb', line 73 def remote_condition condition_to_object(self._remote_condition) end |
#remote_uninit? ⇒ Boolean
97 98 99 |
# File 'lib/core/endpoint.rb', line 97 def remote_uninit? check_state(REMOTE_UNINIT) end |
#transport ⇒ Transport
Return the transport associated with this endpoint.
81 82 83 |
# File 'lib/core/endpoint.rb', line 81 def transport self.connection.transport end |