]> git.sesse.net Git - cubemap/blob - config.h
Move SIGHUP handling as soon as possible, so that repeated SIGHUPing is less likely...
[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 Config {
26         int num_servers;
27         std::vector<MarkPoolConfig> mark_pools;
28         std::vector<StreamConfig> streams;
29         std::vector<AcceptorConfig> acceptors;
30
31         std::string stats_file;  // Empty means no stats file.
32         int stats_interval;
33 };
34
35 // Parse and validate configuration. Returns false on error.
36 // <config> is taken to be empty (uninitialized) on entry.
37 bool parse_config(const std::string &filename, Config *config);
38
39 #endif  // !defined(_CONFIG_H)