#include <handler.h>
Classes | |
struct | cygnal_init_t |
Public Types | |
enum | admin_cmd_e { UNKNOWN, STATUS, POLL, HELP, INTERVAL, QUIT } |
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 () |
boost::shared_ptr < 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_t > | initModule (const std::string &module) |
Initialize the named module within Cygnal. | |
bool | initialized () |
boost::shared_ptr< cygnal::Buffer > | readFromPlugin () |
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) |
boost::shared_ptr < 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::RTMPMsg > | getNetConnection () |
boost::shared_ptr< HTTPServer > & | getHTTPHandler (int fd) |
boost::shared_ptr< RTMPServer > | getRTMPHandler (int fd) |
cygnal::Buffer * | parseFirstRequest (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, boost::shared_ptr < gnash::DiskStream > > | _diskstreams |
std::map< int, gnash::Network::protocols_supported_e > | _protocol |
std::map< int, boost::shared_ptr< HTTPServer > > | _http |
std::map< int, boost::shared_ptr< RTMPServer > > | _rtmp |
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 > > | _files |
std::vector< boost::shared_ptr < cygnal::Element > > | _sol |
std::map< int, size_t > | _bodysize |
int | _in_fd |
std::string | _fcsubscribe |
boost::shared_ptr< gnash::RTMPMsg > | _netconnect |
std::map< int, std::string > | _keys |
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.
cygnal::Handler::Handler | ( | ) |
cygnal::Handler::~Handler | ( | ) |
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 | ( | ) |
References _clients, _diskstreams, _protocol, gnash::key::i, and proto_str.
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] |
References _diskstreams.
Referenced by event_handler(), and cygnal::HTTPServer::processGetRequest().
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 | ( | ) |
boost::shared_ptr< Handler::cygnal_init_t > cygnal::Handler::initModule | ( | const std::string & | module | ) |
Initialize the named module within Cygnal.
References _, _netconnect, _plugin, gnash::Extension::_plugins, gnash::Extension::_pluginsdir, gnash::SharedLib::getInitEntry(), info, lt_dlsetsearchpath(), and gnash::SharedLib::openLib().
cygnal::Buffer * cygnal::Handler::parseFirstRequest | ( | int | fd, | |
gnash::Network::protocols_supported_e | proto | |||
) |
References _http, _keys, gnash::HTTP::getField(), gnash::HTTP::getFilespec(), gnash::HTTP::processHeaderFields(), gnash::Network::readNet(), and gnash::Network::sniffBytesReady().
Referenced by connection_handler().
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, and _streams.
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 | ) |
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] |
References _diskstreams.
Referenced by cygnal::HTTPServer::http_handler().
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] |
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.
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.
cygnal::Handler::_clients [protected] |
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().
cygnal::Handler::_diskstreams [protected] |
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] |
Referenced by addClient(), getHTTPHandler(), parseFirstRequest(), and recvMsg().
cygnal::Handler::_in_fd [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().
cygnal::Handler::_local [protected] |
These are local process we're responsible for starting and stopping.
Referenced by initialized().
cygnal::Handler::_name [protected] |
cygnal::Handler::_netconnect [protected] |
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] |
Referenced by initialized(), initModule(), readFromPlugin(), setPlugin(), and writeToPlugin().
cygnal::Handler::_protocol [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().
cygnal::Handler::_remote [protected] |
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().
cygnal::Handler::_streams [protected] |
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().