coord_base.hh

来自「BCAST Implementation for NS2」· HH 代码 · 共 205 行

HH
205
字号
/* * Copyright (c) 2001-2003 International Computer Science Institute * See LICENSE file for licensing, conditions, and warranties on use. * * DO NOT EDIT THIS FILE - IT IS PROGRAMMATICALLY GENERATED * * Generated by 'tgt-gen'. * * $XORP: xorp/xrl/targets/coord_base.hh,v 1.13 2003/06/26 19:41:49 atanu Exp $ */#ifndef __XRL_INTERFACES_COORD_BASE_HH__#define __XRL_INTERFACES_COORD_BASE_HH__#undef XORP_LIBRARY_NAME#define XORP_LIBRARY_NAME "XrlCoordTarget"#include "libxorp/xlog.h"#include "libxipc/xrl_cmd_map.hh"class XrlCoordTargetBase {protected:    XrlCmdMap* _cmds;public:    XrlCoordTargetBase(XrlCmdMap* cmds) : _cmds(cmds) { add_handlers(); }    virtual ~XrlCoordTargetBase() { remove_handlers(); }    inline const string& name() const { return _cmds->name(); }    inline const char* version() const { return "coord/0.0"; }protected:    /**     *  Pure-virtual function that needs to be implemented to:     *       *  Get name of Xrl Target     */    virtual XrlCmdError common_0_1_get_target_name(	// Output values, 	string&	name) = 0;    /**     *  Pure-virtual function that needs to be implemented to:     *       *  Get version string from Xrl Target     */    virtual XrlCmdError common_0_1_get_version(	// Output values, 	string&	version) = 0;    /**     *  Pure-virtual function that needs to be implemented to:     *       *  Get status of Xrl Target     */    virtual XrlCmdError common_0_1_get_status(	// Output values, 	uint32_t&	status, 	string&	reason) = 0;    /**     *  Pure-virtual function that needs to be implemented to:     *       *  Request clean shutdown of Xrl Target     */    virtual XrlCmdError common_0_1_shutdown() = 0;    /**     *  Pure-virtual function that needs to be implemented to:     *       *  Command to be executed by the coordinating process.     *       *  @param command to be sent to the coordinator.     */    virtual XrlCmdError coord_0_1_command(	// Input values, 	const string&	command) = 0;    /**     *  Pure-virtual function that needs to be implemented to:     *       *  Status, show the state of this peer.     */    virtual XrlCmdError coord_0_1_status(	// Input values, 	const string&	peer, 	// Output values, 	string&	status) = 0;    /**     *  Pure-virtual function that needs to be implemented to:     *       *  If there are still any outstanding commands pending will return true.     *  Can be used to poll the coordinating process to verify that the     *  previous command has completed.     */    virtual XrlCmdError coord_0_1_pending(	// Output values, 	bool&	pending) = 0;    virtual XrlCmdError datain_0_1_receive(	// Input values, 	const string&	peer, 	const uint32_t&	genid, 	const bool&	status, 	const uint32_t&	secs, 	const uint32_t&	micro, 	const vector<uint8_t>&	data) = 0;    virtual XrlCmdError datain_0_1_error(	// Input values, 	const string&	peer, 	const uint32_t&	genid, 	const string&	reason) = 0;    virtual XrlCmdError datain_0_1_closed(	// Input values, 	const string&	peer, 	const uint32_t&	genid) = 0;private:    const XrlCmdError handle_common_0_1_get_target_name(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_common_0_1_get_version(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_common_0_1_get_status(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_common_0_1_shutdown(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_coord_0_1_command(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_coord_0_1_status(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_coord_0_1_pending(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_datain_0_1_receive(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_datain_0_1_error(const XrlArgs& in, XrlArgs* out);    const XrlCmdError handle_datain_0_1_closed(const XrlArgs& in, XrlArgs* out);    void add_handlers()    {	if (_cmds->add_handler("common/0.1/get_target_name", 	    callback(this, &XrlCoordTargetBase::handle_common_0_1_get_target_name)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/common/0.1/get_target_name");	}	if (_cmds->add_handler("common/0.1/get_version", 	    callback(this, &XrlCoordTargetBase::handle_common_0_1_get_version)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/common/0.1/get_version");	}	if (_cmds->add_handler("common/0.1/get_status", 	    callback(this, &XrlCoordTargetBase::handle_common_0_1_get_status)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/common/0.1/get_status");	}	if (_cmds->add_handler("common/0.1/shutdown", 	    callback(this, &XrlCoordTargetBase::handle_common_0_1_shutdown)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/common/0.1/shutdown");	}	if (_cmds->add_handler("coord/0.1/command", 	    callback(this, &XrlCoordTargetBase::handle_coord_0_1_command)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/coord/0.1/command");	}	if (_cmds->add_handler("coord/0.1/status", 	    callback(this, &XrlCoordTargetBase::handle_coord_0_1_status)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/coord/0.1/status");	}	if (_cmds->add_handler("coord/0.1/pending", 	    callback(this, &XrlCoordTargetBase::handle_coord_0_1_pending)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/coord/0.1/pending");	}	if (_cmds->add_handler("datain/0.1/receive", 	    callback(this, &XrlCoordTargetBase::handle_datain_0_1_receive)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/datain/0.1/receive");	}	if (_cmds->add_handler("datain/0.1/error", 	    callback(this, &XrlCoordTargetBase::handle_datain_0_1_error)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/datain/0.1/error");	}	if (_cmds->add_handler("datain/0.1/closed", 	    callback(this, &XrlCoordTargetBase::handle_datain_0_1_closed)) == false) {	    XLOG_ERROR("Failed to xrl handler finder://coord/datain/0.1/closed");	}	_cmds->finalize();    }    void remove_handlers()    {	_cmds->remove_handler("common/0.1/get_target_name");	_cmds->remove_handler("common/0.1/get_version");	_cmds->remove_handler("common/0.1/get_status");	_cmds->remove_handler("common/0.1/shutdown");	_cmds->remove_handler("coord/0.1/command");	_cmds->remove_handler("coord/0.1/status");	_cmds->remove_handler("coord/0.1/pending");	_cmds->remove_handler("datain/0.1/receive");	_cmds->remove_handler("datain/0.1/error");	_cmds->remove_handler("datain/0.1/closed");    }};#endif /* __XRL_INTERFACES_COORD_BASE_HH__ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?