]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/cups.h
Merge changes from 1.1.x into 1.2 devel.
[thirdparty/cups.git] / cups / cups.h
CommitLineData
d853e109 1/*
753453e4 2 * "$Id: cups.h,v 1.32.2.2 2001/12/26 16:52:11 mike Exp $"
d853e109 3 *
3a193f5e 4 * API definitions for the Common UNIX Printing System (CUPS).
d853e109 5 *
d2935a0f 6 * Copyright 1997-2001 by Easy Software Products.
d853e109 7 *
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
13 * at:
14 *
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
58ec2a95 17 * 44141 Airport View Drive, Suite 204
d853e109 18 * Hollywood, Maryland 20636-3111 USA
19 *
20 * Voice: (301) 373-9603
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
d853e109 23 */
24
3a193f5e 25#ifndef _CUPS_CUPS_H_
26# define _CUPS_CUPS_H_
27
d853e109 28/*
29 * Include necessary headers...
30 */
31
183914a3 32# include "ipp.h"
33# include "ppd.h"
3a193f5e 34
35
36/*
37 * C++ magic...
38 */
39
91e6c295 40# ifdef __cplusplus
3a193f5e 41extern "C" {
91e6c295 42# endif /* __cplusplus */
3a193f5e 43
44
45/*
46 * Constants...
47 */
48
753453e4 49# define CUPS_VERSION 1.0200
3a193f5e 50# define CUPS_DATE_ANY -1
51
52
53/*
54 * Types and structures...
55 */
56
38bea099 57typedef unsigned cups_ptype_t; /**** Printer Type/Capability Bits ****/
58enum /* Not a typedef'd enum so we can OR */
3a193f5e 59{
7551914d 60 CUPS_PRINTER_LOCAL = 0x0000, /* Local printer or class */
3a193f5e 61 CUPS_PRINTER_CLASS = 0x0001, /* Printer class */
62 CUPS_PRINTER_REMOTE = 0x0002, /* Remote printer or class */
63 CUPS_PRINTER_BW = 0x0004, /* Can do B&W printing */
64 CUPS_PRINTER_COLOR = 0x0008, /* Can do color printing */
65 CUPS_PRINTER_DUPLEX = 0x0010, /* Can do duplexing */
66 CUPS_PRINTER_STAPLE = 0x0020, /* Can staple output */
67 CUPS_PRINTER_COPIES = 0x0040, /* Can do copies */
68 CUPS_PRINTER_COLLATE = 0x0080, /* Can collage copies */
69 CUPS_PRINTER_PUNCH = 0x0100, /* Can punch output */
70 CUPS_PRINTER_COVER = 0x0200, /* Can cover output */
71 CUPS_PRINTER_BIND = 0x0400, /* Can bind output */
72 CUPS_PRINTER_SORT = 0x0800, /* Can sort output */
73 CUPS_PRINTER_SMALL = 0x1000, /* Can do Letter/Legal/A4 */
74 CUPS_PRINTER_MEDIUM = 0x2000, /* Can do Tabloid/B/C/A3/A2 */
75 CUPS_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */
c67ca4ce 76 CUPS_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */
c1a915db 77 CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */
183914a3 78 CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */
c1a915db 79 CUPS_PRINTER_OPTIONS = 0xfffc /* ~(CLASS | REMOTE | IMPLICIT) */
38bea099 80};
3a193f5e 81
3b960317 82typedef struct /**** Printer Options ****/
3a193f5e 83{
f4671380 84 char *name; /* Name of option */
85 char *value; /* Value of option */
50146867 86} cups_option_t;
87
bf23e338 88typedef struct /**** Destination ****/
89{
7a04198c 90 char *name, /* Printer or class name */
7bfde0bb 91 *instance; /* Local instance name or NULL */
bf23e338 92 int is_default; /* Is this printer the default? */
93 int num_options; /* Number of options */
94 cups_option_t *options; /* Options */
95} cups_dest_t;
96
b5cb0608 97typedef struct /**** Job ****/
98{
99 int id; /* The job ID */
100 char *dest, /* Printer or class name */
101 *title, /* Title/job name */
102 *user, /* User the submitted the job */
103 *format; /* Document format */
104 ipp_jstate_t state; /* Job state */
105 int size, /* Size in kilobytes */
106 priority; /* Priority (1-100) */
107 time_t completed_time, /* Time the job was completed */
108 creation_time, /* Time the job was created */
109 processing_time; /* Time the job was processed */
110} cups_job_t;
111
112
3a193f5e 113/*
114 * Functions...
115 */
116
063e1ac7 117extern int cupsCancelJob(const char *printer, int job);
3270670b 118#define cupsDoRequest(http,request,resource) cupsDoFileRequest((http),(request),(resource),NULL)
119extern ipp_t *cupsDoFileRequest(http_t *http, ipp_t *request,
063e1ac7 120 const char *resource, const char *filename);
2a0ef17a 121extern http_encryption_t cupsEncryption(void);
b5cb0608 122extern void cupsFreeJobs(int num_jobs, cups_job_t *jobs);
3b960317 123extern int cupsGetClasses(char ***classes);
063e1ac7 124extern const char *cupsGetDefault(void);
b5cb0608 125extern int cupsGetJobs(cups_job_t **jobs, const char *dest,
126 int myjobs, int completed);
063e1ac7 127extern const char *cupsGetPPD(const char *printer);
3b960317 128extern int cupsGetPrinters(char ***printers);
8b06ca19 129extern ipp_status_t cupsLastError(void);
063e1ac7 130extern int cupsPrintFile(const char *printer, const char *filename,
131 const char *title, int num_options,
132 cups_option_t *options);
501b59e2 133extern int cupsPrintFiles(const char *printer, int num_files,
134 const char **files, const char *title,
135 int num_options, cups_option_t *options);
8fc2907d 136extern char *cupsTempFile(char *filename, int len);
1b5bf964 137extern int cupsTempFd(char *filename, int len);
bf23e338 138
f4671380 139extern int cupsAddDest(const char *name, const char *instance,
140 int num_dests, cups_dest_t **dests);
141extern void cupsFreeDests(int num_dests, cups_dest_t *dests);
142extern cups_dest_t *cupsGetDest(const char *name, const char *instance,
143 int num_dests, cups_dest_t *dests);
bf23e338 144extern int cupsGetDests(cups_dest_t **dests);
f4671380 145extern void cupsSetDests(int num_dests, cups_dest_t *dests);
bf23e338 146
063e1ac7 147extern int cupsAddOption(const char *name, const char *value,
148 int num_options, cups_option_t **options);
183914a3 149extern void cupsEncodeOptions(ipp_t *ipp, int num_options,
150 cups_option_t *options);
3b960317 151extern void cupsFreeOptions(int num_options, cups_option_t *options);
063e1ac7 152extern const char *cupsGetOption(const char *name, int num_options,
3b960317 153 cups_option_t *options);
063e1ac7 154extern int cupsParseOptions(const char *arg, int num_options,
4a73831b 155 cups_option_t **options);
58ec2a95 156extern int cupsMarkOptions(ppd_file_t *ppd, int num_options,
157 cups_option_t *options);
50146867 158
063e1ac7 159extern const char *cupsGetPassword(const char *prompt);
160extern const char *cupsServer(void);
2a0ef17a 161extern void cupsSetEncryption(http_encryption_t e);
c68b6ae8 162extern void cupsSetPasswordCB(const char *(*cb)(const char *));
163extern void cupsSetServer(const char *server);
164extern void cupsSetUser(const char *user);
063e1ac7 165extern const char *cupsUser(void);
6b67a15e 166
91e6c295 167# ifdef __cplusplus
3a193f5e 168}
91e6c295 169# endif /* __cplusplus */
d853e109 170
3a193f5e 171#endif /* !_CUPS_CUPS_H_ */
d853e109 172
173/*
753453e4 174 * End of "$Id: cups.h,v 1.32.2.2 2001/12/26 16:52:11 mike Exp $".
d853e109 175 */