Integer type name change.
[silc.git] / lib / silcclient / command_reply.h
1 /*
2
3   command_reply.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 COMMAND_REPLY_H
21 #define COMMAND_REPLY_H
22
23 /* Structure holding one command reply and pointer to its function. */
24 typedef struct {
25   SilcCommandCb cb;
26   SilcCommand cmd;
27 } SilcClientCommandReply;
28
29 /* Context sent as argument to all command reply functions */
30 struct SilcClientCommandReplyContextStruct {
31   SilcClient client;
32   SilcSocketConnection sock;
33   SilcCommandPayload payload;
34   SilcArgumentPayload args;
35   SilcPacketContext *packet;
36
37   /* If defined this executes the pending command. */
38   SilcCommandCb callback;
39   void *context;
40   SilcUInt16 ident;
41 };
42
43 /* Macros */
44
45 /* Macro used to declare command reply functions */
46 #define SILC_CLIENT_CMD_REPLY_FUNC(func)                                \
47 void silc_client_command_reply_##func(void *context, void *context2)
48
49 /* Status message structure. Messages are defined below. */
50 typedef struct {
51   SilcCommandStatus status;
52   char *message;
53 } SilcCommandStatusMessage;
54
55 /* Status messages returned by the server */
56 #define STAT(x) SILC_STATUS_ERR_##x
57 DLLAPI extern const SilcCommandStatusMessage silc_command_status_messages[];
58
59 /* Prototypes */
60
61 void silc_client_command_reply_process(SilcClient client,
62                                        SilcSocketConnection sock,
63                                        SilcPacketContext *packet);
64 char *silc_client_command_status_message(SilcCommandStatus status);
65 SILC_CLIENT_CMD_REPLY_FUNC(whois);
66 SILC_CLIENT_CMD_REPLY_FUNC(whowas);
67 SILC_CLIENT_CMD_REPLY_FUNC(identify);
68 SILC_CLIENT_CMD_REPLY_FUNC(nick);
69 SILC_CLIENT_CMD_REPLY_FUNC(list);
70 SILC_CLIENT_CMD_REPLY_FUNC(topic);
71 SILC_CLIENT_CMD_REPLY_FUNC(invite);
72 SILC_CLIENT_CMD_REPLY_FUNC(kill);
73 SILC_CLIENT_CMD_REPLY_FUNC(info);
74 SILC_CLIENT_CMD_REPLY_FUNC(links);
75 SILC_CLIENT_CMD_REPLY_FUNC(stats);
76 SILC_CLIENT_CMD_REPLY_FUNC(users);
77 SILC_CLIENT_CMD_REPLY_FUNC(connect);
78 SILC_CLIENT_CMD_REPLY_FUNC(ping);
79 SILC_CLIENT_CMD_REPLY_FUNC(pong);
80 SILC_CLIENT_CMD_REPLY_FUNC(oper);
81 SILC_CLIENT_CMD_REPLY_FUNC(join);
82 SILC_CLIENT_CMD_REPLY_FUNC(motd);
83 SILC_CLIENT_CMD_REPLY_FUNC(umode);
84 SILC_CLIENT_CMD_REPLY_FUNC(cmode);
85 SILC_CLIENT_CMD_REPLY_FUNC(cumode);
86 SILC_CLIENT_CMD_REPLY_FUNC(kick);
87 SILC_CLIENT_CMD_REPLY_FUNC(ban);
88 SILC_CLIENT_CMD_REPLY_FUNC(close);
89 SILC_CLIENT_CMD_REPLY_FUNC(shutdown);
90 SILC_CLIENT_CMD_REPLY_FUNC(silcoper);
91 SILC_CLIENT_CMD_REPLY_FUNC(leave);
92 SILC_CLIENT_CMD_REPLY_FUNC(users);
93 SILC_CLIENT_CMD_REPLY_FUNC(getkey);
94 SILC_CLIENT_CMD_REPLY_FUNC(quit);
95
96 /* Internal command reply functions */
97 SILC_CLIENT_CMD_REPLY_FUNC(whois_i);
98 SILC_CLIENT_CMD_REPLY_FUNC(identify_i);
99 SILC_CLIENT_CMD_REPLY_FUNC(info_i);
100
101 #endif