httpdirfs/src/config.h

103 lines
2.8 KiB
C
Raw Permalink Normal View History

2021-08-22 01:51:37 +02:00
#ifndef CONFIG_H
#define CONFIG_H
/**
* \brief the maximum length of a path and a URL.
* \details This corresponds the maximum path length under Ext4.
*/
#define MAX_PATH_LEN 4096
/**
* \brief the maximum length of a filename.
* \details This corresponds the filename length under Ext4.
*/
#define MAX_FILENAME_LEN 255
/**
* \brief the default user agent string
*/
#define DEFAULT_USER_AGENT "HTTPDirFS-" VERSION
/**
* \brief The default maximum number of network connections
*/
#define DEFAULT_NETWORK_MAX_CONNS 10
/**
2023-07-26 01:46:24 +02:00
* \brief The default refresh_timeout
*/
#define DEFAULT_REFRESH_TIMEOUT 3600
/**
* \brief Operation modes
*/
typedef enum {
2021-08-31 12:18:39 +02:00
NORMAL = 1,
SONIC = 2,
SINGLE = 3,
} OperationMode;
2021-08-22 01:51:37 +02:00
/**
* \brief configuration data structure
* \note The opening curly bracket should be at line 39, so the code belong
* lines up with the initialisation code in util.c
*/
typedef struct {
/** \brief Operation Mode */
2021-08-31 12:18:39 +02:00
OperationMode mode;
2021-08-29 23:46:24 +02:00
/** \brief Current log level */
2021-08-31 12:18:39 +02:00
int log_type;
2021-08-22 01:51:37 +02:00
/*---------------- Network related --------------*/
/** \brief HTTP username */
2021-08-31 12:18:39 +02:00
char *http_username;
2021-08-22 01:51:37 +02:00
/** \brief HTTP password */
2021-08-31 12:18:39 +02:00
char *http_password;
2021-08-22 01:51:37 +02:00
/** \brief HTTP proxy URL */
2021-08-31 12:18:39 +02:00
char *proxy;
2021-08-22 01:51:37 +02:00
/** \brief HTTP proxy username */
2021-08-31 12:18:39 +02:00
char *proxy_username;
2021-08-22 01:51:37 +02:00
/** \brief HTTP proxy password */
2021-08-31 12:18:39 +02:00
char *proxy_password;
/** \brief HTTP proxy certificate file */
char *proxy_cafile;
2021-08-22 01:51:37 +02:00
/** \brief HTTP maximum connection count */
2021-08-31 12:18:39 +02:00
long max_conns;
2021-08-22 01:51:37 +02:00
/** \brief HTTP user agent*/
2021-08-31 12:18:39 +02:00
char *user_agent;
2021-08-22 01:51:37 +02:00
/** \brief The waiting time after getting HTTP 429 (too many requests) */
2021-08-31 12:18:39 +02:00
int http_wait_sec;
2021-08-22 01:51:37 +02:00
/** \brief Disable check for the server's support of HTTP range request */
2021-08-31 12:18:39 +02:00
int no_range_check;
2021-08-22 01:51:37 +02:00
/** \brief Disable TLS certificate verification */
2021-08-31 12:18:39 +02:00
int insecure_tls;
/** \brief Server certificate file */
char *cafile;
/** \brief Refresh directory listing after refresh_timeout seconds*/
int refresh_timeout;
2021-08-22 01:51:37 +02:00
/*--------------- Cache related ---------------*/
/** \brief Whether cache mode is enabled */
2021-08-31 12:18:39 +02:00
int cache_enabled;
2021-08-22 01:51:37 +02:00
/** \brief The cache location*/
2021-08-31 12:18:39 +02:00
char *cache_dir;
2021-08-22 01:51:37 +02:00
/** \brief The size of each download segment for cache mode */
2021-08-31 12:18:39 +02:00
int data_blksz;
2021-08-22 01:51:37 +02:00
/** \brief The maximum segment count for a single cache file */
2021-08-31 12:18:39 +02:00
int max_segbc;
2021-08-22 01:51:37 +02:00
/*-------------- Sonic related -------------*/
/** \brief The Sonic server username */
2021-08-31 12:18:39 +02:00
char *sonic_username;
2021-08-22 01:51:37 +02:00
/** \brief The Sonic server password */
2021-08-31 12:18:39 +02:00
char *sonic_password;
2021-08-22 01:51:37 +02:00
/** \brief Whether we are using sonic mode ID3 extension */
2021-08-31 12:18:39 +02:00
int sonic_id3;
2021-08-22 01:51:37 +02:00
/** \brief Whether we use the legacy sonic authentication mode */
2021-08-31 12:18:39 +02:00
int sonic_insecure;
2021-08-22 01:51:37 +02:00
} ConfigStruct;
/**
* \brief The Configuration data structure
*/
extern ConfigStruct CONFIG;
#endif