xref: /freebsd/usr.sbin/lpr/common_source/ctlinfo.h (revision 05d85d77812429b83839c71b83c540fc422ae1ba)
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  * $FreeBSD$
35442e0eafSGarance A Drosehn  * ------+---------+---------+---------+---------+---------+---------+---------*
36442e0eafSGarance A Drosehn  */
37442e0eafSGarance A Drosehn 
38442e0eafSGarance A Drosehn /*
39442e0eafSGarance A Drosehn  * ctlinfo - This collection of routines will know everything there is to
40442e0eafSGarance A Drosehn  * know about the information inside a control file ('cf*') which is used
41442e0eafSGarance A Drosehn  * to describe a print job in lpr & friends.  The eventual goal is that it
42442e0eafSGarance A Drosehn  * will be the ONLY source file to know what's inside these control-files.
43442e0eafSGarance A Drosehn  */
44442e0eafSGarance A Drosehn 
45442e0eafSGarance A Drosehn struct cjprivate;			/* used internal to ctl* routines */
46442e0eafSGarance A Drosehn 
47442e0eafSGarance A Drosehn struct cjobinfo {
48442e0eafSGarance A Drosehn 	int	 cji_dfcount;		/* number of data files to print */
49442e0eafSGarance A Drosehn 	int	 cji_uncount;		/* number of unlink-file requests */
50442e0eafSGarance A Drosehn 	char	*cji_accthost;		/* the host that this job came from,
51442e0eafSGarance A Drosehn 					 * for accounting purposes (usually
52442e0eafSGarance A Drosehn 					 * the host where the original 'lpr'
53442e0eafSGarance A Drosehn 					 * was done) */
54442e0eafSGarance A Drosehn 	char	*cji_acctuser;		/* userid who should be charged for
55442e0eafSGarance A Drosehn 					 * this job (usually, the userid which
56442e0eafSGarance A Drosehn 					 * did the original 'lpr') */
57442e0eafSGarance A Drosehn 	char	*cji_class;		/* class-name */
58442e0eafSGarance A Drosehn 	char	*cji_curqueue;		/* printer-queue that this cf-file is
59*05d85d77SElyes Haouas 					 * currently sitting in (mainly used
60442e0eafSGarance A Drosehn 					 * in syslog error messages) */
61442e0eafSGarance A Drosehn 	char	*cji_fname;		/* filename of the control file */
62442e0eafSGarance A Drosehn 	char	*cji_jobname;		/* job-name (for banner) */
63442e0eafSGarance A Drosehn 	char	*cji_mailto;		/* userid to send email to (or null) */
64ad1f7851SGarance A Drosehn 	char	*cji_headruser;		/* "literal" user-name (for banner) or
65442e0eafSGarance A Drosehn 					 * NULL if no banner-page is wanted */
66442e0eafSGarance A Drosehn 	struct cjprivate *cji_priv;
67442e0eafSGarance A Drosehn };
68442e0eafSGarance A Drosehn 
691f589b47SGarance A Drosehn #include "lp.cdefs.h"		/* A cross-platform version of <sys/cdefs.h> */
70442e0eafSGarance A Drosehn 
71442e0eafSGarance A Drosehn __BEGIN_DECLS
72d6771428SGarance A Drosehn void		 ctl_freeinf(struct cjobinfo *_cjinf);
73d6771428SGarance A Drosehn struct cjobinfo	*ctl_readcf(const char *_ptrname, const char *_cfname);
74442e0eafSGarance A Drosehn char		*ctl_renametf(const char *_ptrname, const char *_tfname);
75442e0eafSGarance A Drosehn __END_DECLS
76