Remove redundant spaces.

This commit is contained in:
Guus Sliepen 2002-09-09 22:33:31 +00:00
parent 9f38e39463
commit 6f9f6779e6
35 changed files with 270 additions and 255 deletions

View file

@ -29,7 +29,7 @@
library for inclusion into tinc (http://tinc.nl.linux.org/) by
Guus Sliepen <guus@sliepen.eu.org>.
$Id: avl_tree.c,v 1.1.2.10 2002/09/09 21:49:16 guus Exp $
$Id: avl_tree.c,v 1.1.2.11 2002/09/09 22:32:24 guus Exp $
*/
#include <stdio.h>
@ -89,7 +89,7 @@ int lg(unsigned int u)
/* Internal helper functions */
int avl_check_balance(avl_node_t * node)
int avl_check_balance(avl_node_t *node)
{
#ifdef AVL_DEPTH
int d;
@ -117,7 +117,7 @@ int avl_check_balance(avl_node_t * node)
#endif
}
void avl_rebalance(avl_tree_t * tree, avl_node_t * node)
void avl_rebalance(avl_tree_t *tree, avl_node_t *node)
{
avl_node_t *child;
avl_node_t *gchild;
@ -272,7 +272,7 @@ avl_tree_t *avl_alloc_tree(avl_compare_t compare, avl_action_t delete)
return tree;
}
void avl_free_tree(avl_tree_t * tree)
void avl_free_tree(avl_tree_t *tree)
{
free(tree);
}
@ -282,7 +282,7 @@ avl_node_t *avl_alloc_node(void)
return (avl_node_t *)xmalloc_and_zero(sizeof(avl_node_t));
}
void avl_free_node(avl_tree_t * tree, avl_node_t * node)
void avl_free_node(avl_tree_t *tree, avl_node_t *node)
{
if(node->data && tree->delete)
tree->delete(node->data);
@ -292,7 +292,7 @@ void avl_free_node(avl_tree_t * tree, avl_node_t * node)
/* Searching */
void *avl_search(const avl_tree_t * tree, const void *data)
void *avl_search(const avl_tree_t *tree, const void *data)
{
avl_node_t *node;
@ -301,7 +301,7 @@ void *avl_search(const avl_tree_t * tree, const void *data)
return node ? node->data : NULL;
}
void *avl_search_closest(const avl_tree_t * tree, const void *data, int *result)
void *avl_search_closest(const avl_tree_t *tree, const void *data, int *result)
{
avl_node_t *node;
@ -310,7 +310,7 @@ void *avl_search_closest(const avl_tree_t * tree, const void *data, int *result)
return node ? node->data : NULL;
}
void *avl_search_closest_smaller(const avl_tree_t * tree, const void *data)
void *avl_search_closest_smaller(const avl_tree_t *tree, const void *data)
{
avl_node_t *node;
@ -319,7 +319,7 @@ void *avl_search_closest_smaller(const avl_tree_t * tree, const void *data)
return node ? node->data : NULL;
}
void *avl_search_closest_greater(const avl_tree_t * tree, const void *data)
void *avl_search_closest_greater(const avl_tree_t *tree, const void *data)
{
avl_node_t *node;
@ -328,7 +328,7 @@ void *avl_search_closest_greater(const avl_tree_t * tree, const void *data)
return node ? node->data : NULL;
}
avl_node_t *avl_search_node(const avl_tree_t * tree, const void *data)
avl_node_t *avl_search_node(const avl_tree_t *tree, const void *data)
{
avl_node_t *node;
int result;
@ -338,7 +338,7 @@ avl_node_t *avl_search_node(const avl_tree_t * tree, const void *data)
return result ? NULL : node;
}
avl_node_t *avl_search_closest_node(const avl_tree_t * tree, const void *data,
avl_node_t *avl_search_closest_node(const avl_tree_t *tree, const void *data,
int *result)
{
avl_node_t *node;
@ -381,7 +381,7 @@ avl_node_t *avl_search_closest_node(const avl_tree_t * tree, const void *data,
return node;
}
avl_node_t *avl_search_closest_smaller_node(const avl_tree_t * tree,
avl_node_t *avl_search_closest_smaller_node(const avl_tree_t *tree,
const void *data)
{
avl_node_t *node;
@ -395,7 +395,7 @@ avl_node_t *avl_search_closest_smaller_node(const avl_tree_t * tree,
return node;
}
avl_node_t *avl_search_closest_greater_node(const avl_tree_t * tree,
avl_node_t *avl_search_closest_greater_node(const avl_tree_t *tree,
const void *data)
{
avl_node_t *node;
@ -411,7 +411,7 @@ avl_node_t *avl_search_closest_greater_node(const avl_tree_t * tree,
/* Insertion and deletion */
avl_node_t *avl_insert(avl_tree_t * tree, void *data)
avl_node_t *avl_insert(avl_tree_t *tree, void *data)
{
avl_node_t *closest, *new;
int result;
@ -451,7 +451,7 @@ avl_node_t *avl_insert(avl_tree_t * tree, void *data)
return new;
}
avl_node_t *avl_insert_node(avl_tree_t * tree, avl_node_t * node)
avl_node_t *avl_insert_node(avl_tree_t *tree, avl_node_t *node)
{
avl_node_t *closest;
int result;
@ -485,14 +485,14 @@ avl_node_t *avl_insert_node(avl_tree_t * tree, avl_node_t * node)
return node;
}
void avl_insert_top(avl_tree_t * tree, avl_node_t * node)
void avl_insert_top(avl_tree_t *tree, avl_node_t *node)
{
node->prev = node->next = node->parent = NULL;
tree->head = tree->tail = tree->root = node;
}
void avl_insert_before(avl_tree_t * tree, avl_node_t * before,
avl_node_t * node)
void avl_insert_before(avl_tree_t *tree, avl_node_t *before,
avl_node_t *node)
{
if(!before)
return tree->tail ? avl_insert_after(tree, tree->tail, node) : avl_insert_top(tree, node);
@ -515,7 +515,7 @@ void avl_insert_before(avl_tree_t * tree, avl_node_t * before,
avl_rebalance(tree, before->parent);
}
void avl_insert_after(avl_tree_t * tree, avl_node_t * after, avl_node_t * node)
void avl_insert_after(avl_tree_t *tree, avl_node_t *after, avl_node_t *node)
{
if(!after)
return tree->head ? avl_insert_before(tree, tree->head,
@ -540,7 +540,7 @@ void avl_insert_after(avl_tree_t * tree, avl_node_t * after, avl_node_t * node)
avl_rebalance(tree, after->parent);
}
avl_node_t *avl_unlink(avl_tree_t * tree, void *data)
avl_node_t *avl_unlink(avl_tree_t *tree, void *data)
{
avl_node_t *node;
@ -552,7 +552,7 @@ avl_node_t *avl_unlink(avl_tree_t * tree, void *data)
return node;
}
void avl_unlink_node(avl_tree_t * tree, avl_node_t * node)
void avl_unlink_node(avl_tree_t *tree, avl_node_t *node)
{
avl_node_t *parent;
avl_node_t **superparent;
@ -621,13 +621,13 @@ void avl_unlink_node(avl_tree_t * tree, avl_node_t * node)
#endif
}
void avl_delete_node(avl_tree_t * tree, avl_node_t * node)
void avl_delete_node(avl_tree_t *tree, avl_node_t *node)
{
avl_unlink_node(tree, node);
avl_free_node(tree, node);
}
void avl_delete(avl_tree_t * tree, void *data)
void avl_delete(avl_tree_t *tree, void *data)
{
avl_node_t *node;
@ -639,7 +639,7 @@ void avl_delete(avl_tree_t * tree, void *data)
/* Fast tree cleanup */
void avl_delete_tree(avl_tree_t * tree)
void avl_delete_tree(avl_tree_t *tree)
{
avl_node_t *node, *next;
@ -653,7 +653,7 @@ void avl_delete_tree(avl_tree_t * tree)
/* Tree walking */
void avl_foreach(avl_tree_t * tree, avl_action_t action)
void avl_foreach(avl_tree_t *tree, avl_action_t action)
{
avl_node_t *node, *next;
@ -663,7 +663,7 @@ void avl_foreach(avl_tree_t * tree, avl_action_t action)
}
}
void avl_foreach_node(avl_tree_t * tree, avl_action_t action)
void avl_foreach_node(avl_tree_t *tree, avl_action_t action)
{
avl_node_t *node, *next;
@ -676,12 +676,12 @@ void avl_foreach_node(avl_tree_t * tree, avl_action_t action)
/* Indexing */
#ifdef AVL_COUNT
unsigned int avl_count(avl_tree_t * tree)
unsigned int avl_count(avl_tree_t *tree)
{
return AVL_NODE_COUNT(tree->root);
}
avl_node_t *avl_get_node(const avl_tree_t * tree, unsigned int index)
avl_node_t *avl_get_node(const avl_tree_t *tree, unsigned int index)
{
avl_node_t *node;
unsigned int c;
@ -704,7 +704,7 @@ avl_node_t *avl_get_node(const avl_tree_t * tree, unsigned int index)
return NULL;
}
unsigned int avl_index(const avl_node_t * node)
unsigned int avl_index(const avl_node_t *node)
{
avl_node_t *next;
unsigned int index;
@ -721,7 +721,7 @@ unsigned int avl_index(const avl_node_t * node)
}
#endif
#ifdef AVL_DEPTH
unsigned int avl_depth(avl_tree_t * tree)
unsigned int avl_depth(avl_tree_t *tree)
{
return AVL_NODE_DEPTH(tree->root);
}

View file

@ -29,7 +29,7 @@
library for inclusion into tinc (http://tinc.nl.linux.org/) by
Guus Sliepen <guus@sliepen.eu.org>.
$Id: avl_tree.h,v 1.1.2.6 2002/09/09 21:49:16 guus Exp $
$Id: avl_tree.h,v 1.1.2.7 2002/09/09 22:32:27 guus Exp $
*/
@ -68,9 +68,9 @@ typedef struct avl_node_t {
} avl_node_t;
typedef int (*avl_compare_t) (const void *, const void *);
typedef void (*avl_action_t) (const void *);
typedef void (*avl_action_node_t) (const avl_node_t *);
typedef int (*avl_compare_t)(const void *, const void *);
typedef void (*avl_action_t)(const void *);
typedef void (*avl_action_node_t)(const avl_node_t *);
typedef struct avl_tree_t {
@ -94,7 +94,7 @@ extern avl_tree_t *avl_alloc_tree(avl_compare_t, avl_action_t);
extern void avl_free_tree(avl_tree_t *);
extern avl_node_t *avl_alloc_node(void);
extern void avl_free_node(avl_tree_t * tree, avl_node_t *);
extern void avl_free_node(avl_tree_t *tree, avl_node_t *);
/* Insertion and deletion */
@ -106,7 +106,7 @@ extern void avl_insert_before(avl_tree_t *, avl_node_t *, avl_node_t *);
extern void avl_insert_after(avl_tree_t *, avl_node_t *, avl_node_t *);
extern avl_node_t *avl_unlink(avl_tree_t *, void *);
extern void avl_unlink_node(avl_tree_t * tree, avl_node_t *);
extern void avl_unlink_node(avl_tree_t *tree, avl_node_t *);
extern void avl_delete(avl_tree_t *, void *);
extern void avl_delete_node(avl_tree_t *, avl_node_t *);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: list.c,v 1.1.2.12 2002/09/09 21:49:16 guus Exp $
$Id: list.c,v 1.1.2.13 2002/09/09 22:32:27 guus Exp $
*/
#include "config.h"
@ -41,7 +41,7 @@ list_t *list_alloc(list_action_t delete)
return list;
}
void list_free(list_t * list)
void list_free(list_t *list)
{
free(list);
}
@ -51,7 +51,7 @@ list_node_t *list_alloc_node(void)
return (list_node_t *)xmalloc_and_zero(sizeof(list_node_t));
}
void list_free_node(list_t * list, list_node_t * node)
void list_free_node(list_t *list, list_node_t *node)
{
if(node->data && list->delete)
list->delete(node->data);
@ -61,7 +61,7 @@ void list_free_node(list_t * list, list_node_t * node)
/* Insertion and deletion */
list_node_t *list_insert_head(list_t * list, void *data)
list_node_t *list_insert_head(list_t *list, void *data)
{
list_node_t *node;
@ -82,7 +82,7 @@ list_node_t *list_insert_head(list_t * list, void *data)
return node;
}
list_node_t *list_insert_tail(list_t * list, void *data)
list_node_t *list_insert_tail(list_t *list, void *data)
{
list_node_t *node;
@ -103,7 +103,7 @@ list_node_t *list_insert_tail(list_t * list, void *data)
return node;
}
void list_unlink_node(list_t * list, list_node_t * node)
void list_unlink_node(list_t *list, list_node_t *node)
{
if(node->prev)
node->prev->next = node->next;
@ -118,25 +118,25 @@ void list_unlink_node(list_t * list, list_node_t * node)
list->count--;
}
void list_delete_node(list_t * list, list_node_t * node)
void list_delete_node(list_t *list, list_node_t *node)
{
list_unlink_node(list, node);
list_free_node(list, node);
}
void list_delete_head(list_t * list)
void list_delete_head(list_t *list)
{
list_delete_node(list, list->head);
}
void list_delete_tail(list_t * list)
void list_delete_tail(list_t *list)
{
list_delete_node(list, list->tail);
}
/* Head/tail lookup */
void *list_get_head(list_t * list)
void *list_get_head(list_t *list)
{
if(list->head)
return list->head->data;
@ -144,7 +144,7 @@ void *list_get_head(list_t * list)
return NULL;
}
void *list_get_tail(list_t * list)
void *list_get_tail(list_t *list)
{
if(list->tail)
return list->tail->data;
@ -154,7 +154,7 @@ void *list_get_tail(list_t * list)
/* Fast list deletion */
void list_delete_list(list_t * list)
void list_delete_list(list_t *list)
{
list_node_t *node, *next;
@ -168,7 +168,7 @@ void list_delete_list(list_t * list)
/* Traversing */
void list_foreach_node(list_t * list, list_action_node_t action)
void list_foreach_node(list_t *list, list_action_node_t action)
{
list_node_t *node, *next;
@ -178,7 +178,7 @@ void list_foreach_node(list_t * list, list_action_node_t action)
}
}
void list_foreach(list_t * list, list_action_t action)
void list_foreach(list_t *list, list_action_t action)
{
list_node_t *node, *next;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: list.h,v 1.1.2.7 2002/09/09 21:49:16 guus Exp $
$Id: list.h,v 1.1.2.8 2002/09/09 22:32:27 guus Exp $
*/
#ifndef __TINC_LIST_H__
@ -32,8 +32,8 @@ typedef struct list_node_t {
void *data;
} list_node_t;
typedef void (*list_action_t) (const void *);
typedef void (*list_action_node_t) (const list_node_t *);
typedef void (*list_action_t)(const void *);
typedef void (*list_action_node_t)(const list_node_t *);
typedef struct list_t {
list_node_t *head;

View file

@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: conf.c,v 1.9.4.59 2002/09/09 21:24:25 guus Exp $
$Id: conf.c,v 1.9.4.60 2002/09/09 22:32:30 guus Exp $
*/
#include "config.h"
@ -53,7 +53,7 @@ int pingtimeout = 0; /* seconds before timeout */
char *confbase = NULL; /* directory in which all config files are */
char *netname = NULL; /* name of the vpn network */
int config_compare(config_t * a, config_t * b)
int config_compare(config_t *a, config_t *b)
{
int result;
@ -92,7 +92,7 @@ config_t *new_config(void)
return (config_t *) xmalloc_and_zero(sizeof(config_t));
}
void free_config(config_t * cfg)
void free_config(config_t *cfg)
{
cp();
@ -108,14 +108,14 @@ void free_config(config_t * cfg)
free(cfg);
}
void config_add(avl_tree_t * config_tree, config_t * cfg)
void config_add(avl_tree_t *config_tree, config_t *cfg)
{
cp();
avl_insert(config_tree, cfg);
}
config_t *lookup_config(avl_tree_t * config_tree, char *variable)
config_t *lookup_config(avl_tree_t *config_tree, char *variable)
{
config_t cfg, *found;
@ -136,7 +136,7 @@ config_t *lookup_config(avl_tree_t * config_tree, char *variable)
return found;
}
config_t *lookup_config_next(avl_tree_t * config_tree, config_t * cfg)
config_t *lookup_config_next(avl_tree_t *config_tree, config_t *cfg)
{
avl_node_t *node;
config_t *found;
@ -157,7 +157,7 @@ config_t *lookup_config_next(avl_tree_t * config_tree, config_t * cfg)
return NULL;
}
int get_config_bool(config_t * cfg, int *result)
int get_config_bool(config_t *cfg, int *result)
{
cp();
@ -178,7 +178,7 @@ int get_config_bool(config_t * cfg, int *result)
return 0;
}
int get_config_int(config_t * cfg, int *result)
int get_config_int(config_t *cfg, int *result)
{
cp();
@ -194,7 +194,7 @@ int get_config_int(config_t * cfg, int *result)
return 0;
}
int get_config_string(config_t * cfg, char **result)
int get_config_string(config_t *cfg, char **result)
{
cp();
@ -206,7 +206,7 @@ int get_config_string(config_t * cfg, char **result)
return 1;
}
int get_config_address(config_t * cfg, struct addrinfo **result)
int get_config_address(config_t *cfg, struct addrinfo **result)
{
struct addrinfo *ai;
@ -228,7 +228,7 @@ int get_config_address(config_t * cfg, struct addrinfo **result)
return 0;
}
int get_config_port(config_t * cfg, port_t * result)
int get_config_port(config_t *cfg, port_t *result)
{
cp();
@ -246,7 +246,7 @@ int get_config_port(config_t * cfg, port_t * result)
return 0;
}
int get_config_subnet(config_t * cfg, subnet_t ** result)
int get_config_subnet(config_t *cfg, subnet_t ** result)
{
subnet_t *subnet;
@ -290,7 +290,7 @@ int get_config_subnet(config_t * cfg, subnet_t ** result)
given, and buf needs to be expanded, the var pointed to by buflen
will be increased.
*/
char *readline(FILE * fp, char **buf, size_t * buflen)
char *readline(FILE * fp, char **buf, size_t *buflen)
{
char *newline = NULL;
char *p;
@ -353,7 +353,7 @@ char *readline(FILE * fp, char **buf, size_t * buflen)
Parse a configuration file and put the results in the configuration tree
starting at *base.
*/
int read_config_file(avl_tree_t * config_tree, const char *fname)
int read_config_file(avl_tree_t *config_tree, const char *fname)
{
int err = -2; /* Parse error */
FILE *fp;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: connection.c,v 1.1.2.33 2002/09/09 21:24:31 guus Exp $
$Id: connection.c,v 1.1.2.34 2002/09/09 22:32:30 guus Exp $
*/
#include "config.h"
@ -43,7 +43,7 @@
avl_tree_t *connection_tree; /* Meta connections */
connection_t *broadcast;
int connection_compare(connection_t * a, connection_t * b)
int connection_compare(connection_t *a, connection_t *b)
{
return a - b;
}
@ -82,7 +82,7 @@ connection_t *new_connection(void)
return c;
}
void free_connection(connection_t * c)
void free_connection(connection_t *c)
{
cp();
@ -104,14 +104,14 @@ void free_connection(connection_t * c)
free(c);
}
void connection_add(connection_t * c)
void connection_add(connection_t *c)
{
cp();
avl_insert(connection_tree, c);
}
void connection_del(connection_t * c)
void connection_del(connection_t *c)
{
cp();
@ -136,7 +136,7 @@ void dump_connections(void)
syslog(LOG_DEBUG, _("End of connections."));
}
int read_connection_config(connection_t * c)
int read_connection_config(connection_t *c)
{
char *fname;
int x;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.2 2002/09/09 21:25:18 guus Exp $
$Id: device.c,v 1.1.2.3 2002/09/09 22:33:21 guus Exp $
*/
#include "config.h"
@ -83,7 +83,7 @@ void close_device(void)
cp close(device_fd);
}
int read_packet(vpn_packet_t * packet)
int read_packet(vpn_packet_t *packet)
{
int lenin;
cp if((lenin = read(device_fd, packet->data, MTU)) <= 0) {
@ -104,7 +104,7 @@ int read_packet(vpn_packet_t * packet)
return 0;
cp}
int write_packet(vpn_packet_t * packet)
int write_packet(vpn_packet_t *packet)
{
cp if(debug_lvl >= DEBUG_TRAFFIC)
syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"),

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.3 2002/09/09 21:25:19 guus Exp $
$Id: device.c,v 1.1.2.4 2002/09/09 22:33:23 guus Exp $
*/
#include "config.h"
@ -92,7 +92,7 @@ void close_device(void)
read, encrypt and send data that is
available through the ethertap device
*/
int read_packet(vpn_packet_t * packet)
int read_packet(vpn_packet_t *packet)
{
int lenin;
cp if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) {
@ -117,7 +117,7 @@ int read_packet(vpn_packet_t * packet)
return 0;
cp}
int write_packet(vpn_packet_t * packet)
int write_packet(vpn_packet_t *packet)
{
cp if(debug_lvl >= DEBUG_TRAFFIC)
syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"),

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: edge.c,v 1.1.2.16 2002/09/09 21:24:31 guus Exp $
$Id: edge.c,v 1.1.2.17 2002/09/09 22:32:30 guus Exp $
*/
#include "config.h"
@ -43,12 +43,12 @@
avl_tree_t *edge_weight_tree; /* Tree with all edges, sorted on weight */
int edge_compare(edge_t * a, edge_t * b)
int edge_compare(edge_t *a, edge_t *b)
{
return strcmp(a->to->name, b->to->name);
}
int edge_weight_compare(edge_t * a, edge_t * b)
int edge_weight_compare(edge_t *a, edge_t *b)
{
int result;
@ -80,7 +80,7 @@ avl_tree_t *new_edge_tree(void)
return avl_alloc_tree((avl_compare_t) edge_compare, NULL);
}
void free_edge_tree(avl_tree_t * edge_tree)
void free_edge_tree(avl_tree_t *edge_tree)
{
cp();
@ -103,14 +103,14 @@ edge_t *new_edge(void)
return (edge_t *) xmalloc_and_zero(sizeof(edge_t));
}
void free_edge(edge_t * e)
void free_edge(edge_t *e)
{
cp();
free(e);
}
void edge_add(edge_t * e)
void edge_add(edge_t *e)
{
cp();
@ -123,7 +123,7 @@ void edge_add(edge_t * e)
e->reverse->reverse = e;
}
void edge_del(edge_t * e)
void edge_del(edge_t *e)
{
cp();
@ -134,7 +134,7 @@ void edge_del(edge_t * e)
avl_delete(edge_weight_tree, e);
}
edge_t *lookup_edge(node_t * from, node_t * to)
edge_t *lookup_edge(node_t *from, node_t *to)
{
edge_t v;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: event.c,v 1.1.4.5 2002/09/09 21:24:31 guus Exp $
$Id: event.c,v 1.1.4.6 2002/09/09 22:32:30 guus Exp $
*/
#include "config.h"
@ -38,7 +38,7 @@ extern time_t now;
int id;
int event_compare(event_t * a, event_t * b)
int event_compare(event_t *a, event_t *b)
{
if(a->time > b->time)
return 1;
@ -70,14 +70,14 @@ event_t *new_event(void)
return (event_t *) xmalloc_and_zero(sizeof(event_t));
}
void free_event(event_t * event)
void free_event(event_t *event)
{
cp();
free(event);
}
void event_add(event_t * event)
void event_add(event_t *event)
{
cp();
@ -85,7 +85,7 @@ void event_add(event_t * event)
avl_insert(event_tree, event);
}
void event_del(event_t * event)
void event_del(event_t *event)
{
cp();

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: event.h,v 1.1.4.3 2002/09/09 21:24:34 guus Exp $
$Id: event.h,v 1.1.4.4 2002/09/09 22:32:36 guus Exp $
*/
#ifndef __TINC_EVENT_H__
@ -28,7 +28,7 @@
avl_tree_t *event_tree;
typedef void (*event_handler_t) (void *);
typedef void (*event_handler_t)(void *);
typedef struct {
time_t time;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.6 2002/09/09 21:25:19 guus Exp $
$Id: device.c,v 1.1.2.7 2002/09/09 22:33:23 guus Exp $
*/
#include "config.h"
@ -92,7 +92,7 @@ void close_device(void)
read, encrypt and send data that is
available through the ethertap device
*/
int read_packet(vpn_packet_t * packet)
int read_packet(vpn_packet_t *packet)
{
int lenin;
cp if((lenin = read(device_fd, packet->data, MTU)) <= 0) {
@ -112,7 +112,7 @@ int read_packet(vpn_packet_t * packet)
return 0;
cp}
int write_packet(vpn_packet_t * packet)
int write_packet(vpn_packet_t *packet)
{
cp if(debug_lvl >= DEBUG_TRAFFIC)
syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"),

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.11 2002/09/09 21:25:23 guus Exp $
$Id: device.c,v 1.1.2.12 2002/09/09 22:33:24 guus Exp $
*/
#include "config.h"
@ -73,7 +73,9 @@ int setup_device(void)
{
struct ifreq ifr;
cp if(!get_config_string(lookup_config(config_tree, "Device"), &device))
cp();
if(!get_config_string(lookup_config(config_tree, "Device"), &device))
device = DEFAULT_DEVICE;
if(!get_config_string(lookup_config(config_tree, "Interface"), &interface))
@ -82,13 +84,13 @@ int setup_device(void)
#else
interface = rindex(device, '/') ? rindex(device, '/') + 1 : device;
#endif
cp device_fd = open(device, O_RDWR | O_NONBLOCK);
device_fd = open(device, O_RDWR | O_NONBLOCK);
if(device_fd < 0) {
syslog(LOG_ERR, _("Could not open %s: %s"), device, strerror(errno));
return -1;
}
cp
/* Set default MAC address for ethertap devices */
mymac.type = SUBNET_MAC;
mymac.net.mac.address.x[0] = 0xfe;
@ -102,10 +104,12 @@ int setup_device(void)
/* Ok now check if this is an old ethertap or a new tun/tap thingie */
memset(&ifr, 0, sizeof(ifr));
cp ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
if(interface)
strncpy(ifr.ifr_name, interface, IFNAMSIZ);
cp if(!ioctl(device_fd, TUNSETIFF, (void *) &ifr)) {
if(!ioctl(device_fd, TUNSETIFF, (void *) &ifr)) {
device_info = _("Linux tun/tap device");
device_type = DEVICE_TYPE_TUNTAP;
strncpy(ifrname, ifr.ifr_name, IFNAMSIZ);
@ -125,22 +129,28 @@ int setup_device(void)
}
syslog(LOG_INFO, _("%s is a %s"), device, device_info);
cp return 0;
return 0;
}
void close_device(void)
{
cp close(device_fd);
cp();
close(device_fd);
}
/*
read, encrypt and send data that is
available through the ethertap device
*/
int read_packet(vpn_packet_t * packet)
int read_packet(vpn_packet_t *packet)
{
int lenin;
cp if(device_type == DEVICE_TYPE_TUNTAP) {
cp();
if(device_type == DEVICE_TYPE_TUNTAP) {
lenin = read(device_fd, packet->data, MTU);
if(lenin <= 0) {
@ -171,11 +181,13 @@ int read_packet(vpn_packet_t * packet)
}
return 0;
cp}
}
int write_packet(vpn_packet_t * packet)
int write_packet(vpn_packet_t *packet)
{
cp if(debug_lvl >= DEBUG_TRAFFIC)
cp();
if(debug_lvl >= DEBUG_TRAFFIC)
syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"),
packet->len, device_info);
@ -186,8 +198,8 @@ int write_packet(vpn_packet_t * packet)
return -1;
}
} else { /* ethertap */
*(short int *)(packet->data - 2) = packet->len;
*(short int *) (packet->data - 2) = packet->len;
if(write(device_fd, packet->data - 2, packet->len + 2) < 0) {
syslog(LOG_ERR, _("Can't write to %s %s: %s"), device_info, device,
strerror(errno));
@ -196,12 +208,15 @@ int write_packet(vpn_packet_t * packet)
}
device_total_out += packet->len;
cp return 0;
return 0;
}
void dump_device_stats(void)
{
cp syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device);
cp();
syslog(LOG_DEBUG, _("Statistics for %s %s:"), device_info, device);
syslog(LOG_DEBUG, _(" total bytes in: %10d"), device_total_in);
syslog(LOG_DEBUG, _(" total bytes out: %10d"), device_total_out);
cp}
}

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: meta.c,v 1.1.2.29 2002/09/09 21:24:34 guus Exp $
$Id: meta.c,v 1.1.2.30 2002/09/09 22:32:39 guus Exp $
*/
#include "config.h"
@ -39,7 +39,7 @@
#include "system.h"
#include "protocol.h"
int send_meta(connection_t * c, char *buffer, int length)
int send_meta(connection_t *c, char *buffer, int length)
{
char *bufp;
int outlen;
@ -67,7 +67,7 @@ int send_meta(connection_t * c, char *buffer, int length)
return 0;
}
void broadcast_meta(connection_t * from, char *buffer, int length)
void broadcast_meta(connection_t *from, char *buffer, int length)
{
avl_node_t *node;
connection_t *c;
@ -82,7 +82,7 @@ void broadcast_meta(connection_t * from, char *buffer, int length)
}
}
int receive_meta(connection_t * c)
int receive_meta(connection_t *c)
{
int x, l = sizeof(x);
int oldlen, i;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.c,v 1.35.4.180 2002/09/09 21:24:34 guus Exp $
$Id: net.c,v 1.35.4.181 2002/09/09 22:32:39 guus Exp $
*/
#include "config.h"
@ -166,7 +166,7 @@ void build_fdset(fd_set * fs)
- Check if we need to retry making an outgoing connection
- Deactivate the host
*/
void terminate_connection(connection_t * c, int report)
void terminate_connection(connection_t *c, int report)
{
cp();

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_packet.c,v 1.1.2.22 2002/09/09 21:24:41 guus Exp $
$Id: net_packet.c,v 1.1.2.23 2002/09/09 22:32:44 guus Exp $
*/
#include "config.h"
@ -85,7 +85,7 @@ int keyexpires = 0;
/* VPN packet I/O */
void receive_udppacket(node_t * n, vpn_packet_t * inpkt)
void receive_udppacket(node_t *n, vpn_packet_t *inpkt)
{
vpn_packet_t pkt1, pkt2;
vpn_packet_t *pkt[] = { &pkt1, &pkt2, &pkt1, &pkt2 };
@ -164,7 +164,7 @@ void receive_udppacket(node_t * n, vpn_packet_t * inpkt)
receive_packet(n, inpkt);
}
void receive_tcppacket(connection_t * c, char *buffer, int len)
void receive_tcppacket(connection_t *c, char *buffer, int len)
{
vpn_packet_t outpkt;
@ -176,7 +176,7 @@ void receive_tcppacket(connection_t * c, char *buffer, int len)
receive_packet(c->node, &outpkt);
}
void receive_packet(node_t * n, vpn_packet_t * packet)
void receive_packet(node_t *n, vpn_packet_t *packet)
{
cp();
@ -187,7 +187,7 @@ void receive_packet(node_t * n, vpn_packet_t * packet)
route_incoming(n, packet);
}
void send_udppacket(node_t * n, vpn_packet_t * inpkt)
void send_udppacket(node_t *n, vpn_packet_t *inpkt)
{
vpn_packet_t pkt1, pkt2;
vpn_packet_t *pkt[] = { &pkt1, &pkt2, &pkt1, &pkt2 };
@ -313,7 +313,7 @@ void send_udppacket(node_t * n, vpn_packet_t * inpkt)
/*
send a packet to the given vpn ip.
*/
void send_packet(node_t * n, vpn_packet_t * packet)
void send_packet(node_t *n, vpn_packet_t *packet)
{
node_t *via;
@ -353,7 +353,7 @@ void send_packet(node_t * n, vpn_packet_t * packet)
/* Broadcast a packet using the minimum spanning tree */
void broadcast_packet(node_t * from, vpn_packet_t * packet)
void broadcast_packet(node_t *from, vpn_packet_t *packet)
{
avl_node_t *node;
connection_t *c;
@ -372,7 +372,7 @@ void broadcast_packet(node_t * from, vpn_packet_t * packet)
}
}
void flush_queue(node_t * n)
void flush_queue(node_t *n)
{
list_node_t *node, *next;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_setup.c,v 1.1.2.25 2002/09/09 21:24:41 guus Exp $
$Id: net_setup.c,v 1.1.2.26 2002/09/09 22:32:44 guus Exp $
*/
#include "config.h"
@ -77,7 +77,7 @@
char *myport;
int read_rsa_public_key(connection_t * c)
int read_rsa_public_key(connection_t *c)
{
FILE *fp;
char *fname;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_socket.c,v 1.1.2.20 2002/09/09 21:24:41 guus Exp $
$Id: net_socket.c,v 1.1.2.21 2002/09/09 22:32:44 guus Exp $
*/
#include "config.h"
@ -84,7 +84,7 @@ int listen_sockets;
/* Setup sockets */
int setup_listen_socket(sockaddr_t * sa)
int setup_listen_socket(sockaddr_t *sa)
{
int nfd, flags;
char *addrstr;
@ -162,7 +162,7 @@ int setup_listen_socket(sockaddr_t * sa)
return nfd;
}
int setup_vpn_in_socket(sockaddr_t * sa)
int setup_vpn_in_socket(sockaddr_t *sa)
{
int nfd, flags;
char *addrstr;
@ -219,7 +219,7 @@ int setup_vpn_in_socket(sockaddr_t * sa)
return nfd;
}
void retry_outgoing(outgoing_t * outgoing)
void retry_outgoing(outgoing_t *outgoing)
{
event_t *event;
@ -242,7 +242,7 @@ void retry_outgoing(outgoing_t * outgoing)
outgoing->timeout);
}
int setup_outgoing_socket(connection_t * c)
int setup_outgoing_socket(connection_t *c)
{
int option;
@ -288,7 +288,7 @@ int setup_outgoing_socket(connection_t * c)
}
void finish_connecting(connection_t * c)
void finish_connecting(connection_t *c)
{
cp();
@ -300,7 +300,7 @@ void finish_connecting(connection_t * c)
send_id(c);
}
void do_outgoing_connection(connection_t * c)
void do_outgoing_connection(connection_t *c)
{
char *address, *port;
int option, result, flags;
@ -403,7 +403,7 @@ begin:
return;
}
void setup_outgoing_connection(outgoing_t * outgoing)
void setup_outgoing_connection(outgoing_t *outgoing)
{
connection_t *c;
node_t *n;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.5 2002/09/09 21:25:23 guus Exp $
$Id: device.c,v 1.1.2.6 2002/09/09 22:33:24 guus Exp $
*/
#include "config.h"
@ -93,7 +93,7 @@ void close_device(void)
cp close(device_fd);
cp}
int read_packet(vpn_packet_t * packet)
int read_packet(vpn_packet_t *packet)
{
int lenin;
cp if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) {
@ -119,7 +119,7 @@ int read_packet(vpn_packet_t * packet)
return 0;
cp}
int write_packet(vpn_packet_t * packet)
int write_packet(vpn_packet_t *packet)
{
cp if(debug_lvl >= DEBUG_TRAFFIC)
syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"),

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: netutl.c,v 1.12.4.43 2002/09/09 21:24:41 guus Exp $
$Id: netutl.c,v 1.12.4.44 2002/09/09 22:32:44 guus Exp $
*/
#include "config.h"
@ -107,7 +107,7 @@ sockaddr_t str2sockaddr(char *address, char *port)
return result;
}
void sockaddr2str(sockaddr_t * sa, char **addrstr, char **portstr)
void sockaddr2str(sockaddr_t *sa, char **addrstr, char **portstr)
{
char address[NI_MAXHOST];
char port[NI_MAXSERV];
@ -135,7 +135,7 @@ void sockaddr2str(sockaddr_t * sa, char **addrstr, char **portstr)
*portstr = xstrdup(port);
}
char *sockaddr2hostname(sockaddr_t * sa)
char *sockaddr2hostname(sockaddr_t *sa)
{
char *str;
char address[NI_MAXHOST] = "unknown";
@ -156,7 +156,7 @@ char *sockaddr2hostname(sockaddr_t * sa)
return str;
}
int sockaddrcmp(sockaddr_t * a, sockaddr_t * b)
int sockaddrcmp(sockaddr_t *a, sockaddr_t *b)
{
int result;
@ -196,7 +196,7 @@ int sockaddrcmp(sockaddr_t * a, sockaddr_t * b)
}
}
void sockaddrunmap(sockaddr_t * sa)
void sockaddrunmap(sockaddr_t *sa)
{
if(sa->sa.sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&sa->in6.sin6_addr)) {
sa->in.sin_addr.s_addr = ((uint32_t *) & sa->in6.sin6_addr)[3];

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: node.c,v 1.1.2.17 2002/09/09 21:24:41 guus Exp $
$Id: node.c,v 1.1.2.18 2002/09/09 22:32:49 guus Exp $
*/
#include "config.h"
@ -39,12 +39,12 @@ avl_tree_t *node_udp_tree; /* Known nodes, sorted by address and port */
node_t *myself;
int node_compare(node_t * a, node_t * b)
int node_compare(node_t *a, node_t *b)
{
return strcmp(a->name, b->name);
}
int node_udp_compare(node_t * a, node_t * b)
int node_udp_compare(node_t *a, node_t *b)
{
int result;
@ -87,7 +87,7 @@ node_t *new_node(void)
return n;
}
void free_node(node_t * n)
void free_node(node_t *n)
{
cp();
@ -112,7 +112,7 @@ void free_node(node_t * n)
free(n);
}
void node_add(node_t * n)
void node_add(node_t *n)
{
cp();
@ -120,7 +120,7 @@ void node_add(node_t * n)
avl_insert(node_udp_tree, n);
}
void node_del(node_t * n)
void node_del(node_t *n)
{
avl_node_t *node, *next;
edge_t *e;
@ -152,7 +152,7 @@ node_t *lookup_node(char *name)
return avl_search(node_tree, &n);
}
node_t *lookup_node_udp(sockaddr_t * sa)
node_t *lookup_node_udp(sockaddr_t *sa)
{
node_t n;
cp();

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.10 2002/09/09 21:25:26 guus Exp $
$Id: device.c,v 1.1.2.11 2002/09/09 22:33:27 guus Exp $
*/
#include "config.h"
@ -93,7 +93,7 @@ void close_device(void)
cp close(device_fd);
cp}
int read_packet(vpn_packet_t * packet)
int read_packet(vpn_packet_t *packet)
{
int lenin;
u_int32_t type;
@ -139,7 +139,7 @@ int read_packet(vpn_packet_t * packet)
return 0;
cp}
int write_packet(vpn_packet_t * packet)
int write_packet(vpn_packet_t *packet)
{
u_int32_t type;
struct iovec vector[2];

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: process.c,v 1.1.2.46 2002/09/09 21:24:41 guus Exp $
$Id: process.c,v 1.1.2.47 2002/09/09 22:32:49 guus Exp $
*/
#include "config.h"
@ -423,7 +423,7 @@ RETSIGTYPE ignore_signal_handler(int a)
struct {
int signal;
void (*handler) (int);
void (*handler)(int);
} sighandlers[] = {
{
SIGHUP, sighup_handler}, {

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol.c,v 1.28.4.136 2002/09/09 21:24:41 guus Exp $
$Id: protocol.c,v 1.28.4.137 2002/09/09 22:32:49 guus Exp $
*/
#include "config.h"
@ -57,7 +57,7 @@ int check_id(char *id)
/* Generic request routines - takes care of logging and error
detection as well */
int send_request(connection_t * c, const char *format, ...)
int send_request(connection_t *c, const char *format, ...)
{
va_list args;
char buffer[MAXBUFSIZE];
@ -97,7 +97,7 @@ int send_request(connection_t * c, const char *format, ...)
return send_meta(c, buffer, len);
}
int forward_request(connection_t * from)
int forward_request(connection_t *from)
{
int request;
cp();
@ -120,7 +120,7 @@ int forward_request(connection_t * from)
return broadcast_meta(from, from->buffer, from->reqlen);
}
int receive_request(connection_t * c)
int receive_request(connection_t *c)
{
int request;
@ -170,12 +170,12 @@ int receive_request(connection_t * c)
return 0;
}
int past_request_compare(past_request_t * a, past_request_t * b)
int past_request_compare(past_request_t *a, past_request_t *b)
{
return strcmp(a->request, b->request);
}
void free_past_request(past_request_t * r)
void free_past_request(past_request_t *r)
{
cp();
@ -245,7 +245,7 @@ void age_past_requests(void)
/* Jumptable for the request handlers */
int (*request_handlers[]) (connection_t *) = {
int (*request_handlers[])(connection_t *) = {
id_h, metakey_h, challenge_h, chal_reply_h, ack_h,
status_h, error_h, termreq_h,
ping_h, pong_h,

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol.h,v 1.5.4.35 2002/09/09 21:24:42 guus Exp $
$Id: protocol.h,v 1.5.4.36 2002/09/09 22:32:55 guus Exp $
*/
#ifndef __TINC_PROTOCOL_H__
@ -93,7 +93,7 @@ extern int send_tcppacket(connection_t *, vpn_packet_t *);
/* Request handlers */
extern int (*request_handlers[]) (connection_t *);
extern int (*request_handlers[])(connection_t *);
extern int id_h(connection_t *);
extern int metakey_h(connection_t *);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_auth.c,v 1.1.4.16 2002/09/09 21:24:45 guus Exp $
$Id: protocol_auth.c,v 1.1.4.17 2002/09/09 22:32:59 guus Exp $
*/
#include "config.h"
@ -53,7 +53,7 @@
#include "system.h"
int send_id(connection_t * c)
int send_id(connection_t *c)
{
cp();
@ -61,7 +61,7 @@ int send_id(connection_t * c)
myself->connection->protocol_version);
}
int id_h(connection_t * c)
int id_h(connection_t *c)
{
char name[MAX_STRING_SIZE];
int bla;
@ -137,7 +137,7 @@ int id_h(connection_t * c)
return send_metakey(c);
}
int send_metakey(connection_t * c)
int send_metakey(connection_t *c)
{
char buffer[MAX_STRING_SIZE];
int len, x;
@ -216,7 +216,7 @@ int send_metakey(connection_t * c)
return x;
}
int metakey_h(connection_t * c)
int metakey_h(connection_t *c)
{
char buffer[MAX_STRING_SIZE];
int cipher, digest, maclength, compression;
@ -319,7 +319,7 @@ int metakey_h(connection_t * c)
return send_challenge(c);
}
int send_challenge(connection_t * c)
int send_challenge(connection_t *c)
{
char buffer[MAX_STRING_SIZE];
int len, x;
@ -351,7 +351,7 @@ int send_challenge(connection_t * c)
return x;
}
int challenge_h(connection_t * c)
int challenge_h(connection_t *c)
{
char buffer[MAX_STRING_SIZE];
int len;
@ -390,7 +390,7 @@ int challenge_h(connection_t * c)
return send_chal_reply(c);
}
int send_chal_reply(connection_t * c)
int send_chal_reply(connection_t *c)
{
char hash[EVP_MAX_MD_SIZE * 2 + 1];
EVP_MD_CTX ctx;
@ -414,7 +414,7 @@ int send_chal_reply(connection_t * c)
return send_request(c, "%d %s", CHAL_REPLY, hash);
}
int chal_reply_h(connection_t * c)
int chal_reply_h(connection_t *c)
{
char hishash[MAX_STRING_SIZE];
char myhash[EVP_MAX_MD_SIZE];
@ -470,7 +470,7 @@ int chal_reply_h(connection_t * c)
return send_ack(c);
}
int send_ack(connection_t * c)
int send_ack(connection_t *c)
{
/* ACK message contains rest of the information the other end needs
to create node_t and edge_t structures. */
@ -492,7 +492,7 @@ int send_ack(connection_t * c)
return x;
}
void send_everything(connection_t * c)
void send_everything(connection_t *c)
{
avl_node_t *node, *node2;
node_t *n;
@ -516,7 +516,7 @@ void send_everything(connection_t * c)
}
}
int ack_h(connection_t * c)
int ack_h(connection_t *c)
{
char hisport[MAX_STRING_SIZE];
char *hisaddress, *dummy;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_edge.c,v 1.1.4.12 2002/09/09 21:24:48 guus Exp $
$Id: protocol_edge.c,v 1.1.4.13 2002/09/09 22:33:02 guus Exp $
*/
#include "config.h"
@ -45,7 +45,7 @@
#include "system.h"
int send_add_edge(connection_t * c, edge_t * e)
int send_add_edge(connection_t *c, edge_t *e)
{
int x;
char *address, *port;
@ -63,7 +63,7 @@ int send_add_edge(connection_t * c, edge_t * e)
return x;
}
int add_edge_h(connection_t * c)
int add_edge_h(connection_t *c)
{
edge_t *e;
node_t *from, *to;
@ -174,7 +174,7 @@ int add_edge_h(connection_t * c)
return 0;
}
int send_del_edge(connection_t * c, edge_t * e)
int send_del_edge(connection_t *c, edge_t *e)
{
cp();
@ -182,7 +182,7 @@ int send_del_edge(connection_t * c, edge_t * e)
e->from->name, e->to->name);
}
int del_edge_h(connection_t * c)
int del_edge_h(connection_t *c)
{
edge_t *e;
char from_name[MAX_STRING_SIZE];

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_key.c,v 1.1.4.13 2002/09/09 21:24:56 guus Exp $
$Id: protocol_key.c,v 1.1.4.14 2002/09/09 22:33:03 guus Exp $
*/
#include "config.h"
@ -45,7 +45,7 @@
int mykeyused = 0;
int send_key_changed(connection_t * c, node_t * n)
int send_key_changed(connection_t *c, node_t *n)
{
cp();
@ -59,7 +59,7 @@ int send_key_changed(connection_t * c, node_t * n)
return send_request(c, "%d %lx %s", KEY_CHANGED, random(), n->name);
}
int key_changed_h(connection_t * c)
int key_changed_h(connection_t *c)
{
char name[MAX_STRING_SIZE];
node_t *n;
@ -93,14 +93,14 @@ int key_changed_h(connection_t * c)
return 0;
}
int send_req_key(connection_t * c, node_t * from, node_t * to)
int send_req_key(connection_t *c, node_t *from, node_t *to)
{
cp();
return send_request(c, "%d %s %s", REQ_KEY, from->name, to->name);
}
int req_key_h(connection_t * c)
int req_key_h(connection_t *c)
{
char from_name[MAX_STRING_SIZE];
char to_name[MAX_STRING_SIZE];
@ -143,7 +143,7 @@ int req_key_h(connection_t * c)
return 0;
}
int send_ans_key(connection_t * c, node_t * from, node_t * to)
int send_ans_key(connection_t *c, node_t *from, node_t *to)
{
char key[MAX_STRING_SIZE];
@ -159,7 +159,7 @@ int send_ans_key(connection_t * c, node_t * from, node_t * to)
from->compression);
}
int ans_key_h(connection_t * c)
int ans_key_h(connection_t *c)
{
char from_name[MAX_STRING_SIZE];
char to_name[MAX_STRING_SIZE];

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_misc.c,v 1.1.4.6 2002/09/09 21:25:02 guus Exp $
$Id: protocol_misc.c,v 1.1.4.7 2002/09/09 22:33:04 guus Exp $
*/
#include "config.h"
@ -42,7 +42,7 @@
/* Status and error notification routines */
int send_status(connection_t * c, int statusno, char *statusstring)
int send_status(connection_t *c, int statusno, char *statusstring)
{
cp();
@ -52,7 +52,7 @@ int send_status(connection_t * c, int statusno, char *statusstring)
return send_request(c, "%d %d %s", STATUS, statusno, statusstring);
}
int status_h(connection_t * c)
int status_h(connection_t *c)
{
int statusno;
char statusstring[MAX_STRING_SIZE];
@ -73,7 +73,7 @@ int status_h(connection_t * c)
return 0;
}
int send_error(connection_t * c, int err, char *errstring)
int send_error(connection_t *c, int err, char *errstring)
{
cp();
@ -83,7 +83,7 @@ int send_error(connection_t * c, int err, char *errstring)
return send_request(c, "%d %d %s", ERROR, err, errstring);
}
int error_h(connection_t * c)
int error_h(connection_t *c)
{
int err;
char errorstring[MAX_STRING_SIZE];
@ -106,14 +106,14 @@ int error_h(connection_t * c)
return 0;
}
int send_termreq(connection_t * c)
int send_termreq(connection_t *c)
{
cp();
return send_request(c, "%d", TERMREQ);
}
int termreq_h(connection_t * c)
int termreq_h(connection_t *c)
{
cp();
@ -122,7 +122,7 @@ int termreq_h(connection_t * c)
return 0;
}
int send_ping(connection_t * c)
int send_ping(connection_t *c)
{
cp();
@ -132,21 +132,21 @@ int send_ping(connection_t * c)
return send_request(c, "%d", PING);
}
int ping_h(connection_t * c)
int ping_h(connection_t *c)
{
cp();
return send_pong(c);
}
int send_pong(connection_t * c)
int send_pong(connection_t *c)
{
cp();
return send_request(c, "%d", PONG);
}
int pong_h(connection_t * c)
int pong_h(connection_t *c)
{
cp();
@ -162,7 +162,7 @@ int pong_h(connection_t * c)
/* Sending and receiving packets via TCP */
int send_tcppacket(connection_t * c, vpn_packet_t * packet)
int send_tcppacket(connection_t *c, vpn_packet_t *packet)
{
int x;
@ -178,7 +178,7 @@ int send_tcppacket(connection_t * c, vpn_packet_t * packet)
return send_meta(c, packet->data, packet->len);
}
int tcppacket_h(connection_t * c)
int tcppacket_h(connection_t *c)
{
short int len;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_node.c,v 1.1.4.8 2002/09/09 21:25:02 guus Exp $
$Id: protocol_node.c,v 1.1.4.9 2002/09/09 22:33:08 guus Exp $
*/
#include "config.h"
@ -43,7 +43,7 @@
#include "system.h"
int send_add_node(connection_t * c, node_t * n)
int send_add_node(connection_t *c, node_t *n)
{
int x;
char *address, *port;
@ -60,7 +60,7 @@ int send_add_node(connection_t * c, node_t * n)
return x;
}
int add_node_h(connection_t * c)
int add_node_h(connection_t *c)
{
connection_t *other;
node_t *n, *prevhop, *via;
@ -178,13 +178,13 @@ int add_node_h(connection_t * c)
return 0;
}
int send_del_node(connection_t * c, node_t * n)
int send_del_node(connection_t *c, node_t *n)
{
cp();
return send_request(c, "%d %s %s", DEL_NODE, n->name, n->prevhop->name);
}
int del_node_h(connection_t * c)
int del_node_h(connection_t *c)
{
char name[MAX_STRING_SIZE];
char prevhopname[MAX_STRING_SIZE];

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_subnet.c,v 1.1.4.8 2002/09/09 21:25:02 guus Exp $
$Id: protocol_subnet.c,v 1.1.4.9 2002/09/09 22:33:13 guus Exp $
*/
#include "config.h"
@ -43,7 +43,7 @@
#include "system.h"
int send_add_subnet(connection_t * c, subnet_t * subnet)
int send_add_subnet(connection_t *c, subnet_t *subnet)
{
int x;
char *netstr;
@ -58,7 +58,7 @@ int send_add_subnet(connection_t * c, subnet_t * subnet)
return x;
}
int add_subnet_h(connection_t * c)
int add_subnet_h(connection_t *c)
{
char subnetstr[MAX_STRING_SIZE];
char name[MAX_STRING_SIZE];
@ -133,7 +133,7 @@ int add_subnet_h(connection_t * c)
return 0;
}
int send_del_subnet(connection_t * c, subnet_t * s)
int send_del_subnet(connection_t *c, subnet_t *s)
{
int x;
char *netstr;
@ -149,7 +149,7 @@ int send_del_subnet(connection_t * c, subnet_t * s)
return x;
}
int del_subnet_h(connection_t * c)
int del_subnet_h(connection_t *c)
{
char subnetstr[MAX_STRING_SIZE];
char name[MAX_STRING_SIZE];

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.2 2002/09/09 21:25:28 guus Exp $
$Id: device.c,v 1.1.2.3 2002/09/09 22:33:31 guus Exp $
*/
#include "config.h"
@ -117,7 +117,7 @@ void close_device(void)
read, encrypt and send data that is
available through the ethertap device
*/
int read_packet(vpn_packet_t * packet)
int read_packet(vpn_packet_t *packet)
{
int lenin;
cp if((lenin = read(device_fd, packet->data, MTU)) <= 0) {
@ -138,7 +138,7 @@ int read_packet(vpn_packet_t * packet)
return 0;
cp}
int write_packet(vpn_packet_t * packet)
int write_packet(vpn_packet_t *packet)
{
cp if(debug_lvl >= DEBUG_TRAFFIC)
syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"),

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: route.c,v 1.1.2.45 2002/09/09 21:25:07 guus Exp $
$Id: route.c,v 1.1.2.46 2002/09/09 22:33:16 guus Exp $
*/
#include "config.h"
@ -67,7 +67,7 @@ int priorityinheritance = 0;
int macexpire = 600;
subnet_t mymac;
void learn_mac(mac_t * address)
void learn_mac(mac_t *address)
{
subnet_t *subnet;
avl_node_t *node;
@ -131,7 +131,7 @@ void age_mac(void)
}
}
node_t *route_mac(vpn_packet_t * packet)
node_t *route_mac(vpn_packet_t *packet)
{
subnet_t *subnet;
@ -139,11 +139,11 @@ node_t *route_mac(vpn_packet_t * packet)
/* Learn source address */
learn_mac((mac_t *) (&packet->data[6]));
learn_mac((mac_t *)(&packet->data[6]));
/* Lookup destination address */
subnet = lookup_subnet_mac((mac_t *) (&packet->data[0]));
subnet = lookup_subnet_mac((mac_t *)(&packet->data[0]));
if(subnet)
return subnet->owner;
@ -151,7 +151,7 @@ node_t *route_mac(vpn_packet_t * packet)
return NULL;
}
node_t *route_ipv4(vpn_packet_t * packet)
node_t *route_ipv4(vpn_packet_t *packet)
{
subnet_t *subnet;
@ -175,7 +175,7 @@ node_t *route_ipv4(vpn_packet_t * packet)
return subnet->owner;
}
node_t *route_ipv6(vpn_packet_t * packet)
node_t *route_ipv6(vpn_packet_t *packet)
{
subnet_t *subnet;
@ -202,7 +202,7 @@ node_t *route_ipv6(vpn_packet_t * packet)
return subnet->owner;
}
uint16_t inet_checksum(uint16_t * data, int len, uint16_t prevsum)
uint16_t inet_checksum(uint16_t *data, int len, uint16_t prevsum)
{
uint32_t checksum = prevsum ^ 0xFFFF;
@ -215,7 +215,7 @@ uint16_t inet_checksum(uint16_t * data, int len, uint16_t prevsum)
return checksum ^ 0xFFFF;
}
void route_neighborsol(vpn_packet_t * packet)
void route_neighborsol(vpn_packet_t *packet)
{
struct ip6_hdr *hdr;
struct nd_neighbor_solicit *ns;
@ -232,9 +232,9 @@ void route_neighborsol(vpn_packet_t * packet)
cp();
hdr = (struct ip6_hdr *) (packet->data + 14);
ns = (struct nd_neighbor_solicit *) (packet->data + 14 + sizeof(*hdr));
opt = (struct nd_opt_hdr *) (packet->data + 14 + sizeof(*hdr) + sizeof(*ns));
hdr = (struct ip6_hdr *)(packet->data + 14);
ns = (struct nd_neighbor_solicit *)(packet->data + 14 + sizeof(*hdr));
opt = (struct nd_opt_hdr *)(packet->data + 14 + sizeof(*hdr) + sizeof(*ns));
/* First, snatch the source address from the neighbor solicitation packet */
@ -330,7 +330,7 @@ void route_neighborsol(vpn_packet_t * packet)
write_packet(packet);
}
void route_arp(vpn_packet_t * packet)
void route_arp(vpn_packet_t *packet)
{
struct ether_arp *arp;
subnet_t *subnet;
@ -347,7 +347,7 @@ void route_arp(vpn_packet_t * packet)
Most of the code here is taken from choparp.c by Takamichi Tateoka (tree@mma.club.uec.ac.jp)
*/
arp = (struct ether_arp *) (packet->data + 14);
arp = (struct ether_arp *)(packet->data + 14);
/* Check if this is a valid ARP request */
@ -392,7 +392,7 @@ void route_arp(vpn_packet_t * packet)
write_packet(packet);
}
void route_outgoing(vpn_packet_t * packet)
void route_outgoing(vpn_packet_t *packet)
{
uint16_t type;
node_t *n = NULL;
@ -403,7 +403,7 @@ void route_outgoing(vpn_packet_t * packet)
switch (routing_mode) {
case RMODE_ROUTER:
type = ntohs(*((uint16_t *) (&packet->data[12])));
type = ntohs(*((uint16_t *)(&packet->data[12])));
switch (type) {
case 0x0800:
n = route_ipv4(packet);
@ -444,7 +444,7 @@ void route_outgoing(vpn_packet_t * packet)
}
}
void route_incoming(node_t * source, vpn_packet_t * packet)
void route_incoming(node_t *source, vpn_packet_t *packet)
{
switch (routing_mode) {
case RMODE_ROUTER:
@ -452,7 +452,7 @@ void route_incoming(node_t * source, vpn_packet_t * packet)
node_t *n = NULL;
uint16_t type;
type = ntohs(*((uint16_t *) (&packet->data[12])));
type = ntohs(*((uint16_t *)(&packet->data[12])));
switch (type) {
case 0x0800:
n = route_ipv4(packet);
@ -481,7 +481,7 @@ void route_incoming(node_t * source, vpn_packet_t * packet)
{
subnet_t *subnet;
subnet = lookup_subnet_mac((mac_t *) (&packet->data[0]));
subnet = lookup_subnet_mac((mac_t *)(&packet->data[0]));
if(subnet) {
if(subnet->owner == myself)

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: device.c,v 1.1.2.9 2002/09/09 21:25:28 guus Exp $
$Id: device.c,v 1.1.2.10 2002/09/09 22:33:31 guus Exp $
*/
@ -136,7 +136,7 @@ void close_device(void)
cp close(device_fd);
}
int read_packet(vpn_packet_t * packet)
int read_packet(vpn_packet_t *packet)
{
int lenin;
cp if((lenin = read(device_fd, packet->data + 14, MTU - 14)) <= 0) {
@ -162,7 +162,7 @@ int read_packet(vpn_packet_t * packet)
return 0;
cp}
int write_packet(vpn_packet_t * packet)
int write_packet(vpn_packet_t *packet)
{
cp if(debug_lvl >= DEBUG_TRAFFIC)
syslog(LOG_DEBUG, _("Writing packet of %d bytes to %s"),

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: subnet.c,v 1.1.2.41 2002/09/09 21:25:10 guus Exp $
$Id: subnet.c,v 1.1.2.42 2002/09/09 22:33:21 guus Exp $
*/
#include "config.h"
@ -48,7 +48,7 @@ avl_tree_t *subnet_tree;
/* Subnet comparison */
int subnet_compare_mac(subnet_t * a, subnet_t * b)
int subnet_compare_mac(subnet_t *a, subnet_t *b)
{
int result;
@ -60,7 +60,7 @@ int subnet_compare_mac(subnet_t * a, subnet_t * b)
return strcmp(a->owner->name, b->owner->name);
}
int subnet_compare_ipv4(subnet_t * a, subnet_t * b)
int subnet_compare_ipv4(subnet_t *a, subnet_t *b)
{
int result;
@ -77,7 +77,7 @@ int subnet_compare_ipv4(subnet_t * a, subnet_t * b)
return strcmp(a->owner->name, b->owner->name);
}
int subnet_compare_ipv6(subnet_t * a, subnet_t * b)
int subnet_compare_ipv6(subnet_t *a, subnet_t *b)
{
int result;
@ -94,7 +94,7 @@ int subnet_compare_ipv6(subnet_t * a, subnet_t * b)
return strcmp(a->owner->name, b->owner->name);
}
int subnet_compare(subnet_t * a, subnet_t * b)
int subnet_compare(subnet_t *a, subnet_t *b)
{
int result;
@ -145,7 +145,7 @@ avl_tree_t *new_subnet_tree(void)
return avl_alloc_tree((avl_compare_t) subnet_compare, NULL);
}
void free_subnet_tree(avl_tree_t * subnet_tree)
void free_subnet_tree(avl_tree_t *subnet_tree)
{
cp();
@ -161,7 +161,7 @@ subnet_t *new_subnet(void)
return (subnet_t *) xmalloc_and_zero(sizeof(subnet_t));
}
void free_subnet(subnet_t * subnet)
void free_subnet(subnet_t *subnet)
{
cp();
@ -170,7 +170,7 @@ void free_subnet(subnet_t * subnet)
/* Adding and removing subnets */
void subnet_add(node_t * n, subnet_t * subnet)
void subnet_add(node_t *n, subnet_t *subnet)
{
cp();
@ -180,7 +180,7 @@ void subnet_add(node_t * n, subnet_t * subnet)
avl_insert(n->subnet_tree, subnet);
}
void subnet_del(node_t * n, subnet_t * subnet)
void subnet_del(node_t *n, subnet_t *subnet)
{
cp();
@ -259,7 +259,7 @@ subnet_t *str2net(char *subnetstr)
return NULL;
}
char *net2str(subnet_t * subnet)
char *net2str(subnet_t *subnet)
{
char *netstr;
@ -309,14 +309,14 @@ char *net2str(subnet_t * subnet)
/* Subnet lookup routines */
subnet_t *lookup_subnet(node_t * owner, subnet_t * subnet)
subnet_t *lookup_subnet(node_t *owner, subnet_t *subnet)
{
cp();
return avl_search(owner->subnet_tree, subnet);
}
subnet_t *lookup_subnet_mac(mac_t * address)
subnet_t *lookup_subnet_mac(mac_t *address)
{
subnet_t subnet, *p;
@ -331,7 +331,7 @@ subnet_t *lookup_subnet_mac(mac_t * address)
return p;
}
subnet_t *lookup_subnet_ipv4(ipv4_t * address)
subnet_t *lookup_subnet_ipv4(ipv4_t *address)
{
subnet_t subnet, *p;
@ -369,7 +369,7 @@ subnet_t *lookup_subnet_ipv4(ipv4_t * address)
return p;
}
subnet_t *lookup_subnet_ipv6(ipv6_t * address)
subnet_t *lookup_subnet_ipv6(ipv6_t *address)
{
subnet_t subnet, *p;