| /* cdu_db.h |
| * |
| * This file defines client data usage database interface. |
| * |
| * Author: Cradlepoint Technology, Inc. <source@cradlepoint.com> |
| * Adrian Sitterle <asitterle@cradlepoint.com> |
| * |
| * Copyright (C) 2019 Cradlepoint Technology, Inc. |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License version 2 |
| * as published by the Free Software Foundation. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| */ |
| |
| #pragma once |
| #include "cdu_types.h" |
| |
| |
| #define CDU_DB_UPDATE_PERMA_SET 1 |
| #define CDU_DB_UPDATE_EPHEM_SET 0 |
| #define CDU_DB_CONNTR_NOCLEAR 0 |
| |
| extern struct hlist_head cdu_db_usage_hash[USAGE_HASH_BITS] __read_mostly; |
| extern struct list_head cdu_db_usage_list; |
| extern spinlock_t cdu_db_hash_lock; |
| |
| int cdu_db_init(void); |
| void cdu_db_uninit(void); |
| void cdu_db_remove(struct usage_entry *obj); |
| void cdu_db_flush(void); |
| void cdu_db_update_entry(const struct nf_conn *ct, bool persist, bool clear); |
| void cdu_db_clear_stats(struct usage_entry *obj, bool persist); |
| void cdu_db_get_stats(struct usage_stats *upload, struct usage_stats *download, const struct usage_entry *obj); |
| void cdu_db_add_entry_ifmissing(const struct nf_conn *ct); |
| |
| void cdu_db_read_conn(bool clear); |