Added destination ID resolving to the structures.
[silc.git] / apps / silc / protocol.h
1 /*
2
3   protocol.h
4
5   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6
7   Copyright (C) 1997 - 2000 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20
21 #ifndef PROTOCOL_H
22 #define PROTOCOL_H
23
24 /* SILC client protocol types */
25 #define SILC_PROTOCOL_CLIENT_NONE 0
26 #define SILC_PROTOCOL_CLIENT_CONNECTION_AUTH 1
27 #define SILC_PROTOCOL_CLIENT_CHANNEL_AUTH 2
28 #define SILC_PROTOCOL_CLIENT_KEY_EXCHANGE 3
29 /* #define SILC_PROTOCOL_CLIENT_MAX 255 */
30
31 /* Internal context for key exchange protocol */
32 typedef struct {
33   void *client;
34   SilcSocketConnection sock;
35   SilcRng rng;
36   int responder;
37
38   /* Destinations ID taken from authenticataed packet so that we can
39      get the destinations ID. */
40   void *dest_id;
41   SilcIdType dest_id_type;
42
43   SilcBuffer packet;
44   SilcSKE ske;
45 } SilcClientKEInternalContext;
46
47 /* Internal context for connection authentication protocol */
48 typedef struct {
49   void *client;
50   SilcSocketConnection sock;
51
52   /* SKE object from Key Exchange protocol. */
53   SilcSKE ske;
54
55   /* Auth method that must be used. This is resolved before this
56      connection authentication protocol is started. */
57   unsigned int auth_meth;
58
59   /* Destinations ID from KE protocol context */
60   void *dest_id;
61   SilcIdType dest_id_type;
62
63   /* Authentication data if we alreay know it. This is filled before
64      starting the protocol if we know the authentication data. Otherwise
65      these are and remain NULL. */
66   unsigned char *auth_data;
67   unsigned int auth_data_len;
68
69   SilcTask timeout_task;
70 } SilcClientConnAuthInternalContext;
71
72 /* Prototypes */
73
74 #endif