|
|
The FinderClient class performs communication processing with the Finder on behalf of XORP processes. It handles XRL registration and resolution requests.
typedef XorpCallback2<void, const XrlError&, const FinderDBEntry*>::RefPtr QueryCallback | QueryCallback |
typedef ref_ptr<FinderClientOp> Operation | Operation |
typedef list<Operation> OperationQueue | OperationQueue |
typedef map<string, FinderDBEntry> ResolvedTable | ResolvedTable |
typedef map<string, string> LocalResolvedTable | LocalResolvedTable |
typedef vector<InstanceInfo> InstanceList | InstanceList |
FinderClient ()
| FinderClient |
~FinderClient ()
| ~FinderClient |
[virtual]
bool register_xrl_target (const string& instance_name,
const string& class_name,
const XrlDispatcher* dispatcher)
| register_xrl_target |
Register an Xrl Target with the FinderClient and place request with Finder to perform registration. The request to the Finder is asynchronous and there is a delay between when the request is made when it is satisfied.
Parameters:
instance_name | a unique name to be associated with the Target. |
class_name | the class name that the Target is an instance of. |
dispatcher | pointer to Xrl dispatcher that can execute the command. |
Returns: true on success, false if instance_name or class_name are empty.
bool unregister_xrl_target (const string& instance_name)
| unregister_xrl_target |
Unregister Xrl Target with FinderClient and place a request with the Finder to remove registration. The request to the Finder is asynchronous and there is a delay between when the request is made when it is satisfied.
Parameters:
instance_name | unique name associated with Xrl Target. |
bool register_xrl (const string& instance_name,
const string& xrl,
const string& pf_name,
const string& pf_args)
| register_xrl |
Register an Xrl with the Finder.
Parameters:
instance_name | unique name associated with Xrl Target and making the registration. |
xrl | string representation of the Xrl. |
pf_name | protocol family name that implements Xrl. |
pf_args | protocol family arguments to locate dispatcher for registered Xrl. |
Returns: true if registration request is successfully enqueued, false otherwise.
bool enable_xrls (const string& instance_name)
| enable_xrls |
Request Finder advertise Xrls associated with an Xrl Target instance to other XORP Xrl targets. Until the Finder has satisfied this request the Xrl Target has no visibility in the Xrl universe.
Parameters:
instance_name | unique name associated with Xrl Target to be advertised. |
Returns: true on success, false if instance_name has not previously been registered with FinderClient.
void query (const string& xrl,
const QueryCallback& qcb)
| query |
Request resolution of an Xrl.
If the Xrl to be resolved in cache exists in the FinderClients cache, the callback provided as a function argument is invoked immediately. Otherwise the request is forwarded to the finder, the cache updated, and callback dispatched when the Finder answers the request.
Parameters:
xrl | Xrl to be resolved. |
qcb | callback to be dispatched when result is availble. |
const FinderDBEntry* query_cache (const string& xrl)
| query_cache |
[const]
Attempt to resolve Xrl from cache.
Parameters:
xrl | Xrl to be resolved. |
Returns: pointer to cached entry on success, 0 otherwise.
void uncache_result (const FinderDBEntry* dbe)
| uncache_result |
Remove an resolved entry from cache.
This method is typically called when the information provided has been useful to consumer. ie because the answer is found to be no longer valid.
bool query_self (const string& incoming_xrl_command,
string& local_xrl_command)
| query_self |
[const]
Resolve Xrl that an Xrl Target associated with the FinderClient registered.
Parameters:
incoming_xrl_command | the command component of the Xrl being resolved. |
local_xrl_command | the local name of the Xrl command being resolved. |
Returns: true and assign value to local_xrl_command on success, false on failure.
bool forward_finder_xrl (const Xrl& x, const XrlPFSender::SendCallback& cb)
| forward_finder_xrl |
Send an Xrl for the Finder to dispatch. This is the mechanism that allows clients of the Finder to interrogate the Finder through an Xrl interface.
Parameters:
x | Xrl to be dispatched. |
cb | callback to be called with dispatch result. |
Returns: true on success.
FinderMessengerBase* messenger ()
| messenger |
Accessor for Finder Messenger used by FinderClient instance.
inline OperationQueue& todo_list ()
| todo_list |
Get list of operations pending.
inline OperationQueue& done_list ()
| done_list |
Get List of operations done and are repeatable.
void notify_done (const FinderClientOp* completed)
| notify_done |
Notify successful completion of an operation on the todo list.
void notify_failed (const FinderClientOp* completed)
| notify_failed |
Notify failed completion of an operation on the todo list.
inline XrlCmdMap& commands ()
| commands |
Get the Xrl Commands implemented by the FinderClient.
inline bool ready ()
| ready |
[const]
Returns: true if FinderClient has registered Xrls and is considered operational.
inline bool connected ()
| connected |
[const]
Returns: true if a connection is established with the Finder.
bool attach_observer (FinderClientObserver* o)
| attach_observer |
Attach a FinderClientObserver instance to receive event notifications.
Parameters:
o | pointer to observer to receive notifications. |
Returns: true on success, false if an observer is already present.
bool detach_observer (FinderClientObserver* o)
| detach_observer |
Detach the FinderClientObserver instance.
Parameters:
o | pointer to the FinderClientObserver be removed. |
Returns: true on success, false if the FinderClientObserver is not the current observer.
void messenger_birth_event (FinderMessengerBase*)
| messenger_birth_event |
[protected]
Reimplemented from FinderMessengerManager.
void messenger_death_event (FinderMessengerBase*)
| messenger_death_event |
[protected]
Reimplemented from FinderMessengerManager.
void messenger_active_event (FinderMessengerBase*)
| messenger_active_event |
[protected]
Reimplemented from FinderMessengerManager.
void messenger_inactive_event (FinderMessengerBase*)
| messenger_inactive_event |
[protected]
Reimplemented from FinderMessengerManager.
void messenger_stopped_event (FinderMessengerBase*)
| messenger_stopped_event |
[protected]
Reimplemented from FinderMessengerManager.
bool manages (const FinderMessengerBase*)
| manages |
[protected const]
Reimplemented from FinderMessengerManager.
void uncache_xrl (const string& xrl)
| uncache_xrl |
[protected]
Reimplemented from FinderClientXrlCommandInterface.
void uncache_xrls_from_target (const string& target)
| uncache_xrls_from_target |
[protected]
Reimplemented from FinderClientXrlCommandInterface.
XrlCmdError dispatch_tunneled_xrl (const string& xrl)
| dispatch_tunneled_xrl |
[protected]
Reimplemented from FinderClientXrlCommandInterface.
void crank ()
| crank |
[protected]
void prepare_for_restart ()
| prepare_for_restart |
[protected]
inline InstanceList::iterator find_instance (const string& instance)
| find_instance |
[protected]
inline InstanceList::const_iterator find_instance (const string& instance)
| find_instance |
[protected const]
OperationQueue _todo_list | _todo_list |
[protected]
OperationQueue _done_list | _done_list |
[protected]
ResolvedTable _rt | _rt |
[protected]
LocalResolvedTable _lrt | _lrt |
[protected]
InstanceList _ids | _ids |
[protected]
XrlCmdMap _commands | _commands |
[protected]
FinderMessengerBase* _messenger | _messenger |
[protected]
bool _pending_result | _pending_result |
[protected]
bool _xrls_registered | _xrls_registered |
[protected]
FinderClientObserver* _observer | _observer |
[protected]