Cogs.Core
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Cogs::RTSP Class Referenceabstract
Inheritance diagram for Cogs::RTSP:
Cogs::Network::ConnectionTCP Cogs::Network::ConnectionBase

Classes

struct  CaseInsensitiveCompare
 
struct  MediaDescription
 
struct  Message
 

Public Types

using MediaList = std::vector< MediaDescription >
 

Public Member Functions

 RTSP (std::string_view url, std::string_view userAgent="Cogs/1.0")
 
bool sendSetup (MediaDescription &mediaDescription, const std::string &mediaURL, uint16_t client_port_a, uint16_t client_port_b)
 
bool sendPlay ()
 
bool sendPause ()
 
bool sendTeardown ()
 
bool isActive () const
 
const std::string & getOriginalURL () const
 
const MediaList & getMediaDescriptions () const
 
- Public Member Functions inherited from Cogs::Network::ConnectionTCP
 ConnectionTCP (Socket socket, const SockaddrIn &addr)
 Constructs a connection that is attached to the specified socket.
 
virtual ~ConnectionTCP ()
 Destroys this connection.
 
SocketType type () const override
 
IPProto proto () const override
 
void enableAutoReconnect ()
 
void disableAutoReconnect ()
 
virtual bool isAutoConnectEnabled () const override
 
virtual bool isConnected () const override
 
void setConnectTimeout (int64_t milliseconds)
 
void setNoDelay (bool val=true)
 Set the TCP_NODELAY flag (Enable / Disables Nagles algorithm).
 
void shutdown ()
 Shutdown this connection.
 
virtual bool connect (const SockaddrIn &addr)
 Sets up this connection ready to connect to the specified remote address and port.
 
virtual bool reconnect () override
 Reconnects this connection to the remote host previously specified through a call to connect.
 
virtual bool disconnect () override
 Disconnects this connection.
 
bool listen (uint16_t port)
 
bool listen (AddrIn ip, uint16_t port)
 Sets this connection up as a listener that will listen for and respond to incoming connection requests on the specified port.
 
virtual bool processIncoming () override
 Manages accepting incoming connections when this connection is a listener.
 
virtual ConnectionTCPaccept (Socket, const SockaddrIn &)
 
- Public Member Functions inherited from Cogs::Network::ConnectionBase
Family family () const
 
virtual SocketType type () const =0
 
virtual IPProto proto () const =0
 
Socket getSocket () const
 
void remove ()
 
void removeAndDelete ()
 
const SockaddrIngetAddress () const
 
int64_t getReconnectTime () const
 
virtual bool isAutoConnectEnabled () const
 
virtual bool isConnected () const
 
bool shouldRemove () const
 
bool shouldDelete () const
 
void setNonblocking (bool val=true)
 Sets socket non-blocking mode to val.
 
void setDoNotProcess ()
 
virtual bool reconnect ()
 
virtual bool disconnect ()=0
 
bool bind (uint16_t port)
 
virtual bool bind (AddrIn ip, uint16_t port)
 Sets this connection up as a listener that will listen for and respond to incoming connection requests on the specified port.
 
bool send (const void *data, uint64_t byteCount, uint64_t &bytesSent)
 Attempts to send as much of the specified data as possible.
 
bool receive (void *buffer, uint64_t byteCount, uint64_t &bytesReceived)
 Attempts to read the specified number of bytes from the network socket this connection represents.
 
bool sendTo (const void *data, uint64_t byteCount, uint64_t &bytesSent, const SockaddrIn &addr)
 Attempts to send as much of the specified data as possible.
 
bool recvFrom (void *buffer, uint64_t byteCount, uint64_t &bytesReceived, SockaddrIn &addr)
 Attempts to read the specified number of bytes from the network socket this connection represents.
 
virtual bool processOutgoing ()
 
virtual bool processIncoming ()
 

Protected Member Functions

virtual bool processOutgoing () override
 
virtual bool processIncoming () override
 Manages accepting incoming connections when this connection is a listener.
 
virtual void processIncomingMessage (Message &message)
 
virtual void receivedMediaDescriptions ()=0
 
virtual void receivedStreamSetup (MediaDescription &md)=0
 
void queueMessage (Message *message)
 
- Protected Member Functions inherited from Cogs::Network::ConnectionBase
void create ()
 Internal wrapper for the socket() call.
 
void close ()
 Internal wrapper for closing the socket.
 

Protected Attributes

MediaList mediaDescriptions
 List of media descriptions.
 
bool has_describe: 1
 
bool has_setup: 1
 
bool has_play: 1
 
bool has_pause: 1
 
bool has_teardown: 1
 
bool has_set_parameter: 1
 
bool has_get_parameter: 1
 
bool is_active: 1
 
bool has_video: 1
 
bool has_audio: 1
 
