File: parser.h

package info (click to toggle)
tsocks 1.8beta5-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 428 kB
  • ctags: 173
  • sloc: sh: 2,774; ansic: 1,876; makefile: 129
file content (44 lines) | stat: -rw-r--r-- 1,557 bytes parent folder | download | duplicates (7)
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