"Fossies" - the Fresh Open Source Software Archive

Member "vnstat-2.9/src/dbaccess.h" (16 Sep 2019, 1243 Bytes) of package /linux/misc/vnstat-2.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "dbaccess.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.4_vs_2.5.

    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
   16 typedef struct {
   17     time_t date;
   18     uint64_t rx, tx;
   19 } HOUR;
   20 
   21 typedef struct {
   22     time_t date;
   23     uint64_t rx, tx;
   24     int rxk, txk;
   25     int used;
   26 } DAY;
   27 
   28 typedef struct {
   29     time_t month;
   30     uint64_t rx, tx;
   31     int rxk, txk;
   32     int used;
   33 } MONTH;
   34 
   35 /* legacy database structure */
   36 typedef struct {
   37     int version;
   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 
   54 int importlegacydb(const char *iface, const char *dirname);
   55 int insertlegacydata(DATA *data, const char *iface);
   56 int readdb(DATA *data, const char *iface, const char *dirname, const int force);
   57 void initdb(DATA *data);
   58 int validatedb(DATA *data);
   59 
   60 #endif