Lines Matching refs:hapd

30 static void accounting_sta_interim(struct hostapd_data *hapd,
34 static struct radius_msg * accounting_msg(struct hostapd_data *hapd, in accounting_msg() argument
47 radius_client_get_id(hapd->radius)); in accounting_msg()
61 hapd->conf->radius_acct_req_attr, in accounting_msg()
64 hapd->conf->ieee802_1x ? in accounting_msg()
96 if (add_common_radius_attr(hapd, hapd->conf->radius_acct_req_attr, sta, in accounting_msg()
167 static int accounting_sta_update_stats(struct hostapd_data *hapd, in accounting_sta_update_stats() argument
171 if (hostapd_drv_read_sta_data(hapd, data, sta->addr)) in accounting_sta_update_stats()
185 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS, in accounting_sta_update_stats()
200 struct hostapd_data *hapd = eloop_ctx; in accounting_interim_update() local
205 accounting_sta_interim(hapd, sta); in accounting_interim_update()
209 accounting_sta_update_stats(hapd, sta, &data); in accounting_interim_update()
214 hapd, sta); in accounting_interim_update()
223 void accounting_sta_start(struct hostapd_data *hapd, struct sta_info *sta) in accounting_sta_start() argument
231 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS, in accounting_sta_start()
241 hostapd_drv_sta_clear_stats(hapd, sta->addr); in accounting_sta_start()
243 if (!hapd->conf->radius->acct_server) in accounting_sta_start()
251 hapd, sta); in accounting_sta_start()
253 msg = accounting_msg(hapd, sta, RADIUS_ACCT_STATUS_TYPE_START); in accounting_sta_start()
255 radius_client_send(hapd->radius, msg, RADIUS_ACCT, sta->addr) < 0) in accounting_sta_start()
262 static void accounting_sta_report(struct hostapd_data *hapd, in accounting_sta_report() argument
271 if (!hapd->conf->radius->acct_server) in accounting_sta_report()
274 msg = accounting_msg(hapd, sta, in accounting_sta_report()
290 if (accounting_sta_update_stats(hapd, sta, &data) == 0) { in accounting_sta_report()
349 if (radius_client_send(hapd->radius, msg, in accounting_sta_report()
365 static void accounting_sta_interim(struct hostapd_data *hapd, in accounting_sta_interim() argument
369 accounting_sta_report(hapd, sta, 0); in accounting_sta_interim()
378 void accounting_sta_stop(struct hostapd_data *hapd, struct sta_info *sta) in accounting_sta_stop() argument
381 accounting_sta_report(hapd, sta, 1); in accounting_sta_stop()
382 eloop_cancel_timeout(accounting_interim_update, hapd, sta); in accounting_sta_stop()
383 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_RADIUS, in accounting_sta_stop()
392 int accounting_sta_get_id(struct hostapd_data *hapd, struct sta_info *sta) in accounting_sta_get_id() argument
427 static void accounting_report_state(struct hostapd_data *hapd, int on) in accounting_report_state() argument
431 if (!hapd->conf->radius->acct_server || hapd->radius == NULL) in accounting_report_state()
436 msg = accounting_msg(hapd, NULL, in accounting_report_state()
442 if (hapd->acct_session_id) { in accounting_report_state()
446 (unsigned long long) hapd->acct_session_id); in accounting_report_state()
452 if (radius_client_send(hapd->radius, msg, RADIUS_ACCT, NULL) < 0) in accounting_report_state()
459 struct hostapd_data *hapd = ctx; in accounting_interim_error_cb() local
464 sta = ap_get_sta(hapd, addr); in accounting_interim_error_cb()
495 hapd, sta); in accounting_interim_error_cb()
519 int accounting_init(struct hostapd_data *hapd) in accounting_init() argument
521 if (radius_gen_session_id((u8 *) &hapd->acct_session_id, in accounting_init()
522 sizeof(hapd->acct_session_id)) < 0) in accounting_init()
525 if (radius_client_register(hapd->radius, RADIUS_ACCT, in accounting_init()
526 accounting_receive, hapd)) in accounting_init()
528 radius_client_set_interim_error_cb(hapd->radius, in accounting_init()
529 accounting_interim_error_cb, hapd); in accounting_init()
531 accounting_report_state(hapd, 1); in accounting_init()
541 void accounting_deinit(struct hostapd_data *hapd) in accounting_deinit() argument
543 accounting_report_state(hapd, 0); in accounting_deinit()