]> git.sesse.net Git - cubemap/blob - config.h
Support configurable BACKLOG_SIZE (per-stream). No support for changing across restar...
[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         size_t backlog_size;
17         int mark_pool;  // -1 for none.
18 };
19
20 struct AcceptorConfig {
21         int port;
22 };
23
24 struct Config {
25         int num_servers;
26         std::vector<MarkPoolConfig> mark_pools;
27         std::vector<StreamConfig> streams;
28         std::vector<AcceptorConfig> acceptors;
29
30         std::string stats_file;  // Empty means no stats file.
31         int stats_interval;
32 };
33
34 // Parse and validate configuration. Returns false on error.
35 // <config> is taken to be empty (uninitialized) on entry.
36 bool parse_config(const std::string &filename, Config *config);
37
38 #endif  // !defined(_CONFIG_H)