Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/src/collectd/network.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#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);

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.