vnstat  2.9
About: vnStat is a console-based network traffic monitor (using the /proc filesystem).
  Fossies Dox: vnstat-2.9.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

dbaccess.h
Go to the documentation of this file.
1#ifndef DBACCESS_H
2#define DBACCESS_H
3
4/* legacy database version */
5/* import is supported only from version 3 */
6/* 1 = 1.0, 2 = 1.1-1.2, 3 = 1.3-1.8 */
7#define LEGACYDBVERSION 3
8
9/* all structs below are used for supporting data import */
10/* from the legacy database format => don't modify */
11
12#if defined(__clang__)
13#pragma clang diagnostic push
14#pragma clang diagnostic ignored "-Wpadded"
15#endif
16typedef struct {
17 time_t date;
18 uint64_t rx, tx;
19} HOUR;
20
21typedef struct {
22 time_t date;
23 uint64_t rx, tx;
24 int rxk, txk;
25 int used;
26} DAY;
27
28typedef struct {
29 time_t month;
30 uint64_t rx, tx;
31 int rxk, txk;
32 int used;
33} MONTH;
34
35/* legacy database structure */
36typedef struct {
38 char interface[32];
39 char nick[32];
40 int active;
41 uint64_t totalrx, totaltx, currx, curtx;
42 int totalrxk, totaltxk;
43 time_t lastupdated, created;
44 DAY day[30];
45 MONTH month[12];
46 DAY top10[10];
47 HOUR hour[24];
48 uint64_t btime;
49} DATA;
50#if defined(__clang__)
51#pragma clang diagnostic pop
52#endif
53
54int importlegacydb(const char *iface, const char *dirname);
55int insertlegacydata(DATA *data, const char *iface);
56int readdb(DATA *data, const char *iface, const char *dirname, const int force);
57void initdb(DATA *data);
58int validatedb(DATA *data);
59
60#endif
int insertlegacydata(DATA *data, const char *iface)
Definition: dbaccess.c:31
void initdb(DATA *data)
Definition: dbaccess.c:273
int validatedb(DATA *data)
Definition: dbaccess.c:348
int readdb(DATA *data, const char *iface, const char *dirname, const int force)
Definition: dbaccess.c:138
int importlegacydb(const char *iface, const char *dirname)
Definition: dbaccess.c:5
Definition: dbaccess.h:36
int totalrxk
Definition: dbaccess.h:42
int version
Definition: dbaccess.h:37
uint64_t currx
Definition: dbaccess.h:41
uint64_t btime
Definition: dbaccess.h:48
time_t created
Definition: dbaccess.h:43
int active
Definition: dbaccess.h:40
Definition: dbaccess.h:21
time_t date
Definition: dbaccess.h:22
uint64_t rx
Definition: dbaccess.h:23
int used
Definition: dbaccess.h:25
int rxk
Definition: dbaccess.h:24
Definition: dbaccess.h:16
uint64_t rx
Definition: dbaccess.h:18
time_t date
Definition: dbaccess.h:17
Definition: dbaccess.h:28
uint64_t rx
Definition: dbaccess.h:30
time_t month
Definition: dbaccess.h:29
int used
Definition: dbaccess.h:32
int rxk
Definition: dbaccess.h:31