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