Class: Qpid::Proton::Transport Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/core/transport.rb

Overview

Deprecated.

all important features are available from #Connection

Constant Summary collapse

TRACE_OFF =

Turn logging off entirely.

Cproton::PN_TRACE_OFF
TRACE_RAW =

Log raw binary data into/out of the transport.

Cproton::PN_TRACE_RAW
TRACE_FRM =

Log frames into/out of the transport.

Cproton::PN_TRACE_FRM
TRACE_DRV =

Log driver related events; i.e., initialization, end of stream, etc.

Cproton::PN_TRACE_DRV

Instance Method Summary collapse

Constructor Details

#initialize(impl = Cproton.pn_transport) ⇒ Transport

Creates a new transport instance.



171
172
173
174
175
# File 'lib/core/transport.rb', line 171

def initialize(impl = Cproton.pn_transport)
  @impl = impl
  @ssl = nil
  self.class.store_instance(self, :pn_transport_attachments)
end

Instance Method Details

#bind(connection)

Binds to the given connection.

Parameters:



204
205
206
# File 'lib/core/transport.rb', line 204

def bind(connection)
  Cproton.pn_transport_bind(@impl, connection.impl)
end

#close_head

Indicate that the output has closed.

Tells the transport that no more output will be popped.

Raises:



311
312
313
# File 'lib/core/transport.rb', line 311

def close_head
  Cproton.pn_transport_close_head(@impl)
end

#close_tail

Indicate that the input has reached EOS (end of stream).

This tells the transport that no more input will be forthcoming.

Raises:



277
278
279
# File 'lib/core/transport.rb', line 277

def close_tail
  Cproton.pn_transport_close_tail(@impl)
end

#conditionCondition?

Returns transport error condition or nil if there is no error.

Returns:

  • (Condition, nil)

    transport error condition or nil if there is no error.



190
191
192
# File 'lib/core/transport.rb', line 190

def condition
  Condition.convert(Cproton.pn_transport_condition(@impl))
end

#condition=(c)

Set the error condition for the transport.

Parameters:



196
197
198
# File 'lib/core/transport.rb', line 196

def condition=(c)
  Condition.assign(Cproton.pn_transport_condition(@impl), c)
end

#connectionConnection?

Return the AMQP connection associated with the transport.

Returns:

  • (Connection, nil)

    The bound connection, or nil.



231
232
233
# File 'lib/core/transport.rb', line 231

def connection
  Connection.wrap(Cproton.pn_transport_connection(@impl))
end

#log(message)

Log a message to the transport's logging mechanism.

This can be using in a debugging scenario as the message will be prepended with the transport's identifier.

Parameters:

  • message (String)

    The message to be logged.



242
243
244
# File 'lib/core/transport.rb', line 242

def log(message)
  Cproton.pn_transport_log(@impl, message)
end

#peek(size) ⇒ String

Returns the specified number of bytes from the transport's buffers.

Parameters:

  • size (Integer)

    The number of bytes to return.

Returns:

  • (String)

    The data peeked.

Raises:



289
290
291
292
293
294
# File 'lib/core/transport.rb', line 289

def peek(size)
  cd, out = Cproton.pn_transport_peek(@impl, size)
  return nil if cd == Qpid::Proton::Error::EOS
  raise TransportError.new if cd < -1
  out
end

#pop(size)

Removes the specified number of bytes from the pending output queue following the transport's head pointer.

Parameters:

  • size (Integer)

    The number of bytes to remove.



301
302
303
# File 'lib/core/transport.rb', line 301

def pop(size)
  Cproton.pn_transport_pop(@impl, size)
end

#process(size)

Process input data following the tail pointer.

Calling this function will cause the transport to consume the specified number of bytes of input occupying the free space following the tail pointer. It may also change the value for #tail, as well as the amount of free space reported by #capacity.

Parameters:

  • size (Integer)

    The number of bytes to process.

Raises:



267
268
269
# File 'lib/core/transport.rb', line 267

def process(size)
  Cproton.pn_transport_process(@impl, size)
end

#push(data) ⇒ Integer

Pushes the supplied bytes into the tail of the transport.

Parameters:

  • data (String)

    The bytes to be pushed.

Returns:

  • (Integer)

    The number of bytes pushed.



252
253
254
# File 'lib/core/transport.rb', line 252

def push(data)
  Cproton.pn_transport_push(@impl, data, data.length)
end

#quiesced?Boolean

Returns whether the transport has any buffered data.

Returns:

  • (Boolean)

    True if the transport has no buffered data.



185
186
187
# File 'lib/core/transport.rb', line 185

def quiesced?
  Cproton.pn_transport_quiesced(@impl)
end

#saslSASL

Create, or return existing, SSL object for the transport.

Returns:

  • (SASL)

    the SASL object



336
337
338
# File 'lib/core/transport.rb', line 336

def sasl
  SASL.new(self)
end

#set_server

Set server mode for this tranport - enables protocol detection and server-side authentication for incoming connections



179
# File 'lib/core/transport.rb', line 179

def set_server() Cproton.pn_transport_set_server(@impl); end

#ssl(domain = nil, session_details = nil) ⇒ SSL

Creates, or returns an existing, SSL object for the transport.

Parameters:

  • domain (SSLDomain) (defaults to: nil)

    The SSL domain.

  • session_details (SSLDetails) (defaults to: nil)

    The SSL session details.

Returns:

  • (SSL)

    The SSL object.



347
348
349
# File 'lib/core/transport.rb', line 347

def ssl(domain = nil, session_details = nil)
  @ssl ||= SSL.create(self, domain, session_details)
end

#tick(now) ⇒ Integer

Process any pending transport timer events.

This method should be called after all pending input has been processed by the transport (see #input), and before generating output (see #output).

It returns the deadline for the next pending timer event, if any art present.

Parameters:

  • now (Time)

    The timestamp.

Returns:

  • (Integer)

    If non-zero, the expiration time of the next pending timer event for the transport. The caller must invoke #tick again at least once at or before this deadline occurs.



330
331
332
# File 'lib/core/transport.rb', line 330

def tick(now)
  Cproton.pn_transport_tick(@impl, now)
end

#trace(level)

Updates the transports trace flags.

Parameters:

  • level (Integer)

    The trace level.

See Also:



223
224
225
# File 'lib/core/transport.rb', line 223

def trace(level)
  Cproton.pn_transport_trace(@impl, level)
end

#unbind

Unbinds from the previous connection.



210
211
212
# File 'lib/core/transport.rb', line 210

def unbind
  Cproton.pn_transport_unbind(@impl)
end