Gnash
0.8.11dev
|
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. More... | |
std::string | validateURL () const |
Make the stored URI into a valid and checked URL. More... | |
void | call (as_object *asCallback, const std::string &methodName, const std::vector< as_value > &args) |
void | close () |
Process the close() method. More... | |
bool | connect (const std::string &uri) |
Process the connect(uri) method. More... | |
void | connect () |
Carry out the connect(null) method. More... | |
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. More... | |
std::unique_ptr< IOChannel > | getStream (const std::string &name) |
Get an stream by name. More... | |
void | markReachableResources () const |
Mark responders associated with remoting calls. More... | |
![]() | |
ActiveRelay (as_object *owner) | |
virtual | ~ActiveRelay () |
Make sure we are removed from the list of callbacks on destruction. More... | |
virtual void | setReachable () |
Mark any other reachable resources, and finally mark our owner. More... | |
virtual void | clean () |
Remove the ActiveRelay from movie_root's callback set. More... | |
as_object & | owner () const |
Return the as_object that this Relay is attached to. More... | |
![]() | |
virtual | ~Relay ()=0 |
Additional Inherited Members |
NetConnection ActionScript class.
Provides interfaces to load data from an URL
|
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 gnash::log_aserror().
Referenced by update().
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 CONNECT_CLOSED, and notifyStatus().
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 _, gnash::StreamProvider::allow(), gnash::StreamProvider::baseURL(), close(), CONNECT_FAILED, gnash::getRunResources(), gnash::log_error(), gnash::log_security(), gnash::log_unimpl(), notifyStatus(), gnash::ActiveRelay::owner(), gnash::RunResources::streamProvider(), and url.
Referenced by update().
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 gnash::StreamProvider::baseURL(), close(), CONNECT_SUCCESS, gnash::getRunResources(), notifyStatus(), gnash::ActiveRelay::owner(), gnash::RunResources::streamProvider(), and url.
std::unique_ptr< IOChannel > gnash::NetConnection_as::getStream | ( | const std::string & | name | ) |
Get an stream by name.
References gnash::movie_root::addAdvanceCallback(), gnash::StreamProvider::baseURL(), gnash::RcInitFile::getDefaultInstance(), gnash::getRoot(), gnash::getRunResources(), gnash::StreamProvider::getStream(), name, gnash::ActiveRelay::owner(), gnash::movie_root::removeAdvanceCallback(), gnash::RcInitFile::saveStreamingMedia(), gnash::RunResources::streamProvider(), and url.
Referenced by getURI(), and gnash::NetStream_as::play().
|
inline |
References getStream(), markReachableResources(), name, gnash::netconnection_class_init(), notifyStatus(), test::uri, and url.
Referenced by update().
|
inline |
References setURI(), and test::uri.
Referenced by gnash::BufferedAudioStreamer::cleanAudioQueue(), gnash::NetStream_as::play(), and update().
|
virtual |
Mark responders associated with remoting calls.
Reimplemented from gnash::ActiveRelay.
References gnash::renderer::opengl::for_each(), gnash::ActiveRelay::owner(), and gnash::GcResource::setReachable().
Referenced by getURI().
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::callMethod(), gnash::createObject(), gnash::getGlobal(), gnash::as_object::init_member(), gnash::ActiveRelay::owner(), and gnash::NSV::PROP_ON_STATUS.
|
inline |
void gnash::NetConnection_as::setURI | ( | const std::string & | uri | ) |
References gnash::as_object::init_readonly_property(), gnash::ActiveRelay::owner(), and test::uri.
Referenced by isConnected(), and update().
|
virtual |
Process connection stuff.
If there are no connections we can stop the timer.
Implements gnash::ActiveRelay.
References _, gnash::fn_call::arg(), call(), CALL_BADVERSION, CALL_FAILED, gnash::callMethod(), close(), connect(), CONNECT_APPSHUTDOWN, CONNECT_CLOSED, CONNECT_FAILED, CONNECT_REJECTED, CONNECT_SUCCESS, gnash::Global_as::createFunction(), gnash::fn_call::dump_args(), gnash::image::end(), gnash::key::f, gnash::fn_call::getArgs(), gnash::getGlobal(), gnash::getMember(), gnash::VM::getSWFVersion(), gnash::getSWFVersion(), getURI(), gnash::getVM(), gnash::key::i, IF_VERBOSE_ASCODING_ERRORS, gnash::as_object::init_member(), gnash::as_object::init_readonly_property(), gnash::as_value::is_null(), gnash::as_value::is_undefined(), isConnected(), gnash::log_aserror(), gnash::log_debug(), gnash::log_unimpl(), gnash::fn_call::nargs, NetConnection_as(), gnash::ActiveRelay::owner(), gnash::NSV::PROP_ON_STATUS, gnash::amf::readNetworkShort(), gnash::as_object::setRelay(), setURI(), gnash::fn_call::this_ptr, gnash::as_value::to_string(), gnash::toObject(), UNUSED, and test::uri.
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::StreamProvider::allow(), gnash::StreamProvider::baseURL(), gnash::getRunResources(), gnash::log_debug(), gnash::log_security(), gnash::ActiveRelay::owner(), gnash::RunResources::streamProvider(), and test::uri.