-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
Currently ipptool and ippeveprinter use a private API to read ipptool test files and ippeveprinter attribute files. They share a common core syntax for specifying IPP attributes with a callback interface for processing tool-specific directives/commands and reporting errors. This same private API has been used in the PWG's ippsample project for ippserver and ipp3dprinter, but now that ippsample is using libcups it is inappropriate for them to use a private API. Also, the private API has been in use long enough to develop a stable public API, and there are other third-party tools and printer applications that could make use of the API as well.
The current private API:
typedef struct _ipp_file_s _ipp_file_t;/**** File Parser ****/
typedef struct _ipp_vars_s _ipp_vars_t;/**** Variables ****/
typedef int (*_ipp_fattr_cb_t)(_ipp_file_t *f, void *user_data, const char *attr);
/**** File Attribute (Filter) Callback ****/
typedef int (*_ipp_ferror_cb_t)(_ipp_file_t *f, void *user_data, const char *error);
/**** File Parser Error Callback ****/
typedef int (*_ipp_ftoken_cb_t)(_ipp_file_t *f, _ipp_vars_t *v, void *user_data, const char *token);
/**** File Parser Token Callback ****/
struct _ipp_vars_s /**** Variables ****/
{
char *uri, /* URI for printer */
scheme[64], /* Scheme from URI */
username[256], /* Username from URI */
*password, /* Password from URI (if any) */
host[256], /* Hostname from URI */
portstr[32], /* Port number string */
resource[1024]; /* Resource path from URI */
int port; /* Port number from URI */
size_t num_vars; /* Number of variables */
cups_option_t *vars; /* Array of variables */
int password_tries; /* Number of retries for password */
_ipp_fattr_cb_t attrcb; /* Attribute (filter) callback */
_ipp_ferror_cb_t errorcb; /* Error callback */
_ipp_ftoken_cb_t tokencb; /* Token callback */
};
struct _ipp_file_s /**** File Parser */
{
const char *filename; /* Filename */
cups_file_t *fp; /* File pointer */
int linenum; /* Current line number */
ipp_t *attrs; /* Attributes */
ipp_tag_t group_tag; /* Current group for new attributes */
};
extern ipp_t *_ippFileParse(_ipp_vars_t *v, const char *filename, void *user_data);
extern int _ippFileReadToken(_ipp_file_t *f, char *token, size_t tokensize);
extern void _ippVarsDeinit(_ipp_vars_t *v);
extern void _ippVarsExpand(_ipp_vars_t *v, char *dst, const char *src, size_t dstsize);
extern const char *_ippVarsGet(_ipp_vars_t *v, const char *name);
extern void _ippVarsInit(_ipp_vars_t *v, _ipp_fattr_cb_t attrcb, _ipp_ferror_cb_t errorcb, _ipp_ftoken_cb_t tokencb);
extern const char *_ippVarsPasswordCB(const char *prompt, http_t *http, const char *method, const char *resource, void *user_data);
extern int _ippVarsSet(_ipp_vars_t *v, const char *name, const char *value);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done