Add Guus' name and shift out old protocol requests
[tinc] / src / protocol.h
1 /*
2     protocol.h -- header for protocol.c
3     Copyright (C) 1999,2000 Ivo Timmermans <itimmermans@bigfoot.com>,
4                        2000 Guus Sliepen <guus@sliepen.warande.net>
5
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.
10
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.
15
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.
19
20     $Id: protocol.h,v 1.5.4.6 2000/09/10 21:57:11 zarq Exp $
21 */
22
23 #ifndef __TINC_PROTOCOL_H__
24 #define __TINC_PROTOCOL_H__
25
26 #include "net.h"
27
28 enum {
29   PROT_RESERVED = 0,                 /* reserved: do not use. */
30   PROT_NOT_IN_USE,
31   PROT_TOO_OLD = 2,
32   PROT_3,
33   PROT_4,
34   PROT_ECHELON,
35   PROT_6,
36   PROT_CURRENT,                      /* protocol currently in use */
37 };
38
39 enum {
40   ACK = 1,              /* acknowledged */
41 /* These requests are obsolete.
42   AUTH_S_INIT = 10,
43   AUTH_C_INIT,
44   AUTH_S_SPP,
45   AUTH_C_SPP,
46   AUTH_S_SKEY,
47   AUTH_C_SKEY,
48   AUTH_S_SACK,
49   AUTH_C_RACK, */
50   TERMREQ = 30,         /* terminate connection */
51   PINGTIMEOUT,          /* terminate due to ping t.o. */
52   DEL_HOST,             /* forward a termreq to others */
53   PING = 40,            /* ping */
54   PONG,
55   ADD_HOST = 60,        /* Add new given host to connection list */
56   BASIC_INFO,           /* some basic info follows */
57   PASSPHRASE,           /* encrypted passphrase */
58   PUBLIC_KEY,           /* public key in base-36 */
59   HOLD = 80,            /* don't send any data */
60   RESUME,               /* resume dataflow with new encryption key */
61   CALCULATE = 100,      /* calculate the following numer^privkey and send me the result */  
62   CALC_RES,             /* result of the above */
63   ALMOST_KEY,           /* this number^privkey is the shared key */
64   PACKET = 110,         /* TCP tunneled network packet */
65   REQ_KEY = 160,        /* request public key */
66   ANS_KEY,              /* answer to such request */
67   KEY_CHANGED,          /* public key has changed */
68   
69 };
70
71 extern int (*request_handlers[256])(conn_list_t*);
72
73 extern int send_ping(conn_list_t*);
74 extern int send_basic_info(conn_list_t *);
75 extern int send_termreq(conn_list_t *);
76 extern int send_timeout(conn_list_t *);
77 extern int send_key_request(ip_t);
78 extern void send_key_changed_all(void);
79 extern int send_del_host(conn_list_t *, conn_list_t *);
80 extern int send_tcppacket(conn_list_t *, void *, int);
81 extern int notify_others(conn_list_t *, conn_list_t *, int (*function)(conn_list_t*, conn_list_t*));
82
83 #endif /* __TINC_PROTOCOL_H__ */
84
85