xref: /freebsd/contrib/ntp/include/ntp_filegen.h (revision 416ba5c74546f32a993436a99516d35008e9f384)
1 /*
2  * ntp_filegen.h,v 3.9 1996/12/01 16:02:45 kardel Exp
3  *
4  * definitions for NTP file generations support
5  *
6  *
7  * Copyright (C) 1992, 1996 by Rainer Pruy
8  * Friedrich-Alexander Universitaet Erlangen-Nuernberg, Germany
9  *
10  * This code may be modified and used freely
11  * provided the credits remain intact.
12  */
13 
14 #include "ntp_types.h"
15 
16 /*
17  * supported file generation types
18  */
19 
20 #define FILEGEN_NONE	255	/* no generations - use plain file name */
21 #define FILEGEN_PID	1	/* one filegen per process incarnation */
22 #define FILEGEN_DAY	2	/* one filegen per day */
23 #define FILEGEN_WEEK	3	/* one filegen per week */
24 #define FILEGEN_MONTH	4	/* one filegen per month */
25 #define FILEGEN_YEAR	5	/* one filegen per year */
26 #define FILEGEN_AGE	6	/* change filegen each FG_AGE_SECS */
27 
28 /*
29  * supported file generation flags
30  */
31 
32 #define FGEN_FLAG_LINK		0x01 /* make a link to base name */
33 
34 #define FGEN_FLAG_ENABLED	0x80 /* set this to really create files	  */
35 				     /* without this, open is suppressed */
36 
37 typedef struct filegen_tag {
38 	FILE *	fp;	/* file referring to current generation */
39 	char *	dir;	/* currently always statsdir */
40 	char *	fname;	/* filename prefix of generation file */
41 			/* must be malloced, will be fed to free() */
42 	u_long	id_lo;	/* lower bound of ident value */
43 	u_long	id_hi;	/* upper bound of ident value */
44 	u_char	type;	/* type of file generation */
45 	u_char	flag;	/* flags modifying processing of file generation */
46 } FILEGEN;
47 
48 extern	void	filegen_setup	(FILEGEN *, u_int32);
49 extern	void	filegen_config	(FILEGEN *, const char *, const char *,
50 				 u_int, u_int);
51 extern	void	filegen_statsdir(void);
52 extern	FILEGEN *filegen_get	(const char *);
53 extern	void	filegen_register (const char *, const char *, FILEGEN *);
54 #ifdef DEBUG
55 extern	void	filegen_unregister(const char *);
56 #endif
57