Classes | Public Types | Public Member Functions | Protected Attributes

cygnal::Handler Class Reference

#include <handler.h>

Inheritance diagram for cygnal::Handler:
Inheritance graph
Collaboration diagram for cygnal::Handler:
Collaboration graph

List of all members.


struct  cygnal_init_t

Public Types

enum  admin_cmd_e {
enum  pub_stream_e { RECORD, LIVE, APPEND }
typedef size_t(* cygnal_io_write_t )(boost::uint8_t *data, size_t size)
typedef boost::shared_ptr
< cygnal::Buffer >(* 
cygnal_io_read_t )()
typedef boost::shared_ptr
< cygnal_init_t >(* 
cygnal_io_init_t )(boost::shared_ptr< gnash::RTMPMsg > &msg)

Public Member Functions

DSOEXPORT Handler ()
 ~Handler ()
bool sync ()
bool sync (int in_fd)
void setName (const std::string &x)
std::string & getName ()
int getActiveDiskStreams ()
< gnash::DiskStream
getDiskStream (int x)
void setDiskStream (int x, boost::shared_ptr< gnash::DiskStream > y)
void addSOL (boost::shared_ptr< cygnal::Element > x)
 Add a SharedObject.
size_t addClient (int fd, gnash::Network::protocols_supported_e proto)
void removeClient (int fd)
std::vector< int > & getClients ()
int getClient (int x)
int recvMsg (int fd)
 Receive a message from the other end of the network connection.
gnash::Network::protocols_supported_e getProtocol (int x)
void setProtocol (int fd, gnash::Network::protocols_supported_e x)
size_t addRemote (int x)
void setPlugin (boost::shared_ptr< Handler::cygnal_init_t > &init)
void setPlugin (Handler::cygnal_io_read_t read_ptr, Handler::cygnal_io_write_t write_ptr)
boost::shared_ptr< cygnal_init_tinitModule (const std::string &module)
 Initialize the named module within Cygnal.
bool initialized ()
boost::shared_ptr< cygnal::BufferreadFromPlugin ()
 This method reads raw data from a plugin.
size_t writeToPlugin (cygnal::Buffer &buf)
 This method writes raw data to a plugin.
size_t writeToPlugin (boost::uint8_t *data, size_t size)
double createStream (double transid)
double createStream (double transid, const std::string &filespec)
bool playStream ()
bool playStream (const std::string &filespec)
int publishStream ()
int publishStream (const std::string &filespec, pub_stream_e op)
int seekStream ()
int seekStream (int offset)
int pauseStream (double transid)
< gnash::DiskStream
findStream (const std::string &filespec)
int togglePause (double)
double resumeStream (double transid)
double closeStream (double transid)
double deleteStream (double transid)
void setFCSubscribe (const std::string &x)
std::string & getFCSubscribe ()
void setNetConnection (gnash::RTMPMsg *msg)
void setNetConnection (boost::shared_ptr< gnash::RTMPMsg > msg)
boost::shared_ptr< gnash::RTMPMsggetNetConnection ()
boost::shared_ptr< HTTPServer > & getHTTPHandler (int fd)
boost::shared_ptr< RTMPServergetRTMPHandler (int fd)
cygnal::BufferparseFirstRequest (int fd, gnash::Network::protocols_supported_e proto)
std::string & getKey (int x)
void setKey (int fd, std::string x)
void dump ()

Protected Attributes

std::string _name
int _streams
std::map< int,
< gnash::DiskStream > > 
std::map< int,
std::map< int,
boost::shared_ptr< HTTPServer > > 
std::map< int,
boost::shared_ptr< RTMPServer > > 
std::vector< int > _clients
std::vector< int > _remote
boost::shared_ptr< cygnal::Proc_local
boost::shared_ptr< cygnal_init_t_plugin
std::vector< boost::shared_ptr
< gnash::DiskStream > > 
std::vector< boost::shared_ptr
< cygnal::Element > > 
std::map< int, size_t > _bodysize
int _in_fd
std::string _fcsubscribe
boost::shared_ptr< gnash::RTMPMsg_netconnect
std::map< int, std::string > _keys

Member Typedef Documentation

typedef boost::shared_ptr<cygnal_init_t>(* cygnal::Handler::cygnal_io_init_t)(boost::shared_ptr< gnash::RTMPMsg > &msg)

This typedef is only used for the init function optionally supported by the plugin.

typedef boost::shared_ptr<cygnal::Buffer>(* cygnal::Handler::cygnal_io_read_t)()
typedef size_t(* cygnal::Handler::cygnal_io_write_t)(boost::uint8_t *data, size_t size)

This typedef is only used for the io function that must be supported by the plugin.

Member Enumeration Documentation

The Admin command sent by the client


This enum contains the possible values for streaming video types.


Constructor & Destructor Documentation

cygnal::Handler::Handler (  ) 
cygnal::Handler::~Handler (  ) 

Member Function Documentation

size_t cygnal::Handler::addClient ( int  fd,
gnash::Network::protocols_supported_e  proto 

addClient Add a client to the list for output messages for a resource. This also specifies the protocol handler required for data on this file descriptor.

References _clients, _http, _protocol, and _rtmp.

Referenced by connection_handler().

size_t cygnal::Handler::addRemote ( int  x  )  [inline]

addRemote Add a remote machine to the list for input messages.

References _remote.

void cygnal::Handler::addSOL ( boost::shared_ptr< cygnal::Element x  )  [inline]

Add a SharedObject.

References _sol.

double cygnal::Handler::closeStream ( double  transid  ) 

References _diskstreams.

double cygnal::Handler::createStream ( double  transid  ) 

References _diskstreams, and _streams.

double cygnal::Handler::createStream ( double  transid,
const std::string &  filespec 

References _diskstreams, and _streams.

double cygnal::Handler::deleteStream ( double  transid  ) 

References _diskstreams, and _streams.

void cygnal::Handler::dump (  ) 
boost::shared_ptr< gnash::DiskStream > cygnal::Handler::findStream ( const std::string &  filespec  ) 

References _diskstreams, _streams, and gnash::key::i.

int cygnal::Handler::getActiveDiskStreams (  )  [inline]

References _diskstreams.

Referenced by event_handler().

int cygnal::Handler::getClient ( int  x  )  [inline]

References _clients.

Referenced by event_handler().

cygnal::Handler::getClients (  )  [inline]

Get the vector of file descriptors for this handler.

References _clients.

Referenced by event_handler().

boost::shared_ptr<gnash::DiskStream> cygnal::Handler::getDiskStream ( int  x  )  [inline]
std::string& cygnal::Handler::getFCSubscribe (  )  [inline]

References _fcsubscribe.

boost::shared_ptr<HTTPServer>& cygnal::Handler::getHTTPHandler ( int  fd  )  [inline]

References _http.

Referenced by event_handler().

std::string& cygnal::Handler::getKey ( int  x  )  [inline]

References _keys.

Referenced by connection_handler().

std::string& cygnal::Handler::getName (  )  [inline]

References _name.

boost::shared_ptr<gnash::RTMPMsg> cygnal::Handler::getNetConnection (  )  [inline]

References _netconnect.

gnash::Network::protocols_supported_e cygnal::Handler::getProtocol ( int  x  )  [inline]

References _protocol.

Referenced by event_handler().

boost::shared_ptr<RTMPServer> cygnal::Handler::getRTMPHandler ( int  fd  )  [inline]

References _rtmp.

bool cygnal::Handler::initialized (  ) 

initialized See if any of the cgi-bins has been loaded.

References _clients, _files, _local, _plugin, and _remote.

boost::shared_ptr< Handler::cygnal_init_t > cygnal::Handler::initModule ( const std::string &  module  ) 
cygnal::Buffer * cygnal::Handler::parseFirstRequest ( int  fd,
gnash::Network::protocols_supported_e  proto 
int cygnal::Handler::pauseStream ( double  transid  ) 

References _diskstreams, and gnash::key::PAUSE.

cygnal::Handler::playStream (  ) 

Play the specified file as a stream

bool cygnal::Handler::playStream ( const std::string &  filespec  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References _diskstreams, _streams, and cygnal::CRcInitFile::getDocumentRoot().

int cygnal::Handler::publishStream (  ) 

References LIVE.

int cygnal::Handler::publishStream ( const std::string &  filespec,
Handler::pub_stream_e  op 
boost::shared_ptr< cygnal::Buffer > cygnal::Handler::readFromPlugin (  ) 

This method reads raw data from a plugin.

References _plugin.

int cygnal::Handler::recvMsg ( int  fd  ) 

Receive a message from the other end of the network connection.

fd The file descriptor to read from
The number of bytes sent

References _http, and _protocol.

void cygnal::Handler::removeClient ( int  fd  ) 

removeClient Remove a client from the list for messages.

References _clients.

Referenced by event_handler().

double cygnal::Handler::resumeStream ( double  transid  ) 

References togglePause().

int cygnal::Handler::seekStream ( int  offset  ) 
int cygnal::Handler::seekStream (  ) 
void cygnal::Handler::setDiskStream ( int  x,
boost::shared_ptr< gnash::DiskStream y 
) [inline]
void cygnal::Handler::setFCSubscribe ( const std::string &  x  )  [inline]

References _fcsubscribe.

void cygnal::Handler::setKey ( int  fd,
std::string  x 
) [inline]

References _keys.

void cygnal::Handler::setName ( const std::string &  x  )  [inline]

References _name.

void cygnal::Handler::setNetConnection ( boost::shared_ptr< gnash::RTMPMsg msg  )  [inline]

References _netconnect.

void cygnal::Handler::setNetConnection ( gnash::RTMPMsg msg  )  [inline]

References _netconnect.

void cygnal::Handler::setPlugin ( Handler::cygnal_io_read_t  read_ptr,
Handler::cygnal_io_write_t  write_ptr 

References _plugin.

void cygnal::Handler::setPlugin ( boost::shared_ptr< Handler::cygnal_init_t > &  init  ) 
void cygnal::Handler::setProtocol ( int  fd,
gnash::Network::protocols_supported_e  x 
) [inline]

References _protocol.

bool cygnal::Handler::sync ( int  in_fd  ) 
cygnal::Handler::sync (  )  [inline]

Send the onSync message to all connected clients

References _in_fd, and sync().

Referenced by sync().

int cygnal::Handler::togglePause ( double  streamid  ) 

References _diskstreams, and gnash::key::PAUSE.

Referenced by resumeStream().

size_t cygnal::Handler::writeToPlugin ( cygnal::Buffer buf  )  [inline]

This method writes raw data to a plugin.

References cygnal::Buffer::allocated(), and cygnal::Buffer::begin().

size_t cygnal::Handler::writeToPlugin ( boost::uint8_t *  data,
size_t  size 

References _plugin.

Member Data Documentation

std::map<int, size_t> cygnal::Handler::_bodysize [protected]

var _bodysize; is to store the body size of the previous packet for this channel. 4 and 1 byte heades don't use the length field, they just use the previous vaue for this field.

is the array of all clients connected to this server for this application. This is where all the output goes.

Referenced by addClient(), dump(), getClient(), getClients(), initialized(), and removeClient().

This is all the opened disk based files that are currently being streamed by the server.

Referenced by closeStream(), createStream(), deleteStream(), dump(), findStream(), getActiveDiskStreams(), getDiskStream(), pauseStream(), playStream(), setDiskStream(), and togglePause().

std::string cygnal::Handler::_fcsubscribe [protected]

Referenced by getFCSubscribe(), and setFCSubscribe().

std::vector<boost::shared_ptr<gnash::DiskStream> > cygnal::Handler::_files [protected]

Referenced by initialized().

std::map<int, boost::shared_ptr<HTTPServer> > cygnal::Handler::_http [protected]

The file descriptor of the incoming data for an Invoke message.

Referenced by sync().

std::map<int, std::string> cygnal::Handler::_keys [protected]

Referenced by getKey(), parseFirstRequest(), and setKey().

These are local process we're responsible for starting and stopping.

Referenced by initialized().

The name of the path this handler is supporting.

Referenced by getName(), and setName().

This store the data from the NetConnection ActionScript object we get as the final part of the handshake process that is used to set up the connection. This has all the file paths and other information needed by the server.

Referenced by getNetConnection(), initModule(), and setNetConnection().

boost::shared_ptr<cygnal_init_t> cygnal::Handler::_plugin [protected]

this is the map of which protocol is being used by which file descriptor.

Reimplemented from gnash::Network.

Referenced by addClient(), dump(), getProtocol(), recvMsg(), and setProtocol().

This is network connections to other processes, on other computers.

Referenced by addRemote(), and initialized().

std::map<int, boost::shared_ptr<RTMPServer> > cygnal::Handler::_rtmp [protected]

Referenced by addClient(), and getRTMPHandler().

cygnal::Handler::_sol [protected]

is for remote SharedObjects

Referenced by addSOL().

Each incoming request has one of 4 states the server has to handle to send a response.

This is a counter of how many streams have been allocated by the server.

Referenced by createStream(), deleteStream(), findStream(), and playStream().

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