• 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()
285 cli->sendMsg(ResponseCode::CommandParameterError, "Flag unsupported", false); in runCommand()
290 cli->sendMsg(ResponseCode::CommandOkay, "Interface configuration set", false); in runCommand()
298 cli->sendMsg(ResponseCode::CommandOkay, "Interface IP addresses cleared", false); in runCommand()
302 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
310 cli->sendMsg(ResponseCode::CommandOkay, "IPv6 privacy extensions changed", false); in runCommand()
313 cli->sendMsg(ResponseCode::OperationFailed, "Failed to set ipv6 privacy extensions", in runCommand()
319 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
327 cli->sendMsg(ResponseCode::CommandOkay, "IPv6 state changed", false); in runCommand()
330 cli->sendMsg(ResponseCode::OperationFailed, "Failed to change IPv6 state", true); in runCommand()
335 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
341 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], mtuValue, "Failed to set MTU", true); in runCommand()
344 cli->sendMsg(ResponseCode::CommandOkay, "MTU changed", false); in runCommand()
347 cli->sendMsg(ResponseCode::OperationFailed, "Failed to set MTU", true); in runCommand()
351 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown interface cmd", false); in runCommand()
360 int NdcDispatcher::IpFwdCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
371 cli->sendMsg(ResponseCode::IpFwdStatusResult, msg.c_str(), false); in runCommand()
399 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown ipfwd cmd", false); in runCommand()
404 cli->sendMsg(ResponseCode::CommandOkay, "ipfwd operation succeeded", false); in runCommand()
407 cli->sendMsg(ResponseCode::OperationFailed, "ipfwd operation failed", true); in runCommand()
414 int NdcDispatcher::TetherCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
418 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
429 cli->sendMsg(ResponseCode::TetherStatusResult, msg.c_str(), false); in runCommand()
436 cli->sendMsg(ResponseCode::TetherInterfaceListResult, ifname.c_str(), false); in runCommand()
441 cli->sendMsg(ResponseCode::CommandSyntaxError, "Bad number of arguments", false); in runCommand()
457 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
468 cli->sendMsg(ResponseCode::CommandParameterError, in runCommand()
475 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
486 cli->sendMsg(ResponseCode::CommandParameterError, in runCommand()
491 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown tether cmd", false); in runCommand()
497 cli->sendMsg(ResponseCode::CommandOkay, "Tether operation succeeded", false); in runCommand()
500 cli->sendMsg(ResponseCode::OperationFailed, "Tether operation failed", true); in runCommand()
508 int NdcDispatcher::NatCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
512 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
524 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown nat cmd", false); in runCommand()
529 cli->sendMsg(ResponseCode::CommandOkay, "Nat operation succeeded", false); in runCommand()
532 cli->sendMsg(ResponseCode::OperationFailed, "Nat operation failed", true); in runCommand()
540 void NdcDispatcher::BandwidthControlCmd::sendGenericSyntaxError(NdcClient* cli, in sendGenericSyntaxError() argument
544 cli->sendMsg(ResponseCode::CommandSyntaxError, msg, false); in sendGenericSyntaxError()
548 void NdcDispatcher::BandwidthControlCmd::sendGenericOkFail(NdcClient* cli, int cond) const { in sendGenericOkFail() argument
550 cli->sendMsg(ResponseCode::CommandOkay, "Bandwidth command succeeeded", false); in sendGenericOkFail()
552 cli->sendMsg(ResponseCode::OperationFailed, "Bandwidth command failed", false); in sendGenericOkFail()
556 void NdcDispatcher::BandwidthControlCmd::sendGenericOpFailed(NdcClient* cli, in sendGenericOpFailed() argument
558 cli->sendMsg(ResponseCode::OperationFailed, errMsg, false); in sendGenericOpFailed()
561 int NdcDispatcher::BandwidthControlCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
563 sendGenericSyntaxError(cli, "<cmds> <args...>"); in runCommand()
571 sendGenericSyntaxError(cli, "removeiquota <interface>"); in runCommand()
575 sendGenericOkFail(cli, rc); in runCommand()
580 sendGenericSyntaxError(cli, "setiquota <interface> <bytes>"); in runCommand()
584 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], bytes, "Bandwidth command failed", false); in runCommand()
586 sendGenericOkFail(cli, rc); in runCommand()
591 sendGenericSyntaxError(cli, "addnaughtyapps <appUid> ..."); in runCommand()
597 PARSE_UINT_RETURN_IF_FAIL(cli, argv[arg_index], uid, "Bandwidth command failed", false); in runCommand()
601 sendGenericOkFail(cli, rc); in runCommand()
606 sendGenericSyntaxError(cli, "removenaughtyapps <appUid> ..."); in runCommand()
612 PARSE_UINT_RETURN_IF_FAIL(cli, argv[arg_index], uid, "Bandwidth command failed", false); in runCommand()
616 sendGenericOkFail(cli, rc); in runCommand()
621 sendGenericSyntaxError(cli, "addniceapps <appUid> ..."); in runCommand()
627 PARSE_UINT_RETURN_IF_FAIL(cli, argv[arg_index], uid, "Bandwidth command failed", false); in runCommand()
631 sendGenericOkFail(cli, rc); in runCommand()
636 sendGenericSyntaxError(cli, "removeniceapps <appUid> ..."); in runCommand()
642 PARSE_UINT_RETURN_IF_FAIL(cli, argv[arg_index], uid, "Bandwidth command failed", false); in runCommand()
646 sendGenericOkFail(cli, rc); in runCommand()
651 sendGenericSyntaxError(cli, "setglobalalert <bytes>"); in runCommand()
655 PARSE_INT_RETURN_IF_FAIL(cli, argv[2], bytes, "Bandwidth command failed", false); in runCommand()
657 sendGenericOkFail(cli, rc); in runCommand()
662 sendGenericSyntaxError(cli, "setinterfacealert <interface> <bytes>"); in runCommand()
666 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], bytes, "Bandwidth command failed", false); in runCommand()
668 sendGenericOkFail(cli, rc); in runCommand()
673 sendGenericSyntaxError(cli, "removeinterfacealert <interface>"); in runCommand()
677 sendGenericOkFail(cli, rc); in runCommand()
681 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown bandwidth cmd", false); in runCommand()
687 int NdcDispatcher::IdletimerControlCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
690 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
699 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
704 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], timeout, "Failed to add interface", false); in runCommand()
707 cli->sendMsg(ResponseCode::OperationFailed, "Failed to add interface", false); in runCommand()
709 cli->sendMsg(ResponseCode::CommandOkay, "Add success", false); in runCommand()
715 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
719 PARSE_INT_RETURN_IF_FAIL(cli, argv[3], timeout, "Failed to remove interface", false); in runCommand()
722 cli->sendMsg(ResponseCode::OperationFailed, "Failed to remove interface", false); in runCommand()
724 cli->sendMsg(ResponseCode::CommandOkay, "Remove success", false); in runCommand()
729 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown idletimer cmd", false); in runCommand()
735 int NdcDispatcher::FirewallCmd::sendGenericOkFail(NdcClient* cli, int cond) const { in sendGenericOkFail() argument
737 cli->sendMsg(ResponseCode::CommandOkay, "Firewall command succeeded", false); in sendGenericOkFail()
739 cli->sendMsg(ResponseCode::OperationFailed, "Firewall command failed", false); in sendGenericOkFail()
781 int NdcDispatcher::FirewallCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
783 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing command", false); in runCommand()
789 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
794 return sendGenericOkFail(cli, res); in runCommand()
799 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
804 return sendGenericOkFail(cli, res); in runCommand()
809 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
817 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
822 PARSE_UINT_RETURN_IF_FAIL(cli, argv[3], uid, "Firewall command failed", false); in runCommand()
824 return sendGenericOkFail(cli, res); in runCommand()
829 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
834 return sendGenericOkFail(cli, res); in runCommand()
839 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
844 return sendGenericOkFail(cli, res); in runCommand()
847 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown command", false); in runCommand()
853 int NdcDispatcher::ClatdCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
856 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
866 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false); in runCommand()
871 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown clatd cmd", false); in runCommand()
876 cli->sendMsg(ResponseCode::CommandOkay, in runCommand()
879 cli->sendMsg(ResponseCode::OperationFailed, "Clatd operation failed", false); in runCommand()
887 int NdcDispatcher::StrictCmd::sendGenericOkFail(NdcClient* cli, int cond) const { in sendGenericOkFail() argument
889 cli->sendMsg(ResponseCode::CommandOkay, "Strict command succeeded", false); in sendGenericOkFail()
891 cli->sendMsg(ResponseCode::OperationFailed, "Strict command failed", false); in sendGenericOkFail()
908 int NdcDispatcher::StrictCmd::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
910 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing command", false); in runCommand()
916 cli->sendMsg(ResponseCode::CommandSyntaxError, in runCommand()
923 PARSE_UINT_RETURN_IF_FAIL(cli, argv[2], uid, "Invalid UID", false); in runCommand()
925 cli->sendMsg(ResponseCode::CommandSyntaxError, "Invalid UID", false); in runCommand()
931 cli->sendMsg(ResponseCode::CommandSyntaxError, "Invalid penalty argument", false); in runCommand()
936 return sendGenericOkFail(cli, res); in runCommand()
939 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown command", false); in runCommand()
945 int NdcDispatcher::NetworkCommand::syntaxError(NdcClient* cli, const char* message) const { in syntaxError() argument
946 cli->sendMsg(ResponseCode::CommandSyntaxError, message, false); in syntaxError()
950 int NdcDispatcher::NetworkCommand::operationError(NdcClient* cli, const char* message, in operationError() argument
953 cli->sendMsg(ResponseCode::OperationFailed, message, true); in operationError()
957 int NdcDispatcher::NetworkCommand::success(NdcClient* cli) const { in success()
958 cli->sendMsg(ResponseCode::CommandOkay, "success", false); in success()
962 int NdcDispatcher::NetworkCommand::runCommand(NdcClient* cli, int argc, char** argv) const { in runCommand() argument
964 return syntaxError(cli, "Missing argument"); in runCommand()
974 return syntaxError(cli, "Incorrect number of arguments"); in runCommand()
983 PARSE_UINT_RETURN_IF_FAIL(cli, argv[nextArg++], uid, "Unknown argument", false); in runCommand()
990 return syntaxError(cli, "Unknown argument"); in runCommand()
995 return syntaxError(cli, "Incorrect number of arguments"); in runCommand()
1015 return operationError(cli, add ? "addRoute() failed" : "removeRoute() failed", in runCommand()
1019 return success(cli); in runCommand()
1027 return syntaxError(cli, "Missing argument"); in runCommand()
1032 return operationError(cli, "addInterfaceToNetwork() failed", in runCommand()
1037 return operationError(cli, "removeInterfaceFromNetwork() failed", in runCommand()
1041 return syntaxError(cli, "Unknown argument"); in runCommand()
1043 return success(cli); in runCommand()
1053 return syntaxError(cli, "Missing argument"); in runCommand()
1059 return operationError(cli, "createVirtualNetwork() failed", in runCommand()
1063 return syntaxError(cli, "Unknown trailing argument(s)"); in runCommand()
1069 return syntaxError(cli, "Unknown permission"); in runCommand()
1073 return operationError(cli, "createPhysicalNetwork() failed", in runCommand()
1077 return success(cli); in runCommand()
1084 return syntaxError(cli, "Incorrect number of arguments"); in runCommand()
1089 return operationError(cli, "destroyNetwork() failed", in runCommand()
1093 return success(cli); in runCommand()
1101 return syntaxError(cli, "Missing argument"); in runCommand()
1106 return syntaxError(cli, "Missing netId"); in runCommand()
1110 return syntaxError(cli, "Unknown argument"); in runCommand()
1113 return operationError(cli, "setDefaultNetwork() failed", in runCommand()
1116 return success(cli); in runCommand()
1126 return syntaxError(cli, "Missing argument"); in runCommand()
1133 return syntaxError(cli, "Unknown permission"); in runCommand()
1137 return syntaxError(cli, "Unknown argument"); in runCommand()
1140 return syntaxError(cli, "Missing id"); in runCommand()
1146 return syntaxError(cli, "Unknown argument"); in runCommand()
1155 return syntaxError(cli, "Invalid id"); in runCommand()
1170 return operationError(cli, "setPermissionForNetworks() failed", in runCommand()
1175 return success(cli); in runCommand()
1183 return syntaxError(cli, "Missing argument"); in runCommand()
1188 return syntaxError(cli, "Invalid UIDs"); in runCommand()
1193 return operationError(cli, "addUsersToNetwork() failed", in runCommand()
1199 return operationError(cli, "removeUsersFromNetwork() failed", in runCommand()
1203 return syntaxError(cli, "Unknown argument"); in runCommand()
1205 return success(cli); in runCommand()
1213 return syntaxError(cli, "Missing argument"); in runCommand()
1218 PARSE_UINT_RETURN_IF_FAIL(cli, argv[i], uid, "Unknown argument", false); in runCommand()
1230 return syntaxError(cli, "Unknown argument"); in runCommand()
1232 return success(cli); in runCommand()
1235 return syntaxError(cli, "Unknown argument"); in runCommand()