1 /* parser.h - Structures, functions and global variables for the */ 2 /* tsocks parsing routines */ 3 4 #ifndef _PARSER_H 5 6 #define _PARSER_H 1 7 8 /* Structure definitions */ 9 10 /* Structure representing one server specified in the config */ 11 struct serverent { 12 int lineno; /* Line number in conf file this path started on */ 13 char *address; /* Address/hostname of server */ 14 int port; /* Port number of server */ 15 int type; /* Type of server (4/5) */ 16 char *defuser; /* Default username for this socks server */ 17 char *defpass; /* Default password for this socks server */ 18 struct netent *reachnets; /* Linked list of nets from this server */ 19 struct serverent *next; /* Pointer to next server entry */ 20 }; 21 22 /* Structure representing a network */ 23 struct netent { 24 struct in_addr localip; /* Base IP of the network */ 25 struct in_addr localnet; /* Mask for the network */ 26 unsigned long startport; /* Range of ports for the */ 27 unsigned long endport; /* network */ 28 struct netent *next; /* Pointer to next network entry */ 29 }; 30 31 /* Structure representing a complete parsed file */ 32 struct parsedfile { 33 struct netent *localnets; 34 struct serverent defaultserver; 35 struct serverent *paths; 36 }; 37 38 /* Functions provided by parser module */ 39 int read_config(char *, struct parsedfile *); 40 int is_local(struct parsedfile *, struct in_addr *); 41 int pick_server(struct parsedfile *, struct serverent **, struct in_addr *, unsigned int port); 42 char *strsplit(char *separator, char **text, const char *search); 43 44 #endif 45