]> git.sesse.net Git - cubemap/blob - config.h
Move the “read the whole file” logic into a new file.
[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 <vector>
7 #include <string>
8
9 struct MarkPoolConfig {
10         int from, to;
11 };
12
13 struct StreamConfig {
14         std::string stream_id;
15         std::string src;  // Can be empty.
16         int mark_pool;  // -1 for none.
17 };
18
19 struct AcceptorConfig {
20         int port;
21 };
22
23 struct Config {
24         int num_servers;
25         std::vector<MarkPoolConfig> mark_pools;
26         std::vector<StreamConfig> streams;
27         std::vector<AcceptorConfig> acceptors;
28
29         std::string stats_file;  // Empty means no stats file.
30         int stats_interval;
31 };
32
33 // Parse and validate configuration. Returns false on error.
34 // <config> is taken to be empty (uninitialized) on entry.
35 bool parse_config(const std::string &filename, Config *config);
36
37 #endif  // !defined(_CONFIG_H)