XrlRouter Class Reference

Inheritance diagram for XrlRouter:
XrlDispatcher XrlSender FinderClientObserver XrlCmdMap NONCOPYABLE XrlStdRouter IfMgrXrlMirrorRouter XrlCliNode XrlFib2mribNode XrlMfeaNode XrlMld6igmpNode XrlMld6igmpNode XrlPimNode XrlStaticRoutesNode

List of all members.

Public Types

typedef XrlSender::Callback XrlCallback
typedef XrlRouterDispatchState DispatchState

Public Member Functions

 XrlRouter (EventLoop &e, const char *class_name, const char *finder_address, uint16_t finder_port) throw (InvalidAddress)
 XrlRouter (EventLoop &e, const char *class_name, IPv4 finder_address, uint16_t finder_port) throw (InvalidAddress)
bool add_listener (XrlPFListener *listener)
 Add a protocol family listener.
void finalize ()
 Start registration of XRLs that have been registered via add_handler with the Finder.
bool finalized () const
bool connected () const
bool connect_failed () const
bool ready () const
bool failed () const
virtual string toString () const
bool send (const Xrl &xrl, const XrlCallback &cb)
 Send XRL.
bool pending () const
bool add_handler_internal (const string &cmd, const XrlRecvAsyncCallback &rcb)
 Add an XRL method handler.
EventLoopeventloop ()
const string & instance_name () const
const string & class_name () const
IPv4 finder_address () const
uint16_t finder_port () const
XIlookup_xrl (const string &name) const

Protected Member Functions

virtual void finder_connect_event ()
 Called when Finder connection is established.
virtual void finder_disconnect_event ()
 Called when Finder disconnect occurs.
virtual void finder_ready_event (const string &tgt_name)
 Called when an Xrl Target becomes visible to other processes.
void dispatch_xrl (const string &method_name, const XrlArgs &inputs, XrlDispatcherCallback outputs) const
void resolve_callback (const XrlError &e, const FinderDBEntry *dbe, XrlRouterDispatchState *ds)
 Resolve callback (slow path).
void send_callback (const XrlError &e, XrlArgs *reply, XrlPFSender *sender, XrlCallback user_callback)
 Send callback (fast path).
bool send_resolved (const Xrl &xrl, const FinderDBEntry *dbe, const XrlCallback &dispatch_cb, bool direct_call)
 Choose appropriate XrlPFSender and execute Xrl dispatch.
void initialize (const char *class_name, IPv4 finder_addr, uint16_t finder_port)

Protected Attributes

string _instance_name
bool _finalized
list< XrlPFListener * > _listeners
list< XrlRouterDispatchState * > _dsl
list< ref_ptr< XrlPFSender > > _senders

Static Protected Attributes

static uint32_t _icnt = 0

Private Types

typedef map< string, XI * > XIM

Private Member Functions

ref_ptr< XrlPFSenderlookup_sender (const Xrl &xrl, FinderDBEntry *dbe)

Private Attributes

XIM _xi_cache

Member Function Documentation

bool XrlRouter::add_handler_internal ( const string &  cmd,
const XrlRecvAsyncCallback &  rcb 
) [virtual]

Add an XRL method handler.

cmdXRL method path name.
rcbcallback to be dispatched when XRL method is received for invocation.

Reimplemented from XrlCmdMap.

bool XrlRouter::add_listener ( XrlPFListener listener)

Add a protocol family listener.

When XRLs are registered through XrlRouter::finalize() they will register support for each protocol family listener added.

bool XrlRouter::connect_failed ( ) const
true if instance has encountered a connection error to the Finder.
bool XrlRouter::connected ( ) const
true if instance has established a connection to the Finder.
EventLoop& XrlRouter::eventloop ( ) [inline]
EventLoop used by XrlRouter instance.
bool XrlRouter::failed ( ) const
true if instance has experienced an unrecoverable error.
bool XrlRouter::finalized ( ) const [inline]
true when XRLs
void XrlRouter::finder_ready_event ( const string &  tgt_name) [protected, virtual]

Called when an Xrl Target becomes visible to other processes.

Implementers of this method should check tgt_name corresponds to the XrlRouter::instance_name as other targets within same process may cause this method to be invoked.

Default implementation is a no-op.

tgt_namename of Xrl Target becoming ready.

Implements FinderClientObserver.

Reimplemented in IfMgrXrlMirrorRouter.

bool XrlRouter::pending ( ) const [virtual]
true if at least one XrlRouter::send() call is still pending a result.

Implements XrlSender.

bool XrlRouter::ready ( ) const
true if instance has established a connection to the Finder, registered own XRLs, and should be considered operational.
void XrlRouter::resolve_callback ( const XrlError e,
const FinderDBEntry dbe,
XrlRouterDispatchState ds 
) [protected]

Resolve callback (slow path).

Called with results from asynchronous FinderClient Xrl queries.

bool XrlRouter::send ( const Xrl xrl,
const XrlCallback &  cb 
) [virtual]

Send XRL.

xrlXRL to be sent.
cbcallback to be dispatched with XRL result and return values.
true if XRL accepted for sending, false if insufficient resources are available.

Implements XrlSender.

void XrlRouter::send_callback ( const XrlError e,
XrlArgs reply,
XrlPFSender sender,
XrlCallback  user_callback 
) [protected]

Send callback (fast path).

FIXME: use smart ptr.

bool XrlRouter::send_resolved ( const Xrl xrl,
const FinderDBEntry dbe,
const XrlCallback &  dispatch_cb,
bool  direct_call 
) [protected]

Choose appropriate XrlPFSender and execute Xrl dispatch.

true on success, false otherwise.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations