]> git.sesse.net Git - cubemap/blob - config.h
Make things line up a bit better.
[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 <stddef.h>
7 #include <string>
8 #include <vector>
9
10 struct MarkPoolConfig {
11         int from, to;
12 };
13
14 struct StreamConfig {
15         std::string stream_id;
16         std::string src;  // Can be empty.
17         size_t backlog_size;
18         int mark_pool;  // -1 for none.
19 };
20
21 struct AcceptorConfig {
22         int port;
23 };
24
25 struct LogConfig {
26         enum { LOG_TYPE_FILE, LOG_TYPE_CONSOLE, LOG_TYPE_SYSLOG } type;
27         std::string filename;
28 };
29
30 struct Config {
31         int num_servers;
32         std::vector<MarkPoolConfig> mark_pools;
33         std::vector<StreamConfig> streams;
34         std::vector<AcceptorConfig> acceptors;
35         std::vector<LogConfig> log_destinations;
36
37         std::string stats_file;  // Empty means no stats file.
38         int stats_interval;
39 };
40
41 // Parse and validate configuration. Returns false on error.
42 // <config> is taken to be empty (uninitialized) on entry.
43 bool parse_config(const std::string &filename, Config *config);
44
45 #endif  // !defined(_CONFIG_H)