Gnash  0.8.11dev
NetConnection_as.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_NETCONNECTION_H
20 #define GNASH_NETCONNECTION_H
21 
22 
23 #include <vector>
24 #include <string>
25 #include <list>
26 #include <memory>
27 
28 #include "Relay.h"
29 
30 // Forward declarations
31 namespace gnash {
32  class Connection;
33  class as_object;
34  class as_value;
35  class IOChannel;
36  struct ObjectURI;
37 }
38 
39 namespace gnash {
40 
42 //
46 {
47 public:
48 
50  {
58  };
59 
61 
62  virtual ~NetConnection_as();
63 
65  virtual void update();
66 
68  std::string validateURL() const;
69 
70  void call(as_object* asCallback, const std::string& methodName,
71  const std::vector<as_value>& args);
72 
74  void close();
75 
77  //
80  bool connect(const std::string& uri);
81 
83  //
86  void connect();
87 
88  void setConnected() {
89  _isConnected = true;
90  }
91 
92  bool isConnected() const {
93  return _isConnected;
94  }
95 
96  void setURI(const std::string& uri);
97 
98  const std::string& getURI() const {
99  return _uri;
100  }
101 
104 
106  std::unique_ptr<IOChannel> getStream(const std::string& name);
107 
109  void markReachableResources() const;
110 
111 private:
112 
113  bool isRTMP();
114 
115  void createStream(as_object* asCallback);
116 
118  void addToURL(const std::string& url);
119 
120  typedef std::list<std::unique_ptr<Connection> > Connections;
121 
123  //
128  Connections _oldConnections;
129 
131  std::unique_ptr<Connection> _currentConnection;
132 
134  std::string _uri;
135 
136  bool _isConnected;
137 
138  void startAdvanceTimer();
139 
140  void stopAdvanceTimer();
141 };
142 
143 void netconnection_class_init(as_object& global, const ObjectURI& uri);
144 
145 } // end of gnash namespace
146 
147 #endif
148 
149 // local Variables:
150 // mode: C++
151 // indent-tabs-mode: nil
152 // End:
void markReachableResources() const
Mark responders associated with remoting calls.
Definition: NetConnection_as.cpp:431
Definition: NetConnection_as.h:56
Definition: NetConnection_as.h:52
void setURI(const std::string &uri)
Definition: NetConnection_as.cpp:584
std::unique_ptr< IOChannel > getStream(const std::string &name)
Get an stream by name.
Definition: NetConnection_as.cpp:628
Definition: NetConnection_as.h:55
uri
Definition: test.py:12
std::string validateURL() const
Make the stored URI into a valid and checked URL.
Definition: NetConnection_as.cpp:444
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
The base class for all ActionScript objects.
Definition: as_object.h:161
Definition: NetConnection_as.h:54
virtual void update()
Process connection stuff.
Definition: NetConnection_as.cpp:675
NetConnection ActionScript class.
Definition: NetConnection_as.h:45
void netconnection_class_init(as_object &where, const ObjectURI &uri)
Definition: NetConnection_as.cpp:424
A URI for describing as_objects.
Definition: ObjectURI.h:44
code
Definition: GnashKey.h:43
void notifyStatus(StatusCode code)
Notify the NetConnection onStatus handler of a change.
Definition: NetConnection_as.cpp:464
bool isConnected() const
Definition: NetConnection_as.h:92
StatusCode
Definition: NetConnection_as.h:49
Definition: NetConnection_as.h:53
std::string url
Definition: gnash.cpp:59
as_object & owner() const
Return the as_object that this Relay is attached to.
Definition: Relay.h:108
Definition: NetConnection_as.h:51
void setConnected()
Definition: NetConnection_as.h:88
void connect()
Carry out the connect(null) method.
Definition: NetConnection_as.cpp:484
A native type that requires periodic updates from the core (movie_root).
Definition: Relay.h:79
const std::string & getURI() const
Definition: NetConnection_as.h:98
NetConnection_as(as_object *owner)
Definition: NetConnection_as.cpp:410
Definition: NetConnection_as.h:57
void call(as_object *asCallback, const std::string &methodName, const std::vector< as_value > &args)
Definition: NetConnection_as.cpp:591
virtual ~NetConnection_as()
Definition: NetConnection_as.cpp:418
std::string name
Definition: LocalConnection_as.cpp:149
void close()
Process the close() method.
Definition: NetConnection_as.cpp:563