]>
Commit | Line | Data |
---|---|---|
fa73b229 | 1 | /* |
7e86f2f6 | 2 | * Private IPP definitions for CUPS. |
fa73b229 | 3 | * |
fd96ad89 MS |
4 | * Copyright © 2007-2018 by Apple Inc. |
5 | * Copyright © 1997-2006 by Easy Software Products. | |
fa73b229 | 6 | * |
fd96ad89 MS |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
8 | * information. | |
fa73b229 | 9 | */ |
10 | ||
11 | #ifndef _CUPS_IPP_PRIVATE_H_ | |
12 | # define _CUPS_IPP_PRIVATE_H_ | |
13 | ||
14 | /* | |
15 | * Include necessary headers... | |
16 | */ | |
17 | ||
fd96ad89 | 18 | # include <cups/cups.h> |
fa73b229 | 19 | |
20 | ||
21 | /* | |
22 | * C++ magic... | |
23 | */ | |
24 | ||
25 | # ifdef __cplusplus | |
26 | extern "C" { | |
27 | # endif /* __cplusplus */ | |
28 | ||
29 | ||
1f6f3dbc MS |
30 | /* |
31 | * Constants... | |
32 | */ | |
33 | ||
34 | # define IPP_BUF_SIZE (IPP_MAX_LENGTH + 2) | |
35 | /* Size of buffer */ | |
36 | ||
37 | ||
8ca02f3c | 38 | /* |
39 | * Structures... | |
40 | */ | |
41 | ||
42 | typedef struct /**** Attribute mapping data ****/ | |
43 | { | |
5a738aea | 44 | int multivalue; /* Option has multiple values? */ |
8ca02f3c | 45 | const char *name; /* Option/attribute name */ |
46 | ipp_tag_t value_tag; /* Value tag for this attribute */ | |
47 | ipp_tag_t group_tag; /* Group tag for this attribute */ | |
dcb445bc MS |
48 | ipp_tag_t alt_group_tag; /* Alternate group tag for this |
49 | * attribute */ | |
a469f8a5 | 50 | const ipp_op_t *operations; /* Allowed operations for this attr */ |
8ca02f3c | 51 | } _ipp_option_t; |
52 | ||
fd96ad89 MS |
53 | typedef struct _ipp_file_s _ipp_file_t;/**** File Parser ****/ |
54 | typedef struct _ipp_vars_s _ipp_vars_t;/**** Variables ****/ | |
55 | ||
a166e933 MS |
56 | typedef int (*_ipp_fattr_cb_t)(_ipp_file_t *f, void *user_data, const char *attr); |
57 | /**** File Attribute (Filter) Callback ****/ | |
fd96ad89 MS |
58 | typedef int (*_ipp_ferror_cb_t)(_ipp_file_t *f, void *user_data, const char *error); |
59 | /**** File Parser Error Callback ****/ | |
60 | typedef int (*_ipp_ftoken_cb_t)(_ipp_file_t *f, _ipp_vars_t *v, void *user_data, const char *token); | |
61 | /**** File Parser Token Callback ****/ | |
62 | ||
63 | struct _ipp_vars_s /**** Variables ****/ | |
64 | { | |
65 | char *uri, /* URI for printer */ | |
66 | scheme[64], /* Scheme from URI */ | |
67 | username[256], /* Username from URI */ | |
68 | *password, /* Password from URI (if any) */ | |
69 | host[256], /* Hostname from URI */ | |
70 | portstr[32], /* Port number string */ | |
71 | resource[1024]; /* Resource path from URI */ | |
72 | int port; /* Port number from URI */ | |
fd96ad89 MS |
73 | int num_vars; /* Number of variables */ |
74 | cups_option_t *vars; /* Array of variables */ | |
75 | int password_tries; /* Number of retries for password */ | |
a166e933 MS |
76 | _ipp_fattr_cb_t attrcb; /* Attribute (filter) callback */ |
77 | _ipp_ferror_cb_t errorcb; /* Error callback */ | |
78 | _ipp_ftoken_cb_t tokencb; /* Token callback */ | |
fd96ad89 MS |
79 | }; |
80 | ||
81 | struct _ipp_file_s /**** File Parser */ | |
82 | { | |
83 | const char *filename; /* Filename */ | |
84 | cups_file_t *fp; /* File pointer */ | |
85 | int linenum; /* Current line number */ | |
86 | ipp_t *attrs; /* Attributes */ | |
87 | ipp_tag_t group_tag; /* Current group for new attributes */ | |
88 | }; | |
89 | ||
8ca02f3c | 90 | |
fa73b229 | 91 | /* |
92 | * Prototypes for private functions... | |
93 | */ | |
94 | ||
fd96ad89 | 95 | /* encode.c */ |
a469f8a5 MS |
96 | #ifdef DEBUG |
97 | extern const char *_ippCheckOptions(void); | |
98 | #endif /* DEBUG */ | |
8ca02f3c | 99 | extern _ipp_option_t *_ippFindOption(const char *name); |
fa73b229 | 100 | |
fd96ad89 | 101 | /* ipp-file.c */ |
a166e933 | 102 | extern ipp_t *_ippFileParse(_ipp_vars_t *v, const char *filename, void *user_data); |
fd96ad89 MS |
103 | extern int _ippFileReadToken(_ipp_file_t *f, char *token, size_t tokensize); |
104 | ||
105 | /* ipp-vars.c */ | |
106 | extern void _ippVarsDeinit(_ipp_vars_t *v); | |
107 | extern void _ippVarsExpand(_ipp_vars_t *v, char *dst, const char *src, size_t dstsize) __attribute__((nonnull(1,2,3))); | |
108 | extern const char *_ippVarsGet(_ipp_vars_t *v, const char *name); | |
a166e933 | 109 | extern void _ippVarsInit(_ipp_vars_t *v, _ipp_fattr_cb_t attrcb, _ipp_ferror_cb_t errorcb, _ipp_ftoken_cb_t tokencb); |
fd96ad89 MS |
110 | extern const char *_ippVarsPasswordCB(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data); |
111 | extern int _ippVarsSet(_ipp_vars_t *v, const char *name, const char *value); | |
112 | ||
113 | ||
fa73b229 | 114 | /* |
115 | * C++ magic... | |
116 | */ | |
117 | ||
118 | # ifdef __cplusplus | |
119 | } | |
120 | # endif /* __cplusplus */ | |
121 | #endif /* !_CUPS_IPP_H_ */ |