Code auditing weekend results and fixes committing.
[silc.git] / apps / silcd / command.h
index 21677e8f287ee70126694eea0842a44d186efbef..de0b464b78d02f3fd28d93f0ee97ee26964ae64e 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
 
-  Copyright (C) 1997 - 2000 Pekka Riikonen
+  Copyright (C) 1997 - 2001 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -56,12 +56,13 @@ typedef struct {
   SilcCommandPayload payload;
   SilcArgumentPayload args;
   SilcPacketContext *packet;
-  int pending;
+  int pending;                 /* Command is being re-processed when TRUE */
 } *SilcServerCommandContext;
 
 /* Structure holding pending commands. If command is pending it will be
    executed after command reply has been received and executed. */
 typedef struct SilcServerCommandPendingStruct {
+  SilcServer server;
   SilcCommand reply_cmd;
   SilcCommandCb callback;
   void *context;
@@ -80,25 +81,28 @@ typedef struct SilcServerCommandPendingStruct {
 void silc_server_command_##func(void *context)
 
 /* Executed pending command */
-#define SILC_SERVER_COMMAND_EXEC_PENDING(ctx, cmd)     \
-do {                                                   \
-  if (ctx->callback) {                                 \
-    (*ctx->callback)(ctx->context);                    \
-    silc_server_command_pending_del(cmd, ctx->ident);  \
-  }                                                    \
+#define SILC_SERVER_COMMAND_EXEC_PENDING(ctx, cmd)                     \
+do {                                                                   \
+  if (ctx->callback) {                                                 \
+    (*ctx->callback)(ctx->context);                                    \
+    silc_server_command_pending_del(ctx->server, cmd, ctx->ident);     \
+  }                                                                    \
 } while(0)
 
 /* Prototypes */
 void silc_server_command_process(SilcServer server,
                                 SilcSocketConnection sock,
                                 SilcPacketContext *packet);
-void silc_server_command_pending(SilcCommand reply_cmd,
+void silc_server_command_pending(SilcServer server,
+                                SilcCommand reply_cmd,
                                 unsigned short ident,
                                 SilcCommandCb callback,
                                 void *context);
-void silc_server_command_pending_del(SilcCommand reply_cmd,
+void silc_server_command_pending_del(SilcServer server,
+                                    SilcCommand reply_cmd,
                                     unsigned short ident);
-int silc_server_command_pending_check(SilcServerCommandReplyContext ctx,
+int silc_server_command_pending_check(SilcServer server,
+                                     SilcServerCommandReplyContext ctx,
                                      SilcCommand command, 
                                      unsigned short ident);
 SILC_SERVER_CMD_FUNC(whois);
@@ -129,6 +133,6 @@ SILC_SERVER_CMD_FUNC(close);
 SILC_SERVER_CMD_FUNC(die);
 SILC_SERVER_CMD_FUNC(silcoper);
 SILC_SERVER_CMD_FUNC(leave);
-SILC_SERVER_CMD_FUNC(names);
+SILC_SERVER_CMD_FUNC(users);
 
 #endif