summaryrefslogtreecommitdiff
path: root/usr/src/cmd/lp/lib/papi/papi_impl.h
blob: d2359f4e7342e1dfdb386d5413aff3c8d2cc9cbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _PAPI_IMPL_H
#define	_PAPI_IMPL_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#include <papi.h>

#ifdef __cplusplus
extern "C" {
#endif

#include <time.h>
#include <sys/types.h>
#include <stdarg.h>

/* lpsched include files */
#include <lp.h>
#include <msgs.h>
#include <printers.h>
#include <requests.h>


/*
 * Implementation specific types/prototypes/definitions follow
 *
 *
 * Ex:
 */

typedef struct {
	papi_attribute_t **attributes;
	int (*authCB)(papi_service_t svc);
	void *app_data;
	MESG *md;
	char *msgbuf;
	size_t msgbuf_size;
} service_t;

typedef struct job {
	papi_attribute_t **attributes;	/* job attributes */
} job_t;

typedef struct {
	papi_attribute_t **attributes;	/* queue attributes */
} printer_t;

typedef struct {
	int fd;
	REQUEST *request;
	char *meta_data_file;
	char added;
} job_stream_t;

extern void lpsched_read_job_configuration(service_t *svc, job_t *j,
				char *file);
extern void lpsched_request_to_job(REQUEST *r, job_t *j);

extern void job_status_to_attributes(job_t *job, char *req_id, char *user,
				char *slabel, size_t size, time_t date,
				short state, char *destination, char *form,
				char *charset, short rank, char *file);
extern papi_status_t addLPString(papi_attribute_t ***list,
					int flags, char *name, char *value);
extern papi_status_t addLPStrings(papi_attribute_t ***list,
					int flags, char *name, char **values);
extern papi_status_t lpsched_printer_configuration_to_attributes(
				service_t *svc, printer_t *p, char *dest);
extern papi_status_t lpsched_class_configuration_to_attributes(service_t *svc,
	printer_t *p, char *dest);
extern papi_status_t class_status_to_attributes(printer_t *p, char *printer,
	short status, char *reject_reason, long reject_date);
extern papi_status_t lpsched_disable_printer(papi_service_t svc,
	const char *printer, const char *message);
extern papi_status_t lpsched_enable_printer(papi_service_t svc,
	const char *printer);
extern papi_status_t lpsched_status_to_papi_status(int status);
extern papi_status_t job_attributes_to_lpsched_request(papi_service_t svc,
	REQUEST *r, papi_attribute_t **attributes);
extern papi_status_t lpsched_alloc_files(papi_service_t svc, int number,
	char **prefix);
extern papi_status_t lpsched_commit_job(papi_service_t svc, char *job,
	char **tmp);
extern papi_status_t lpsched_start_change(papi_service_t svc,
	const char *printer, int32_t job_id, char **tmp);
extern papi_status_t lpsched_end_change(papi_service_t svc,
	const char *printer, int32_t job_id);
extern papi_status_t printer_status_to_attributes(printer_t *p, char *printer,
	char *form, char *character_set, char *reject_reason,
	char *disable_reason, short status, char *request_id, long enable_date,
	long reject_date);

extern void lpsched_service_information(printer_t *p);
extern void lpsched_request_to_job_attributes(REQUEST *r, job_t *j);
extern void detailed_error(service_t *svc, char *fmt, ...);
extern char *banner_type(unsigned short banner);
extern char *mime_type_to_lp_type(char *mime_type);
extern char *lp_type_to_mime_type(char *lp_type);
extern char *fifo_name_from_uri(const char *uri);
extern char *printer_name_from_uri_id(const char *uri, int32_t id);

extern int snd_msg(service_t *svc, int type, ...);
extern int rcv_msg(service_t *svc, int type, ...);

extern int list_append();
extern void list_remove();



#ifdef __cplusplus
}
#endif

#endif /* _PAPI_IMPL_H */