Sirikata
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
Sirikata::ObjectHostConnectionManager Class Reference

ObjectHostConnectionManager handles the networking aspects of interacting with object hosts. More...

#include <ObjectHostConnectionManager.hpp>

Collaboration diagram for Sirikata::ObjectHostConnectionManager:

List of all members.

Classes

class  Listener

Public Member Functions

 ObjectHostConnectionManager (SpaceContext *ctx, const Address4 &listen_addr, OHDP::Service *ohdp_service, Listener *listener)
 ~ObjectHostConnectionManager ()
bool validConnection (const ObjectHostConnectionID &conn_id) const
bool validConnection (const ShortObjectHostConnectionID &short_conn_id) const
WARN_UNUSED bool send (const ObjectHostConnectionID &conn_id, Sirikata::Protocol::Object::ObjectMessage *msg)
 NOTE: Must be used from within the main strand.
WARN_UNUSED bool send (const ShortObjectHostConnectionID short_conn_id, Sirikata::Protocol::Object::ObjectMessage *msg)
void shutdown ()
Network::IOStrand *const netStrand () const

Private Types

typedef std::set
< ObjectHostConnection * > 
ObjectHostConnectionSet
typedef
std::tr1::unordered_map
< ShortObjectHostConnectionID,
ObjectHostConnection * > 
ShortIDConnectionMap

Private Member Functions

void listen (const Address4 &listen_addr)
 Listen for and handle new connections.
void handleNewConnection (Sirikata::Network::Stream *str, Sirikata::Network::Stream::SetCallbacks &sc)
void handleConnectionEvent (ObjectHostConnection *conn, Sirikata::Network::Stream::ConnectionStatus status, const std::string &reason)
 Reading and writing handling for ObjectHostConnections.
void newOHStream (int err, OHDPSST::Stream::Ptr s)
void handleConnectionRead (ObjectHostConnection *conn, Sirikata::Network::Chunk &chunk, const Sirikata::Network::Stream::PauseReceiveCallback &pause)
bool sendHelper (ObjectHostConnection *conn, Sirikata::Protocol::Object::ObjectMessage *msg)
void insertConnection (ObjectHostConnection *conn)
void destroyConnection (ObjectHostConnection *conn)
void closeAllConnections ()

Static Private Member Functions

static ObjectHostConnectionID conn_id (ObjectHostConnection *c)

Private Attributes

SpaceContextmContext
Network::IOStrandmIOStrand
Sirikata::Network::StreamListenermAcceptor
ObjectHostConnectionSet mConnections
ShortObjectHostConnectionID mShortIDSource
ShortIDConnectionMap mShortConnections
ListenermListener
OHDPSST::BaseDatagramLayer::Ptr mOHSSTDatagramLayer

Detailed Description

ObjectHostConnectionManager handles the networking aspects of interacting with object hosts.

It listens for connections, maintains per object connections, and handles shipping messages out to the network.


Member Typedef Documentation


Constructor & Destructor Documentation

Sirikata::ObjectHostConnectionManager::ObjectHostConnectionManager ( SpaceContext ctx,
const Address4 listen_addr,
OHDP::Service ohdp_service,
Listener listener 
)
Sirikata::ObjectHostConnectionManager::~ObjectHostConnectionManager ( )

References mAcceptor, and mIOStrand.


Member Function Documentation

void Sirikata::ObjectHostConnectionManager::closeAllConnections ( ) [private]

References destroyConnection(), and mConnections.

Referenced by shutdown().

ObjectHostConnectionID Sirikata::ObjectHostConnectionManager::conn_id ( ObjectHostConnection c) [static, private]
void Sirikata::ObjectHostConnectionManager::destroyConnection ( ObjectHostConnection conn) [private]
void Sirikata::ObjectHostConnectionManager::handleConnectionEvent ( ObjectHostConnection conn,
Sirikata::Network::Stream::ConnectionStatus  status,
const std::string &  reason 
) [private]
void Sirikata::ObjectHostConnectionManager::handleConnectionRead ( ObjectHostConnection conn,
Sirikata::Network::Chunk &  chunk,
const Sirikata::Network::Stream::PauseReceiveCallback pause 
) [private]
void Sirikata::ObjectHostConnectionManager::handleNewConnection ( Sirikata::Network::Stream str,
Sirikata::Network::Stream::SetCallbacks sc 
) [private]
void Sirikata::ObjectHostConnectionManager::insertConnection ( ObjectHostConnection conn) [private]
void Sirikata::ObjectHostConnectionManager::listen ( const Address4 listen_addr) [private]
Network::IOStrand* const Sirikata::ObjectHostConnectionManager::netStrand ( ) const [inline]
void Sirikata::ObjectHostConnectionManager::newOHStream ( int  err,
OHDPSST::Stream::Ptr  s 
) [private]
bool Sirikata::ObjectHostConnectionManager::send ( const ShortObjectHostConnectionID  short_conn_id,
Sirikata::Protocol::Object::ObjectMessage *  msg 
)
bool Sirikata::ObjectHostConnectionManager::send ( const ObjectHostConnectionID conn_id,
Sirikata::Protocol::Object::ObjectMessage *  msg 
)
bool Sirikata::ObjectHostConnectionManager::sendHelper ( ObjectHostConnection conn,
Sirikata::Protocol::Object::ObjectMessage *  msg 
) [private]
void Sirikata::ObjectHostConnectionManager::shutdown ( )
bool Sirikata::ObjectHostConnectionManager::validConnection ( const ObjectHostConnectionID conn_id) const
bool Sirikata::ObjectHostConnectionManager::validConnection ( const ShortObjectHostConnectionID short_conn_id) const

Member Data Documentation

Referenced by handleNewConnection().


The documentation for this class was generated from the following files: