FREEDM DGI
Namespaces | Classes | Typedefs | Functions | Variables
freedm::broker Namespace Reference

Broker Architecture Namespace.

Namespaces

 device
 
 gm
 
 lb
 
 sc
 
 vvc
 

Classes

class  CBroker
 Scheduler for the DGI modules. More...
 
class  CClockSynchronizer
 
class  CConnection
 Represents a single outgoing connection to a client. More...
 
class  CConnectionManager
 Manages open connections so that they may be cleanly stopped. More...
 
class  CDispatcher
 Handles applying read handlers to incoming messages. More...
 
class  CGlobalConfiguration
 A singleton class which tracks commonly used configuration options. More...
 
class  CGlobalLogger
 Tracks the global logging configuration. More...
 
class  CGlobalPeerList
 
class  CListener
 Represents a single CListener from a client. More...
 
class  CLocalLogger
 
class  CLog
 Logging Output Software. More...
 
class  CPeerNode
 Base interface for agents/broker modules. More...
 
class  CPhysicalTopology
 Provides the Physical Topology Architecture. More...
 
class  CProtocolSR
 A reliable connection protocol with sweet as expirations. More...
 
class  CTimings
 
struct  EConnectionError
 Used for errors communicating with peers. More...
 
struct  EDgiConfigError
 Used when the DGI has been misconfigured. More...
 
struct  EDgiNoSuchPeerError
 
class  IDGIModule
 An interface for an object which can handle recieving incoming messages. More...
 
class  IProtocol
 A connection protocol. More...
 
struct  SRemoteHost
 A container which lists the hostname and and port of a peer. More...
 

Typedefs

typedef CLocalLoggerCLoggerPointer
 Boost requires this to be a raw pointer. More...
 
typedef boost::shared_ptr< CConnectionConnectionPtr
 
typedef std::map< std::string, CPeerNodePeerSet
 Provides a PeerSet type for a module templated on T. More...
 
typedef PeerSet::iterator PeerSetIterator
 Provides a PeerSet iterator templated on T. More...
 
typedef std::map< std::string, std::pair< CPeerNode, boost::posix_time::ptime > > TimedPeerSet
 Similar to a PeerSet, but also tracks the time a peer was inserted. More...
 
typedef TimedPeerSet::iterator TimedPeerSetIterator
 Provides a TimedPeerSet iterator templated on T. More...
 

Functions

std::string basename (const std::string s)
 Turns a qualified path into just a filename. More...
 
google::protobuf::uint64 ComputeMessageHash (const ModuleMessage &msg)
 Hash a message. More...
 
int CountInPeerSet (PeerSet &ps, const CPeerNode &m)
 Provides count() for a PeerSet. More...
 
int CountInTimedPeerSet (TimedPeerSet &tps, const CPeerNode &m)
 Provides count() for a TimedPeerSet. More...
 
void EraseInPeerSet (PeerSet &ps, const CPeerNode &m)
 Provides erase() for a PeerSet. More...
 
void EraseInTimedPeerSet (TimedPeerSet &tps, const CPeerNode &m)
 Provides erase() for a TimedPeerSet. More...
 
PeerSetIterator FindInPeerSet (PeerSet &ps, const CPeerNode &m)
 Provides find() for a PeerSet. More...
 
boost::posix_time::ptime GetTimeFromPeerSet (TimedPeerSet &tps, const CPeerNode &m)
 Get the time a peer was placed into the TimedPeerSet; only sensible if the peer is in the set exactly once. More...
 
void InsertInPeerSet (PeerSet &ps, const CPeerNode &m)
 Provides insert() for a PeerSet. More...
 
void InsertInTimedPeerSet (TimedPeerSet &tps, const CPeerNode &m, boost::posix_time::ptime time)
 Provides insert() for a TimedPeerSet. More...
 
bool IsValidPort (std::string port)
 
bool MessageIsExpired (const ProtocolMessage &msg)
 Determines whether the message has expired. More...
 
bool operator< (const CPeerNode &a, const CPeerNode &b)
 
bool operator== (const CPeerNode &a, const CPeerNode &b)
 
void SetExpirationTimeFromNow (ProtocolMessage &msg, const boost::posix_time::time_duration &expires_in)
 Set the expiration time for this message. More...
 
void StampMessageSendtime (ProtocolMessageWindow &msg)
 Sets the message's timestamp to the current time. More...
 

Variables

const unsigned int ALIGNMENT_DURATION = 250
 How often the scheduler should verify the schedule is being followed. More...
 

Typedef Documentation

typedef boost::shared_ptr<CConnection> freedm::broker::ConnectionPtr
typedef std::map<std::string, CPeerNode> freedm::broker::PeerSet
typedef PeerSet::iterator freedm::broker::PeerSetIterator
typedef std::map<std::string, std::pair<CPeerNode, boost::posix_time::ptime> > freedm::broker::TimedPeerSet
typedef TimedPeerSet::iterator freedm::broker::TimedPeerSetIterator

Function Documentation

std::string freedm::broker::basename ( const std::string  s)

basename

