]> git.sesse.net Git - cubemap/blob - config.h
Remove support for mark pools.
[cubemap] / config.h
1 #ifndef _CONFIG_H
2 #define _CONFIG_H
3
4 // Various routines that deal with parsing the configuration file.
5
6 #include <arpa/inet.h>
7 #include <netinet/in.h>
8 #include <stddef.h>
9 #include <string>
10 #include <vector>
11
12 struct StreamConfig {
13         std::string url;  // As seen by the client.
14         std::string src;  // Can be empty.
15         size_t backlog_size;
16         uint32_t pacing_rate;  // In bytes per second. Default is ~0U (no limit).
17         enum { STREAM_ENCODING_RAW = 0, STREAM_ENCODING_METACUBE } encoding;
18 };
19
20 struct UDPStreamConfig {
21         sockaddr_in6 dst;
22         std::string src;  // Can be empty.
23         uint32_t pacing_rate;  // In bytes per second. Default is ~0U (no limit).
24 };
25
26 struct AcceptorConfig {
27         sockaddr_in6 addr;
28 };
29
30 struct LogConfig {
31         enum { LOG_TYPE_FILE, LOG_TYPE_CONSOLE, LOG_TYPE_SYSLOG } type;
32         std::string filename;
33 };
34
35 struct Config {
36         bool daemonize;
37         int num_servers;
38         std::vector<StreamConfig> streams;
39         std::vector<UDPStreamConfig> udpstreams;
40         std::vector<AcceptorConfig> acceptors;
41         std::vector<LogConfig> log_destinations;
42
43         std::string stats_file;  // Empty means no stats file.
44         int stats_interval;
45
46         std::string input_stats_file;  // Empty means no input stats file.
47         int input_stats_interval;
48
49         std::string access_log_file;  // Empty means no accses_log file.
50 };
51
52 // Parse and validate configuration. Returns false on error.
53 // <config> is taken to be empty (uninitialized) on entry.
54 bool parse_config(const std::string &filename, Config *config);
55
56 #endif  // !defined(_CONFIG_H)