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