Description:
Return the last component of a path. That is, given a path like "/root/freedm/example", this function will return "example"
Precondition:
None
Postcondition:
None
Parameters
sThe path to extract from.
Returns
The last component of the path.
google::protobuf::uint64 freedm::broker::ComputeMessageHash ( const ModuleMessage &  msg)

ComputeMessageHash

Description:
Hash a message.
Parameters
msgthe message to hash
Returns
a hash of the message
int freedm::broker::CountInPeerSet ( PeerSet ps,
const CPeerNode m 
)

CountInPeerSet

Description:
Counts the instances of a peer in a PeerSet. This function provides count().
Parameters
psThe peerset to search
mThe peer to search for.
Precondition:
None
Postcondition:
None
Returns
The count of peers matching m (should be one or zero).
int freedm::broker::CountInTimedPeerSet ( TimedPeerSet tps,
const CPeerNode m 
)

CountInPeerSet

Description:
Counts the instances of a peer in a TimedPeerSet. This function provides count().
Parameters
tpsThe peerset to search
mThe peer to search for.
Precondition:
None
Postcondition:
None
Returns
The count of peers matching m (should be one or zero).
void freedm::broker::EraseInPeerSet ( PeerSet ps,
const CPeerNode m 
)

EraseInPeerSet

Description:
Removes the specified peer from a peer set. Provides erase() for a PeerSet.
Parameters
psThe peerset to erase from
mThe peer to erase.
Precondition:
None
Postcondition:
If m is in the PeerSet, it is removed.
void freedm::broker::EraseInTimedPeerSet ( TimedPeerSet tps,
const CPeerNode m 
)

EraseInTimedPeerSet

Description:
Removes the specified peer from a peer set. Provides erase() for a TimedPeerSet.
Parameters
tpsThe peerset to erase from
mThe peer to erase.
Precondition:
None
Postcondition:
If m is in the TimedPeerSet, it is removed.
PeerSetIterator freedm::broker::FindInPeerSet ( PeerSet ps,
const CPeerNode m 
)

FindInPeerSet

Description:
Returns an iterator to the peer in the PeerSet. This function provides find().
Parameters
psThe peerset to search
mthe peer to search for.
Precondition:
None
Postcondition:
None
Returns
an iterator to the specified Peer
boost::posix_time::ptime freedm::broker::GetTimeFromPeerSet ( TimedPeerSet tps,
const CPeerNode m 
)

GetTimeFromPeerSet

Description:
Get the time a peer was placed into the TimedPeerSet
Precondition:
None
Postcondition:
Throws an exception if the peer is not in the peerset.
Parameters
tpsThe timed peer set to search.
mThe peer to search for.
void freedm::broker::InsertInPeerSet ( PeerSet ps,
const CPeerNode m 
)

InsertInPeerSet

Description:
Adds the specified peer to the PeerSet. Provides insert() for a PeerSet.
Precondition:
None
Postcondition:
If m is not in the PeerSet it is added.
Parameters
psThe peerset to search
mthe peer to add to the set
void freedm::broker::InsertInTimedPeerSet ( TimedPeerSet tps,
const CPeerNode m,
boost::posix_time::ptime  time 
)

InsertInTimedPeerSet

Description:
Adds the specified peer to the TimedPeerSet. Provides insert() for a TimedPeerSet.
Precondition:
None
Postcondition:
If m is not in the TimedPeerSet it is added.
Parameters
tpsThe TimedPeerSet to insert into
mThe peer to add to the set.
timeThe time the peer was added to the TimedPeerSet
bool freedm::broker::IsValidPort ( std::string  port)
inline

IsValidPort

Description:
Determines whether the given string represents a valid port number.
Parameters
portthe string to checkt
Returns
true if port represents a valid port
bool freedm::broker::MessageIsExpired ( const ProtocolMessage &  msg)

MessageIsExpired

Description:
Determines whether the message has expired.
Parameters
msgthe message to check
Returns
true if the message has expired; false otherwise (including if the message has no expiration time set)
bool freedm::broker::operator< ( const CPeerNode a,
const CPeerNode b 
)
Description:
Provides a < operator for the maps these get stored in.
Returns
True if a's uuid is < b's.
bool freedm::broker::operator== ( const CPeerNode a,
const CPeerNode b 
)
Description:
Compares two peernodes.
Returns
True if the peer nodes have the same uuid.
void freedm::broker::SetExpirationTimeFromNow ( ProtocolMessage &  msg,
const boost::posix_time::time_duration &  expires_in 
)

SetExpirationTimeFromNow

Description:
Set the expiration time for this message.
Parameters
msgthe message to modify
expires_inhow long from now to set the expiration time
Precondition:
None
Postcondition:
Sets the expire time to the current UTC time + expires_in time.
void freedm::broker::StampMessageSendtime ( ProtocolMessageWindow &  msg)

StampMessageSendtime

Description:
Sets the message's timestamp to the current time.
Parameters
msgthe message to stamp, transfer-none
Precondition:
None
Postcondition:
Sets the send time for the message to the current UTC time.

Variable Documentation

const unsigned int freedm::broker::ALIGNMENT_DURATION = 250