]>
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 | ||
56 | typedef int (*_ipp_ferror_cb_t)(_ipp_file_t *f, void *user_data, const char *error); | |
57 | /**** File Parser Error Callback ****/ | |
58 | typedef int (*_ipp_ftoken_cb_t)(_ipp_file_t *f, _ipp_vars_t *v, void *user_data, const char *token); | |
59 | /**** File Parser Token Callback ****/ | |
60 | ||
61 | struct _ipp_vars_s /**** Variables ****/ | |
62 | { | |
63 | char *uri, /* URI for printer */ | |
64 | scheme[64], /* Scheme from URI */ | |
65 | username[256], /* Username from URI */ | |
66 | *password, /* Password from URI (if any) */ | |
67 | host[256], /* Hostname from URI */ | |
68 | portstr[32], /* Port number string */ | |
69 | resource[1024]; /* Resource path from URI */ | |
70 | int port; /* Port number from URI */ | |
fd96ad89 MS |
71 | int num_vars; /* Number of variables */ |
72 | cups_option_t *vars; /* Array of variables */ | |
73 | int password_tries; /* Number of retries for password */ | |
74 | }; | |
75 | ||
76 | struct _ipp_file_s /**** File Parser */ | |
77 | { | |
78 | const char *filename; /* Filename */ | |
79 | cups_file_t *fp; /* File pointer */ | |
80 | int linenum; /* Current line number */ | |
81 | ipp_t *attrs; /* Attributes */ | |
82 | ipp_tag_t group_tag; /* Current group for new attributes */ | |
83 | }; | |
84 | ||
8ca02f3c | 85 | |
fa73b229 | 86 | /* |
87 | * Prototypes for private functions... | |
88 | */ | |
89 | ||
fd96ad89 | 90 | /* encode.c */ |
a469f8a5 MS |
91 | #ifdef DEBUG |
92 | extern const char *_ippCheckOptions(void); | |
93 | #endif /* DEBUG */ | |
8ca02f3c | 94 | extern _ipp_option_t *_ippFindOption(const char *name); |
fa73b229 | 95 | |
fd96ad89 MS |
96 | /* ipp-file.c */ |
97 | extern ipp_t *_ippFileParse(_ipp_vars_t *v, const char *filename, _ipp_ftoken_cb_t tokencb, _ipp_ferror_cb_t errorcb, void *user_data); | |
98 | extern int _ippFileReadToken(_ipp_file_t *f, char *token, size_t tokensize); | |
99 | ||
100 | /* ipp-vars.c */ | |
101 | extern void _ippVarsDeinit(_ipp_vars_t *v); | |
102 | extern void _ippVarsExpand(_ipp_vars_t *v, char *dst, const char *src, size_t dstsize) __attribute__((nonnull(1,2,3))); | |
103 | extern const char *_ippVarsGet(_ipp_vars_t *v, const char *name); | |
104 | extern void _ippVarsInit(_ipp_vars_t *v); | |
105 | extern const char *_ippVarsPasswordCB(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data); | |
106 | extern int _ippVarsSet(_ipp_vars_t *v, const char *name, const char *value); | |
107 | ||
108 | ||
fa73b229 | 109 | /* |
110 | * C++ magic... | |
111 | */ | |
112 | ||
113 | # ifdef __cplusplus | |
114 | } | |
115 | # endif /* __cplusplus */ | |
116 | #endif /* !_CUPS_IPP_H_ */ |