static gboolean mh_qpid_callback(qmf::AgentSession session, qmf::AgentEvent event, gpointer user_data) { MatahariAgent *agent = (MatahariAgent*) user_data; mh_trace("Qpid message recieved"); if (event.hasDataAddr()) { mh_trace("Message is for %s (type: %s)", event.getDataAddr().getName().c_str(), event.getDataAddr().getAgentName().c_str()); } return agent->invoke(session, event, user_data); }
bool ObjectManager::invoke(qmf::AgentSession& session, qmf::AgentEvent& event) const { if (event.hasDataAddr()) { MatahariObject *obj = _impl->find(event.getDataAddr()); if (obj) { return obj->invoke(session, event); } mh_err("Target of method call not found"); } return false; }
gboolean SrvAgent::invoke(qmf::AgentSession session, qmf::AgentEvent event, gpointer user_data) { if (event.getType() == qmf::AGENT_METHOD && event.hasDataAddr()) { if (event.getDataAddr().getName() == "Services") { return invoke_services(session, event, user_data); } else if (event.getDataAddr().getName() == "Resources") { return invoke_resources(session, event, user_data); } else { mh_err("Unknown agent: %s", event.getDataAddr().getName().c_str()); } } mh_err("Unhandled message"); return TRUE; }