forked from cminyard/ser2net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadconfig.h
66 lines (55 loc) · 2.15 KB
/
readconfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* ser2net - A program for allowing telnet connection to serial ports
* Copyright (C) 2001 Corey Minyard <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef READCONFIG
#define READCONFIG
#include <stdio.h>
/* Handle one line of configuration. */
int handle_config_line(char *inbuf, int len);
/* Initialize for a new config read. */
int readconfig_init(void);
/* Read the specified configuration file and call the routine to
create the ports. */
int readconfig(FILE *instream);
int yaml_readconfig(FILE *f);
/*
* Search for a banner/open/close string by name. Note that the
* returned value needs to be free-ed when done.
*/
enum str_type { BANNER, OPENSTR, CLOSESTR, SIGNATURE, CLOSEON, DEVNAME };
char *find_str(const char *name, enum str_type *type, unsigned int *len);
/*
* Clean up longstrings.
*/
void free_longstrs(void);
void free_tracefiles(void);
void free_rs485confs(void);
/*
* Search for a tracefile by name. Note that the
* returned value needs to be free-ed when done.
*/
char *find_tracefile(const char *name);
/* Search for RS485 configuration by name. */
char *find_rs485conf(const char *name);
/* Return the default int/bool value for the given name. */
int find_default_int(const char *name);
bool find_default_bool(const char *name);
/* Return the default string value for the given name. Return GE_NOMEM if
out of memory. The returned value must be freed. */
int find_default_str(const char *name, char **rstr);
#endif /* READCONFIG */