[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r12201: fix mass breakage of cygnal
From: |
Rob Savoye |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r12201: fix mass breakage of cygnal due to a namespace conflict. Rename amf namespace to cygnal, change everywhere it was referenced. |
Date: |
Thu, 27 May 2010 16:44:28 -0600 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 12201
committer: Rob Savoye <address@hidden>
branch nick: trunk
timestamp: Thu 2010-05-27 16:44:28 -0600
message:
fix mass breakage of cygnal due to a namespace conflict. Rename amf namespace
to cygnal, change everywhere it was referenced.
modified:
cygnal/cgi-bin/echo/echo.cpp
cygnal/cgi-bin/echo/echo.h
cygnal/cgi-bin/oflaDemo/oflaDemo.cpp
cygnal/cgi-bin/oflaDemo/oflaDemo.h
cygnal/cvm.cpp
cygnal/cygnal.cpp
cygnal/handler.cpp
cygnal/handler.h
cygnal/http_server.cpp
cygnal/http_server.h
cygnal/libamf/amf.cpp
cygnal/libamf/amf.h
cygnal/libamf/amf_msg.cpp
cygnal/libamf/amf_msg.h
cygnal/libamf/amftest.cpp
cygnal/libamf/amfutf8.h
cygnal/libamf/buffer.cpp
cygnal/libamf/buffer.h
cygnal/libamf/element.cpp
cygnal/libamf/element.h
cygnal/libamf/flv.cpp
cygnal/libamf/flv.h
cygnal/libamf/lcshm.cpp
cygnal/libamf/lcshm.h
cygnal/libamf/sol.cpp
cygnal/libamf/sol.h
cygnal/libnet/cache.h
cygnal/libnet/cque.cpp
cygnal/libnet/cque.h
cygnal/libnet/diskstream.cpp
cygnal/libnet/diskstream.h
cygnal/libnet/http.cpp
cygnal/libnet/http.h
cygnal/libnet/network.cpp
cygnal/libnet/network.h
cygnal/libnet/rtmp.cpp
cygnal/libnet/rtmp.h
cygnal/libnet/rtmp_client.cpp
cygnal/libnet/rtmp_client.h
cygnal/libnet/rtmp_msg.cpp
cygnal/libnet/rtmp_msg.h
cygnal/rtmp_server.cpp
cygnal/rtmp_server.h
cygnal/serverSO.h
=== modified file 'cygnal/cgi-bin/echo/echo.cpp'
--- a/cygnal/cgi-bin/echo/echo.cpp 2010-03-13 13:10:42 +0000
+++ b/cygnal/cgi-bin/echo/echo.cpp 2010-05-27 22:44:28 +0000
@@ -35,7 +35,6 @@
#include "cygnal.h"
#include "handler.h"
-using namespace amf;
using namespace gnash;
using namespace std;
using namespace cygnal;
@@ -71,11 +70,11 @@
return init;
}
- boost::shared_ptr<amf::Buffer> echo_read_func()
+ boost::shared_ptr<cygnal::Buffer> echo_read_func()
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf = echo.getResponse();
+ boost::shared_ptr<cygnal::Buffer> buf = echo.getResponse();
// log_network("%s", hexify(data, safe, true));
@@ -88,9 +87,9 @@
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf = echo.getResponse();
+ boost::shared_ptr<cygnal::Buffer> buf = echo.getResponse();
- vector<boost::shared_ptr<amf::Element> > request =
+ vector<boost::shared_ptr<cygnal::Element> > request =
echo.parseEchoRequest(data, size);
if (request[3]) {
buf = echo.formatEchoResponse(request[1]->to_number(),
*request[3]);
@@ -179,7 +178,7 @@
// This is the main message processing loop for rtmp. All message received
require
// a response.
do {
- boost::shared_ptr<amf::Buffer> bufptr(new amf::Buffer);
+ boost::shared_ptr<cygnal::Buffer> bufptr(new cygnal::Buffer);
if (infile.empty()) {
net.readNet(netfd, *bufptr);
} else {
@@ -191,10 +190,10 @@
}
}
- vector<boost::shared_ptr<amf::Element> > request =
net.parseEchoRequest(
+ vector<boost::shared_ptr<cygnal::Element> > request =
net.parseEchoRequest(
bufptr->reference(), bufptr->allocated());
if (request[3]) {
- boost::shared_ptr<amf::Buffer> result =
net.formatEchoResponse(request[1]->to_number(), *request[3]);
+ boost::shared_ptr<cygnal::Buffer> result =
net.formatEchoResponse(request[1]->to_number(), *request[3]);
if (net.writeNet(netfd, *result)) {
log_debug("Sent echo test response response to client.");
}
@@ -217,31 +216,31 @@
// Parse an Echo Request message coming from the Red5 echo_test. This
// method should only be used for testing purposes.
-vector<boost::shared_ptr<amf::Element > >
+vector<boost::shared_ptr<cygnal::Element > >
EchoTest::parseEchoRequest(boost::uint8_t *ptr, size_t size)
{
// GNASH_REPORT_FUNCTION;
- amf::AMF amf;
- vector<boost::shared_ptr<amf::Element > > headers;
+ cygnal::AMF amf;
+ vector<boost::shared_ptr<cygnal::Element > > headers;
// The first element is the name of the test, 'echo'
- boost::shared_ptr<amf::Element> el1 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el1 = amf.extractAMF(ptr, ptr+size);
ptr += amf.totalsize();
headers.push_back(el1);
// The second element is the number of the test,
- boost::shared_ptr<amf::Element> el2 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el2 = amf.extractAMF(ptr, ptr+size);
ptr += amf.totalsize();
headers.push_back(el2);
// This one has always been a NULL object from my tests
- boost::shared_ptr<amf::Element> el3 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el3 = amf.extractAMF(ptr, ptr+size);
ptr += amf.totalsize();
headers.push_back(el3);
// This one has always been an NULL or Undefined object from my tests
- boost::shared_ptr<amf::Element> el4 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el4 = amf.extractAMF(ptr, ptr+size);
if (!el4) {
log_error("Couldn't reliably extract the echo data!");
}
@@ -255,11 +254,11 @@
// is only used for testing by developers. The format appears to be
// a string '_result', followed by the number of the test, and then two
// NULL objects.
-boost::shared_ptr<amf::Buffer>
-EchoTest::formatEchoResponse(double num, amf::Element &el)
+boost::shared_ptr<cygnal::Buffer>
+EchoTest::formatEchoResponse(double num, cygnal::Element &el)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> data = amf::AMF::encodeElement(el);
+ boost::shared_ptr<cygnal::Buffer> data = cygnal::AMF::encodeElement(el);
if (data) {
return formatEchoResponse(num, data->reference(), data->allocated());
} else {
@@ -270,14 +269,14 @@
return data;
}
-boost::shared_ptr<amf::Buffer>
-EchoTest::formatEchoResponse(double num, amf::Buffer &data)
+boost::shared_ptr<cygnal::Buffer>
+EchoTest::formatEchoResponse(double num, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return formatEchoResponse(num, data.reference(), data.allocated());
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
EchoTest::formatEchoResponse(double num, boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
@@ -292,11 +291,11 @@
Element null;
null.makeNull();
- boost::shared_ptr<amf::Buffer> encecho = echo.encode();
- boost::shared_ptr<amf::Buffer> encidx = index.encode();
- boost::shared_ptr<amf::Buffer> encnull = null.encode();
+ boost::shared_ptr<cygnal::Buffer> encecho = echo.encode();
+ boost::shared_ptr<cygnal::Buffer> encidx = index.encode();
+ boost::shared_ptr<cygnal::Buffer> encnull = null.encode();
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(encecho->size()
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(encecho->size()
+ encidx->size()
+ encnull->size() +
size));
=== modified file 'cygnal/cgi-bin/echo/echo.h'
--- a/cygnal/cgi-bin/echo/echo.h 2010-03-11 01:47:08 +0000
+++ b/cygnal/cgi-bin/echo/echo.h 2010-05-27 22:44:28 +0000
@@ -46,24 +46,24 @@
~EchoTest ();
// Parse an Echo Request message coming from the Red5 echo_test.
- std::vector<boost::shared_ptr<amf::Element > >
parseEchoRequest(amf::Buffer &buf)
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseEchoRequest(cygnal::Buffer &buf)
{ return parseEchoRequest(buf.reference(), buf.size()); };
- std::vector<boost::shared_ptr<amf::Element > >
parseEchoRequest(boost::uint8_t *buf, size_t size);
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseEchoRequest(boost::uint8_t *buf, size_t size);
// format a response to the 'echo' test used for testing Gnash.
- boost::shared_ptr<amf::Buffer> formatEchoResponse(double num, amf::Element
&el);
- boost::shared_ptr<amf::Buffer> formatEchoResponse(double num, amf::Buffer
&data);
- boost::shared_ptr<amf::Buffer> formatEchoResponse(double num,
boost::uint8_t *data, size_t size);
+ boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num,
cygnal::Element &el);
+ boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num,
cygnal::Buffer &data);
+ boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num,
boost::uint8_t *data, size_t size);
- boost::shared_ptr<amf::Buffer> getResponse() { return _response; };
- void setResponse(boost::shared_ptr<amf::Buffer> &x) { _response = x; };
+ boost::shared_ptr<cygnal::Buffer> getResponse() { return _response; };
+ void setResponse(boost::shared_ptr<cygnal::Buffer> &x) { _response = x; };
void setNetConnection(gnash::RTMPMsg *msg) { _netconnect.reset(msg); };
void setNetConnection(boost::shared_ptr<gnash::RTMPMsg> msg) { _netconnect
= msg; };
boost::shared_ptr<gnash::RTMPMsg> getNetConnection() { return
_netconnect;};
private:
- boost::shared_ptr<amf::Buffer> _response;
+ boost::shared_ptr<cygnal::Buffer> _response;
boost::shared_ptr<Handler::cygnal_init_t> _info;
/// \var _netconnect
/// This store the data from the NetConnection ActionScript
@@ -77,7 +77,7 @@
extern "C" {
boost::shared_ptr<Handler::cygnal_init_t>echo_init_func(boost::shared_ptr<gnash::RTMPMsg>
&msg);
- boost::shared_ptr<amf::Buffer> echo_read_func();
+ boost::shared_ptr<cygnal::Buffer> echo_read_func();
size_t echo_write_func(boost::uint8_t *data, size_t size);
}
=== modified file 'cygnal/cgi-bin/oflaDemo/oflaDemo.cpp'
--- a/cygnal/cgi-bin/oflaDemo/oflaDemo.cpp 2010-03-13 13:10:42 +0000
+++ b/cygnal/cgi-bin/oflaDemo/oflaDemo.cpp 2010-05-27 22:44:28 +0000
@@ -86,7 +86,6 @@
# endif
#endif
-using namespace amf;
using namespace gnash;
using namespace std;
using namespace cygnal;
@@ -125,11 +124,11 @@
return init;
}
- boost::shared_ptr<amf::Buffer> oflaDemo_read_func()
+ boost::shared_ptr<cygnal::Buffer> oflaDemo_read_func()
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf = oflaDemo.getResponse();
+ boost::shared_ptr<cygnal::Buffer> buf = oflaDemo.getResponse();
// log_network("%s", hexify(data, safe, true));
return buf;
@@ -141,23 +140,23 @@
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf = oflaDemo.getResponse();
+ boost::shared_ptr<cygnal::Buffer> buf = oflaDemo.getResponse();
- vector<boost::shared_ptr<amf::Element> > request =
+ vector<boost::shared_ptr<cygnal::Element> > request =
oflaDemo.parseOflaDemoRequest(data, size);
if (request.size() == 0) {
// Send the packet to notify the client that the
// NetConnection::connect() was sucessful. After the client
// receives this, the handhsake is completed.
- boost::shared_ptr<amf::Buffer> error =
+ boost::shared_ptr<cygnal::Buffer> error =
oflaDemo.encodeResult(RTMPMsg::NC_CALL_FAILED);
// This builds the full header,which is required as the first part
// of the packet.
- boost::shared_ptr<amf::Buffer> head = oflaDemo.encodeHeader(0x3,
+ boost::shared_ptr<cygnal::Buffer> head = oflaDemo.encodeHeader(0x3,
RTMP::HEADER_12, error->allocated(),
RTMP::INVOKE, RTMPMsg::FROM_SERVER);
- boost::scoped_ptr<amf::Buffer> response(new amf::Buffer(
+ boost::scoped_ptr<cygnal::Buffer> response(new cygnal::Buffer(
error->allocated() + head->allocated()));
*response = head;
*response += error;
@@ -251,7 +250,7 @@
// This is the main message processing loop for rtmp. All message received
require
// a response.
do {
- boost::shared_ptr<amf::Buffer> bufptr(new amf::Buffer);
+ boost::shared_ptr<cygnal::Buffer> bufptr(new cygnal::Buffer);
if (infile.empty()) {
net.readNet(netfd, *bufptr);
} else {
@@ -263,10 +262,10 @@
}
}
- vector<boost::shared_ptr<amf::Element> > request =
net.parseOflaDemoRequest(
+ vector<boost::shared_ptr<cygnal::Element> > request =
net.parseOflaDemoRequest(
bufptr->reference(), bufptr->allocated());
if (request[3]) {
- boost::shared_ptr<amf::Buffer> result =
net.formatOflaDemoResponse(request[1]->to_number(), *request[3]);
+ boost::shared_ptr<cygnal::Buffer> result =
net.formatOflaDemoResponse(request[1]->to_number(), *request[3]);
if (net.writeNet(netfd, *result)) {
log_debug("Sent oflaDemo test response response to client.");
}
@@ -386,16 +385,16 @@
// Parse an OflaDemo Request message coming from the Red5 oflaDemo_test. This
// method should only be used for testing purposes.
-vector<boost::shared_ptr<amf::Element > >
+vector<boost::shared_ptr<cygnal::Element > >
OflaDemoTest::parseOflaDemoRequest(boost::uint8_t *ptr, size_t size)
{
GNASH_REPORT_FUNCTION;
demoService demo;
- amf::AMF amf;
- vector<boost::shared_ptr<amf::Element > > headers;
+ cygnal::AMF amf;
+ vector<boost::shared_ptr<cygnal::Element > > headers;
- boost::shared_ptr<amf::Element> el1 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el1 = amf.extractAMF(ptr, ptr+size);
if (!el1) {
log_error("No AMF data in message!");
return headers;
@@ -406,7 +405,7 @@
headers.push_back(el1);
// The second element is a number
- boost::shared_ptr<amf::Element> el2 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el2 = amf.extractAMF(ptr, ptr+size);
if (!el2) {
log_error("No AMF data in message!");
return headers;
@@ -417,9 +416,9 @@
if (method == "demoService.getListOfAvailableFLVs") {
// Get the path from the NetConnection object we recieved from the
// client at the end of the handshake process.
- boost::shared_ptr<amf::Element> version;
- boost::shared_ptr<amf::Element> tcurl;
- boost::shared_ptr<amf::Element> swfurl;
+ boost::shared_ptr<cygnal::Element> version;
+ boost::shared_ptr<cygnal::Element> tcurl;
+ boost::shared_ptr<cygnal::Element> swfurl;
boost::shared_ptr<gnash::RTMPMsg> msg = getNetConnection();
if (msg) {
@@ -455,24 +454,24 @@
toparr.makeECMAArray();
size_t total_size = 0;
- vector<boost::shared_ptr<amf::Buffer> > buffers;
+ vector<boost::shared_ptr<cygnal::Buffer> > buffers;
for (it=mediafiles.begin(); it<mediafiles.end(); ++it) {
- vector<boost::shared_ptr<amf::Element> > data;
+ vector<boost::shared_ptr<cygnal::Element> > data;
boost::shared_ptr<demoService::filestats_t> file = *it;
- boost::shared_ptr<amf::Element> obj(new amf::Element);
+ boost::shared_ptr<cygnal::Element> obj(new cygnal::Element);
obj->makeECMAArray();
obj->setName(file->name);
- boost::shared_ptr<amf::Element> modified(new amf::Element);
+ boost::shared_ptr<cygnal::Element> modified(new
cygnal::Element);
modified->makeString("lastModified", file->last);
obj->addProperty(modified);
- boost::shared_ptr<amf::Element> name(new amf::Element);
+ boost::shared_ptr<cygnal::Element> name(new cygnal::Element);
name->makeString("name", file->name);
obj->addProperty(name);
- boost::shared_ptr<amf::Element> size(new amf::Element);
+ boost::shared_ptr<cygnal::Element> size(new cygnal::Element);
size->makeString("size", file->size);
obj->addProperty(size);
@@ -480,31 +479,31 @@
toparr.addProperty(obj);
}
- boost::shared_ptr<amf::Buffer> topenc = toparr.encode();
+ boost::shared_ptr<cygnal::Buffer> topenc = toparr.encode();
total_size += topenc->allocated();
// Start with the method name for the INVOKE
- amf::Element method;
+ cygnal::Element method;
method.makeString("_result");
- boost::shared_ptr<amf::Buffer> methodenc = method.encode();
+ boost::shared_ptr<cygnal::Buffer> methodenc = method.encode();
total_size += methodenc->allocated();
// Add the stream ID
- amf::Element sid;
+ cygnal::Element sid;
sid.makeNumber(2); // FIXME: needs a real value!
- boost::shared_ptr<amf::Buffer> sidenc = sid.encode();
+ boost::shared_ptr<cygnal::Buffer> sidenc = sid.encode();
total_size += sidenc->allocated();
// There there is always a NULL object to start the data
Element null;
null.makeNull();
- boost::shared_ptr<amf::Buffer> encnull = null.encode();
+ boost::shared_ptr<cygnal::Buffer> encnull = null.encode();
total_size += encnull->allocated();
- boost::shared_ptr<amf::Buffer> result(new
amf::Buffer(total_size+amf::AMF_HEADER_SIZE+RTMP_MAX_HEADER_SIZE+10));
- _response.reset(new
amf::Buffer(total_size+amf::AMF_HEADER_SIZE+RTMP_MAX_HEADER_SIZE+10));
+ boost::shared_ptr<cygnal::Buffer> result(new
cygnal::Buffer(total_size+cygnal::AMF_HEADER_SIZE+RTMP_MAX_HEADER_SIZE+10));
+ _response.reset(new
cygnal::Buffer(total_size+cygnal::AMF_HEADER_SIZE+RTMP_MAX_HEADER_SIZE+10));
#if 0
- boost::shared_ptr<amf::Buffer> head = encodeHeader(0x3,
+ boost::shared_ptr<cygnal::Buffer> head = encodeHeader(0x3,
RTMP::HEADER_8, total_size,
RTMP::INVOKE, RTMPMsg::FROM_SERVER);
*result = head;
@@ -516,11 +515,11 @@
#if 0
// Followed by all the encoded objects and properties
- vector<boost::shared_ptr<amf::Buffer> >::iterator rit;
+ vector<boost::shared_ptr<cygnal::Buffer> >::iterator rit;
for (rit=buffers.begin(); rit<buffers.end(); ++rit) {
- boost::shared_ptr<amf::Buffer> buf = *rit;
+ boost::shared_ptr<cygnal::Buffer> buf = *rit;
*_response += buf;
- std::vector<boost::shared_ptr<amf::Element> > data1;
+ std::vector<boost::shared_ptr<cygnal::Element> > data1;
}
#endif
}
@@ -535,11 +534,11 @@
// is only used for testing by developers. The format appears to be
// a string '_result', followed by the number of the test, and then two
// NULL objects.
-boost::shared_ptr<amf::Buffer>
-OflaDemoTest::formatOflaDemoResponse(double num, amf::Element &el)
+boost::shared_ptr<cygnal::Buffer>
+OflaDemoTest::formatOflaDemoResponse(double num, cygnal::Element &el)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> data = amf::AMF::encodeElement(el);
+ boost::shared_ptr<cygnal::Buffer> data = cygnal::AMF::encodeElement(el);
if (data) {
return formatOflaDemoResponse(num, data->reference(),
data->allocated());
} else {
@@ -550,14 +549,14 @@
return data;
}
-boost::shared_ptr<amf::Buffer>
-OflaDemoTest::formatOflaDemoResponse(double num, amf::Buffer &data)
+boost::shared_ptr<cygnal::Buffer>
+OflaDemoTest::formatOflaDemoResponse(double num, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return formatOflaDemoResponse(num, data.reference(), data.allocated());
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
OflaDemoTest::formatOflaDemoResponse(double num, boost::uint8_t *data, size_t
size)
{
// GNASH_REPORT_FUNCTION;
@@ -572,11 +571,11 @@
Element null;
null.makeNull();
- boost::shared_ptr<amf::Buffer> encoflaDemo = oflaDemo.encode();
- boost::shared_ptr<amf::Buffer> encidx = index.encode();
- boost::shared_ptr<amf::Buffer> encnull = null.encode();
+ boost::shared_ptr<cygnal::Buffer> encoflaDemo = oflaDemo.encode();
+ boost::shared_ptr<cygnal::Buffer> encidx = index.encode();
+ boost::shared_ptr<cygnal::Buffer> encnull = null.encode();
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(encoflaDemo->size()
+ boost::shared_ptr<cygnal::Buffer> buf(new
cygnal::Buffer(encoflaDemo->size()
+ encidx->size()
+ encnull->size() +
size));
=== modified file 'cygnal/cgi-bin/oflaDemo/oflaDemo.h'
--- a/cygnal/cgi-bin/oflaDemo/oflaDemo.h 2010-03-10 16:37:25 +0000
+++ b/cygnal/cgi-bin/oflaDemo/oflaDemo.h 2010-05-27 22:44:28 +0000
@@ -73,17 +73,17 @@
~OflaDemoTest ();
// Parse an OflaDemo Request message coming from the Red5 oflaDemo_test.
- std::vector<boost::shared_ptr<amf::Element > >
parseOflaDemoRequest(amf::Buffer &buf)
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseOflaDemoRequest(cygnal::Buffer &buf)
{ return parseOflaDemoRequest(buf.reference(), buf.size()); };
- std::vector<boost::shared_ptr<amf::Element > >
parseOflaDemoRequest(boost::uint8_t *buf, size_t size);
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseOflaDemoRequest(boost::uint8_t *buf, size_t size);
// format a response to the 'oflaDemo' test used for testing Gnash.
- boost::shared_ptr<amf::Buffer> formatOflaDemoResponse(double num,
amf::Element &el);
- boost::shared_ptr<amf::Buffer> formatOflaDemoResponse(double num,
amf::Buffer &data);
- boost::shared_ptr<amf::Buffer> formatOflaDemoResponse(double num,
boost::uint8_t *data, size_t size);
+ boost::shared_ptr<cygnal::Buffer> formatOflaDemoResponse(double num,
cygnal::Element &el);
+ boost::shared_ptr<cygnal::Buffer> formatOflaDemoResponse(double num,
cygnal::Buffer &data);
+ boost::shared_ptr<cygnal::Buffer> formatOflaDemoResponse(double num,
boost::uint8_t *data, size_t size);
- boost::shared_ptr<amf::Buffer> getResponse() { return _response; };
- void setResponse(boost::shared_ptr<amf::Buffer> &x) { _response = x; };
+ boost::shared_ptr<cygnal::Buffer> getResponse() { return _response; };
+ void setResponse(boost::shared_ptr<cygnal::Buffer> &x) { _response = x; };
void setNetConnection(gnash::RTMPMsg *msg) { _netconnect.reset(msg); };
void setNetConnection(boost::shared_ptr<gnash::RTMPMsg> msg) { _netconnect
= msg; };
@@ -96,7 +96,7 @@
/// file paths and other information needed by the server.
boost::shared_ptr<gnash::RTMPMsg> _netconnect;
private:
- boost::shared_ptr<amf::Buffer> _response;
+ boost::shared_ptr<cygnal::Buffer> _response;
boost::shared_ptr<Handler::cygnal_init_t> _info;
};
@@ -104,7 +104,7 @@
extern "C" {
boost::shared_ptr<Handler::cygnal_init_t>oflaDemo_init_func(boost::shared_ptr<gnash::RTMPMsg>
&msg);
- boost::shared_ptr<amf::Buffer> oflaDemo_read_func();
+ boost::shared_ptr<cygnal::Buffer> oflaDemo_read_func();
size_t oflaDemo_write_func(boost::uint8_t *data, size_t size);
}
=== modified file 'cygnal/cvm.cpp'
--- a/cygnal/cvm.cpp 2010-03-11 17:15:38 +0000
+++ b/cygnal/cvm.cpp 2010-05-27 22:44:28 +0000
@@ -447,7 +447,7 @@
md->completeLoad();
- m.init(md.get(), MovieClip::MovieVariables());
+ m.init(md.get(), MovieClip::MovieVariables(), MovieClip::MovieVariables());
if ( quitrequested ) { // setRootMovie would execute actions in first frame
quitrequested = false;
return md;
=== modified file 'cygnal/cygnal.cpp'
--- a/cygnal/cygnal.cpp 2010-03-14 00:29:46 +0000
+++ b/cygnal/cygnal.cpp 2010-05-27 22:44:28 +0000
@@ -102,7 +102,6 @@
using namespace std;
using namespace gnash;
using namespace cygnal;
-using namespace amf;
static void usage();
static void version_and_copyright();
@@ -840,7 +839,7 @@
HTTPServer *http = new HTTPServer;
hargs.entry = http;
http->setDocRoot(crcfile.getDocumentRoot());
- boost::shared_ptr<amf::Buffer> buf(http->peekChunk());
+ boost::shared_ptr<cygnal::Buffer> buf(http->peekChunk());
http->processHeaderFields(*buf);
string hostname, path;
string::size_type pos = http->getField("host").find(":", 0);
@@ -858,7 +857,7 @@
hand = new Handler;
hand->addClient(args->netfd, Network::HTTP);
int retries = 10;
- amf::Buffer *buf = 0;
+ cygnal::Buffer *buf = 0;
do {
buf = hand->parseFirstRequest(args->netfd, Network::HTTP);
if (!buf) {
@@ -902,7 +901,7 @@
rargs->protocol = args->protocol;
rargs->netfd = args->netfd;
RTMPServer *rtmp = new RTMPServer;
- boost::shared_ptr<amf::Element> tcurl =
+ boost::shared_ptr<cygnal::Element> tcurl =
rtmp->processClientHandShake(args->netfd);
if (!tcurl) {
// log_error("Couldn't read the tcUrl variable!");
=== modified file 'cygnal/handler.cpp'
--- a/cygnal/handler.cpp 2010-02-09 21:15:33 +0000
+++ b/cygnal/handler.cpp 2010-05-27 22:44:28 +0000
@@ -138,13 +138,13 @@
// Parse the first nessages when starting a new message handler,
// which is used to determine the name of the resource to
// initialize, or load from the cache.
-amf::Buffer *
+cygnal::Buffer *
Handler::parseFirstRequest(int fd, gnash::Network::protocols_supported_e proto)
{
GNASH_REPORT_FUNCTION;
string key;
Network net;
- amf::Buffer *buf = 0;
+ cygnal::Buffer *buf = 0;
boost::mutex::scoped_lock lock(_mutex);
switch (proto) {
@@ -174,7 +174,7 @@
HTTPServer http;
size_t bytes = http.sniffBytesReady(fd);
if (bytes) {
- buf = new amf::Buffer(bytes);
+ buf = new cygnal::Buffer(bytes);
} else {
return 0;
}
@@ -367,12 +367,12 @@
return ret;
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
Handler::readFromPlugin()
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
if (_plugin) {
buf = _plugin->read_func();
}
=== modified file 'cygnal/handler.h'
--- a/cygnal/handler.h 2010-03-11 01:47:08 +0000
+++ b/cygnal/handler.h 2010-05-27 22:44:28 +0000
@@ -91,7 +91,7 @@
/// This typedef is only used for the io function that must be
/// supported by the plugin.
typedef size_t (*cygnal_io_write_t)(boost::uint8_t *data, size_t size);
- typedef boost::shared_ptr<amf::Buffer> (*cygnal_io_read_t)();
+ typedef boost::shared_ptr<cygnal::Buffer> (*cygnal_io_read_t)();
typedef struct {
std::string version;
std::string description;
@@ -128,7 +128,7 @@
void setDiskStream(int x, boost::shared_ptr<gnash::DiskStream> y) {
_diskstreams[x] = y; }
/// Add a SharedObject
- void addSOL(boost::shared_ptr<amf::Element> x) {
+ void addSOL(boost::shared_ptr<cygnal::Element> x) {
_sol.push_back(x);
};
@@ -174,10 +174,10 @@
bool initialized();
/// This method reads raw data from a plugin.
- boost::shared_ptr<amf::Buffer> readFromPlugin();
+ boost::shared_ptr<cygnal::Buffer> readFromPlugin();
/// This method writes raw data to a plugin.
- size_t writeToPlugin(amf::Buffer &buf) {
+ size_t writeToPlugin(cygnal::Buffer &buf) {
return writeToPlugin(buf.begin(), buf.allocated()); };
size_t writeToPlugin(boost::uint8_t *data, size_t size);
@@ -243,7 +243,7 @@
// Parse the first nessages when starting a new message handler,
// which is used to determine the name of the resource to
// initialize, or load from the cache.
- amf::Buffer *parseFirstRequest(int fd,
gnash::Network::protocols_supported_e proto);
+ cygnal::Buffer *parseFirstRequest(int fd,
gnash::Network::protocols_supported_e proto);
std::string &getKey(int x) { return _keys[x]; };
void setKey(int fd, std::string x) { _keys[fd] = x; };
@@ -295,7 +295,7 @@
std::vector<boost::shared_ptr<gnash::DiskStream> > _files;
/// \var _sol
/// is for remote SharedObjects
- std::vector<boost::shared_ptr<amf::Element> > _sol;
+ std::vector<boost::shared_ptr<cygnal::Element> > _sol;
///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,
=== modified file 'cygnal/http_server.cpp'
--- a/cygnal/http_server.cpp 2010-01-19 23:57:51 +0000
+++ b/cygnal/http_server.cpp 2010-05-27 22:44:28 +0000
@@ -91,18 +91,18 @@
{
GNASH_REPORT_FUNCTION;
- amf::Buffer *buf = new amf::Buffer;
+ cygnal::Buffer *buf = new cygnal::Buffer;
// return processClientRequest(fd, buf);
return HTTP::HTTP_NONE;
}
HTTP::http_method_e
-HTTPServer::processClientRequest(Handler *hand, int fd, amf::Buffer *buf)
+HTTPServer::processClientRequest(Handler *hand, int fd, cygnal::Buffer *buf)
{
GNASH_REPORT_FUNCTION;
- amf::Buffer result;
+ cygnal::Buffer result;
if (buf) {
_cmd = extractCommand(buf->reference());
@@ -178,8 +178,8 @@
}
// A GET request asks the server to send a file to the client
-amf::Buffer &
-HTTPServer::processGetRequest(Handler *hand, int fd, amf::Buffer *buf)
+cygnal::Buffer &
+HTTPServer::processGetRequest(Handler *hand, int fd, cygnal::Buffer *buf)
{
GNASH_REPORT_FUNCTION;
@@ -191,7 +191,7 @@
if (buf == 0) {
// log_debug("Que empty, net connection dropped for fd #%d",
getFileFd());
log_debug("Que empty, net connection dropped for fd #%d", fd);
- amf::Buffer buf;
+ cygnal::Buffer buf;
return buf;
}
@@ -237,7 +237,7 @@
// Create the reply message
// _close = true; Force sending the close connection in the header
- amf::Buffer &reply = formatHeader(_diskstream->getFileType(),
+ cygnal::Buffer &reply = formatHeader(_diskstream->getFileType(),
_diskstream->getFileSize(),
HTTPServer::OK);
@@ -269,14 +269,14 @@
// A POST request asks sends a data from the client to the server. After
processing
// the header like we normally do, we then read the amount of bytes specified
by
// the "content-length" field, and then write that data to disk, or decode the
amf.
-boost::shared_ptr<amf::Buffer>
-HTTPServer::processPostRequest(int fd, amf::Buffer *bufFIXME)
+boost::shared_ptr<cygnal::Buffer>
+HTTPServer::processPostRequest(int fd, cygnal::Buffer *bufFIXME)
{
GNASH_REPORT_FUNCTION;
// cerr << "QUE1 = " << _que.size() << endl;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
if (_que.size() == 0) {
return buf;
@@ -292,7 +292,7 @@
clearHeader();
boost::uint8_t *data = processHeaderFields(buf.get());
size_t length = strtol(getField("content-length").c_str(), NULL, 0);
- boost::shared_ptr<amf::Buffer> content(new amf::Buffer(length));
+ boost::shared_ptr<cygnal::Buffer> content(new cygnal::Buffer(length));
int ret = 0;
if (buf->allocated() - (data - buf->reference()) ) {
// cerr << "Don't need to read more data: have " << buf->allocated() << "
bytes" << endl;
@@ -315,7 +315,7 @@
log_debug("Got AMF data in POST");
#if 0
amf::AMF amf;
- boost::shared_ptr<amf::Element> el =
amf.extractAMF(content.reference(), content.end());
+ boost::shared_ptr<cygnal::Element> el =
amf.extractAMF(content.reference(), content.end());
el->dump(); // FIXME: do something intelligent
// with this Element
#endif
@@ -336,17 +336,17 @@
cgis.startCGI(_filespec, true, CGIBIN_PORT);
cgis.createClient("localhost", CGIBIN_PORT);
cgis.writeNet(*content);
- boost::shared_ptr<amf::Buffer> reply = cgis.readNet();
+ boost::shared_ptr<cygnal::Buffer> reply = cgis.readNet();
writeNet(fd, *reply);
// cgis.stopCGI(_filespec);
#else
- vector<boost::shared_ptr<amf::Element> > headers =
parseEchoRequest(*content);
- //boost::shared_ptr<amf::Element> &el0 = headers[0];
+ vector<boost::shared_ptr<cygnal::Element> > headers =
parseEchoRequest(*content);
+ //boost::shared_ptr<cygnal::Element> &el0 = headers[0];
if (headers.size() >= 4) {
if (headers[3]) {
- amf::Buffer &reply = formatEchoResponse(headers[1]->getName(),
*headers[3]);
+ cygnal::Buffer &reply =
formatEchoResponse(headers[1]->getName(), *headers[3]);
// cerr << "FIXME 3: " << hexify(reply.reference(), reply.allocated(),
true) << endl;
// cerr << "FIXME 3: " << hexify(reply.reference(), reply.allocated(),
false) << endl;
writeNet(fd, reply);
@@ -354,74 +354,74 @@
}
#endif
} else {
- amf::Buffer &reply = formatHeader(_filetype, _filesize, HTTPServer::OK);
+ cygnal::Buffer &reply = formatHeader(_filetype, _filesize,
HTTPServer::OK);
writeNet(fd, reply);
}
return buf;
}
-boost::shared_ptr<amf::Buffer>
-HTTPServer::processPutRequest(int /* fd */, amf::Buffer */* buf */)
+boost::shared_ptr<cygnal::Buffer>
+HTTPServer::processPutRequest(int /* fd */, cygnal::Buffer */* buf */)
{
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
// GNASH_REPORT_FUNCTION;
log_unimpl("PUT request");
return buf;
}
-boost::shared_ptr<amf::Buffer>
-HTTPServer::processDeleteRequest(int /* fd */, amf::Buffer */* buf */)
+boost::shared_ptr<cygnal::Buffer>
+HTTPServer::processDeleteRequest(int /* fd */, cygnal::Buffer */* buf */)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
log_unimpl("DELETE request");
return buf;
}
-boost::shared_ptr<amf::Buffer>
-HTTPServer::processConnectRequest(int /* fd */, amf::Buffer */* buf */)
+boost::shared_ptr<cygnal::Buffer>
+HTTPServer::processConnectRequest(int /* fd */, cygnal::Buffer */* buf */)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
log_unimpl("CONNECT request");
return buf;
}
-boost::shared_ptr<amf::Buffer>
-HTTPServer::processOptionsRequest(int /* fd */, amf::Buffer */* buf */)
+boost::shared_ptr<cygnal::Buffer>
+HTTPServer::processOptionsRequest(int /* fd */, cygnal::Buffer */* buf */)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
log_unimpl("OPTIONS request");
return buf;
}
-boost::shared_ptr<amf::Buffer>
-HTTPServer::processHeadRequest(int /* fd */, amf::Buffer */* buf */)
+boost::shared_ptr<cygnal::Buffer>
+HTTPServer::processHeadRequest(int /* fd */, cygnal::Buffer */* buf */)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
log_unimpl("HEAD request");
return buf;
}
-boost::shared_ptr<amf::Buffer>
-HTTPServer::processTraceRequest(int /* fd */, amf::Buffer */* buf */)
+boost::shared_ptr<cygnal::Buffer>
+HTTPServer::processTraceRequest(int /* fd */, cygnal::Buffer */* buf */)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
log_unimpl("TRACE request");
return buf;
}
-amf::Buffer &
+cygnal::Buffer &
HTTPServer::formatErrorResponse(http_status_e code)
{
// GNASH_REPORT_FUNCTION;
@@ -458,7 +458,7 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTPServer::formatGetReply(http_status_e code)
{
@@ -467,7 +467,7 @@
return formatHeader(_filesize, code);
}
-amf::Buffer &
+cygnal::Buffer &
HTTPServer::formatGetReply(size_t size, http_status_e code)
{
// GNASH_REPORT_FUNCTION;
@@ -492,7 +492,7 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTPServer::formatPostReply(rtmpt_cmd_e /* code */)
{
GNASH_REPORT_FUNCTION;
@@ -506,7 +506,7 @@
#if 0
formatHeader(_filesize, code);
- boost::shared_ptr<amf::Buffer> buf = new amf::Buffer;
+ boost::shared_ptr<cygnal::Buffer> buf = new cygnal::Buffer;
if (_header.str().size()) {
buf->resize(_header.str().size());
string str = _header.str();
@@ -527,12 +527,12 @@
#ifndef USE_CGIBIN
// Parse an Echo Request message coming from the Red5 echo_test. This
// method should only be used for testing purposes.
-vector<boost::shared_ptr<amf::Element > >
+vector<boost::shared_ptr<cygnal::Element > >
HTTPServer::parseEchoRequest(boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
- vector<boost::shared_ptr<amf::Element > > headers;
+ vector<boost::shared_ptr<cygnal::Element > > headers;
// skip past the header bytes, we don't care about them.
boost::uint8_t *tmpptr = data + 6;
@@ -543,7 +543,7 @@
// Get the first name, which is a raw string, and not preceded by
// a type byte.
- boost::shared_ptr<amf::Element > el1(new amf::Element);
+ boost::shared_ptr<cygnal::Element > el1(new cygnal::Element);
// If the length of the name field is corrupted, then we get out of
// range quick, and corrupt memory. This is a bit of a hack, but
@@ -562,7 +562,7 @@
// a type byte.
length = ntohs((*(boost::uint16_t *)tmpptr) & 0xffff);
tmpptr += sizeof(boost::uint16_t);
- boost::shared_ptr<amf::Element > el2(new amf::Element);
+ boost::shared_ptr<cygnal::Element > el2(new cygnal::Element);
// std::string name2(reinterpret_cast<const char *>(tmpptr), length);
// el2->setName(name2.c_str(), name2.size());
@@ -582,11 +582,11 @@
// Get the last two pieces of data, which are both AMF encoded
// with a type byte.
amf::AMF amf;
- boost::shared_ptr<amf::Element> el3 = amf.extractAMF(tmpptr, tmpptr +
size);
+ boost::shared_ptr<cygnal::Element> el3 = amf.extractAMF(tmpptr, tmpptr +
size);
headers.push_back(el3);
tmpptr += amf.totalsize();
- boost::shared_ptr<amf::Element> el4 = amf.extractAMF(tmpptr, tmpptr +
size);
+ boost::shared_ptr<cygnal::Element> el4 = amf.extractAMF(tmpptr, tmpptr +
size);
headers.push_back(el4);
return headers;
@@ -595,14 +595,14 @@
// format a response to the 'echo' test used for testing Gnash. This
// is only used for testing by developers. The format appears to be
// two strings, followed by a double, followed by the "onResult".
-amf::Buffer &
-HTTPServer::formatEchoResponse(const std::string &num, amf::Element &el)
+cygnal::Buffer &
+HTTPServer::formatEchoResponse(const std::string &num, cygnal::Element &el)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> data;
+ boost::shared_ptr<cygnal::Buffer> data;
- amf::Element nel;
- if (el.getType() == amf::Element::TYPED_OBJECT_AMF0) {
+ cygnal::Element nel;
+ if (el.getType() == cygnal::Element::TYPED_OBJECT_AMF0) {
nel.makeTypedObject();
string name = el.getName();
nel.setName(name);
@@ -610,7 +610,7 @@
// FIXME: see about using std::reverse() instead.
for (int i=el.propertySize()-1; i>=0; i--) {
// for (int i=0 ; i<el.propertySize(); i++) {
- boost::shared_ptr<amf::Element> child = el.getProperty(i);
+ boost::shared_ptr<cygnal::Element> child = el.getProperty(i);
nel.addProperty(child);
}
data = nel.encode();
@@ -624,14 +624,14 @@
return formatEchoResponse(num, data->reference(), data->allocated());
}
-amf::Buffer &
-HTTPServer::formatEchoResponse(const std::string &num, amf::Buffer &data)
+cygnal::Buffer &
+HTTPServer::formatEchoResponse(const std::string &num, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return formatEchoResponse(num, data.reference(), data.allocated());
}
-amf::Buffer &
+cygnal::Buffer &
HTTPServer::formatEchoResponse(const std::string &num, boost::uint8_t *data,
size_t size)
{
// GNASH_REPORT_FUNCTION;
@@ -639,8 +639,8 @@
//boost::uint8_t *tmpptr = data;
// FIXME: temporary hacks while debugging
- amf::Buffer fixme("00 00 00 00 00 01");
- amf::Buffer fixme2("ff ff ff ff");
+ cygnal::Buffer fixme("00 00 00 00 00 01");
+ cygnal::Buffer fixme2("ff ff ff ff");
_buffer = "HTTPServer/1.1 200 OK\r\n";
formatContentType(DiskStream::FILETYPE_AMF);
@@ -661,23 +661,23 @@
// the request, a slash followed by a number like "/2".
string result = num;
result += "/onResult";
- boost::shared_ptr<amf::Buffer> res = amf::AMF::encodeString(result);
+ boost::shared_ptr<cygnal::Buffer> res = amf::AMF::encodeString(result);
_buffer.append(res->begin()+1, res->size()-1);
// Add the null data item
- boost::shared_ptr<amf::Buffer> null = amf::AMF::encodeString("null");
+ boost::shared_ptr<cygnal::Buffer> null = amf::AMF::encodeString("null");
_buffer.append(null->begin()+1, null->size()-1);
// Add the other binary blob
_buffer += fixme2;
- amf::Element::amf0_type_e type =
static_cast<amf::Element::amf0_type_e>(*data);
- if ((type == amf::Element::UNSUPPORTED_AMF0)
- || (type == amf::Element::NULL_AMF0)) {
+ cygnal::Element::amf0_type_e type =
static_cast<cygnal::Element::amf0_type_e>(*data);
+ if ((type == cygnal::Element::UNSUPPORTED_AMF0)
+ || (type == cygnal::Element::NULL_AMF0)) {
_buffer += type;
// Red5 returns a NULL object when it's recieved an undefined one in
the echo_test
- } else if (type == amf::Element::UNDEFINED_AMF0) {
- _buffer += amf::Element::NULL_AMF0;
+ } else if (type == cygnal::Element::UNDEFINED_AMF0) {
+ _buffer += cygnal::Element::NULL_AMF0;
} else {
// Add the AMF data we're echoing back
if (size) {
@@ -888,7 +888,7 @@
}
boost::uint8_t *
-HTTPServer::processHeaderFields(amf::Buffer &buf)
+HTTPServer::processHeaderFields(cygnal::Buffer &buf)
{
// GNASH_REPORT_FUNCTION;
string head(reinterpret_cast<const char *>(buf.reference()));
@@ -993,12 +993,12 @@
}
bool
-HTTPServer::http_handler(Handler *hand, int netfd, amf::Buffer *buf)
+HTTPServer::http_handler(Handler *hand, int netfd, cygnal::Buffer *buf)
{
GNASH_REPORT_FUNCTION;
// Handler *hand = reinterpret_cast<Handler *>(args->handler);
- // amf::Buffer *buf = args->buffer;
+ // cygnal::Buffer *buf = args->buffer;
// boost::shared_ptr<HTTPServer> www(new HTTPServer); // =
hand->getHTTPHandler (args->netfd);
string url, parameters;
@@ -1051,7 +1051,7 @@
if (response.empty()) {
cerr << "FIXME no cache hit for: " << www.getFilespec() << endl;
// www.clearHeader();
-// amf::Buffer &ss = www.formatHeader(filestream->getFileSize(),
HTTP::LIFE_IS_GOOD);
+// cygnal::Buffer &ss = www.formatHeader(filestream->getFileSize(),
HTTP::LIFE_IS_GOOD);
// www.writeNet(args->netfd, (boost::uint8_t
*)www.getHeader().c_str(), www.getHeader().size());
// cache.addResponse(www.getFilespec(), www.getHeader());
} else {
=== modified file 'cygnal/http_server.h'
--- a/cygnal/http_server.h 2010-03-10 16:37:25 +0000
+++ b/cygnal/http_server.h 2010-05-27 22:44:28 +0000
@@ -46,56 +46,56 @@
// These are for the protocol itself
http_method_e processClientRequest(int fd);
- http_method_e processClientRequest(Handler *hand, int fd, amf::Buffer
*buf);
- amf::Buffer &processGetRequest(Handler *hand, int fd, amf::Buffer *buf);
- boost::shared_ptr<amf::Buffer> processPostRequest(int fd, amf::Buffer
*buf);
- boost::shared_ptr<amf::Buffer> processPutRequest(int fd, amf::Buffer *buf);
- boost::shared_ptr<amf::Buffer> processDeleteRequest(int fd, amf::Buffer
*buf);
- boost::shared_ptr<amf::Buffer> processConnectRequest(int fd, amf::Buffer
*buf);
- boost::shared_ptr<amf::Buffer> processOptionsRequest(int fd, amf::Buffer
*buf);
- boost::shared_ptr<amf::Buffer> processHeadRequest(int fd, amf::Buffer
*buf);
- boost::shared_ptr<amf::Buffer> processTraceRequest(int fd, amf::Buffer
*buf);
+ http_method_e processClientRequest(Handler *hand, int fd, cygnal::Buffer
*buf);
+ cygnal::Buffer &processGetRequest(Handler *hand, int fd, cygnal::Buffer
*buf);
+ boost::shared_ptr<cygnal::Buffer> processPostRequest(int fd,
cygnal::Buffer *buf);
+ boost::shared_ptr<cygnal::Buffer> processPutRequest(int fd, cygnal::Buffer
*buf);
+ boost::shared_ptr<cygnal::Buffer> processDeleteRequest(int fd,
cygnal::Buffer *buf);
+ boost::shared_ptr<cygnal::Buffer> processConnectRequest(int fd,
cygnal::Buffer *buf);
+ boost::shared_ptr<cygnal::Buffer> processOptionsRequest(int fd,
cygnal::Buffer *buf);
+ boost::shared_ptr<cygnal::Buffer> processHeadRequest(int fd,
cygnal::Buffer *buf);
+ boost::shared_ptr<cygnal::Buffer> processTraceRequest(int fd,
cygnal::Buffer *buf);
// Handle the response for the request.
- boost::shared_ptr<amf::Buffer> formatServerReply(http_status_e code);
- amf::Buffer &formatGetReply(gnash::DiskStream::filetype_e type, size_t
size, http_status_e code);
- amf::Buffer &formatGetReply(size_t size, http_status_e code);
- amf::Buffer &formatGetReply(http_status_e code);
- amf::Buffer &formatPostReply(rtmpt_cmd_e code);
- amf::Buffer &formatErrorResponse(http_status_e err);
+ boost::shared_ptr<cygnal::Buffer> formatServerReply(http_status_e code);
+ cygnal::Buffer &formatGetReply(gnash::DiskStream::filetype_e type, size_t
size, http_status_e code);
+ cygnal::Buffer &formatGetReply(size_t size, http_status_e code);
+ cygnal::Buffer &formatGetReply(http_status_e code);
+ cygnal::Buffer &formatPostReply(rtmpt_cmd_e code);
+ cygnal::Buffer &formatErrorResponse(http_status_e err);
// These methods extract data from an RTMPT message. RTMP is an
// extension to HTTP that adds commands to manipulate the
// connection's persistance.
rtmpt_cmd_e extractRTMPT(boost::uint8_t *data);
- rtmpt_cmd_e extractRTMPT(amf::Buffer &data)
+ rtmpt_cmd_e extractRTMPT(cygnal::Buffer &data)
{ return extractRTMPT(data.reference()); };
#if 0
// Examine the beginning of the data for an HTTP request command
// like GET or POST, etc...
http_method_e extractCommand(boost::uint8_t *data);
- http_method_e extractCommand(amf::Buffer &data)
+ http_method_e extractCommand(cygnal::Buffer &data)
{ return extractCommand(data.reference()); };
// process all the header fields in the Buffer, storing them internally
// in _fields. The address returned is the address where the Content data
// starts, and is "Content-Length" bytes long, of "Content-Type" data.
- boost::uint8_t *processHeaderFields(amf::Buffer &buf);
+ boost::uint8_t *processHeaderFields(cygnal::Buffer &buf);
#endif
#if 0
// Parse an Echo Request message coming from the Red5 echo_test.
- std::vector<boost::shared_ptr<amf::Element > >
parseEchoRequest(gnash::amf::Buffer &buf) { return
parseEchoRequest(buf.reference(), buf.size()); };
- std::vector<boost::shared_ptr<amf::Element > >
parseEchoRequest(boost::uint8_t *buf, size_t size);
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseEchoRequest(gnash::cygnal::Buffer &buf) { return
parseEchoRequest(buf.reference(), buf.size()); };
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseEchoRequest(boost::uint8_t *buf, size_t size);
// format a response to the 'echo' test used for testing Gnash.
- gnash::amf::Buffer &formatEchoResponse(const std::string &num,
amf::Element &el);
- gnash::amf::Buffer &formatEchoResponse(const std::string &num, amf::Buffer
&data);
- gnash::amf::Buffer &formatEchoResponse(const std::string &num, uint8_t
*data, size_t size);
+ gnash::cygnal::Buffer &formatEchoResponse(const std::string &num,
cygnal::Element &el);
+ gnash::cygnal::Buffer &formatEchoResponse(const std::string &num,
cygnal::Buffer &data);
+ gnash::cygnal::Buffer &formatEchoResponse(const std::string &num, uint8_t
*data, size_t size);
#endif
- bool http_handler(Handler *hand, int netfd, amf::Buffer *buf);
+ bool http_handler(Handler *hand, int netfd, cygnal::Buffer *buf);
boost::shared_ptr<gnash::DiskStream> getDiskStream() { return _diskstream;
};
void dump();
=== modified file 'cygnal/libamf/amf.cpp'
--- a/cygnal/libamf/amf.cpp 2010-03-11 17:15:38 +0000
+++ b/cygnal/libamf/amf.cpp 2010-05-27 22:44:28 +0000
@@ -32,7 +32,7 @@
#include <map>
#include <boost/cstdint.hpp>
-namespace amf
+namespace cygnal
{
/// \define ENSUREBYTES
@@ -172,26 +172,26 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeObject(const amf::Element &data)
+AMF::encodeObject(const cygnal::Element &data)
{
// GNASH_REPORT_FUNCTION;
boost::uint32_t length;
length = data.propertySize();
gnash::log_debug("Encoded data size has %d properties", length);
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
if (length) {
- buf.reset(new amf::Buffer);
+ buf.reset(new cygnal::Buffer);
} else {
return buf;
}
*buf = Element::OBJECT_AMF0;
if (data.propertySize() > 0) {
- std::vector<boost::shared_ptr<amf::Element> >::const_iterator ait;
- std::vector<boost::shared_ptr<amf::Element> > props =
data.getProperties();
+ std::vector<boost::shared_ptr<cygnal::Element> >::const_iterator ait;
+ std::vector<boost::shared_ptr<cygnal::Element> > props =
data.getProperties();
for (ait = props.begin(); ait != props.end(); ait++) {
- boost::shared_ptr<amf::Element> el = (*(ait));
- boost::shared_ptr<amf::Buffer> item = AMF::encodeElement(el);
+ boost::shared_ptr<cygnal::Element> el = (*(ait));
+ boost::shared_ptr<cygnal::Buffer> item = AMF::encodeElement(el);
if (item) {
*buf += item;
item.reset();
@@ -310,14 +310,14 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeTypedObject(const amf::Element &data)
+AMF::encodeTypedObject(const cygnal::Element &data)
{
// GNASH_REPORT_FUNCTION;
size_t size = 0;
boost::uint32_t props;
props = data.propertySize();
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
// log_debug("Encoded data size has %d properties", props);
if (props) {
// Calculate the total size of the output buffer
@@ -346,11 +346,11 @@
}
if (data.propertySize() > 0) {
- std::vector<boost::shared_ptr<amf::Element> >::const_iterator ait;
- std::vector<boost::shared_ptr<amf::Element> > props =
data.getProperties();
+ std::vector<boost::shared_ptr<cygnal::Element> >::const_iterator ait;
+ std::vector<boost::shared_ptr<cygnal::Element> > props =
data.getProperties();
for (ait = props.begin(); ait != props.end(); ait++) {
- boost::shared_ptr<amf::Element> el = (*(ait));
- boost::shared_ptr<amf::Buffer> item = AMF::encodeElement(el);
+ boost::shared_ptr<cygnal::Element> el = (*(ait));
+ boost::shared_ptr<cygnal::Buffer> item = AMF::encodeElement(el);
if (item) {
*buf += item;
item.reset();
@@ -381,7 +381,7 @@
{
// GNASH_REPORT_FUNCTION;
boost::uint16_t num = index;
- boost::shared_ptr<amf::Buffer> buf(new Buffer(3));
+ boost::shared_ptr<cygnal::Buffer> buf(new Buffer(3));
*buf = Element::REFERENCE_AMF0;
swapBytes(&num, sizeof(boost::uint16_t));
*buf += num;
@@ -416,7 +416,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeECMAArray(const amf::Element &data)
+AMF::encodeECMAArray(const cygnal::Element &data)
{
// GNASH_REPORT_FUNCTION;
boost::uint32_t length;
@@ -425,11 +425,11 @@
length = data.propertySize();
// log_debug("Encoded data size has %d properties", length);
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer);
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer);
if (length == 0) {
// an undefined array is only 5 bytes, 1 for the type and
// 4 for the length.
- buf.reset(new amf::Buffer(5));
+ buf.reset(new cygnal::Buffer(5));
}
*buf = Element::ECMA_ARRAY_AMF0;
length = 0;
@@ -439,19 +439,19 @@
// At lest for red5, it seems to encode from the last item to the
// first, so we do the same for now.
if (data.propertySize() > 0) {
- boost::shared_ptr<amf::Buffer> item;
- std::vector<boost::shared_ptr<amf::Element> >::const_iterator ait;
- std::vector<boost::shared_ptr<amf::Element> > props =
data.getProperties();
+ boost::shared_ptr<cygnal::Buffer> item;
+ std::vector<boost::shared_ptr<cygnal::Element> >::const_iterator ait;
+ std::vector<boost::shared_ptr<cygnal::Element> > props =
data.getProperties();
for (ait = props.begin(); ait != props.end(); ait++) {
- boost::shared_ptr<amf::Element> el = (*(ait));
+ boost::shared_ptr<cygnal::Element> el = (*(ait));
if (sparse) {
sparse = false;
// char num[12];
// sprintf(num, "%d", counter);
-// amf::Element elnum(num, el->to_number());
+// cygnal::Element elnum(num, el->to_number());
// *buf += AMF::encodeElement(elnum);
// double nodes = items;
- amf::Element ellen("length");
+ cygnal::Element ellen("length");
ellen.makeNumber(data.propertySize());
*buf += AMF::encodeElement(ellen);
} else {
@@ -467,8 +467,8 @@
}
#if 0
double count = data.propertySize();
- amf::Element ellen("length", count);
- boost::shared_ptr<amf::Buffer> buflen = ellen.encode();
+ cygnal::Element ellen("length", count);
+ boost::shared_ptr<cygnal::Buffer> buflen = ellen.encode();
*buf += buflen;
#endif
@@ -524,33 +524,33 @@
///
/// @return a binary AMF packet in big endian format (header,data)
boost::shared_ptr<Buffer>
-AMF::encodeStrictArray(const amf::Element &data)
+AMF::encodeStrictArray(const cygnal::Element &data)
{
// GNASH_REPORT_FUNCTION;
boost::uint32_t items;
items = data.propertySize();
// log_debug("Encoded data size has %d properties", items);
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer);
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer);
if (items) {
- buf.reset(new amf::Buffer);
+ buf.reset(new cygnal::Buffer);
} else {
// an undefined array is only 5 bytes, 1 for the type and
// 4 for the length.
buf->resize(5);
- // buf.reset(new amf::Buffer(5));
+ // buf.reset(new cygnal::Buffer(5));
}
*buf = Element::STRICT_ARRAY_AMF0;
swapBytes(&items, sizeof(boost::uint32_t));
*buf += items;
if (data.propertySize() > 0) {
- std::vector<boost::shared_ptr<amf::Element> >::const_iterator ait;
- std::vector<boost::shared_ptr<amf::Element> > props =
data.getProperties();
+ std::vector<boost::shared_ptr<cygnal::Element> >::const_iterator ait;
+ std::vector<boost::shared_ptr<cygnal::Element> > props =
data.getProperties();
bool sparse = false;
size_t counter = 0;
for (ait = props.begin(); ait != props.end(); ait++) {
counter++;
- boost::shared_ptr<amf::Element> el = (*(ait));
+ boost::shared_ptr<cygnal::Element> el = (*(ait));
#if 0
// FIXME: Red5's echo tests like to turn strict array's into ecma
// arrays, but we shouldn't do that in the core.
@@ -576,13 +576,13 @@
sparse = false;
std::ostringstream os;
os << counter;
- amf::Element elnum(os.str().c_str(), el->to_number());
+ cygnal::Element elnum(os.str().c_str(), el->to_number());
*buf += AMF::encodeElement(elnum);
double nodes = items;
- amf::Element ellen("length", nodes);
+ cygnal::Element ellen("length", nodes);
*buf += AMF::encodeElement(ellen);
} else {
- boost::shared_ptr<amf::Buffer> item =
AMF::encodeElement(el);
+ boost::shared_ptr<cygnal::Buffer> item =
AMF::encodeElement(el);
if (item) {
*buf += item;
item.reset();
@@ -683,13 +683,13 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeElement(boost::shared_ptr<amf::Element> el)
+AMF::encodeElement(boost::shared_ptr<cygnal::Element> el)
{
return encodeElement(*el);
}
boost::shared_ptr<Buffer>
-AMF::encodeElement(const amf::Element& el)
+AMF::encodeElement(const cygnal::Element& el)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -792,9 +792,9 @@
boost::shared_ptr<Buffer> bigbuf;
if (el.getName() && (el.getType() != Element::TYPED_OBJECT_AMF0)) {
if (buf) {
- bigbuf.reset(new amf::Buffer(el.getNameSize() +
sizeof(boost::uint16_t) + buf->size()));
+ bigbuf.reset(new cygnal::Buffer(el.getNameSize() +
sizeof(boost::uint16_t) + buf->size()));
} else {
- bigbuf.reset(new amf::Buffer(el.getNameSize() +
sizeof(boost::uint16_t)));
+ bigbuf.reset(new cygnal::Buffer(el.getNameSize() +
sizeof(boost::uint16_t)));
}
// Add the length of the string for the name of the variable
@@ -822,7 +822,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeProperty(boost::shared_ptr<amf::Element> el)
+AMF::encodeProperty(boost::shared_ptr<cygnal::Element> el)
{
// GNASH_REPORT_FUNCTION;
size_t outsize;
@@ -879,7 +879,7 @@
/// @return A smart ptr to an Element.
///
/// @remarks May throw a ParserException
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
AMF::extractAMF(boost::shared_ptr<Buffer> buf)
{
// GNASH_REPORT_FUNCTION;
@@ -900,21 +900,21 @@
/// @return A smart ptr to an Element.
///
/// @remarks May throw a ParserException
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
AMF::extractAMF(boost::uint8_t *in, boost::uint8_t* tooFar)
{
// GNASH_REPORT_FUNCTION;
boost::uint8_t *tmpptr = in;
boost::uint16_t length;
- boost::shared_ptr<amf::Element> el(new Element);
+ boost::shared_ptr<cygnal::Element> el(new Element);
if (in == 0) {
gnash::log_error(_("AMF body input data is NULL"));
return el;
}
- std::map<boost::uint16_t, amf::Element> references;
+ std::map<boost::uint16_t, cygnal::Element> references;
// All elements look like this:
// the first two bytes is the length of name of the element
@@ -961,7 +961,7 @@
return el;
}
double swapped = *(reinterpret_cast<const double*>(tmpptr));
- swapBytes(&swapped, amf::AMF0_NUMBER_SIZE);
+ swapBytes(&swapped, cygnal::AMF0_NUMBER_SIZE);
el->makeNumber(swapped);
tmpptr += AMF0_NUMBER_SIZE; // all numbers are 8 bit big endian
break;
@@ -1002,7 +1002,7 @@
tmpptr++;
break;
}
- boost::shared_ptr<amf::Element> child =
+ boost::shared_ptr<cygnal::Element> child =
amf_obj.extractProperty(tmpptr, tooFar);
if (child == 0) {
// skip past zero length string (2 bytes), null
@@ -1050,7 +1050,7 @@
tmpptr++;
break;
}
- boost::shared_ptr<amf::Element> child =
+ boost::shared_ptr<cygnal::Element> child =
amf_obj.extractProperty(tmpptr, tooFar);
if (child == 0) {
// skip past zero length string (2 bytes),
@@ -1071,7 +1071,7 @@
tmpptr += sizeof(boost::uint32_t);
while (items--) {
- boost::shared_ptr<amf::Element> child =
+ boost::shared_ptr<cygnal::Element> child =
amf_obj.extractProperty(tmpptr, tooFar);
if (child == 0) {
break;
@@ -1095,7 +1095,7 @@
// Skip past the length field to get to the start of the data
tmpptr += sizeof(boost::uint32_t);
while (items) {
- boost::shared_ptr<amf::Element> child =
+ boost::shared_ptr<cygnal::Element> child =
amf_obj.extractAMF(tmpptr, tooFar);
if (child == 0) {
break;
@@ -1111,7 +1111,7 @@
case Element::DATE_AMF0:
{
double swapped = *reinterpret_cast<const double*>(tmpptr);
- swapBytes(&swapped, amf::AMF0_NUMBER_SIZE);
+ swapBytes(&swapped, cygnal::AMF0_NUMBER_SIZE);
el->makeDate(swapped);
tmpptr += AMF0_NUMBER_SIZE; // all dates are 8 bit big endian
numbers
break;
@@ -1152,7 +1152,7 @@
tmpptr++;
break;
}
- boost::shared_ptr<amf::Element> child =
+ boost::shared_ptr<cygnal::Element> child =
amf_obj.extractProperty(tmpptr, tooFar);
if (child == 0) {
break;
@@ -1187,7 +1187,7 @@
/// @return A smart ptr to an Element.
///
/// @remarks May throw a ParserException
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
AMF::extractProperty(boost::shared_ptr<Buffer> buf)
{
// GNASH_REPORT_FUNCTION;
@@ -1210,14 +1210,14 @@
/// @return A smart ptr to an Element.
///
/// @remarks May throw a ParserException
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
AMF::extractProperty(boost::uint8_t *in, boost::uint8_t* tooFar)
{
// GNASH_REPORT_FUNCTION;
boost::uint8_t *tmpptr = in;
boost::uint16_t length;
- boost::shared_ptr<amf::Element> el;
+ boost::shared_ptr<cygnal::Element> el;
length = ntohs((*(boost::uint16_t *)tmpptr) & 0xffff);
// go past the length bytes, which leaves us pointing at the raw data
@@ -1288,5 +1288,5 @@
// local Variables:
// mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: nil
// End:
=== modified file 'cygnal/libamf/amf.h'
--- a/cygnal/libamf/amf.h 2010-03-11 01:47:08 +0000
+++ b/cygnal/libamf/amf.h 2010-05-27 22:44:28 +0000
@@ -36,7 +36,7 @@
#include "dsodefs.h"
/// Action Message Format specific classes of libamf.
-namespace amf
+namespace cygnal
{
// forward declaration
@@ -203,7 +203,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeTypedObject(const amf::Element
&data);
+ static boost::shared_ptr<Buffer> encodeTypedObject(const cygnal::Element
&data);
/// Encode a Reference to an object to its serialized representation.
//
@@ -237,7 +237,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeECMAArray(const amf::Element &data);
+ static boost::shared_ptr<Buffer> encodeECMAArray(const cygnal::Element
&data);
/// Encode a Long String to its serialized representation.
//
@@ -280,7 +280,7 @@
///
/// @return a binary AMF packet in big endian format (header,data)
///
- static boost::shared_ptr<Buffer> encodeStrictArray(const amf::Element
&data);
+ static boost::shared_ptr<Buffer> encodeStrictArray(const cygnal::Element
&data);
/// Encode an object to its serialized representation.
//
@@ -288,7 +288,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeObject(const amf::Element &data);
+ static boost::shared_ptr<Buffer> encodeObject(const cygnal::Element &data);
/// Encode the end of an object to its serialized representation.
//
@@ -310,7 +310,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer>
encodeElement(boost::shared_ptr<amf::Element> el);
+ static boost::shared_ptr<Buffer>
encodeElement(boost::shared_ptr<cygnal::Element> el);
/// Encode an Element to its serialized representation.
//
@@ -318,7 +318,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeElement(const amf::Element& el);
+ static boost::shared_ptr<Buffer> encodeElement(const cygnal::Element& el);
/// Encode a variable to its serialized representation.
//
@@ -326,7 +326,7 @@
///
/// @return a binary AMF packet in big endian format
///
- boost::shared_ptr<Buffer> encodeProperty(boost::shared_ptr<amf::Element>
el);
+ boost::shared_ptr<Buffer>
encodeProperty(boost::shared_ptr<cygnal::Element> el);
/// @} end of encoding methods
@@ -358,7 +358,7 @@
///
/// @remarks May throw a ParserException
///
- boost::shared_ptr<amf::Element> extractAMF(boost::uint8_t *in,
boost::uint8_t* tooFar);
+ boost::shared_ptr<cygnal::Element> extractAMF(boost::uint8_t *in,
boost::uint8_t* tooFar);
/// Extract an AMF object from an array of raw bytes.
//
@@ -368,7 +368,7 @@
///
/// @remarks May throw a ParserException
///
- boost::shared_ptr<amf::Element> extractAMF(boost::shared_ptr<Buffer> buf);
+ boost::shared_ptr<cygnal::Element> extractAMF(boost::shared_ptr<Buffer>
buf);
/// Extract a Property.
//
@@ -385,7 +385,7 @@
///
/// @remarks May throw a ParserException
///
- boost::shared_ptr<amf::Element> extractProperty(boost::uint8_t *in,
boost::uint8_t* tooFar);
+ boost::shared_ptr<cygnal::Element> extractProperty(boost::uint8_t *in,
boost::uint8_t* tooFar);
/// Extract a Property.
//
@@ -399,7 +399,7 @@
///
/// @remarks May throw a ParserException
///
- boost::shared_ptr<amf::Element> extractProperty(boost::shared_ptr<Buffer>
buf);
+ boost::shared_ptr<cygnal::Element>
extractProperty(boost::shared_ptr<Buffer> buf);
/// @} end of decoding methods
=== modified file 'cygnal/libamf/amf_msg.cpp'
--- a/cygnal/libamf/amf_msg.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libamf/amf_msg.cpp 2010-05-27 22:44:28 +0000
@@ -37,16 +37,16 @@
using std::endl;
-namespace amf
+namespace cygnal
{
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
AMF_msg::encodeContextHeader(boost::uint16_t version, boost::uint16_t headers,
boost::uint16_t messages)
{
// GNASH_REPORT_FUNCTION;
size_t size = sizeof(AMF_msg::context_header_t);
- boost::shared_ptr<amf::Buffer> buf (new amf::Buffer(size));
+ boost::shared_ptr<cygnal::Buffer> buf (new cygnal::Buffer(size));
// use a short as a temporary, as it turns out htons() returns a 32bit int
// instead when compiling with -O2. This forces appending bytes to get the
@@ -61,7 +61,7 @@
return buf;
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
AMF_msg::encodeContextHeader(AMF_msg::context_header_t *head)
{
// GNASH_REPORT_FUNCTION;
@@ -72,14 +72,14 @@
// 00 06 67 65 74 77 61 79 <- getway, message #1
// 00 04 2f 32 32 39 <- /229, operation name
// 00 00 00 0e <- byte length of message
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
AMF_msg::encodeMsgHeader(AMF_msg::message_header_t *head)
{
// GNASH_REPORT_FUNCTION;
// The size of the buffer are the two strings, their lenght fields, and
the integer.
// size_t size = head->target.size() + head->response.size() +
sizeof(boost::uint32_t)
// + (sizeof(boost::uint16_t) * 2);
- boost::shared_ptr<amf::Buffer> buf (new
amf::Buffer(sizeof(AMF_msg::message_header_t)));
+ boost::shared_ptr<cygnal::Buffer> buf (new
cygnal::Buffer(sizeof(AMF_msg::message_header_t)));
// Encode the target URI, which usually looks something like ."getway"
boost::uint16_t length = head->target.size();
@@ -99,7 +99,7 @@
// These methods parse the raw data of the AMF packet
boost::shared_ptr<AMF_msg::context_header_t>
-AMF_msg::parseContextHeader(amf::Buffer &data)
+AMF_msg::parseContextHeader(cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return parseContextHeader(data.reference(), data.size());
@@ -122,7 +122,7 @@
}
boost::shared_ptr<AMF_msg::message_header_t>
-AMF_msg::parseMessageHeader(amf::Buffer &data)
+AMF_msg::parseMessageHeader(cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return parseMessageHeader(data.reference(), data.size());
@@ -191,7 +191,7 @@
}
boost::shared_ptr<AMF_msg::context_header_t>
-AMF_msg::parseAMFPacket(amf::Buffer &data)
+AMF_msg::parseAMFPacket(cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return parseAMFPacket(data.reference(), data.size());
@@ -217,7 +217,7 @@
ptr += msghead->target.size() + msghead->response.size()
+ (sizeof(boost::uint16_t) * 2)
+ (sizeof(boost::uint32_t));
- boost::shared_ptr<amf::Element> el = amf.extractAMF(ptr,
ptr+size);
+ boost::shared_ptr<cygnal::Element> el = amf.extractAMF(ptr,
ptr+size);
msgpkt->header.target = msghead->target;
msgpkt->header.response = msghead->response;
msgpkt->header.size = msghead->size;
@@ -234,7 +234,7 @@
return header;
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
AMF_msg::encodeAMFPacket(const std::string & /* target */,
const std::string & /*response */, size_t /* size */)
{
@@ -243,14 +243,14 @@
return encodeAMFPacket();
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
AMF_msg::encodeAMFPacket()
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer);
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer);
// Encode the packet header
- boost::shared_ptr<amf::Buffer> buf1 = encodeContextHeader(0, 0,
_messages.size());
+ boost::shared_ptr<cygnal::Buffer> buf1 = encodeContextHeader(0, 0,
_messages.size());
*buf = buf1;
// Now encode all the messages
@@ -259,13 +259,13 @@
for (it = _messages.begin(); it != _messages.end(); it++) {
boost::shared_ptr<AMF_msg::amf_message_t> msg = (*(it));
- boost::shared_ptr<amf::Buffer> buf2 =
encodeMsgHeader(msg->header.target,
+ boost::shared_ptr<cygnal::Buffer> buf2 =
encodeMsgHeader(msg->header.target,
msg->header.response,
msg->header.size);
// AMF_msg::dump(msg->header);
// msg->data->dump();
- boost::shared_ptr<amf::Buffer> buf3 = msg->data->encode();
+ boost::shared_ptr<cygnal::Buffer> buf3 = msg->data->encode();
*buf += buf2;
*buf += buf3;
}
@@ -273,7 +273,7 @@
return buf;
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
AMF_msg::encodeMsgHeader(const std::string &target,
const std::string &response, size_t size)
{
@@ -282,7 +282,7 @@
total += response.size() + sizeof(boost::uint16_t);
total += sizeof(boost::uint32_t);
- boost::shared_ptr<amf::Buffer> buf (new amf::Buffer(total));
+ boost::shared_ptr<cygnal::Buffer> buf (new cygnal::Buffer(total));
boost::uint16_t length = target.size();
swapBytes(&length, sizeof(boost::uint16_t));
*buf += length;
=== modified file 'cygnal/libamf/amf_msg.h'
--- a/cygnal/libamf/amf_msg.h 2010-01-11 06:41:38 +0000
+++ b/cygnal/libamf/amf_msg.h 2010-05-27 22:44:28 +0000
@@ -37,7 +37,7 @@
#include "dsodefs.h"
/// Action Message Format specific classes of libamf.
-namespace amf
+namespace cygnal
{
// forward declaration
@@ -69,7 +69,7 @@
} message_header_t;
typedef struct {
message_header_t header;
- boost::shared_ptr<amf::Element> data;
+ boost::shared_ptr<cygnal::Element> data;
} amf_message_t;
size_t addMessage(boost::shared_ptr<amf_message_t> msg)
@@ -80,30 +80,30 @@
size_t messageCount() { return _messages.size(); };
// These methods create the raw data of the AMF packet from Elements
- static boost::shared_ptr<amf::Buffer> encodeContextHeader(context_header_t
*head);
- static boost::shared_ptr<amf::Buffer> encodeContextHeader(boost::uint16_t
version,
+ static boost::shared_ptr<cygnal::Buffer>
encodeContextHeader(context_header_t *head);
+ static boost::shared_ptr<cygnal::Buffer>
encodeContextHeader(boost::uint16_t version,
boost::uint16_t
headers,
boost::uint16_t
messages);
- static boost::shared_ptr<amf::Buffer> encodeMsgHeader(message_header_t
*head);
- static boost::shared_ptr<amf::Buffer> encodeMsgHeader(const std::string
&target,
+ static boost::shared_ptr<cygnal::Buffer> encodeMsgHeader(message_header_t
*head);
+ static boost::shared_ptr<cygnal::Buffer> encodeMsgHeader(const std::string
&target,
const std::string &response, size_t
size);
// These methods parse the raw data of the AMF packet into data structures
- static boost::shared_ptr<context_header_t> parseContextHeader(amf::Buffer
&data);
+ static boost::shared_ptr<context_header_t>
parseContextHeader(cygnal::Buffer &data);
static boost::shared_ptr<context_header_t>
parseContextHeader(boost::uint8_t *data, size_t size);
- static boost::shared_ptr<message_header_t> parseMessageHeader(amf::Buffer
&data);
+ static boost::shared_ptr<message_header_t>
parseMessageHeader(cygnal::Buffer &data);
static boost::shared_ptr<message_header_t>
parseMessageHeader(boost::uint8_t *data, size_t size);
// These methods parse the entire packet. which consists of multiple
messages
- boost::shared_ptr<context_header_t> parseAMFPacket(amf::Buffer &buf);
+ boost::shared_ptr<context_header_t> parseAMFPacket(cygnal::Buffer &buf);
boost::shared_ptr<context_header_t> parseAMFPacket(boost::uint8_t *data,
size_t size);
// This methods create an entire packet from multiple messages, already
parsed in
- boost::shared_ptr<amf::Buffer> encodeAMFPacket();
- boost::shared_ptr<amf::Buffer> encodeAMFPacket(const std::string &target,
+ boost::shared_ptr<cygnal::Buffer> encodeAMFPacket();
+ boost::shared_ptr<cygnal::Buffer> encodeAMFPacket(const std::string
&target,
const std::string &response, size_t size);
static void dump(context_header_t &data);
=== modified file 'cygnal/libamf/amftest.cpp'
--- a/cygnal/libamf/amftest.cpp 2010-01-11 06:41:38 +0000
+++ b/cygnal/libamf/amftest.cpp 2010-05-27 22:44:28 +0000
@@ -49,7 +49,7 @@
#include "amf.h"
-using namespace amf;
+using namespace cygnal;
using namespace gnash;
using namespace std;
=== modified file 'cygnal/libamf/amfutf8.h'
--- a/cygnal/libamf/amfutf8.h 2010-01-11 06:41:38 +0000
+++ b/cygnal/libamf/amfutf8.h 2010-05-27 22:44:28 +0000
@@ -21,7 +21,7 @@
#include <vector>
-namespace amf
+namespace cygnal
{
// This represents an regular UTF8 type in an AMF message
=== modified file 'cygnal/libamf/buffer.cpp'
--- a/cygnal/libamf/buffer.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libamf/buffer.cpp 2010-05-27 22:44:28 +0000
@@ -32,10 +32,10 @@
#include "GnashException.h"
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf
+namespace cygnal
{
/// \brief Convert a Hex digit into it's decimal value.
@@ -109,7 +109,7 @@
}
std::string
-Buffer::hexify (amf::Buffer &buf, bool ascii)
+Buffer::hexify (cygnal::Buffer &buf, bool ascii)
{
return gnash::hexify(buf.reference(), buf.allocated(), ascii);
}
@@ -145,8 +145,8 @@
: _seekptr(0)
{
// GNASH_REPORT_FUNCTION;
- _nbytes = amf::NETBUFSIZE;
- init(amf::NETBUFSIZE);
+ _nbytes = cygnal::NETBUFSIZE;
+ init(cygnal::NETBUFSIZE);
}
/// \brief Create a new Buffer with a size other than the default
@@ -259,7 +259,7 @@
///
/// @return A reference to a Buffer.
Buffer &
-Buffer::operator+=(amf::Element::amf0_type_e type)
+Buffer::operator+=(cygnal::Element::amf0_type_e type)
{
// GNASH_REPORT_FUNCTION;
boost::uint8_t nb = static_cast<boost::uint8_t>(type);
@@ -466,7 +466,7 @@
///
/// @return A reference to a Buffer.
Buffer &
-Buffer::operator=(amf::Element::amf0_type_e type)
+Buffer::operator=(cygnal::Element::amf0_type_e type)
{
boost::uint8_t nb = static_cast<boost::uint8_t>(type);
return operator=(nb);
@@ -708,7 +708,7 @@
// deleted when this method returns.
// We loose data if we resize smaller than the data currently held.
if (size < used) {
- gnash::log_error("amf::Buffer::resize(%d): Truncating data (%d
bytes) while resizing!", size, used - size);
+ gnash::log_error("cygnal::Buffer::resize(%d): Truncating data (%d
bytes) while resizing!", size, used - size);
used = size;
}
boost::uint8_t *newptr = new boost::uint8_t[size];
=== modified file 'cygnal/libamf/buffer.h'
--- a/cygnal/libamf/buffer.h 2010-03-11 01:47:08 +0000
+++ b/cygnal/libamf/buffer.h 2010-05-27 22:44:28 +0000
@@ -37,10 +37,10 @@
// _definst_ is the default instance name
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf
+namespace cygnal
{
// Adjust for the constant size
@@ -200,7 +200,7 @@
/// @param type An AMF0 type.
///
/// @return A reference to a Buffer.
- Buffer &operator=(amf::Element::amf0_type_e type);
+ Buffer &operator=(cygnal::Element::amf0_type_e type);
/// Copy a boolean into the buffer. This overwrites all data, and
/// resets the seek ptr.
///
@@ -266,7 +266,7 @@
/// @param type An AMF0 type.
///
/// @return A reference to a Buffer.
- Buffer &operator+=(amf::Element::amf0_type_e type);
+ Buffer &operator+=(cygnal::Element::amf0_type_e type);
/// \brief Append a boolean to existing data in the buffer.
///
/// @param type A boolean.
@@ -444,11 +444,11 @@
return os;
}
-} // end of amf namespace
+} // end of namespace cygnal
#endif // end of __BUFFER_H__
// local Variables:
// mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: nil
// End:
=== modified file 'cygnal/libamf/element.cpp'
--- a/cygnal/libamf/element.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libamf/element.cpp 2010-05-27 22:44:28 +0000
@@ -36,10 +36,10 @@
using std::string;
using gnash::log_error;
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf
+namespace cygnal
{
/// \brief This is used to print more intelligent debug messages
@@ -186,7 +186,7 @@
}
// Build up the properties for the function block
- shared_ptr<amf::Element> el = new Element(flag);
+ shared_ptr<cygnal::Element> el = new Element(flag);
_properties.push_back(el);
el = new Element(unknown1);
@@ -404,7 +404,7 @@
}
size_t
-Element::calculateSize(amf::Element &el) const
+Element::calculateSize(cygnal::Element &el) const
{
// GNASH_REPORT_FUNCTION;
size_t outsize = 0;
@@ -431,14 +431,14 @@
// More complex messages have child elements, either properties or
// the items in an array, If we have children, count up their size too.
// Calculate the total size of the message
- std::vector<boost::shared_ptr<amf::Element> > props = el.getProperties();
+ std::vector<boost::shared_ptr<cygnal::Element> > props =
el.getProperties();
for (size_t i=0; i<props.size(); i++) {
outsize += props[i]->getDataSize();
if (props[i]->getNameSize()) {
outsize += props[i]->getNameSize();
- outsize += amf::AMF_PROP_HEADER_SIZE;
+ outsize += cygnal::AMF_PROP_HEADER_SIZE;
} else {
- outsize += amf::AMF_HEADER_SIZE;
+ outsize += cygnal::AMF_HEADER_SIZE;
}
}
@@ -711,7 +711,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeNumber(boost::shared_ptr<amf::Buffer> buf)
+Element::makeNumber(boost::shared_ptr<cygnal::Buffer> buf)
{
// GNASH_REPORT_FUNCTION;
return makeNumber(buf->reference());
@@ -1189,7 +1189,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeECMAArray(const std::string &name,
std::vector<boost::shared_ptr<amf::Element> > &data)
+Element::makeECMAArray(const std::string &name,
std::vector<boost::shared_ptr<cygnal::Element> > &data)
{
// GNASH_REPORT_FUNCTION;
_type = Element::ECMA_ARRAY_AMF0;
@@ -1206,7 +1206,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeECMAArray(std::vector<boost::shared_ptr<amf::Element> > &data)
+Element::makeECMAArray(std::vector<boost::shared_ptr<cygnal::Element> > &data)
{
// GNASH_REPORT_FUNCTION;
makeObject(data);
@@ -1252,7 +1252,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeStrictArray(const std::string &name,
std::vector<boost::shared_ptr<amf::Element> > &data)
+Element::makeStrictArray(const std::string &name,
std::vector<boost::shared_ptr<cygnal::Element> > &data)
{
// GNASH_REPORT_FUNCTION;
makeObject(name, data);
@@ -1268,7 +1268,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeStrictArray(std::vector<boost::shared_ptr<amf::Element> > &data)
+Element::makeStrictArray(std::vector<boost::shared_ptr<cygnal::Element> >
&data)
{
// GNASH_REPORT_FUNCTION;
makeObject(data);
@@ -1569,7 +1569,7 @@
/// search for.
///
/// @return A smart pointer to the Element for this property.
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
Element::findProperty(const std::string &name)
{
if (_properties.size() > 0) {
=== modified file 'cygnal/libamf/element.h'
--- a/cygnal/libamf/element.h 2010-01-11 06:41:38 +0000
+++ b/cygnal/libamf/element.h 2010-05-27 22:44:28 +0000
@@ -30,10 +30,10 @@
//#include "network.h"
#include "dsodefs.h" // DSOEXPORT
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf
+namespace cygnal
{
// Forward decleration
@@ -254,7 +254,7 @@
/// @param buf A smart pointer to a Buffer class.
///
/// @return A reference to this Element.
- Element &makeNumber(boost::shared_ptr<amf::Buffer> buf);
+ Element &makeNumber(boost::shared_ptr<cygnal::Buffer> buf);
/// \brief Make this Element with a double value.
/// The size isn't needed as a double is always the same
size.
@@ -350,7 +350,7 @@
/// @param data A smart pointer to an Element to use as the value.
///
/// @return A reference to this Element.
- Element &makeObject(std::vector<boost::shared_ptr<amf::Element> > &data);
+ Element &makeObject(std::vector<boost::shared_ptr<cygnal::Element> >
&data);
/// \brief Make this Element a Property with an Object as the value.
///
@@ -359,7 +359,7 @@
/// @param data A smart pointer to an Element to use as the value.
///
/// @return A reference to this Element.
- Element &makeObject(const std::string &name,
std::vector<boost::shared_ptr<amf::Element> > &data);
+ Element &makeObject(const std::string &name,
std::vector<boost::shared_ptr<cygnal::Element> > &data);
/// \brief Make this Element as an XML Object data type.
/// This is like a string object, but the type is different.
@@ -407,7 +407,7 @@
/// @param data A smart pointer to a vector of Elements to use as the
vaule.
///
/// @return A reference to this Element.
- Element &makeECMAArray(std::vector<boost::shared_ptr<amf::Element> >
&data);
+ Element &makeECMAArray(std::vector<boost::shared_ptr<cygnal::Element> >
&data);
/// \brief Make this Element a Property with an ECMA Array as the value.
///
@@ -416,7 +416,7 @@
/// @param data A smart pointer to a vector of Elements to use as the
vaule.
///
/// @return A reference to this Element.
- Element &makeECMAArray(const std::string &name,
std::vector<boost::shared_ptr<amf::Element> > &data);
+ Element &makeECMAArray(const std::string &name,
std::vector<boost::shared_ptr<cygnal::Element> > &data);
/// \brief Make this Element a Property with an Strict Array as the value.
/// This is an array of a single AMF type. These are stored
@@ -441,7 +441,7 @@
/// @param data A smart pointer to a vector of Elements to use as the
vaule.
///
/// @return A reference to this Element.
- Element &makeStrictArray(std::vector<boost::shared_ptr<amf::Element> >
&data);
+ Element &makeStrictArray(std::vector<boost::shared_ptr<cygnal::Element> >
&data);
/// \brief Make this Element a Property with an Strict Array as the value.
///
@@ -450,7 +450,7 @@
/// @param data A smart pointer to a vector of Elements to use as the
vaule.
///
/// @return A reference to this Element.
- Element &makeStrictArray(const std::string &name,
std::vector<boost::shared_ptr<amf::Element> > &data);
+ Element &makeStrictArray(const std::string &name,
std::vector<boost::shared_ptr<cygnal::Element> > &data);
/// \brief Make this Element a Property with an Typed Object as the value.
///
@@ -573,7 +573,7 @@
/// @param buf A smart pointer to an Element.
///
/// @return A boolean true if the Elements are indentical.
- bool operator==(boost::shared_ptr<amf::Element> );
+ bool operator==(boost::shared_ptr<cygnal::Element> );
/// \brief Test equivalance against a boolean value
/// This compares all the data and the data type in the
@@ -592,7 +592,7 @@
/// the array to get.
///
/// @return A smart pointer to the Element or property.
- boost::shared_ptr<amf::Element> operator[](size_t index);
+ boost::shared_ptr<cygnal::Element> operator[](size_t index);
/// \brief Get the size in bytes of the Element's data.
/// All data in an Element is stored in a Buffer class.
@@ -743,7 +743,7 @@
{ return _properties; };
size_t calculateSize();
- size_t calculateSize(amf::Element &el) const;
+ size_t calculateSize(cygnal::Element &el) const;
/// \brief Dump the internal data of this class in a human readable form.
/// @remarks This should only be used for debugging purposes.
@@ -770,7 +770,7 @@
/// \var _buffer
/// A smart pointer to the Buffer used to hold the data
/// for this Element.
- boost::shared_ptr<amf::Buffer> _buffer;
+ boost::shared_ptr<cygnal::Buffer> _buffer;
/// \var _type
/// The AMF0 data type of this Element.
@@ -798,5 +798,5 @@
// local Variables:
// mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: nil
// End:
=== modified file 'cygnal/libamf/flv.cpp'
--- a/cygnal/libamf/flv.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libamf/flv.cpp 2010-05-27 22:44:28 +0000
@@ -37,7 +37,7 @@
using gnash::log_debug;
using gnash::log_error;
-namespace amf
+namespace cygnal
{
Flv::Flv()
@@ -61,11 +61,11 @@
}
// Encode the data into a Buffer
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
Flv::encodeHeader(boost::uint8_t type)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf(new Buffer(sizeof(Flv::flv_header_t)));
+ boost::shared_ptr<cygnal::Buffer> buf(new
Buffer(sizeof(Flv::flv_header_t)));
buf->clear();
boost::uint8_t version = 0x1;
@@ -128,13 +128,13 @@
}
// Decode a MetaData object, which is after the header, but before all the tags
-boost::shared_ptr<amf::Element>
-Flv::decodeMetaData(boost::shared_ptr<amf::Buffer> buf)
+boost::shared_ptr<cygnal::Element>
+Flv::decodeMetaData(boost::shared_ptr<cygnal::Buffer> buf)
{
return decodeMetaData(buf->reference(), buf->size());
}
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
Flv::decodeMetaData(boost::uint8_t *buf, size_t size)
{
// GNASH_REPORT_FUNCTION;
@@ -306,21 +306,21 @@
return tag;
}
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
Flv::findProperty(const std::string &name)
{
if (_properties.size() > 0) {
- std::vector<boost::shared_ptr<amf::Element> >::iterator ait;
+ std::vector<boost::shared_ptr<cygnal::Element> >::iterator ait;
// cerr << "# of Properties in object: " << _properties.size() << endl;
for (ait = _properties.begin(); ait != _properties.end(); ait++) {
- boost::shared_ptr<amf::Element> el = (*(ait));
+ boost::shared_ptr<cygnal::Element> el = (*(ait));
if (el->getName() == name) {
return el;
}
// el->dump();
}
}
- boost::shared_ptr<amf::Element> el;
+ boost::shared_ptr<cygnal::Element> el;
return el;
}
@@ -329,11 +329,11 @@
{
// GNASH_REPORT_FUNCTION;
if (_properties.size() > 0) {
- std::vector<boost::shared_ptr<amf::Element> >::iterator ait;
+ std::vector<boost::shared_ptr<cygnal::Element> >::iterator ait;
std::cerr << "# of Properties in object: " << _properties.size()
<< std::endl;
for (ait = _properties.begin(); ait != _properties.end(); ait++) {
- boost::shared_ptr<amf::Element> el = (*(ait));
+ boost::shared_ptr<cygnal::Element> el = (*(ait));
// an onMetaData packet of an FLV stream only contains number or
// boolean bydefault
if (el->getType() == Element::NUMBER_AMF0) {
=== modified file 'cygnal/libamf/flv.h'
--- a/cygnal/libamf/flv.h 2010-01-11 06:41:38 +0000
+++ b/cygnal/libamf/flv.h 2010-05-27 22:44:28 +0000
@@ -30,10 +30,10 @@
#include "buffer.h"
#include "dsodefs.h" // DSOEXPORT
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf
+namespace cygnal
{
/// \brief The FLV header is always 9 bytes
@@ -167,14 +167,14 @@
/// @param type The data type for the header
///
/// @return a smart pointer to a Buffer containing the data in big endian
format.
- boost::shared_ptr<amf::Buffer> encodeHeader(boost::uint8_t type);
+ boost::shared_ptr<cygnal::Buffer> encodeHeader(boost::uint8_t type);
/// \brief Decode a Buffer into a header
///
/// @param buf a smart pointer to a Buffer containing the data.
///
/// @return a smart pointer to data structure that contains the data.
- boost::shared_ptr<flv_header_t>
decodeHeader(boost::shared_ptr<amf::Buffer> buf) { return
decodeHeader(buf->reference()); };
+ boost::shared_ptr<flv_header_t>
decodeHeader(boost::shared_ptr<cygnal::Buffer> buf) { return
decodeHeader(buf->reference()); };
boost::shared_ptr<flv_header_t> decodeHeader(boost::uint8_t *data);
/// \brief Decode a MetaData object.
@@ -183,7 +183,7 @@
/// @param buf a smart pointer to a Buffer containing the data.
///
/// @return a smart pointer to an Element that contains the data.
- boost::shared_ptr<amf::Element>
decodeMetaData(boost::shared_ptr<amf::Buffer> buf);
+ boost::shared_ptr<cygnal::Element>
decodeMetaData(boost::shared_ptr<cygnal::Buffer> buf);
/// \brief Decode a MetaData object.
/// This is after the header, but before all the other tags
usually
@@ -193,7 +193,7 @@
/// @param size The size of the data in bytes
///
/// @return a smart pointer to an Element that contains the data.
- boost::shared_ptr<amf::Element> decodeMetaData(boost::uint8_t *data,
size_t size);
+ boost::shared_ptr<cygnal::Element> decodeMetaData(boost::uint8_t *data,
size_t size);
/// \brief Decode an Audio object.
///
@@ -214,7 +214,7 @@
/// @param flags The data to deserialize.
///
/// @return a smart pointer to an video data structure that contains the
data.
- boost::shared_ptr<flv_tag_t>
decodeTagHeader(boost::shared_ptr<amf::Buffer> &buf) { return
decodeTagHeader(buf->reference()); };
+ boost::shared_ptr<flv_tag_t>
decodeTagHeader(boost::shared_ptr<cygnal::Buffer> &buf) { return
decodeTagHeader(buf->reference()); };
boost::shared_ptr<flv_tag_t> decodeTagHeader(boost::uint8_t *data);
/// \brief Find the named property for this Object.
@@ -223,14 +223,14 @@
/// search for.
///
/// @return A smart pointer to the Element for this property.
- boost::shared_ptr<amf::Element> findProperty(const std::string &name);
+ boost::shared_ptr<cygnal::Element> findProperty(const std::string &name);
/// \brief Set all the properties from an array of Element classes.
///
/// @param array
///
/// @return nothing
- void setProperties(std::vector<boost::shared_ptr<amf::Element> > array)
+ void setProperties(std::vector<boost::shared_ptr<cygnal::Element> > array)
{ _properties = array; };
/// \brief Convert a 24 bit integer to a 32 bit one so we can use it.
@@ -258,12 +258,12 @@
/// \var Flv::_properties
/// The array of properties for this Flv file, which is
/// populated by the data from the first onMetaTag block.
- std::vector<boost::shared_ptr<amf::Element> > _properties;
+ std::vector<boost::shared_ptr<cygnal::Element> > _properties;
/// \var _metadata
/// The data contained in the first onMetaData tag from
/// the FLV file.
- boost::shared_ptr<amf::Element> _metadata;
+ boost::shared_ptr<cygnal::Element> _metadata;
}; // end of class definition
=== modified file 'cygnal/libamf/lcshm.cpp'
--- a/cygnal/libamf/lcshm.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libamf/lcshm.cpp 2010-05-27 22:44:28 +0000
@@ -48,10 +48,11 @@
// * The listeners block starts at 40k+16 = 40976 bytes,
// * To add a listener, simply append its name in the listeners list (null
terminated strings)
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf {
+namespace cygnal
+{
// The maximum
// although a bool is one byte, it appears to be a short in AMF,
@@ -464,17 +465,17 @@
// Make sure it is always right. Probably wrong.
// Which is then always followed by 3 AMF objects.
- boost::shared_ptr<amf::Buffer> buf1 = AMF::encodeString(con);
+ boost::shared_ptr<cygnal::Buffer> buf1 = AMF::encodeString(con);
memcpy(ptr_FH, buf1->begin(), buf1->size());
ptr_FH += buf1->size();
const std::string protocol="localhost";
// This could equal to the domain name.
- boost::shared_ptr<amf::Buffer> buf2 = AMF::encodeString(protocol);
+ boost::shared_ptr<cygnal::Buffer> buf2 = AMF::encodeString(protocol);
memcpy(ptr_FH, buf2->begin(), buf2->size());
ptr_FH += buf2->size();
- boost::shared_ptr<amf::Buffer> buf3 = AMF::encodeString(host);
+ boost::shared_ptr<cygnal::Buffer> buf3 = AMF::encodeString(host);
memcpy(ptr_FH, buf3->begin(), buf3->size());
ptr_FH += buf3->size();
@@ -590,12 +591,12 @@
void
LcShm::send(const string& name , const string& domainname ,
- vector<amf::Element* >& data )
+ vector<cygnal::Element* >& data )
{
//GNASH_REPORT_FUNCTION;
boost::mutex::scoped_lock lock(_localconnection_mutex);
- std::vector<amf::Element* >::iterator iter;
+ std::vector<cygnal::Element* >::iterator iter;
if (!Listener::getBaseAddress()) return;
@@ -640,16 +641,16 @@
// Make sure it is right later.
// Which is then always followed by 3 AMF objects.
- boost::shared_ptr<amf::Buffer> buf1 = AMF::encodeString(name);
+ boost::shared_ptr<cygnal::Buffer> buf1 = AMF::encodeString(name);
memcpy(ptr, buf1->begin(), buf1->size());
ptr += buf1->size();
const std::string protocol="localhostf";
- boost::shared_ptr<amf::Buffer> buf2 = AMF::encodeString(protocol);
+ boost::shared_ptr<cygnal::Buffer> buf2 = AMF::encodeString(protocol);
memcpy(ptr, buf2->begin(), buf2->size());
ptr += buf2->size();
- boost::shared_ptr<amf::Buffer> buf3 = AMF::encodeString(domainname);
+ boost::shared_ptr<cygnal::Buffer> buf3 = AMF::encodeString(domainname);
memcpy(ptr, buf3->begin(), buf3->size());
ptr += buf3->size();
@@ -746,7 +747,7 @@
///
/// @return nothing.
/// We may only need a connection name for the receive function.
-///void recv(std::string &name, std::string &dataname,
boost::shared_ptr<amf::Element> data)
+///void recv(std::string &name, std::string &dataname,
boost::shared_ptr<cygnal::Element> data)
//{
//GNASH_REPORT_FUNCTION;
@@ -763,7 +764,7 @@
/// boost::uint8_t *parseHeader(boost::uint8_t *data, boost::uint8_t*
tooFar);
/// This should be easy if parseHeader function has been finished.
/// 3: Parse the body of the shared memory
-/// std::vector<boost::shared_ptr<amf::Element> >
parseBody(boost::uint8_t *data);
+/// std::vector<boost::shared_ptr<cygnal::Element> >
parseBody(boost::uint8_t *data);
/// This should be easy if parseHeader function has been finished.
/// 4: The listened should implement these commands somehow automatically .
/// Handler?
=== modified file 'cygnal/libamf/lcshm.h'
--- a/cygnal/libamf/lcshm.h 2010-02-09 16:03:15 +0000
+++ b/cygnal/libamf/lcshm.h 2010-05-27 22:44:28 +0000
@@ -29,10 +29,11 @@
#include "SharedMem.h"
#include "dsodefs.h"
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf {
+namespace cygnal
+{
/// \class Listener
/// Manipulate the list of LocalConnection Listeners. We've made
@@ -128,7 +129,7 @@
std::string connection_name;
std::string protocol;
std::string method_name;
- std::vector<boost::shared_ptr<amf::Element> > data; // this can be any
AMF data type
+ std::vector<boost::shared_ptr<cygnal::Element> > data; // this can be
any AMF data type
} lc_message_t;
/// \struct LcShm::lc_object.t
/// Hold the data for each connection to the memory segment.
@@ -191,7 +192,7 @@
///
/// @return nothing.
void send(const std::string& name, const std::string& dataname,
- std::vector< amf::Element* >& data);
+ std::vector< cygnal::Element* >& data);
/// \brief Read the date from the memory
///
@@ -202,7 +203,7 @@
///
/// @return nothing.
/// We may only need a connection name for the receive function.
- void recv(std::string &name, std::string &dataname,
boost::shared_ptr<amf::Element> data);
+ void recv(std::string &name, std::string &dataname,
boost::shared_ptr<cygnal::Element> data);
/// \brief Parse the body of a memory segment.
///
@@ -210,7 +211,7 @@
///
/// @return A vector of smart pointers to the AMF0 Elements in
/// this memopry segment.
- std::vector<boost::shared_ptr<amf::Element> > parseBody(boost::uint8_t
*data);
+ std::vector<boost::shared_ptr<cygnal::Element> > parseBody(boost::uint8_t
*data);
/// \brief Parse the header of the memory segment.
///
@@ -252,7 +253,7 @@
/// \brief Add an AMF0 Element array of data for this memory segment.
///
/// @return
- void addObject(boost::shared_ptr<amf::Element> el) {
_amfobjs.push_back(el); };
+ void addObject(boost::shared_ptr<cygnal::Element> el) {
_amfobjs.push_back(el); };
/// \brief Get the number of AMF0 Elements stored in this class.
///
@@ -262,7 +263,7 @@
/// \brief Get the array of AMF0 objects stored by this class.
///
/// @return A vector of smart pointers to AMF0 Elements.
- std::vector<boost::shared_ptr<amf::Element> > getElements() { return
_amfobjs; };
+ std::vector<boost::shared_ptr<cygnal::Element> > getElements() { return
_amfobjs; };
/// \brief Set the base address to be used for the memory segment.
///
@@ -296,7 +297,7 @@
/// \var LcShm::_amfobjs
/// A vector of AMF0 Elements in the memory segment.
/// Is this necessary if we have put all the things to pass in the
memory?
- std::vector<boost::shared_ptr<amf::Element> > _amfobjs;
+ std::vector<boost::shared_ptr<cygnal::Element> > _amfobjs;
///Si added
/// This is the mutex that controls access to the sharedmemory
=== modified file 'cygnal/libamf/sol.cpp'
--- a/cygnal/libamf/sol.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libamf/sol.cpp 2010-05-27 22:44:28 +0000
@@ -70,10 +70,10 @@
throw ParserException("Premature end of AMF stream"); \
}
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf
+namespace cygnal
{
SOL::SOL()
@@ -118,7 +118,7 @@
///
/// @return nothing.
void
-SOL::addObj(boost::shared_ptr<amf::Element> el)
+SOL::addObj(boost::shared_ptr<cygnal::Element> el)
{
// GNASH_REPORT_FUNCTION;
_amfobjs.push_back(el);
@@ -252,7 +252,7 @@
}
vector<boost::uint8_t>::iterator it;
- vector<boost::shared_ptr<amf::Element> >::iterator ita;
+ vector<boost::shared_ptr<cygnal::Element> >::iterator ita;
AMF amf_obj;
char *ptr;
int size = 0;
@@ -262,7 +262,7 @@
}
for (ita = _amfobjs.begin(); ita != _amfobjs.end(); ita++) {
- boost::shared_ptr<amf::Element> el = (*(ita));
+ boost::shared_ptr<cygnal::Element> el = (*(ita));
size += el->getNameSize() + el->getDataSize() + 7;
}
_filesize = size;
@@ -274,7 +274,7 @@
for (ita = _amfobjs.begin(); ita != _amfobjs.end(); ita++) {
boost::shared_ptr<Element> el = (*(ita));
- boost::shared_ptr<amf::Buffer> var = amf_obj.encodeProperty(el);
+ boost::shared_ptr<cygnal::Buffer> var = amf_obj.encodeProperty(el);
// boost::uint8_t *var = amf_obj.encodeProperty(el, outsize);
if (!var) {
continue;
@@ -436,7 +436,7 @@
ptr += 4;
AMF amf_obj;
- boost::shared_ptr<amf::Element> el;
+ boost::shared_ptr<cygnal::Element> el;
while ( ptr < tooFar) {
if (ptr) {
el = amf_obj.extractProperty(ptr, tooFar);
@@ -459,12 +459,12 @@
}
bool
-SOL::updateSO(boost::shared_ptr<amf::Element> &newel)
+SOL::updateSO(boost::shared_ptr<cygnal::Element> &newel)
{
// GNASH_REPORT_FUNCTION;
- vector<boost::shared_ptr<amf::Element> >::iterator ita;
+ vector<boost::shared_ptr<cygnal::Element> >::iterator ita;
for (ita = _amfobjs.begin(); ita != _amfobjs.end(); ita++) {
- boost::shared_ptr<amf::Element> oldel = (*(ita));
+ boost::shared_ptr<cygnal::Element> oldel = (*(ita));
if (oldel == newel) {
oldel = newel;
}
@@ -473,7 +473,7 @@
}
bool
-SOL::updateSO(int index, boost::shared_ptr<amf::Element> &el)
+SOL::updateSO(int index, boost::shared_ptr<cygnal::Element> &el)
{
// GNASH_REPORT_FUNCTION;
_amfobjs[index] = el;
@@ -487,14 +487,14 @@
SOL::dump()
{
using namespace std;
- vector<boost::shared_ptr<amf::Element> >::iterator it;
+ vector<boost::shared_ptr<cygnal::Element> >::iterator it;
cerr << "Dumping SOL file" << endl;
cerr << "The file name is: " << _filespec << endl;
cerr << "The size of the file is: " << _filesize << endl;
cerr << "The name of the object is: " << _objname << endl;
for (it = _amfobjs.begin(); it != _amfobjs.end(); it++) {
- boost::shared_ptr<amf::Element> el = (*(it));
+ boost::shared_ptr<cygnal::Element> el = (*(it));
cerr << el->getName() << ": ";
if (el->getType() == Element::STRING_AMF0) {
if (el->getDataSize() != 0) {
=== modified file 'cygnal/libamf/sol.h'
--- a/cygnal/libamf/sol.h 2010-01-01 17:48:26 +0000
+++ b/cygnal/libamf/sol.h 2010-05-27 22:44:28 +0000
@@ -37,10 +37,10 @@
// Padding - 4 bytes
// After this is a series of AMF objects
-/// \namespace amf
+/// \namespace cygnal
///
/// This namespace is for all the AMF specific classes in libamf.
-namespace amf
+namespace cygnal
{
// Forward declarations
@@ -138,7 +138,7 @@
///
/// @return A smart pointer to the array of properities for this
/// .sol file.
- std::vector<boost::shared_ptr<amf::Element> > &getElements() { return
_amfobjs; }
+ std::vector<boost::shared_ptr<cygnal::Element> > &getElements() { return
_amfobjs; }
/// \brief Get an element referenced by index in the array
///
@@ -179,8 +179,8 @@
/// in the .sol file.
const std::string &getObjectName() const { return _objname; };
- bool updateSO(boost::shared_ptr<amf::Element> &el);
- bool updateSO(int index, boost::shared_ptr<amf::Element> &el);
+ bool updateSO(boost::shared_ptr<cygnal::Element> &el);
+ bool updateSO(int index, boost::shared_ptr<cygnal::Element> &el);
/// \brief Dump the internal data of this class in a human readable form.
///
=== modified file 'cygnal/libnet/cache.h'
--- a/cygnal/libnet/cache.h 2010-03-08 03:39:32 +0000
+++ b/cygnal/libnet/cache.h 2010-05-27 22:44:28 +0000
@@ -101,7 +101,7 @@
/// The memory page size.
size_t _pagesize;
-amf::AMF::filetype_e _filetype; // FIXME: this shouldn't be here still
+cygnal::AMF::filetype_e _filetype; // FIXME: this shouldn't be here still
};
/// \brief Dump to the specified output stream.
@@ -117,5 +117,5 @@
// local Variables:
// mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: nil
// End:
=== modified file 'cygnal/libnet/cque.cpp'
--- a/cygnal/libnet/cque.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libnet/cque.cpp 2010-05-27 22:44:28 +0000
@@ -53,7 +53,7 @@
que_t::iterator it;
boost::mutex::scoped_lock lock(_mutex);
// for (it = _que.begin(); it != _que.end(); it++) {
-// boost::shared_ptr<amf::Buffer> ptr = *(it);
+// boost::shared_ptr<cygnal::Buffer> ptr = *(it);
// if (ptr->size()) { // FIXME: we probably want to delete ptr anyway,
// delete ptr; // but if we do, this will core dump.
// }
@@ -94,7 +94,7 @@
}
bool
-CQue::push(boost::shared_ptr<amf::Buffer> data)
+CQue::push(boost::shared_ptr<cygnal::Buffer> data)
{
// GNASH_REPORT_FUNCTION;
boost::mutex::scoped_lock lock(_mutex);
@@ -111,18 +111,18 @@
CQue::push(boost::uint8_t *data, int nbytes)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer);
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer);
std::copy(data, data + nbytes, buf->reference());
return push(buf);
}
// Pop the first date element off the FIFO
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
CQue::pop()
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
boost::mutex::scoped_lock lock(_mutex);
if (_que.size()) {
buf = _que.front();
@@ -135,7 +135,7 @@
}
// Peek at the first data element without removing it
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
CQue::peek()
{
// GNASH_REPORT_FUNCTION;
@@ -143,7 +143,7 @@
if (_que.size()) {
return _que.front();
}
- return boost::shared_ptr<amf::Buffer>();
+ return boost::shared_ptr<cygnal::Buffer>();
}
// Return the size of the queues
@@ -157,14 +157,14 @@
// Remove a range of elements
void
-CQue::remove(boost::shared_ptr<amf::Buffer> begin,
boost::shared_ptr<amf::Buffer> end)
+CQue::remove(boost::shared_ptr<cygnal::Buffer> begin,
boost::shared_ptr<cygnal::Buffer> end)
{
GNASH_REPORT_FUNCTION;
- deque<boost::shared_ptr<amf::Buffer> >::iterator it;
- deque<boost::shared_ptr<amf::Buffer> >::iterator start;
- deque<boost::shared_ptr<amf::Buffer> >::iterator stop;
+ deque<boost::shared_ptr<cygnal::Buffer> >::iterator it;
+ deque<boost::shared_ptr<cygnal::Buffer> >::iterator start;
+ deque<boost::shared_ptr<cygnal::Buffer> >::iterator stop;
boost::mutex::scoped_lock lock(_mutex);
- boost::shared_ptr<amf::Buffer> ptr;
+ boost::shared_ptr<cygnal::Buffer> ptr;
for (it = _que.begin(); it != _que.end(); it++) {
ptr = *(it);
if (ptr->reference() == begin->reference()) {
@@ -180,13 +180,13 @@
// Remove an element
void
-CQue::remove(boost::shared_ptr<amf::Buffer> element)
+CQue::remove(boost::shared_ptr<cygnal::Buffer> element)
{
GNASH_REPORT_FUNCTION;
- deque<boost::shared_ptr<amf::Buffer> >::iterator it;
+ deque<boost::shared_ptr<cygnal::Buffer> >::iterator it;
boost::mutex::scoped_lock lock(_mutex);
for (it = _que.begin(); it != _que.end(); ) {
- boost::shared_ptr<amf::Buffer> ptr = *(it);
+ boost::shared_ptr<cygnal::Buffer> ptr = *(it);
if (ptr->reference() == element->reference()) {
it = _que.erase(it);
} else {
@@ -197,7 +197,7 @@
// Merge sucessive buffers into one single larger buffer. This is for some
// protocols, than have very long headers.
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
CQue::merge()
{
// GNASH_REPORT_FUNCTION;
@@ -205,8 +205,8 @@
return merge(_que.front());
}
-boost::shared_ptr<amf::Buffer>
-CQue::merge(boost::shared_ptr<amf::Buffer> start)
+boost::shared_ptr<cygnal::Buffer>
+CQue::merge(boost::shared_ptr<cygnal::Buffer> start)
{
// GNASH_REPORT_FUNCTION;
// Find iterator to first element to merge
@@ -224,7 +224,7 @@
size_t sz = (*to)->size();
totalsize += sz;
// log_debug("%s: Totalsize is %s", __PRETTY_FUNCTION__, totalsize);
- if (sz < amf::NETBUFSIZE) {
+ if (sz < cygnal::NETBUFSIZE) {
break;
}
}
@@ -232,7 +232,7 @@
// log_debug("%s: Final Totalsize is %s", __PRETTY_FUNCTION__, totalsize);
// Merge all elements in a single buffer. We have totalsize now.
- boost::shared_ptr<amf::Buffer> newbuf(new amf::Buffer(totalsize));
+ boost::shared_ptr<cygnal::Buffer> newbuf(new cygnal::Buffer(totalsize));
for (que_t::iterator i=from; i!=to; ++i) {
// log_debug("%s: copying %d bytes, space left is %d, totalsize is %d",
__PRETTY_FUNCTION__,
// (*i)->allocated(), newbuf->spaceLeft(), totalsize);
@@ -260,12 +260,12 @@
CQue::dump()
{
// GNASH_REPORT_FUNCTION;
- deque<boost::shared_ptr<amf::Buffer> >::iterator it;
+ deque<boost::shared_ptr<cygnal::Buffer> >::iterator it;
boost::mutex::scoped_lock lock(_mutex);
std::cerr << std::endl << "CQue \"" << _name << "\" has "<< _que.size()
<< " buffers." << std::endl;
for (it = _que.begin(); it != _que.end(); it++) {
- boost::shared_ptr<amf::Buffer> ptr = *(it);
+ boost::shared_ptr<cygnal::Buffer> ptr = *(it);
ptr->dump();
}
#ifdef USE_STATS_QUEUE
=== modified file 'cygnal/libnet/cque.h'
--- a/cygnal/libnet/cque.h 2010-03-11 01:47:08 +0000
+++ b/cygnal/libnet/cque.h 2010-05-27 22:44:28 +0000
@@ -36,7 +36,7 @@
class CQue {
public:
- typedef std::deque<boost::shared_ptr<amf::Buffer> > que_t;
+ typedef std::deque<boost::shared_ptr<cygnal::Buffer> > que_t;
#ifdef USE_STATS_QUEUE
typedef struct {
struct timespec start;
@@ -50,11 +50,11 @@
~CQue();
// Push data onto the que
bool push(boost::uint8_t *data, int nbytes);
- bool push(boost::shared_ptr<amf::Buffer> data);
+ bool push(boost::shared_ptr<cygnal::Buffer> data);
// Pop the first date element off the que
- boost::shared_ptr<amf::Buffer> DSOEXPORT pop();
+ boost::shared_ptr<cygnal::Buffer> DSOEXPORT pop();
// Peek at the first date element witjhout removing it from the que
- boost::shared_ptr<amf::Buffer> DSOEXPORT peek();
+ boost::shared_ptr<cygnal::Buffer> DSOEXPORT peek();
// Get the number of elements in the que
size_t DSOEXPORT size();
// Wait for a condition variable to trigger
@@ -64,16 +64,16 @@
// Empty the que of all data.
void clear();
// Remove a range of elements
- void remove(boost::shared_ptr<amf::Buffer> begin,
boost::shared_ptr<amf::Buffer> end);
+ void remove(boost::shared_ptr<cygnal::Buffer> begin,
boost::shared_ptr<cygnal::Buffer> end);
// // Remove an element
-// void remove(boost::shared_ptr<amf::Buffer> it);
- void remove(boost::shared_ptr<amf::Buffer> it);
+// void remove(boost::shared_ptr<cygnal::Buffer> it);
+ void remove(boost::shared_ptr<cygnal::Buffer> it);
// Merge sucessive buffers into one single larger buffer. This is for some
// protocols, than have very long headers.
- boost::shared_ptr<amf::Buffer> DSOEXPORT
merge(boost::shared_ptr<amf::Buffer> begin);
- boost::shared_ptr<amf::Buffer> DSOEXPORT merge();
+ boost::shared_ptr<cygnal::Buffer> DSOEXPORT
merge(boost::shared_ptr<cygnal::Buffer> begin);
+ boost::shared_ptr<cygnal::Buffer> DSOEXPORT merge();
- boost::shared_ptr<amf::Buffer> operator[] (int index) { return
_que[index]; };
+ boost::shared_ptr<cygnal::Buffer> operator[] (int index) { return
_que[index]; };
// Dump the data to the terminal
void dump();
=== modified file 'cygnal/libnet/diskstream.cpp'
--- a/cygnal/libnet/diskstream.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libnet/diskstream.cpp 2010-05-27 22:44:28 +0000
@@ -210,7 +210,7 @@
#endif
}
-DiskStream::DiskStream(const string &str, amf::Buffer &buf)
+DiskStream::DiskStream(const string &str, cygnal::Buffer &buf)
: _state(DiskStream::NO_STATE),
_filefd(0),
_netfd(0),
@@ -507,15 +507,15 @@
boost::uint8_t *ptr = dataptr;
if (_filetype == FILETYPE_FLV) {
// FIXME: for now, assume all media files are in FLV format
- _flv.reset(new amf::Flv);
- boost::shared_ptr<amf::Flv::flv_header_t> head =
_flv->decodeHeader(ptr);
- ptr += sizeof(amf::Flv::flv_header_t);
- ptr += sizeof(amf::Flv::previous_size_t);
- boost::shared_ptr<amf::Flv::flv_tag_t> tag =
_flv->decodeTagHeader(ptr);
- ptr += sizeof(amf::Flv::flv_tag_t);
+ _flv.reset(new cygnal::Flv);
+ boost::shared_ptr<cygnal::Flv::flv_header_t> head =
_flv->decodeHeader(ptr);
+ ptr += sizeof(cygnal::Flv::flv_header_t);
+ ptr += sizeof(cygnal::Flv::previous_size_t);
+ boost::shared_ptr<cygnal::Flv::flv_tag_t> tag =
_flv->decodeTagHeader(ptr);
+ ptr += sizeof(cygnal::Flv::flv_tag_t);
size_t bodysize = _flv->convert24(tag->bodysize);
- if (tag->type == amf::Flv::TAG_METADATA) {
- boost::shared_ptr<amf::Element> metadata =
_flv->decodeMetaData(ptr, bodysize);
+ if (tag->type == cygnal::Flv::TAG_METADATA) {
+ boost::shared_ptr<cygnal::Element> metadata =
_flv->decodeMetaData(ptr, bodysize);
if (metadata) {
metadata->dump();
}
@@ -564,7 +564,7 @@
}
bool
-DiskStream::writeToDisk(const std::string &filespec, amf::Buffer &data)
+DiskStream::writeToDisk(const std::string &filespec, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return writeToDisk(filespec, data.reference(), data.allocated());
=== modified file 'cygnal/libnet/diskstream.h'
--- a/cygnal/libnet/diskstream.h 2010-02-14 00:41:33 +0000
+++ b/cygnal/libnet/diskstream.h 2010-05-27 22:44:28 +0000
@@ -88,7 +88,7 @@
DSOEXPORT DiskStream();
DSOEXPORT DiskStream(const std::string &filespec);
- DSOEXPORT DiskStream(const std::string &filespec, amf::Buffer &buf);
+ DSOEXPORT DiskStream(const std::string &filespec, cygnal::Buffer &buf);
DSOEXPORT DiskStream(const std::string &filespec, boost::uint8_t *data,
size_t size);
DSOEXPORT DiskStream(const std::string &filespec, int netfd);
DSOEXPORT ~DiskStream();
@@ -200,7 +200,7 @@
///
/// @return true if the operation suceeded, false if it failed.
DSOEXPORT bool writeToDisk(const std::string &filespec, boost::uint8_t
*data, size_t size);
- DSOEXPORT bool writeToDisk(const std::string &filespec, amf::Buffer &data);
+ DSOEXPORT bool writeToDisk(const std::string &filespec, cygnal::Buffer
&data);
DSOEXPORT bool writeToDisk(const std::string &filespec);
DSOEXPORT bool writeToDisk();
@@ -353,7 +353,7 @@
#endif
// The header, tag, and onMetaData from the FLV file.
- boost::shared_ptr<amf::Flv> _flv;
+ boost::shared_ptr<cygnal::Flv> _flv;
};
/// \brief Dump to the specified output stream.
=== modified file 'cygnal/libnet/http.cpp'
--- a/cygnal/libnet/http.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libnet/http.cpp 2010-05-27 22:44:28 +0000
@@ -140,7 +140,7 @@
boost::uint8_t *
-HTTP::processHeaderFields(amf::Buffer *buf)
+HTTP::processHeaderFields(cygnal::Buffer *buf)
{
// GNASH_REPORT_FUNCTION;
string head(reinterpret_cast<const char *>(buf->reference()), buf->size());
@@ -236,12 +236,12 @@
// // Parse an Echo Request message coming from the Red5 echo_test. This
// // method should only be used for testing purposes.
-// vector<boost::shared_ptr<amf::Element > >
+// vector<boost::shared_ptr<cygnal::Element > >
// HTTP::parseEchoRequest(boost::uint8_t *data, size_t size)
// {
// // GNASH_REPORT_FUNCTION;
-// vector<boost::shared_ptr<amf::Element > > headers;
+// vector<boost::shared_ptr<cygnal::Element > > headers;
// // skip past the header bytes, we don't care about them.
// boost::uint8_t *tmpptr = data + 6;
@@ -252,7 +252,7 @@
// // Get the first name, which is a raw string, and not preceded by
// // a type byte.
-// boost::shared_ptr<amf::Element > el1(new amf::Element);
+// boost::shared_ptr<cygnal::Element > el1(new cygnal::Element);
// // If the length of the name field is corrupted, then we get out of
// // range quick, and corrupt memory. This is a bit of a hack, but
@@ -271,7 +271,7 @@
// // a type byte.
// length = ntohs((*(boost::uint16_t *)tmpptr) & 0xffff);
// tmpptr += sizeof(boost::uint16_t);
-// boost::shared_ptr<amf::Element > el2(new amf::Element);
+// boost::shared_ptr<cygnal::Element > el2(new cygnal::Element);
// // std::string name2(reinterpret_cast<const char *>(tmpptr), length);
// // el2->setName(name2.c_str(), name2.size());
@@ -291,11 +291,11 @@
// // Get the last two pieces of data, which are both AMF encoded
// // with a type byte.
// amf::AMF amf;
-// boost::shared_ptr<amf::Element> el3 = amf.extractAMF(tmpptr, tmpptr +
size);
+// boost::shared_ptr<cygnal::Element> el3 = amf.extractAMF(tmpptr, tmpptr
+ size);
// headers.push_back(el3);
// tmpptr += amf.totalsize();
-// boost::shared_ptr<amf::Element> el4 = amf.extractAMF(tmpptr, tmpptr +
size);
+// boost::shared_ptr<cygnal::Element> el4 = amf.extractAMF(tmpptr, tmpptr
+ size);
// headers.push_back(el4);
// return headers;
@@ -304,14 +304,14 @@
// // format a response to the 'echo' test used for testing Gnash. This
// // is only used for testing by developers. The format appears to be
// // two strings, followed by a double, followed by the "onResult".
-// amf::Buffer &
-// HTTP::formatEchoResponse(const std::string &num, amf::Element &el)
+// cygnal::Buffer &
+// HTTP::formatEchoResponse(const std::string &num, cygnal::Element &el)
// {
// // GNASH_REPORT_FUNCTION;
-// boost::shared_ptr<amf::Buffer> data;
+// boost::shared_ptr<cygnal::Buffer> data;
-// amf::Element nel;
-// if (el.getType() == amf::Element::TYPED_OBJECT_AMF0) {
+// cygnal::Element nel;
+// if (el.getType() == cygnal::Element::TYPED_OBJECT_AMF0) {
// nel.makeTypedObject();
// string name = el.getName();
// nel.setName(name);
@@ -319,7 +319,7 @@
// // FIXME: see about using std::reverse() instead.
// for (int i=el.propertySize()-1; i>=0; i--) {
// // for (int i=0 ; i<el.propertySize(); i++) {
-// boost::shared_ptr<amf::Element> child = el.getProperty(i);
+// boost::shared_ptr<cygnal::Element> child = el.getProperty(i);
// nel.addProperty(child);
// }
// data = nel.encode();
@@ -358,7 +358,7 @@
// GNASH_REPORT_FUNCTION;
bool result = false;
- boost::shared_ptr<amf::Buffer> buf(_que.peek());
+ boost::shared_ptr<cygnal::Buffer> buf(_que.peek());
if (buf) {
_cmd = extractCommand(buf->reference());
switch (_cmd) {
@@ -413,7 +413,7 @@
return false;
}
- boost::shared_ptr<amf::Buffer> buf(_que.pop());
+ boost::shared_ptr<cygnal::Buffer> buf(_que.pop());
// cerr << "YYYYYYY: " << (char *)buf->reference() << endl;
// cerr << hexify(buf->reference(), buf->allocated(), false) << endl;
@@ -451,7 +451,7 @@
}
// Send the reply
- amf::Buffer &reply = formatHeader(filestream->getFileType(),
+ cygnal::Buffer &reply = formatHeader(filestream->getFileType(),
filestream->getFileSize(),
HTTP::OK);
writeNet(fd, reply);
@@ -515,7 +515,7 @@
return false;
}
- boost::shared_ptr<amf::Buffer> buf(_que.pop());
+ boost::shared_ptr<cygnal::Buffer> buf(_que.pop());
if (buf == 0) {
log_debug("Que empty, net connection dropped for fd #%d", getFileFd());
return false;
@@ -525,7 +525,7 @@
clearHeader();
boost::uint8_t *data = processHeaderFields(*buf);
size_t length = strtol(getField("content-length").c_str(), NULL, 0);
- boost::shared_ptr<amf::Buffer> content(new amf::Buffer(length));
+ boost::shared_ptr<cygnal::Buffer> content(new cygnal::Buffer(length));
int ret = 0;
if (buf->allocated() - (data - buf->reference()) ) {
// cerr << "Don't need to read more data: have " << buf->allocated() << "
bytes" << endl;
@@ -548,7 +548,7 @@
log_debug("Got AMF data in POST");
#if 0
amf::AMF amf;
- boost::shared_ptr<amf::Element> el =
amf.extractAMF(content.reference(), content.end());
+ boost::shared_ptr<cygnal::Element> el =
amf.extractAMF(content.reference(), content.end());
el->dump(); // FIXME: do something intelligent
// with this Element
#endif
@@ -563,21 +563,21 @@
log_debug("Got CGI echo request in POST");
// cerr << "FIXME 2: " << hexify(content->reference(),
content->allocated(), true) << endl;
- vector<boost::shared_ptr<amf::Element> > headers =
parseEchoRequest(*content);
- //boost::shared_ptr<amf::Element> &el0 = headers[0];
- //boost::shared_ptr<amf::Element> &el1 = headers[1];
- //boost::shared_ptr<amf::Element> &el3 = headers[3];
+ vector<boost::shared_ptr<cygnal::Element> > headers =
parseEchoRequest(*content);
+ //boost::shared_ptr<cygnal::Element> &el0 = headers[0];
+ //boost::shared_ptr<cygnal::Element> &el1 = headers[1];
+ //boost::shared_ptr<cygnal::Element> &el3 = headers[3];
if (headers.size() >= 4) {
if (headers[3]) {
- amf::Buffer &reply = formatEchoResponse(headers[1]->getName(),
*headers[3]);
+ cygnal::Buffer &reply =
formatEchoResponse(headers[1]->getName(), *headers[3]);
// cerr << "FIXME 3: " << hexify(reply.reference(), reply.allocated(),
true) << endl;
// cerr << "FIXME 3: " << hexify(reply.reference(), reply.allocated(),
false) << endl;
writeNet(fd, reply);
}
}
} else {
- amf::Buffer &reply = formatHeader(_filetype, _filesize, HTTP::OK);
+ cygnal::Buffer &reply = formatHeader(_filetype, _filesize, HTTP::OK);
writeNet(fd, reply);
}
@@ -650,7 +650,7 @@
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5 (5.3 Request
Header Fields)
bool
-HTTP::checkRequestFields(amf::Buffer & /* buf */)
+HTTP::checkRequestFields(cygnal::Buffer & /* buf */)
{
// GNASH_REPORT_FUNCTION;
@@ -683,7 +683,7 @@
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec7 (7.1 Entity
Header Fields)
bool
-HTTP::checkEntityFields(amf::Buffer & /* buf */)
+HTTP::checkEntityFields(cygnal::Buffer & /* buf */)
{
// GNASH_REPORT_FUNCTION;
@@ -710,7 +710,7 @@
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec4 (4.5 General
Header Fields)
bool
-HTTP::checkGeneralFields(amf::Buffer & /* buf */)
+HTTP::checkGeneralFields(cygnal::Buffer & /* buf */)
{
// GNASH_REPORT_FUNCTION;
@@ -754,7 +754,7 @@
return true;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatHeader(http_status_e type)
{
// GNASH_REPORT_FUNCTION;
@@ -762,7 +762,7 @@
return formatHeader(_filesize, type);
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatCommon(const string &data)
{
// GNASH_REPORT_FUNCTION;
@@ -772,14 +772,14 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatHeader(size_t size, http_status_e code)
{
// GNASH_REPORT_FUNCTION;
return formatHeader(_filetype, size, code);
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatHeader(DiskStream::filetype_e type, size_t size, http_status_e
code)
{
// GNASH_REPORT_FUNCTION;
@@ -956,7 +956,7 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatDate()
{
// GNASH_REPORT_FUNCTION;
@@ -991,7 +991,7 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatServer()
{
// GNASH_REPORT_FUNCTION;
@@ -1000,7 +1000,7 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatServer(const string &data)
{
// GNASH_REPORT_FUNCTION;
@@ -1011,7 +1011,7 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatContentLength()
{
// GNASH_REPORT_FUNCTION;
@@ -1019,7 +1019,7 @@
return formatContentLength(_filesize);
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatContentLength(boost::uint32_t filesize)
{
// GNASH_REPORT_FUNCTION;
@@ -1034,14 +1034,14 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatContentType()
{
// GNASH_REPORT_FUNCTION;
return formatContentType(_filetype);
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatContentType(DiskStream::filetype_e filetype)
{
// GNASH_REPORT_FUNCTION;
@@ -1112,7 +1112,7 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatLastModified()
{
// GNASH_REPORT_FUNCTION;
@@ -1131,14 +1131,14 @@
return formatLastModified(date.str());
}
-amf::Buffer &
-HTTP::formatEchoResponse(const std::string &num, amf::Buffer &data)
+cygnal::Buffer &
+HTTP::formatEchoResponse(const std::string &num, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return formatEchoResponse(num, data.reference(), data.allocated());
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatEchoResponse(const std::string &num, boost::uint8_t *data, size_t
size)
{
// GNASH_REPORT_FUNCTION;
@@ -1146,8 +1146,8 @@
//boost::uint8_t *tmpptr = data;
// FIXME: temporary hacks while debugging
- amf::Buffer fixme("00 00 00 00 00 01");
- amf::Buffer fixme2("ff ff ff ff");
+ cygnal::Buffer fixme("00 00 00 00 00 01");
+ cygnal::Buffer fixme2("ff ff ff ff");
_buffer = "HTTP/1.1 200 OK\r\n";
formatContentType(DiskStream::FILETYPE_AMF);
@@ -1168,23 +1168,23 @@
// the request, a slash followed by a number like "/2".
string result = num;
result += "/onResult";
- boost::shared_ptr<amf::Buffer> res = amf::AMF::encodeString(result);
+ boost::shared_ptr<cygnal::Buffer> res = cygnal::AMF::encodeString(result);
_buffer.append(res->begin()+1, res->size()-1);
// Add the null data item
- boost::shared_ptr<amf::Buffer> null = amf::AMF::encodeString("null");
+ boost::shared_ptr<cygnal::Buffer> null = cygnal::AMF::encodeString("null");
_buffer.append(null->begin()+1, null->size()-1);
// Add the other binary blob
_buffer += fixme2;
- amf::Element::amf0_type_e type =
static_cast<amf::Element::amf0_type_e>(*data);
- if ((type == amf::Element::UNSUPPORTED_AMF0)
- || (type == amf::Element::NULL_AMF0)) {
+ cygnal::Element::amf0_type_e type =
static_cast<cygnal::Element::amf0_type_e>(*data);
+ if ((type == cygnal::Element::UNSUPPORTED_AMF0)
+ || (type == cygnal::Element::NULL_AMF0)) {
_buffer += type;
// Red5 returns a NULL object when it's recieved an undefined one in
the echo_test
- } else if (type == amf::Element::UNDEFINED_AMF0) {
- _buffer += amf::Element::NULL_AMF0;
+ } else if (type == cygnal::Element::UNDEFINED_AMF0) {
+ _buffer += cygnal::Element::NULL_AMF0;
} else {
// Add the AMF data we're echoing back
if (size) {
@@ -1195,7 +1195,7 @@
return _buffer;
}
-amf::Buffer &
+cygnal::Buffer &
HTTP::formatRequest(const string &url, http_method_e cmd)
{
// GNASH_REPORT_FUNCTION;
@@ -1374,7 +1374,7 @@
// line number. There is supposed to be a ';' before the \r\n, as this
// field can have other attributes, but the OpenStreetMap server doesn't
// use the semi-colon, as it's optional, and rarely used anyway.
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
boost::uint8_t *start = std::find(data, data+size, '\r') + 2;
if (start != data+size) {
// extract the total size of the chunk
@@ -1383,7 +1383,7 @@
total = static_cast<size_t>(strtol(bytes.c_str(), NULL, 16));
log_debug("%s: Total size for first chunk is: %d, data size %d (%d)",
__PRETTY_FUNCTION__, total, size, sizesize);
- buf.reset(new amf::Buffer(total+2));
+ buf.reset(new cygnal::Buffer(total+2));
// Add the existing data from the previous packet
buf->copy(data+sizesize, size-sizesize);
}
@@ -1409,7 +1409,7 @@
// tell we're done processing chunks till one has a length of
// "0\r\n", this is important.
pktsize = 12;
- buf.reset(new amf::Buffer(pktsize+2));
+ buf.reset(new cygnal::Buffer(pktsize+2));
}
ret = readNet(buf->reference() + buf->allocated(), pktsize, 60);
//buf->dump();
@@ -1439,7 +1439,7 @@
pktsize = total+8; // FIXME: why do we need an 8
here ?
// log_debug("%s: Total size for chunk is: %d (%s),
adding %d bytes",
// __PRETTY_FUNCTION__, total, bytes, (start
- buf->reference()));
- amf::Buffer tmpbuf(start - buf->reference());
+ cygnal::Buffer tmpbuf(start - buf->reference());
// don't forget the two bytes for the "\r\n"
tmpbuf.copy(buf->reference() + bytes.size() + 2,
(start - buf->reference()));
buf->clear(); // FIXME: debug only
@@ -1494,14 +1494,14 @@
size_t ret = 0;
if (size == 0) {
- size = amf::NETBUFSIZE;
+ size = cygnal::NETBUFSIZE;
}
log_debug("Starting to wait for data in net for fd #%d", fd);
Network net;
do {
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(size));
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(size));
ret = net.readNet(fd, *buf, 5);
// cerr << __PRETTY_FUNCTION__ << ret << " : " << (char *)buf->reference()
<< endl;
@@ -1520,7 +1520,7 @@
if (ret > 0) {
buf->setSeekPointer(buf->reference() + ret);
// cerr << "XXXXX: " << (char *)buf->reference() << endl;
- if (ret < static_cast<int>(amf::NETBUFSIZE)) {
+ if (ret < static_cast<int>(cygnal::NETBUFSIZE)) {
// buf->resize(ret); FIXME: why does this corrupt
// the buffer ?
_que.push(buf);
=== modified file 'cygnal/libnet/http.h'
--- a/cygnal/libnet/http.h 2010-01-01 20:41:28 +0000
+++ b/cygnal/libnet/http.h 2010-05-27 22:44:28 +0000
@@ -131,13 +131,13 @@
~HTTP();
// Check the Header fields to make sure they're valid values.
- bool checkRequestFields(amf::Buffer &buf);
- bool checkEntityFields(amf::Buffer &buf);
- bool checkGeneralFields(amf::Buffer &buf);
+ bool checkRequestFields(cygnal::Buffer &buf);
+ bool checkEntityFields(cygnal::Buffer &buf);
+ bool checkGeneralFields(cygnal::Buffer &buf);
// // Parse an Echo Request message coming from the Red5 echo_test.
- std::vector<boost::shared_ptr<amf::Element > >
parseEchoRequest(amf::Buffer &buf) { return parseEchoRequest(buf.reference(),
buf.size()); };
- std::vector<boost::shared_ptr<amf::Element > >
parseEchoRequest(boost::uint8_t *buf, size_t size);
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseEchoRequest(cygnal::Buffer &buf) { return
parseEchoRequest(buf.reference(), buf.size()); };
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseEchoRequest(boost::uint8_t *buf, size_t size);
// Convert the Content-Length field to a number we can use
size_t getContentLength();
@@ -145,7 +145,7 @@
// process all the header fields in the Buffer, storing them internally
// in _fields. The address returned is the address where the Content data
// starts, and is "Content-Length" bytes long, of "Content-Type" data.
- boost::uint8_t *processHeaderFields(amf::Buffer *buf);
+ boost::uint8_t *processHeaderFields(cygnal::Buffer *buf);
// Get the field for header 'name' that was stored by processHeaderFields()
std::string &getField(const std::string &name) { return _fields[name]; };
@@ -160,11 +160,11 @@
boost::shared_ptr<http_response_t> parseStatus(const std::string &line);
// Handle the response for the request.
- boost::shared_ptr<amf::Buffer> formatServerReply(http_status_e code);
- amf::Buffer &formatGetReply(DiskStream::filetype_e type, size_t size,
http_status_e code);
- amf::Buffer &formatGetReply(size_t size, http_status_e code);
- amf::Buffer &formatGetReply(http_status_e code);
- amf::Buffer &formatPostReply(rtmpt_cmd_e code);
+ boost::shared_ptr<cygnal::Buffer> formatServerReply(http_status_e code);
+ cygnal::Buffer &formatGetReply(DiskStream::filetype_e type, size_t size,
http_status_e code);
+ cygnal::Buffer &formatGetReply(size_t size, http_status_e code);
+ cygnal::Buffer &formatGetReply(http_status_e code);
+ cygnal::Buffer &formatPostReply(rtmpt_cmd_e code);
// Make copies of ourself
HTTP &operator = (HTTP &obj);
@@ -185,62 +185,62 @@
/// chare a common constructor. A few require formatting
/// of numerical data into string data, so they can't use
/// the common form.
- amf::Buffer &formatCommon(const std::string &data);
+ cygnal::Buffer &formatCommon(const std::string &data);
- amf::Buffer &formatHeader(DiskStream::filetype_e type, size_t filesize,
+ cygnal::Buffer &formatHeader(DiskStream::filetype_e type, size_t filesize,
http_status_e code);
- amf::Buffer &formatHeader(size_t filesize, http_status_e type);
- amf::Buffer &formatHeader(http_status_e type);
- amf::Buffer &formatRequest(const std::string &url, http_method_e req);
+ cygnal::Buffer &formatHeader(size_t filesize, http_status_e type);
+ cygnal::Buffer &formatHeader(http_status_e type);
+ cygnal::Buffer &formatRequest(const std::string &url, http_method_e req);
// format a response to the 'echo' test used for testing Gnash.
- amf::Buffer &formatEchoResponse(const std::string &num, amf::Element &el);
- amf::Buffer &formatEchoResponse(const std::string &num, amf::Buffer &data);
- amf::Buffer &formatEchoResponse(const std::string &num, boost::uint8_t
*data, size_t size);
+ cygnal::Buffer &formatEchoResponse(const std::string &num, cygnal::Element
&el);
+ cygnal::Buffer &formatEchoResponse(const std::string &num, cygnal::Buffer
&data);
+ cygnal::Buffer &formatEchoResponse(const std::string &num, boost::uint8_t
*data, size_t size);
- amf::Buffer &formatMethod(const std::string &data)
+ cygnal::Buffer &formatMethod(const std::string &data)
{return formatCommon("Method: " + data); };
- amf::Buffer &formatDate();
- amf::Buffer &formatServer();
- amf::Buffer &formatServer(const std::string &data);
- amf::Buffer &formatReferer(const std::string &data)
+ cygnal::Buffer &formatDate();
+ cygnal::Buffer &formatServer();
+ cygnal::Buffer &formatServer(const std::string &data);
+ cygnal::Buffer &formatReferer(const std::string &data)
{return formatCommon("Referer: " + data); };
- amf::Buffer &formatConnection(const std::string &data)
+ cygnal::Buffer &formatConnection(const std::string &data)
{return formatCommon("Connection: " + data); };
- amf::Buffer &formatKeepAlive(const std::string &data)
+ cygnal::Buffer &formatKeepAlive(const std::string &data)
{return formatCommon("Keep-Alive: " + data); };
- amf::Buffer &formatContentLength();
- amf::Buffer &formatContentLength(boost::uint32_t filesize);
- amf::Buffer &formatContentType();
- amf::Buffer &formatContentType(DiskStream::filetype_e type);
- amf::Buffer &formatHost(const std::string &data)
+ cygnal::Buffer &formatContentLength();
+ cygnal::Buffer &formatContentLength(boost::uint32_t filesize);
+ cygnal::Buffer &formatContentType();
+ cygnal::Buffer &formatContentType(DiskStream::filetype_e type);
+ cygnal::Buffer &formatHost(const std::string &data)
{return formatCommon("Host: " + data); };
- amf::Buffer &formatAgent(const std::string &data)
+ cygnal::Buffer &formatAgent(const std::string &data)
{return formatCommon("User-Agent: " + data); };
- amf::Buffer &formatAcceptRanges(const std::string &data)
+ cygnal::Buffer &formatAcceptRanges(const std::string &data)
{return formatCommon("Accept-Ranges: " + data); };
- amf::Buffer &formatLastModified();
- amf::Buffer &formatLastModified(const std::string &data)
+ cygnal::Buffer &formatLastModified();
+ cygnal::Buffer &formatLastModified(const std::string &data)
{return formatCommon("Last-Modified: " + data); }
- amf::Buffer &formatEtag(const std::string &data)
+ cygnal::Buffer &formatEtag(const std::string &data)
{return formatCommon("Etag: " + data); };
- amf::Buffer &formatLanguage(const std::string &data)
+ cygnal::Buffer &formatLanguage(const std::string &data)
{return formatCommon("Accept-Language: " + data); };
- amf::Buffer &formatCharset(const std::string &data)
+ cygnal::Buffer &formatCharset(const std::string &data)
{return formatCommon("Accept-Charset: " + data); };
- amf::Buffer &formatEncoding(const std::string &data)
+ cygnal::Buffer &formatEncoding(const std::string &data)
{return formatCommon("Accept-Encoding: " + data); };
- amf::Buffer &formatTE(const std::string &data)
+ cygnal::Buffer &formatTE(const std::string &data)
{return formatCommon("TE: " + data); };
// All HTTP messages are terminated with a blank line
void terminateHeader() { _buffer += "\r\n"; };
-// amf::Buffer &formatErrorResponse(http_status_e err);
+// cygnal::Buffer &formatErrorResponse(http_status_e err);
// Return the header that's been built up.
boost::uint8_t *getHeader() { return _buffer.reference(); };
// Return the header that's been built up.
- amf::Buffer &getBuffer() { return _buffer; };
+ cygnal::Buffer &getBuffer() { return _buffer; };
// // Return the body that's been built up.
// std::string getBody() { return _body.str(); };
@@ -274,7 +274,7 @@
int sendMsg();
int sendMsg(int fd);
int sendMsg(const boost::uint8_t *data, size_t size);
- int sendMsg(boost::shared_ptr<amf::Buffer> &buf)
+ int sendMsg(boost::shared_ptr<cygnal::Buffer> &buf)
{ return sendMsg(buf->reference(), buf->size()); };
int sendMsg(std::stringstream &sstr)
{ return sendMsg(reinterpret_cast<const boost::uint8_t
*>(sstr.str().c_str()), sstr.str().size()); };
@@ -297,13 +297,13 @@
std::string &getDocRoot() { return _docroot; };
// Pop the first date element off the que
- boost::shared_ptr<amf::Buffer> DSOEXPORT popChunk() { return _que.pop(); };
+ boost::shared_ptr<cygnal::Buffer> DSOEXPORT popChunk() { return
_que.pop(); };
// Peek at the first date element witjhout removing it from the que
- boost::shared_ptr<amf::Buffer> DSOEXPORT peekChunk() { return _que.peek();
};
+ boost::shared_ptr<cygnal::Buffer> DSOEXPORT peekChunk() { return
_que.peek(); };
// Get the number of elements in the que
size_t DSOEXPORT sizeChunks() { return _que.size(); };
- boost::shared_ptr<amf::Buffer> DSOEXPORT mergeChunks() { return
_que.merge(); };
+ boost::shared_ptr<cygnal::Buffer> DSOEXPORT mergeChunks() { return
_que.merge(); };
http_method_e getOperation() { return _cmd; };
@@ -311,14 +311,14 @@
// Examine the beginning of the data for an HTTP request command
// like GET or POST, etc...
http_method_e extractCommand(boost::uint8_t *data);
- http_method_e extractCommand(amf::Buffer &data)
+ http_method_e extractCommand(cygnal::Buffer &data)
{ return extractCommand(data.reference()); };
typedef boost::char_separator<char> Sep;
typedef boost::tokenizer<Sep> Tok;
http_method_e _cmd;
- amf::Buffer _buffer;
+ cygnal::Buffer _buffer;
CQue _que;
DiskStream::filetype_e _filetype;
=== modified file 'cygnal/libnet/network.cpp'
--- a/cygnal/libnet/network.cpp 2010-04-16 14:18:46 +0000
+++ b/cygnal/libnet/network.cpp 2010-05-27 22:44:28 +0000
@@ -770,11 +770,11 @@
return false;
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
Network::readNet()
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buffer(new amf::Buffer);
+ boost::shared_ptr<cygnal::Buffer> buffer(new cygnal::Buffer);
int ret = readNet(*buffer);
if (ret > 0) {
buffer->resize(ret);
@@ -784,7 +784,7 @@
// Read from the connection
int
-Network::readNet(int fd, amf::Buffer &buffer)
+Network::readNet(int fd, cygnal::Buffer &buffer)
{
// GNASH_REPORT_FUNCTION;
int ret = readNet(fd, buffer.reference(), buffer.size(), _timeout);
@@ -796,7 +796,7 @@
}
int
-Network::readNet(int fd, amf::Buffer *buffer)
+Network::readNet(int fd, cygnal::Buffer *buffer)
{
// GNASH_REPORT_FUNCTION;
int ret = readNet(fd, buffer->reference(), buffer->size(), _timeout);
@@ -808,7 +808,7 @@
}
int
-Network::readNet(amf::Buffer &buffer)
+Network::readNet(cygnal::Buffer &buffer)
{
// GNASH_REPORT_FUNCTION;
int ret = readNet(_sockfd, buffer, _timeout);
@@ -817,7 +817,7 @@
}
int
-Network::readNet(amf::Buffer &buffer, int timeout)
+Network::readNet(cygnal::Buffer &buffer, int timeout)
{
// GNASH_REPORT_FUNCTION;
int ret = readNet(_sockfd, buffer.reference(), buffer.size(), timeout);
@@ -829,7 +829,7 @@
}
int
-Network::readNet(int fd, amf::Buffer &buffer, int timeout)
+Network::readNet(int fd, cygnal::Buffer &buffer, int timeout)
{
// GNASH_REPORT_FUNCTION;
int ret = readNet(fd, buffer.reference(), buffer.size(), timeout);
@@ -994,14 +994,14 @@
// Write to the connection
int
-Network::writeNet(amf::Buffer *buffer)
+Network::writeNet(cygnal::Buffer *buffer)
{
// GNASH_REPORT_FUNCTION;
return writeNet(buffer->reference(), buffer->allocated());
}
int
-Network::writeNet(int fd, amf::Buffer *buffer)
+Network::writeNet(int fd, cygnal::Buffer *buffer)
{
// GNASH_REPORT_FUNCTION;
return writeNet(fd, buffer->reference(), buffer->allocated());
@@ -1009,7 +1009,7 @@
// Write to the connection
int
-Network::writeNet(amf::Buffer &buffer)
+Network::writeNet(cygnal::Buffer &buffer)
{
// GNASH_REPORT_FUNCTION;
return writeNet(buffer.reference(), buffer.allocated());
@@ -1017,7 +1017,7 @@
// Write to the connection
int
-Network::writeNet(int fd, amf::Buffer &buffer)
+Network::writeNet(int fd, cygnal::Buffer &buffer)
{
// GNASH_REPORT_FUNCTION;
return writeNet(fd, buffer.reference(), buffer.allocated());
=== modified file 'cygnal/libnet/network.h'
--- a/cygnal/libnet/network.h 2010-01-11 06:41:38 +0000
+++ b/cygnal/libnet/network.h 2010-05-27 22:44:28 +0000
@@ -62,7 +62,7 @@
#include "dsodefs.h" //For DSOEXPORT.
-namespace amf {
+namespace cygnal {
class Buffer;
}
@@ -138,7 +138,7 @@
int netfd;
void *entry;
void *handler;
- amf::Buffer *buffer;
+ cygnal::Buffer *buffer;
std::string filespec;
protocols_supported_e protocol;
} thread_params_t;
@@ -204,12 +204,12 @@
/// @param nbytes The number of bytes to try to read.
///
/// @return The number of bytes read.
- boost::shared_ptr<amf::Buffer> readNet();
- int readNet(amf::Buffer &buffer);
- int readNet(int fd, amf::Buffer &buffer);
- int readNet(int fd, amf::Buffer *buffer);
- int readNet(amf::Buffer &buffer, int timeout);
- int readNet(int fd, amf::Buffer &buffer, int timeout);
+ boost::shared_ptr<cygnal::Buffer> readNet();
+ int readNet(cygnal::Buffer &buffer);
+ int readNet(int fd, cygnal::Buffer &buffer);
+ int readNet(int fd, cygnal::Buffer *buffer);
+ int readNet(cygnal::Buffer &buffer, int timeout);
+ int readNet(int fd, cygnal::Buffer &buffer, int timeout);
int readNet(byte_t *data, int nbytes);
int readNet(byte_t *data, int nbytes, int timeout);
int readNet(int fd, byte_t *data, int nbytes);
@@ -226,10 +226,10 @@
/// @param nbytes The number of bytes to try to write..
///
/// @return The number of bytes read.
- int writeNet(amf::Buffer *buffer);
- int writeNet(amf::Buffer &buffer);
- int writeNet(int fd, amf::Buffer *buffer);
- int writeNet(int fd, amf::Buffer &buffer);
+ int writeNet(cygnal::Buffer *buffer);
+ int writeNet(cygnal::Buffer &buffer);
+ int writeNet(int fd, cygnal::Buffer *buffer);
+ int writeNet(int fd, cygnal::Buffer &buffer);
int writeNet(const std::string &data);
int writeNet(const byte_t *data, int nbytes);
// int writeNet(int fd, const byte_t *buffer);
@@ -363,5 +363,5 @@
// Local Variables:
// mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: nil
// End:
=== modified file 'cygnal/libnet/rtmp.cpp'
--- a/cygnal/libnet/rtmp.cpp 2010-03-08 02:13:37 +0000
+++ b/cygnal/libnet/rtmp.cpp 2010-05-27 22:44:28 +0000
@@ -226,21 +226,21 @@
}
void
-RTMP::addProperty(amf::Element &el)
+RTMP::addProperty(cygnal::Element &el)
{
// GNASH_REPORT_FUNCTION;
_properties[el.getName()] = el;
}
void
-RTMP::addProperty(char *name, amf::Element &el)
+RTMP::addProperty(char *name, cygnal::Element &el)
{
// GNASH_REPORT_FUNCTION;
_properties[name] = el;
}
-amf::Element &
+cygnal::Element &
RTMP::getProperty(const std::string &name)
{
// Find without inserting.
@@ -254,7 +254,7 @@
}
boost::shared_ptr<RTMP::rtmp_head_t>
-RTMP::decodeHeader(amf::Buffer &buf)
+RTMP::decodeHeader(cygnal::Buffer &buf)
{
// GNASH_REPORT_FUNCTION;
return decodeHeader(buf.reference());
@@ -372,11 +372,11 @@
/// * Routing - The source/destination of the message
//
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeHeader(int amf_index, rtmp_headersize_e head_size)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(1));
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(1));
buf->clear();
boost::uint8_t *ptr = buf->reference();
@@ -388,26 +388,26 @@
}
// There are 3 size of RTMP headers, 1, 4, 8, and 12.
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeHeader(int amf_index, rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
RTMPMsg::rtmp_source_e routing)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
switch(head_size) {
case HEADER_1:
- buf.reset(new amf::Buffer(1));
+ buf.reset(new cygnal::Buffer(1));
break;
case HEADER_4:
- buf.reset(new amf::Buffer(4));
+ buf.reset(new cygnal::Buffer(4));
break;
case HEADER_8:
- buf.reset(new amf::Buffer(8));
+ buf.reset(new cygnal::Buffer(8));
break;
case HEADER_12:
- buf.reset(new amf::Buffer(12));
+ buf.reset(new cygnal::Buffer(12));
break;
}
boost::uint8_t *ptr = buf->reference();
@@ -463,7 +463,7 @@
#if 0
bool
-RTMP::packetRead(amf::Buffer &buf)
+RTMP::packetRead(cygnal::Buffer &buf)
{
GNASH_REPORT_FUNCTION;
@@ -501,14 +501,14 @@
// ptr = decodeHeader(ptr);
// ptr += headersize;
- boost::shared_ptr<amf::Element> el = amf.extractAMF(ptr, tooFar);
+ boost::shared_ptr<cygnal::Element> el = amf.extractAMF(ptr, tooFar);
// el->dump();
el = amf.extractAMF(ptr, tooFar); // @@strk@@ : what's the +1 for ?
// el->dump();
log_network (_("Reading AMF packets till we're done..."));
// buf->dump();
while (ptr < end) {
- boost::shared_ptr<amf::Element> el = amf.extractProperty(ptr, tooFar);
+ boost::shared_ptr<cygnal::Element> el = amf.extractProperty(ptr,
tooFar);
addProperty(el);
// el->dump();
}
@@ -521,16 +521,16 @@
// buf = _handler->merge(buf); FIXME needs to use shared_ptr
}
while ((ptr - buf.begin()) < static_cast<int>(actual_size)) {
- boost::shared_ptr<amf::Element> el = amf.extractProperty(ptr, tooFar);
+ boost::shared_ptr<cygnal::Element> el = amf.extractProperty(ptr,
tooFar);
addProperty(el);
// el->dump(); // FIXME: dump the AMF objects as they are read
in
}
// dump();
- boost::shared_ptr<amf::Element> url = getProperty("tcUrl");
- boost::shared_ptr<amf::Element> file = getProperty("swfUrl");
- boost::shared_ptr<amf::Element> app = getProperty("app");
+ boost::shared_ptr<cygnal::Element> url = getProperty("tcUrl");
+ boost::shared_ptr<cygnal::Element> file = getProperty("swfUrl");
+ boost::shared_ptr<cygnal::Element> app = getProperty("app");
if (file) {
log_network("SWF file %s", file->to_string());
@@ -554,7 +554,7 @@
AMFProperties::iterator it;
for (it = _properties.begin(); it != _properties.end(); it++) {
// const char *name = it->first;
- amf::Element el = it->second;
+ cygnal::Element el = it->second;
el.dump();
}
}
@@ -616,14 +616,14 @@
return ping;
}
boost::shared_ptr<RTMP::rtmp_ping_t>
-RTMP::decodePing(amf::Buffer &buf)
+RTMP::decodePing(cygnal::Buffer &buf)
{
// GNASH_REPORT_FUNCTION;
return decodePing(buf.reference());
}
boost::shared_ptr<RTMP::user_event_t>
-RTMP::decodeUserControl(amf::Buffer &buf)
+RTMP::decodeUserControl(cygnal::Buffer &buf)
{
// GNASH_REPORT_FUNCTION;
return decodeUserControl(buf.reference());
@@ -679,17 +679,17 @@
// 02 00 00 00 00 00 06 04 00 00 00 00 00 04 00 00 00 01
// Stream Start -
// 02 00 00 00 00 00 06 04 00 00 00 00 00 00 00 00 00 01
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeUserControl(user_control_e eventid, boost::uint32_t data)
{
// GNASH_REPORT_FUNCTION;
boost::uint32_t swapped = 0;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
if (eventid == STREAM_BUFFER) {
- buf.reset(new amf::Buffer(sizeof(boost::uint16_t) * 5));
+ buf.reset(new cygnal::Buffer(sizeof(boost::uint16_t) * 5));
} else {
- buf.reset(new amf::Buffer(sizeof(boost::uint16_t) * 3));
+ buf.reset(new cygnal::Buffer(sizeof(boost::uint16_t) * 3));
}
// Set the type of this ping message
@@ -705,17 +705,17 @@
case STREAM_EOF:
case STREAM_NODATA:
swapped = data;
- amf::swapBytes(&swapped, sizeof(boost::uint32_t));
+ cygnal::swapBytes(&swapped, sizeof(boost::uint32_t));
*buf += swapped;
break;
case STREAM_BUFFER:
- buf.reset(new amf::Buffer(sizeof(boost::uint16_t) * 5));
+ buf.reset(new cygnal::Buffer(sizeof(boost::uint16_t) * 5));
break;
case STREAM_LIVE:
case STREAM_PING:
case STREAM_PONG:
swapped = data;
- amf::swapBytes(&swapped, sizeof(boost::uint32_t));
+ cygnal::swapBytes(&swapped, sizeof(boost::uint32_t));
*buf += swapped;
break;
default:
@@ -729,16 +729,16 @@
RTMP::decodeMsgBody(boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
- amf::AMF amf_obj;
+ cygnal::AMF amf_obj;
boost::uint8_t *ptr = data;
boost::uint8_t* tooFar = data + size;
bool status = false;
boost::shared_ptr<RTMPMsg> msg(new RTMPMsg);
// The first data object is the method name of this object.
- boost::shared_ptr<amf::Element> name = amf_obj.extractAMF(ptr, tooFar);
+ boost::shared_ptr<cygnal::Element> name = amf_obj.extractAMF(ptr, tooFar);
if (name) {
- ptr += name->getDataSize() + amf::AMF_HEADER_SIZE; // skip the length
bytes too
+ ptr += name->getDataSize() + cygnal::AMF_HEADER_SIZE; // skip the
length bytes too
} else {
log_error("Name field of RTMP Message corrupted!");
msg.reset();
@@ -747,13 +747,13 @@
// The stream ID is the second data object. All messages have
// these two objects at the minimum.
- boost::shared_ptr<amf::Element> streamid = amf_obj.extractAMF(ptr, tooFar);
+ boost::shared_ptr<cygnal::Element> streamid = amf_obj.extractAMF(ptr,
tooFar);
if (streamid) {
// Most onStatus messages have the stream ID, but the Data
// Start onStatus message is basically just a marker that an
// FLV file is coming next.
- if (streamid->getType() == amf::Element::NUMBER_AMF0) {
- ptr += amf::AMF0_NUMBER_SIZE + 1;
+ if (streamid->getType() == cygnal::Element::NUMBER_AMF0) {
+ ptr += cygnal::AMF0_NUMBER_SIZE + 1;
}
} else {
log_error("Stream ID field of RTMP Message corrupted!");
@@ -778,7 +778,7 @@
while (ptr < tooFar) {
// These pointers get deleted automatically when the msg
// object is deleted
- boost::shared_ptr<amf::Element> el = amf_obj.extractAMF(ptr, tooFar);
+ boost::shared_ptr<cygnal::Element> el = amf_obj.extractAMF(ptr,
tooFar);
ptr += amf_obj.totalsize();
if (el == 0) {
break;
@@ -793,7 +793,7 @@
}
boost::shared_ptr<RTMPMsg>
-RTMP::decodeMsgBody(amf::Buffer &buf)
+RTMP::decodeMsgBody(cygnal::Buffer &buf)
{
// GNASH_REPORT_FUNCTION;
return decodeMsgBody(buf.reference(), buf.allocated());
@@ -802,13 +802,13 @@
// 02 00 00 00 00 00 04 01 00 00 00 00 00 00 10 00
// id=2 timestamp=0 body_size=4 content_type=0x01 dest=0
// Set chunk size 4096
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeChunkSize(int size)
{
GNASH_REPORT_FUNCTION;
boost::uint32_t swapped = htonl(size);
- boost::shared_ptr<amf::Buffer> buf(new
amf::Buffer(sizeof(boost::uint32_t)));
+ boost::shared_ptr<cygnal::Buffer> buf(new
cygnal::Buffer(sizeof(boost::uint32_t)));
*buf += swapped;
return buf;
@@ -823,12 +823,12 @@
log_unimpl(__PRETTY_FUNCTION__);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeBytesRead()
{
GNASH_REPORT_FUNCTION;
log_unimpl(__PRETTY_FUNCTION__);
- return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
+ return boost::shared_ptr<cygnal::Buffer>((cygnal::Buffer*)0);
}
void
@@ -838,12 +838,12 @@
log_unimpl(__PRETTY_FUNCTION__);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeServer()
{
GNASH_REPORT_FUNCTION;
log_unimpl(__PRETTY_FUNCTION__);
- return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
+ return boost::shared_ptr<cygnal::Buffer>((cygnal::Buffer*)0);
}
void
@@ -853,12 +853,12 @@
log_unimpl(__PRETTY_FUNCTION__);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeClient()
{
GNASH_REPORT_FUNCTION;
log_unimpl(__PRETTY_FUNCTION__);
- return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
+ return boost::shared_ptr<cygnal::Buffer>((cygnal::Buffer*)0);
}
void
@@ -868,12 +868,12 @@
log_unimpl(__PRETTY_FUNCTION__);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeAudioData()
{
GNASH_REPORT_FUNCTION;
log_unimpl(__PRETTY_FUNCTION__);
- return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
+ return boost::shared_ptr<cygnal::Buffer>((cygnal::Buffer*)0);
}
void
@@ -883,12 +883,12 @@
log_unimpl(__PRETTY_FUNCTION__);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeVideoData()
{
GNASH_REPORT_FUNCTION;
log_unimpl(__PRETTY_FUNCTION__);
- return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
+ return boost::shared_ptr<cygnal::Buffer>((cygnal::Buffer*)0);
}
void
@@ -898,12 +898,12 @@
log_unimpl(__PRETTY_FUNCTION__);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeNotify()
{
GNASH_REPORT_FUNCTION;
log_unimpl(__PRETTY_FUNCTION__);
- return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
+ return boost::shared_ptr<cygnal::Buffer>((cygnal::Buffer*)0);
}
void
@@ -913,12 +913,12 @@
log_unimpl(__PRETTY_FUNCTION__);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeSharedObj()
{
GNASH_REPORT_FUNCTION;
log_unimpl(__PRETTY_FUNCTION__);
- return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
+ return boost::shared_ptr<cygnal::Buffer>((cygnal::Buffer*)0);
}
void
@@ -928,12 +928,12 @@
log_unimpl(__PRETTY_FUNCTION__);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::encodeInvoke()
{
GNASH_REPORT_FUNCTION;
log_unimpl(__PRETTY_FUNCTION__);
- return boost::shared_ptr<amf::Buffer>((amf::Buffer*)0);
+ return boost::shared_ptr<cygnal::Buffer>((cygnal::Buffer*)0);
}
void
RTMP::decodeInvoke()
@@ -949,7 +949,7 @@
bool
RTMP::sendMsg(int channel, rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
- RTMPMsg::rtmp_source_e routing, amf::Buffer &data)
+ RTMPMsg::rtmp_source_e routing, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return sendMsg(getFileFd(), channel, head_size, total_size, type, routing,
data.reference(), data.allocated());
@@ -958,7 +958,7 @@
bool
RTMP::sendMsg(int fd, int channel, rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
- RTMPMsg::rtmp_source_e routing, amf::Buffer &data)
+ RTMPMsg::rtmp_source_e routing, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return sendMsg(fd, channel, head_size, total_size, type, routing,
data.reference(), data.allocated());
@@ -997,19 +997,19 @@
// Figure out how many packets it'll take to send this data.
int pkts = size/_chunksize[channel];
- boost::shared_ptr<amf::Buffer> bigbuf(new amf::Buffer(size+pkts+100));
+ boost::shared_ptr<cygnal::Buffer> bigbuf(new
cygnal::Buffer(size+pkts+100));
// This builds the full header, which is required as the first part
// of the packet.
- boost::shared_ptr<amf::Buffer> head = encodeHeader(channel, head_size,
+ boost::shared_ptr<cygnal::Buffer> head = encodeHeader(channel, head_size,
total_size, type, routing);
// When more data is sent than fits in the chunksize for this
// channel, it gets broken into chunksize pieces, and each piece
// after the first packet is sent gets a one byte header instead.
#if 0
- boost::shared_ptr<amf::Buffer> cont_head = encodeHeader(channel,
RTMP::HEADER_1);
+ boost::shared_ptr<cygnal::Buffer> cont_head = encodeHeader(channel,
RTMP::HEADER_1);
#else
- boost::shared_ptr<amf::Buffer> cont_head(new amf::Buffer(1));
+ boost::shared_ptr<cygnal::Buffer> cont_head(new cygnal::Buffer(1));
boost::uint8_t foo = 0xc3;
*cont_head = foo;
#endif
@@ -1093,11 +1093,11 @@
#if 0
// Send a Msg, and expect a response back of some kind.
RTMPMsg *
-RTMP::sendRecvMsg(amf::Buffer &bufin)
+RTMP::sendRecvMsg(cygnal::Buffer &bufin)
{
GNASH_REPORT_FUNCTION;
// size_t total_size = buf2->size() - 6; // FIXME: why drop 6 bytes ?
- boost::shared_ptr<amf::Buffer> head = encodeHeader(amf_index, head_size,
total_size,
+ boost::shared_ptr<cygnal::Buffer> head = encodeHeader(amf_index,
head_size, total_size,
type, routing);
// int ret = 0;
int ret = writeNet(head->reference(), head->size()); // send the header
first
@@ -1109,7 +1109,7 @@
RTMP::rtmp_head_t *rthead = 0;
RTMPMsg *msg = 0;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
boost::uint8_t *ptr = 0;
@@ -1189,7 +1189,7 @@
case VIDEO_DATA:
{
log_network("Got VIDEO packets!!!");
- boost::shared_ptr<amf::Buffer> frame;
+ boost::shared_ptr<cygnal::Buffer> frame;
do {
frame = recvMsg(1); // use a 1 second timeout
if (frame) {
@@ -1245,7 +1245,7 @@
// Receive a message, which is a series of AMF elements, seperated
// by a one byte header at regular byte intervals. (128 bytes for
// video data by default). Each message main contain multiple packets.
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::recvMsg()
{
// GNASH_REPORT_FUNCTION;
@@ -1256,7 +1256,7 @@
// more efficient. As these reads may cross packet boundaries, and they may
// also include the RTMP header every _chunksize bytes, this raw data will
// need to be processed later on.
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMP::recvMsg(int fd)
{
// GNASH_REPORT_FUNCTION;
@@ -1265,7 +1265,7 @@
//bool nopacket = true;
// Read really big packets, they get split into the smaller ones when
'split'
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(3074));
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(3074));
do {
ret = readNet(fd, buf->reference()+ret, buf->size()-ret, _timeout);
// We got data. Resize the buffer if necessary.
@@ -1307,7 +1307,7 @@
// bytes another 1 byte RTMP header. The header itself is not part of the byte
// count.
boost::shared_ptr<RTMP::queues_t>
-RTMP::split(amf::Buffer &buf)
+RTMP::split(cygnal::Buffer &buf)
{
// GNASH_REPORT_FUNCTION;
return split(buf.reference(), buf.allocated());
@@ -1331,7 +1331,7 @@
//size_t nbytes = 0;
ptr = data;
- boost::shared_ptr<amf::Buffer> chunk;
+ boost::shared_ptr<cygnal::Buffer> chunk;
// There may be multiple messages in this Buffer, so we walk a
// temp pointer through the contents of the Buffer.
while ((ptr - data) < static_cast<int>(size)) {
@@ -1357,13 +1357,13 @@
// range, we can't really continue.
if (rthead->head_size <= RTMP_MAX_HEADER_SIZE) {
// Any packet with a header size greater than 1 is a
- // always a new RTMP message, so create a new amf::Buffer to
+ // always a new RTMP message, so create a new cygnal::Buffer to
// hold all the data.
if ((rthead->head_size >= 1) || (ptr == data)) {
// cerr << "New packet for channel #" << rthead->channel << "
of size "
// << (rthead->head_size + rthead->bodysize) << endl;
// give it some memory to store data in. We store
- chunk.reset(new amf::Buffer(rthead->bodysize +
rthead->head_size + 1));
+ chunk.reset(new cygnal::Buffer(rthead->bodysize +
rthead->head_size + 1));
// Each RTMP connection has 64 channels, so we store
// the header with the data so that info is accessible
// via the Buffer for processing later. All the data
@@ -1382,7 +1382,7 @@
if (chunk == 0) {
cerr << "Chunk wasn't allocated! " << (rthead->bodysize +
rthead->head_size)
<< std::endl;
- chunk.reset(new amf::Buffer(rthead->bodysize +
rthead->head_size));
+ chunk.reset(new cygnal::Buffer(rthead->bodysize +
rthead->head_size));
chunk->clear(); // FIXME: temporary debug only, should be
unnecessary
_queues[rthead->channel].push(chunk);
}
=== modified file 'cygnal/libnet/rtmp.h'
--- a/cygnal/libnet/rtmp.h 2010-04-16 14:18:46 +0000
+++ b/cygnal/libnet/rtmp.h 2010-05-27 22:44:28 +0000
@@ -143,7 +143,7 @@
class DSOEXPORT RTMP : public Network
{
public:
- typedef std::map<const char*, amf::Element> AMFProperties;
+ typedef std::map<const char*, cygnal::Element> AMFProperties;
typedef std::deque<CQue *> queues_t;
typedef enum {
ENCODE_AMF0=0x0,
@@ -267,7 +267,7 @@
// rtmp_status_e status;
// std::string method;
// double streamid;
-// std::vector<boost::shared_ptr<amf::Element> > objs;
+// std::vector<boost::shared_ptr<cygnal::Element> > objs;
// } rtmp_msg_t;
typedef enum {
RTMP_ERR_UNDEF,
@@ -324,19 +324,19 @@
// Decode
boost::shared_ptr<rtmp_head_t> decodeHeader(boost::uint8_t *header);
- boost::shared_ptr<rtmp_head_t> decodeHeader(amf::Buffer &data);
+ boost::shared_ptr<rtmp_head_t> decodeHeader(cygnal::Buffer &data);
- boost::shared_ptr<amf::Buffer> encodeHeader(int amf_index,
+ boost::shared_ptr<cygnal::Buffer> encodeHeader(int amf_index,
rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
RTMPMsg::rtmp_source_e routing);
- boost::shared_ptr<amf::Buffer> encodeHeader(int amf_index,
+ boost::shared_ptr<cygnal::Buffer> encodeHeader(int amf_index,
rtmp_headersize_e head_size);
- void addProperty(amf::Element &el);
- void addProperty(char *name, amf::Element &el);
- void addProperty(std::string &name, amf::Element &el);
- amf::Element &getProperty(const std::string &name);
+ void addProperty(cygnal::Element &el);
+ void addProperty(char *name, cygnal::Element &el);
+ void addProperty(std::string &name, cygnal::Element &el);
+ cygnal::Element &getProperty(const std::string &name);
// void setHandler(Handler *hand) { _handler = hand; };
int headerSize(boost::uint8_t header);
@@ -350,60 +350,60 @@
// Decode an RTMP message
boost::shared_ptr<RTMPMsg> decodeMsgBody(boost::uint8_t *data, size_t
size);
- boost::shared_ptr<RTMPMsg> decodeMsgBody(amf::Buffer &buf);
+ boost::shared_ptr<RTMPMsg> decodeMsgBody(cygnal::Buffer &buf);
virtual boost::shared_ptr<rtmp_ping_t> decodePing(boost::uint8_t *data);
- boost::shared_ptr<rtmp_ping_t> decodePing(amf::Buffer &buf);
+ boost::shared_ptr<rtmp_ping_t> decodePing(cygnal::Buffer &buf);
virtual boost::shared_ptr<user_event_t> decodeUserControl(boost::uint8_t
*data);
- boost::shared_ptr<user_event_t> decodeUserControl(amf::Buffer &buf);
- virtual boost::shared_ptr<amf::Buffer> encodeUserControl(user_control_e,
boost::uint32_t data);
+ boost::shared_ptr<user_event_t> decodeUserControl(cygnal::Buffer &buf);
+ virtual boost::shared_ptr<cygnal::Buffer>
encodeUserControl(user_control_e, boost::uint32_t data);
// These are handlers for the various types
- virtual boost::shared_ptr<amf::Buffer> encodeChunkSize(int size);
+ virtual boost::shared_ptr<cygnal::Buffer> encodeChunkSize(int size);
virtual void decodeChunkSize();
- virtual boost::shared_ptr<amf::Buffer> encodeBytesRead();
+ virtual boost::shared_ptr<cygnal::Buffer> encodeBytesRead();
virtual void decodeBytesRead();
- virtual boost::shared_ptr<amf::Buffer> encodeServer();
+ virtual boost::shared_ptr<cygnal::Buffer> encodeServer();
virtual void decodeServer();
- virtual boost::shared_ptr<amf::Buffer> encodeClient();
+ virtual boost::shared_ptr<cygnal::Buffer> encodeClient();
virtual void decodeClient();
- virtual boost::shared_ptr<amf::Buffer> encodeAudioData();
+ virtual boost::shared_ptr<cygnal::Buffer> encodeAudioData();
virtual void decodeAudioData();
- virtual boost::shared_ptr<amf::Buffer> encodeVideoData();
+ virtual boost::shared_ptr<cygnal::Buffer> encodeVideoData();
virtual void decodeVideoData();
- virtual boost::shared_ptr<amf::Buffer> encodeNotify();
+ virtual boost::shared_ptr<cygnal::Buffer> encodeNotify();
virtual void decodeNotify();
- virtual boost::shared_ptr<amf::Buffer> encodeSharedObj();
+ virtual boost::shared_ptr<cygnal::Buffer> encodeSharedObj();
virtual void decodeSharedObj();
- virtual boost::shared_ptr<amf::Buffer> encodeInvoke();
+ virtual boost::shared_ptr<cygnal::Buffer> encodeInvoke();
virtual void decodeInvoke();
// Receive a message, which is a series of AMF elements, seperated
// by a one byte header at regular byte intervals. (128 bytes for
// video data by default). Each message may contain multiple packets.
- boost::shared_ptr<amf::Buffer> recvMsg();
- boost::shared_ptr<amf::Buffer> recvMsg(int fd);
+ boost::shared_ptr<cygnal::Buffer> recvMsg();
+ boost::shared_ptr<cygnal::Buffer> recvMsg(int fd);
// Send a message, usually a single ActionScript object. This message
// may be broken down into a series of packets on a regular byte
// interval. (128 bytes for video data by default). Each message main
// contain multiple packets.
- bool sendMsg(amf::Buffer &data);
+ bool sendMsg(cygnal::Buffer &data);
bool sendMsg(int channel, rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
- RTMPMsg::rtmp_source_e routing, amf::Buffer &data);
+ RTMPMsg::rtmp_source_e routing, cygnal::Buffer &data);
bool sendMsg(int fd, int channel, rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
- RTMPMsg::rtmp_source_e routing, amf::Buffer &data);
+ RTMPMsg::rtmp_source_e routing, cygnal::Buffer &data);
bool sendMsg(int channel, rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
RTMPMsg::rtmp_source_e routing, boost::uint8_t *data, size_t
size);
@@ -415,14 +415,14 @@
// Send a Msg, and expect a response back of some kind.
RTMPMsg *sendRecvMsg(int amf_index, rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
- RTMPMsg::rtmp_source_e routing, amf::Buffer &buf);
+ RTMPMsg::rtmp_source_e routing, cygnal::Buffer
&buf);
#endif
// Split a large buffer into multiple smaller ones of the default chunksize
// of 128 bytes. We read network data in big chunks because it's more
efficient,
// but RTMP uses a weird scheme of a standard header, and then every
chunksize
// bytes another 1 byte RTMP header. The header itself is not part of the
byte
// count.
- boost::shared_ptr<queues_t> split(amf::Buffer &buf);
+ boost::shared_ptr<queues_t> split(cygnal::Buffer &buf);
boost::shared_ptr<queues_t> split(boost::uint8_t *data, size_t size);
CQue &operator[] (size_t x) { return _queues[x]; }
@@ -440,7 +440,7 @@
void dump();
protected:
AMFProperties _properties;
- amf::Buffer *_handshake;
+ cygnal::Buffer *_handshake;
// Handler *_handler;
rtmp_head_t _header;
int _packet_size;
@@ -452,7 +452,7 @@
int _timeout;
CQue _queues[MAX_AMF_INDEXES];
// queues_t _channels;
- amf::Buffer _buffer;
+ cygnal::Buffer _buffer;
rtmp_handshake_head_t _handshake_header;
};
=== modified file 'cygnal/libnet/rtmp_client.cpp'
--- a/cygnal/libnet/rtmp_client.cpp 2010-03-08 02:13:37 +0000
+++ b/cygnal/libnet/rtmp_client.cpp 2010-05-27 22:44:28 +0000
@@ -46,7 +46,7 @@
#include "GnashSleep.h"
#include "URL.h"
-typedef boost::shared_ptr<amf::Element> ElementSharedPtr;
+typedef boost::shared_ptr<cygnal::Element> ElementSharedPtr;
namespace gnash
{
@@ -79,7 +79,7 @@
// Make the NetConnection object that is used to connect to the
// server.
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeConnect()
{
// GNASH_REPORT_FUNCTION;
@@ -87,7 +87,7 @@
return encodeConnect(_path.c_str());
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeConnect(const char *uri)
{
// GNASH_REPORT_FUNCTION;
@@ -97,7 +97,7 @@
RTMPClient::SEEK);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeConnect(const char *uri,
double audioCodecs, double videoCodecs,
double videoFunction)
@@ -166,29 +166,29 @@
pageUrl.c_str());
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeConnect(const char *app, const char *swfUrl, const char
*tcUrl,
double audioCodecs, double videoCodecs, double
videoFunction,
const char *pageUrl)
{
GNASH_REPORT_FUNCTION;
- amf::AMF amf_obj;
+ cygnal::AMF amf_obj;
- ElementSharedPtr connect(new amf::Element);
+ ElementSharedPtr connect(new cygnal::Element);
connect->makeString("connect");
- ElementSharedPtr connum(new amf::Element);
+ ElementSharedPtr connum(new cygnal::Element);
// update the counter for the number of connections. This number is used
heavily
// in RTMP to help keep communications clear when there are multiple
streams.
_connections++;
connum->makeNumber(_connections);
// Make the top level object
- ElementSharedPtr obj(new amf::Element);
+ ElementSharedPtr obj(new cygnal::Element);
obj->makeObject();
- ElementSharedPtr appnode(new amf::Element);
+ ElementSharedPtr appnode(new cygnal::Element);
appnode->makeString("app", app);
obj->addProperty(appnode);
@@ -199,40 +199,40 @@
version = "LNX 9,0,31,0";
}
- ElementSharedPtr flashVer(new amf::Element);
+ ElementSharedPtr flashVer(new cygnal::Element);
flashVer->makeString("flashVer", version);
obj->addProperty(flashVer);
- ElementSharedPtr swfUrlnode(new amf::Element);
+ ElementSharedPtr swfUrlnode(new cygnal::Element);
// swfUrl->makeString("swfUrl",
"http://192.168.1.70/software/gnash/tests/ofla_demo.swf");
swfUrlnode->makeString("swfUrl", swfUrl);
obj->addProperty(swfUrlnode);
// filespec = "rtmp://localhost:5935/oflaDemo";
- ElementSharedPtr tcUrlnode(new amf::Element);
+ ElementSharedPtr tcUrlnode(new cygnal::Element);
tcUrlnode->makeString("tcUrl", tcUrl);
obj->addProperty(tcUrlnode);
- ElementSharedPtr fpad(new amf::Element);
+ ElementSharedPtr fpad(new cygnal::Element);
fpad->makeBoolean("fpad", false);
obj->addProperty(fpad);
- ElementSharedPtr audioCodecsnode(new amf::Element);
+ ElementSharedPtr audioCodecsnode(new cygnal::Element);
// audioCodecsnode->makeNumber("audioCodecs", 615);
audioCodecsnode->makeNumber("audioCodecs", audioCodecs);
obj->addProperty(audioCodecsnode);
- ElementSharedPtr videoCodecsnode(new amf::Element);
+ ElementSharedPtr videoCodecsnode(new cygnal::Element);
// videoCodecsnode->makeNumber("videoCodecs", 124);
videoCodecsnode->makeNumber("videoCodecs", videoCodecs);
obj->addProperty(videoCodecsnode);
- ElementSharedPtr videoFunctionnode(new amf::Element);
+ ElementSharedPtr videoFunctionnode(new cygnal::Element);
// videoFunctionnode->makeNumber("videoFunction", 0x1);
videoFunctionnode->makeNumber("videoFunction", videoFunction);
obj->addProperty(videoFunctionnode);
- ElementSharedPtr pageUrlnode(new amf::Element);
+ ElementSharedPtr pageUrlnode(new cygnal::Element);
// pageUrlnode->makeString("pageUrl",
"http://x86-ubuntu/software/gnash/tests/");
pageUrlnode->makeString("pageUrl", pageUrl);
obj->addProperty(pageUrlnode);
@@ -247,11 +247,11 @@
// RTMP::INVOKE, RTMP::FROM_CLIENT);
// const char *rtmpStr = "03 00 00 04 00 01 1f 14 00 00 00 00";
// Buffer *rtmpBuf = hex2mem(rtmpStr);
- boost::shared_ptr<amf::Buffer> conobj = connect->encode();
- boost::shared_ptr<amf::Buffer> numobj = connum->encode();
- boost::shared_ptr<amf::Buffer> encobj = obj->encode();
+ boost::shared_ptr<cygnal::Buffer> conobj = connect->encode();
+ boost::shared_ptr<cygnal::Buffer> numobj = connum->encode();
+ boost::shared_ptr<cygnal::Buffer> encobj = obj->encode();
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(conobj->size() +
numobj->size() + encobj->size()));
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(conobj->size() +
numobj->size() + encobj->size()));
*buf += conobj;
*buf += numobj;
*buf += encobj;
@@ -278,7 +278,7 @@
// to be on the end of the second block of handshake data.
// We build this here so we can get the total encoded
// size of the object.
- boost::shared_ptr<amf::Buffer> ncbuf = encodeConnect();
+ boost::shared_ptr<cygnal::Buffer> ncbuf = encodeConnect();
// As at this point we don't have an RTMP connection,
// we can't use the regular sendMsg(), that handles the RTMP
@@ -286,7 +286,7 @@
// always one by, so we just add it by hand. It doesn't matter
// as long as the channel number matches the one used to
// create the initial RTMP packet header.
- boost::scoped_ptr<amf::Buffer> newbuf(new amf::Buffer(ncbuf->size() +
5));
+ boost::scoped_ptr<cygnal::Buffer> newbuf(new
cygnal::Buffer(ncbuf->size() + 5));
size_t nbytes = 0;
size_t chunk = RTMP_VIDEO_PACKET_SIZE;
do {
@@ -302,19 +302,19 @@
}
} while (nbytes < ncbuf->allocated());
- boost::shared_ptr<amf::Buffer> head = encodeHeader(0x3,
+ boost::shared_ptr<cygnal::Buffer> head = encodeHeader(0x3,
RTMP::HEADER_12, ncbuf->allocated(),
RTMP::INVOKE, RTMPMsg::FROM_CLIENT);
// Build the first handshake packet, and send it to the
// server.
- boost::shared_ptr<amf::Buffer> handshake1 = handShakeRequest();
+ boost::shared_ptr<cygnal::Buffer> handshake1 = handShakeRequest();
if (!handshake1) {
log_error("RTMP handshake request failed");
return false;
}
- boost::scoped_ptr<amf::Buffer> handshake2(new amf::Buffer
+ boost::scoped_ptr<cygnal::Buffer> handshake2(new cygnal::Buffer
((RTMP_HANDSHAKE_SIZE * 2) + newbuf->allocated()
+ RTMP_MAX_HEADER_SIZE));
@@ -338,7 +338,7 @@
}
// give the server time to process our NetConnection::connect() request
- boost::shared_ptr<amf::Buffer> response;
+ boost::shared_ptr<cygnal::Buffer> response;
boost::shared_ptr<RTMP::rtmp_head_t> rthead;
boost::shared_ptr<RTMP::queues_t> que;
@@ -358,29 +358,29 @@
return true;
}
-boost::shared_ptr<amf::Buffer>
-RTMPClient::encodeEchoRequest(const std::string &method, double id,
amf::Element &el)
+boost::shared_ptr<cygnal::Buffer>
+RTMPClient::encodeEchoRequest(const std::string &method, double id,
cygnal::Element &el)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Element> str(new amf::Element);
+ boost::shared_ptr<cygnal::Element> str(new cygnal::Element);
str->makeString(method);
- boost::shared_ptr<amf::Buffer> strobj = str->encode();
+ boost::shared_ptr<cygnal::Buffer> strobj = str->encode();
// Encod ethe stream ID
- boost::shared_ptr<amf::Element> num(new amf::Element);
+ boost::shared_ptr<cygnal::Element> num(new cygnal::Element);
num->makeNumber(id);
- boost::shared_ptr<amf::Buffer> numobj = num->encode();
+ boost::shared_ptr<cygnal::Buffer> numobj = num->encode();
// Set the NULL object element that follows the stream ID
- boost::shared_ptr<amf::Element> null(new amf::Element);
+ boost::shared_ptr<cygnal::Element> null(new cygnal::Element);
null->makeNull();
- boost::shared_ptr<amf::Buffer> nullobj = null->encode();
+ boost::shared_ptr<cygnal::Buffer> nullobj = null->encode();
- boost::shared_ptr<amf::Buffer> elobj = el.encode();
+ boost::shared_ptr<cygnal::Buffer> elobj = el.encode();
size_t totalsize = strobj->size() + numobj->size() + nullobj->size() +
elobj->size();
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(totalsize));
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(totalsize));
*buf += strobj;
*buf += numobj;
@@ -393,7 +393,7 @@
// 43 00 1a 21 00 00 19 14 02 00 0c 63 72 65 61 74 C..!.......creat
// 65 53 74 72 65 61 6d 00 40 08 00 00 00 00 00 00 address@hidden
// 05 .
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeStream(double id)
{
// GNASH_REPORT_FUNCTION;
@@ -401,22 +401,22 @@
struct timespec now;
clock_gettime (CLOCK_REALTIME, &now);
- boost::shared_ptr<amf::Element> str(new amf::Element);
+ boost::shared_ptr<cygnal::Element> str(new cygnal::Element);
str->makeString("createStream");
- boost::shared_ptr<amf::Buffer> strobj = str->encode();
+ boost::shared_ptr<cygnal::Buffer> strobj = str->encode();
- boost::shared_ptr<amf::Element> num(new amf::Element);
+ boost::shared_ptr<cygnal::Element> num(new cygnal::Element);
num->makeNumber(id);
- boost::shared_ptr<amf::Buffer> numobj = num->encode();
+ boost::shared_ptr<cygnal::Buffer> numobj = num->encode();
// Set the NULL object element that follows the stream ID
- boost::shared_ptr<amf::Element> null(new amf::Element);
+ boost::shared_ptr<cygnal::Element> null(new cygnal::Element);
null->makeNull();
- boost::shared_ptr<amf::Buffer> nullobj = null->encode();
+ boost::shared_ptr<cygnal::Buffer> nullobj = null->encode();
size_t totalsize = strobj->size() + numobj->size() + nullobj->size();
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(totalsize));
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(totalsize));
*buf += strobj;
*buf += numobj;
@@ -431,21 +431,21 @@
// 6f 6e 32 5f 66 6c 61 73 68 38 5f 77 5f 61 75 64 on2_flash8_w_aud
// 69 6f 2e 66 6c 76 c2 00 03 00 00 00 01 00 00 27 io.flv.........'
// 10
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag)
{
// GNASH_REPORT_FUNCTION;
return encodeStreamOp(id, op, flag, "", 0);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, double pos)
{
// GNASH_REPORT_FUNCTION;
return encodeStreamOp(id, op, flag, "", pos);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name)
{
// GNASH_REPORT_FUNCTION;
@@ -458,13 +458,13 @@
// A pause packet is the operation name "pause", followed by the stream ID,
// then a NULL object, a boolean (always true from what I can tell), and then
// a location, which appears to always be 0.
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name, double pos)
{
// GNASH_REPORT_FUNCTION;
// Set the operations command name
- amf::Element str;
+ cygnal::Element str;
switch (op) {
case STREAM_PLAY: // play the existing stream
str.makeString("play");
@@ -482,35 +482,35 @@
str.makeString("seek");
break;
default:
- boost::shared_ptr<amf::Buffer> foo;
+ boost::shared_ptr<cygnal::Buffer> foo;
return foo;
};
- boost::shared_ptr<amf::Buffer> strobj = str.encode();
+ boost::shared_ptr<cygnal::Buffer> strobj = str.encode();
// Set the stream ID, which follows the command
- amf::Element strid;
+ cygnal::Element strid;
strid.makeNumber(id);
- boost::shared_ptr<amf::Buffer> stridobj = strid.encode();
+ boost::shared_ptr<cygnal::Buffer> stridobj = strid.encode();
// Set the NULL object element that follows the stream ID
- amf::Element null;
+ cygnal::Element null;
null.makeNull();
- boost::shared_ptr<amf::Buffer> nullobj = null.encode();
+ boost::shared_ptr<cygnal::Buffer> nullobj = null.encode();
// Set the BOOLEAN object element that is the last field in the packet
// (SEEK and PLAY don't use the boolean flag)
- boost::shared_ptr<amf::Buffer> boolobj;
+ boost::shared_ptr<cygnal::Buffer> boolobj;
if ((op != STREAM_SEEK) && (op != STREAM_PLAY)) {
- amf::Element boolean;
+ cygnal::Element boolean;
boolean.makeBoolean(flag);
boolobj = boolean.encode();
}
// The seek command also may have an optional location to seek to
- boost::shared_ptr<amf::Buffer> posobj;
+ boost::shared_ptr<cygnal::Buffer> posobj;
if ((op == STREAM_PAUSE) || (op == STREAM_SEEK)) {
- amf::Element seek;
+ cygnal::Element seek;
seek.makeNumber(pos);
posobj = seek.encode();
}
@@ -518,9 +518,9 @@
// The play command has an optional field, which is the name of the file
// used for the stream. A Play command without this name set play an
// existing stream that is already open.
- boost::shared_ptr<amf::Buffer> fileobj;
+ boost::shared_ptr<cygnal::Buffer> fileobj;
if (!name.empty()) {
- amf::Element filespec;
+ cygnal::Element filespec;
filespec.makeString(name);
fileobj = filespec.encode();
}
@@ -533,7 +533,7 @@
if ( fileobj ) pktsize += fileobj->size();
if ( posobj ) pktsize += posobj->size();
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(pktsize));
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(pktsize));
*buf += strobj;
*buf += stridobj;
*buf += nullobj;
@@ -546,14 +546,14 @@
// A request for a handshake is initiated by sending a byte with a
// value of 0x3, followed by a message body of unknown format.
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::handShakeRequest()
{
GNASH_REPORT_FUNCTION;
boost::uint32_t zero = 0;
// Make a buffer to hold the handshake data.
- boost::shared_ptr<amf::Buffer> handshake(new
amf::Buffer(RTMP_HANDSHAKE_SIZE+1));
+ boost::shared_ptr<cygnal::Buffer> handshake(new
cygnal::Buffer(RTMP_HANDSHAKE_SIZE+1));
if (!handshake) {
return handshake;
}
@@ -584,17 +584,17 @@
// The client finishes the handshake process by sending the second
// data block we get from the server as the response
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPClient::clientFinish()
{
// GNASH_REPORT_FUNCTION;
- amf::Buffer data;
+ cygnal::Buffer data;
return clientFinish(data);
}
-boost::shared_ptr<amf::Buffer>
-RTMPClient::clientFinish(amf::Buffer &data)
+boost::shared_ptr<cygnal::Buffer>
+RTMPClient::clientFinish(cygnal::Buffer &data)
{
GNASH_REPORT_FUNCTION;
bool done = false;
@@ -607,7 +607,7 @@
// The handhake for this phase is twice the size of the initial handshake
// we sent previously, plus one byte for the RTMP version header.
int max_size = (RTMP_HANDSHAKE_SIZE*2) + 1;
- boost::shared_ptr<amf::Buffer> handshake1(new amf::Buffer(
+ boost::shared_ptr<cygnal::Buffer> handshake1(new cygnal::Buffer(
max_size + data.allocated()));
do {
ret = readNet(handshake1->end(), max_size - offset);
@@ -655,7 +655,7 @@
#endif
// Make a new buffer big enough to hold the handshake, data, and header
byte
- boost::shared_ptr<amf::Buffer> handshake2(new amf::Buffer(
+ boost::shared_ptr<cygnal::Buffer> handshake2(new cygnal::Buffer(
RTMP_HANDSHAKE_SIZE + data.allocated()));
// Copy the timestamp from the message we just received.
@@ -721,7 +721,7 @@
// Read the responses back from the server. This is usually a series of
system
// messages on channel 2, and the response message on channel 3 from our
request.
- boost::shared_ptr<amf::Buffer> response = recvMsg();
+ boost::shared_ptr<cygnal::Buffer> response = recvMsg();
if (!response) {
log_error("Got no response from the RTMP server");
return msgque;
@@ -758,7 +758,7 @@
while (channel_q->size()) {
// Get the first message in the channel queue
- boost::shared_ptr<amf::Buffer> ptr = channel_q->pop();
+ boost::shared_ptr<cygnal::Buffer> ptr = channel_q->pop();
ptr->dump();
if (ptr) { // If there is legit data
rthead = decodeHeader(ptr->reference());
=== modified file 'cygnal/libnet/rtmp_client.h'
--- a/cygnal/libnet/rtmp_client.h 2010-03-11 01:47:08 +0000
+++ b/cygnal/libnet/rtmp_client.h 2010-05-27 22:44:28 +0000
@@ -45,18 +45,18 @@
bool handShakeWait();
// bool handShakeResponse();
- boost::shared_ptr<amf::Buffer> clientFinish();
- DSOEXPORT boost::shared_ptr<amf::Buffer> clientFinish(amf::Buffer &data);
- DSOEXPORT boost::shared_ptr<amf::Buffer> handShakeRequest();
+ boost::shared_ptr<cygnal::Buffer> clientFinish();
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> clientFinish(cygnal::Buffer
&data);
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> handShakeRequest();
// These are used for creating the primary objects
// Create the initial object sent to the server, which
// is NetConnection::connect()
- DSOEXPORT boost::shared_ptr<amf::Buffer> encodeConnect();
- DSOEXPORT boost::shared_ptr<amf::Buffer> encodeConnect(const char *uri);
- DSOEXPORT boost::shared_ptr<amf::Buffer> encodeConnect(const char *uri,
double audioCodecs, double videoCodecs,
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeConnect();
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeConnect(const char *uri);
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeConnect(const char *uri,
double audioCodecs, double videoCodecs,
double videoFunction);
- DSOEXPORT boost::shared_ptr<amf::Buffer> encodeConnect(const char *app,
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeConnect(const char *app,
const char *swfUrl, const char *tcUrl,
double audioCodecs, double videoCodecs, double
videoFunction,
const char *pageUrl);
@@ -64,18 +64,18 @@
DSOEXPORT bool connectToServer(const std::string &url);
// Create the second object sent to the server, which is
NetStream():;NetStream()
- DSOEXPORT boost::shared_ptr<amf::Buffer> encodeStream(double id);
- boost::shared_ptr<amf::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag);
- boost::shared_ptr<amf::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag, double pos);
- DSOEXPORT boost::shared_ptr<amf::Buffer> encodeStreamOp(double id,
rtmp_op_e op, bool flag, const std::string &name);
- boost::shared_ptr<amf::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag, const std::string &name, double pos);
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeStream(double id);
+ boost::shared_ptr<cygnal::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag);
+ boost::shared_ptr<cygnal::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag, double pos);
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeStreamOp(double id,
rtmp_op_e op, bool flag, const std::string &name);
+ boost::shared_ptr<cygnal::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag, const std::string &name, double pos);
bool isConnected() { return _connected; };
std::string &getPath() { return _path; };
void setPath(std::string &x) { _path = x; };
- DSOEXPORT boost::shared_ptr<amf::Buffer> encodeEchoRequest(const
std::string &method, double id, amf::Element &el);
+ DSOEXPORT boost::shared_ptr<cygnal::Buffer> encodeEchoRequest(const
std::string &method, double id, cygnal::Element &el);
typedef std::deque<boost::shared_ptr<RTMPMsg> > msgque_t;
msgque_t recvResponse();
=== modified file 'cygnal/libnet/rtmp_msg.cpp'
--- a/cygnal/libnet/rtmp_msg.cpp 2010-03-09 01:24:14 +0000
+++ b/cygnal/libnet/rtmp_msg.cpp 2010-05-27 22:44:28 +0000
@@ -41,7 +41,7 @@
#include "buffer.h"
using std::vector;
-using amf::Element;
+using cygnal::Element;
namespace gnash
{
@@ -122,21 +122,21 @@
// error, or onStatus message, the actual data can be obtained from the
Element.
//
RTMPMsg::rtmp_status_e
-RTMPMsg::checkStatus(boost::shared_ptr<amf::Element> /* el */)
+RTMPMsg::checkStatus(boost::shared_ptr<cygnal::Element> /* el */)
{
// GNASH_REPORT_FUNCTION;
if (_amfobjs.size() > 0) {
- vector<boost::shared_ptr<amf::Element> >::iterator pit;
- vector<boost::shared_ptr<amf::Element> >::iterator cit;
+ vector<boost::shared_ptr<cygnal::Element> >::iterator pit;
+ vector<boost::shared_ptr<cygnal::Element> >::iterator cit;
// cerr << "# of Properties in object" << _amfobjs.size() << endl;
for (pit = _amfobjs.begin(); pit != _amfobjs.end(); pit++) {
- boost::shared_ptr<amf::Element> el = (*(pit));
- std::vector<boost::shared_ptr<amf::Element> > props =
el->getProperties();
+ boost::shared_ptr<cygnal::Element> el = (*(pit));
+ std::vector<boost::shared_ptr<cygnal::Element> > props =
el->getProperties();
// printf("FIXME2: %d, %s:%s\n", props.size(),
// props[2]->getName(), props[2]->to_string());
if (el->getType() == Element::OBJECT_AMF0) {
for (cit = props.begin(); cit != props.end(); cit++) {
- boost::shared_ptr<amf::Element> child = (*(cit));
+ boost::shared_ptr<cygnal::Element> child = (*(cit));
// child->dump();
std::string name = child->getName();
std::string value;
@@ -165,7 +165,7 @@
// }
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
RTMPMsg::operator[](size_t index)
{
// GNASH_REPORT_FUNCTION;
@@ -173,7 +173,7 @@
return _amfobjs[index];
}
- boost::shared_ptr<amf::Element> el;
+ boost::shared_ptr<cygnal::Element> el;
return el;
}
@@ -183,15 +183,15 @@
/// search for.
///
/// @return A smart pointer to the Element for this property.
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
RTMPMsg::findProperty(const std::string &name)
{
if (_amfobjs.size() > 0) {
vector<boost::shared_ptr<Element> >::iterator ait;
// cerr << "# of Properties in object: " << _properties.size() << endl;
for (ait = _amfobjs.begin(); ait != _amfobjs.end(); ait++) {
- boost::shared_ptr<amf::Element> el = (*(ait));
- boost::shared_ptr<amf::Element> prop = el->findProperty(name);
+ boost::shared_ptr<cygnal::Element> el = (*(ait));
+ boost::shared_ptr<cygnal::Element> prop = el->findProperty(name);
if (prop) {
return prop;
}
@@ -215,10 +215,10 @@
// cerr << "Transaction ID:\t" << hexify((const unsigned char *)&_transid,
8, false) << endl;
cerr << "Transaction ID:\t" << _transid << endl;
- vector<boost::shared_ptr<amf::Element> >::iterator ait;
+ vector<boost::shared_ptr<cygnal::Element> >::iterator ait;
cerr << "# of Elements in file: " << _amfobjs.size() << endl;
for (ait = _amfobjs.begin(); ait != _amfobjs.end(); ait++) {
- boost::shared_ptr<amf::Element> el = (*(ait));
+ boost::shared_ptr<cygnal::Element> el = (*(ait));
el->dump();
}
}
=== modified file 'cygnal/libnet/rtmp_msg.h'
--- a/cygnal/libnet/rtmp_msg.h 2010-01-11 06:41:38 +0000
+++ b/cygnal/libnet/rtmp_msg.h 2010-05-27 22:44:28 +0000
@@ -92,9 +92,9 @@
RTMPMsg();
~RTMPMsg();
- void addObject(boost::shared_ptr<amf::Element> el) {
_amfobjs.push_back(el); };
+ void addObject(boost::shared_ptr<cygnal::Element> el) {
_amfobjs.push_back(el); };
size_t size() { return _amfobjs.size(); };
- std::vector<boost::shared_ptr<amf::Element> > getElements() { return
_amfobjs; };
+ std::vector<boost::shared_ptr<cygnal::Element> > getElements() { return
_amfobjs; };
void setMethodName(const std::string &name) { _method = name; } ;
std::string &getMethodName() { return _method; };
@@ -102,15 +102,15 @@
void setTransactionID(double num) { _transid = num; };
double getTransactionID() { return _transid; };
- rtmp_status_e checkStatus(boost::shared_ptr<amf::Element> el);
+ rtmp_status_e checkStatus(boost::shared_ptr<cygnal::Element> el);
void setStatus(rtmp_status_e st) { _status = st; };
rtmp_status_e getStatus() { return _status; };
void setChannel(boost::uint8_t num) { _channel = num; };
boost::uint8_t getChannel() { return _channel; } ;
- boost::shared_ptr<amf::Element> operator[](size_t x);
- boost::shared_ptr<amf::Element> at(size_t x) { return _amfobjs[x]; };
+ boost::shared_ptr<cygnal::Element> operator[](size_t x);
+ boost::shared_ptr<cygnal::Element> at(size_t x) { return _amfobjs[x]; };
/// \brief Find the named property for this Object.
///
@@ -118,7 +118,7 @@
/// search for.
///
/// @return A smart pointer to the Element for this property.
- DSOEXPORT boost::shared_ptr<amf::Element> findProperty(const std::string
&name);
+ DSOEXPORT boost::shared_ptr<cygnal::Element> findProperty(const
std::string &name);
// void setHeaderData(RTMP::rtmp_head_t &qhead);
@@ -130,7 +130,7 @@
rtmp_status_e _status;
std::string _method;
double _transid;
- std::vector<boost::shared_ptr<amf::Element> > _amfobjs;
+ std::vector<boost::shared_ptr<cygnal::Element> > _amfobjs;
boost::uint8_t _channel;
};
=== modified file 'cygnal/rtmp_server.cpp'
--- a/cygnal/rtmp_server.cpp 2010-01-11 06:41:38 +0000
+++ b/cygnal/rtmp_server.cpp 2010-05-27 22:44:28 +0000
@@ -59,7 +59,6 @@
#endif
using namespace gnash;
using namespace std;
-using namespace amf;
namespace cygnal
{
@@ -92,7 +91,7 @@
}
-boost::shared_ptr<amf::Element>
+boost::shared_ptr<cygnal::Element>
RTMPServer::processClientHandShake(int fd)
{
GNASH_REPORT_FUNCTION;
@@ -109,17 +108,17 @@
// These store the information we need from the initial
/// NetConnection object.
- boost::scoped_ptr<amf::Element> nc;
- boost::shared_ptr<amf::Buffer> pkt;
- boost::shared_ptr<amf::Element> tcurl;
- boost::shared_ptr<amf::Element> swfurl;
- boost::shared_ptr<amf::Element> encoding;
+ boost::scoped_ptr<cygnal::Element> nc;
+ boost::shared_ptr<cygnal::Buffer> pkt;
+ boost::shared_ptr<cygnal::Element> tcurl;
+ boost::shared_ptr<cygnal::Element> swfurl;
+ boost::shared_ptr<cygnal::Element> encoding;
// RTMP::rtmp_headersize_e response_head_size = RTMP::HEADER_12;
// Read the handshake bytes sent by the client when requesting
// a connection.
- boost::shared_ptr<amf::Buffer> handshake1 = RTMP::recvMsg(fd);
+ boost::shared_ptr<cygnal::Buffer> handshake1 = RTMP::recvMsg(fd);
// See if we have data in the handshake, we should have 1537 bytes
if (!handshake1) {
log_error("Failed to read the handshake from the client.");
@@ -134,7 +133,7 @@
// Read the response from the client from the handshale reponse we
// just sent.
- boost::shared_ptr<amf::Buffer> handshake2 = RTMP::recvMsg(fd);
+ boost::shared_ptr<cygnal::Buffer> handshake2 = RTMP::recvMsg(fd);
// See if we have data in the handshake, we should have 1536 bytes
if (handshake2 == 0) {
log_error("failed to read the handshake from the client.");
@@ -148,7 +147,7 @@
// Wmake sure we got data before trying to process it
if (!pkt) {
log_error("Didn't receive any data in handshake!");
- tcurl.reset(new amf::Element);
+ tcurl.reset(new cygnal::Element);
return tcurl; // nc is empty
}
@@ -181,7 +180,7 @@
// now build a copy of the data but skip over the RTMP header
// bytes every chunk size biundary. All RTMP headers at this stage
// are 1 byte ones.
- boost::scoped_ptr<amf::Buffer> newptr(new amf::Buffer(qhead->bodysize));
+ boost::scoped_ptr<cygnal::Buffer> newptr(new
cygnal::Buffer(qhead->bodysize));
if (qhead->bodysize > RTMP_VIDEO_PACKET_SIZE) {
log_network("De chunkifying the NetConnection packet.");
int nbytes = 0;
@@ -227,7 +226,7 @@
// causes Async I/O errors in the client.
if (!encoding) {
// Send a onBWDone to the client to start the new NetConnection,
- boost::shared_ptr<amf::Buffer> bwdone = encodeBWDone(2.0);
+ boost::shared_ptr<cygnal::Buffer> bwdone = encodeBWDone(2.0);
if (RTMP::sendMsg(fd, qhead->channel, RTMP::HEADER_8,
bwdone->size(), RTMP::INVOKE, RTMPMsg::FROM_SERVER,
*bwdone)) {
log_network("Sent onBWDone to client");
@@ -239,7 +238,7 @@
}
// Send a Set Client Window Size to the client
- boost::shared_ptr<amf::Buffer> winsize(new
amf::Buffer(sizeof(boost::uint32_t)));
+ boost::shared_ptr<cygnal::Buffer> winsize(new
cygnal::Buffer(sizeof(boost::uint32_t)));
boost::uint32_t swapped = 0x20000;
swapBytes(&swapped, sizeof(boost::uint32_t));
*winsize += swapped;
@@ -253,7 +252,7 @@
}
// Send a ping to the client to reset the new NetConnection,
- boost::shared_ptr<amf::Buffer> ping_reset =
+ boost::shared_ptr<cygnal::Buffer> ping_reset =
encodePing(RTMP::PING_RESET, 0);
if (RTMP::sendMsg(fd, RTMP_SYSTEM_CHANNEL, RTMP::HEADER_8,
ping_reset->size(), RTMP::USER, RTMPMsg::FROM_SERVER,
*ping_reset)) {
@@ -267,7 +266,7 @@
// Send the packet to notify the client that the
// NetConnection::connect() was sucessful. After the client
// receives this, the handhsake is completed.
- boost::shared_ptr<amf::Buffer> response =
+ boost::shared_ptr<cygnal::Buffer> response =
encodeResult(RTMPMsg::NC_CONNECT_SUCCESS);
if (RTMP::sendMsg(fd, 3, RTMP::HEADER_8, response->allocated(),
RTMP::INVOKE, RTMPMsg::FROM_SERVER, *response)) {
@@ -286,7 +285,7 @@
// in one big packet as doing otherwise seems to cause subtle timing
// problems with the Adobe player. This way it connects every time.
bool
-RTMPServer::handShakeResponse(int fd, amf::Buffer &handshake)
+RTMPServer::handShakeResponse(int fd, cygnal::Buffer &handshake)
{
GNASH_REPORT_FUNCTION;
@@ -295,7 +294,7 @@
// the response handshake is twice the size of the one we just
// received for a total of 3072 bytes, plus room for the version.
- boost::scoped_ptr<amf::Buffer> zeros(new amf::Buffer(RTMP_HANDSHAKE_SIZE*2
+ boost::scoped_ptr<cygnal::Buffer> zeros(new
cygnal::Buffer(RTMP_HANDSHAKE_SIZE*2
+ RTMP_HANDSHAKE_VERSION_SIZE));
zeros->clear(); // set entire buffer to zeros
@@ -342,11 +341,11 @@
return true;
}
-boost::shared_ptr<amf::Buffer>
-RTMPServer::serverFinish(int fd, amf::Buffer &handshake1, amf::Buffer
&handshake2)
+boost::shared_ptr<cygnal::Buffer>
+RTMPServer::serverFinish(int fd, cygnal::Buffer &handshake1, cygnal::Buffer
&handshake2)
{
GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
// sanity check our input data. We do this seperately as an empty
// buffer means data wasn't read correctly from the network. We
@@ -407,7 +406,7 @@
}
bool
-RTMPServer::packetSend(amf::Buffer &/* buf */)
+RTMPServer::packetSend(cygnal::Buffer &/* buf */)
{
GNASH_REPORT_FUNCTION;
return false;
@@ -415,7 +414,7 @@
// This overrides using same method from the base RTMP class.
bool
-RTMPServer::packetRead(amf::Buffer &buf)
+RTMPServer::packetRead(cygnal::Buffer &buf)
{
GNASH_REPORT_FUNCTION;
@@ -459,12 +458,12 @@
boost::uint8_t* tooFar = ptr+300+sizeof(int); // FIXME:
AMF amf_obj;
- boost::shared_ptr<amf::Element> el1 = amf_obj.extractAMF(ptr, tooFar);
+ boost::shared_ptr<cygnal::Element> el1 = amf_obj.extractAMF(ptr, tooFar);
ptr += amf_obj.totalsize();
- boost::shared_ptr<amf::Element> el2 = amf_obj.extractAMF(ptr, tooFar);
+ boost::shared_ptr<cygnal::Element> el2 = amf_obj.extractAMF(ptr, tooFar);
int size = 0;
- boost::shared_ptr<amf::Element> el;
+ boost::shared_ptr<cygnal::Element> el;
while ( size < static_cast<boost::uint16_t>(_header.bodysize) - 24 ) {
if (ptr) {
el = amf_obj.extractProperty(ptr, tooFar);
@@ -490,7 +489,7 @@
log_network (_("Reading AMF packets till we're done..."));
// buf->dump();
while (ptr < end) {
- boost::shared_ptr<amf::Element> el(new amf::Element);
+ boost::shared_ptr<cygnal::Element> el(new cygnal::Element);
ptr = amf.extractProperty(el, ptr);
addProperty(el);
// el->dump();
@@ -504,7 +503,7 @@
buf = _que->merge(buf);
}
while ((ptr - buf->begin()) < static_cast<int>(actual_size)) {
- boost::shared_ptr<amf::Element> el(new amf::Element);
+ boost::shared_ptr<cygnal::Element> el(new cygnal::Element);
if (ptr) {
ptr = amf.extractProperty(el, ptr);
addProperty(el);
@@ -610,7 +609,7 @@
return encodeResult(status, _filespec, _streamid);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPServer::encodeResult(gnash::RTMPMsg::rtmp_status_e status, const
std::string &filename)
{
// GNASH_REPORT_FUNCTION;
@@ -618,14 +617,14 @@
return encodeResult(status, filename, _streamid, clientid);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPServer::encodeResult(gnash::RTMPMsg::rtmp_status_e status, const
std::string &filename, double &clientid)
{
// GNASH_REPORT_FUNCTION;
return encodeResult(status, filename, _streamid, clientid);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPServer::encodeResult(gnash::RTMPMsg::rtmp_status_e status, double &transid)
{
// GNASH_REPORT_FUNCTION;
@@ -633,7 +632,7 @@
return encodeResult(status, "", transid, clientid);
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPServer::encodeResult(gnash::RTMPMsg::rtmp_status_e status, const
std::string &filename, double &transid, double &clientid)
{
// GNASH_REPORT_FUNCTION;
@@ -674,15 +673,15 @@
{
// errstr = new Element;
// errstr->makeString("error");
- boost::shared_ptr<amf::Element> level(new Element);
+ boost::shared_ptr<cygnal::Element> level(new Element);
level->makeString("level", "error");
top.addProperty(level);
- boost::shared_ptr<amf::Element> description(new Element);
+ boost::shared_ptr<cygnal::Element> description(new Element);
description->makeString("description", "Connection Failed.");
top.addProperty(description);
- boost::shared_ptr<amf::Element> code(new Element);
+ boost::shared_ptr<cygnal::Element> code(new Element);
code->makeString("code", "Connection.Connect.Failed");
top.addProperty(code);
}
@@ -692,29 +691,29 @@
// delete str;
// str = new Element;
// str->makeString("error");
- boost::shared_ptr<amf::Element> level(new Element);
+ boost::shared_ptr<cygnal::Element> level(new Element);
level->makeString("level", "error");
top.addProperty(level);
- boost::shared_ptr<amf::Element> description(new Element);
+ boost::shared_ptr<cygnal::Element> description(new Element);
description->makeString("description", "Connection Rejected.");
top.addProperty(description);
- boost::shared_ptr<amf::Element> code(new Element);
+ boost::shared_ptr<cygnal::Element> code(new Element);
code->makeString("code", "NetConnection.Connect.Rejected");
top.addProperty(code);
}
case RTMPMsg::NC_CONNECT_SUCCESS:
{
- boost::shared_ptr<amf::Element> level(new Element);
+ boost::shared_ptr<cygnal::Element> level(new Element);
level->makeString("level", "status");
top.addProperty(level);
- boost::shared_ptr<amf::Element> code(new Element);
+ boost::shared_ptr<cygnal::Element> code(new Element);
code->makeString("code", "NetConnection.Connect.Success");
top.addProperty(code);
- boost::shared_ptr<amf::Element> description(new Element);
+ boost::shared_ptr<cygnal::Element> description(new Element);
description->makeString("description", "Connection succeeded.");
top.addProperty(description);
}
@@ -732,15 +731,15 @@
{
str->makeString("onStatus");
- boost::shared_ptr<amf::Element> level(new Element);
+ boost::shared_ptr<cygnal::Element> level(new Element);
level->makeString("level", "status");
top.addProperty(level);
- boost::shared_ptr<amf::Element> code(new Element);
+ boost::shared_ptr<cygnal::Element> code(new Element);
code->makeString("code", "NetStream.Pause.Notify");
top.addProperty(code);
- boost::shared_ptr<amf::Element> description(new Element);
+ boost::shared_ptr<cygnal::Element> description(new Element);
string field = "Pausing ";
if (!filename.empty()) {
field += filename;
@@ -748,11 +747,11 @@
description->makeString("description", field);
top.addProperty(description);
- boost::shared_ptr<amf::Element> details(new Element);
+ boost::shared_ptr<cygnal::Element> details(new Element);
details->makeString("details", filename);
top.addProperty(details);
- boost::shared_ptr<amf::Element> cid(new Element);
+ boost::shared_ptr<cygnal::Element> cid(new Element);
cid->makeNumber("clientid", clientid);
top.addProperty(cid);
@@ -771,15 +770,15 @@
{
str->makeString("onStatus");
// "clientid"
- boost::shared_ptr<amf::Element> level(new Element);
+ boost::shared_ptr<cygnal::Element> level(new Element);
level->makeString("level", "status");
top.addProperty(level);
- boost::shared_ptr<amf::Element> code(new Element);
+ boost::shared_ptr<cygnal::Element> code(new Element);
code->makeString("code", "NetStream.Play.Reset");
top.addProperty(code);
- boost::shared_ptr<amf::Element> description(new Element);
+ boost::shared_ptr<cygnal::Element> description(new Element);
string field = "Playing and resetting ";
if (!filename.empty()) {
field += filename;
@@ -787,11 +786,11 @@
description->makeString("description", field);
top.addProperty(description);
- boost::shared_ptr<amf::Element> details(new Element);
+ boost::shared_ptr<cygnal::Element> details(new Element);
details->makeString("details", filename);
top.addProperty(details);
- boost::shared_ptr<amf::Element> cid(new Element);
+ boost::shared_ptr<cygnal::Element> cid(new Element);
#ifdef CLIENT_ID_NUMERIC
double clientid = createClientID();
cid->makeNumber("clientid", clientid);
@@ -813,15 +812,15 @@
{
str->makeString("onStatus");
- boost::shared_ptr<amf::Element> level(new Element);
+ boost::shared_ptr<cygnal::Element> level(new Element);
level->makeString("level", "status");
top.addProperty(level);
- boost::shared_ptr<amf::Element> code(new Element);
+ boost::shared_ptr<cygnal::Element> code(new Element);
code->makeString("code", "NetStream.Play.Start");
top.addProperty(code);
- boost::shared_ptr<amf::Element> description(new Element);
+ boost::shared_ptr<cygnal::Element> description(new Element);
string field = "Started playing ";
if (!filename.empty()) {
field += filename;
@@ -829,11 +828,11 @@
description->makeString("description", field);
top.addProperty(description);
- boost::shared_ptr<amf::Element> details(new Element);
+ boost::shared_ptr<cygnal::Element> details(new Element);
details->makeString("details", filename);
top.addProperty(details);
- boost::shared_ptr<amf::Element> cid(new Element);
+ boost::shared_ptr<cygnal::Element> cid(new Element);
#ifdef CLIENT_ID_NUMERIC
double clientid = createClientID();
cid->makeNumber("clientid", clientid);
@@ -854,15 +853,15 @@
case RTMPMsg::NS_PLAY_STOP:
case RTMPMsg::NS_PLAY_STREAMNOTFOUND:
{
- boost::shared_ptr<amf::Element> level(new Element);
+ boost::shared_ptr<cygnal::Element> level(new Element);
level->makeString("level", "error");
top.addProperty(level);
- boost::shared_ptr<amf::Element> description(new Element);
+ boost::shared_ptr<cygnal::Element> description(new Element);
description->makeString("description",
"NetStream.Play.StreamNotFound.");
top.addProperty(description);
- boost::shared_ptr<amf::Element> code(new Element);
+ boost::shared_ptr<cygnal::Element> code(new Element);
code->makeString("code", "NetStream.Play.StreamNotFound");
top.addProperty(code);
break;
@@ -898,7 +897,7 @@
// Don't encode as an object, just the properties
notobject = true;
- boost::shared_ptr<amf::Element> id2(new Element);
+ boost::shared_ptr<cygnal::Element> id2(new Element);
double sid = createStreamID();
id2->makeNumber(sid);
@@ -912,11 +911,11 @@
break;
};
- boost::shared_ptr<amf::Buffer> strbuf = str->encode();
- boost::shared_ptr<amf::Buffer> numbuf = number->encode();
- boost::shared_ptr<amf::Buffer> topbuf = top.encode(notobject);
+ boost::shared_ptr<cygnal::Buffer> strbuf = str->encode();
+ boost::shared_ptr<cygnal::Buffer> numbuf = number->encode();
+ boost::shared_ptr<cygnal::Buffer> topbuf = top.encode(notobject);
- boost::shared_ptr<amf::Buffer> buf(new Buffer(strbuf->size() +
numbuf->size() + topbuf->size()));
+ boost::shared_ptr<cygnal::Buffer> buf(new Buffer(strbuf->size() +
numbuf->size() + topbuf->size()));
*buf += strbuf;
*buf += numbuf;
boost::uint8_t byte = static_cast<boost::uint8_t>(RTMP::WINDOW_SIZE &
0x000000ff);
@@ -961,7 +960,7 @@
// GNASH_REPORT_FUNCTION;
// An encoded ping message
- boost::shared_ptr<amf::Buffer> buf(new Buffer(sizeof(boost::uint16_t) *
3));
+ boost::shared_ptr<cygnal::Buffer> buf(new Buffer(sizeof(boost::uint16_t) *
3));
// boost::uint8_t *ptr = buf->reference();
// Set the type of this ping message
@@ -1017,7 +1016,7 @@
}
// Encode a onBWDone message for the client. These are of a fixed size.
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPServer::encodeBWDone(double id)
{
// GNASH_REPORT_FUNCTION;
@@ -1032,11 +1031,11 @@
Element null;
null.makeNull();
- boost::shared_ptr<amf::Buffer> enccmd = cmd.encode();
- boost::shared_ptr<amf::Buffer> encnum = num.encode();
- boost::shared_ptr<amf::Buffer> encnull = null.encode();
+ boost::shared_ptr<cygnal::Buffer> enccmd = cmd.encode();
+ boost::shared_ptr<cygnal::Buffer> encnum = num.encode();
+ boost::shared_ptr<cygnal::Buffer> encnull = null.encode();
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(enccmd->size()
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(enccmd->size()
+ encnum->size()
+ encnull->size()));
@@ -1047,16 +1046,16 @@
return buf;
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPServer::encodeAudio(boost::uint8_t *data, size_t size)
{
GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> buf;
+ boost::shared_ptr<cygnal::Buffer> buf;
if (size) {
if (data) {
- buf.reset(new amf::Buffer(size));
+ buf.reset(new cygnal::Buffer(size));
buf->copy(data, size);
}
}
@@ -1064,7 +1063,7 @@
return buf;
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPServer::encodeVideo(boost::uint8_t *data, size_t size)
{
GNASH_REPORT_FUNCTION;
@@ -1073,30 +1072,30 @@
#if 0
// Parse an Echo Request message coming from the Red5 echo_test. This
// method should only be used for testing purposes.
-vector<boost::shared_ptr<amf::Element > >
+vector<boost::shared_ptr<cygnal::Element > >
RTMPServer::parseEchoRequest(boost::uint8_t *ptr, size_t size)
{
// GNASH_REPORT_FUNCTION;
AMF amf;
- vector<boost::shared_ptr<amf::Element > > headers;
+ vector<boost::shared_ptr<cygnal::Element > > headers;
// The first element is the name of the test, 'echo'
- boost::shared_ptr<amf::Element> el1 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el1 = amf.extractAMF(ptr, ptr+size);
ptr += amf.totalsize();
headers.push_back(el1);
// The second element is the number of the test,
- boost::shared_ptr<amf::Element> el2 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el2 = amf.extractAMF(ptr, ptr+size);
ptr += amf.totalsize();
headers.push_back(el2);
// This one has always been a NULL object from my tests
- boost::shared_ptr<amf::Element> el3 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el3 = amf.extractAMF(ptr, ptr+size);
ptr += amf.totalsize();
headers.push_back(el3);
// This one has always been an NULL or Undefined object from my tests
- boost::shared_ptr<amf::Element> el4 = amf.extractAMF(ptr, ptr+size);
+ boost::shared_ptr<cygnal::Element> el4 = amf.extractAMF(ptr, ptr+size);
if (!el4) {
log_error("Couldn't reliably extract the echo data!");
}
@@ -1110,22 +1109,22 @@
// is only used for testing by developers. The format appears to be
// a string '_result', followed by the number of the test, and then two
// NULL objects.
-boost::shared_ptr<amf::Buffer>
-RTMPServer::formatEchoResponse(double num, amf::Element &el)
+boost::shared_ptr<cygnal::Buffer>
+RTMPServer::formatEchoResponse(double num, cygnal::Element &el)
{
// GNASH_REPORT_FUNCTION;
- boost::shared_ptr<amf::Buffer> data = amf::AMF::encodeElement(el);
+ boost::shared_ptr<cygnal::Buffer> data = amf::AMF::encodeElement(el);
return formatEchoResponse(num, data->reference(), data->allocated());
}
-boost::shared_ptr<amf::Buffer>
-RTMPServer::formatEchoResponse(double num, amf::Buffer &data)
+boost::shared_ptr<cygnal::Buffer>
+RTMPServer::formatEchoResponse(double num, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return formatEchoResponse(num, data.reference(), data.allocated());
}
-boost::shared_ptr<amf::Buffer>
+boost::shared_ptr<cygnal::Buffer>
RTMPServer::formatEchoResponse(double num, boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
@@ -1140,11 +1139,11 @@
Element null;
null.makeNull();
- boost::shared_ptr<amf::Buffer> encecho = echo.encode();
- boost::shared_ptr<amf::Buffer> encidx = index.encode();
- boost::shared_ptr<amf::Buffer> encnull = null.encode();
+ boost::shared_ptr<cygnal::Buffer> encecho = echo.encode();
+ boost::shared_ptr<cygnal::Buffer> encidx = index.encode();
+ boost::shared_ptr<cygnal::Buffer> encnull = null.encode();
- boost::shared_ptr<amf::Buffer> buf(new amf::Buffer(encecho->size()
+ boost::shared_ptr<cygnal::Buffer> buf(new cygnal::Buffer(encecho->size()
+ encidx->size()
+ encnull->size() +
size));
@@ -1316,7 +1315,7 @@
}
size_t
-RTMPServer::sendToClient(std::vector<int> &fds, amf::Buffer &data)
+RTMPServer::sendToClient(std::vector<int> &fds, cygnal::Buffer &data)
{
// GNASH_REPORT_FUNCTION;
return sendToClient(fds, data.reference(), data.allocated());
@@ -1365,10 +1364,10 @@
// Adjust the timeout
rtmp->setTimeout(10);
- boost::shared_ptr<amf::Buffer> pkt;
- boost::shared_ptr<amf::Element> tcurl;
- boost::shared_ptr<amf::Element> swfurl;
- boost::shared_ptr<amf::Buffer> response;
+ boost::shared_ptr<cygnal::Buffer> pkt;
+ boost::shared_ptr<cygnal::Element> tcurl;
+ boost::shared_ptr<cygnal::Element> swfurl;
+ boost::shared_ptr<cygnal::Buffer> response;
// Keep track of the network statistics
// See if we have any messages waiting. After the initial connect, this is
@@ -1376,7 +1375,7 @@
// Adjust the timeout
rtmp->setTimeout(30);
-// boost::shared_ptr<amf::Buffer> buf;
+// boost::shared_ptr<cygnal::Buffer> buf;
// If we have active disk streams, send those packets first.
// 0 is a reserved stream, so we start with 1, as the reserved
@@ -1419,7 +1418,7 @@
}
boost::shared_ptr<RTMP::rtmp_head_t> qhead;
for (size_t i=0; i<que->size(); i++) {
- boost::shared_ptr<amf::Buffer> bufptr = que->at(i)->pop();
+ boost::shared_ptr<cygnal::Buffer> bufptr =
que->at(i)->pop();
// que->at(i)->dump();
if (bufptr) {
// bufptr->dump();
@@ -1539,7 +1538,7 @@
} else if (body->getMethodName() == "play") {
string filespec;
boost::shared_ptr<gnash::RTMPMsg> nc =
rtmp->getNetConnection();
- boost::shared_ptr<amf::Element> tcurl =
nc->findProperty("tcUrl");
+ boost::shared_ptr<cygnal::Element> tcurl =
nc->findProperty("tcUrl");
URL url(tcurl->to_string());
filespec += url.hostname() + url.path();
filespec += '/';
@@ -1641,7 +1640,7 @@
log_error("Received an _error message from the
client!");
} else {
/* size_t ret = */ hand->writeToPlugin(tmpptr,
qhead->bodysize);
- boost::shared_ptr<amf::Buffer> result =
hand->readFromPlugin();
+ boost::shared_ptr<cygnal::Buffer> result =
hand->readFromPlugin();
if (result) {
if (rtmp->sendMsg(args->netfd, qhead->channel,
RTMP::HEADER_8,
result->allocated(),
@@ -1666,7 +1665,7 @@
// size_t ret = hand->writeToPlugin(tmpptr,
qhead->bodysize);
#if 0
- boost::shared_ptr<amf::Buffer> result =
hand->readFromPlugin();
+ boost::shared_ptr<cygnal::Buffer> result =
hand->readFromPlugin();
if (result) { // FIXME: this needs a real channel number
if (rtmp->sendMsg(args->netfd, 0x3, RTMP::HEADER_8, ret,
RTMP::INVOKE, RTMPMsg::FROM_SERVER,
*result)) {
@@ -1685,7 +1684,7 @@
log_network("Never read any data from fd #%d", args->netfd);
#if 0
// Send a ping to reset the new stream
- boost::shared_ptr<amf::Buffer> ping_reset =
+ boost::shared_ptr<cygnal::Buffer> ping_reset =
rtmp->encodePing(RTMP::PING_CLEAR, 0);
if (rtmp->sendMsg(args->netfd, RTMP_SYSTEM_CHANNEL,
RTMP::HEADER_12, ping_reset->size(),
=== modified file 'cygnal/rtmp_server.h'
--- a/cygnal/rtmp_server.h 2010-03-11 01:47:08 +0000
+++ b/cygnal/rtmp_server.h 2010-05-27 22:44:28 +0000
@@ -56,37 +56,37 @@
/// INVOKE operation of ::connect(). serverFinish() is
/// actually used to extract the AMF data from the packet, and
/// handShakeResponse() is used to construct the response packet.
- boost::shared_ptr<amf::Element> processClientHandShake(int fd);
+ boost::shared_ptr<cygnal::Element> processClientHandShake(int fd);
- bool packetSend(amf::Buffer &buf);
- bool packetRead(amf::Buffer &buf);
+ bool packetSend(cygnal::Buffer &buf);
+ bool packetRead(cygnal::Buffer &buf);
// These are handlers for the various types
- boost::shared_ptr<amf::Buffer> encodeResult(gnash::RTMPMsg::rtmp_status_e
status);
- boost::shared_ptr<amf::Buffer> encodeResult(gnash::RTMPMsg::rtmp_status_e
status, const std::string &filename);
- boost::shared_ptr<amf::Buffer> encodeResult(gnash::RTMPMsg::rtmp_status_e
status, const std::string &filename, double &transid);
- boost::shared_ptr<amf::Buffer> encodeResult(gnash::RTMPMsg::rtmp_status_e
status, double &transid);
- boost::shared_ptr<amf::Buffer> encodeResult(gnash::RTMPMsg::rtmp_status_e
status, const std::string &filename, double &transid, double &clientid);
+ boost::shared_ptr<cygnal::Buffer>
encodeResult(gnash::RTMPMsg::rtmp_status_e status);
+ boost::shared_ptr<cygnal::Buffer>
encodeResult(gnash::RTMPMsg::rtmp_status_e status, const std::string &filename);
+ boost::shared_ptr<cygnal::Buffer>
encodeResult(gnash::RTMPMsg::rtmp_status_e status, const std::string &filename,
double &transid);
+ boost::shared_ptr<cygnal::Buffer>
encodeResult(gnash::RTMPMsg::rtmp_status_e status, double &transid);
+ boost::shared_ptr<cygnal::Buffer>
encodeResult(gnash::RTMPMsg::rtmp_status_e status, const std::string &filename,
double &transid, double &clientid);
// Encode a Ping for the client
- boost::shared_ptr<amf::Buffer> encodePing(rtmp_ping_e type,
boost::uint32_t milliseconds);
- boost::shared_ptr<amf::Buffer> encodePing(rtmp_ping_e type);
- // boost::shared_ptr<amf::Buffer> encodeUser(user_control_e type,
boost::uint32_t milliseconds);
- boost::shared_ptr<amf::Buffer> encodeAudio(boost::uint8_t *data, size_t
size);
- boost::shared_ptr<amf::Buffer> encodeVideo(boost::uint8_t *data, size_t
size);
+ boost::shared_ptr<cygnal::Buffer> encodePing(rtmp_ping_e type,
boost::uint32_t milliseconds);
+ boost::shared_ptr<cygnal::Buffer> encodePing(rtmp_ping_e type);
+ // boost::shared_ptr<cygnal::Buffer> encodeUser(user_control_e type,
boost::uint32_t milliseconds);
+ boost::shared_ptr<cygnal::Buffer> encodeAudio(boost::uint8_t *data, size_t
size);
+ boost::shared_ptr<cygnal::Buffer> encodeVideo(boost::uint8_t *data, size_t
size);
// Encode a onBWDone message for the client
- boost::shared_ptr<amf::Buffer> encodeBWDone(double id);
+ boost::shared_ptr<cygnal::Buffer> encodeBWDone(double id);
// Parse an Echo Request message coming from the Red5 echo_test.
- std::vector<boost::shared_ptr<amf::Element > >
parseEchoRequest(amf::Buffer &buf) { return parseEchoRequest(buf.reference(),
buf.size()); };
- std::vector<boost::shared_ptr<amf::Element > >
parseEchoRequest(boost::uint8_t *buf, size_t size);
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseEchoRequest(cygnal::Buffer &buf) { return
parseEchoRequest(buf.reference(), buf.size()); };
+ std::vector<boost::shared_ptr<cygnal::Element > >
parseEchoRequest(boost::uint8_t *buf, size_t size);
// format a response to the 'echo' test used for testing Gnash.
- boost::shared_ptr<amf::Buffer> formatEchoResponse(double num, amf::Element
&el);
- boost::shared_ptr<amf::Buffer> formatEchoResponse(double num, amf::Buffer
&data);
- boost::shared_ptr<amf::Buffer> formatEchoResponse(double num,
boost::uint8_t *data, size_t size);
- void addReference(boost::uint16_t index, amf::Element &el) {
_references[index] = el; };
- amf::Element &getReference(boost::uint16_t index) { return
_references[index]; };
+ boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num,
cygnal::Element &el);
+ boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num,
cygnal::Buffer &data);
+ boost::shared_ptr<cygnal::Buffer> formatEchoResponse(double num,
boost::uint8_t *data, size_t size);
+ void addReference(boost::uint16_t index, cygnal::Element &el) {
_references[index] = el; };
+ cygnal::Element &getReference(boost::uint16_t index) { return
_references[index]; };
bool sendFile(int fd, const std::string &filespec);
@@ -105,7 +105,7 @@
size_t sendToClient(std::vector<int> &fds, boost::uint8_t *data,
size_t size);
- size_t sendToClient(std::vector<int> &fds,amf::Buffer &data);
+ size_t sendToClient(std::vector<int> &fds,cygnal::Buffer &data);
void setNetConnection(gnash::RTMPMsg *msg) { _netconnect.reset(msg); };
void setNetConnection(boost::shared_ptr<gnash::RTMPMsg> msg) { _netconnect
= msg; };
@@ -117,12 +117,12 @@
/// This is only called by processClientHandshake() to compare
/// the handshakes to make sure they match, and to extract the
/// initial AMF data from packet.
- boost::shared_ptr<amf::Buffer> serverFinish(int fd,
- amf::Buffer &handshake1, amf::Buffer &handshake2);
+ boost::shared_ptr<cygnal::Buffer> serverFinish(int fd,
+ cygnal::Buffer &handshake1, cygnal::Buffer &handshake2);
/// \method handShakeResponse
/// This is only called by processClientHandshake() to
/// construct the handshake response to the client.
- bool handShakeResponse(int fd, amf::Buffer &buf);
+ bool handShakeResponse(int fd, cygnal::Buffer &buf);
/// This is used by the boost tokenizer functions, and is defined
/// here purely for convienience.
@@ -134,7 +134,7 @@
std::string _docroot;
std::string _filespec;
boost::uint32_t _filesize;
- std::map<boost::uint16_t, amf::Element> _references;
+ std::map<boost::uint16_t, cygnal::Element> _references;
#ifdef CLIENT_ID_NUMERIC
std::array<double> _clientids;
#else
=== modified file 'cygnal/serverSO.h'
--- a/cygnal/serverSO.h 2010-03-11 01:47:08 +0000
+++ b/cygnal/serverSO.h 2010-05-27 22:44:28 +0000
@@ -33,7 +33,7 @@
/// This class handles storing SharedObject on the server side.
/// The SOL class is used to optionally read and write a disk
/// file similar to the client side.
-class DSOEXPORT ServerSO : public amf::SOL
+class DSOEXPORT ServerSO : public cygnal::SOL
{
public:
ServerSO();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r12201: fix mass breakage of cygnal due to a namespace conflict. Rename amf namespace to cygnal, change everywhere it was referenced.,
Rob Savoye <=