httpdirfs/src/network.h

46 lines
973 B
C
Raw Normal View History

2018-07-21 03:51:49 +02:00
#ifndef NETWORK_H
#define NETWORK_H
2018-07-22 12:50:51 +02:00
/**
* \file network.h
* \brief network related functions
*/
2021-09-03 22:39:31 +02:00
typedef struct TransferStruct TransferStruct;
2018-07-26 11:29:44 +02:00
#include "link.h"
2021-09-03 22:39:31 +02:00
#include <curl/curl.h>
/** \brief HTTP response codes */
typedef enum {
2021-08-31 12:18:39 +02:00
HTTP_OK = 200,
HTTP_PARTIAL_CONTENT = 206,
HTTP_RANGE_NOT_SATISFIABLE = 416,
HTTP_TOO_MANY_REQUESTS = 429,
HTTP_CLOUDFLARE_UNKNOWN_ERROR = 520,
HTTP_CLOUDFLARE_TIMEOUT = 524
} HTTPResponseCode;
2018-07-26 11:29:44 +02:00
/** \brief curl shared interface */
2018-07-30 15:20:04 +02:00
extern CURLSH *CURL_SHARE;
2018-07-26 11:29:44 +02:00
2018-07-26 11:58:51 +02:00
/** \brief perform one transfer cycle */
int curl_multi_perform_once(void);
2018-07-30 15:20:04 +02:00
/** \brief initialise the network module */
void NetworkSystem_init(void);
2018-07-26 11:58:51 +02:00
/** \brief blocking file transfer */
2021-09-03 15:56:11 +02:00
void transfer_blocking(CURL *curl);
2018-07-26 11:58:51 +02:00
/** \brief non blocking file transfer */
2021-09-03 15:56:11 +02:00
void transfer_nonblocking(CURL *curl);
2018-07-20 16:38:44 +02:00
/**
* \brief check if a HTTP response code corresponds to a temporary failure
*/
int HTTP_temp_failure(HTTPResponseCode http_resp);
2018-07-18 17:26:26 +02:00
#endif