• Home
  • Raw
  • Download

Lines Matching refs:cli

53 #define PARSE_INT_RETURN_IF_FAIL(cli, label, intLabel, errMsg, addErrno)         \  argument
57 (cli)->sendMsg(ResponseCode::OperationFailed, (errMsg), (addErrno)); \
62 #define PARSE_UINT_RETURN_IF_FAIL(cli, label, intLabel, errMsg, addErrno) \ argument
66 (cli)->sendMsg(ResponseCode::OperationFailed, (errMsg), (addErrno)); \
167 int NdcDispatcher::InterfaceCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
169 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
179 cli->sendMsg(ResponseCode::OperationFailed, "Failed to get interface list", true); in runCommand()
183 cli->sendMsg(ResponseCode::InterfaceListResult, iface.c_str(), false); in runCommand()
186 cli->sendMsg(ResponseCode::CommandOkay, "Interface list completed", false); in runCommand()
193 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
203 cli->sendMsg(ResponseCode::OperationFailed, "Interface not found", true); in runCommand()
213 cli->sendMsg(ResponseCode::InterfaceGetCfgResult, msg.c_str(), false); in runCommand()
219 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
238 PARSE_INT_RETURN_IF_FAIL(cli, argv[4], interfaceCfg.prefixLength, in runCommand()
243 cli->sendMsg(ResponseCode::OperationFailed, "Failed to set address", true); in runCommand()
259 cli->sendMsg(ResponseCode::OperationFailed, "Failed to up interface", true); in runCommand()
270 cli->sendMsg(ResponseCode::OperationFailed, "Failed to down interface", in runCommand()
279 cli->sendMsg(ResponseCode::CommandParameterError, "Flag unsupported", false); in runCommand()
284 cli->sendMsg(ResponseCode::CommandOkay, "Interface configuration set", false); in runCommand()
292 cli->sendMsg(ResponseCode::CommandOkay, "Interface IP addresses cleared", false); in runCommand()
296 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
304 cli->sendMsg(ResponseCode::CommandOkay, "IPv6 privacy extensions changed", false); in runCommand()
307 cli->sendMsg(ResponseCode::OperationFailed, "Failed to set ipv6 privacy extensions", in runCommand()
313 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
321 cli->sendMsg(ResponseCode::CommandOkay, "IPv6 state changed", false); in runCommand()
324 cli->sendMsg(ResponseCode::OperationFailed, "Failed to change IPv6 state", true); in runCommand()
329 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
335 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], mtuValue, "Failed to set MTU", true); in runCommand()
338 cli->sendMsg(ResponseCode::CommandOkay, "MTU changed", false); in runCommand()
341 cli->sendMsg(ResponseCode::OperationFailed, "Failed to set MTU", true); in runCommand()
345 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown interface cmd", false); in runCommand()
354 int NdcDispatcher::IpFwdCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
365 cli->sendMsg(ResponseCode::IpFwdStatusResult, msg.c_str(), false); in runCommand()
393 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown ipfwd cmd", false); in runCommand()
398 cli->sendMsg(ResponseCode::CommandOkay, "ipfwd operation succeeded", false); in runCommand()
401 cli->sendMsg(ResponseCode::OperationFailed, "ipfwd operation failed", true); in runCommand()
408 int NdcDispatcher::TetherCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
412 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
423 cli->sendMsg(ResponseCode::TetherStatusResult, msg.c_str(), false); in runCommand()
430 cli->sendMsg(ResponseCode::TetherInterfaceListResult, ifname.c_str(), false); in runCommand()
435 cli->sendMsg(ResponseCode::CommandSyntaxError, "Bad number of arguments", false); in runCommand()
451 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
462 cli->sendMsg(ResponseCode::CommandParameterError, in runCommand()
469 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
480 cli->sendMsg(ResponseCode::CommandParameterError, in runCommand()
485 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown tether cmd", false); in runCommand()
491 cli->sendMsg(ResponseCode::CommandOkay, "Tether operation succeeded", false); in runCommand()
494 cli->sendMsg(ResponseCode::OperationFailed, "Tether operation failed", true); in runCommand()
502 int NdcDispatcher::NatCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
506 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
518 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown nat cmd", false); in runCommand()
523 cli->sendMsg(ResponseCode::CommandOkay, "Nat operation succeeded", false); in runCommand()
526 cli->sendMsg(ResponseCode::OperationFailed, "Nat operation failed", true); in runCommand()
534 void NdcDispatcher::BandwidthControlCmd::sendGenericSyntaxError(NdcClient* cli, in sendGenericSyntaxError() argument
538 cli->sendMsg(ResponseCode::CommandSyntaxError, msg, false); in sendGenericSyntaxError()
542 void NdcDispatcher::BandwidthControlCmd::sendGenericOkFail(NdcClient* cli, int cond) const { in sendGenericOkFail() argument
544 cli->sendMsg(ResponseCode::CommandOkay, "Bandwidth command succeeeded", false); in sendGenericOkFail()
546 cli->sendMsg(ResponseCode::OperationFailed, "Bandwidth command failed", false); in sendGenericOkFail()
550 void NdcDispatcher::BandwidthControlCmd::sendGenericOpFailed(NdcClient* cli, in sendGenericOpFailed() argument
552 cli->sendMsg(ResponseCode::OperationFailed, errMsg, false); in sendGenericOpFailed()
555 int NdcDispatcher::BandwidthControlCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
557 sendGenericSyntaxError(cli, "<cmds> <args...>"); in runCommand()
565 sendGenericSyntaxError(cli, "removeiquota <interface>"); in runCommand()
569 sendGenericOkFail(cli, rc); in runCommand()
574 sendGenericSyntaxError(cli, "setiquota <interface> <bytes>"); in runCommand()
578 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], bytes, "Bandwidth command failed", false); in runCommand()
580 sendGenericOkFail(cli, rc); in runCommand()
585 sendGenericSyntaxError(cli, "addnaughtyapps <appUid> ..."); in runCommand()
591 PARSE_UINT_RETURN_IF_FAIL(cli, argv[arg_index], uid, "Bandwidth command failed", false); in runCommand()
595 sendGenericOkFail(cli, rc); in runCommand()
600 sendGenericSyntaxError(cli, "removenaughtyapps <appUid> ..."); in runCommand()
606 PARSE_UINT_RETURN_IF_FAIL(cli, argv[arg_index], uid, "Bandwidth command failed", false); in runCommand()
610 sendGenericOkFail(cli, rc); in runCommand()
615 sendGenericSyntaxError(cli, "addniceapps <appUid> ..."); in runCommand()
621 PARSE_UINT_RETURN_IF_FAIL(cli, argv[arg_index], uid, "Bandwidth command failed", false); in runCommand()
625 sendGenericOkFail(cli, rc); in runCommand()
630 sendGenericSyntaxError(cli, "removeniceapps <appUid> ..."); in runCommand()
636 PARSE_UINT_RETURN_IF_FAIL(cli, argv[arg_index], uid, "Bandwidth command failed", false); in runCommand()
640 sendGenericOkFail(cli, rc); in runCommand()
645 sendGenericSyntaxError(cli, "setglobalalert <bytes>"); in runCommand()
649 PARSE_INT_RETURN_IF_FAIL(cli, argv[2], bytes, "Bandwidth command failed", false); in runCommand()
651 sendGenericOkFail(cli, rc); in runCommand()
656 sendGenericSyntaxError(cli, "setinterfacealert <interface> <bytes>"); in runCommand()
660 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], bytes, "Bandwidth command failed", false); in runCommand()
662 sendGenericOkFail(cli, rc); in runCommand()
667 sendGenericSyntaxError(cli, "removeinterfacealert <interface>"); in runCommand()
671 sendGenericOkFail(cli, rc); in runCommand()
675 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown bandwidth cmd", false); in runCommand()
681 int NdcDispatcher::IdletimerControlCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
684 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
693 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
698 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], timeout, "Failed to add interface", false); in runCommand()
701 cli->sendMsg(ResponseCode::OperationFailed, "Failed to add interface", false); in runCommand()
703 cli->sendMsg(ResponseCode::CommandOkay, "Add success", false); in runCommand()
709 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
713 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], timeout, "Failed to remove interface", false); in runCommand()
716 cli->sendMsg(ResponseCode::OperationFailed, "Failed to remove interface", false); in runCommand()
718 cli->sendMsg(ResponseCode::CommandOkay, "Remove success", false); in runCommand()
723 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown idletimer cmd", false); in runCommand()
729 int NdcDispatcher::FirewallCmd::sendGenericOkFail(NdcClient* cli, int cond) const { in sendGenericOkFail() argument
731 cli->sendMsg(ResponseCode::CommandOkay, "Firewall command succeeded", false); in sendGenericOkFail()
733 cli->sendMsg(ResponseCode::OperationFailed, "Firewall command failed", false); in sendGenericOkFail()
775 int NdcDispatcher::FirewallCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
777 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing command", false); in runCommand()
783 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
788 return sendGenericOkFail(cli, res); in runCommand()
793 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
798 return sendGenericOkFail(cli, res); in runCommand()
803 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
811 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
816 PARSE_UINT_RETURN_IF_FAIL(cli, argv[3], uid, "Firewall command failed", false); in runCommand()
818 return sendGenericOkFail(cli, res); in runCommand()
823 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
828 return sendGenericOkFail(cli, res); in runCommand()
833 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
838 return sendGenericOkFail(cli, res); in runCommand()
841 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown command", false); in runCommand()
847 int NdcDispatcher::ClatdCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
850 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
860 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
865 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown clatd cmd", false); in runCommand()
870 cli->sendMsg(ResponseCode::CommandOkay, in runCommand()
873 cli->sendMsg(ResponseCode::OperationFailed, "Clatd operation failed", false); in runCommand()
881 int NdcDispatcher::StrictCmd::sendGenericOkFail(NdcClient* cli, int cond) const { in sendGenericOkFail() argument
883 cli->sendMsg(ResponseCode::CommandOkay, "Strict command succeeded", false); in sendGenericOkFail()
885 cli->sendMsg(ResponseCode::OperationFailed, "Strict command failed", false); in sendGenericOkFail()
902 int NdcDispatcher::StrictCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
904 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing command", false); in runCommand()
910 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
917 PARSE_UINT_RETURN_IF_FAIL(cli, argv[2], uid, "Invalid UID", false); in runCommand()
919 cli->sendMsg(ResponseCode::CommandSyntaxError, "Invalid UID", false); in runCommand()
925 cli->sendMsg(ResponseCode::CommandSyntaxError, "Invalid penalty argument", false); in runCommand()
930 return sendGenericOkFail(cli, res); in runCommand()
933 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown command", false); in runCommand()
939 int NdcDispatcher::NetworkCommand::syntaxError(NdcClient* cli, const char* message) const { in syntaxError() argument
940 cli->sendMsg(ResponseCode::CommandSyntaxError, message, false); in syntaxError()
944 int NdcDispatcher::NetworkCommand::operationError(NdcClient* cli, const char* message, in operationError() argument
947 cli->sendMsg(ResponseCode::OperationFailed, message, true); in operationError()
951 int NdcDispatcher::NetworkCommand::success(NdcClient* cli) const { in success()
952 cli->sendMsg(ResponseCode::CommandOkay, "success", false); in success()
956 int NdcDispatcher::NetworkCommand::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
958 return syntaxError(cli, "Missing argument"); in runCommand()
968 return syntaxError(cli, "Incorrect number of arguments"); in runCommand()
977 PARSE_UINT_RETURN_IF_FAIL(cli, argv[nextArg++], uid, "Unknown argument", false); in runCommand()
984 return syntaxError(cli, "Unknown argument"); in runCommand()
989 return syntaxError(cli, "Incorrect number of arguments"); in runCommand()
1009 return operationError(cli, add ? "addRoute() failed" : "removeRoute() failed", in runCommand()
1013 return success(cli); in runCommand()
1021 return syntaxError(cli, "Missing argument"); in runCommand()
1026 return operationError(cli, "addInterfaceToNetwork() failed", in runCommand()
1031 return operationError(cli, "removeInterfaceFromNetwork() failed", in runCommand()
1035 return syntaxError(cli, "Unknown argument"); in runCommand()
1037 return success(cli); in runCommand()
1047 return syntaxError(cli, "Missing argument"); in runCommand()
1053 return operationError(cli, "createVirtualNetwork() failed", in runCommand()
1057 return syntaxError(cli, "Unknown trailing argument(s)"); in runCommand()
1063 return syntaxError(cli, "Unknown permission"); in runCommand()
1067 return operationError(cli, "createPhysicalNetwork() failed", in runCommand()
1071 return success(cli); in runCommand()
1078 return syntaxError(cli, "Incorrect number of arguments"); in runCommand()
1083 return operationError(cli, "destroyNetwork() failed", in runCommand()
1087 return success(cli); in runCommand()
1095 return syntaxError(cli, "Missing argument"); in runCommand()
1100 return syntaxError(cli, "Missing netId"); in runCommand()
1104 return syntaxError(cli, "Unknown argument"); in runCommand()
1107 return operationError(cli, "setDefaultNetwork() failed", in runCommand()
1110 return success(cli); in runCommand()
1120 return syntaxError(cli, "Missing argument"); in runCommand()
1127 return syntaxError(cli, "Unknown permission"); in runCommand()
1131 return syntaxError(cli, "Unknown argument"); in runCommand()
1134 return syntaxError(cli, "Missing id"); in runCommand()
1140 return syntaxError(cli, "Unknown argument"); in runCommand()
1149 return syntaxError(cli, "Invalid id"); in runCommand()
1164 return operationError(cli, "setPermissionForNetworks() failed", in runCommand()
1169 return success(cli); in runCommand()
1177 return syntaxError(cli, "Missing argument"); in runCommand()
1182 return syntaxError(cli, "Invalid UIDs"); in runCommand()
1187 return operationError(cli, "addUsersToNetwork() failed", in runCommand()
1193 return operationError(cli, "removeUsersFromNetwork() failed", in runCommand()
1197 return syntaxError(cli, "Unknown argument"); in runCommand()
1199 return success(cli); in runCommand()
1207 return syntaxError(cli, "Missing argument"); in runCommand()
1212 PARSE_UINT_RETURN_IF_FAIL(cli, argv[i], uid, "Unknown argument", false); in runCommand()
1224 return syntaxError(cli, "Unknown argument"); in runCommand()
1226 return success(cli); in runCommand()
1229 return syntaxError(cli, "Unknown argument"); in runCommand()