updates.
[silc.git] / lib / silcclient / 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 } SilcClientCommandReply;
29
30 /* All client command replys */
31 extern SilcClientCommandReply silc_command_reply_list[];
32
33 /* Context sent as argument to all command reply functions */
34 typedef struct {
35   SilcClient client;
36   SilcSocketConnection sock;
37   SilcCommandPayload payload;
38   SilcArgumentPayload args;
39   SilcPacketContext *packet;
40
41   /* If defined this executes the pending command. */
42   SilcClientPendingDestructor destructor;
43   SilcCommandCb callback;
44   void *context;
45   unsigned short ident;
46 } *SilcClientCommandReplyContext;
47
48 /* Macros */
49
50 /* Macro used for command declaration in command reply list structure */
51 #define SILC_CLIENT_CMD_REPLY(func, cmd ) \
52 { silc_client_command_reply_##func, SILC_COMMAND_##cmd }
53
54 /* Macro used to declare command reply functions */
55 #define SILC_CLIENT_CMD_REPLY_FUNC(func) \
56 void silc_client_command_reply_##func(void *context)
57
58 /* Prototypes */
59 void silc_client_command_reply_process(SilcClient client,
60                                        SilcSocketConnection sock,
61                                        SilcPacketContext *packet);
62 SILC_CLIENT_CMD_REPLY_FUNC(whois);
63 SILC_CLIENT_CMD_REPLY_FUNC(whowas);
64 SILC_CLIENT_CMD_REPLY_FUNC(identify);
65 SILC_CLIENT_CMD_REPLY_FUNC(nick);
66 SILC_CLIENT_CMD_REPLY_FUNC(list);
67 SILC_CLIENT_CMD_REPLY_FUNC(topic);
68 SILC_CLIENT_CMD_REPLY_FUNC(invite);
69 SILC_CLIENT_CMD_REPLY_FUNC(kill);
70 SILC_CLIENT_CMD_REPLY_FUNC(info);
71 SILC_CLIENT_CMD_REPLY_FUNC(links);
72 SILC_CLIENT_CMD_REPLY_FUNC(stats);
73 SILC_CLIENT_CMD_REPLY_FUNC(users);
74 SILC_CLIENT_CMD_REPLY_FUNC(connect);
75 SILC_CLIENT_CMD_REPLY_FUNC(ping);
76 SILC_CLIENT_CMD_REPLY_FUNC(pong);
77 SILC_CLIENT_CMD_REPLY_FUNC(oper);
78 SILC_CLIENT_CMD_REPLY_FUNC(join);
79 SILC_CLIENT_CMD_REPLY_FUNC(motd);
80 SILC_CLIENT_CMD_REPLY_FUNC(umode);
81 SILC_CLIENT_CMD_REPLY_FUNC(cmode);
82 SILC_CLIENT_CMD_REPLY_FUNC(cumode);
83 SILC_CLIENT_CMD_REPLY_FUNC(kick);
84 SILC_CLIENT_CMD_REPLY_FUNC(restart);
85 SILC_CLIENT_CMD_REPLY_FUNC(close);
86 SILC_CLIENT_CMD_REPLY_FUNC(shutdown);
87 SILC_CLIENT_CMD_REPLY_FUNC(silcoper);
88 SILC_CLIENT_CMD_REPLY_FUNC(leave);
89 SILC_CLIENT_CMD_REPLY_FUNC(users);
90
91 #endif