5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1997 - 2001 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; version 2 of the License.
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.
20 #ifndef COMMAND_REPLY_H
21 #define COMMAND_REPLY_H
23 /* Structure holding one command reply and pointer to its function. */
27 } SilcClientCommandReply;
29 /* Context holding pending command callbacks. */
31 SilcCommandCb callback;
33 } *SilcClientCommandPendingCallbacks;
35 /* Context sent as argument to all command reply functions */
36 struct SilcClientCommandReplyContextStruct {
38 SilcSocketConnection sock;
39 SilcCommandPayload payload;
42 SilcArgumentPayload args;
43 SilcPacketContext *packet;
45 /* If defined this executes the pending command. */
46 SilcClientCommandPendingCallbacks callbacks;
47 SilcUInt32 callbacks_count;
54 /* Command reply operation that is called at the end of all command replys.
55 Usage: COMMAND_REPLY((ARGS, argument1, argument2, etc...)), */
56 #define COMMAND_REPLY(args) cmd->client->internal->ops->command_reply args
57 #define SILC_ARGS cmd->client, cmd->sock->user_data, \
58 cmd->payload, TRUE, silc_command_get(cmd->payload), cmd->status
60 /* Error reply to application. Usage: COMMAND_REPLY_ERROR; */
61 #define COMMAND_REPLY_ERROR cmd->client->internal->ops-> \
62 command_reply(cmd->client, cmd->sock->user_data, cmd->payload, \
63 FALSE, silc_command_get(cmd->payload), cmd->status)
65 /* Macro used to declare command reply functions */
66 #define SILC_CLIENT_CMD_REPLY_FUNC(func) \
67 void silc_client_command_reply_##func(void *context, void *context2)
71 void silc_client_command_reply_process(SilcClient client,
72 SilcSocketConnection sock,
73 SilcPacketContext *packet);
74 void silc_client_command_reply_free(SilcClientCommandReplyContext cmd);
75 SILC_CLIENT_CMD_REPLY_FUNC(whois);
76 SILC_CLIENT_CMD_REPLY_FUNC(whowas);
77 SILC_CLIENT_CMD_REPLY_FUNC(identify);
78 SILC_CLIENT_CMD_REPLY_FUNC(nick);
79 SILC_CLIENT_CMD_REPLY_FUNC(list);
80 SILC_CLIENT_CMD_REPLY_FUNC(topic);
81 SILC_CLIENT_CMD_REPLY_FUNC(invite);
82 SILC_CLIENT_CMD_REPLY_FUNC(kill);
83 SILC_CLIENT_CMD_REPLY_FUNC(info);
84 SILC_CLIENT_CMD_REPLY_FUNC(stats);
85 SILC_CLIENT_CMD_REPLY_FUNC(ping);
86 SILC_CLIENT_CMD_REPLY_FUNC(oper);
87 SILC_CLIENT_CMD_REPLY_FUNC(join);
88 SILC_CLIENT_CMD_REPLY_FUNC(motd);
89 SILC_CLIENT_CMD_REPLY_FUNC(umode);
90 SILC_CLIENT_CMD_REPLY_FUNC(cmode);
91 SILC_CLIENT_CMD_REPLY_FUNC(cumode);
92 SILC_CLIENT_CMD_REPLY_FUNC(kick);
93 SILC_CLIENT_CMD_REPLY_FUNC(ban);
94 SILC_CLIENT_CMD_REPLY_FUNC(detach);
95 SILC_CLIENT_CMD_REPLY_FUNC(watch);
96 SILC_CLIENT_CMD_REPLY_FUNC(silcoper);
97 SILC_CLIENT_CMD_REPLY_FUNC(leave);
98 SILC_CLIENT_CMD_REPLY_FUNC(users);
99 SILC_CLIENT_CMD_REPLY_FUNC(getkey);
100 SILC_CLIENT_CMD_REPLY_FUNC(quit);
102 /* Internal command reply functions */
103 SILC_CLIENT_CMD_REPLY_FUNC(whois_i);
104 SILC_CLIENT_CMD_REPLY_FUNC(identify_i);
105 SILC_CLIENT_CMD_REPLY_FUNC(info_i);
106 SILC_CLIENT_CMD_REPLY_FUNC(users_i);
108 SILC_CLIENT_CMD_REPLY_FUNC(connect);
109 SILC_CLIENT_CMD_REPLY_FUNC(close);
110 SILC_CLIENT_CMD_REPLY_FUNC(shutdown);