[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/rtmp r9863: switch to boost::uint8_t from
From: |
rob |
Subject: |
[Gnash-commit] /srv/bzr/gnash/rtmp r9863: switch to boost::uint8_t from Network::byte_t. |
Date: |
Sat, 20 Dec 2008 10:11:55 -0700 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9863
committer: address@hidden
branch nick: rtmp
timestamp: Sat 2008-12-20 10:11:55 -0700
message:
switch to boost::uint8_t from Network::byte_t.
modified:
libamf/amf.cpp
libamf/amf.h
libamf/amfutf8.h
libamf/buffer.cpp
libamf/buffer.h
libamf/element.cpp
libamf/element.h
libamf/flv.cpp
libamf/flv.h
libamf/lcshm.cpp
libamf/lcshm.h
libamf/sol.cpp
libamf/sol.h
libcore/asobj/SharedObject.cpp
libmedia/FLVParser.cpp
libnet/cque.cpp
libnet/cque.h
libnet/handler.cpp
libnet/handler.h
libnet/http.cpp
libnet/http.h
libnet/network.h
libnet/rtmp.cpp
libnet/rtmp.h
libnet/rtmp_client.cpp
libnet/rtmp_msg.h
libnet/rtmp_server.cpp
utilities/flvdumper.cpp
=== modified file 'libamf/amf.cpp'
--- a/libamf/amf.cpp 2008-12-19 17:12:06 +0000
+++ b/libamf/amf.cpp 2008-12-20 17:11:55 +0000
@@ -29,11 +29,19 @@
#include "GnashException.h"
#include "buffer.h"
#include "amf.h"
-#include "network.h"
+//#include "network.h"
#include "element.h"
#include "amfutf8.h"
#include <boost/cstdint.hpp> // for boost::?int??_t
+#if !defined(HAVE_WINSOCK_H) || defined(__OS2__)
+# include <sys/types.h>
+# include <arpa/inet.h>
+#else
+# include <windows.h>
+# include <io.h>
+#endif
+
using namespace std;
using namespace gnash;
@@ -109,8 +117,8 @@
union {
boost::uint16_t s;
struct {
- Network::byte_t c0;
- Network::byte_t c1;
+ boost::uint8_t c0;
+ boost::uint8_t c1;
} c;
} u;
@@ -123,7 +131,7 @@
// Little-endian machine: byte-swap the word
// A conveniently-typed pointer to the source data
- Network::byte_t *x = static_cast<Network::byte_t *>(word);
+ boost::uint8_t *x = static_cast<boost::uint8_t *>(word);
/// Handle odd as well as even counts of bytes
std::reverse(x, x+size);
@@ -168,7 +176,7 @@
// Encode a boolean value. 0 for false, 1 for true
boost::shared_ptr<Buffer> buf(new Buffer(2));
*buf = Element::BOOLEAN_AMF0;
- *buf += static_cast<Network::byte_t>(flag);
+ *buf += static_cast<boost::uint8_t>(flag);
return buf;
}
@@ -218,7 +226,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeDate(const Network::byte_t *data)
+AMF::encodeDate(const boost::uint8_t *data)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf(new Buffer(AMF_HEADER_SIZE));
@@ -253,7 +261,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeXMLObject(const Network::byte_t * /*data */, size_t /* size */)
+AMF::encodeXMLObject(const boost::uint8_t * /*data */, size_t /* size */)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -270,7 +278,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeTypedObject(Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeTypedObject(boost::uint8_t * /* data */, size_t /* size */)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -287,7 +295,7 @@
///
/// @return a binary AMF packet in big endian format (header,data)
boost::shared_ptr<Buffer>
-AMF::encodeReference(const Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeReference(const boost::uint8_t * /* data */, size_t /* size */)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -304,7 +312,7 @@
///
/// @return a binary AMF packet in big endian format (header,data)
boost::shared_ptr<Buffer>
-AMF::encodeMovieClip(const Network::byte_t * /*data */, size_t /* size */)
+AMF::encodeMovieClip(const boost::uint8_t * /*data */, size_t /* size */)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -323,7 +331,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeECMAArray(const Network::byte_t * /*data */, size_t /* size */)
+AMF::encodeECMAArray(const boost::uint8_t * /*data */, size_t /* size */)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -340,7 +348,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeLongString(const Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeLongString(const boost::uint8_t * /* data */, size_t /* size */)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -357,7 +365,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeRecordSet(const Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeRecordSet(const boost::uint8_t * /* data */, size_t /* size */)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -376,7 +384,7 @@
///
/// @return a binary AMF packet in big endian format (header,data)
boost::shared_ptr<Buffer>
-AMF::encodeStrictArray(const Network::byte_t * /* data */, size_t /* size */)
+AMF::encodeStrictArray(const boost::uint8_t * /* data */, size_t /* size */)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<Buffer> buf;
@@ -393,7 +401,7 @@
boost::shared_ptr<Buffer>
AMF::encodeString(const string &str)
{
- Network::byte_t *ptr = const_cast<Network::byte_t
*>(reinterpret_cast<const Network::byte_t *>(str.c_str()));
+ boost::uint8_t *ptr = const_cast<boost::uint8_t *>(reinterpret_cast<const
boost::uint8_t *>(str.c_str()));
return encodeString(ptr, str.size());
}
@@ -405,7 +413,7 @@
///
/// @return a binary AMF packet in big endian format
boost::shared_ptr<Buffer>
-AMF::encodeString(Network::byte_t *data, size_t size)
+AMF::encodeString(boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
boost::uint16_t length;
@@ -656,8 +664,8 @@
AMF::extractAMF(boost::shared_ptr<Buffer> buf)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t* start = buf->reference();
- Network::byte_t* tooFar = start+buf->size();
+ boost::uint8_t* start = buf->reference();
+ boost::uint8_t* tooFar = start+buf->size();
return extractAMF(start, tooFar);
}
@@ -674,11 +682,11 @@
///
/// @remarks May throw a ParserException
boost::shared_ptr<amf::Element>
-AMF::extractAMF(Network::byte_t *in, Network::byte_t* tooFar)
+AMF::extractAMF(boost::uint8_t *in, boost::uint8_t* tooFar)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *tmpptr = in;
+ boost::uint8_t *tmpptr = in;
boost::uint16_t length;
boost::shared_ptr<amf::Element> el(new Element);
@@ -859,8 +867,8 @@
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t* start = buf->reference();
- Network::byte_t* tooFar = start+buf->size();
+ boost::uint8_t* start = buf->reference();
+ boost::uint8_t* tooFar = start+buf->size();
return extractProperty(start, tooFar);
}
@@ -878,11 +886,11 @@
///
/// @remarks May throw a ParserException
boost::shared_ptr<amf::Element>
-AMF::extractProperty(Network::byte_t *in, Network::byte_t* tooFar)
+AMF::extractProperty(boost::uint8_t *in, boost::uint8_t* tooFar)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *tmpptr = in;
+ boost::uint8_t *tmpptr = in;
boost::uint16_t length;
boost::shared_ptr<amf::Element> el;
=== modified file 'libamf/amf.h'
--- a/libamf/amf.h 2008-11-18 22:56:10 +0000
+++ b/libamf/amf.h 2008-12-20 17:11:55 +0000
@@ -26,10 +26,6 @@
#ifndef _AMF_H_
#define _AMF_H_
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
#include <vector>
#include <string>
#include <cstring>
@@ -37,7 +33,6 @@
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>
-#include "network.h"
#include "element.h"
#include "dsodefs.h"
@@ -54,7 +49,7 @@
/// \brief The header size in bytes of an common AMF object.
/// The size of an AMF header is a type field (1 byte), followed by a
/// length field. (short)
-const gnash::Network::byte_t AMF_HEADER_SIZE = 3;
+const boost::uint8_t AMF_HEADER_SIZE = 3;
/// \brief The header size of a property.
/// A property is a little different. It always assumes the the
@@ -62,13 +57,13 @@
/// type byte like a regular AMF object and length is used for the
/// data. So a property object header is then only 5 bytes instead
/// of the 6 that one assumes would be used.
-const gnash::Network::byte_t AMF_PROP_HEADER_SIZE = 5;
+const boost::uint8_t AMF_PROP_HEADER_SIZE = 5;
/// AMF version 0 is supported by default
-const gnash::Network::byte_t AMF_VERSION = 0;
+const boost::uint8_t AMF_VERSION = 0;
/// For terminating sequences, a byte with value 0x09 is used.
-const gnash::Network::byte_t TERMINATOR = 0x09;
+const boost::uint8_t TERMINATOR = 0x09;
/// \brief The maximum size for a string.
/// As if there is a parsing error, we'll often see the symptom of the length
@@ -151,7 +146,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeString(gnash::Network::byte_t
*data, size_t size);
+ static boost::shared_ptr<Buffer> encodeString(boost::uint8_t *data, size_t
size);
/// Encode a String object to its serialized representation.
//
@@ -197,7 +192,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeXMLObject(const
gnash::Network::byte_t *data, size_t nbytes);
+ static boost::shared_ptr<Buffer> encodeXMLObject(const boost::uint8_t
*data, size_t nbytes);
/// Encode a Typed Object to its serialized representation.
//
@@ -207,7 +202,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeTypedObject(gnash::Network::byte_t
*data, size_t size);
+ static boost::shared_ptr<Buffer> encodeTypedObject(boost::uint8_t *data,
size_t size);
/// Encode a Reference to an object to its serialized representation.
//
@@ -217,7 +212,7 @@
///
/// @return a binary AMF packet in big endian format (header,data)
///
- static boost::shared_ptr<Buffer> encodeReference(const
gnash::Network::byte_t *data, size_t size);
+ static boost::shared_ptr<Buffer> encodeReference(const boost::uint8_t
*data, size_t size);
/// Encode a Movie Clip (swf data) to its serialized representation.
//
@@ -227,7 +222,7 @@
///
/// @return a binary AMF packet in big endian format (header,data)
///
- static boost::shared_ptr<Buffer> encodeMovieClip(const
gnash::Network::byte_t *data, size_t size);
+ static boost::shared_ptr<Buffer> encodeMovieClip(const boost::uint8_t
*data, size_t size);
/// Encode an ECMA Array to its serialized representation.
//
@@ -240,7 +235,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeECMAArray(const
gnash::Network::byte_t *data, size_t size);
+ static boost::shared_ptr<Buffer> encodeECMAArray(const boost::uint8_t
*data, size_t size);
/// Encode a Long String to its serialized representation.
//
@@ -250,7 +245,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeLongString(const
gnash::Network::byte_t *data, size_t size);
+ static boost::shared_ptr<Buffer> encodeLongString(const boost::uint8_t
*data, size_t size);
/// Encode a Record Set to its serialized representation.
//
@@ -260,7 +255,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeRecordSet(const
gnash::Network::byte_t *data, size_t size);
+ static boost::shared_ptr<Buffer> encodeRecordSet(const boost::uint8_t
*data, size_t size);
/// Encode a Date to its serialized representation.
//
@@ -268,7 +263,7 @@
///
/// @return a binary AMF packet in big endian format
///
- static boost::shared_ptr<Buffer> encodeDate(const gnash::Network::byte_t
*data);
+ static boost::shared_ptr<Buffer> encodeDate(const boost::uint8_t *data);
/// Encode a Strict Array to its serialized representation.
//
@@ -281,7 +276,7 @@
///
/// @return a binary AMF packet in big endian format (header,data)
///
- static boost::shared_ptr<Buffer> encodeStrictArray(const
gnash::Network::byte_t *data, size_t size);
+ static boost::shared_ptr<Buffer> encodeStrictArray(const boost::uint8_t
*data, size_t size);
/// Encode an object to its serialized representation.
//
@@ -343,7 +338,7 @@
///
/// @return The data type from the header
///
- static Element::amf0_type_e extractElementHeader(gnash::Network::byte_t
*in)
+ static Element::amf0_type_e extractElementHeader(boost::uint8_t *in)
{ return *(reinterpret_cast<Element::amf0_type_e
*>(in)); };
/// Extract an AMF object from an array of raw bytes.
@@ -359,7 +354,7 @@
///
/// @remarks May throw a ParserException
///
- boost::shared_ptr<amf::Element> extractAMF(gnash::Network::byte_t *in,
gnash::Network::byte_t* tooFar);
+ boost::shared_ptr<amf::Element> extractAMF(boost::uint8_t *in,
boost::uint8_t* tooFar);
/// Extract an AMF object from an array of raw bytes.
//
@@ -386,7 +381,7 @@
///
/// @remarks May throw a ParserException
///
- boost::shared_ptr<amf::Element> extractProperty(gnash::Network::byte_t
*in, gnash::Network::byte_t* tooFar);
+ boost::shared_ptr<amf::Element> extractProperty(boost::uint8_t *in,
boost::uint8_t* tooFar);
/// Extract a Property.
//
=== modified file 'libamf/amfutf8.h'
--- a/libamf/amfutf8.h 2008-01-21 22:55:26 +0000
+++ b/libamf/amfutf8.h 2008-12-20 17:11:55 +0000
@@ -18,10 +18,6 @@
#ifndef _AMFUTF8_H_
#define _AMFUTF8_H_
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
#include <vector>
namespace amf
=== modified file 'libamf/buffer.cpp'
--- a/libamf/buffer.cpp 2008-12-15 23:02:24 +0000
+++ b/libamf/buffer.cpp 2008-12-20 17:11:55 +0000
@@ -26,7 +26,7 @@
#include "buffer.h"
#include "amf.h"
#include "log.h"
-#include "network.h"
+//#include "network.h"
#include "GnashException.h"
using namespace std;
@@ -43,8 +43,8 @@
/// @param digit The digit as a hex value
///
/// @return The byte as a decimal value.
-Network::byte_t
-Buffer::hex2digit (Network::byte_t digit)
+boost::uint8_t
+Buffer::hex2digit (boost::uint8_t digit)
{
if (digit == 0)
return 0;
@@ -73,10 +73,10 @@
// GNASH_REPORT_FUNCTION;
size_t count = str.size();
size_t size = (count/3) + 1;
- Network::byte_t ch = 0;
+ boost::uint8_t ch = 0;
- Network::byte_t *ptr = const_cast<Network::byte_t
*>(reinterpret_cast<const Network::byte_t *>(str.c_str()));
- Network::byte_t *end = ptr + count;
+ boost::uint8_t *ptr = const_cast<boost::uint8_t *>(reinterpret_cast<const
boost::uint8_t *>(str.c_str()));
+ boost::uint8_t *end = ptr + count;
init(size);
@@ -107,7 +107,7 @@
{
// GNASH_REPORT_FUNCTION;
if (!_data) {
- _data.reset(new Network::byte_t[size]);
+ _data.reset(new boost::uint8_t[size]);
_seekptr = _data.get();
}
_seekptr = _data.get();
@@ -126,8 +126,8 @@
: _seekptr(0)
{
// GNASH_REPORT_FUNCTION;
- _nbytes = gnash::NETBUFSIZE;
- init(gnash::NETBUFSIZE);
+ _nbytes = amf::NETBUFSIZE;
+ init(amf::NETBUFSIZE);
}
/// \brief Create a new Buffer with a size other than the default
@@ -176,7 +176,7 @@
///
/// @return A reference to a Buffer.
Buffer &
-Buffer::copy(Network::byte_t *data, size_t nbytes)
+Buffer::copy(boost::uint8_t *data, size_t nbytes)
{
// GNASH_REPORT_FUNCTION;
if (_data) {
@@ -197,7 +197,7 @@
///
/// @return A reference to a Buffer.
Buffer &
-Buffer::append(gnash::Network::byte_t *data, size_t nbytes)
+Buffer::append(boost::uint8_t *data, size_t nbytes)
{
// GNASH_REPORT_FUNCTION;
if (_data) {
@@ -235,7 +235,7 @@
Buffer::operator+=(amf::Element::amf0_type_e type)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t nb = static_cast<Network::byte_t>(type);
+ boost::uint8_t nb = static_cast<boost::uint8_t>(type);
return operator+=(nb);
}
@@ -249,7 +249,7 @@
Buffer::operator+=(char byte)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t nb = static_cast<Network::byte_t>(byte);
+ boost::uint8_t nb = static_cast<boost::uint8_t>(byte);
return operator+=(nb);
}
@@ -262,7 +262,7 @@
Buffer::operator+=(bool flag)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t nb = static_cast<Network::byte_t>(flag);
+ boost::uint8_t nb = static_cast<boost::uint8_t>(flag);
return operator+=(nb);
}
@@ -272,7 +272,7 @@
///
/// @return A reference to a Buffer.
Buffer &
-Buffer::operator+=(Network::byte_t byte)
+Buffer::operator+=(boost::uint8_t byte)
{
// GNASH_REPORT_FUNCTION;
if ((_seekptr + 1) <= (_data.get() + _nbytes)) {
@@ -292,7 +292,7 @@
Buffer::operator+=(const char *str)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = const_cast<Network::byte_t
*>(reinterpret_cast<const Network::byte_t *>(str));
+ boost::uint8_t *ptr = const_cast<boost::uint8_t *>(reinterpret_cast<const
boost::uint8_t *>(str));
return append(ptr, strlen(str));
}
@@ -307,7 +307,7 @@
Buffer::operator+=(const std::string &str)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = const_cast<Network::byte_t
*>(reinterpret_cast<const Network::byte_t *>(str.c_str()));
+ boost::uint8_t *ptr = const_cast<boost::uint8_t *>(reinterpret_cast<const
boost::uint8_t *>(str.c_str()));
return append(ptr, str.size());
}
@@ -321,7 +321,7 @@
Buffer::operator+=(double num)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(&num);
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(&num);
return append(ptr, AMF0_NUMBER_SIZE);
}
@@ -334,7 +334,7 @@
Buffer::operator+=(boost::uint16_t length)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(&length);
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(&length);
return append(ptr, sizeof(boost::uint16_t));
}
@@ -347,7 +347,7 @@
Buffer::operator+=(boost::uint32_t length)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(&length);
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(&length);
return append(ptr, sizeof(boost::uint32_t));
}
@@ -392,7 +392,7 @@
Buffer::operator=(const std::string &str)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = const_cast<Network::byte_t
*>(reinterpret_cast<const Network::byte_t *>(str.c_str()));
+ boost::uint8_t *ptr = const_cast<boost::uint8_t *>(reinterpret_cast<const
boost::uint8_t *>(str.c_str()));
return copy(ptr, str.size());
}
@@ -400,7 +400,7 @@
Buffer::operator=(const char *str)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = const_cast<Network::byte_t
*>(reinterpret_cast<const Network::byte_t *>(str));
+ boost::uint8_t *ptr = const_cast<boost::uint8_t *>(reinterpret_cast<const
boost::uint8_t *>(str));
return copy(ptr, strlen(str));
}
@@ -414,7 +414,7 @@
Buffer::operator=(double num)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(&num);
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(&num);
return copy(ptr, AMF0_NUMBER_SIZE);
}
@@ -428,7 +428,7 @@
Buffer::operator=(boost::uint16_t length)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(&length);
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(&length);
return copy(ptr, sizeof(boost::uint16_t));
}
@@ -441,7 +441,7 @@
Buffer &
Buffer::operator=(amf::Element::amf0_type_e type)
{
- Network::byte_t nb = static_cast<Network::byte_t>(type);
+ boost::uint8_t nb = static_cast<boost::uint8_t>(type);
return operator+=(nb);
}
@@ -454,7 +454,7 @@
Buffer &
Buffer::operator=(bool flag)
{
- Network::byte_t nb = static_cast<Network::byte_t>(flag);
+ boost::uint8_t nb = static_cast<boost::uint8_t>(flag);
return operator=(nb);
}
@@ -465,7 +465,7 @@
///
/// @return A reference to a Buffer.
Buffer &
-Buffer::operator=(gnash::Network::byte_t byte)
+Buffer::operator=(boost::uint8_t byte)
{
// GNASH__FUNCTION;
return copy(&byte, 1);
@@ -478,7 +478,7 @@
///
/// @return A reference to a Buffer.
Buffer &
-Buffer::operator=(gnash::Network::byte_t *data)
+Buffer::operator=(boost::uint8_t *data)
{
// GNASH_REPORT_FUNCTION;
if (data) {
@@ -531,11 +531,11 @@
/// @param byte The byte to remove from the buffer.
///
/// @return A real pointer to the base address of the buffer.
-Network::byte_t *
-Buffer::remove(Network::byte_t c)
+boost::uint8_t *
+Buffer::remove(boost::uint8_t c)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *start = std::find(begin(), end(), c);
+ boost::uint8_t *start = std::find(begin(), end(), c);
// log_debug("Byte is at %x", (void *)start);
@@ -559,7 +559,7 @@
/// Buffer
///
/// @return A real pointer to the base address of the Buffer.
-Network::byte_t *
+boost::uint8_t *
Buffer::remove(int start)
{
// GNASH_REPORT_FUNCTION;
@@ -583,7 +583,7 @@
/// @param range The amount of bytes to remove from the Buffer.
///
/// @return A real pointer to the base address of the Buffer.
-Network::byte_t *
+boost::uint8_t *
Buffer::remove(int start, int range)
{
// GNASH_REPORT_FUNCTION;
@@ -637,12 +637,12 @@
Buffer::resize(size_t size)
{
GNASH_REPORT_FUNCTION;
- boost::scoped_array<gnash::Network::byte_t> tmp;
+ boost::scoped_array<boost::uint8_t> tmp;
// If we don't have any data yet in this buffer, resizing is cheap, as
// we don't havce to copy any data.
if (_seekptr == _data.get()) {
- _data.reset(new Network::byte_t[size]);
+ _data.reset(new boost::uint8_t[size]);
_nbytes= size;
return *this;
}
@@ -678,7 +678,7 @@
log_error("amf::Buffer::resize(%d): Truncating data (%d bytes)
while resizing!", size, used - size);
used = size;
}
- Network::byte_t *newptr = new Network::byte_t[size];
+ boost::uint8_t *newptr = new boost::uint8_t[size];
std::copy(_data.get(), _data.get() + used, newptr);
_data.reset(newptr);
=== modified file 'libamf/buffer.h'
--- a/libamf/buffer.h 2008-12-01 15:42:49 +0000
+++ b/libamf/buffer.h 2008-12-20 17:11:55 +0000
@@ -19,6 +19,10 @@
#ifndef __BUFFER_H__
#define __BUFFER_H__ 1
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
#include <boost/cstdint.hpp>
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
@@ -28,7 +32,6 @@
#include "getclocktime.hpp"
#include "amf.h"
#include "element.h"
-#include "network.h"
#include "dsodefs.h"
// _definst_ is the default instance name
@@ -39,6 +42,10 @@
namespace amf
{
+// Adjust for the constant size
+const size_t NETBUFSIZE = 1448; // 1500 appears to be the default size
as used by FMS
+//const size_t NETBUFSIZE = 1357*2; // 1500 appears to be the default size
as used by FMS
+
/// \class Buffer
///
/// This class is used to hold all data for libamf classes. It is a
@@ -114,7 +121,7 @@
/// @param nbytes The number of bytes to copy.
///
/// @return A reference to a Buffer.
- Buffer ©(gnash::Network::byte_t *data, size_t nbytes);
+ Buffer ©(boost::uint8_t *data, size_t nbytes);
/// \brief Copy a Buffer class into the buffer.
/// This overwrites all data, and resets the seek ptr.
@@ -153,14 +160,14 @@
/// @param byte A single byte.
///
/// @return A reference to a Buffer.
- Buffer &operator=(gnash::Network::byte_t byte);
+ Buffer &operator=(boost::uint8_t byte);
/// \brief Copy a byte into the buffer.
/// This overwrites all data, and resets the seek ptr.
///
/// @param byte A pointer to a single byte.
///
/// @return A reference to a Buffer.
- Buffer &operator=(gnash::Network::byte_t *byte);
+ Buffer &operator=(boost::uint8_t *byte);
/// \brief Copy a AMF0 type into the buffer.
/// This overwrites all data, and resets the seek ptr.
///
@@ -184,7 +191,7 @@
/// @param nbytes The number of bytes to append.
///
/// @return A reference to a Buffer.
- Buffer &append(gnash::Network::byte_t *data, size_t nbytes);
+ Buffer &append(boost::uint8_t *data, size_t nbytes);
/// \brief Append a Buffer class to existing data in the buffer.
///
@@ -226,7 +233,7 @@
/// @param byte A single byte.
///
/// @return A reference to a Buffer.
- Buffer &operator+=(gnash::Network::byte_t byte);
+ Buffer &operator+=(boost::uint8_t byte);
Buffer &operator+=(char byte);
/// \brief Append an AMF0 type to existing data in the buffer.
///
@@ -249,7 +256,7 @@
/// @param byte The byte to remove from the buffer.
///
/// @return A real pointer to the base address of the buffer.
- gnash::Network::byte_t *remove(gnash::Network::byte_t c);
+ boost::uint8_t *remove(boost::uint8_t c);
/// \brief Drop a byte without resizing.
/// This will remove the byte from the Buffer, and then
/// move the remaining data to be in the correct
@@ -259,7 +266,7 @@
/// Buffer
///
/// @return A real pointer to the base address of the Buffer.
- gnash::Network::byte_t *remove(int index);
+ boost::uint8_t *remove(int index);
/// \brief Drop bytes without resizing.
/// This will remove the bytes from the Buffer, and then
/// move the remaining data to be in the correct
@@ -274,22 +281,22 @@
/// @param range The amoiunt of bytes to remove from the Buffer.
///
/// @return A real pointer to the base address of the Buffer.
- gnash::Network::byte_t *remove(int start, int range);
+ boost::uint8_t *remove(int start, int range);
// Network::byte_t *remove(char c);
/// \brief Return the base address of the Buffer.
///
/// @return A real pointer to the base address of the Buffer.
- gnash::Network::byte_t *begin() { return _data.get() ; };
- gnash::Network::byte_t *reference() { return _data.get(); }
- const gnash::Network::byte_t *reference() const { return _data.get(); }
+ boost::uint8_t *begin() { return _data.get() ; };
+ boost::uint8_t *reference() { return _data.get(); }
+ const boost::uint8_t *reference() const { return _data.get(); }
/// \brief Return the last address of the Buffer
/// Which is the base address plus the total size of the
/// Buffer.
///
/// @return A real pointer to the last address of the Buffer with data.
- gnash::Network::byte_t *end() { return _seekptr; };
+ boost::uint8_t *end() { return _seekptr; };
/// \brief Get the size of the Buffer.
///
@@ -326,7 +333,7 @@
/// get.
///
/// @return The byte at the specified location.
- gnash::Network::byte_t operator[](int index) { return _data[index]; };
+ boost::uint8_t operator[](int index) { return _data[index]; };
/// \brief Get the byte at a specified location.
///
@@ -334,7 +341,7 @@
/// get.
///
/// @return A real pointer to the byte at the specified location.
- gnash::Network::byte_t *at(int index) { return _data.get() + index; };
+ boost::uint8_t *at(int index) { return _data.get() + index; };
/// \brief How much room is left in the buffer past the seek pointer.
/// This is primarily used to see if the buffer is fully
@@ -368,12 +375,12 @@
/// \var _seekptr
/// \brief This is a pointer to the address in the Buffer to
/// write data to then next time some is appended.
- gnash::Network::byte_t *_seekptr;
+ boost::uint8_t *_seekptr;
/// \var _data
/// \brief This is the container of the actual data in this
/// Buffer.
- boost::scoped_array<gnash::Network::byte_t> _data;
+ boost::scoped_array<boost::uint8_t> _data;
/// \var _nbytes
/// \brief This is the total allocated size of the Buffer.
@@ -401,7 +408,7 @@
/// @param digit The digit as a hex value
///
/// @return The byte as a decimal value.
- gnash::Network::byte_t hex2digit (gnash::Network::byte_t digit);
+ boost::uint8_t hex2digit (boost::uint8_t digit);
};
/// \brief Dump to the specified output stream.
=== modified file 'libamf/element.cpp'
--- a/libamf/element.cpp 2008-12-18 17:32:49 +0000
+++ b/libamf/element.cpp 2008-12-20 17:11:55 +0000
@@ -287,7 +287,7 @@
/// \brief Cast the data in this Element to an real pointer to data.
///
/// @return A real pointer to the base address of the raw data in memory.
-gnash::Network::byte_t *
+boost::uint8_t *
Element::to_reference()
{
// GNASH_REPORT_FUNCTION;
@@ -297,7 +297,7 @@
return 0;
};
-const gnash::Network::byte_t *
+const boost::uint8_t *
Element::to_reference() const
{
// GNASH_REPORT_FUNCTION;
@@ -404,7 +404,7 @@
*buf += enclength;
string str = _name;
*buf += str;
- Network::byte_t byte = static_cast<Network::byte_t>(0x5);
+ boost::uint8_t byte = static_cast<boost::uint8_t>(0x5);
*buf += byte;
}
@@ -421,7 +421,7 @@
}
}
// log_debug("FIXME: Terminating object");
- Network::byte_t pad = 0;
+ boost::uint8_t pad = 0;
*buf += pad;
*buf += pad;
*buf += TERMINATOR;
@@ -521,7 +521,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeString(Network::byte_t *data, size_t size)
+Element::makeString(boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
_type = Element::STRING_AMF0;
@@ -551,7 +551,7 @@
{
// GNASH_REPORT_FUNCTION;
_type = Element::STRING_AMF0;
- check_buffer(sizeof(Network::byte_t));
+ check_buffer(sizeof(boost::uint8_t));
*(_buffer->reference()) = 0;
return *this;
}
@@ -568,7 +568,7 @@
{
// GNASH_REPORT_FUNCTION;
_type = Element::STRING_AMF0;
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(const_cast<char
*>(str));
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(const_cast<char
*>(str));
return makeString(ptr, size);
}
@@ -620,7 +620,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeNumber(Network::byte_t *data)
+Element::makeNumber(boost::uint8_t *data)
{
// GNASH_REPORT_FUNCTION;
double num = *reinterpret_cast<const double*>(data);
@@ -662,10 +662,10 @@
return makeNumber(num);
}
-/// \overload Element::makeNumber(const std::string &name,
gnash::Network::byte_t *data);
+/// \overload Element::makeNumber(const std::string &name, boost::uint8_t
*data);
/// The size isn't needed as a double is always the same size.
Element &
-Element::makeNumber(const std::string &name, gnash::Network::byte_t *data)
+Element::makeNumber(const std::string &name, boost::uint8_t *data)
{
// GNASH_REPORT_FUNCTION;
if (name.size()) {
@@ -717,7 +717,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeBoolean(Network::byte_t *data)
+Element::makeBoolean(boost::uint8_t *data)
{
// GNASH_REPORT_FUNCTION;
bool flag = *reinterpret_cast<const bool*>(data);
@@ -926,7 +926,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeTypedObject(Network::byte_t *data, size_t size)
+Element::makeTypedObject(boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
_type = Element::TYPED_OBJECT_AMF0;
@@ -954,7 +954,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeReference(Network::byte_t *indata, size_t size)
+Element::makeReference(boost::uint8_t *indata, size_t size)
{
// GNASH_REPORT_FUNCTION;
_type = Element::REFERENCE_AMF0;
@@ -982,7 +982,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeMovieClip(Network::byte_t *indata, size_t size)
+Element::makeMovieClip(boost::uint8_t *indata, size_t size)
{
// GNASH_REPORT_FUNCTION;
_type = Element::MOVIECLIP_AMF0;
@@ -1133,7 +1133,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeUnsupported(Network::byte_t *data, size_t size)
+Element::makeUnsupported(boost::uint8_t *data, size_t size)
{
// GNASH_REPORT_FUNCTION;
_type = Element::UNSUPPORTED_AMF0;
@@ -1161,7 +1161,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeLongString(Network::byte_t *indata, size_t size)
+Element::makeLongString(boost::uint8_t *indata, size_t size)
{
// GNASH_REPORT_FUNCTION;
_type = Element::LONG_STRING_AMF0;
@@ -1187,7 +1187,7 @@
///
/// @return A reference to this Element.
Element &
-Element::makeDate(Network::byte_t *date)
+Element::makeDate(boost::uint8_t *date)
{
// GNASH_REPORT_FUNCTION;
_type = Element::DATE_AMF0;
@@ -1240,7 +1240,7 @@
Element::setName(const char *name, size_t size)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(const_cast<char
*>(name));
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(const_cast<char
*>(name));
return setName(ptr, size);
}
@@ -1255,7 +1255,7 @@
///
/// @remarks This adds a NULL string terminator so the name can be printed.
void
-Element::setName(Network::byte_t *name, size_t size)
+Element::setName(boost::uint8_t *name, size_t size)
{
// GNASH_REPORT_FUNCTION;
if ((size > 0) && (name != 0)) {
=== modified file 'libamf/element.h'
--- a/libamf/element.h 2008-11-18 22:56:10 +0000
+++ b/libamf/element.h 2008-12-20 17:11:55 +0000
@@ -26,7 +26,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
-#include "network.h"
+//#include "network.h"
#include "dsodefs.h" // DSOEXPORT
/// \namespace amf
@@ -221,8 +221,8 @@
///
/// @return A reference to this Element.
Element &makeString(const char *str, size_t size);
- /// \overload Element::makeString(gnash::Network::byte_t *data, size_t
size)
- Element &makeString(gnash::Network::byte_t *data, size_t size);
+ /// \overload Element::makeString(boost::uint8_t *data, size_t size)
+ Element &makeString(boost::uint8_t *data, size_t size);
/// \brief Make this Element with an ASCII string value.
///
@@ -261,7 +261,7 @@
/// @param str The double to use as the value.
///
/// @return A reference to this Element.
- Element &makeNumber(gnash::Network::byte_t *data);
+ Element &makeNumber(boost::uint8_t *data);
/// \brief Make this Element a Property with a double value
///
@@ -269,9 +269,9 @@
///
/// @param num The double to use as the value of the property.
Element &makeNumber(const std::string &name, double num) ;
- /// \overload Element::makeNumber(const std::string &name,
gnash::Network::byte_t *data);
+ /// \overload Element::makeNumber(const std::string &name, boost::uint8_t
*data);
/// The size isn't needed as a double is always the same
size.
- Element &makeNumber(const std::string &name, gnash::Network::byte_t *data);
+ Element &makeNumber(const std::string &name, boost::uint8_t *data);
/// \brief Make this Element with a boolean value.
/// The size isn't needed as a boolean is always the same
size.
@@ -279,7 +279,7 @@
/// @param data A real pointer to the boolean use as the value.
///
/// @return A reference to this Element.
- Element &makeBoolean(gnash::Network::byte_t *data);
+ Element &makeBoolean(boost::uint8_t *data);
/// \brief Make this Element with a boolean value.
///
@@ -464,7 +464,7 @@
/// @param size The number of bytes to use as the value.
///
/// @return A reference to this Element.
- Element &makeTypedObject(gnash::Network::byte_t *data, size_t size);
+ Element &makeTypedObject(boost::uint8_t *data, size_t size);
/// \brief Make this Element a Property with an Object Reference as the
value.
///
@@ -478,7 +478,7 @@
/// @param size The number of bytes to use as the value.
///
/// @return A reference to this Element.
- Element &makeReference(gnash::Network::byte_t *data, size_t size);
+ Element &makeReference(boost::uint8_t *data, size_t size);
/// \brief Make this Element a Property with a Movie Clip (SWF data) as
the value.
///
@@ -492,7 +492,7 @@
/// @param size The number of bytes to use as the value.
///
/// @return A reference to this Element.
- Element &makeMovieClip(gnash::Network::byte_t *data, size_t size);
+ Element &makeMovieClip(boost::uint8_t *data, size_t size);
/// \brief Make this Element a Property with a UTF8 String as the value.
///
@@ -506,7 +506,7 @@
/// @param size The number of bytes to use as the value.
///
/// @return A reference to this Element.
- Element &makeLongString(gnash::Network::byte_t *data, size_t size);
+ Element &makeLongString(boost::uint8_t *data, size_t size);
/// \brief Make this Element a Property with a Record Set as the value.
///
@@ -520,7 +520,7 @@
/// @param size The number of bytes to use as the value.
///
/// @return A reference to this Element.
- Element &makeRecordSet(gnash::Network::byte_t *data, size_t size);
+ Element &makeRecordSet(boost::uint8_t *data, size_t size);
/// \brief Make this Element a Property with a Date as the value.
///
@@ -532,7 +532,7 @@
/// @param data A real pointer to the raw data to use as the value.
///
/// @return A reference to this Element.
- Element &makeDate(gnash::Network::byte_t *data);
+ Element &makeDate(boost::uint8_t *data);
/// \brief Make this Element a Property with an Unsupported value.
///
@@ -546,7 +546,7 @@
/// @param size The number of bytes to use as the value.
///
/// @return A reference to this Element.
- Element &makeUnsupported(gnash::Network::byte_t *data, size_t size);
+ Element &makeUnsupported(boost::uint8_t *data, size_t size);
/// \brief Test equivalance against another Element.
/// This compares all the data and the data type in the
@@ -626,8 +626,8 @@
/// \brief Cast the data in this Element to an real pointer to data.
///
/// @return A real pointer to the base address of the raw data in memory.
- gnash::Network::byte_t *to_reference();
- const gnash::Network::byte_t *to_reference() const;
+ boost::uint8_t *to_reference();
+ const boost::uint8_t *to_reference() const;
// Manipulate the name of a property
@@ -663,7 +663,7 @@
/// @return nothing.
///
/// @remarks This add a NULL string terminator so the name can be printed.
- void setName(gnash::Network::byte_t *name, size_t size);
+ void setName(boost::uint8_t *name, size_t size);
// Manipulate the children Elements of an object
=== modified file 'libamf/flv.cpp'
--- a/libamf/flv.cpp 2008-10-27 14:46:27 +0000
+++ b/libamf/flv.cpp 2008-12-20 17:11:55 +0000
@@ -27,6 +27,13 @@
#include <vector>
#include <cmath>
#include <climits>
+#if !defined(HAVE_WINSOCK_H) || defined(__OS2__)
+# include <sys/types.h>
+# include <arpa/inet.h>
+#else
+# include <windows.h>
+# include <io.h>
+#endif
#include "buffer.h"
#include "log.h"
@@ -67,20 +74,20 @@
// Encode the data into a Buffer
boost::shared_ptr<amf::Buffer>
-Flv::encodeHeader(Network::byte_t type)
+Flv::encodeHeader(boost::uint8_t type)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<amf::Buffer> buf(new Buffer(sizeof(Flv::flv_header_t)));
buf->clear();
- Network::byte_t version = 0x1;
+ boost::uint8_t version = 0x1;
*buf = "FLV";
*buf += version;
*buf += type;
boost::uint32_t size = htonl(0x9);
- buf->append((Network::byte_t *)&size, sizeof(boost::uint32_t));
+ buf->append((boost::uint8_t *)&size, sizeof(boost::uint32_t));
return buf;
}
@@ -140,12 +147,12 @@
}
boost::shared_ptr<amf::Element>
-Flv::decodeMetaData(gnash::Network::byte_t *buf, size_t size)
+Flv::decodeMetaData(boost::uint8_t *buf, size_t size)
{
// GNASH_REPORT_FUNCTION;
AMF amf;
- Network::byte_t *ptr = buf;
- Network::byte_t *tooFar = ptr + size;
+ boost::uint8_t *ptr = buf;
+ boost::uint8_t *tooFar = ptr + size;
// Extract the onMetaData object name
// In disk files, I always see the 0x2 type field for
@@ -174,7 +181,7 @@
}
boost::shared_ptr<Flv::flv_audio_t>
-Flv::decodeAudioData(gnash::Network::byte_t byte)
+Flv::decodeAudioData(boost::uint8_t byte)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<flv_audio_t> audio(new flv_audio_t);
@@ -233,7 +240,7 @@
}
boost::shared_ptr<Flv::flv_video_t>
-Flv::decodeVideoData(gnash::Network::byte_t byte)
+Flv::decodeVideoData(boost::uint8_t byte)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<flv_video_t> video(new flv_video_t);
=== modified file 'libamf/flv.h'
--- a/libamf/flv.h 2008-10-27 14:46:27 +0000
+++ b/libamf/flv.h 2008-12-20 17:11:55 +0000
@@ -165,7 +165,7 @@
/// @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(gnash::Network::byte_t type);
+ boost::shared_ptr<amf::Buffer> encodeHeader(boost::uint8_t type);
/// \brief Decode a Buffer into a header
///
@@ -190,21 +190,21 @@
/// @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(gnash::Network::byte_t
*data, size_t size);
+ boost::shared_ptr<amf::Element> decodeMetaData(boost::uint8_t *data,
size_t size);
/// \brief Decode an Audio object.
///
/// @param flags The data to deserialize.
///
/// @return a smart pointer to an audio data structure that contains the
data.
- boost::shared_ptr<flv_audio_t> decodeAudioData(gnash::Network::byte_t
flags);
+ boost::shared_ptr<flv_audio_t> decodeAudioData(boost::uint8_t flags);
/// \brief Decode an Video object.
///
/// @param flags The data to deserialize.
///
/// @return a smart pointer to an video data structure that contains the
data.
- boost::shared_ptr<flv_video_t> decodeVideoData(gnash::Network::byte_t
flags);
+ boost::shared_ptr<flv_video_t> decodeVideoData(boost::uint8_t flags);
/// \brief Decode an MetaData object.
///
=== modified file 'libamf/lcshm.cpp'
--- a/libamf/lcshm.cpp 2008-11-21 13:05:13 +0000
+++ b/libamf/lcshm.cpp 2008-12-20 17:11:55 +0000
@@ -29,7 +29,7 @@
#include "log.h"
#include "buffer.h"
-#include "network.h"
+//#include "network.h"
#include "amf.h"
#include "shm.h"
#include "element.h"
@@ -101,7 +101,7 @@
/// \brief Construct an initialized shared memory segment.
///
/// @param addr The address to use for the memory segment.
-LcShm::LcShm(Network::byte_t *addr)
+LcShm::LcShm(boost::uint8_t *addr)
{
// GNASH_REPORT_FUNCTION;
_baseaddr = addr;
@@ -136,7 +136,7 @@
///
/// @param baseaddr The address to use for the block of
/// Listeners.
-Listener::Listener(Network::byte_t *x)
+Listener::Listener(boost::uint8_t *x)
{
// GNASH_REPORT_FUNCTION;
_baseaddr = x;
@@ -159,7 +159,7 @@
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *addr = _baseaddr + LC_LISTENERS_START;
+ boost::uint8_t *addr = _baseaddr + LC_LISTENERS_START;
char *item = reinterpret_cast<char *>(addr);
// Walk through the list to the end
while (*item != 0) {
@@ -182,7 +182,7 @@
{
GNASH_REPORT_FUNCTION;
- Network::byte_t *addr = _baseaddr + LC_LISTENERS_START;
+ boost::uint8_t *addr = _baseaddr + LC_LISTENERS_START;
char *item = reinterpret_cast<char *>(addr);
// Walk to the end of the list
while ((item[0] != 0) && (item[1] != 0)) {
@@ -231,7 +231,7 @@
{
GNASH_REPORT_FUNCTION;
- Network::byte_t *addr = _baseaddr + LC_LISTENERS_START;
+ boost::uint8_t *addr = _baseaddr + LC_LISTENERS_START;
int len = 0;
char *item = reinterpret_cast<char *>(addr);
@@ -263,7 +263,7 @@
// GNASH_REPORT_FUNCTION;
auto_ptr< vector<string> > listeners ( new vector<string> );
if (_baseaddr != 0) {
- Network::byte_t *addr = _baseaddr + LC_LISTENERS_START;
+ boost::uint8_t *addr = _baseaddr + LC_LISTENERS_START;
const char *item = reinterpret_cast<const char *>(addr);
while (*item != 0) {
@@ -318,11 +318,11 @@
/// @return A real pointer to the data after the headers has been parsed.
///
/// @remarks May throw a ParserException
-Network::byte_t *
-LcShm::parseHeader(Network::byte_t *data, Network::byte_t* tooFar)
+boost::uint8_t *
+LcShm::parseHeader(boost::uint8_t *data, boost::uint8_t* tooFar)
{
// GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = data;
+ boost::uint8_t *ptr = data;
if (data == 0) {
log_debug("No data pointer to parse!");
@@ -391,17 +391,17 @@
/// @param domain The domain the hostname is in.
///
/// @return A real pointer to a header for a memory segment.
-Network::byte_t *
+boost::uint8_t *
LcShm::formatHeader(const std::string &con, const std::string &host, bool /*
domain */ )
{
GNASH_REPORT_FUNCTION;
-// Network::byte_t *ptr = data + LC_HEADER_SIZE;
+// boost::uint8_t *ptr = data + LC_HEADER_SIZE;
int size = con.size() + host.size() + 9;
// Buffer *buf;
- Network::byte_t *header = new Network::byte_t[size + 1];
- Network::byte_t *ptr = header;
+ boost::uint8_t *header = new boost::uint8_t[size + 1];
+ boost::uint8_t *ptr = header;
// This is the initial 16 bytes of the header
memset(ptr, 0, size + 1);
@@ -523,13 +523,13 @@
// formatHeader(name, domainname, _object.domain);
// Update the connection name
- Network::byte_t *ptr = Listener::getBaseAddress();
- if (ptr == reinterpret_cast<Network::byte_t *>(0)) {
+ boost::uint8_t *ptr = Listener::getBaseAddress();
+ if (ptr == reinterpret_cast<boost::uint8_t *>(0)) {
log_error("base address not set!");
}
#if 0
-// Network::byte_t *tmp = AMF::encodeElement(name.c_str());
+// boost::uint8_t *tmp = AMF::encodeElement(name.c_str());
// memcpy(ptr, tmp, name.size());
// ptr += name.size() + AMF_HEADER_SIZE;
// delete[] tmp;
@@ -539,7 +539,7 @@
// ptr += domainname.size() + AMF_HEADER_SIZE;
// ptr += LC_HEADER_SIZE;
-// Network::byte_t *x = ptr; // just for debugging from gdb. temporary
+// boost::uint8_t *x = ptr; // just for debugging from gdb. temporary
// This is the initial 16 bytes of the header
memset(ptr, 0, LC_HEADER_SIZE + 200);
@@ -572,8 +572,8 @@
// ptr += AMF_BOOLEAN_SIZE;
- vector<Network::byte_t> *vec = AMF::encodeElement(data);
- vector<Network::byte_t>::iterator vit;
+ vector<boost::uint8_t> *vec = AMF::encodeElement(data);
+ vector<boost::uint8_t>::iterator vit;
// Can't do a memcpy with a std::vector
// log_debug("Number of bytes in the vector: %x", vec->size());
for (vit = vec->begin(); vit != vec->end(); vit++) {
=== modified file 'libamf/lcshm.h'
--- a/libamf/lcshm.h 2008-11-21 13:05:13 +0000
+++ b/libamf/lcshm.h 2008-12-20 17:11:55 +0000
@@ -18,10 +18,6 @@
#ifndef __LCSHM_H__
#define __LCSHM_H__
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>
#include <string>
@@ -52,7 +48,7 @@
///
/// @param baseaddr The address to use for the block of
/// Listeners.
- Listener(gnash::Network::byte_t *baseaddr);
+ Listener(boost::uint8_t *baseaddr);
/// \brief Delete the Listener block
~Listener();
@@ -92,13 +88,13 @@
/// @param addr The address for the block of Listeners.
///
/// @return nothing.
- void setBaseAddress(gnash::Network::byte_t *addr) { _baseaddr = addr; };
+ void setBaseAddress(boost::uint8_t *addr) { _baseaddr = addr; };
/// \brief Set the base address for the block of Listeners.
///
/// @return A real pointer to the base address of the block of
/// Listeners in the memory segment.
- gnash::Network::byte_t *getBaseAddress() { return _baseaddr; };
+ boost::uint8_t *getBaseAddress() { return _baseaddr; };
protected:
/// \var LcShm::_name
@@ -107,7 +103,7 @@
/// \var LcShm::_baseaddr
/// The base address of the block of Listeners.
- gnash::Network::byte_t *_baseaddr;
+ boost::uint8_t *_baseaddr;
// std::vector<std::string> _listeners;
};
@@ -152,7 +148,7 @@
/// \brief Construct an initialized shared memory segment.
///
/// @param baseaddr The address to use for the memory segment.
- LcShm(gnash::Network::byte_t *baseaddr);
+ LcShm(boost::uint8_t *baseaddr);
/// \brief Construct an initialized shared memory segment.
///
@@ -213,7 +209,7 @@
///
/// @return A vector of smart pointers to the AMF0 Elements in
/// this memopry segment.
- std::vector<boost::shared_ptr<amf::Element> >
parseBody(gnash::Network::byte_t *data);
+ std::vector<boost::shared_ptr<amf::Element> > parseBody(boost::uint8_t
*data);
/// \brief Parse the header of the memory segment.
///
@@ -225,7 +221,7 @@
/// @return A real pointer to the data after the headers has been parsed.
///
/// @remarks May throw a ParserException
- gnash::Network::byte_t *parseHeader(gnash::Network::byte_t *data,
gnash::Network::byte_t* tooFar);
+ boost::uint8_t *parseHeader(boost::uint8_t *data, boost::uint8_t* tooFar);
/// \brief Format the header for the memory segment.
///
@@ -236,7 +232,7 @@
/// @param domain The domain the hostname is in.
///
/// @return A real pointer to a header for a memory segment.
- gnash::Network::byte_t *formatHeader(const std::string &con, const
std::string &host, bool domain);
+ boost::uint8_t *formatHeader(const std::string &con, const std::string
&host, bool domain);
/// \brief Set the name for this connection to the memory segment.
///
@@ -272,7 +268,7 @@
/// @param addr The address to use for opening the memory segment.
///
/// @return nothing.
- void setBaseAddr(gnash::Network::byte_t *addr) { _baseaddr = addr; };
+ void setBaseAddr(boost::uint8_t *addr) { _baseaddr = addr; };
/// \brief Dump the internal data of this class in a human readable form.
/// @remarks This should only be used for debugging purposes.
@@ -281,7 +277,7 @@
private:
/// \var LcShm::_baseaddr.
/// The base address of the memory segment.
- gnash::Network::byte_t *_baseaddr;
+ boost::uint8_t *_baseaddr;
/// \var LcShm::_header
/// A stored copy of the header for the memory segment.
=== modified file 'libamf/sol.cpp'
--- a/libamf/sol.cpp 2008-12-09 15:57:34 +0000
+++ b/libamf/sol.cpp 2008-12-20 17:11:55 +0000
@@ -30,7 +30,7 @@
#include <fstream>
#include <cassert>
-#include "network.h"
+//#include "network.h"
#include "element.h"
#include "amf.h"
#include "buffer.h"
@@ -180,7 +180,7 @@
// so we swap it first.
boost::uint16_t swapped = SOL_MAGIC;
swapped = htons(swapped);
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(&swapped);
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(&swapped);
for (i=0; i<sizeof(boost::uint16_t); i++) {
_header.push_back(ptr[i]);
}
@@ -191,7 +191,7 @@
filesize += name.size() + 16;
boost::uint32_t len = filesize;
len = htonl(len);
- ptr = reinterpret_cast<Network::byte_t *>(&len);
+ ptr = reinterpret_cast<boost::uint8_t *>(&len);
for (i=0; i<sizeof(boost::uint32_t); i++) {
_header.push_back(ptr[i]);
}
@@ -207,7 +207,7 @@
// then the 0x0004 bytes, also a mystery
swapped = SOL_BLOCK_MARK;
swapped = htons(swapped);
- ptr = reinterpret_cast<Network::byte_t *>(&swapped);
+ ptr = reinterpret_cast<boost::uint8_t *>(&swapped);
for (i=0; i<sizeof(boost::uint16_t); i++) {
_header.push_back(ptr[i]);
}
@@ -221,12 +221,12 @@
// First the length in two bytes
swapped = name.size();
swapped = htons(swapped);
- ptr = reinterpret_cast<Network::byte_t *>(&swapped);
+ ptr = reinterpret_cast<boost::uint8_t *>(&swapped);
for (i=0; i<sizeof(boost::uint16_t); i++) {
_header.push_back(ptr[i]);
}
// then the string itself
- ptr = (Network::byte_t *)name.c_str();
+ ptr = (boost::uint8_t *)name.c_str();
for (i=0; i<name.size(); i++) {
_header.push_back(ptr[i]);
}
@@ -265,7 +265,7 @@
return false;
}
- vector<Network::byte_t>::iterator it;
+ vector<boost::uint8_t>::iterator it;
vector<boost::shared_ptr<amf::Element> >::iterator ita;
AMF amf_obj;
char *ptr;
@@ -289,7 +289,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);
- // Network::byte_t *var = amf_obj.encodeProperty(el, outsize);
+ // boost::uint8_t *var = amf_obj.encodeProperty(el, outsize);
if (!var) {
continue;
}
@@ -382,16 +382,16 @@
try {
- Network::byte_t *ptr = 0;
+ boost::uint8_t *ptr = 0;
ifstream ifs(filespec.c_str(), ios::binary);
_filesize = st.st_size;
- boost::scoped_array<Network::byte_t> buf(
- new Network::byte_t[_filesize + sizeof(int)]);
+ boost::scoped_array<boost::uint8_t> buf(
+ new boost::uint8_t[_filesize + sizeof(int)]);
ptr = buf.get();
- Network::byte_t* tooFar = buf.get() + _filesize;
+ boost::uint8_t* tooFar = buf.get() + _filesize;
bodysize = st.st_size - 6;
_filespec = filespec;
=== modified file 'libamf/sol.h'
--- a/libamf/sol.h 2008-12-09 15:57:34 +0000
+++ b/libamf/sol.h 2008-12-20 17:11:55 +0000
@@ -18,17 +18,11 @@
#ifndef GNASH_SOL_H
#define GNASH_SOL_H
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
#include <boost/cstdint.hpp>
#include <string>
#include <vector>
#include "dsodefs.h" //DSOEXPORT
-#include "network.h"
-//#include "element.h"
#include "amf.h"
// It comprises of a magic number, followed by the file length, a
@@ -74,7 +68,7 @@
/// .sol file data.
///
/// @return true if this succeeded. false if it doesn't.
- bool extractHeader(const std::vector<gnash::Network::byte_t> &data);
+ bool extractHeader(const std::vector<boost::uint8_t> &data);
/// \brief Extract the header from the file.
///
@@ -89,7 +83,7 @@
/// .sol file data.
///
/// @return true if this succeeded. false if it doesn't.
- bool formatHeader(const std::vector<gnash::Network::byte_t> &data);
+ bool formatHeader(const std::vector<boost::uint8_t> &data);
/// \brief Create the file header.
///
@@ -131,7 +125,7 @@
/// \brief Get the stored copy of the header
///
/// @return A vector of raw bytes that is a binary form of the header.
- std::vector<gnash::Network::byte_t> getHeader() { return _header; };
+ std::vector<boost::uint8_t> getHeader() { return _header; };
/// \brief Add the AMF objects that are the data of the file
//
@@ -193,11 +187,11 @@
private:
/// \var SOL::_header
/// A stored copy of the SOL file header.
- std::vector<gnash::Network::byte_t> _header;
+ std::vector<boost::uint8_t> _header;
/// \var SOL::_data
/// The vector that contains the raw dats for this .sol
file.
- std::vector<gnash::Network::byte_t> _data;
+ std::vector<boost::uint8_t> _data;
/// \var SOL::_objname
/// The name of the SharedObject in the .sol file.
=== modified file 'libcore/asobj/SharedObject.cpp'
--- a/libcore/asobj/SharedObject.cpp 2008-12-15 12:29:59 +0000
+++ b/libcore/asobj/SharedObject.cpp 2008-12-20 17:11:55 +0000
@@ -26,6 +26,13 @@
#include <boost/tokenizer.hpp>
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
+#if !defined(HAVE_WINSOCK_H) || defined(__OS2__)
+# include <sys/types.h>
+# include <arpa/inet.h>
+#else
+# include <windows.h>
+# include <io.h>
+#endif
#include "SimpleBuffer.h"
#include "as_value.h"
=== modified file 'libmedia/FLVParser.cpp'
--- a/libmedia/FLVParser.cpp 2008-11-18 11:59:41 +0000
+++ b/libmedia/FLVParser.cpp 2008-12-20 17:11:55 +0000
@@ -35,6 +35,13 @@
#include <string>
#include <iosfwd>
+#if !defined(HAVE_WINSOCK_H) || defined(__OS2__)
+# include <sys/types.h>
+# include <arpa/inet.h>
+#else
+# include <windows.h>
+# include <io.h>
+#endif
using namespace std;
=== modified file 'libnet/cque.cpp'
--- a/libnet/cque.cpp 2008-11-19 10:09:12 +0000
+++ b/libnet/cque.cpp 2008-12-20 17:11:55 +0000
@@ -105,7 +105,7 @@
// Push data
bool
-CQue::push(gnash::Network::byte_t *data, int nbytes)
+CQue::push(boost::uint8_t *data, int nbytes)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<amf::Buffer> buf(new amf::Buffer);
@@ -211,7 +211,7 @@
for (que_t::iterator e=_que.end(); to!=e; ++to) {
size_t sz = (*to)->size();
totalsize += sz;
- if (sz < gnash::NETBUFSIZE) break;
+ if (sz < amf::NETBUFSIZE) break;
}
if (to == _que.end()) {
// Didn't find an element ending the merge
@@ -220,7 +220,7 @@
// Merge all elements in a single buffer. We have totalsize now.
boost::shared_ptr<amf::Buffer> newbuf(new Buffer(totalsize));
- Network::byte_t *tmp = newbuf->reference();
+ boost::uint8_t *tmp = newbuf->reference();
++to;
for (que_t::iterator i=from; i!=to; ++i) {
boost::shared_ptr<amf::Buffer> buf = *i;
=== modified file 'libnet/cque.h'
--- a/libnet/cque.h 2008-11-01 14:59:07 +0000
+++ b/libnet/cque.h 2008-12-20 17:11:55 +0000
@@ -48,7 +48,7 @@
CQue(const std::string &str) { _name = str; };
~CQue();
// Push data onto the que
- bool push(gnash::Network::byte_t *data, int nbytes);
+ bool push(boost::uint8_t *data, int nbytes);
bool push(boost::shared_ptr<amf::Buffer> data);
// Pop the first date element off the que
boost::shared_ptr<amf::Buffer> pop();
=== modified file 'libnet/handler.cpp'
--- a/libnet/handler.cpp 2008-12-15 03:44:46 +0000
+++ b/libnet/handler.cpp 2008-12-20 17:11:55 +0000
@@ -85,7 +85,7 @@
// Push bytes on the outgoing FIFO
bool
-Handler::push(gnash::Network::byte_t *data, int nbytes, fifo_e direction)
+Handler::push(boost::uint8_t *data, int nbytes, fifo_e direction)
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<amf::Buffer> ptr(new amf::Buffer);
=== modified file 'libnet/handler.h'
--- a/libnet/handler.h 2008-12-15 03:44:46 +0000
+++ b/libnet/handler.h 2008-12-20 17:11:55 +0000
@@ -73,16 +73,16 @@
bool push(boost::shared_ptr<amf::Buffer> data)
{ return _incoming.push(data); };
bool push(boost::shared_ptr<amf::Buffer> data, fifo_e direction);
- bool push(gnash::Network::byte_t *data, int nbytes, fifo_e direction);
- bool push(gnash::Network::byte_t *data, int nbytes)
+ bool push(boost::uint8_t *data, int nbytes, fifo_e direction);
+ bool push(boost::uint8_t *data, int nbytes)
{ return _incoming.push(data, nbytes); };
- bool pushin(gnash::Network::byte_t *data, int nbytes)
+ bool pushin(boost::uint8_t *data, int nbytes)
{ return _incoming.push(data, nbytes); };
bool pushin(boost::shared_ptr<amf::Buffer> data)
{ return _incoming.push(data); };
#if 0
// Push bytes on the incoming FIFO, which must be specified
- bool pushout(gnash::Network::byte_t *data, int nbytes)
+ bool pushout(boost::uint8_t *data, int nbytes)
{ return _outgoing.push(data, nbytes); };
bool pushout(boost::shared_ptr<amf::Buffer> data)
{ return _outgoing.push(data); };
=== modified file 'libnet/http.cpp'
--- a/libnet/http.cpp 2008-12-18 18:48:48 +0000
+++ b/libnet/http.cpp 2008-12-20 17:11:55 +0000
@@ -188,7 +188,7 @@
{
GNASH_REPORT_FUNCTION;
-// Network::byte_t buffer[readsize+1];
+// boost::uint8_t buffer[readsize+1];
// const char *ptr = reinterpret_cast<const char *>(buffer);
// memset(buffer, 0, readsize+1);
@@ -307,12 +307,12 @@
return false;
}
clearHeader();
-// gnash::Network::byte_t *data = processHeaderFields(*buf);
+// boost::uint8_t *data = processHeaderFields(*buf);
processHeaderFields(*buf);
size_t length = strtol(getField("content-length").c_str(), NULL, 0);
amf::Buffer content (length);
cerr << __PRETTY_FUNCTION__ << " : " << content.size() << endl;
- int ret = readNet(fd, content, 5);
+ int ret = readNet(fd, content, 1);
// cerr << __PRETTY_FUNCTION__ << " : " << ret << " : " << (char
*)content->reference() << endl;
if (getField("content-type") == "application/x-www-form-urlencoded") {
@@ -324,9 +324,12 @@
// oh boy, we got ourselves some encoded AMF objects instead of a
boring file.
} else if (getField("content-type") == "application/x-amf") {
log_debug("Got AMF data in POST");
+#if 0
amf::AMF amf;
boost::shared_ptr<amf::Element> el =
amf.extractAMF(content.reference(), content.end());
- el->dump(); // FIXME: do something intelligent with this
Element
+ el->dump(); // FIXME: do something intelligent
+ // with this Element
+#endif
}
// Send the reply
@@ -337,10 +340,22 @@
&& (getField("content-type") == "application/x-amf")) {
// const char *num = (const char *)buf->at(10);
log_debug("Got CGI echo request in POST");
-// cerr << hexify(content.reference(), content.allocated(), true) << endl;
- amf::Buffer &reply = formatEchoResponse("1", content); // FIXME:
- writeNet(fd, reply);
- } else {
+ cerr << 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];
+ if (headers.size() > 0) {
+// el0->dump();
+// headers[1]->dump();
+// headers[2]->dump();
+// headers[3]->dump();
+ cerr << "FIXME 3: " << headers[0]->getName() << endl;
+ amf::Buffer &reply = formatEchoResponse(el0->getName(),
*headers[3]);
+// writeNet(fd, reply);
+ }
+// } else {
amf::Buffer &reply = formatHeader(_filetype, _filesize, HTTP::OK);
writeNet(fd, reply);
}
@@ -480,7 +495,7 @@
return false;
}
-gnash::Network::byte_t *
+boost::uint8_t *
HTTP::processHeaderFields(amf::Buffer &buf)
{
// GNASH_REPORT_FUNCTION;
@@ -532,8 +547,8 @@
// cerr << "FIXME: " << (void *)i << " : " << dec << end << endl;
} else {
- const gnash::Network::byte_t *cmd = reinterpret_cast<const
gnash::Network::byte_t *>(i->c_str());
- if (extractCommand(const_cast<gnash::Network::byte_t *>(cmd)) ==
HTTP::HTTP_NONE) {
+ const boost::uint8_t *cmd = reinterpret_cast<const boost::uint8_t
*>(i->c_str());
+ if (extractCommand(const_cast<boost::uint8_t *>(cmd)) ==
HTTP::HTTP_NONE) {
break;
} else {
log_debug("Got a request, parsing \"%s\"", *i);
@@ -1013,7 +1028,7 @@
formatHeader(size, code);
// int ret = Network::writeNet(_header.str());
-// Network::byte_t *ptr = (Network::byte_t *)_body.str().c_str();
+// boost::uint8_t *ptr = (boost::uint8_t *)_body.str().c_str();
// buf->copy(ptr, _body.str().size());
// _handler->dump();
@@ -1100,6 +1115,7 @@
boost::shared_ptr<amf::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);
headers.push_back(el4);
@@ -1130,7 +1146,7 @@
{
GNASH_REPORT_FUNCTION;
- Network::byte_t *tmpptr = data;
+ boost::uint8_t *tmpptr = data;
// FIXME: temporary hacks while debugging
amf::Buffer fixme("00 00 00 00 00 01");
@@ -1207,7 +1223,7 @@
/// <index>
/// is a consecutive number that seems to be used to detect missing packages
HTTP::rtmpt_cmd_e
-HTTP::extractRTMPT(gnash::Network::byte_t *data)
+HTTP::extractRTMPT(boost::uint8_t *data)
{
GNASH_REPORT_FUNCTION;
@@ -1261,7 +1277,7 @@
}
HTTP::http_method_e
-HTTP::extractCommand(gnash::Network::byte_t *data)
+HTTP::extractCommand(boost::uint8_t *data)
{
// GNASH_REPORT_FUNCTION;
@@ -1294,8 +1310,8 @@
// For valid requests, the second argument, delimited by spaces is the
filespec
// of the file being requested or transmitted.
if (cmd != HTTP::HTTP_NONE) {
- Network::byte_t *start = std::find(data, data+7, ' ') + 1;
- Network::byte_t *end = std::find(start + 2, data+PATH_MAX, ' ');
+ boost::uint8_t *start = std::find(data, data+7, ' ') + 1;
+ boost::uint8_t *end = std::find(start + 2, data+PATH_MAX, ' ');
// FIXME: there has got to be a way to copy into a string that actually
works.
char path[(end-start) + 1];
memset(path, 0, (end-start) + 1);
@@ -1346,7 +1362,7 @@
///
/// @return The number of bytes sent
int DSOEXPORT
-HTTP::sendMsg(const Network::byte_t *data, size_t size)
+HTTP::sendMsg(const boost::uint8_t *data, size_t size)
{
GNASH_REPORT_FUNCTION;
// _header
@@ -1383,7 +1399,7 @@
if (ret > 0) {
buf->setSeekPointer(buf->reference() + ret);
// cerr << "XXXXX: " << (char *)buf->reference() << endl;
- if (ret < static_cast<int>(NETBUFSIZE)) {
+ if (ret < static_cast<int>(amf::NETBUFSIZE)) {
// buf->resize(ret); FIXME: why does this corrupt
// the buffer ?
_que.push(buf);
=== modified file 'libnet/http.h'
--- a/libnet/http.h 2008-12-18 18:48:48 +0000
+++ b/libnet/http.h 2008-12-20 17:11:55 +0000
@@ -147,7 +147,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.
- gnash::Network::byte_t *processHeaderFields(amf::Buffer &buf);
+ boost::uint8_t *processHeaderFields(amf::Buffer &buf);
// Get the field for header 'name' that was stored by processHeaderFields()
std::string &getField(const std::string &name) { return _fields[name]; };
@@ -170,13 +170,13 @@
// 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(gnash::Network::byte_t *data);
+ rtmpt_cmd_e extractRTMPT(boost::uint8_t *data);
rtmpt_cmd_e extractRTMPT(amf::Buffer &data)
{ return extractRTMPT(data.reference()); };
// Examine the beginning of the data for an HTTP request command
// like GET or POST, etc...
- http_method_e extractCommand(gnash::Network::byte_t *data);
+ http_method_e extractCommand(boost::uint8_t *data);
http_method_e extractCommand(amf::Buffer &data)
{ return extractCommand(data.reference()); };
@@ -248,7 +248,7 @@
amf::Buffer &formatErrorResponse(http_status_e err);
// Return the header that's been built up.
- Network::byte_t *getHeader() { return _buffer.reference(); };
+ boost::uint8_t *getHeader() { return _buffer.reference(); };
// Return the header that's been built up.
amf::Buffer &getBuffer() { return _buffer; };
@@ -281,11 +281,11 @@
/// @return The number of bytes sent
int DSOEXPORT sendMsg();
int DSOEXPORT sendMsg(int fd);
- int DSOEXPORT sendMsg(const Network::byte_t *data, size_t size);
+ int DSOEXPORT sendMsg(const boost::uint8_t *data, size_t size);
int DSOEXPORT sendMsg(boost::shared_ptr<amf::Buffer> &buf)
{ return sendMsg(buf->reference(), buf->size()); };
int DSOEXPORT sendMsg(std::stringstream &sstr)
- { return sendMsg(reinterpret_cast<const Network::byte_t
*>(sstr.str().c_str()), sstr.str().size()); };
+ { return sendMsg(reinterpret_cast<const boost::uint8_t
*>(sstr.str().c_str()), sstr.str().size()); };
// These accessors are used mostly just for debugging.
bool keepAlive() { return _keepalive; }
=== modified file 'libnet/network.h'
--- a/libnet/network.h 2008-12-18 00:07:18 +0000
+++ b/libnet/network.h 2008-12-20 17:11:55 +0000
@@ -78,9 +78,6 @@
typedef int socklen_t;
#endif
-// Adjust for the constant size
-const size_t NETBUFSIZE = 1448; // 1500 appears to be the default size
as used by FMS
-//const size_t NETBUFSIZE = 1357*2; // 1500 appears to be the default size
as used by FMS
/// \class Network
/// This is a low level network class for Gnash and Cygnal. This
=== modified file 'libnet/rtmp.cpp'
--- a/libnet/rtmp.cpp 2008-11-21 21:09:15 +0000
+++ b/libnet/rtmp.cpp 2008-12-20 17:11:55 +0000
@@ -146,7 +146,7 @@
};
int
-RTMP::headerSize(Network::byte_t header)
+RTMP::headerSize(boost::uint8_t header)
{
// GNASH_REPORT_FUNCTION;
@@ -249,11 +249,11 @@
}
RTMP::rtmp_head_t *
-RTMP::decodeHeader(Network::byte_t *in)
+RTMP::decodeHeader(boost::uint8_t *in)
{
GNASH_REPORT_FUNCTION;
- Network::byte_t *tmpptr = in;
+ boost::uint8_t *tmpptr = in;
_header.channel = *tmpptr & RTMP_INDEX_MASK;
log_debug (_("The AMF channel index is %d"), _header.channel);
@@ -278,7 +278,7 @@
}
if (_header.head_size >= 8) {
- Network::byte_t byte = *tmpptr;
+ boost::uint8_t byte = *tmpptr;
_header.type = (content_types_e)byte;
tmpptr++;
if (_header.type <= RTMP::INVOKE ) {
@@ -340,7 +340,7 @@
{
// GNASH_REPORT_FUNCTION;
boost::shared_ptr<amf::Buffer> buf(new Buffer(1));
- Network::byte_t *ptr = buf->reference();
+ boost::uint8_t *ptr = buf->reference();
// Make the channel index & header size byte
*ptr = head_size & RTMP_HEADSIZE_MASK;
@@ -375,7 +375,7 @@
// FIXME: this is only to make this more readeable with GDB, and is a
performance hit.
buf->clear();
- Network::byte_t *ptr = buf->reference();
+ boost::uint8_t *ptr = buf->reference();
// Make the channel index & header size byte
// *ptr = head_size & RTMP_HEADSIZE_MASK;
@@ -419,8 +419,8 @@
// int packetsize = 0;
size_t amf_index, headersize;
- Network::byte_t *ptr = buf->reference();
- Network::byte_t *tooFar = ptr+buf->size();
+ boost::uint8_t *ptr = buf->reference();
+ boost::uint8_t *tooFar = ptr+buf->size();
AMF amf;
amf_index = *buf->reference() & RTMP_INDEX_MASK;
@@ -439,9 +439,9 @@
// }
#if 1
- Network::byte_t *end = buf->remove(0xc3);
+ boost::uint8_t *end = buf->remove(0xc3);
#else
- Network::byte_t *end = buf->find(0xc3);
+ boost::uint8_t *end = buf->find(0xc3);
log_debug("END is %x", (void *)end);
*end = '*';
#endif
@@ -528,11 +528,11 @@
// This seems to be a ping message, 12 byte header, system channel 2
// 02 00 00 00 00 00 06 04 00 00 00 00 00 00 00 00 00 00
RTMP::rtmp_ping_t *
-RTMP::decodePing(Network::byte_t *data)
+RTMP::decodePing(boost::uint8_t *data)
{
GNASH_REPORT_FUNCTION;
- Network::byte_t *ptr = reinterpret_cast<Network::byte_t *>(data);
+ boost::uint8_t *ptr = reinterpret_cast<boost::uint8_t *>(data);
rtmp_ping_t *ping = new rtmp_ping_t;
memset(ping, 0, sizeof(rtmp_ping_t));
@@ -600,12 +600,12 @@
// address@hidden
// 43 00 00 00 00 00 15 14 02 00 08 6f 6e 42 57 44 6f 6e 65 00 40 00 00 00 00
00 00 00 05
RTMPMsg *
-RTMP::decodeMsgBody(Network::byte_t *data, size_t size)
+RTMP::decodeMsgBody(boost::uint8_t *data, size_t size)
{
GNASH_REPORT_FUNCTION;
AMF amf_obj;
- Network::byte_t *ptr = data;
- Network::byte_t* tooFar = ptr + size;
+ boost::uint8_t *ptr = data;
+ boost::uint8_t* tooFar = ptr + size;
bool status = false;
// The first data object is the method name of this object.
@@ -816,7 +816,7 @@
size_t partial = RTMP_VIDEO_PACKET_SIZE;
size_t nbytes = 0;
- Network::byte_t header = 0xc3;
+ boost::uint8_t header = 0xc3;
while (nbytes <= data->size()) {
if ((data->size() - nbytes) < static_cast<signed
int>(RTMP_VIDEO_PACKET_SIZE)) {
@@ -852,7 +852,7 @@
RTMP::rtmp_head_t *rthead = 0;
RTMPMsg *msg = 0;
boost::shared_ptr<amf::Buffer> buf;
- Network::byte_t *ptr = 0;
+ boost::uint8_t *ptr = 0;
buf = recvMsg(1); // use a 1 second timeout
@@ -1043,7 +1043,7 @@
}
// split the buffer at the chunksize boundary
- Network::byte_t *ptr = 0;
+ boost::uint8_t *ptr = 0;
rtmp_head_t *rthead = 0;
size_t pktsize = 0;
size_t nbytes = 0;
=== modified file 'libnet/rtmp.h'
--- a/libnet/rtmp.h 2008-09-22 22:56:11 +0000
+++ b/libnet/rtmp.h 2008-12-20 17:11:55 +0000
@@ -34,7 +34,7 @@
namespace gnash
{
-const Network::byte_t RTMP_HANDSHAKE = 0x3;
+const boost::uint8_t RTMP_HANDSHAKE = 0x3;
const int RTMP_BODY_SIZE = 1536;
const int MAX_AMF_INDEXES = 64;
@@ -63,8 +63,8 @@
// The third and fourth bytes form an integer value that specifies the
// number of headers.
typedef struct {
- gnash::Network::byte_t version;
- gnash::Network::byte_t source;
+ boost::uint8_t version;
+ boost::uint8_t source;
boost::uint32_t count;
} amfpacket_t;
@@ -211,7 +211,7 @@
virtual ~RTMP();
// Decode
- rtmp_head_t *decodeHeader(gnash::Network::byte_t *header);
+ rtmp_head_t *decodeHeader(boost::uint8_t *header);
rtmp_head_t *decodeHeader(boost::shared_ptr<amf::Buffer> data);
boost::shared_ptr<amf::Buffer> encodeHeader(int amf_index,
rtmp_headersize_e head_size,
size_t total_size, content_types_e type,
RTMPMsg::rtmp_source_e routing);
@@ -225,7 +225,7 @@
void addProperty(std::string &name, boost::shared_ptr<amf::Element> el);
boost::shared_ptr<amf::Element> getProperty(const std::string &name);
void setHandler(Handler *hand) { _handler = hand; };
- int headerSize(gnash::Network::byte_t header);
+ int headerSize(boost::uint8_t header);
rtmp_head_t *getHeader() { return &_header; };
int getHeaderSize() { return _header.head_size; };
@@ -236,10 +236,10 @@
int getMysteryWord() { return _mystery_word; };
// Decode an RTMP message
- RTMPMsg *decodeMsgBody(Network::byte_t *data, size_t size);
+ RTMPMsg *decodeMsgBody(boost::uint8_t *data, size_t size);
RTMPMsg *decodeMsgBody(boost::shared_ptr<amf::Buffer> buf);
- virtual rtmp_ping_t *decodePing(Network::byte_t *data);
+ virtual rtmp_ping_t *decodePing(boost::uint8_t *data);
rtmp_ping_t *decodePing(boost::shared_ptr<amf::Buffer> buf);
// These are handlers for the various types
=== modified file 'libnet/rtmp_client.cpp'
--- a/libnet/rtmp_client.cpp 2008-11-29 01:40:58 +0000
+++ b/libnet/rtmp_client.cpp 2008-12-20 17:11:55 +0000
@@ -339,7 +339,7 @@
// Since we don't know what the format is, create a pattern we can
// recognize if we stumble across it later on.
for (int i=0; i<RTMP_BODY_SIZE; i++) {
- Network::byte_t pad = i^256;
+ boost::uint8_t pad = i^256;
*_handshake += pad;
}
=== modified file 'libnet/rtmp_msg.h'
--- a/libnet/rtmp_msg.h 2008-09-22 22:56:11 +0000
+++ b/libnet/rtmp_msg.h 2008-12-20 17:11:55 +0000
@@ -103,8 +103,8 @@
void setStatus(rtmp_status_e st) { _status = st; };
rtmp_status_e getStatus() { return _status; };
- void setChannel(Network::byte_t num) { _channel = num; };
- Network::byte_t getChannel() { return _channel; } ;
+ void setChannel(boost::uint8_t num) { _channel = num; };
+ boost::uint8_t getChannel() { return _channel; } ;
boost::shared_ptr<amf::Element> operator[](size_t x);
@@ -117,7 +117,7 @@
std::string _method;
double _streamid;
std::vector<boost::shared_ptr<amf::Element> > _amfobjs;
- Network::byte_t _channel;
+ boost::uint8_t _channel;
};
} // end of gnash namespace
=== modified file 'libnet/rtmp_server.cpp'
--- a/libnet/rtmp_server.cpp 2008-12-15 03:46:09 +0000
+++ b/libnet/rtmp_server.cpp 2008-12-20 17:11:55 +0000
@@ -185,7 +185,7 @@
GNASH_REPORT_FUNCTION;
unsigned int amf_index, headersize;
- Network::byte_t *ptr = buf->reference();
+ boost::uint8_t *ptr = buf->reference();
AMF amf;
if (buf->reference() == 0) {
@@ -208,16 +208,16 @@
// }
// #if 1
-// Network::byte_t *end = buf->remove(0xc3);
+// boost::uint8_t *end = buf->remove(0xc3);
// #else
-// Network::byte_t *end = buf->find(0xc3);
+// boost::uint8_t *end = buf->find(0xc3);
// log_debug("END is %x", (void *)end);
// *end = '*';
// #endif
decodeHeader(ptr);
ptr += headersize;
- Network::byte_t* tooFar = ptr+300+sizeof(int); // FIXME:
+ boost::uint8_t* tooFar = ptr+300+sizeof(int); // FIXME:
AMF amf_obj;
boost::shared_ptr<amf::Element> el1 = amf_obj.extractAMF(ptr, tooFar);
@@ -369,7 +369,7 @@
GNASH_REPORT_FUNCTION;
// Buffer *buf = new Buffer;
-// Network::byte_t *ptr = buf->reference();
+// boost::uint8_t *ptr = buf->reference();
// buf->clear(); // default everything to zeros, real data gets
optionally added.
// ptr += sizeof(boost::uint16_t); // go past the first short
// const char *capabilities = 0;
@@ -491,7 +491,7 @@
boost::shared_ptr<amf::Buffer> buf(new Buffer(strbuf->size() +
numbuf->size() + topbuf->size()));
*buf += strbuf;
*buf += numbuf;
- Network::byte_t byte = static_cast<Network::byte_t>(RTMP::SERVER &
0x000000ff);
+ boost::uint8_t byte = static_cast<boost::uint8_t>(RTMP::SERVER &
0x000000ff);
*buf += byte;
*buf += topbuf;
@@ -617,7 +617,7 @@
{
GNASH_REPORT_FUNCTION;
boost::shared_ptr<amf::Buffer> buf(new Buffer(sizeof(boost::uint16_t) *
3));
- Network::byte_t *ptr = buf->reference();
+ boost::uint8_t *ptr = buf->reference();
buf->clear(); // default everything to zeros, real data gets
optionally added.
boost::uint16_t typefield = htons(type);
@@ -636,7 +636,7 @@
ptr += sizeof(boost::uint16_t); // go past the second short
swapped = milliseconds;
swapBytes(&swapped, sizeof(boost::uint32_t));
- buf->append((Network::byte_t *)&swapped, sizeof(boost::uint32_t));
+ buf->append((boost::uint8_t *)&swapped, sizeof(boost::uint32_t));
break;
}
// reset doesn't have any parameters
@@ -649,7 +649,7 @@
// swapped = htonl(milliseconds);
swapped = milliseconds;
swapBytes(&swapped, sizeof(boost::uint32_t));
- buf->append((Network::byte_t *)&swapped, sizeof(boost::uint32_t));
+ buf->append((boost::uint8_t *)&swapped, sizeof(boost::uint32_t));
break;
}
default:
=== modified file 'utilities/flvdumper.cpp'
--- a/utilities/flvdumper.cpp 2008-10-25 17:25:58 +0000
+++ b/utilities/flvdumper.cpp 2008-12-20 17:11:55 +0000
@@ -27,6 +27,13 @@
#include <string>
#include <vector>
#include <sys/stat.h>
+#if !defined(HAVE_WINSOCK_H) || defined(__OS2__)
+# include <sys/types.h>
+# include <arpa/inet.h>
+#else
+# include <windows.h>
+# include <io.h>
+#endif
#ifdef ENABLE_NLS
# include <locale>
@@ -172,8 +179,8 @@
Flv flv;
struct stat st;
- Network::byte_t *buf = 0;
- Network::byte_t *ptr = 0;
+ boost::uint8_t *buf = 0;
+ boost::uint8_t *ptr = 0;
// boost::shared_ptr<Flv::flv_header_t> head;
Flv::previous_size_t previous = 0;
boost::shared_ptr<Flv::flv_tag_t> tag;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/rtmp r9863: switch to boost::uint8_t from Network::byte_t.,
rob <=