Moved silc_client_ch[u]mode[_char] to client library from silc/.
[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[@server] */
30   char *username;             /* username[@host] */
31   char *server;               /* SILC server name */
32   unsigned int num;
33   SilcClientID *id;
34
35   /* Keys, these are defined if private message key has been defined 
36      with the remote client. */
37   SilcCipher send_key;
38   SilcCipher receive_key;
39 } SilcClientEntryObject;
40
41 typedef SilcClientEntryObject *SilcClientEntry;
42
43 /* Client and its mode on a channel */
44 typedef struct {
45   SilcClientEntry client;
46   unsigned int mode;
47 } SilcChannelUsers;
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   SilcChannelUsers *clients;
60   unsigned int clients_count;
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 } SilcChannelEntryObject;
68
69 typedef SilcChannelEntryObject *SilcChannelEntry;
70
71 /* Prototypes */
72
73 SilcClientEntry silc_idlist_get_client(SilcClient client,
74                                        SilcClientConnection conn,
75                                        char *nickname,
76                                        char *server,
77                                        unsigned int num);
78 SilcClientEntry silc_idlist_get_client_by_id(SilcClient client,
79                                              SilcClientConnection conn,
80                                              SilcClientID *client_id,
81                                              int query);
82 SilcChannelEntry silc_idlist_get_channel(SilcClient client,
83                                          SilcClientConnection conn,
84                                          char *channel);
85
86 #endif