xref: /freebsd/usr.sbin/lpr/common_source/ctlinfo.h (revision 1f589b473781e5dd070b60dd1e465b58d7102bf8)
1442e0eafSGarance A Drosehn /*
2442e0eafSGarance A Drosehn  * ------+---------+---------+---------+---------+---------+---------+---------*
3442e0eafSGarance A Drosehn  * Copyright (c) 2001  - Garance Alistair Drosehn <gad@FreeBSD.org>.
4442e0eafSGarance A Drosehn  * All rights reserved.
5442e0eafSGarance A Drosehn  *
6442e0eafSGarance A Drosehn  * Redistribution and use in source and binary forms, with or without
7442e0eafSGarance A Drosehn  * modification, are permitted provided that the following conditions
8442e0eafSGarance A Drosehn  * are met:
9442e0eafSGarance A Drosehn  *   1. Redistributions of source code must retain the above copyright
10442e0eafSGarance A Drosehn  *      notice, this list of conditions and the following disclaimer.
11442e0eafSGarance A Drosehn  *   2. Redistributions in binary form must reproduce the above copyright
12442e0eafSGarance A Drosehn  *      notice, this list of conditions and the following disclaimer in the
13442e0eafSGarance A Drosehn  *      documentation and/or other materials provided with the distribution.
14442e0eafSGarance A Drosehn  *
15442e0eafSGarance A Drosehn  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16442e0eafSGarance A Drosehn  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17442e0eafSGarance A Drosehn  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18442e0eafSGarance A Drosehn  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19442e0eafSGarance A Drosehn  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20442e0eafSGarance A Drosehn  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21442e0eafSGarance A Drosehn  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22442e0eafSGarance A Drosehn  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23442e0eafSGarance A Drosehn  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24442e0eafSGarance A Drosehn  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25442e0eafSGarance A Drosehn  * SUCH DAMAGE.
26442e0eafSGarance A Drosehn  *
27442e0eafSGarance A Drosehn  * The views and conclusions contained in the software and documentation
28442e0eafSGarance A Drosehn  * are those of the authors and should not be interpreted as representing
29442e0eafSGarance A Drosehn  * official policies, either expressed or implied, of the FreeBSD Project.
30442e0eafSGarance A Drosehn  *
31442e0eafSGarance A Drosehn  * ------+---------+---------+---------+---------+---------+---------+---------*
32442e0eafSGarance A Drosehn  * $FreeBSD$
33442e0eafSGarance A Drosehn  * ------+---------+---------+---------+---------+---------+---------+---------*
34442e0eafSGarance A Drosehn  */
35442e0eafSGarance A Drosehn 
36442e0eafSGarance A Drosehn /*
37442e0eafSGarance A Drosehn  * ctlinfo - This collection of routines will know everything there is to
38442e0eafSGarance A Drosehn  * know about the information inside a control file ('cf*') which is used
39442e0eafSGarance A Drosehn  * to describe a print job in lpr & friends.  The eventual goal is that it
40442e0eafSGarance A Drosehn  * will be the ONLY source file to know what's inside these control-files.
41442e0eafSGarance A Drosehn  */
42442e0eafSGarance A Drosehn 
43442e0eafSGarance A Drosehn struct cjprivate;			/* used internal to ctl* routines */
44442e0eafSGarance A Drosehn 
45442e0eafSGarance A Drosehn struct cjobinfo {
46442e0eafSGarance A Drosehn 	int	 cji_dfcount;		/* number of data files to print */
47442e0eafSGarance A Drosehn 	int	 cji_uncount;		/* number of unlink-file requests */
48442e0eafSGarance A Drosehn 	char	*cji_accthost;		/* the host that this job came from,
49442e0eafSGarance A Drosehn 					 * for accounting purposes (usually
50442e0eafSGarance A Drosehn 					 * the host where the original 'lpr'
51442e0eafSGarance A Drosehn 					 * was done) */
52442e0eafSGarance A Drosehn 	char	*cji_acctuser;		/* userid who should be charged for
53442e0eafSGarance A Drosehn 					 * this job (usually, the userid which
54442e0eafSGarance A Drosehn 					 * did the original 'lpr') */
55442e0eafSGarance A Drosehn 	char	*cji_class;		/* class-name */
56442e0eafSGarance A Drosehn 	char	*cji_curqueue;		/* printer-queue that this cf-file is
57442e0eafSGarance A Drosehn 					 * curently sitting in (mainly used
58442e0eafSGarance A Drosehn 					 * in syslog error messages) */
59442e0eafSGarance A Drosehn 	char	*cji_fname;		/* filename of the control file */
60442e0eafSGarance A Drosehn 	char	*cji_jobname;		/* job-name (for banner) */
61442e0eafSGarance A Drosehn 	char	*cji_mailto;		/* userid to send email to (or null) */
62442e0eafSGarance A Drosehn 	char	*cji_username;		/* "literal" user-name (for banner) or
63442e0eafSGarance A Drosehn 					 * NULL if no banner-page is wanted */
64442e0eafSGarance A Drosehn 	struct cjprivate *cji_priv;
65442e0eafSGarance A Drosehn };
66442e0eafSGarance A Drosehn 
671f589b47SGarance A Drosehn #include "lp.cdefs.h"		/* A cross-platform version of <sys/cdefs.h> */
68442e0eafSGarance A Drosehn 
69442e0eafSGarance A Drosehn __BEGIN_DECLS
70d6771428SGarance A Drosehn void		 ctl_freeinf(struct cjobinfo *_cjinf);
71d6771428SGarance A Drosehn struct cjobinfo	*ctl_readcf(const char *_ptrname, const char *_cfname);
72442e0eafSGarance A Drosehn char		*ctl_renametf(const char *_ptrname, const char *_tfname);
73442e0eafSGarance A Drosehn __END_DECLS
74