- Protected Attributes inherited from Cogs::Network::ConnectionBase
Cogs::Atomic< uint32_t > flags = 0
 
int64_t reconnectTime = 0
 
Socket socket = InvalidSocket
 
SockaddrIn sockAddr = {}
 

Private Member Functions

void addStandardHeaders (Message &message)
 
bool breakdownURL (std::string_view uri)
 
std::string buildURL (std::string_view method)
 
void parseSDP (const std::string &sdp)
 
void sendOptions ()
 
void sendDescribe ()
 

Private Attributes

std::deque< Message * > queuedMessages
 List of messages waiting to be sent.
 
Cogs::Mutex queueMutex
 Mutex protecting the message queue.
 
Memory::MemoryBuffer outgoingBuffer
 Memory buffer used when sending data.
 
MessageoutgoingMessage = nullptr
 The message currently being sent.
 
std::deque< Message * > sentMessages
 List of sent messages.
 
Memory::MemoryBuffer incomingBuffer
 Memory buffer used when receiving data.
 
Message incomingMessage
 The message currently being received.
 
std::string originalURL
 URL with which this RTSP object was constructed.
 
std::string userInfo
 user:pass part of the URL.
 
std::string hostname
 Hostname of the RTSP server.
 
std::string resourcePath
 Path on the server to the resource we are accessing.
 
uint16_t hostPort = 554
 Port we should use when connecting to the server.
 
std::string agentString
 User agent string passed in requests.
 
int sequenceNumber = 0
 Our sequence number that will be used when sending requests.
 
std::string sessionID
 Server generated session identifier.
 
int64_t timeout = 60000
 Session timeout in millisesonds.
 
int64_t keepAliveTime = 0
 Millisecond timestamp when we should ping the server to prevent the session from timing out.
 

Additional Inherited Members

- Static Protected Attributes inherited from Cogs::Network::ConnectionBase
static constexpr uint32_t cRemove = 0x00000001
 
static constexpr uint32_t cDelete = 0x00000002
 
static constexpr uint32_t cDoNotProcess = 0x00000004
 

Detailed Description

Definition at line 18 of file RTSP.h.

Member Typedef Documentation

◆ MediaList

using Cogs::RTSP::MediaList = std::vector<MediaDescription>

Definition at line 72 of file RTSP.h.

Constructor & Destructor Documentation

◆ RTSP()

Cogs::RTSP::RTSP ( std::string_view  url,
std::string_view  userAgent = "Cogs/1.0" 
)

Definition at line 20 of file RTSP.cpp.

◆ ~RTSP()

Cogs::RTSP::~RTSP ( )

Definition at line 44 of file RTSP.cpp.

Member Function Documentation

◆ addStandardHeaders()

void Cogs::RTSP::addStandardHeaders ( Message message)
private

Definition at line 471 of file RTSP.cpp.

◆ breakdownURL()

bool Cogs::RTSP::breakdownURL ( std::string_view  uri)
private

Definition at line 480 of file RTSP.cpp.

◆ buildURL()

std::string Cogs::RTSP::buildURL ( std::string_view  method)
private

Definition at line 511 of file RTSP.cpp.

◆ getMediaDescriptions()

const MediaList & Cogs::RTSP::getMediaDescriptions ( ) const
inline

Definition at line 85 of file RTSP.h.

◆ getOriginalURL()

const std::string & Cogs::RTSP::getOriginalURL ( ) const
inline

Definition at line 84 of file RTSP.h.

◆ isActive()

bool Cogs::RTSP::isActive ( ) const
inline

Definition at line 82 of file RTSP.h.

◆ parseSDP()

void Cogs::RTSP::parseSDP ( const std::string &  sdp)
private

Definition at line 102 of file RTSP.cpp.

◆ processIncoming()

bool Cogs::RTSP::processIncoming ( )
overrideprotectedvirtual

Manages accepting incoming connections when this connection is a listener.

Reimplemented from Cogs::Network::ConnectionTCP.

Definition at line 288 of file RTSP.cpp.

◆ processIncomingMessage()

void Cogs::RTSP::processIncomingMessage ( Message message)
protectedvirtual

Definition at line 359 of file RTSP.cpp.

◆ processOutgoing()

bool Cogs::RTSP::processOutgoing ( )
overrideprotectedvirtual

Reimplemented from Cogs::Network::ConnectionBase.

Definition at line 229 of file RTSP.cpp.

◆ queueMessage()

void Cogs::RTSP::queueMessage ( Message message)
protected

Definition at line 462 of file RTSP.cpp.

◆ sendDescribe()

void Cogs::RTSP::sendDescribe ( )
private

Definition at line 542 of file RTSP.cpp.

◆ sendOptions()

void Cogs::RTSP::sendOptions ( )
private

Definition at line 533 of file RTSP.cpp.

◆ sendPause()

