| 1443 | } |
| 1444 | |
| 1445 | Status GetGateHookClassInfo(ServerContext*, |
| 1446 | const GetGateHookClassInfoRequest* request, |
| 1447 | GetGateHookClassInfoResponse* response) override { |
| 1448 | std::lock_guard<std::recursive_mutex> lock(mutex_); |
| 1449 | |
| 1450 | VLOG(1) << "GetGateHookClassInfo from client:" << std::endl |
| 1451 | << request->DebugString(); |
| 1452 | if (!request->name().length()) { |
| 1453 | return return_with_error(response, EINVAL, |
| 1454 | "Argument must be a name in str"); |
| 1455 | } |
| 1456 | |
| 1457 | const std::string& cls_name = request->name(); |
| 1458 | const auto& it = |
| 1459 | bess::GateHookBuilder::all_gate_hook_builders().find(cls_name); |
| 1460 | if (it == bess::GateHookBuilder::all_gate_hook_builders().end()) { |
| 1461 | return return_with_error(response, ENOENT, "No gatehook class '%s' found", |
| 1462 | cls_name.c_str()); |
| 1463 | } |
| 1464 | const bess::GateHookBuilder* cls = &it->second; |
| 1465 | |
| 1466 | response->set_name(cls->class_name()); |
| 1467 | response->set_help(cls->help_text()); |
| 1468 | for (const auto& cmd : cls->cmds()) { |
| 1469 | response->add_cmds(cmd.first); |
| 1470 | response->add_cmd_args(cmd.second); |
| 1471 | } |
| 1472 | return Status::OK; |
| 1473 | } |
| 1474 | |
| 1475 | Status ListGateHooks(ServerContext*, const EmptyRequest*, |
| 1476 | ListGateHooksResponse* response) override { |
nothing calls this directly
no test coverage detected