/usr/lib/ruby/vendor_ruby/qrack/transport/frame08.rb is in ruby-bunny 0.7.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | # encoding: utf-8
#:stopdoc:
# this file was autogenerated on 2011-07-21 07:15:33 +0100
#
# DO NOT EDIT! (edit ext/qparser.rb and config.yml instead, and run 'ruby qparser.rb')
module Qrack
module Transport
class Frame
FOOTER = 206
ID = 0
@types = {
1 => 'Method',
2 => 'Header',
3 => 'Body',
4 => 'OobMethod',
5 => 'OobHeader',
6 => 'OobBody',
7 => 'Trace',
8 => 'Heartbeat',
}
attr_accessor :channel, :payload
def initialize payload = nil, channel = 0
@channel, @payload = channel, payload
end
def id
self.class::ID
end
def to_binary
buf = Transport::Buffer.new
buf.write :octet, id
buf.write :short, channel
buf.write :longstr, payload
buf.write :octet, FOOTER
buf.rewind
buf
end
def to_s
to_binary.to_s
end
def == frame
[ :id, :channel, :payload ].inject(true) do |eql, field|
eql and __send__(field) == frame.__send__(field)
end
end
def self.parse buf
buf = Transport::Buffer.new(buf) unless buf.is_a? Transport::Buffer
buf.extract do
id, channel, payload, footer = buf.read(:octet, :short, :longstr, :octet)
Qrack::Transport.const_get(@types[id]).new(payload, channel) if footer == FOOTER
end
end
end
class Method < Frame
ID = 1
def initialize payload = nil, channel = 0
super
unless @payload.is_a? Protocol::Class::Method or @payload.nil?
@payload = Protocol.parse(@payload)
end
end
end
class Header < Frame
ID = 2
def initialize payload = nil, channel = 0
super
unless @payload.is_a? Protocol::Header or @payload.nil?
@payload = Protocol::Header.new(@payload)
end
end
end
class Body < Frame
ID = 3
end
class OobMethod < Frame
ID = 4
end
class OobHeader < Frame
ID = 5
end
class OobBody < Frame
ID = 6
end
class Trace < Frame
ID = 7
end
class Heartbeat < Frame
ID = 8
end
end
end
|