2 connlist.h -- header for connlist.c
3 Copyright (C) 2000 Guus Sliepen <guus@sliepen.warande.net>,
4 2000 Ivo Timmermans <itimmermans@bigfoot.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 $Id: connlist.h,v 1.1.2.6 2000/10/29 00:02:18 guus Exp $
23 #ifndef __TINC_CONNLIST_H__
24 #define __TINC_CONNLIST_H__
26 #include <openssl/evp.h>
27 #include <openssl/rsa.h>
32 typedef struct conn_list_t {
33 char *name; /* name of this connection */
34 ipv4_t address; /* his real (internet) ip */
35 char *hostname; /* the hostname of its real ip */
36 short unsigned int port; /* his portnumber */
37 int protocol_version; /* used protocol */
38 long int options; /* options turned on for this connection */
40 int flags; /* his flags */
41 int socket; /* our udp vpn socket */
42 int meta_socket; /* our tcp meta socket */
43 status_bits_t status; /* status info */
44 packet_queue_t *sq; /* pending outgoing packets */
45 packet_queue_t *rq; /* pending incoming packets (they have no
46 valid key to be decrypted with) */
47 RSA *rsa_key; /* the public/private key */
49 EVP_CIPHER_CTX *cipher_inctx; /* Context of encrypted meta data that will come from him to us */
50 EVP_CIPHER_CTX *cipher_outctx; /* Context of encrypted meta data that will be sent from us to him */
52 EVP_CIPHER_CTX *cipher_pktctx; /* Context of encrypted vpn packets that will be sent to him */
53 EVP_CIPHER *cipher_pkttype; /* Cipher type for encrypted vpn packets */
54 char *cipher_pktkey; /* Cipher key */
56 char *buffer; /* metadata input buffer */
57 int buflen; /* bytes read into buffer */
58 int reqlen; /* length of first request in buffer */
59 int allow_request; /* defined if there's only one request possible */
61 time_t last_ping_time; /* last time we saw some activity from the other end */
62 int want_ping; /* 0 if there's no need to check for activity. Shouldn't this go into status? (GS) */
64 char *mychallenge; /* challenge we received from him */
65 char *hischallenge; /* challenge we sent to him */
67 struct conn_list_t *nexthop; /* nearest meta-hop in this direction */
69 struct subnet_t *subnets; /* Pointer to a list of subnets belonging to this connection */
71 struct config_t *config; /* Pointer to configuration tree belonging to this host */
73 struct conn_list_t *next; /* after all, it's a list of connections */
74 struct conn_list_t *prev; /* doubly linked for O(1) deletions */
79 extern conn_list_t *conn_list;
80 extern conn_list_t *myself;
82 extern conn_list_t *new_conn_list();
83 extern void free_conn_list(conn_list_t *);
84 extern void conn_list_add(conn_list_t *);
85 extern void conn_list_del(conn_list_t *);
86 extern conn_list_t *lookup_id(char *);
87 extern void dump_conn_list(void);
88 extern int read_host_config(conn_list_t *);
90 #endif /* __TINC_CONNLIST_H__ */