-
Notifications
You must be signed in to change notification settings - Fork 29
/
parser.h
44 lines (36 loc) · 1.52 KB
/
parser.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
/* parser.h - Structures, functions and global variables for the */
/* tsocks parsing routines */
#ifndef _PARSER_H
#define _PARSER_H 1
/* Structure definitions */
/* Structure representing one server specified in the config */
struct serverent {
int lineno; /* Line number in conf file this path started on */
char *address; /* Address/hostname of server */
int port; /* Port number of server */
int type; /* Type of server (4/5) */
char *defuser; /* Default username for this socks server */
char *defpass; /* Default password for this socks server */
struct netent *reachnets; /* Linked list of nets from this server */
struct serverent *next; /* Pointer to next server entry */
};
/* Structure representing a network */
struct netent {
struct in_addr localip; /* Base IP of the network */
struct in_addr localnet; /* Mask for the network */
unsigned long startport; /* Range of ports for the */
unsigned long endport; /* network */
struct netent *next; /* Pointer to next network entry */
};
/* Structure representing a complete parsed file */
struct parsedfile {
struct netent *localnets;
struct serverent defaultserver;
struct serverent *paths;
};
/* Functions provided by parser module */
int read_config(char *, struct parsedfile *);
int is_local(struct parsedfile *, struct in_addr *);
int pick_server(struct parsedfile *, struct serverent **, struct in_addr *, unsigned int port);
char *strsplit(char *separator, char **text, const char *search);
#endif