5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1997 - 2002 Pekka Riikonen
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.
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.
21 #ifndef COMMAND_REPLY_H
22 #define COMMAND_REPLY_H
26 /* Structure holding one command reply and pointer to its function. */
30 } SilcServerCommandReply;
32 /* All server command replys */
33 extern SilcServerCommandReply silc_command_reply_list[];
35 /* Context holding pending command callbacks. */
37 SilcCommandCb callback;
39 } *SilcServerCommandPendingCallbacks;
41 /* Context sent as argument to all command reply functions */
44 SilcSocketConnection sock;
45 SilcCommandPayload payload;
46 SilcArgumentPayload args;
48 /* If defined this executes the pending command. */
49 SilcServerCommandPendingCallbacks callbacks;
50 SilcUInt32 callbacks_count;
52 } *SilcServerCommandReplyContext;
56 /* Macro used for command declaration in command reply list structure */
57 #define SILC_SERVER_CMD_REPLY(func, cmd ) \
58 { silc_server_command_reply_##func, SILC_COMMAND_##cmd }
60 /* Macro used to declare command reply functions */
61 #define SILC_SERVER_CMD_REPLY_FUNC(func) \
62 void silc_server_command_reply_##func(void *context, void *context2)
65 void silc_server_command_reply_free(SilcServerCommandReplyContext cmd);
66 void silc_server_command_reply_process(SilcServer server,
67 SilcSocketConnection sock,
69 SILC_SERVER_CMD_REPLY_FUNC(whois);
70 SILC_SERVER_CMD_REPLY_FUNC(whowas);
71 SILC_SERVER_CMD_REPLY_FUNC(identify);
72 SILC_SERVER_CMD_REPLY_FUNC(info);
73 SILC_SERVER_CMD_REPLY_FUNC(motd);
74 SILC_SERVER_CMD_REPLY_FUNC(join);
75 SILC_SERVER_CMD_REPLY_FUNC(stats);
76 SILC_SERVER_CMD_REPLY_FUNC(users);
77 SILC_SERVER_CMD_REPLY_FUNC(getkey);
78 SILC_SERVER_CMD_REPLY_FUNC(list);
79 SILC_SERVER_CMD_REPLY_FUNC(watch);