Debian Codegraph @

src/network.h

raw symbols SCIP
1 /*
2 * HTTPDirFS - HTTP Directory Filesystem
3 *
4 * Copyright (C) 2020-2026 Fufu Fang <[email protected]>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * In addition, as a special exception, the copyright holders give
20 * permission to link the code of portions of this program with the OpenSSL
21 * library.
22 */
23
24 #ifndef NETWORK_H
25 #define NETWORK_H
26
27 /**
28 * \file network.h
29 * \brief Network transfer and cURL wrapper header
30 */
31
32 #include <curl/curl.h>
33
34 /** \brief HTTP response codes */
35 typedef enum {
36 HTTP_OK = 200,
37 HTTP_PARTIAL_CONTENT = 206,
38 HTTP_RANGE_NOT_SATISFIABLE = 416,
39 HTTP_TOO_MANY_REQUESTS = 429,
40 HTTP_CLOUDFLARE_UNKNOWN_ERROR = 520,
41 HTTP_CLOUDFLARE_TIMEOUT = 524
42 } HTTPResponseCode;
43
44 /** \brief curl shared interface */
45 extern CURLSH *CURL_SHARE;
46
47 /** \brief perform one transfer cycle */
48 int curl_multi_perform_once(void);
49
50 /** \brief initialise the network module */
51 void NetworkSystem_init(void);
52
53 /** \brief blocking file transfer */
54 void transfer_blocking(CURL *curl);
55
56 /** \brief non blocking file transfer */
57 void transfer_nonblocking(CURL *curl);
58
59 /**
60 * \brief check if a HTTP response code corresponds to a temporary failure
61 */
62 int HTTP_temp_failure(HTTPResponseCode http_resp);
63
64 #endif