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 | |
23 | extern char *config_file, *cfg_start, *cfg_end, *cfg_cur; |
24 | extern int config_bytes, cfg_lno, cfg_lex; |
25 | |
26 | int cfg_skipspc (void); |
27 | int cfg_skspc (void); |
28 | int cfg_getlex (void); |
29 | int cfg_getword (void); |
30 | int cfg_getstr (void); |
31 | void syntax (const char *msg, ...); |
32 | void syntax_warning (const char *msg, ...); |
33 | int expect_lexem (int lexem); |
34 | int expect_word (const char *name, int len); |
35 | void reset_config (void); |
36 | int load_config (const char *file, int fd); |
37 | void close_config (int *fd); |
38 | void md5_hex_config (char *out); |
39 | struct hostent *cfg_gethost (void); |
40 | struct hostent *cfg_gethost_ex (int verb); |
41 | long long cfg_getint (void); |
42 | long long cfg_getint_zero (void); |
43 | long 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 | |