-
Notifications
You must be signed in to change notification settings - Fork 32
/
cupsmodule.h
116 lines (99 loc) · 3.75 KB
/
cupsmodule.h
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
/*
* cups - Python bindings for CUPS
* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013, 2014 Tim Waugh <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef HAVE_CUPSMODULE_H
#define HAVE_CUPSMODULE_H
#include <cups/cups.h>
#include <cups/language.h>
#include <cups/adminutil.h>
/* GCC attributes */
#if !defined(__GNUC__) || __GNUC__ < 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define FORMAT(x)
#else /* GNU C: */
# define FORMAT(x) __attribute__ ((__format__ x))
#endif
extern void debugprintf (const char *fmt, ...) FORMAT ((__printf__, 1, 2));
#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
#define HAVE_CUPS_1_2 1
#endif
#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 3)
#define HAVE_CUPS_1_3 1
#else
#define cupsAdminGetServerSettings _cupsAdminGetServerSettings
#define cupsAdminSetServerSettings _cupsAdminSetServerSettings
#endif
#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 4)
#define HAVE_CUPS_1_4 1
#endif
#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 5)
#define HAVE_CUPS_1_5 1
#endif
#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 6)
#define HAVE_CUPS_1_6 1
#endif
#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 7)
#define HAVE_CUPS_1_7 1
#endif
#ifndef HAVE_CUPS_1_2
#error pycups requires CUPS 1.2.x
#endif
struct TLS
{
PyObject *cups_password_callback;
#ifdef HAVE_CUPS_1_4
PyObject *cups_password_callback_context;
#else /* !HAVE_CUPS_1_4 */
void *g_current_connection;
#endif /* !HAVE_CUPS_1_4 */
};
extern struct TLS *get_TLS (void);
#ifdef HAVE_CUPS_1_6
typedef struct
{
PyObject *cb;
PyObject *user_data;
} CallbackContext;
#endif /* HAVE_CUPS_1_6 */
#ifndef HAVE_CUPS_1_6
int ippGetBoolean(ipp_attribute_t *attr, int element);
int ippGetCount(ipp_attribute_t *attr);
ipp_tag_t ippGetGroupTag(ipp_attribute_t *attr);
int ippGetInteger(ipp_attribute_t *attr, int element);
const char * ippGetName(ipp_attribute_t *attr);
ipp_op_t ippGetOperation(ipp_t *ipp);
int ippGetRange(ipp_attribute_t *attr, int element, int *uppervalue);
int ippGetResolution(ipp_attribute_t *attr, int element,
int *yres, ipp_res_t *units);
ipp_status_t ippGetStatusCode(ipp_t *ipp);
const char * ippGetString(ipp_attribute_t *attr, int element,
const char **language);
ipp_tag_t ippGetValueTag(ipp_attribute_t *attr);
ipp_attribute_t * ippFirstAttribute(ipp_t *ipp);
ipp_attribute_t * ippNextAttribute(ipp_t *ipp);
int ippSetInteger(ipp_t *ipp, ipp_attribute_t **attr,
int element, int intvalue);
int ippSetOperation(ipp_t *ipp, ipp_op_t op);
ipp_state_t ippGetState(ipp_t *ipp);
int ippSetState(ipp_t *ipp, ipp_state_t state);
int ippSetStatusCode(ipp_t *ipp, ipp_status_t status);
int ippSetString(ipp_t *ipp, ipp_attribute_t **attr,
int element, const char *strvalue);
#endif
extern const char * UTF8_from_PyObj (char **const utf8, PyObject *obj);
#endif /* HAVE_CUPSMODULE_H */