Class: PStream::CipherNegotiation

Inherits:
Object
  • Object
show all
Defined in:
lib/pstream/cipher_negotiation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pstream, ipv, src, dst) ⇒ CipherNegotiation

Returns a new instance of CipherNegotiation.



34
35
36
37
38
39
40
41
42
# File 'lib/pstream/cipher_negotiation.rb', line 34

def initialize(pstream, ipv, src, dst)
    @dst = dst
    @ipv = ipv
    @length = nil
    @pstream = pstream
    @src = src
    @suite = nil
    @suites = Array.new
end

Instance Attribute Details

#dstObject (readonly)

Returns the value of attribute dst.



8
9
10
# File 'lib/pstream/cipher_negotiation.rb', line 8

def dst
  @dst
end

#ipvObject (readonly)

Returns the value of attribute ipv.



9
10
11
# File 'lib/pstream/cipher_negotiation.rb', line 9

def ipv
  @ipv
end

#lengthObject

Returns the value of attribute length.



4
5
6
# File 'lib/pstream/cipher_negotiation.rb', line 4

def length
  @length
end

#pstreamObject (readonly)

Returns the value of attribute pstream.



10
11
12
# File 'lib/pstream/cipher_negotiation.rb', line 10

def pstream
  @pstream
end

#srcObject (readonly)

Returns the value of attribute src.



11
12
13
# File 'lib/pstream/cipher_negotiation.rb', line 11

def src
  @src
end

#suiteObject

Returns the value of attribute suite.



5
6
7
# File 'lib/pstream/cipher_negotiation.rb', line 5

def suite
  @suite
end

#suitesObject

Returns the value of attribute suites.



6
7
8
# File 'lib/pstream/cipher_negotiation.rb', line 6

def suites
  @suites
end

Instance Method Details

#summaryObject



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/pstream/cipher_negotiation.rb', line 44

def summary
    ret = Array.new
    ret.push(
        "#{hilight_ipv(@ipv)} #{hilight_hosts(@src, @dst)}"
    )
    ret.push("    #{hilight_selected_suite(@suite)}") if (@suite)
    @suites.each do |suite|
        ret.push("    #{@pstream.hilight_cipher_suite(suite)}")
    end

    return ret.join("\n")
end

#to_sObject



57
58
59
# File 'lib/pstream/cipher_negotiation.rb', line 57

def to_s
    return summary
end