#ifndef COMMAND_H
#define COMMAND_H
-/* Forward declarations */
-typedef struct SilcClientCommandStruct *SilcClientCommand;
-typedef struct SilcClientCommandContextStruct *SilcClientCommandContext;
-
-#include "silcapi.h"
#include "command_reply.h"
/* Structure holding one command and pointer to its function. This
typedef struct SilcClientCommandPendingStruct {
SilcCommand reply_cmd;
SilcCommandCb callback;
- SilcClientPendingDestructor destructor;
void *context;
uint16 ident;
struct SilcClientCommandPendingStruct *next;
void silc_client_command_##func(void *context, void *context2)
/* Executed pending command callback */
-#define SILC_CLIENT_PENDING_EXEC(ctx, cmd) \
-do { \
- if ((ctx)->callback) \
- (*ctx->callback)(ctx->context, ctx); \
-} while(0)
-
-/* Execute destructor for pending command */
-#define SILC_CLIENT_PENDING_DESTRUCTOR(ctx, cmd) \
+#define SILC_CLIENT_PENDING_EXEC(ctx, cmd) \
do { \
+ if ((ctx)->callback) \
+ (*ctx->callback)(ctx->context, ctx); \
silc_client_command_pending_del((ctx)->sock->user_data, (cmd), \
(ctx)->ident); \
- if (ctx->destructor) \
- (*ctx->destructor)(ctx->context); \
} while(0)
bool silc_client_command_register(SilcClient client,