Home | History | Annotate | Download | only in netd

Lines Matching refs:cli

220 int CommandListener::InterfaceCmd::runCommand(SocketClient *cli,
223 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
232 cli->sendMsg(ResponseCode::OperationFailed, "Failed to open sysfs dir", true);
239 cli->sendMsg(ResponseCode::InterfaceListResult, de->d_name, false);
242 cli->sendMsg(ResponseCode::CommandOkay, "Interface list completed", false);
249 cli->sendMsg(ResponseCode::CommandSyntaxError,
255 cli->sendMsg(ResponseCode::OperationFailed, "Failed to execute command", true);
257 cli->sendMsg(ResponseCode::CommandOkay, rbuf, false);
265 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
280 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
285 cli->sendMsg(ResponseCode::CommandOkay,
288 cli->sendMsg(ResponseCode::OperationFailed, "Failed to add fwmark rule",
293 cli->sendMsg(ResponseCode::CommandOkay,
296 cli->sendMsg(ResponseCode::OperationFailed,
300 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown fwmark rule cmd",
306 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
311 cli->sendMsg(ResponseCode::CommandOkay,
314 cli->sendMsg(ResponseCode::OperationFailed,
320 cli->sendMsg(ResponseCode::CommandOkay,
323 cli->sendMsg(ResponseCode::OperationFailed,
327 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown fwmark route cmd",
334 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
339 cli->sendMsg(ResponseCode::CommandOkay, "uid rule successfully added",
342 cli->sendMsg(ResponseCode::OperationFailed, "Failed to add uid rule", true);
347 cli->sendMsg(ResponseCode::CommandOkay, "uid rule successfully removed",
350 cli->sendMsg(ResponseCode::OperationFailed, "Failed to remove uid rule",
354 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown uid cmd", false);
359 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
364 cli->sendMsg(ResponseCode::CommandOkay, "exemption rule successfully added",
367 cli->sendMsg(ResponseCode::OperationFailed, "Failed to add exemption rule",
372 cli->sendMsg(ResponseCode::CommandOkay,
375 cli->sendMsg(ResponseCode::OperationFailed,
379 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown exemption cmd", false);
384 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
388 sSecondaryTableCtrl->getProtectMark(cli);
392 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
395 sSecondaryTableCtrl->getUidMark(cli, atoi(argv[4]));
398 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown fwmark get cmd", false);
402 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown fwmark cmd", false);
409 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
413 cli->sendMsg(ResponseCode::CommandParameterError, "Invalid route prefix", false);
419 cli->sendMsg(ResponseCode::OperationFailed,
422 cli->sendMsg(ResponseCode::CommandOkay,
426 return sSecondaryTableCtrl->addRoute(cli, argv[3], argv[5],
429 cli->sendMsg(ResponseCode::CommandParameterError,
436 cli->sendMsg(ResponseCode::OperationFailed,
439 cli->sendMsg(ResponseCode::CommandOkay,
443 return sSecondaryTableCtrl->removeRoute(cli, argv[3], argv[5],
446 cli->sendMsg(ResponseCode::CommandParameterError,
451 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown interface cmd", false);
466 cli->sendMsg(ResponseCode::OperationFailed, "Interface not found", true);
494 cli->sendMsg(ResponseCode::InterfaceGetCfgResult, msg, false);
505 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
521 cli->sendMsg(ResponseCode::OperationFailed, "Failed to set address", true);
528 cli->sendMsg(ResponseCode::OperationFailed, "Failed to set prefixLength", true);
541 cli->sendMsg(ResponseCode::OperationFailed, "Failed to up interface", true);
549 cli->sendMsg(ResponseCode::OperationFailed, "Failed to down interface", true);
564 cli->sendMsg(ResponseCode::CommandParameterError, "Flag unsupported", false);
570 cli->sendMsg(ResponseCode::CommandOkay, "Interface configuration set", false);
579 cli->sendMsg(ResponseCode::CommandOkay, "Interface IP addresses cleared", false);
583 cli->sendMsg(ResponseCode::CommandSyntaxError,
590 cli->sendMsg(ResponseCode::CommandOkay, "IPv6 privacy extensions changed", false);
592 cli->sendMsg(ResponseCode::OperationFailed,
598 cli->sendMsg(ResponseCode::CommandSyntaxError,
606 cli->sendMsg(ResponseCode::CommandOkay, "IPv6 state changed", false);
608 cli->sendMsg(ResponseCode::OperationFailed,
617 cli->sendMsg(ResponseCode::InterfaceGetMtuResult, msg, false);
620 cli->sendMsg(ResponseCode::OperationFailed,
626 cli->sendMsg(ResponseCode::CommandSyntaxError,
631 cli->sendMsg(ResponseCode::CommandOkay, "MTU changed", false);
633 cli->sendMsg(ResponseCode::OperationFailed,
638 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown interface cmd", false);
650 int CommandListener::ListTtysCmd::runCommand(SocketClient *cli,
656 cli->sendMsg(ResponseCode::TtyListResult, *it, false);
659 cli->sendMsg(ResponseCode::CommandOkay, "Ttys listed.", false);
667 int CommandListener::IpFwdCmd::runCommand(SocketClient *cli,
672 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
680 cli->sendMsg(ResponseCode::IpFwdStatusResult, tmp, false);
688 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown ipfwd cmd", false);
693 cli->sendMsg(ResponseCode::CommandOkay, "ipfwd operation succeeded", false);
695 cli->sendMsg(ResponseCode::OperationFailed, "ipfwd operation failed", true);
705 int CommandListener::TetherCmd::runCommand(SocketClient *cli,
710 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
721 cli->sendMsg(ResponseCode::TetherStatusResult, tmp, false);
729 cli->sendMsg(ResponseCode::TetherInterfaceListResult, *it, false);
736 cli->sendMsg(ResponseCode::TetherDnsFwdTgtListResult, inet_ntoa(*it), false);
744 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
750 cli->sendMsg(ResponseCode::CommandSyntaxError, "Bad number of arguments", false);
760 cli->sendMsg(ResponseCode::CommandParameterError, "Invalid address", false);
774 cli->sendMsg(ResponseCode::CommandParameterError,
783 cli->sendMsg(ResponseCode::CommandParameterError,
788 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown tether cmd", false);
794 cli->sendMsg(ResponseCode::CommandOkay, "Tether operation succeeded", false);
796 cli->sendMsg(ResponseCode::OperationFailed, "Tether operation failed", true);
806 int CommandListener::NatCmd::runCommand(SocketClient *cli,
811 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
826 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown nat cmd", false);
831 cli->sendMsg(ResponseCode::CommandOkay, "Nat operation succeeded", false);
833 cli->sendMsg(ResponseCode::OperationFailed, "Nat operation failed", true);
843 int CommandListener::PppdCmd::runCommand(SocketClient *cli,
848 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
859 cli->sendMsg(ResponseCode::CommandParameterError, "Invalid local address", false);
863 cli->sendMsg(ResponseCode::CommandParameterError, "Invalid remote address", false);
867 cli->sendMsg(ResponseCode::CommandParameterError, "Invalid dns1 address", false);
871 cli->sendMsg(ResponseCode::CommandParameterError, "Invalid dns2 address", false);
878 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown pppd cmd", false);
883 cli->sendMsg(ResponseCode::CommandOkay, "Pppd operation succeeded", false);
885 cli->sendMsg(ResponseCode::OperationFailed, "Pppd operation failed", true);
895 int CommandListener::SoftapCmd::runCommand(SocketClient *cli,
902 cli->sendMsg(ResponseCode::ServiceStartFailed, "SoftAP is not available", false);
906 cli->sendMsg(ResponseCode::CommandSyntaxError,
920 cli->sendMsg(rc, retbuf, false);
926 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unrecognized SoftAP command", false);
931 cli->sendMsg(rc, "SoftAP command has failed", false);
933 cli->sendMsg(rc, "Ok", false);
942 int CommandListener::ResolverCmd::runCommand(SocketClient *cli, int argc, char **margv) {
948 cli->sendMsg(ResponseCode::CommandSyntaxError, "Resolver missing arguments", false);
956 cli->sendMsg(ResponseCode::CommandSyntaxError,
965 cli->sendMsg(ResponseCode::CommandSyntaxError,
983 cli->sendMsg(ResponseCode::CommandSyntaxError,
991 cli->sendMsg(ResponseCode::CommandSyntaxError,
999 cli->sendMsg(ResponseCode::CommandSyntaxError,
1007 cli->sendMsg(ResponseCode::CommandSyntaxError,
1015 cli->sendMsg(ResponseCode::CommandSyntaxError,
1023 cli->sendMsg(ResponseCode::CommandSyntaxError,
1031 cli->sendMsg(ResponseCode::CommandSyntaxError,
1035 cli->sendMsg(ResponseCode::CommandSyntaxError,"Resolver unknown command", false);
1040 cli->sendMsg(ResponseCode::CommandOkay, "Resolver command succeeded", false);
1042 cli->sendMsg(ResponseCode::OperationFailed, "Resolver command failed", true);
1052 void CommandListener::BandwidthControlCmd::sendGenericSyntaxError(SocketClient *cli, const char *usageMsg) {
1055 cli->sendMsg(ResponseCode::CommandSyntaxError, msg, false);
1059 void CommandListener::BandwidthControlCmd::sendGenericOkFail(SocketClient *cli, int cond) {
1061 cli->sendMsg(ResponseCode::CommandOkay, "Bandwidth command succeeeded", false);
1063 cli->sendMsg(ResponseCode::OperationFailed, "Bandwidth command failed", false);
1067 void CommandListener::BandwidthControlCmd::sendGenericOpFailed(SocketClient *cli, const char *errMsg) {
1068 cli->sendMsg(ResponseCode::OperationFailed, errMsg, false);
1071 int CommandListener::BandwidthControlCmd::runCommand(SocketClient *cli, int argc, char **argv) {
1073 sendGenericSyntaxError(cli, "<cmds> <args...>");
1081 sendGenericOkFail(cli, rc);
1087 sendGenericOkFail(cli, rc);
1093 sendGenericSyntaxError(cli, "removequota <interface>");
1097 sendGenericOkFail(cli, rc);
1104 sendGenericSyntaxError(cli, "getquota");
1109 sendGenericOpFailed(cli, "Failed to get quota");
1115 cli->sendMsg(ResponseCode::QuotaCounterResult, msg, false);
1123 sendGenericSyntaxError(cli, "getiquota <iface>");
1129 sendGenericOpFailed(cli, "Failed to get quota");
1134 cli->sendMsg(ResponseCode::QuotaCounterResult, msg, false);
1141 sendGenericSyntaxError(cli, "setquota <interface> <bytes>");
1145 sendGenericOkFail(cli, rc);
1151 sendGenericSyntaxError(cli, "setquotas <bytes> <interface> ...");
1160 cli->sendMsg(ResponseCode::OperationFailed,
1166 sendGenericOkFail(cli, rc);
1173 sendGenericSyntaxError(cli, "removequotas <interface> ...");
1182 cli->sendMsg(ResponseCode::OperationFailed,
1188 sendGenericOkFail(cli, rc);
1194 sendGenericSyntaxError(cli, "removeiquota <interface>");
1198 sendGenericOkFail(cli, rc);
1204 sendGenericSyntaxError(cli, "setiquota <interface> <bytes>");
1208 sendGenericOkFail(cli, rc);
1214 sendGenericSyntaxError(cli, "addnaughtyapps <appUid> ...");
1218 sendGenericOkFail(cli, rc);
1225 sendGenericSyntaxError(cli, "removenaughtyapps <appUid> ...");
1229 sendGenericOkFail(cli, rc);
1234 sendGenericSyntaxError(cli, "happybox (enable | disable)");
1239 sendGenericOkFail(cli, rc);
1245 sendGenericOkFail(cli, rc);
1248 sendGenericSyntaxError(cli, "happybox (enable | disable)");
1253 sendGenericSyntaxError(cli, "addniceapps <appUid> ...");
1257 sendGenericOkFail(cli, rc);
1262 sendGenericSyntaxError(cli, "removeniceapps <appUid> ...");
1266 sendGenericOkFail(cli, rc);
1271 sendGenericSyntaxError(cli, "setglobalalert <bytes>");
1275 sendGenericOkFail(cli, rc);
1280 sendGenericSyntaxError(cli, "debugsettetherglobalalert <interface0> <interface1>");
1285 sendGenericOkFail(cli, rc);
1291 sendGenericSyntaxError(cli, "removeglobalalert");
1295 sendGenericOkFail(cli, rc);
1301 sendGenericSyntaxError(cli, "debugremovetetherglobalalert <interface0> <interface1>");
1306 sendGenericOkFail(cli, rc);
1312 sendGenericSyntaxError(cli, "setsharedalert <bytes>");
1316 sendGenericOkFail(cli, rc);
1322 sendGenericSyntaxError(cli, "removesharedalert");
1326 sendGenericOkFail(cli, rc);
1332 sendGenericSyntaxError(cli, "setinterfacealert <interface> <bytes>");
1336 sendGenericOkFail(cli, rc);
1342 sendGenericSyntaxError(cli, "removeinterfacealert <interface>");
1346 sendGenericOkFail(cli, rc);
1354 sendGenericSyntaxError(cli, "gettetherstats [<intInterface> <extInterface>]");
1359 int rc = sBandwidthCtrl->getTetherStats(cli, tetherStats, extraProcessingInfo);
1362 sendGenericOpFailed(cli, extraProcessingInfo.c_str());
1369 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown bandwidth cmd", false);
1377 int CommandListener::IdletimerControlCmd::runCommand(SocketClient *cli, int argc, char **argv) {
1380 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
1388 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
1390 cli->sendMsg(ResponseCode::CommandOkay, "Enable success", false);
1397 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
1399 cli->sendMsg(ResponseCode::CommandOkay, "Disable success", false);
1405 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
1410 cli->sendMsg(ResponseCode::OperationFailed, "Failed to add interface", false);
1412 cli->sendMsg(ResponseCode::CommandOkay, "Add success", false);
1418 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
1424 cli->sendMsg(ResponseCode::OperationFailed, "Failed to remove interface", false);
1426 cli->sendMsg(ResponseCode::CommandOkay, "Remove success", false);
1431 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown idletimer cmd", false);
1439 int CommandListener::FirewallCmd::sendGenericOkFail(SocketClient *cli, int cond) {
1441 cli->sendMsg(ResponseCode::CommandOkay, "Firewall command succeeded", false);
1443 cli->sendMsg(ResponseCode::OperationFailed, "Firewall command failed", false);
1456 int CommandListener::FirewallCmd::runCommand(SocketClient *cli, int argc,
1459 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing command", false);
1465 return sendGenericOkFail(cli, res);
1469 return sendGenericOkFail(cli, res);
1473 return sendGenericOkFail(cli, res);
1478 cli->sendMsg(ResponseCode::CommandSyntaxError,
1487 return sendGenericOkFail(cli, res);
1492 cli->sendMsg(ResponseCode::CommandSyntaxError,
1502 return sendGenericOkFail(cli, res);
1507 cli->sendMsg(ResponseCode::CommandSyntaxError,
1520 return sendGenericOkFail(cli, res);
1525 cli->sendMsg(ResponseCode::CommandSyntaxError,
1535 return sendGenericOkFail(cli, res);
1538 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown command", false);
1545 int CommandListener::ClatdCmd::runCommand(SocketClient *cli, int argc,
1549 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
1560 cli->sendMsg(ResponseCode::ClatdStatusResult, tmp, false);
1565 cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing argument", false);
1570 cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown clatd cmd", false);
1575 cli->sendMsg(ResponseCode::CommandOkay, "Clatd operation succeeded", false);
1577 cli->sendMsg(ResponseCode::OperationFailed, "Clatd operation failed", false);