+/* Command and command reply context used to hold registered commands
+ in the SILC client. */
+typedef struct SilcClientCommandStruct {
+ struct SilcClientCommandStruct *next;
+ SilcCommand cmd; /* Command type */
+ SilcFSMStateCallback command; /* Command function */
+ SilcFSMStateCallback reply; /* Command reply callback */
+ char *name; /* Name of the command (optional) */
+ SilcUInt8 max_args; /* Maximum arguments (optional) */
+} *SilcClientCommand;
+
+/* Command reply callback structure */
+typedef struct SilcClientCommandReplyCallbackStruct {
+ struct SilcClientCommandReplyCallbackStruct *next;
+ SilcClientCommandReply reply; /* Command reply callback */
+ void *context; /* Command reply context */
+ unsigned int do_not_call : 1; /* Set to not call the callback */
+} *SilcClientCommandReplyCallback;
+
+/* Command context given as argument to command state functions. This same
+ context is used when calling, sending and procesing command and command
+ reply. */
+typedef struct SilcClientCommandContextStruct {
+ struct SilcClientCommandContextStruct *next;
+ SilcClientConnection conn; /* Connection */
+ SilcFSMThreadStruct thread; /* FSM thread for command call */
+
+ SilcCommand cmd; /* Command */
+ SilcUInt16 cmd_ident; /* Command identifier */
+ SilcUInt32 argc; /* Number of arguments */
+ unsigned char **argv; /* Arguments, may be NULL */
+ SilcUInt32 *argv_lens; /* Argument lengths, may be NULL */
+ SilcUInt32 *argv_types; /* Argument types, may be NULL */
+
+ SilcList reply_callbacks; /* Command reply callbacks */
+ SilcStatus status; /* Current command reply status */
+ SilcStatus error; /* Current command reply error */
+
+ void *context; /* Context for free use */
+ unsigned int processed : 1; /* Set when reply was processed */
+ unsigned int called : 1; /* Set when called by application */
+ unsigned int verbose : 1; /* Verbose with 'say' client operation */
+ unsigned int resolved : 1; /* Set when resolving something */
+} *SilcClientCommandContext;
+