SilcStatus Arguments
 
The SilcStatus is used to indicate a status (usually error status) of command execution and command reply status. It is also used to deliver disconnection status when server disconnects client from the server. For application it is mainly important in case of `command_reply' client operation, where the SilcStatus indicates the error status of the command that was executed. If error occurred the arguments returned by the `command_reply' are then dependent of the SilcStatus type instead of the SilcCommand arguments.
 
This documents describes how the application should interpret the SilcStatus type in the `command_reply' client operation to be able to handle all error conditions properly. Any status type can be returned for any SilcCommand. For this reason application should be able to handle any error with any command.
 
 
Error Status In command_reply Client Operation
 
When error occurs in execution of a command the `command_reply' client operation is called with error status. In this case the 'success' argument of the client operation is set to FALSE, to indicate that command execution failed, and the 'status' argument indicates the error. If the 'status' argument is SILC_STATUS_OK then error did not occur and the arguments are as described in SilcCommand arguments.
 
Application should handle the error status arguments by the SilcStatus type for example in a switch statement. The SilcStatus values are defined in lib/silccore/silcstatus.h header file. A short example.
 
  switch(status)
    {
    case SILC_STATUS_ERR_NO_SUCH_NICK:
    ...
    nick = va_arg(va, char *);
    ...
    break;
    case SILC_STATUS_ERR_NO_SUCH_CHANNEL:
    ...
    break;
    case SILC_STATUS_ERR_NO_SUCH_SERVER:
    ...
    break;
    ...
    default:
    break;
    }

 
 
Arguments
 
The following table describes all status values and arguments that the client library sends in the 'command_reply' client operation to the application in case of error. All arguments listed below are usually valid when returned by the library. However applicationn must be able to handle that any of those arguments may be NULL.
 
The 'command_reply' arguments in case of error are as follows:
 
