int BandwidthController::setSharedAlert(int64_t bytes) { if (!sharedQuotaBytes) { ALOGE("Need to have a prior shared quota set to set an alert"); return -1; } if (!bytes) { ALOGE("Invalid bytes value. 1..max_int64."); return -1; } return setCostlyAlert("shared", bytes, &sharedAlertBytes); }
int BandwidthController::setInterfaceAlert(const char *iface, int64_t bytes) { std::list<QuotaInfo>::iterator it; if (!bytes) { ALOGE("Invalid bytes value. 1..max_int64."); return -1; } for (it = quotaIfaces.begin(); it != quotaIfaces.end(); it++) { if (it->ifaceName == iface) break; } if (it == quotaIfaces.end()) { ALOGE("Need to have a prior interface quota set to set an alert"); return -1; } return setCostlyAlert(iface, bytes, &it->alert); }