updates. New data types.
[silc.git] / lib / silccore / silccommand.h
index d6e982633afc27aa6863fd4079ab39c870b3f799..2f835e91941c7a4ebf146fe7ece4e7e18109ee6b 100644 (file)
@@ -36,19 +36,24 @@ typedef struct SilcCommandPayloadStruct *SilcCommandPayload;
 typedef enum {
   SILC_CF_NONE           = 0,
 
-  /* Command may only be used once per (about) 2 seconds */
+  /* Command may only be used once per (about) 2 seconds. Bursts up
+     to 5 commands are allowed though. */
   SILC_CF_LAG            = (1L << 1),
 
+  /* Command may only be used once per (about) 2 seconds. No bursts
+     are allowed at all. */
+  SILC_CF_LAG_STRICT     = (1L << 2),
+
   /* Command is available for registered connections (connections
      whose ID has been created. */
-  SILC_CF_REG            = (1L << 2),
+  SILC_CF_REG            = (1L << 3),
 
   /* Command is available only for server operators */
-  SILC_CF_OPER           = (1L << 3),
+  SILC_CF_OPER           = (1L << 4),
 
   /* Command is available only for SILC (router) operators. If this 
      is set SILC_CF_OPER is not necessary to be set. */
-  SILC_CF_SILC_OPER      = (1L << 4),
+  SILC_CF_SILC_OPER      = (1L << 5),
 
 } SilcCommandFlag;
 
@@ -74,9 +79,9 @@ typedef enum {
 #define SILC_COMMAND_CMODE             17
 #define SILC_COMMAND_CUMODE            18
 #define SILC_COMMAND_KICK              19
-#define        SILC_COMMAND_RESTART            20
+#define SILC_COMMAND_BAN               20
 #define        SILC_COMMAND_CLOSE              21
-#define        SILC_COMMAND_DIE                22
+#define        SILC_COMMAND_SHUTDOWN           22
 #define SILC_COMMAND_SILCOPER          23
 #define SILC_COMMAND_LEAVE             24
 #define SILC_COMMAND_USERS             25
@@ -85,7 +90,7 @@ typedef enum {
 #define SILC_COMMAND_RESERVED           255
 
 /* Command Status type */
-typedef unsigned short SilcCommandStatus;
+typedef uint16 SilcCommandStatus;
 
 /* Command Status messages */
 #define SILC_STATUS_OK                      0
@@ -128,32 +133,33 @@ typedef unsigned short SilcCommandStatus;
 #define SILC_STATUS_ERR_BAD_NICKNAME        43
 #define SILC_STATUS_ERR_BAD_CHANNEL         44
 #define SILC_STATUS_ERR_AUTH_FAILED         45
+#define SILC_STATUS_ERR_UNKNOWN_ALGORITHM   46
 
 /* Prototypes */
 SilcCommandPayload silc_command_payload_parse(SilcBuffer buffer);
 SilcBuffer silc_command_payload_encode(SilcCommand cmd,
-                                      unsigned int argc,
+                                      uint32 argc,
                                       unsigned char **argv,
-                                      unsigned int *argv_lens,
-                                      unsigned int *argv_types,
-                                      unsigned short ident);
+                                      uint32 *argv_lens,
+                                      uint32 *argv_types,
+                                      uint16 ident);
 SilcBuffer silc_command_payload_encode_payload(SilcCommandPayload payload);
 SilcBuffer silc_command_payload_encode_va(SilcCommand cmd, 
-                                         unsigned short ident, 
-                                         unsigned int argc, ...);
+                                         uint16 ident, 
+                                         uint32 argc, ...);
 SilcBuffer silc_command_payload_encode_vap(SilcCommand cmd, 
-                                          unsigned short ident, 
-                                          unsigned int argc, va_list ap);
+                                          uint16 ident, 
+                                          uint32 argc, va_list ap);
 SilcBuffer 
 silc_command_reply_payload_encode_va(SilcCommand cmd, 
                                     SilcCommandStatus status,
-                                    unsigned short ident,
-                                    unsigned int argc, ...);
+                                    uint16 ident,
+                                    uint32 argc, ...);
 void silc_command_free_payload(SilcCommandPayload payload);
 SilcCommand silc_command_get(SilcCommandPayload payload);
 SilcArgumentPayload silc_command_get_args(SilcCommandPayload payload);
-unsigned short silc_command_get_ident(SilcCommandPayload payload);
-void silc_command_set_ident(SilcCommandPayload payload, unsigned short ident);
+uint16 silc_command_get_ident(SilcCommandPayload payload);
+void silc_command_set_ident(SilcCommandPayload payload, uint16 ident);
 void silc_command_set_command(SilcCommandPayload payload, SilcCommand command);
 
 #endif