updates.
[silc.git] / apps / silcd / server_util.h
1 /*
2
3   server_util.h 
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 1997 - 2001 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; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19
20 #ifndef SERVER_UTIL_H
21 #define SERVER_UTIL_H
22
23 /* This function is used to remove all client entries by the server `entry'.
24    This is called when the connection is lost to the server. In this case
25    we must invalidate all the client entries owned by the server `entry'. 
26    If the `server_signoff' is TRUE then the SERVER_SIGNOFF notify is
27    distributed to our local clients. */
28 bool silc_server_remove_clients_by_server(SilcServer server, 
29                                           SilcServerEntry entry,
30                                           bool server_signoff);
31
32 /* Updates the clients that are originated from the `from' to be originated
33    from the `to'. If the `resolve_real_server' is TRUE then this will
34    attempt to figure out which clients really are originated from the
35    `from' and which are originated from a server that we have connection
36    to, when we've acting as backup router. If it is FALSE the `to' will
37    be the new source. This function also removes the clients that are
38    *really* originated from `from'. These are clients that the `from'
39    owns, and not just clients that are behind the `from'. */
40 void silc_server_update_clients_by_server(SilcServer server, 
41                                           SilcServerEntry from,
42                                           SilcServerEntry to,
43                                           bool resolve_real_server);
44
45 /* Checks whether given channel has global users.  If it does this returns
46    TRUE and FALSE if there is only locally connected clients on the channel. */
47 bool silc_server_channel_has_global(SilcChannelEntry channel);
48
49 /* Checks whether given channel has locally connected users.  If it does this
50    returns TRUE and FALSE if there is not one locally connected client. */
51 bool silc_server_channel_has_local(SilcChannelEntry channel);
52
53 /* Returns TRUE if the given client is on the channel.  FALSE if not. 
54    This works because we assure that the user list on the channel is
55    always in up to date thus we can only check the channel list from 
56    `client' which is faster than checking the user list from `channel'. */
57 bool silc_server_client_on_channel(SilcClientEntry client,
58                                    SilcChannelEntry channel);
59
60 #endif /* SERVER_UTIL_H */