bool Cogs::RTSP::sendPause ( )

Definition at line 76 of file RTSP.cpp.

◆ sendPlay()

bool Cogs::RTSP::sendPlay ( )

Definition at line 63 of file RTSP.cpp.

◆ sendSetup()

bool Cogs::RTSP::sendSetup ( MediaDescription mediaDescription,
const std::string &  mediaURL,
uint16_t  client_port_a,
uint16_t  client_port_b 
)

Definition at line 48 of file RTSP.cpp.

◆ sendTeardown()

bool Cogs::RTSP::sendTeardown ( )

Definition at line 89 of file RTSP.cpp.

Member Data Documentation

◆ agentString

std::string Cogs::RTSP::agentString
private

User agent string passed in requests.

Definition at line 122 of file RTSP.h.

◆ has_audio

bool Cogs::RTSP::has_audio
protected

Definition at line 98 of file RTSP.h.

◆ has_describe

bool Cogs::RTSP::has_describe
protected

Definition at line 89 of file RTSP.h.

◆ has_get_parameter

bool Cogs::RTSP::has_get_parameter
protected

Definition at line 95 of file RTSP.h.

◆ has_pause

bool Cogs::RTSP::has_pause
protected

Definition at line 92 of file RTSP.h.

◆ has_play

bool Cogs::RTSP::has_play
protected

Definition at line 91 of file RTSP.h.

◆ has_set_parameter

bool Cogs::RTSP::has_set_parameter
protected

Definition at line 94 of file RTSP.h.

◆ has_setup

bool Cogs::RTSP::has_setup
protected

Definition at line 90 of file RTSP.h.

◆ has_teardown

bool Cogs::RTSP::has_teardown
protected

Definition at line 93 of file RTSP.h.

◆ has_video

bool Cogs::RTSP::has_video
protected

Definition at line 97 of file RTSP.h.

◆ hostname

std::string Cogs::RTSP::hostname
private

Hostname of the RTSP server.

Definition at line 119 of file RTSP.h.

◆ hostPort

uint16_t Cogs::RTSP::hostPort = 554
private

Port we should use when connecting to the server.

Definition at line 121 of file RTSP.h.

◆ incomingBuffer

Memory::MemoryBuffer Cogs::RTSP::incomingBuffer
private

Memory buffer used when receiving data.

Definition at line 115 of file RTSP.h.

◆ incomingMessage

Message Cogs::RTSP::incomingMessage
private

The message currently being received.

Definition at line 116 of file RTSP.h.

◆ is_active

bool Cogs::RTSP::is_active
protected

Definition at line 96 of file RTSP.h.

◆ keepAliveTime

int64_t Cogs::RTSP::keepAliveTime = 0
private

Millisecond timestamp when we should ping the server to prevent the session from timing out.

Definition at line 126 of file RTSP.h.

◆ mediaDescriptions

MediaList Cogs::RTSP::mediaDescriptions
protected

List of media descriptions.

Definition at line 88 of file RTSP.h.

◆ originalURL

std::string Cogs::RTSP::originalURL
private

URL with which this RTSP object was constructed.

Definition at line 117 of file RTSP.h.

◆ outgoingBuffer

Memory::MemoryBuffer Cogs::RTSP::outgoingBuffer
private

Memory buffer used when sending data.

Definition at line 112 of file RTSP.h.

◆ outgoingMessage

Message* Cogs::RTSP::outgoingMessage = nullptr
private

The message currently being sent.

Definition at line 113 of file RTSP.h.

◆ queuedMessages

std::deque<Message*> Cogs::RTSP::queuedMessages
private

List of messages waiting to be sent.

Definition at line 110 of file RTSP.h.

◆ queueMutex

Cogs::Mutex Cogs::RTSP::queueMutex
private

Mutex protecting the message queue.

Definition at line 111 of file RTSP.h.

◆ resourcePath

std::string Cogs::RTSP::resourcePath
private

Path on the server to the resource we are accessing.

Definition at line 120 of file RTSP.h.

◆ sentMessages

std::deque<Message*> Cogs::RTSP::sentMessages
private

List of sent messages.

(Used to know what we're expecting.)

Definition at line 114 of file RTSP.h.

◆ sequenceNumber

int Cogs::RTSP::sequenceNumber = 0
private

Our sequence number that will be used when sending requests.

Definition at line 123 of file RTSP.h.

◆ sessionID

std::string Cogs::RTSP::sessionID
private

Server generated session identifier.

Definition at line 124 of file RTSP.h.

◆ timeout

int64_t Cogs::RTSP::timeout = 60000
private

Session timeout in millisesonds.

Definition at line 125 of file RTSP.h.

◆ userInfo

std::string Cogs::RTSP::userInfo
private

user:pass part of the URL.

Definition at line 118 of file RTSP.h.


The documentation for this class was generated from the following files: