![]() |
![]()
| ![]() |
![]()
NAMEipa_sdb -- database format for ipa_db_sdb(8) and ipa_st_sdb(8) SYNOPSIS#include "ipa_sdb_config.h"
DESCRIPTIONipa_sdb is a database for IPA database module with the following features:
DATABASE FORMATAll structures needed for direct access to database data are available in the ipa_sdb.h C-header file. The ipa_sdb_config.h file has macros for packing structures, which are determined by the configure script (check its content). If you use another compiler than the compiler used by the configure script, then modify this file and redefine these macros. By default main database directory is IPA_SDB_DB_DIR, but since it can be changed, then let's call it <DB>. The ipa_db_sdb(8) and ipa_st_sdb(8) modules do not expect that any file or directory they currently use can be removed, renamed or modified by another process. The the version number of the database format is stored in the <DB>/IPA_SDB_VERSION_FILE file. There is the IPA_SDB_FORMAT_VERSION macro variable, which is equal to the version number of the database format. Statistics for an arbitrary rule is stored in the <DB>/<rule> directory. There are files with yyyymm like names in this directory which contain statistics per year/month. Each <rule>/yyyymm file contains records with the following format: struct ipa_sdb_rule_record { mday is a day of a month, h1, m1 and s1 is time when a record was added to the database, h2, m2 and s2 is time when a record was updated last time. c_high and c_low are high 32-bit part and low 32-bit part of the counter, each of these parts is represented in network byte order. Since a new record for any new day is always appended, then it is enough to have only the mday field here. The <rule>/IPA_SDB_INFO_FILE file contains description of the rule. Data for limits is kept in the <rule>/IPA_SDB_LIMITS_DIR directory, data for each limit is stored in the <limit> directory. There are files with yyyymm like names in this directory which contain statistics per year/month. Here year/month means year and month when a limit was started. Each <limit>/yyyymm file contains records with the following format: struct ipa_sdb_date_struct { IPA_SDB_DATE_xxx_SET bits in the set field determine which of fields with ipa_sdb_data type have actual data. start is a date when a limit was started, restart is a date when a limit will be restarted, restart_exec is a date when commands for restarted limit were run, reach is a date when a limit was reached, reach_exec is a date when commands for reached limit were run, expire is a date when a limit will expire, expire_exec is a date when commands for expired limit were run and updated is a date when a limit was updated last time. The year field in the ipa_sdb_date structure is represented in network byte order. l_high and l_low represent value of the limit, c_high and c_low represent value of the limit's counter. These fields have the same format as c_high and c_low fields in the ipa_sdb_rule_record structure. The <limit>/IPA_SDB_INFO_FILE file contains description of the limit. Data for thresholds is kept in the <rule>/IPA_SDB_THRESHOLDS_DIR directory, data for each threshold is stored in the <threshold> directory. The <threshold>/IPA_SDB_THRESHOLD_STATE file contains current threshold's state: struct ipa_sdb_threshold_record { t_high and t_low represent value of the threshold, c_high and c_low represent value of the threshold's counter. These fields have the same format as c_high and c_low fields in the ipa_sdb_rule_record structure. tm_started and tm_updated are two timestamps for the threshold. The <threshold>/IPA_SDB_INFO_FILE file contains description of the threshold. SEE ALSOipa_db_sdb(8), ipa_st_sdb(8), ipa_sdb_dump(8) AUTHORAndrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> BUGSIf you find any, please send email me.
|