Class: Mu::Xtractr::Stream::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/mu/xtractr/stream.rb

Overview

Message

Represents a single logical TCP message that has been potentially reassembled from across multiple packets spanning multiple pcaps. Each message contains the stream to which it belongs in addition to whether this message was sent from the client or the server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream, index, dir, bytes) ⇒ Message

:nodoc:



79
80
81
82
83
84
# File 'lib/mu/xtractr/stream.rb', line 79

def initialize stream, index, dir, bytes # :nodoc:
    @stream = stream
    @index  = index
    @dir    = dir
    @bytes  = bytes
end

Instance Attribute Details

#bytesObject (readonly)

Returns the actual bytes of the message.



77
78
79
# File 'lib/mu/xtractr/stream.rb', line 77

def bytes
  @bytes
end

#dirObject (readonly)

Returns the direction of the message (request/response).



74
75
76
# File 'lib/mu/xtractr/stream.rb', line 74

def dir
  @dir
end

#indexObject (readonly)

Returns the index within the stream



71
72
73
# File 'lib/mu/xtractr/stream.rb', line 71

def index
  @index
end

#streamObject (readonly)

Returns the stream to which this message belongs to.



68
69
70
# File 'lib/mu/xtractr/stream.rb', line 68

def stream
  @stream
end

Instance Method Details

#inspectObject

:nodoc:



86
87
88
89
90
# File 'lib/mu/xtractr/stream.rb', line 86

def inspect # :nodoc:
    preview = bytes[0..32]
    preview << "..." if bytes.size > 32
    return "#<message:#{index} flow-#{stream.flow.id} #{preview.inspect}>"
end