Library rtsp

This Real Time Streaming Protocol (RTSP) library implements only a minimal subset of the protocol needed by the current scripts.

Author:

  • Patrik Karlsson <patrik@cqure.net> The library contains the following classes: * <code>Request</code> ** This class contains the functions needed to create the RTSP request * <code>Response</code> ** This class contains the functions needed to parse the RTSP response * <code>Client</code> ** This class contains the RTSP client, a class responsible for sending and receiving requests and responses to/from the server * <code>Helper</code> ** This class serves as the main interface for script writers The following sample code shows how to use the library: <code> local helper = rtsp.Helper:new(host, port) local status = helper:connect() local response status, response = helper:describe(url) helper:close() </code>

Copyright © Same as Nmap--See https://nmap.org/book/man-legal.html

Source: https://svn.nmap.org/nmap/nselib/rtsp.lua

Functions

__tostring (self)

Converts the Request to a string

addHeader (self, header, value)

Adds a RTSP header to the request

addHeader (self, header, value)

Adds a RTSP header to the request

close (self)

Closes the RTSP socket with the server

connect (self)

Connects to the RTSP server

describe (self, url)

Sends a DESCRIBE request to the server and receives the response

exch (self, req, request)

Sends a request to the server and receives the response and attempts to retry if either send or receive fails.

new (self, data)

Creates a new Response instance

new (self, data)

Creates a new Response instance

setCSeq (self, cseq)

Sets the RTSP sequence number

setMethod (self, method)

Sets the RTSP Request method

setRetries (self, retries)

Sets the number of retries for socket reads

setTimeout (self, timeout)

Sets the socket connection timeout in ms

Functions

__tostring (self)

Converts the Request to a string

Parameters

self
 

Return value:

req string containing the request as a string
addHeader (self, header, value)

Adds a RTSP header to the request

Parameters

self
 
header
string containing the header name
value
string containing the header value
addHeader (self, header, value)

Adds a RTSP header to the request

Parameters

self
 
header
string containing the header name
value
string containing the header value
close (self)

Closes the RTSP socket with the server

Parameters

self
 
connect (self)

Connects to the RTSP server

Parameters

self
 

Return values:

  1. status true on success, false on failure
  2. err string containing the error message on failure
describe (self, url)

Sends a DESCRIBE request to the server and receives the response

Parameters

self
 
url
string containing the RTSP URL

Return values:

  1. status true on success, false on failure
  2. response Response instance on success err string containing the error message on failure
exch (self, req, request)

Sends a request to the server and receives the response and attempts to retry if either send or receive fails.

Parameters

self
 
req
 
request
instance of Request

Return values:

  1. status true on success, false on failure
  2. response Response instance on success err string containing the error message on failure
new (self, data)

Creates a new Response instance

Parameters

self
 
data
string containing the unparsed data
new (self, data)

Creates a new Response instance

Parameters

self
 
data
string containing the unparsed data
setCSeq (self, cseq)

Sets the RTSP sequence number

Parameters

self
 
cseq
number containing the sequence number
setMethod (self, method)

Sets the RTSP Request method

Parameters

self
 
method
string containing the RTSP method
setRetries (self, retries)

Sets the number of retries for socket reads

Parameters

self
 
retries
number containing the number of retries
setTimeout (self, timeout)

Sets the socket connection timeout in ms

Parameters

self
 
timeout
number containing the timeout in ms