1#ifndef HEADER_CURL_TOOL_SDECLS_H
2#define HEADER_CURL_TOOL_SDECLS_H
3/***************************************************************************
4 *                                  _   _ ____  _
5 *  Project                     ___| | | |  _ \| |
6 *                             / __| | | | |_) | |
7 *                            | (__| |_| |  _ <| |___
8 *                             \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
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 ***************************************************************************/
24#include "setup.h"
25
26
27/*
28 * OutStruct variables keep track of information relative to curl's
29 * output writing, which may take place to a standard stream or a file.
30 *
31 * 'filename' member is either a pointer to a file name string or NULL
32 * when dealing with a standard stream.
33 *
34 * 'alloc_filename' member is TRUE when string pointed by 'filename' has been
35 * dynamically allocated and 'belongs' to this OutStruct, otherwise FALSE.
36 *
37 * 's_isreg' member is TRUE when output goes to a regular file, this also
38 * implies that output is 'seekable' and 'appendable' and also that member
39 * 'filename' points to file name's string. For any standard stream member
40 * 's_isreg' will be FALSE.
41 *
42 * 'fopened' member is TRUE when output goes to a regular file and it
43 * has been fopen'ed, requiring it to be closed later on. In any other
44 * case this is FALSE.
45 *
46 * 'stream' member is a pointer to a stream controlling object as returned
47 * from a 'fopen' call or a standard stream.
48 *
49 * 'config' member is a pointer to associated 'Configurable' struct.
50 *
51 * 'bytes' member represents amount written so far.
52 *
53 * 'init' member holds original file size or offset at which truncation is
54 * taking place. Always zero unless appending to a non-empty regular file.
55 */
56
57struct OutStruct {
58  char *filename;
59  bool alloc_filename;
60  bool s_isreg;
61  bool fopened;
62  FILE *stream;
63  struct Configurable *config;
64  curl_off_t bytes;
65  curl_off_t init;
66};
67
68
69/*
70 * InStruct variables keep track of information relative to curl's
71 * input reading, which may take place from stdin or from some file.
72 *
73 * 'fd' member is either 'stdin' file descriptor number STDIN_FILENO
74 * or a file descriptor as returned from an 'open' call for some file.
75 *
76 * 'config' member is a pointer to associated 'Configurable' struct.
77 */
78
79struct InStruct {
80  int fd;
81  struct Configurable *config;
82};
83
84
85/*
86 * A linked list of these 'getout' nodes contain URL's to fetch,
87 * as well as information relative to where URL contents should
88 * be stored or which file should be uploaded.
89 */
90
91struct getout {
92  struct getout *next;      /* next one */
93  char          *url;       /* the URL we deal with */
94  char          *outfile;   /* where to store the output */
95  char          *infile;    /* file to upload, if GETOUT_UPLOAD is set */
96  int            flags;     /* options - composed of GETOUT_* bits */
97};
98
99#define GETOUT_OUTFILE    (1<<0)  /* set when outfile is deemed done */
100#define GETOUT_URL        (1<<1)  /* set when URL is deemed done */
101#define GETOUT_USEREMOTE  (1<<2)  /* use remote file name locally */
102#define GETOUT_UPLOAD     (1<<3)  /* if set, -T has been used */
103#define GETOUT_NOUPLOAD   (1<<4)  /* if set, -T "" has been used */
104
105
106/*
107 * 'trace' enumeration represents curl's output look'n feel possibilities.
108 */
109
110typedef enum {
111  TRACE_NONE,  /* no trace/verbose output at all */
112  TRACE_BIN,   /* tcpdump inspired look */
113  TRACE_ASCII, /* like *BIN but without the hex output */
114  TRACE_PLAIN  /* -v/--verbose type */
115} trace;
116
117
118/*
119 * 'HttpReq' enumeration represents HTTP request types.
120 */
121
122typedef enum {
123  HTTPREQ_UNSPEC,  /* first in list */
124  HTTPREQ_GET,
125  HTTPREQ_HEAD,
126  HTTPREQ_POST,
127  HTTPREQ_SIMPLEPOST,
128  HTTPREQ_CUSTOM,
129  HTTPREQ_LAST     /* last in list */
130} HttpReq;
131
132
133/*
134 * Complete struct declarations which have Configurable struct members,
135 * just in case this header is directly included in some source file.
136 */
137
138#include "tool_cfgable.h"
139
140#endif /* HEADER_CURL_TOOL_SDECLS_H */
141
142