1/*
2 This file is part of Mtproto-proxy Library.
3
4 Mtproto-proxy Library is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 Mtproto-proxy Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with Mtproto-proxy Library. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright 2014 Telegram Messenger Inc
18 2014 Vitaly Valtman
19*/
20
21#pragma once
22
23extern char *config_file, *cfg_start, *cfg_end, *cfg_cur;
24extern int config_bytes, cfg_lno, cfg_lex;
25
26int cfg_skipspc (void);
27int cfg_skspc (void);
28int cfg_getlex (void);
29int cfg_getword (void);
30int cfg_getstr (void);
31void syntax (const char *msg, ...);
32void syntax_warning (const char *msg, ...);
33int expect_lexem (int lexem);
34int expect_word (const char *name, int len);
35void reset_config (void);
36int load_config (const char *file, int fd);
37void close_config (int *fd);
38void md5_hex_config (char *out);
39struct hostent *cfg_gethost (void);
40struct hostent *cfg_gethost_ex (int verb);
41long long cfg_getint (void);
42long long cfg_getint_zero (void);
43long long cfg_getint_signed_zero (void);
44
45#define Expect(l) { int t = expect_lexem (l); if (t < 0) { return t; } }
46#define ExpectWord(s) { int t = expect_word (s, strlen (s)); if (t < 0) { return t; } }
47#define Syntax(...) { syntax (__VA_ARGS__); return -1; }
48