Sirikata
Public Types | Public Member Functions
Sirikata::OHDP::Service Class Reference

OHDP::Service is the interface provided by classes that are able to send OHDP messages. More...

#include <Service.hpp>

Inheritance diagram for Sirikata::OHDP::Service:

List of all members.

Public Types

typedef Endpoint::MessageHandler MessageHandler

Public Member Functions

virtual ~Service ()
virtual PortbindOHDPPort (const SpaceID &space, const NodeID &node, PortID port)=0
 Bind an OHDP port for use.
PortbindOHDPPort (const SpaceID &space, PortID port)
 Convenience form of OHDP port binding since only NodeID::self() is ever valid for binding a Port (the local endpoint in OHDP is always NodeID::self() i.e.
PortbindOHDPPort (PortID port)
 Convenience form of OHDP port binding for when the SpaceID and NodeID are ignored because there is only one choice (e.g.
virtual PortbindOHDPPort (const SpaceID &space, const NodeID &node)=0
 Bind a random, unused OHDP port for use.
virtual PortID unusedOHDPPort (const SpaceID &space, const NodeID &node)=0
 Get a random, unused OHDP port.
virtual void registerDefaultOHDPHandler (const MessageHandler &cb)=0
 Register a handler for messages that arrive on unbound ports.

Detailed Description

OHDP::Service is the interface provided by classes that are able to send OHDP messages.

OHDP::Service mainly handles management of OHDP::Ports, which in turn allow sending and receiving of OHDP messages.

A Service allocates Ports and (behind the scenes) handles requests on the Ports, but once allocated the Port is owned by the allocator. The allocator is responsible for deleting all allocated Ports, even if the Service that generated them was destroyed.


Member Typedef Documentation


Constructor & Destructor Documentation

virtual Sirikata::OHDP::Service::~Service ( ) [inline, virtual]

Member Function Documentation

virtual Port* Sirikata::OHDP::Service::bindOHDPPort ( const SpaceID space,
const NodeID node,
PortID  port 
) [pure virtual]

Bind an OHDP port for use.

Parameters:
spacethe Space to communicate via
nodethe node to communicate via
portthe PortID to attempt to bind
Returns:
an OHDP Port object which can be used immediately, or NULL if the port is already bound
Exceptions:
PortAllocationErrorif the Service cannot allocate the port for some reason other than it already being allocated.

Implemented in Sirikata::OHDP::DelegateService, and Sirikata::ObjectHost.

Referenced by Sirikata::TimeSyncClient::TimeSyncClient(), and Sirikata::TimeSyncServer::TimeSyncServer().

Port* Sirikata::OHDP::Service::bindOHDPPort ( const SpaceID space,
PortID  port 
) [inline]

Convenience form of OHDP port binding since only NodeID::self() is ever valid for binding a Port (the local endpoint in OHDP is always NodeID::self() i.e.

0).

References Sirikata::OHDP::NodeID::self().

virtual Port* Sirikata::OHDP::Service::bindOHDPPort ( const SpaceID space,
const NodeID node 
) [pure virtual]

Bind a random, unused OHDP port for use.

Parameters:
spacethe Space to communicate via
Returns:
an OHDP Port object which can be used immediately, or, in extremely rare cases, NULL when an unused port isn't available
Exceptions:
PortAllocationErrorif the Service cannot allocate the port for some reason other than it already being allocated.

Implemented in Sirikata::OHDP::DelegateService, and Sirikata::ObjectHost.

Port* Sirikata::OHDP::Service::bindOHDPPort ( PortID  port) [inline]

Convenience form of OHDP port binding for when the SpaceID and NodeID are ignored because there is only one choice (e.g.

on the space, where SpaceID is always null and NodeID is always self).

References Sirikata::SpaceID::null(), and Sirikata::OHDP::NodeID::self().

virtual void Sirikata::OHDP::Service::registerDefaultOHDPHandler ( const MessageHandler cb) [pure virtual]

Register a handler for messages that arrive on unbound ports.

By default there is no handler and such messages are ignored. Note that this handler will not be invoked for messages arriving at a bound port for which no handler has been registered.

Parameters:
cbthe handler for messages arriving at unbound ports

Implemented in Sirikata::OHDP::DelegateService.

virtual PortID Sirikata::OHDP::Service::unusedOHDPPort ( const SpaceID space,
const NodeID node 
) [pure virtual]

Get a random, unused OHDP port.

Implemented in Sirikata::OHDP::DelegateService, and Sirikata::ObjectHost.


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