pion::platform::Protocol Class Reference

#include <Protocol.hpp>

Inherits pion::platform::PlatformPlugin.

List of all members.


Detailed Description

Protocol: used to encode and decode Events using a particular format

Definition at line 43 of file Protocol.hpp.

Public Member Functions

 Protocol (void)
 constructs a new Protocol object
virtual ~Protocol ()
 virtual destructor: this class is meant to be extended
virtual void reset (void)=0
 resets the Protocol to its initial state
virtual boost::shared_ptr<
Protocol
clone (void) const =0
virtual bool close (pion::platform::EventPtr &event_ptr_ref, bool client_reset, bool server_reset)=0
virtual boost::tribool readNext (bool request, const char *ptr, size_t len, boost::posix_time::ptime data_timestamp, boost::posix_time::ptime ack_timestamp, pion::platform::EventContainer &events, boost::system::error_code &ec)=0
virtual bool checkRecoveryPacket (bool request, const char *ptr, size_t len)
virtual void setConfig (const Vocabulary &v, const xmlNodePtr config_ptr)
virtual void updateVocabulary (const Vocabulary &v)
Event::EventType getEventType (void) const
 returns the type of Event that is used by this Protocol

Protected Member Functions

void copyProtocol (const Protocol &c)
 protected copy function (use clone() instead)

Protected Attributes

EventFactory m_event_factory
 used to efficiently generate new Events

Classes

class  EmptyEventException
 exception thrown if the Protocol configuration does not define an event type More...
class  NotAnObjectException
 exception thrown if the Protocol configuration uses an event type for a Term that is not an object More...
class  UnknownTermException
 exception thrown if the Protocol configuration references an unknown event type More...


Member Function Documentation

bool pion::platform::Protocol::checkRecoveryPacket ( bool  request,
const char *  ptr,
size_t  len 
) [virtual]

called when parsing previously failed. should return true if the current packet allows parsing to recover by starting over at the current point in the data stream.

Parameters:
request direction flag (true if request, false if response)
ptr pointer to data (may be NULL if data packet was missing)
len length in bytes of the network data
Returns:
true if the current packet allows parsing to recover

Definition at line 34 of file Protocol.cpp.

virtual boost::shared_ptr<Protocol> pion::platform::Protocol::clone ( void   )  const [pure virtual]

clones the Protocol, returning a pointer to the cloned copy

Returns:
ProtocolPtr pointer to the cloned copy of the codec

Referenced by pion::platform::ProtocolFactory::getProtocol().

virtual bool pion::platform::Protocol::close ( pion::platform::EventPtr event_ptr_ref,
bool  client_reset,
bool  server_reset 
) [pure virtual]

called to close the protocol parsing. An event may be returned if there is data remaining (i.e. if closed prematurely)

Parameters:
event_ptr_ref refererence to an event object returned if the call resulted in event generation
client_reset will be true if the client reset the connection
server_reset will be true if the server reset the connection
Returns:
true if the request or response parsing was finished prematurely

virtual boost::tribool pion::platform::Protocol::readNext ( bool  request,
const char *  ptr,
size_t  len,
boost::posix_time::ptime  data_timestamp,
boost::posix_time::ptime  ack_timestamp,
pion::platform::EventContainer events,
boost::system::error_code &  ec 
) [pure virtual]

parses the next portion of the network data

Parameters:
request direction flag (true if request, false if response)
ptr pointer to data (may be NULL if data packet was missing)
len length in bytes of the network data
data_timestamp data frame timestamp
ack_timestamp timestamp for acknowlegement of receipt of data frame
events one or more events generated from network data
ec error_code contains additional information for parsing errors
Returns:
true if the current data chunk completes a new event, indeterminate if the event parsing is not yet complete, false if an error encountered during the parsing

void pion::platform::Protocol::setConfig ( const Vocabulary v,
const xmlNodePtr  config_ptr 
) [virtual]

sets configuration parameters for this Protocol

Parameters:
v the Vocabulary that this Protocol will use to describe Terms
config_ptr pointer to a list of XML nodes containing Protocol configuration parameters

Reimplemented from pion::platform::PlatformPlugin.

Definition at line 39 of file Protocol.cpp.

References pion::platform::Vocabulary::findTerm(), pion::platform::ConfigManager::getConfigOption(), pion::platform::PlatformPlugin::getId(), pion::platform::PlatformPlugin::setConfig(), pion::platform::Vocabulary::Term::term_type, pion::platform::Vocabulary::TYPE_OBJECT, and pion::platform::Vocabulary::UNDEFINED_TERM_REF.

Referenced by pion::platform::ProtocolFactory::addPluginNoLock().

void pion::platform::Protocol::updateVocabulary ( const Vocabulary v  )  [virtual]

this updates the Vocabulary information used by this Protocol; it should be called whenever the global Vocabulary is updated

Parameters:
v the Vocabulary that this Protocol will use to describe Terms

Reimplemented from pion::platform::PlatformPlugin.

Definition at line 60 of file Protocol.cpp.

References pion::platform::PlatformPlugin::updateVocabulary().


The documentation for this class was generated from the following files:
Generated on Wed Apr 13 16:38:36 2011 for pion-platform by  doxygen 1.4.7