Module: Qrack::Protocol

Included in:
Qrack
Defined in:
lib/ext/bunny-0.6.0/lib/qrack/protocol/spec08.rb,
lib/ext/bunny-0.6.0/lib/qrack/protocol/spec08.rb,
lib/ext/bunny-0.6.0/lib/qrack/protocol/protocol08.rb

Defined Under Namespace

Classes: Access, Basic, Channel, Class, Connection, Dtx, Exchange, File, Header, Queue, Stream, Test, Tunnel, Tx

Constant Summary collapse

HEADER =
"AMQP".freeze
VERSION_MAJOR =
8
VERSION_MINOR =
0
REVISION =
0
PORT =
5672
SSL_PORT =
5671
RESPONSES =
{
  200 => :REPLY_SUCCESS,
  310 => :NOT_DELIVERED,
  311 => :CONTENT_TOO_LARGE,
  320 => :CONNECTION_FORCED,
  402 => :INVALID_PATH,
  403 => :ACCESS_REFUSED,
  404 => :NOT_FOUND,
  405 => :RESOURCE_LOCKED,
  502 => :SYNTAX_ERROR,
  503 => :COMMAND_INVALID,
  504 => :CHANNEL_ERROR,
  506 => :RESOURCE_ERROR,
  530 => :NOT_ALLOWED,
  540 => :NOT_IMPLEMENTED,
  541 => :INTERNAL_ERROR,
}
FIELDS =
[
  :bit,
  :long,
  :longlong,
  :longstr,
  :octet,
  :short,
  :shortstr,
  :table,
  :timestamp,
]

Class Method Summary collapse

Class Method Details

.Class(id, name) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/ext/bunny-0.6.0/lib/qrack/protocol/spec08.rb', line 108

def self.Class(id, name)
  @_base_classes ||= {}
  @_base_classes[id] ||= ::Class.new(Class) do
    class_eval %[
      def self.inherited klass
        klass.const_set(:ID, #{id})
        klass.const_set(:NAME, :#{name.to_s})
        Protocol.classes[#{id}] = klass
        Protocol.classes[klass::NAME] = klass
      end
    ]
  end
end

.classesObject



106
# File 'lib/ext/bunny-0.6.0/lib/qrack/protocol/spec08.rb', line 106

def self.classes() @classes ||= {} end

.parse(buf) ⇒ Object



125
126
127
128
129
# File 'lib/ext/bunny-0.6.0/lib/qrack/protocol/protocol08.rb', line 125

def self.parse buf
  buf = Transport::Buffer.new(buf) unless buf.is_a? Transport::Buffer
  class_id, method_id = buf.read(:short, :short)
  classes[class_id].methods[method_id].new(buf)
end