]> git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/cgi.h
9604f97a21394c3f20508782990befa81baab560
[thirdparty/cups.git] / cgi-bin / cgi.h
1 /*
2 * CGI support library definitions for CUPS.
3 *
4 * Copyright 2007-2010 by Apple Inc.
5 * Copyright 1997-2006 by Easy Software Products.
6 *
7 * These coded instructions, statements, and computer programs are the
8 * property of Apple Inc. and are protected by Federal copyright
9 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 * which should have been included with this file. If this file is
11 * file is missing or damaged, see the license at "http://www.cups.org/".
12 */
13
14 #ifndef _CUPS_CGI_H_
15 # define _CUPS_CGI_H_
16
17 # include <stdio.h>
18 # include <stdlib.h>
19 # include <time.h>
20 # include <sys/stat.h>
21
22 # ifdef WIN32
23 # include <direct.h>
24 # include <io.h>
25 # else
26 # include <unistd.h>
27 # endif /* WIN32 */
28
29 # include <cups/cups.h>
30 # include <cups/array.h>
31 # include "help-index.h"
32
33
34 /*
35 * C++ magic...
36 */
37
38 # ifdef __cplusplus
39 extern "C" {
40 # endif /* __cplusplus */
41
42 /*
43 * Types...
44 */
45
46 typedef struct cgi_file_s /**** Uploaded file data ****/
47 {
48 char tempfile[1024], /* Temporary file containing data */
49 *name, /* Variable name */
50 *filename, /* Original filename */
51 *mimetype; /* MIME media type */
52 size_t filesize; /* Size of uploaded file */
53 } cgi_file_t;
54
55
56 /*
57 * Prototypes...
58 */
59
60 extern void cgiAbort(const char *title, const char *stylesheet,
61 const char *format, ...);
62 extern int cgiCheckVariables(const char *names);
63 extern void cgiClearVariables(void);
64 extern void *cgiCompileSearch(const char *query);
65 extern void cgiCopyTemplateFile(FILE *out, const char *tmpl);
66 extern void cgiCopyTemplateLang(const char *tmpl);
67 extern int cgiDoSearch(void *search, const char *text);
68 extern void cgiEndHTML(void);
69 extern void cgiEndMultipart(void);
70 extern char *cgiFormEncode(char *dst, const char *src,
71 size_t dstsize);
72 extern void cgiFreeSearch(void *search);
73 extern const char *cgiGetArray(const char *name, int element);
74 extern void cgiGetAttributes(ipp_t *request, const char *tmpl);
75 extern const char *cgiGetCookie(const char *name);
76 extern const cgi_file_t *cgiGetFile(void);
77 extern cups_array_t *cgiGetIPPObjects(ipp_t *response, void *search);
78 extern int cgiGetSize(const char *name);
79 extern char *cgiGetTemplateDir(void);
80 extern const char *cgiGetVariable(const char *name);
81 extern int cgiInitialize(void);
82 extern int cgiIsPOST(void);
83 extern void cgiMoveJobs(http_t *http, const char *dest, int job_id);
84 extern void cgiPrintCommand(http_t *http, const char *dest,
85 const char *command, const char *title);
86 extern void cgiPrintTestPage(http_t *http, const char *dest);
87 extern char *cgiRewriteURL(const char *uri, char *url, int urlsize,
88 const char *newresource);
89 extern void cgiSetArray(const char *name, int element,
90 const char *value);
91 extern void cgiSetCookie(const char *name, const char *value,
92 const char *path, const char *domain,
93 time_t expires, int secure);
94 extern ipp_attribute_t *cgiSetIPPObjectVars(ipp_attribute_t *obj,
95 const char *prefix, int element);
96 extern int cgiSetIPPVars(ipp_t *response, const char *filter_name,
97 const char *filter_value,
98 const char *prefix, int parent_el);
99 extern void cgiSetServerVersion(void);
100 extern void cgiSetSize(const char *name, int size);
101 extern void cgiSetVariable(const char *name, const char *value);
102 extern void cgiShowIPPError(const char *message);
103 extern void cgiShowJobs(http_t *http, const char *dest);
104 extern void cgiStartHTML(const char *title);
105 extern void cgiStartMultipart(void);
106 extern int cgiSupportsMultipart(void);
107 extern const char *cgiText(const char *message);
108
109 # ifdef __cplusplus
110 }
111 # endif /* __cplusplus */
112
113 #endif /* !_CUPS_CGI_H_ */