| 1751 | } |
| 1752 | |
| 1753 | Status ModuleCommand(ServerContext*, const CommandRequest* request, |
| 1754 | CommandResponse* response) override { |
| 1755 | std::lock_guard<std::recursive_mutex> lock(mutex_); |
| 1756 | |
| 1757 | if (!request->name().length()) { |
| 1758 | return return_with_error(response, EINVAL, |
| 1759 | "Missing module name field 'name'"); |
| 1760 | } |
| 1761 | const auto& it = ModuleGraph::GetAllModules().find(request->name()); |
| 1762 | if (it == ModuleGraph::GetAllModules().end()) { |
| 1763 | return return_with_error(response, ENOENT, "No module '%s' found", |
| 1764 | request->name().c_str()); |
| 1765 | } |
| 1766 | |
| 1767 | // DPDK functions may be called, so be prepared |
| 1768 | current_worker.SetNonWorker(); |
| 1769 | |
| 1770 | Module* m = it->second; |
| 1771 | *response = m->RunCommand(request->cmd(), request->arg()); |
| 1772 | return Status::OK; |
| 1773 | } |
| 1774 | |
| 1775 | private: |
| 1776 | Status AttachTc(bess::TrafficClass* c_, const bess::pb::TrafficClass& class_, |
nothing calls this directly
no test coverage detected