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.1 2000/10/11 10:35:15 guus Exp $
23 #ifndef __TINC_CONNLIST_H__
24 #define __TINC_CONNLIST_H__
26 #include <openssl/evp.h>
31 typedef struct conn_list_t {
32 char *name; /* name of this connection */
33 ip_t real_ip; /* his real (internet) ip */
34 char *hostname; /* the hostname of its real ip */
35 short unsigned int port; /* his portnumber */
36 int protocol_version; /* used protocol */
37 int options; /* options turned on for this connection */
39 int flags; /* his flags */
40 int socket; /* our udp vpn socket */
41 int meta_socket; /* our tcp meta socket */
42 status_bits_t status; /* status info */
43 packet_queue_t *sq; /* pending outgoing packets */
44 packet_queue_t *rq; /* pending incoming packets (they have no
45 valid key to be decrypted with) */
46 enc_key_t *public_key; /* the other party's public key */
47 enc_key_t *datakey; /* encrypt data packets with this key */
50 EVP_CIPHER_CTX *cipher_inctx; /* Context of encrypted meta data that will come from him to us */
51 EVP_CIPHER_CTX *cipher_outctx; /* Context of encrypted meta data that will be sent from us to him */
53 EVP_CIPHER_CTX *cipher_pktctx; /* Context of encrypted vpn packets that will be sent to him */
54 EVP_CIPHER *cipher_pkttype; /* Cipher type for encrypted vpn packets */
55 char *cipher_pktkey; /* Cipher key */
56 char *cipher_pktiv; /* Cipher input vector */
58 char *buffer; /* metadata input buffer */
59 int buflen; /* bytes read into buffer */
60 int reqlen; /* length of first request in buffer */
61 int allow_request; /* defined if there's only one request possible */
63 time_t last_ping_time; /* last time we saw some activity from the other end */
64 int want_ping; /* 0 if there's no need to check for activity. Shouldn't this go into status? (GS) */
66 char *mychallenge; /* challenge we received from him */
67 char *hischallenge; /* challenge we sent to him */
69 struct conn_list_t *nexthop; /* nearest meta-hop in this direction, will be changed to myuplink (GS) */
70 struct conn_list_t *hisuplink; /* his nearest meta-hop in our direction */
71 struct conn_list_t *myuplink; /* our nearest meta-hop in his direction */
73 struct subnet_t *subnets; /* Pointer to a list of subnets belonging to this connection */
75 struct conn_list_t *next; /* after all, it's a list of connections */
78 extern conn_list_t *conn_list;
79 extern conn_list_t *myself;
81 extern conn_list_t *new_conn_list();
82 extern void free_conn_list(conn_list_t *);
83 extern void add_conn_list(conn_list_t *);
84 extern void del_conn_list(conn_list_t *);
85 extern conn_list_t *lookup_conn_list_mac(mac_t);
86 extern conn_list_t *lookup_conn_list_ipv4(ipv4_t);
87 extern conn_list_t *lookup_conn_list_ipv6(ipv6_t);
88 extern void dump_conn_list(void);
90 #endif /* __TINC_CONNLIST_H__ */