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)  

misc.h File Reference
#include "dbsql.h"
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UNITPREFIXCOUNT   7
 

Typedefs

typedef enum RequestType RequestType
 
typedef enum ListType ListType
 

Enumerations

enum  RequestType { RT_Normal = 1 , RT_Estimate , RT_ImageScale }
 
enum  ListType {
  LT_None = 0 , LT_5min , LT_Hour , LT_Day ,
  LT_Month , LT_Year , LT_Top
}
 

Functions

int spacecheck (const char *path)
 
void sighandler (int sig)
 
uint64_t getbtime (void)
 
char * getvalue (const uint64_t bytes, const int len, const RequestType type)
 
int getunitspacing (const int len, const int index)
 
char * gettrafficrate (const uint64_t bytes, const time_t interval, const int len)
 
const char * getunitprefix (const int index)
 
const char * getrateunitprefix (const int unitmode, const int index)
 
uint64_t getunitdivisor (const int unitmode, const int index)
 
int getunit (void)
 
char * getratestring (const uint64_t rate, const int len, const int declen)
 
int getratespacing (const int len, const int unitmode, const int unitindex)
 
int getpadding (const int len, const char *str)
 
void cursortocolumn (const int column)
 
void cursorhide (void)
 
void cursorshow (void)
 
void eraseline (void)
 
int validatedatetime (const char *str)
 
int issametimeslot (const ListType listtype, const time_t entry, const time_t updated)
 
uint64_t getperiodseconds (const ListType listtype, const time_t entry, const time_t updated, const short isongoing)
 
void getestimates (uint64_t *rx, uint64_t *tx, const ListType listtype, const time_t updated, dbdatalist **dbdata)
 
int ishelprequest (const char *arg)
 

Macro Definition Documentation

◆ UNITPREFIXCOUNT

#define UNITPREFIXCOUNT   7

Definition at line 4 of file misc.h.

Typedef Documentation

◆ ListType

typedef enum ListType ListType

◆ RequestType

typedef enum RequestType RequestType

Enumeration Type Documentation

◆ ListType

enum ListType
Enumerator
LT_None 
LT_5min 
LT_Hour 
LT_Day 
LT_Month 
LT_Year 
LT_Top 

Definition at line 14 of file misc.h.

◆ RequestType

Enumerator
RT_Normal 
RT_Estimate 
RT_ImageScale 

Definition at line 8 of file misc.h.

Function Documentation

◆ cursorhide()

void cursorhide ( void  )

Definition at line 341 of file misc.c.

Referenced by livetrafficmeter().

◆ cursorshow()

void cursorshow ( void  )

Definition at line 346 of file misc.c.

Referenced by livetrafficmeter().

◆ cursortocolumn()

void cursortocolumn ( const int  column)

Definition at line 336 of file misc.c.

Referenced by livetrafficmeter(), and trafficmeter().

◆ eraseline()

void eraseline ( void  )

Definition at line 351 of file misc.c.

Referenced by livetrafficmeter(), and trafficmeter().

◆ getbtime()

uint64_t getbtime ( void  )

Definition at line 89 of file misc.c.

References debug, errorstring, noexit, printe(), and PT_Error.

Referenced by detectboot().

◆ getestimates()

void getestimates ( uint64_t *  rx,
uint64_t *  tx,
const ListType  listtype,
const time_t  updated,
dbdatalist **  dbdata 
)

◆ getpadding()

int getpadding ( const int  len,
const char *  str 
)

Definition at line 320 of file misc.c.

References cfg, and CFG::utflocale.

Referenced by drawlist(), drawsummary_digest(), showlist(), and showsummary().

◆ getperiodseconds()

uint64_t getperiodseconds ( const ListType  listtype,
const time_t  entry,
const time_t  updated,
const short  isongoing 
)

Definition at line 453 of file misc.c.

References dmonth(), isleapyear(), LT_5min, LT_Day, LT_Hour, LT_Month, LT_Top, LT_Year, and mosecs().

Referenced by drawlist(), showalert(), and showlist().

◆ getratespacing()

int getratespacing ( const int  len,
const int  unitmode,
const int  unitindex 
)

Definition at line 308 of file misc.c.

References getrateunitprefix().

Referenced by getratestring().

◆ getratestring()

char * getratestring ( const uint64_t  rate,
const int  len,
const int  declen 
)

Definition at line 282 of file misc.c.

References DECCONV, getratespacing(), getrateunitprefix(), getunit(), getunitdivisor(), and UNITPREFIXCOUNT.

Referenced by gettrafficrate().

◆ getrateunitprefix()

const char * getrateunitprefix ( const int  unitmode,
const int  index 
)

Definition at line 238 of file misc.c.

References UNITPREFIXCOUNT.

Referenced by getimagescale(), getratespacing(), and getratestring().

◆ gettrafficrate()

char * gettrafficrate ( const uint64_t  bytes,
const time_t  interval,
const int  len 
)

◆ getunit()

int getunit ( void  )

Definition at line 269 of file misc.c.

References cfg, CFG::rateunit, CFG::rateunitmode, and CFG::unitmode.

Referenced by getimagescale(), getimagevalue(), getratestring(), and getscale().

◆ getunitdivisor()

uint64_t getunitdivisor ( const int  unitmode,
const int  index 
)

Definition at line 256 of file misc.c.

References UNITPREFIXCOUNT.

Referenced by getimagevalue(), getratestring(), getvalue(), and parsealertargs().

◆ getunitprefix()

const char * getunitprefix ( const int  index)

Definition at line 222 of file misc.c.

References cfg, CFG::unitmode, and UNITPREFIXCOUNT.

Referenced by getimagescale(), getunitspacing(), getvalue(), parsealertargs(), and showhours().

◆ getunitspacing()

int getunitspacing ( const int  len,
const int  index 
)

Definition at line 189 of file misc.c.

References getunitprefix().

Referenced by getvalue().

◆ getvalue()

char * getvalue ( const uint64_t  bytes,
const int  len,
const RequestType  type 
)

◆ ishelprequest()

int ishelprequest ( const char *  arg)

Definition at line 553 of file misc.c.

Referenced by parsealertargs(), and parseargs().

◆ issametimeslot()

int issametimeslot ( const ListType  listtype,
const time_t  entry,
const time_t  updated 
)

Definition at line 403 of file misc.c.

References LT_5min, LT_Day, LT_Hour, LT_Month, LT_None, LT_Top, and LT_Year.

Referenced by drawfiveminutes(), drawlist(), showlist(), and showsummary().

◆ sighandler()

void sighandler ( int  sig)

Definition at line 61 of file misc.c.

References debug, errorstring, intsignal, printe(), and PT_Info.

Referenced by livetrafficmeter(), and setsignaltraps().

◆ spacecheck()

int spacecheck ( const char *  path)

Definition at line 20 of file misc.c.

References cfg, debug, errorstring, noexit, printe(), PT_Error, and CFG::spacecheck.

Referenced by db_open(), handleaddinterface(), and preparedatabase().

◆ validatedatetime()

int validatedatetime ( const char *  str)

Definition at line 357 of file misc.c.

Referenced by parseargs().