Updates.
[silc.git] / apps / silcd / command_reply.h
1 /*
2
3   command_reply.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 COMMAND_REPLY_H
22 #define COMMAND_REPLY_H
23
24 /* Structure holding one command reply and pointer to its function. */
25 typedef struct {
26   SilcCommandCb cb;
27   SilcCommand cmd;
28 } SilcServerCommandReply;
29
30 /* All server command replys */
31 extern SilcServerCommandReply silc_command_reply_list[];
32
33 /* Context sent as argument to all command reply functions */
34 typedef struct {
35   SilcServer server;
36   SilcSocketConnection sock;
37   SilcCommandPayload payload;
38   SilcArgumentPayload args;
39
40   /* If defined this executes the pending command. */
41   void *context;
42   SilcCommandCb callback;
43   unsigned short ident;
44 } *SilcServerCommandReplyContext;
45
46 /* Macros */
47
48 /* Macro used for command declaration in command reply list structure */
49 #define SILC_SERVER_CMD_REPLY(func, cmd ) \
50 { silc_server_command_reply_##func, SILC_COMMAND_##cmd }
51
52 /* Macro used to declare command reply functions */
53 #define SILC_SERVER_CMD_REPLY_FUNC(func) \
54 void silc_server_command_reply_##func(void *context)
55
56 /* Prototypes */
57 void silc_server_command_reply_process(SilcServer server,
58                                        SilcSocketConnection sock,
59                                        SilcBuffer buffer);
60 SILC_SERVER_CMD_REPLY_FUNC(join);
61 SILC_SERVER_CMD_REPLY_FUNC(whois);
62 SILC_SERVER_CMD_REPLY_FUNC(identify);
63 SILC_SERVER_CMD_REPLY_FUNC(users);
64
65 #endif