Name Description Error Arguments
SILC_STATUS_OK No error. N/A
SILC_STATUS_ERR_NO_SUCH_NICK Requested nickname does not exist. Argument is the unknown name. const char *nickname
SILC_STATUS_ERR_NO_SUCH_CHANNEL The requested channel does not exist. Argument is the unknown name. const char *channel_name
SILC_STATUS_ERR_NO_SUCH_SERVER The requested server does not exist. Argument is the unknown name. const char *server_name
SILC_STATUS_ERR_NO_RECIPIENT Command required recipient but none was provided. No arguments returned. N/A
SILC_STATUS_ERR_UNKNOWN_COMMAND Command sent to server is unknown or unsupported by the server. No arguments returned. N/A
SILC_STATUS_ERR_WILDCARDS Wildcards were provided by they were not permitted. No arguments returned. N/A
SILC_STATUS_ERR_NO_CLIENT_ID Client ID was expected as command parameter but was not found. No arguments returned. N/A
SILC_STATUS_ERR_NO_CHANNEL_ID Channel ID was expected as command parameter but was not found. No arguments returned. N/A
SILC_STATUS_ERR_NO_SERVER_ID Server ID was expected as command parameter but was not found. No arguments returned. N/A
SILC_STATUS_ERR_BAD_CLIENT_ID Client ID provided was malformed. Returns the malformed ID. const SilcClientID *client_id
SILC_STATUS_ERR_BAD_CHANNEL_ID Channel ID provided was malformed. Returns the malformed ID. const SilcChannelID *channel_id
SILC_STATUS_ERR_BAD_SERVER_ID Server ID provided was malformed. Returns the malformed ID. const SilcServerID *server_id
SILC_STATUS_ERR_NO_SUCH_CLIENT_ID Client ID provided does not exist. The unknown ID is returned. const SilcClientID *client_id
SILC_STATUS_ERR_NO_SUCH_CHANNEL_ID Channel ID provided does not exist. The unknown ID is returned. const SilcChannelID *channel_id
SILC_STATUS_ERR_NO_SUCH_SERVER_ID Server ID provided does not exist. The unknown ID is returned. const SilcServerID *server_id
SILC_STATUS_ERR_NOT_ON_CHANNEL The command required for you to be on channel but you were not. The channel ID is returned. const SilcChannelID *channel_id
SILC_STATUS_ERR_USER_NOT_ON_CHANNEL The requested target client is not on requested channel. Returns the target client ID and channel ID. const SilcClientID *client_id, const SilcChannelID *channel_id
SILC_STATUS_ERR_USER_ON_CHANNEL User were invited on channel they already are on. Returns the target client ID and channel ID. const SilcClientID *client_id, const SilcChannelID *channel_id
SILC_STATUS_ERR_NOT_REGISTERED User executed command that requires the client to be registered on the server before it may be executed. No arguments returned. N/A
SILC_STATUS_ERR_NOT_ENOUGH_PARAMS Command required more parameters than provided. No arguments returned. N/A
SILC_STATUS_ERR_TOO_MANY_PARAMS Too many parameters provided for the command. No arguments returned. N/A
SILC_STATUS_ERR_PERM_DENIED Generic permission denied error status, to indicat disallowed access. No arguments returned. N/A
SILC_STATUS_ERR_BAD_PASSWORD Password provided for channel were not accepted. Returns the channel ID. const SilcChannelID *channel_id
SILC_STATUS_ERR_CHANNEL_IS_FULL The channel is full and client cannot join the channel. Returns the channel ID. const SilcChannelID *channel_id
SILC_STATUS_ERR_NOT_INVITED The channel is invite only channel and client has not been invited. Returns the channel ID. const SilcChannelID *channel_id
SILC_STATUS_ERR_BANNED_FROM_CHANNEL The client has been banned from the channel. Returns the channel ID. const SilcChannelID *channel_id
SILC_STATUS_ERR_UNKNOWN_MODE Mode provided by the client was unknown to or unsupported by the server. No arguments returned. N/A
SILC_STATUS_ERR_NOT_YOU User tried to change someone else's mode which is not allowed. No arguments returned. N/A
SILC_STATUS_ERR_NO_CHANNEL_PRIV Command may be executed only by channel operator. The next argument is the channel ID. const SilcChannelID *channel_id
SILC_STATUS_ERR_NO_CHANNEL_FOPRIV Command may be executed only by channel founder. The next argument is the channel ID. const SilcChannelID *channel_id
SILC_STATUS_ERR_NO_SERVER_PRIV Command may be executed only by server operator. No arguments returned. N/A
SILC_STATUS_ERR_NO_ROUTER_PRIV Command may be executed only by router (SILC) operator. No arguments returned. N/A
SILC_STATUS_ERR_BAD_NICKNAME Nickname requested contained illegal characters or was malformed. No arguments returned. N/A
SILC_STATUS_ERR_BAD_CHANNEL Channel name requested contained illegal characters or was malformed. No arguments returned. N/A
SILC_STATUS_ERR_AUTH_FAILED The authentication data (passphrase or digital signature) sent as argument was wrong and thus authentication failed. No arguments returned. N/A
SILC_STATUS_ERR_UNKNOWN_ALGORITHM The server does not support requested algorithm. Returns the unknown algorithm. const char *alg_name
SILC_STATUS_ERR_RESOURCE_LIMIT Server cannot or will not accept the action due to resource limitations. No arguments returned. N/A
SILC_STATUS_ERR_NO_SUCH_SERVICE Requestes service identifier is unknown. Returns the unknown service identifier. const char *service_identifier
SILC_STATUS_ERR_TIMEDOUT Operation (command execution) or service request timed out, and thus was not processed. This usually happens due to network failure between servers and routers in the network. No arguments returned. N/A
SILC_STATUS_ERR_UNSUPPORTED_PUBLIC_KEY The public key or certificate type is not supported in ths implementation. No arguments returned. N/A
SILC_STATUS_ERR_OPERATION_ALLOWED A operation, for example a command, is not allowed or it's execution is not allowed. No arguments returned. N/A

 
SILC protocol defines some additional status types but those status types are not returned in `command_reply' client operation. Only the status types listed above are delivered to application.