#include <lcshm.h>
Classes | |
struct | lc_header_t |
struct | lc_message_t |
struct | lc_object_t |
Public Member Functions | |
LcShm () | |
Construct an uninitialized shared memory segment. | |
~LcShm () | |
Delete the shared memory segment. | |
LcShm (boost::uint8_t *baseaddr) | |
Construct an initialized shared memory segment. | |
LcShm (key_t key) | |
Construct an initialized shared memory segment. | |
bool | connect (const std::string &name) |
Connect to a memory segment. | |
bool | connect (key_t key) |
Connect to a memory segment. | |
void | close (void) |
Close a memory segment. This closes the shared memory segment, but the data remains until the next reboot of the computer. | |
void | send (const std::string &name, const std::string &dataname, std::vector< cygnal::Element * > &data) |
Put data in the memory segment This puts data into the memory segment. | |
void | recv (std::string &name, std::string &dataname, boost::shared_ptr< cygnal::Element > data) |
Read the date from the memory. | |
std::vector< boost::shared_ptr < cygnal::Element > > | parseBody (boost::uint8_t *data) |
Parse the body of a memory segment. | |
boost::uint8_t * | parseHeader (boost::uint8_t *data, boost::uint8_t *tooFar) |
Parse the header of the memory segment. | |
boost::uint8_t * | formatHeader (const std::string &con, const std::string &host, bool domain) |
Format the header for the memory segment. | |
void | addConnectionName (std::string &name) |
Set the name for this connection to the memory segment. | |
void | addHostname (std::string &name) |
Set the hostname used for this connection to the memory segment. | |
void | addObject (boost::shared_ptr< cygnal::Element > el) |
Add an AMF0 Element array of data for this memory segment. | |
size_t | size () |
Get the number of AMF0 Elements stored in this class. | |
std::vector< boost::shared_ptr < cygnal::Element > > | getElements () |
Get the array of AMF0 objects stored by this class. | |
void | setBaseAddr (boost::uint8_t *addr) |
Set the base address to be used for the memory segment. | |
void | dump () |
Dump the internal data of this class in a human readable form. | |
void | setconnected (bool trueorfalse) |
bool | getconnected () |
This class is formanipulating the LocalConnection memory segment.
cygnal::LcShm::LcShm | ( | ) |
Construct an uninitialized shared memory segment.
Construct an uninitialized shared memory segment. Open a connection between two SWF movies so they can send each other Flash Objects, but does not initialize the memory segment.
cygnal::LcShm::~LcShm | ( | ) |
Delete the shared memory segment.
cygnal::LcShm::LcShm | ( | boost::uint8_t * | addr | ) |
Construct an initialized shared memory segment.
baseaddr | The address to use for the memory segment. | |
addr | The address to use for the memory segment. |
cygnal::LcShm::LcShm | ( | key_t | key | ) |
Construct an initialized shared memory segment.
key | The SYSV style key to use for the memory segment. |
void cygnal::LcShm::addConnectionName | ( | std::string & | name | ) |
Set the name for this connection to the memory segment.
name | The name for this connection. |
void cygnal::LcShm::addHostname | ( | std::string & | name | ) |
Set the hostname used for this connection to the memory segment.
name | The hostname for this connection, often "localhost". |
void cygnal::LcShm::addObject | ( | boost::shared_ptr< cygnal::Element > | el | ) | [inline] |
Add an AMF0 Element array of data for this memory segment.
void cygnal::LcShm::close | ( | void | ) |
Close a memory segment. This closes the shared memory segment, but the data remains until the next reboot of the computer.
bool cygnal::LcShm::connect | ( | key_t | key | ) |
Connect to a memory segment.
key | The SYSV style key for the shared memory segment, which is the default type used. |
References gnash::SharedMem::begin(), gnash::SharedMem::end(), parseHeader(), and cygnal::Listener::setBaseAddress().
bool cygnal::LcShm::connect | ( | const std::string & | name | ) |
Connect to a memory segment.
name | The name to use for POSIX shared memory, which is not the default type used. |
void cygnal::LcShm::dump | ( | ) |
Dump the internal data of this class in a human readable form.
Read the date from the memory.
dataname | The name of the data to read. | |
data | A vector of smart pointers to the AMF0 Elements in this memory segment. |
References _object, and cygnal::Listener::listListeners().
boost::uint8_t * cygnal::LcShm::formatHeader | ( | const std::string & | con, | |
const std::string & | host, | |||
bool | domain | |||
) |
Format the header for the memory segment.
con | The name of the connection. | |
host | The bostname of the connection, often "localhost" | |
domain | The domain the hostname is in. |
con | The name of the connection. | |
host | The hostname of the connection, often "localhost" | |
domain | The domain the hostname is in. |
References cygnal::AMF::encodeString(), cygnal::Listener::getBaseAddress(), cygnal::LC_HEADER_SIZE, and size().
bool cygnal::LcShm::getconnected | ( | ) | [inline] |
std::vector<boost::shared_ptr<cygnal::Element> > cygnal::LcShm::getElements | ( | ) | [inline] |
Get the array of AMF0 objects stored by this class.
std::vector<boost::shared_ptr<cygnal::Element> > cygnal::LcShm::parseBody | ( | boost::uint8_t * | data | ) |
Parse the body of a memory segment.
data | The real pointer to the address to start parsing from. |
boost::uint8_t * cygnal::LcShm::parseHeader | ( | boost::uint8_t * | data, | |
boost::uint8_t * | tooFar | |||
) |
Parse the header of the memory segment.
data | real pointer to start parsing from. | |
tooFar | A pointer to one-byte-past the last valid memory address within the buffer. |
data | real pointer to start parsing from. | |
tooFar | A pointer to one-byte-past the last valid memory address within the buffer. |
References cygnal::LcShm::lc_object_t::connection_name, ENSUREBYTES, cygnal::AMF::extractAMF(), cygnal::LcShm::lc_object_t::hostname, and cygnal::LC_HEADER_SIZE.
Referenced by connect().
void cygnal::LcShm::recv | ( | std::string & | name, | |
std::string & | dataname, | |||
boost::shared_ptr< cygnal::Element > | data | |||
) |
Read the date from the memory.
dataname | The name of the data to read. | |
data | A vector of smart pointers to the AMF0 Elements in this memory segment. |
void cygnal::LcShm::send | ( | const std::string & | name, | |
const std::string & | dataname, | |||
std::vector< cygnal::Element * > & | data | |||
) |
Put data in the memory segment This puts data into the memory segment.
name | The connection name for this connection | |
dataname | The name of the data to send. | |
data | A vector of smart pointers to the AMF0 Elements containing the data for this memory segment. |
void cygnal::LcShm::setBaseAddr | ( | boost::uint8_t * | addr | ) | [inline] |
Set the base address to be used for the memory segment.
addr | The address to use for opening the memory segment. |
void cygnal::LcShm::setconnected | ( | bool | trueorfalse | ) | [inline] |
size_t cygnal::LcShm::size | ( | ) | [inline] |
Get the number of AMF0 Elements stored in this class.
Referenced by formatHeader().