00001 #ifndef HEADER_CURL_TOOL_SDECLS_H 00002 #define HEADER_CURL_TOOL_SDECLS_H 00003 /*************************************************************************** 00004 * _ _ ____ _ 00005 * Project ___| | | | _ \| | 00006 * / __| | | | |_) | | 00007 * | (__| |_| | _ <| |___ 00008 * \___|\___/|_| \_\_____| 00009 * 00010 * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. 00011 * 00012 * This software is licensed as described in the file COPYING, which 00013 * you should have received as part of this distribution. The terms 00014 * are also available at https://curl.haxx.se/docs/copyright.html. 00015 * 00016 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 00017 * copies of the Software, and permit persons to whom the Software is 00018 * furnished to do so, under the terms of the COPYING file. 00019 * 00020 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 00021 * KIND, either express or implied. 00022 * 00023 ***************************************************************************/ 00024 #include "tool_setup.h" 00025 #ifdef USE_METALINK 00026 # include <metalink/metalink.h> 00027 #endif /* USE_METALINK */ 00028 00029 /* 00030 * OutStruct variables keep track of information relative to curl's 00031 * output writing, which may take place to a standard stream or a file. 00032 * 00033 * 'filename' member is either a pointer to a file name string or NULL 00034 * when dealing with a standard stream. 00035 * 00036 * 'alloc_filename' member is TRUE when string pointed by 'filename' has been 00037 * dynamically allocated and 'belongs' to this OutStruct, otherwise FALSE. 00038 * 00039 * 'is_cd_filename' member is TRUE when string pointed by 'filename' has been 00040 * set using a server-specified Content-Disposition filename, otherwise FALSE. 00041 * 00042 * 's_isreg' member is TRUE when output goes to a regular file, this also 00043 * implies that output is 'seekable' and 'appendable' and also that member 00044 * 'filename' points to file name's string. For any standard stream member 00045 * 's_isreg' will be FALSE. 00046 * 00047 * 'fopened' member is TRUE when output goes to a regular file and it 00048 * has been fopen'ed, requiring it to be closed later on. In any other 00049 * case this is FALSE. 00050 * 00051 * 'stream' member is a pointer to a stream controlling object as returned 00052 * from a 'fopen' call or a standard stream. 00053 * 00054 * 'config' member is a pointer to associated 'OperationConfig' struct. 00055 * 00056 * 'bytes' member represents amount written so far. 00057 * 00058 * 'init' member holds original file size or offset at which truncation is 00059 * taking place. Always zero unless appending to a non-empty regular file. 00060 * 00061 * 'metalink_parser' member is a pointer to Metalink XML parser 00062 * context. 00063 */ 00064 00065 struct OutStruct { 00066 char *filename; 00067 bool alloc_filename; 00068 bool is_cd_filename; 00069 bool s_isreg; 00070 bool fopened; 00071 FILE *stream; 00072 struct OperationConfig *config; 00073 curl_off_t bytes; 00074 curl_off_t init; 00075 #ifdef USE_METALINK 00076 metalink_parser_context_t *metalink_parser; 00077 #endif /* USE_METALINK */ 00078 }; 00079 00080 00081 /* 00082 * InStruct variables keep track of information relative to curl's 00083 * input reading, which may take place from stdin or from some file. 00084 * 00085 * 'fd' member is either 'stdin' file descriptor number STDIN_FILENO 00086 * or a file descriptor as returned from an 'open' call for some file. 00087 * 00088 * 'config' member is a pointer to associated 'OperationConfig' struct. 00089 */ 00090 00091 struct InStruct { 00092 int fd; 00093 struct OperationConfig *config; 00094 }; 00095 00096 00097 /* 00098 * A linked list of these 'getout' nodes contain URL's to fetch, 00099 * as well as information relative to where URL contents should 00100 * be stored or which file should be uploaded. 00101 */ 00102 00103 struct getout { 00104 struct getout *next; /* next one */ 00105 char *url; /* the URL we deal with */ 00106 char *outfile; /* where to store the output */ 00107 char *infile; /* file to upload, if GETOUT_UPLOAD is set */ 00108 int flags; /* options - composed of GETOUT_* bits */ 00109 }; 00110 00111 #define GETOUT_OUTFILE (1<<0) /* set when outfile is deemed done */ 00112 #define GETOUT_URL (1<<1) /* set when URL is deemed done */ 00113 #define GETOUT_USEREMOTE (1<<2) /* use remote file name locally */ 00114 #define GETOUT_UPLOAD (1<<3) /* if set, -T has been used */ 00115 #define GETOUT_NOUPLOAD (1<<4) /* if set, -T "" has been used */ 00116 #define GETOUT_METALINK (1<<5) /* set when Metalink download */ 00117 00118 /* 00119 * 'trace' enumeration represents curl's output look'n feel possibilities. 00120 */ 00121 00122 typedef enum { 00123 TRACE_NONE, /* no trace/verbose output at all */ 00124 TRACE_BIN, /* tcpdump inspired look */ 00125 TRACE_ASCII, /* like *BIN but without the hex output */ 00126 TRACE_PLAIN /* -v/--verbose type */ 00127 } trace; 00128 00129 00130 /* 00131 * 'HttpReq' enumeration represents HTTP request types. 00132 */ 00133 00134 typedef enum { 00135 HTTPREQ_UNSPEC, /* first in list */ 00136 HTTPREQ_GET, 00137 HTTPREQ_HEAD, 00138 HTTPREQ_FORMPOST, 00139 HTTPREQ_SIMPLEPOST 00140 } HttpReq; 00141 00142 00143 /* 00144 * Complete struct declarations which have OperationConfig struct members, 00145 * just in case this header is directly included in some source file. 00146 */ 00147 00148 #include "tool_cfgable.h" 00149 00150 #endif /* HEADER_CURL_TOOL_SDECLS_H */ 00151