xref: /curl/src/tool_writeout.h (revision 56032044)
1 #ifndef HEADER_CURL_TOOL_WRITEOUT_H
2 #define HEADER_CURL_TOOL_WRITEOUT_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 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 https://curl.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  * SPDX-License-Identifier: curl
24  *
25  ***************************************************************************/
26 #include "tool_setup.h"
27 #include "tool_operate.h"
28 
29 typedef enum {
30   VAR_NONE,       /* must be the first */
31   VAR_APPCONNECT_TIME,
32   VAR_CERT,
33   VAR_CONNECT_TIME,
34   VAR_CONTENT_TYPE,
35   VAR_CONN_ID,
36   VAR_EASY_ID,
37   VAR_EFFECTIVE_FILENAME,
38   VAR_EFFECTIVE_METHOD,
39   VAR_EFFECTIVE_URL,
40   VAR_ERRORMSG,
41   VAR_EXITCODE,
42   VAR_FTP_ENTRY_PATH,
43   VAR_HEADER_JSON,
44   VAR_HEADER_SIZE,
45   VAR_HTTP_CODE,
46   VAR_HTTP_CODE_PROXY,
47   VAR_HTTP_VERSION,
48   VAR_INPUT_URL,
49   VAR_INPUT_URLSCHEME,
50   VAR_INPUT_URLUSER,
51   VAR_INPUT_URLPASSWORD,
52   VAR_INPUT_URLOPTIONS,
53   VAR_INPUT_URLHOST,
54   VAR_INPUT_URLPORT,
55   VAR_INPUT_URLPATH,
56   VAR_INPUT_URLQUERY,
57   VAR_INPUT_URLFRAGMENT,
58   VAR_INPUT_URLZONEID,
59   /* the same ones again for url *effective* */
60   VAR_INPUT_URLESCHEME, /* keep this the first URLE* variable */
61   VAR_INPUT_URLEUSER,
62   VAR_INPUT_URLEPASSWORD,
63   VAR_INPUT_URLEOPTIONS,
64   VAR_INPUT_URLEHOST,
65   VAR_INPUT_URLEPORT,
66   VAR_INPUT_URLEPATH,
67   VAR_INPUT_URLEQUERY,
68   VAR_INPUT_URLEFRAGMENT,
69   VAR_INPUT_URLEZONEID,
70   VAR_JSON,
71   VAR_LOCAL_IP,
72   VAR_LOCAL_PORT,
73   VAR_NAMELOOKUP_TIME,
74   VAR_NUM_CERTS,
75   VAR_NUM_CONNECTS,
76   VAR_NUM_HEADERS,
77   VAR_NUM_RETRY,
78   VAR_ONERROR,
79   VAR_PRETRANSFER_TIME,
80   VAR_POSTTRANSFER_TIME,
81   VAR_PRIMARY_IP,
82   VAR_PRIMARY_PORT,
83   VAR_PROXY_SSL_VERIFY_RESULT,
84   VAR_PROXY_USED,
85   VAR_REDIRECT_COUNT,
86   VAR_REDIRECT_TIME,
87   VAR_REDIRECT_URL,
88   VAR_REFERER,
89   VAR_REQUEST_SIZE,
90   VAR_SCHEME,
91   VAR_SIZE_DOWNLOAD,
92   VAR_SIZE_UPLOAD,
93   VAR_SPEED_DOWNLOAD,
94   VAR_SPEED_UPLOAD,
95   VAR_SSL_VERIFY_RESULT,
96   VAR_STARTTRANSFER_TIME,
97   VAR_STDERR,
98   VAR_STDOUT,
99   VAR_TOTAL_TIME,
100   VAR_URLNUM,
101   VAR_NUM_OF_VARS /* must be the last */
102 } writeoutid;
103 
104 struct writeoutvar {
105   const char *name;
106   writeoutid id;
107   CURLINFO ci;
108   int (*writefunc)(FILE *stream, const struct writeoutvar *wovar,
109                    struct per_transfer *per, CURLcode per_result,
110                    bool use_json);
111 };
112 
113 void ourWriteOut(struct OperationConfig *config, struct per_transfer *per,
114                  CURLcode per_result);
115 
116 #endif /* HEADER_CURL_TOOL_WRITEOUT_H */
117