updates.
[silc.git] / lib / silcclient / idlist.h
1 /*
2
3   idlist.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 IDLIST_H
22 #define IDLIST_H
23
24 /* Client entry context. When client receives information about new client
25    (it receives its ID, for example, by IDENTIFY request) we create new
26    client entry. This entry also includes the private message keys if
27    they are used. */
28 typedef struct SilcClientEntryStruct {
29   char *nickname;             /* nickname */
30   char *username;             /* username[@host] */
31   char *server;               /* SILC server name */
32   char *realname;
33   unsigned int num;
34   SilcClientID *id;
35
36   /* Keys, these are defined if private message key has been defined 
37      with the remote client. */
38   SilcCipher send_key;
39   SilcCipher receive_key;
40 } *SilcClientEntry;
41
42 /* Client and its mode on a channel */
43 typedef struct SilcChannelUserStruct {
44   SilcClientEntry client;
45   unsigned int mode;
46   struct SilcChannelUserStruct *next;
47 } *SilcChannelUser;
48
49 /* Channel entry context. This is allocate for every channel client has
50    joined to. This includes for example the channel specific keys */
51 /* XXX channel_key is the server generated key. Later this context must 
52    include the channel private key. */
53 typedef struct SilcChannelEntryStruct {
54   char *channel_name;
55   SilcChannelID *id;
56   unsigned int mode;
57   int on_channel;
58
59   /* Joined clients */
60   SilcList clients;
61
62   /* Channel keys */
63   SilcCipher channel_key;
64   unsigned char *key;
65   unsigned int key_len;
66   unsigned char iv[SILC_CIPHER_MAX_IV_SIZE];
67 } *SilcChannelEntry;
68
69 /* Command identifier used by ID list routines when sending WHOIS/IDENTIFY
70    commands to routers. */
71 #define SILC_IDLIST_IDENT 3333
72
73 /* Prototypes */
74
75 SilcClientEntry silc_idlist_get_client(SilcClient client,
76                                        SilcClientConnection conn,
77                                        char *nickname,
78                                        char *server,
79                                        unsigned int num);
80 SilcClientEntry silc_idlist_get_client_by_id(SilcClient client,
81                                              SilcClientConnection conn,
82                                              SilcClientID *client_id);
83 SilcChannelEntry silc_idlist_get_channel(SilcClient client,
84                                          SilcClientConnection conn,
85                                          char *channel);
86
87 #endif