Lines Matching defs:hapd
30 static void accounting_sta_interim(struct hostapd_data *hapd,
34 static struct radius_msg * accounting_msg(struct hostapd_data *hapd,
47 radius_client_get_id(hapd->radius));
61 hapd->conf->radius_acct_req_attr,
64 hapd->conf->ieee802_1x ?
96 if (add_common_radius_attr(hapd, hapd->conf->radius_acct_req_attr, sta,
100 if (sta && add_sqlite_radius_attr(hapd, sta, msg, 1) < 0)
170 static int accounting_sta_update_stats(struct hostapd_data *hapd,
174 if (hostapd_drv_read_sta_data(hapd, data, sta->addr))
188 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
203 struct hostapd_data *hapd = eloop_ctx;
208 accounting_sta_interim(hapd, sta);
212 accounting_sta_update_stats(hapd, sta, &data);
217 hapd, sta);
223 * @hapd: hostapd BSS data
226 void accounting_sta_start(struct hostapd_data *hapd, struct sta_info *sta)
234 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
244 hostapd_drv_sta_clear_stats(hapd, sta->addr);
246 if (!hapd->conf->radius->acct_server)
254 hapd, sta);
256 msg = accounting_msg(hapd, sta, RADIUS_ACCT_STATUS_TYPE_START);
258 radius_client_send(hapd->radius, msg, RADIUS_ACCT, sta->addr) < 0)
265 static void accounting_sta_report(struct hostapd_data *hapd,
274 if (!hapd->conf->radius->acct_server)
277 msg = accounting_msg(hapd, sta,
293 if (accounting_sta_update_stats(hapd, sta, &data) == 0) {
352 if (radius_client_send(hapd->radius, msg,
365 * @hapd: hostapd BSS data
368 static void accounting_sta_interim(struct hostapd_data *hapd,
372 accounting_sta_report(hapd, sta, 0);
378 * @hapd: hostapd BSS data
381 void accounting_sta_stop(struct hostapd_data *hapd, struct sta_info *sta)
384 accounting_sta_report(hapd, sta, 1);
385 eloop_cancel_timeout(accounting_interim_update, hapd, sta);
386 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS,
395 int accounting_sta_get_id(struct hostapd_data *hapd, struct sta_info *sta)
430 static void accounting_report_state(struct hostapd_data *hapd, int on)
434 if (!hapd->conf->radius->acct_server || hapd->radius == NULL)
439 msg = accounting_msg(hapd, NULL,
445 if (hapd->acct_session_id) {
449 (unsigned long long) hapd->acct_session_id);
455 if (radius_client_send(hapd->radius, msg, RADIUS_ACCT, NULL) < 0)
462 struct hostapd_data *hapd = ctx;
467 sta = ap_get_sta(hapd, addr);
498 hapd, sta);
519 * @hapd: hostapd BSS data
522 int accounting_init(struct hostapd_data *hapd)
524 if (radius_gen_session_id((u8 *) &hapd->acct_session_id,
525 sizeof(hapd->acct_session_id)) < 0)
528 if (radius_client_register(hapd->radius, RADIUS_ACCT,
529 accounting_receive, hapd))
531 radius_client_set_interim_error_cb(hapd->radius,
532 accounting_interim_error_cb, hapd);
534 accounting_report_state(hapd, 1);
542 * @hapd: hostapd BSS data
544 void accounting_deinit(struct hostapd_data *hapd)
546 accounting_report_state(hapd, 0);