Class | Resolv::DNS::Message::MessageEncoder
In: | resolv.rb
Parent: | Object

### Methods

new put_bytes put_label put_labels put_length16 put_name put_pack put_string put_string_list to_s

### Public Class methods

new() {|self| ...}

[Source]

    # File resolv.rb, line 1156
            def initialize
              @data = ''
              @names = {}
              yield self
            end

### Public Instance methods

put_bytes(d)

[Source]

    # File resolv.rb, line 1166
            def put_bytes(d)
              @data << d
            end

put_label(d)

[Source]

    # File resolv.rb, line 1212
            def put_label(d)
              self.put_string(d.string)
            end

put_labels(d)

[Source]

    # File resolv.rb, line 1198
            def put_labels(d)
              d.each_index {|i|
                domain = d[i..-1]
                if idx = @names[domain]
                  self.put_pack("n", 0xc000 | idx)
                  return
                else
                  @names[domain] = @data.length
                  self.put_label(d[i])
                end
              }
              @data << "\0"
            end

put_length16() {|| ...}

[Source]

    # File resolv.rb, line 1174
            def put_length16
              length_index = @data.length
              @data << "\0\0"
              data_start = @data.length
              yield
              data_end = @data.length
              @data[length_index, 2] = [data_end - data_start].pack("n")
            end

put_name(d)

[Source]

    # File resolv.rb, line 1194
            def put_name(d)
              put_labels(d.to_a)
            end

put_pack(template, *d)

[Source]

    # File resolv.rb, line 1170
            def put_pack(template, *d)
              @data << d.pack(template)
            end

put_string(d)

[Source]

    # File resolv.rb, line 1183
            def put_string(d)
              self.put_pack("C", d.length)
              @data << d
            end

put_string_list(ds)

[Source]

    # File resolv.rb, line 1188
            def put_string_list(ds)
              ds.each {|d|
                self.put_string(d)
              }
            end

to_s()

[Source]

    # File resolv.rb, line 1162
            def to_s
              return @data
            end

[Validate]