#define PACKETMAX 1024
/* cf. collectd/src/network.h */
enum {
TYPE_HOST,
TYPE_TIME,
TYPE_PLUGIN,
TYPE_PLUGIN_INSTANCE,
TYPE_TYPE,
TYPE_TYPE_INSTANCE,
TYPE_VALUES,
TYPE_INTERVAL,
};
/* cf. collectd/src/network.h */
enum {
DS_TYPE_COUNTER,
DS_TYPE_GAUGE,
DS_TYPE_DERIVE,
DS_TYPE_ABSOLUTE,
};
typedef struct Packet Packet;
typedef struct Value Value;
struct Packet {
Packet *next;
char *host;
long interval;
long time;
char *plugin;
char *pinst;
char *type;
char *tinst;
Value *head;
Value *tail;
uint nval;
};
struct Value {
Value *next;
int type;
union {
vlong lval;
double dval;
};
};
Packet* palloc(void);
void pfree(Packet*);
void addcounter(Packet*, uvlong);
void addgauge(Packet*, double);
void addderive(Packet*, vlong);
void addabs(Packet*, uvlong);
uint convS2P(Packet*, uchar*, uint);
uint sizeNP2P(uvlong);
uint sizeSP2P(char*);
uint sizeVP2P(uint);
|