bitgirder-platform 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.txt +176 -0
- data/bin/ensure-test-db +117 -0
- data/bin/install-mysql +375 -0
- data/bin/tomcat7 +569 -0
- data/lib/bitgirder/concurrent.rb +400 -0
- data/lib/bitgirder/core.rb +1235 -0
- data/lib/bitgirder/etl.rb +58 -0
- data/lib/bitgirder/event/file.rb +485 -0
- data/lib/bitgirder/event/logger/testing.rb +140 -0
- data/lib/bitgirder/event/logger.rb +137 -0
- data/lib/bitgirder/event/testing.rb +88 -0
- data/lib/bitgirder/http.rb +255 -0
- data/lib/bitgirder/io/testing.rb +33 -0
- data/lib/bitgirder/io.rb +959 -0
- data/lib/bitgirder/irb.rb +35 -0
- data/lib/bitgirder/mysql.rb +60 -0
- data/lib/bitgirder/ops/java.rb +117 -0
- data/lib/bitgirder/ops/ruby.rb +235 -0
- data/lib/bitgirder/testing.rb +152 -0
- data/lib/doc-gen0.rb +0 -0
- data/lib/doc-gen1.rb +0 -0
- data/lib/doc-gen10.rb +0 -0
- data/lib/doc-gen11.rb +0 -0
- data/lib/doc-gen12.rb +0 -0
- data/lib/doc-gen13.rb +0 -0
- data/lib/doc-gen14.rb +0 -0
- data/lib/doc-gen15.rb +0 -0
- data/lib/doc-gen16.rb +0 -0
- data/lib/doc-gen17.rb +14 -0
- data/lib/doc-gen18.rb +0 -0
- data/lib/doc-gen19.rb +0 -0
- data/lib/doc-gen2.rb +0 -0
- data/lib/doc-gen20.rb +182 -0
- data/lib/doc-gen21.rb +0 -0
- data/lib/doc-gen3.rb +0 -0
- data/lib/doc-gen4.rb +0 -0
- data/lib/doc-gen5.rb +0 -0
- data/lib/doc-gen6.rb +0 -0
- data/lib/doc-gen7.rb +0 -0
- data/lib/doc-gen8.rb +0 -0
- data/lib/doc-gen9.rb +0 -0
- data/lib/mingle/bincodec.rb +512 -0
- data/lib/mingle/codec.rb +54 -0
- data/lib/mingle/http.rb +156 -0
- data/lib/mingle/io/stream.rb +142 -0
- data/lib/mingle/io.rb +160 -0
- data/lib/mingle/json.rb +257 -0
- data/lib/mingle/service.rb +110 -0
- data/lib/mingle-em.rb +92 -0
- data/lib/mingle.rb +2917 -0
- metadata +100 -0
data/lib/mingle/codec.rb
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require 'bitgirder/io'
|
|
2
|
+
|
|
3
|
+
module Mingle
|
|
4
|
+
module Codec
|
|
5
|
+
|
|
6
|
+
require 'tempfile'
|
|
7
|
+
|
|
8
|
+
class MingleCodecError < StandardError; end
|
|
9
|
+
|
|
10
|
+
module MingleCodecImpl
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
def codec_raise( *argv )
|
|
14
|
+
raise Mingle::Codec::MingleCodecError, *argv
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module MingleCodecs
|
|
19
|
+
|
|
20
|
+
@@bgm = BitGirder::Core::BitGirderMethods
|
|
21
|
+
|
|
22
|
+
def decode( codec, obj )
|
|
23
|
+
|
|
24
|
+
@@bgm.not_nil( codec, :codec )
|
|
25
|
+
@@bgm.not_nil( obj, :obj )
|
|
26
|
+
|
|
27
|
+
case obj
|
|
28
|
+
|
|
29
|
+
when String then codec.from_buffer( obj )
|
|
30
|
+
|
|
31
|
+
when IO, Tempfile
|
|
32
|
+
data = BitGirder::Io.slurp_io( obj ) || ""
|
|
33
|
+
decode( codec, data ) # recurse
|
|
34
|
+
|
|
35
|
+
else
|
|
36
|
+
raise "Don't know how to decode obj #{obj} of type #{obj.class}"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
module_function :decode
|
|
41
|
+
|
|
42
|
+
def encode( codec, mv )
|
|
43
|
+
|
|
44
|
+
@@bgm.not_nil( codec, :codec )
|
|
45
|
+
@@bgm.not_nil( mv, :mv )
|
|
46
|
+
|
|
47
|
+
codec.as_buffer( mv )
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
module_function :encode
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/mingle/http.rb
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
require 'bitgirder/core'
|
|
2
|
+
require 'mingle'
|
|
3
|
+
require 'mingle/service'
|
|
4
|
+
require 'mingle/codec'
|
|
5
|
+
|
|
6
|
+
require 'uri'
|
|
7
|
+
|
|
8
|
+
module Mingle
|
|
9
|
+
module Http
|
|
10
|
+
|
|
11
|
+
class ServerLocation < BitGirder::Core::BitGirderClass
|
|
12
|
+
|
|
13
|
+
bg_attr :host
|
|
14
|
+
bg_attr :port
|
|
15
|
+
|
|
16
|
+
bg_attr :uri,
|
|
17
|
+
:processor => lambda { |s| s.start_with?( "/" ) ? s : "/#{s}" }
|
|
18
|
+
|
|
19
|
+
public
|
|
20
|
+
def to_url
|
|
21
|
+
"http://#{host}:#{port}#{uri}"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class HttpCodecContext < BitGirder::Core::BitGirderClass
|
|
26
|
+
|
|
27
|
+
bg_attr :codec
|
|
28
|
+
bg_attr :content_type
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Simple blocking client using ruby builtin http lib
|
|
32
|
+
class NetHttpMingleRpcClient < BitGirder::Core::BitGirderClass
|
|
33
|
+
|
|
34
|
+
require 'net/http'
|
|
35
|
+
|
|
36
|
+
include Mingle::Codec
|
|
37
|
+
include Mingle::Service
|
|
38
|
+
|
|
39
|
+
bg_attr :location
|
|
40
|
+
bg_attr :codec_ctx
|
|
41
|
+
bg_attr :reactor, :required => false
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
def react( meth, *argv )
|
|
45
|
+
|
|
46
|
+
case @reactor
|
|
47
|
+
|
|
48
|
+
when Hash
|
|
49
|
+
if func = @reactor[ meth ] then func.call( *argv ) end
|
|
50
|
+
|
|
51
|
+
else
|
|
52
|
+
if @reactor.respond_to?( meth )
|
|
53
|
+
@reactor.send( meth, *argv )
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Input checker/converter for call()
|
|
59
|
+
private
|
|
60
|
+
def get_mg_req( argv )
|
|
61
|
+
|
|
62
|
+
# Fail if nothing at all was given
|
|
63
|
+
not_nil( argv[ 0 ], :mg_req )
|
|
64
|
+
|
|
65
|
+
case argv.size
|
|
66
|
+
when 1
|
|
67
|
+
case obj = argv[ 0 ]
|
|
68
|
+
when MingleServiceRequest then obj
|
|
69
|
+
when Hash then MingleServiceRequest.new( obj )
|
|
70
|
+
else raise "Invalid or incomplete call param: #{obj}"
|
|
71
|
+
end
|
|
72
|
+
else
|
|
73
|
+
MingleServiceRequest.new(
|
|
74
|
+
:namespace => argv[ 0 ],
|
|
75
|
+
:service => argv[ 1 ],
|
|
76
|
+
:operation => argv[ 2 ],
|
|
77
|
+
:parameters => argv[ 3 ],
|
|
78
|
+
:authentication => argv[ 4 ] )
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
def create_request( mv )
|
|
84
|
+
|
|
85
|
+
req = Net::HTTP::Post.new( @location.uri )
|
|
86
|
+
|
|
87
|
+
req.body = MingleCodecs.encode( @codec_ctx.codec, mv )
|
|
88
|
+
req.content_type = @codec_ctx.content_type
|
|
89
|
+
req[ "connection" ] = "close"
|
|
90
|
+
|
|
91
|
+
react( :complete_request, req )
|
|
92
|
+
|
|
93
|
+
req
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
private
|
|
97
|
+
def as_service_response( body )
|
|
98
|
+
|
|
99
|
+
ms = MingleCodecs.decode( @codec_ctx.codec, body )
|
|
100
|
+
MingleServices.as_service_response( ms )
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
public
|
|
104
|
+
def call( *argv )
|
|
105
|
+
|
|
106
|
+
mv = MingleServices.as_mingle_struct( get_mg_req( argv ) )
|
|
107
|
+
req = create_request( mv )
|
|
108
|
+
|
|
109
|
+
resp =
|
|
110
|
+
Net::HTTP.new( @location.host, @location.port ).start do |http|
|
|
111
|
+
http.request( req )
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
react( :response_received, resp )
|
|
115
|
+
|
|
116
|
+
case resp
|
|
117
|
+
when Net::HTTPOK then as_service_response( resp.body )
|
|
118
|
+
else raise "Got non-OK response: #{resp} (#{resp.body})"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# class ServiceClient < BitGirder::Core::BitGirderClass
|
|
123
|
+
#
|
|
124
|
+
# bg_attr :cli
|
|
125
|
+
# bg_attr :namespace
|
|
126
|
+
# bg_attr :service
|
|
127
|
+
# bg_attr( :identifier => :authentication )
|
|
128
|
+
#
|
|
129
|
+
# def initialize( opts )
|
|
130
|
+
# super
|
|
131
|
+
# end
|
|
132
|
+
#
|
|
133
|
+
# public
|
|
134
|
+
# def call( op, args = {}, auth = nil )
|
|
135
|
+
#
|
|
136
|
+
# @cli.call(
|
|
137
|
+
# @namespace,
|
|
138
|
+
# @service,
|
|
139
|
+
# not_nil( op, :op ),
|
|
140
|
+
# not_nil( args, :args ),
|
|
141
|
+
# auth || @authentication
|
|
142
|
+
# )
|
|
143
|
+
# end
|
|
144
|
+
# end
|
|
145
|
+
#
|
|
146
|
+
# # returns a ServiceClient object bound with the given preset context. opts
|
|
147
|
+
# # must contain the keys :namespace ans :service and may optionally contain
|
|
148
|
+
# # an auth object :authentication
|
|
149
|
+
# public
|
|
150
|
+
# def create_service_client( opts )
|
|
151
|
+
# ServiceClient.new( opts.merge( :cli => self ) )
|
|
152
|
+
# end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
end
|
|
156
|
+
end
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
require 'bitgirder/core'
|
|
2
|
+
require 'bitgirder/io'
|
|
3
|
+
require 'mingle/io'
|
|
4
|
+
|
|
5
|
+
module Mingle
|
|
6
|
+
module Io
|
|
7
|
+
module Stream
|
|
8
|
+
|
|
9
|
+
MESSAGE_VERSION1 = 1
|
|
10
|
+
|
|
11
|
+
TYPE_CODE_HEADERS = 1
|
|
12
|
+
TYPE_CODE_MESSAGE_BODY = 2
|
|
13
|
+
|
|
14
|
+
class Message < BitGirder::Core::BitGirderClass
|
|
15
|
+
|
|
16
|
+
bg_attr :headers,
|
|
17
|
+
:processor => lambda { |val|
|
|
18
|
+
Mingle::Io::Headers.as_headers( val )
|
|
19
|
+
},
|
|
20
|
+
:default => lambda { Mingle::Io::Headers.as_headers( {} ) }
|
|
21
|
+
|
|
22
|
+
bg_attr :body, :default => "".freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class Connection < BitGirder::Core::BitGirderClass
|
|
26
|
+
|
|
27
|
+
include Mingle
|
|
28
|
+
|
|
29
|
+
bg_attr :reader
|
|
30
|
+
bg_attr :writer
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
def impl_initialize
|
|
34
|
+
|
|
35
|
+
@enc = Io::Encoder.new( @writer )
|
|
36
|
+
@dec = Io::Decoder.new( @reader )
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
def write_headers( hdrs )
|
|
41
|
+
|
|
42
|
+
@enc.write_int32( TYPE_CODE_HEADERS )
|
|
43
|
+
@enc.write_headers( hdrs )
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
def write_body( body )
|
|
48
|
+
|
|
49
|
+
@enc.write_int32( TYPE_CODE_MESSAGE_BODY )
|
|
50
|
+
@enc.write_int64( sz = body.bytesize )
|
|
51
|
+
@writer.write( body ) unless sz == 0
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
public
|
|
55
|
+
def write_message( msg )
|
|
56
|
+
|
|
57
|
+
msg = Message.as_instance( msg )
|
|
58
|
+
|
|
59
|
+
@enc.write_int32( MESSAGE_VERSION1 )
|
|
60
|
+
write_headers( msg.headers )
|
|
61
|
+
write_body( msg.body )
|
|
62
|
+
@writer.flush
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
def read_body
|
|
67
|
+
sz = @dec.read_int64
|
|
68
|
+
@dec.read_full( sz )
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
public
|
|
72
|
+
def read_message
|
|
73
|
+
|
|
74
|
+
@dec.expect_version( MESSAGE_VERSION1, "message" )
|
|
75
|
+
|
|
76
|
+
@dec.expect_type_code( TYPE_CODE_HEADERS )
|
|
77
|
+
hdrs = @dec.read_headers
|
|
78
|
+
|
|
79
|
+
@dec.expect_type_code( TYPE_CODE_MESSAGE_BODY )
|
|
80
|
+
body = read_body
|
|
81
|
+
|
|
82
|
+
Message.new( :headers => hdrs, :body => body )
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
class MinglePeer < BitGirder::Core::BitGirderClass
|
|
88
|
+
|
|
89
|
+
include Mingle
|
|
90
|
+
|
|
91
|
+
private_class_method :new
|
|
92
|
+
|
|
93
|
+
bg_attr :proc_builder
|
|
94
|
+
|
|
95
|
+
private
|
|
96
|
+
def start
|
|
97
|
+
@peer = @proc_builder.popen( "r+" )
|
|
98
|
+
@conn = Connection.new( :reader => @peer, :writer => @peer )
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
public
|
|
102
|
+
def exchange_message( msg )
|
|
103
|
+
|
|
104
|
+
@conn.write_message( msg )
|
|
105
|
+
@conn.read_message
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
public
|
|
109
|
+
def await_exit( opts = { :expect_success => true } )
|
|
110
|
+
|
|
111
|
+
not_nil( opts, :opts )
|
|
112
|
+
|
|
113
|
+
msg = nil
|
|
114
|
+
|
|
115
|
+
begin
|
|
116
|
+
pid, stat =
|
|
117
|
+
BitGirder::Io.debug_wait2( :pid => @peer.pid, :name => :peer )
|
|
118
|
+
|
|
119
|
+
unless stat.success?
|
|
120
|
+
msg = "Peer #{pid} exited with non-success #{stat.exitstatus}"
|
|
121
|
+
end
|
|
122
|
+
rescue Errno::ECHILD
|
|
123
|
+
msg = "Peer #{pid} appears to have exited already"
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if msg
|
|
127
|
+
if opts[ :expect_success ] then raise msg else warn msg end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def self.open( *argv )
|
|
132
|
+
|
|
133
|
+
res = self.send( :new, *argv )
|
|
134
|
+
res.send( :start )
|
|
135
|
+
|
|
136
|
+
res
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
data/lib/mingle/io.rb
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
require 'mingle'
|
|
2
|
+
require 'bitgirder/core'
|
|
3
|
+
require 'bitgirder/io'
|
|
4
|
+
|
|
5
|
+
module Mingle
|
|
6
|
+
module Io
|
|
7
|
+
|
|
8
|
+
require 'forwardable'
|
|
9
|
+
|
|
10
|
+
class Headers < BitGirder::Core::BitGirderClass
|
|
11
|
+
|
|
12
|
+
def self.make_fields( flds )
|
|
13
|
+
|
|
14
|
+
pairs = flds.inject( {} ) do |h, pair|
|
|
15
|
+
val = pair[ 1 ]
|
|
16
|
+
val = val.external_form if val.is_a?( MingleIdentifier )
|
|
17
|
+
val = MingleModels.as_mingle_value( val )
|
|
18
|
+
val = MingleModels.as_mingle_string( val )
|
|
19
|
+
h[ pair[ 0 ] ] = val
|
|
20
|
+
h
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
MingleSymbolMap.create( pairs )
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.as_headers( val )
|
|
27
|
+
case val
|
|
28
|
+
when Headers then val
|
|
29
|
+
when Hash, MingleSymbolMap then Headers.new( :fields => val )
|
|
30
|
+
else raise TypeError, "Invalid headers value: #{val.class}"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
bg_attr :fields,
|
|
35
|
+
:processor => lambda { |val| self.make_fields( val ) },
|
|
36
|
+
:default => lambda { {} }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
HEADERS_VERSION1 = 0x01
|
|
40
|
+
|
|
41
|
+
TYPE_CODE_HEADERS_FIELD = 0x01
|
|
42
|
+
TYPE_CODE_HEADERS_END = 0x02
|
|
43
|
+
|
|
44
|
+
BYTE_ORDER = BitGirder::Io::ORDER_LITTLE_ENDIAN
|
|
45
|
+
|
|
46
|
+
class Encoder < BitGirder::Core::BitGirderClass
|
|
47
|
+
|
|
48
|
+
bg_attr :writer
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
def impl_initialize
|
|
52
|
+
@bin = BitGirder::Io::BinaryWriter.new( :order => BYTE_ORDER, :io => @writer )
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
public
|
|
56
|
+
def write_int32( i )
|
|
57
|
+
@bin.write_int32( i )
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
public
|
|
61
|
+
def write_int64( i )
|
|
62
|
+
@bin.write_int64( i )
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
public
|
|
66
|
+
def write_utf8( s )
|
|
67
|
+
@bin.write_utf8( s )
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
public
|
|
71
|
+
def write_headers( hdrs )
|
|
72
|
+
|
|
73
|
+
write_int32( HEADERS_VERSION1 )
|
|
74
|
+
hdrs.fields.each_pair do |k, v|
|
|
75
|
+
write_int32( TYPE_CODE_HEADERS_FIELD )
|
|
76
|
+
write_utf8( k.external_form )
|
|
77
|
+
write_utf8( v.to_s )
|
|
78
|
+
end
|
|
79
|
+
write_int32( TYPE_CODE_HEADERS_END )
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
class InvalidVersionError < StandardError; end
|
|
84
|
+
class InvalidTypeCodeError < StandardError; end
|
|
85
|
+
|
|
86
|
+
class Decoder < BitGirder::Core::BitGirderClass
|
|
87
|
+
|
|
88
|
+
bg_attr :reader
|
|
89
|
+
|
|
90
|
+
extend Forwardable
|
|
91
|
+
def_delegators :@bin,
|
|
92
|
+
:read_full, :read_int32, :read_int64, :read_buffer32, :read_utf8
|
|
93
|
+
|
|
94
|
+
private
|
|
95
|
+
def impl_initialize
|
|
96
|
+
@bin = BitGirder::Io::BinaryReader.new( :order => BYTE_ORDER, :io => @reader )
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
public
|
|
100
|
+
def read_version
|
|
101
|
+
read_int32
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
public
|
|
105
|
+
def expect_version( expct, ver_typ )
|
|
106
|
+
|
|
107
|
+
unless ( ver = read_version ) == expct
|
|
108
|
+
|
|
109
|
+
tmpl = "Invalid %s :version => 0x%08x (expected 0x%08x)"
|
|
110
|
+
msg = sprintf( tmpl, ver_typ, ver, expct )
|
|
111
|
+
raise InvalidVersionError.new( msg )
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
public
|
|
116
|
+
def read_type_code
|
|
117
|
+
read_int32
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
public
|
|
121
|
+
def expect_type_code( expct )
|
|
122
|
+
|
|
123
|
+
unless ( act = read_type_code ) == expct
|
|
124
|
+
|
|
125
|
+
tmpl = "Invalid type :code => 0x%08x (expected 0x%08x)"
|
|
126
|
+
msg = sprintf( tmpl, act, expct )
|
|
127
|
+
raise InvalidTypeCodeError.new( msg )
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
private
|
|
132
|
+
def read_header_field( flds )
|
|
133
|
+
flds[ read_utf8 ] = read_utf8
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
public
|
|
137
|
+
def read_headers
|
|
138
|
+
|
|
139
|
+
expect_version( HEADERS_VERSION1, "headers" )
|
|
140
|
+
|
|
141
|
+
flds = {}
|
|
142
|
+
while true do
|
|
143
|
+
|
|
144
|
+
case tc = read_type_code
|
|
145
|
+
|
|
146
|
+
when TYPE_CODE_HEADERS_FIELD then read_header_field( flds )
|
|
147
|
+
|
|
148
|
+
when TYPE_CODE_HEADERS_END
|
|
149
|
+
return Headers.new( :fields => flds )
|
|
150
|
+
|
|
151
|
+
else
|
|
152
|
+
msg = sprintf( "Unknown type :code => 0x%08x", tc )
|
|
153
|
+
raise InvalidTypeCodeError.new( msg )
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
end
|
|
160
|
+
end
|