Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 154 lines (134 sloc) 5.09 kb
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
1 #ifndef HEADER_CURL_TOOL_SDECLS_H
2 #define HEADER_CURL_TOOL_SDECLS_H
3 /***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
919c97fa »
2012-04-06 curl tool: use configuration files from lib directory
10 * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ***************************************************************************/
919c97fa »
2012-04-06 curl tool: use configuration files from lib directory
24 #include "tool_setup.h"
196c8242 »
2012-06-21 curl: Made --metalink option toggle Metalink functionality
25 #ifdef USE_METALINK
4e3320a6 »
2012-06-30 Include metalink/metalink.h for libmetalink functions
26 # include <metalink/metalink.h>
196c8242 »
2012-06-21 curl: Made --metalink option toggle Metalink functionality
27 #endif /* USE_METALINK */
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
28
29 /*
30 * OutStruct variables keep track of information relative to curl's
7be872c3 »
2011-09-30 curl tool: fix some more OOM handling
31 * output writing, which may take place to a standard stream or a file.
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
32 *
7be872c3 »
2011-09-30 curl tool: fix some more OOM handling
33 * 'filename' member is either a pointer to a file name string or NULL
34 * when dealing with a standard stream.
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
35 *
36 * 'alloc_filename' member is TRUE when string pointed by 'filename' has been
37 * dynamically allocated and 'belongs' to this OutStruct, otherwise FALSE.
38 *
7352ac40 »
2012-06-07 Fixes allowing HTTP test cases 1338, 1339, 1368 and 1369 to succeed
39 * 'is_cd_filename' member is TRUE when string pointed by 'filename' has been
40 * set using a server-specified Content-Disposition filename, otherwise FALSE.
41 *
7be872c3 »
2011-09-30 curl tool: fix some more OOM handling
42 * 's_isreg' member is TRUE when output goes to a regular file, this also
43 * implies that output is 'seekable' and 'appendable' and also that member
44 * 'filename' points to file name's string. For any standard stream member
45 * 's_isreg' will be FALSE.
46 *
47 * 'fopened' member is TRUE when output goes to a regular file and it
48 * has been fopen'ed, requiring it to be closed later on. In any other
49 * case this is FALSE.
50 *
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
51 * 'stream' member is a pointer to a stream controlling object as returned
7be872c3 »
2011-09-30 curl tool: fix some more OOM handling
52 * from a 'fopen' call or a standard stream.
53 *
54 * 'config' member is a pointer to associated 'Configurable' struct.
55 *
56 * 'bytes' member represents amount written so far.
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
57 *
7be872c3 »
2011-09-30 curl tool: fix some more OOM handling
58 * 'init' member holds original file size or offset at which truncation is
59 * taking place. Always zero unless appending to a non-empty regular file.
196c8242 »
2012-06-21 curl: Made --metalink option toggle Metalink functionality
60 *
61 * 'metalink_parser' member is a pointer to Metalink XML parser
62 * context.
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
63 */
64
65 struct OutStruct {
7be872c3 »
2011-09-30 curl tool: fix some more OOM handling
66 char *filename;
67 bool alloc_filename;
7352ac40 »
2012-06-07 Fixes allowing HTTP test cases 1338, 1339, 1368 and 1369 to succeed
68 bool is_cd_filename;
7be872c3 »
2011-09-30 curl tool: fix some more OOM handling
69 bool s_isreg;
70 bool fopened;
71 FILE *stream;
72 struct Configurable *config;
73 curl_off_t bytes;
74 curl_off_t init;
196c8242 »
2012-06-21 curl: Made --metalink option toggle Metalink functionality
75 #ifdef USE_METALINK
76 metalink_parser_context_t *metalink_parser;
77 #endif /* USE_METALINK */
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
78 };
79
80
81 /*
82 * InStruct variables keep track of information relative to curl's
83 * input reading, which may take place from stdin or from some file.
84 *
85 * 'fd' member is either 'stdin' file descriptor number STDIN_FILENO
86 * or a file descriptor as returned from an 'open' call for some file.
87 *
88 * 'config' member is a pointer to associated 'Configurable' struct.
89 */
90
91 struct InStruct {
92 int fd;
93 struct Configurable *config;
94 };
95
96
97 /*
98 * A linked list of these 'getout' nodes contain URL's to fetch,
99 * as well as information relative to where URL contents should
100 * be stored or which file should be uploaded.
101 */
102
103 struct getout {
104 struct getout *next; /* next one */
105 char *url; /* the URL we deal with */
106 char *outfile; /* where to store the output */
107 char *infile; /* file to upload, if GETOUT_UPLOAD is set */
108 int flags; /* options - composed of GETOUT_* bits */
109 };
110
111 #define GETOUT_OUTFILE (1<<0) /* set when outfile is deemed done */
112 #define GETOUT_URL (1<<1) /* set when URL is deemed done */
113 #define GETOUT_USEREMOTE (1<<2) /* use remote file name locally */
114 #define GETOUT_UPLOAD (1<<3) /* if set, -T has been used */
115 #define GETOUT_NOUPLOAD (1<<4) /* if set, -T "" has been used */
69271537 »
2012-05-25 Format GETOUT_METALINK nicely
116 #define GETOUT_METALINK (1<<5) /* set when Metalink download */
84221006 »
2011-09-20 curl tool: reviewed code moved to tool_*.[ch] files
117
118 /*
119 * 'trace' enumeration represents curl's output look'n feel possibilities.
120 */
121
122 typedef enum {
123 TRACE_NONE, /* no trace/verbose output at all */
124 TRACE_BIN, /* tcpdump inspired look */
125 TRACE_ASCII, /* like *BIN but without the hex output */
126 TRACE_PLAIN /* -v/--verbose type */
127 } trace;
128
129
130 /*
131 * 'HttpReq' enumeration represents HTTP request types.
132 */
133
134 typedef enum {
135 HTTPREQ_UNSPEC, /* first in list */
136 HTTPREQ_GET,
137 HTTPREQ_HEAD,
138 HTTPREQ_POST,
139 HTTPREQ_SIMPLEPOST,
140 HTTPREQ_CUSTOM,
141 HTTPREQ_LAST /* last in list */
142 } HttpReq;
143
144
145 /*
146 * Complete struct declarations which have Configurable struct members,
147 * just in case this header is directly included in some source file.
148 */
149
150 #include "tool_cfgable.h"
151
152 #endif /* HEADER_CURL_TOOL_SDECLS_H */
153
Something went wrong with that request. Please try again.