Class: Rex::Proto::SIP::Response
- Defined in:
- lib/rex/proto/sip/response.rb
Overview
Represents a SIP response message
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#message ⇒ Object
Returns the value of attribute message.
-
#status_line ⇒ Object
Returns the value of attribute status_line.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes inherited from Message
Class Method Summary collapse
-
.parse(data) ⇒ Object
Parses
data
, constructs and returns a Response.
Methods inherited from Message
extract_headers, #header, #initialize
Constructor Details
This class inherits a constructor from Rex::Proto::SIP::Message
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
42 43 44 |
# File 'lib/rex/proto/sip/response.rb', line 42 def code @code end |
#message ⇒ Object
Returns the value of attribute message.
42 43 44 |
# File 'lib/rex/proto/sip/response.rb', line 42 def end |
#status_line ⇒ Object
Returns the value of attribute status_line.
42 43 44 |
# File 'lib/rex/proto/sip/response.rb', line 42 def status_line @status_line end |
#version ⇒ Object
Returns the value of attribute version.
42 43 44 |
# File 'lib/rex/proto/sip/response.rb', line 42 def version @version end |
Class Method Details
.parse(data) ⇒ Object
Parses data
, constructs and returns a Response
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rex/proto/sip/response.rb', line 45 def self.parse(data) response = Response.new # do some basic sanity checking on this response to ensure that it is SIP response.status_line = data.split(/\r\n/)[0] unless response.status_line && response.status_line =~ SIP_STATUS_REGEX fail(ArgumentError, "Invalid SIP status line: #{response.status_line}") end response.version = Regexp.last_match(1) response.code = Regexp.last_match(2) response. = Regexp.last_match(3) response.headers = extract_headers(data) response end |