Class: RTSP::Request

Inherits:
Object
  • Object
show all
Extended by:
Global
Includes:
Common
Defined in:
lib/rtsp/request.rb

Overview

Parses raw request data from the server/client and turns it into attr_readers.

Constant Summary

Constants included from Global

Global::DEFAULT_RTSP_PORT, Global::DEFAULT_VERSION

Instance Attribute Summary collapse

Attributes included from Global

#log, #log_level, #logger, #raise_errors

Instance Method Summary collapse

Methods included from Global

log?, raise_errors?, reset_config!

Methods included from Common

#extract_status_line, #inspect, #multicast?, #parse_body, #parse_head, #split_head_and_body_from, #to_s, #transport_url

Constructor Details

#initialize(raw_request, remote_host) ⇒ Request

server/client.

Parameters:

  • raw_request (String)

    The raw request string returned from the

  • remote_host (String)

    The IP address of the remote host.



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rtsp/request.rb', line 26

def initialize(raw_request, remote_host)
  if raw_request.nil? || raw_request.empty?
    raise RTSP::Error,
      "#{self.class} received nil or empty string--this shouldn't happen."
  end

  @raw_body = raw_request
  @remote_host = remote_host

  head, body = split_head_and_body_from @raw_body
  parse_head(head)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



18
19
20
# File 'lib/rtsp/request.rb', line 18

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



16
17
18
# File 'lib/rtsp/request.rb', line 16

def code
  @code
end

#messageObject (readonly)

Returns the value of attribute message.



17
18
19
# File 'lib/rtsp/request.rb', line 17

def message
  @message
end

#remote_hostObject

Returns the value of attribute remote_host.



21
22
23
# File 'lib/rtsp/request.rb', line 21

def remote_host
  @remote_host
end

#rtsp_versionObject (readonly)

Returns the value of attribute rtsp_version.



15
16
17
# File 'lib/rtsp/request.rb', line 15

def rtsp_version
  @rtsp_version
end

#stream_indexObject (readonly)

Returns the value of attribute stream_index.



20
21
22
# File 'lib/rtsp/request.rb', line 20

def stream_index
  @stream_index
end

#urlObject (readonly)

Returns the value of attribute url.



19
20
21
# File 'lib/rtsp/request.rb', line 19

def url
  @url
end