Fixed silc_server_packet_broadcast to sen correct broadcast
[silc.git] / apps / silcd / 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_SERVER_NONE 0
26 #define SILC_PROTOCOL_SERVER_CONNECTION_AUTH 1
27 #define SILC_PROTOCOL_SERVER_KEY_EXCHANGE 2
28 /* #define SILC_PROTOCOL_SERVER_MAX 255 */
29
30 /* Internal context for Key Exchange protocol. */
31 typedef struct {
32   void *server;
33   void *context;
34   SilcSocketConnection sock;
35   SilcRng rng;
36
37   /* TRUE if we are receiveing part of the protocol */
38   int responder;
39
40   /* Destinations ID taken from authenticataed packet so that we can
41      get the destinations ID. */
42   void *dest_id;
43   SilcIdType dest_id_type;
44
45   SilcTask timeout_task;
46   SilcPacketContext *packet;
47   SilcSKE ske;
48 } SilcServerKEInternalContext;
49
50 /* Internal context for connection authentication protocol */
51 typedef struct {
52   void *server;
53   void *context;
54   SilcSocketConnection sock;
55
56   /* TRUE if we are receiving part of the protocol */
57   int responder;
58
59   /* SKE object from Key Exchange protocol. */
60   SilcSKE ske;
61
62   /* Auth method that must be used. This is resolved before this
63      connection authentication protocol is started. Used when we are
64      initiating. */
65   unsigned int auth_meth;
66
67   /* Authentication data if we alreay know it. This is filled before
68      starting the protocol if we know the authentication data. Otherwise
69      these are and remain NULL. Used when we are initiating. */
70   unsigned char *auth_data;
71   unsigned int auth_data_len;
72
73   /* Destinations ID from KE protocol context */
74   void *dest_id;
75   SilcIdType dest_id_type;
76
77   SilcTask timeout_task;
78   SilcPacketContext *packet;
79   unsigned short conn_type;
80 } SilcServerConnAuthInternalContext;
81
82 /* Prototypes */
83 void silc_server_protocols_register(void);
84 void silc_server_protocols_unregister(void);
85
86 #endif