]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/ipp-private.h
2 * Private IPP definitions for CUPS.
4 * Copyright © 2007-2018 by Apple Inc.
5 * Copyright © 1997-2006 by Easy Software Products.
7 * Licensed under Apache License v2.0. See the file "LICENSE" for more
11 #ifndef _CUPS_IPP_PRIVATE_H_
12 # define _CUPS_IPP_PRIVATE_H_
15 * Include necessary headers...
18 # include <cups/cups.h>
27 # endif /* __cplusplus */
34 # define IPP_BUF_SIZE (IPP_MAX_LENGTH + 2)
42 typedef struct /**** Attribute mapping data ****/
44 int multivalue
; /* Option has multiple values? */
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 */
48 ipp_tag_t alt_group_tag
; /* Alternate group tag for this
50 const ipp_op_t
*operations
; /* Allowed operations for this attr */
53 typedef struct _ipp_file_s _ipp_file_t
;/**** File Parser ****/
54 typedef struct _ipp_vars_s _ipp_vars_t
;/**** Variables ****/
56 typedef int (*_ipp_fattr_cb_t
)(_ipp_file_t
*f
, void *user_data
, const char *attr
);
57 /**** File Attribute (Filter) Callback ****/
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 ****/
63 struct _ipp_vars_s
/**** Variables ****/
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 */
73 int num_vars
; /* Number of variables */
74 cups_option_t
*vars
; /* Array of variables */
75 int password_tries
; /* Number of retries for password */
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 */
81 struct _ipp_file_s
/**** File Parser */
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 */
92 * Prototypes for private functions...
97 extern const char *_ippCheckOptions(void);
99 extern _ipp_option_t
*_ippFindOption(const char *name
);
102 extern ipp_t
*_ippFileParse(_ipp_vars_t
*v
, const char *filename
, void *user_data
);
103 extern int _ippFileReadToken(_ipp_file_t
*f
, char *token
, size_t tokensize
);
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
);
109 extern void _ippVarsInit(_ipp_vars_t
*v
, _ipp_fattr_cb_t attrcb
, _ipp_ferror_cb_t errorcb
, _ipp_ftoken_cb_t tokencb
);
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
);
120 # endif /* __cplusplus */
121 #endif /* !_CUPS_IPP_H_ */