Gnash
0.8.10
|
NetConnection ActionScript class. More...
#include <NetConnection_as.h>
Public Types | |
enum | StatusCode { CONNECT_FAILED, CONNECT_SUCCESS, CONNECT_CLOSED, CONNECT_REJECTED, CONNECT_APPSHUTDOWN, CALL_FAILED, CALL_BADVERSION } |
Public Member Functions | |
NetConnection_as (as_object *owner) | |
virtual | ~NetConnection_as () |
virtual void | update () |
Process connection stuff. | |
std::string | validateURL () const |
Make the stored URI into a valid and checked URL. | |
void | call (as_object *asCallback, const std::string &methodName, const std::vector< as_value > &args) |
void | close () |
Process the close() method. | |
bool | connect (const std::string &uri) |
Process the connect(uri) method. | |
void | connect () |
Carry out the connect(null) method. | |
void | setConnected () |
bool | isConnected () const |
void | setURI (const std::string &uri) |
const std::string & | getURI () const |
void | notifyStatus (StatusCode code) |
Notify the NetConnection onStatus handler of a change. | |
std::auto_ptr< IOChannel > | getStream (const std::string &name) |
Get an stream by name. | |
void | markReachableResources () const |
Mark responders associated with remoting calls. |
NetConnection ActionScript class.
Provides interfaces to load data from an URL
gnash::NetConnection_as::NetConnection_as | ( | as_object * | owner | ) |
gnash::NetConnection_as::~NetConnection_as | ( | ) | [virtual] |
void gnash::NetConnection_as::call | ( | as_object * | asCallback, |
const std::string & | methodName, | ||
const std::vector< as_value > & | args | ||
) |
References IF_VERBOSE_ASCODING_ERRORS, and _.
void gnash::NetConnection_as::close | ( | ) |
Process the close() method.
FIXME: This should close an active connection as well as setting the appropriate properties.
Queue the current call queue if it has pending calls
TODO: what should actually happen here? Should an attached NetStream object be interrupted?
References gnash::key::c, notifyStatus(), and CONNECT_CLOSED.
Referenced by connect().
bool gnash::NetConnection_as::connect | ( | const std::string & | uri | ) |
Process the connect(uri) method.
Return false if the connection is disallowed or invalid, true if a connection will be attempted.
References close(), assert, notifyStatus(), CONNECT_FAILED, gnash::getRunResources(), gnash::ActiveRelay::owner(), url, gnash::RunResources::streamProvider(), gnash::StreamProvider::baseURL(), gnash::StreamProvider::allow(), and _.
void gnash::NetConnection_as::connect | ( | ) |
Carry out the connect(null) method.
Called on NetConnection.connect(null).
There is no return because this attempt is always considered be be successful.
The status notification happens immediately, isConnected becomes true.
References close(), notifyStatus(), and CONNECT_SUCCESS.
std::auto_ptr< IOChannel > gnash::NetConnection_as::getStream | ( | const std::string & | name | ) |
Get an stream by name.
References gnash::getRunResources(), gnash::ActiveRelay::owner(), gnash::RunResources::streamProvider(), gnash::RcInitFile::getDefaultInstance(), url, gnash::StreamProvider::baseURL(), gnash::StreamProvider::getStream(), and gnash::RcInitFile::saveStreamingMedia().
Referenced by gnash::NetStream_as::play().
const std::string& gnash::NetConnection_as::getURI | ( | ) | const [inline] |
bool gnash::NetConnection_as::isConnected | ( | ) | const [inline] |
Referenced by gnash::NetStream_as::play().
void gnash::NetConnection_as::markReachableResources | ( | ) | const [virtual] |
Mark responders associated with remoting calls.
Reimplemented from gnash::ActiveRelay.
References gnash::ActiveRelay::owner(), gnash::GcResource::setReachable(), and gnash::renderer::opengl::for_each().
void gnash::NetConnection_as::notifyStatus | ( | StatusCode | code | ) |
Notify the NetConnection onStatus handler of a change.
This is a new normal object each time (see NetConnection.as)
References gnash::createObject(), gnash::getGlobal(), gnash::ActiveRelay::owner(), gnash::as_object::init_member(), and gnash::NSV::PROP_ON_STATUS.
void gnash::NetConnection_as::setConnected | ( | ) | [inline] |
void gnash::NetConnection_as::setURI | ( | const std::string & | uri | ) |
References gnash::ActiveRelay::owner(), and gnash::as_object::init_readonly_property().
void gnash::NetConnection_as::update | ( | ) | [virtual] |
Process connection stuff.
If there are no connections we can stop the timer.
Implements gnash::ActiveRelay.
References gnash::key::i.
std::string gnash::NetConnection_as::validateURL | ( | ) | const |
Make the stored URI into a valid and checked URL.
FIXME: this should not use _uri, but rather take a URL argument. Validation should probably be done on connect() only and return a bool indicating validity. That can be used to return a failure for invalid or blocked URLs.
References gnash::getRunResources(), gnash::ActiveRelay::owner(), gnash::RunResources::streamProvider(), gnash::StreamProvider::baseURL(), assert, gnash::StreamProvider::allow(), and _.