Copyright © 2001 - 2002 SILC Project SILC Project Website | SILC Toolkit Reference Manual Index

SILC Toolkit Reference Manual SILC Core Library SILC Authentication Interface SILC Message Interface SILC Channel Interface SILC Command Interface SILC Notify Interface SILC Status Types SILC Modes SILC ID Interface SILC ID Cache Interface SILC Argument Interface SILC Attributes Interface Packet Protocol Interface SILC Math Library SILC MP Interface SILC Math Interface SILC SFTP Library SILC SFTP Interface SFTP Filesystems Interface SILC Utility Library Basic SILC Types SILC Buffer Interface SILC Buffer Format Interface SILC Hash Table Interface SILC Logging Interface SILC Memory Interface SILC Mutex Interface SILC Thread Interface SILC Network Interface SILC Schedule Interface SILC Socket Interface SILC Protocol Interface SILC Config Interface SILC File Util Interface SILC String Util Interface SILC Util Interface SILC List Interface SILC Dynamic List Interface SILC VCard Interface SILC Application Utilities SILC Key Exchange Library SILC SKE Interface SKE Status Types SKE Diffie Hellman Groups SKE Payloads SILC Client Library Using SILC Client Library Tutorial Arguments for command_reply Client Operation SilcStatus Error Arguments in command_reply Client Operation Arguments for notify Client Operation Client Library Interface Reference SILC Crypto Library Introduction to SILC RNG SILC RNG Interface SILC Cipher API SILC PKCS API SILC PKCS#1 API SILC Hash Interface SILC HMAC Interface Resource Links SILC Project Website SILC Protocol Documentation SILC White Paper SILC FAQs
Structure SilcClientOperations NAME
        typedef struct { ... } SilcClientOperations;
DESCRIPTION
        SILC Client Operations. These must be implemented by the application.
        The Client library may call any of these routines at any time.  The
        routines are used to deliver certain information to the application
        or from the application to the client library.
SOURCE
        typedef struct {
          /* Message sent to the application by library. `conn' associates the
             message to a specific connection.  `conn', however, may be NULL.
             The `type' indicates the type of the message sent by the library.
             The application can for example filter the message according the
             type.  The variable argument list is arguments to the formatted
             message that `msg' may be. */
          void (*say)(SilcClient client, SilcClientConnection conn,
                      SilcClientMessageType type, char *msg, ...);

          /* Message for a channel. The `sender' is the sender of the message
             The `channel' is the channel. The `message' is the message.  Note
             that `message' maybe NULL.  The `flags' indicates message flags
             and it is used to determine how the message can be interpreted
             (like it may tell the message is multimedia message). */
          void (*channel_message)(SilcClient client, SilcClientConnection conn,
                                  SilcClientEntry sender, SilcChannelEntry channel,
                                  SilcMessagePayload payload,
                                  SilcChannelPrivateKey key, SilcMessageFlags flags,
                                  const unsigned char *message,
                                  SilcUInt32 message_len);

          /* Private message to the client. The `sender' is the sender of the
             message. The message is `message'and maybe NULL.  The `flags'
             indicates message flags  and it is used to determine how the message
             can be interpreted (like it may tell the message is multimedia
             message). */
          void (*private_message)(SilcClient client, SilcClientConnection conn,
                                  SilcClientEntry sender, SilcMessagePayload payload,
                                  SilcMessageFlags flags,
                                  const unsigned char *message,
                                  SilcUInt32 message_len);

          /* Notify message to the client. The notify arguments are sent in the
             same order as servers sends them. The arguments are same as received
             from the server except for ID's.  If ID is received application receives
             the corresponding entry to the ID. For example, if Client ID is received
             application receives SilcClientEntry.  Also, if the notify type is
             for channel the channel entry is sent to application (even if server
             does not send it because client library gets the channel entry from
             the Channel ID in the packet's header). */
          void (*notify)(SilcClient client, SilcClientConnection conn,
                         SilcNotifyType type, ...);

          /* Command handler. This function is called always in the command function.
             If error occurs it will be called as well. `conn' is the associated
             client connection. `cmd_context' is the command context that was
             originally sent to the command. `success' is FALSE if error occurred
             during command. `command' is the command being processed. It must be
             noted that this is not reply from server. This is merely called just
             after application has called the command. Just to tell application
             that the command really was processed. */
          void (*command)(SilcClient client, SilcClientConnection conn,
                          SilcClientCommandContext cmd_context, bool success,
                          SilcCommand command, SilcStatus status);

          /* Command reply handler. This function is called always in the command reply
             function. If error occurs it will be called as well. Normal scenario
             is that it will be called after the received command data has been parsed
             and processed. The function is used to pass the received command data to
             the application.

             `conn' is the associated client connection. `cmd_payload' is the command
             payload data received from server and it can be ignored. It is provided
             if the application would like to re-parse the received command data,
             however, it must be noted that the data is parsed already by the library
             thus the payload can be ignored. `success' is FALSE if error occurred.
             In this case arguments are not sent to the application. The `status' is
             the command reply status server returned. The `command' is the command
             reply being processed. The function has variable argument list and each
             command defines the number and type of arguments it passes to the
             application (on error they are not sent).

             The arguments are sent in the same order as servers sends them.  The
             arguments are same as received from the server except for ID's.  If
             ID is received application receives the corresponding entry to the
             ID. For example, if Client ID is receives application receives
             SilcClientEntry. */
          void (*command_reply)(SilcClient client, SilcClientConnection conn,
                                SilcCommandPayload cmd_payload, bool success,
                                SilcCommand command, SilcStatus status, ...);

          /* Called to indicate that connection was either successfully established
             or connecting failed.  This is also the first time application receives
             the SilcClientConnection object which it should save somewhere.
             The `status' indicated whether the connection were successful.  If it
             is error value the application must always call the function
             silc_client_close_connection. */
          void (*connected)(SilcClient client, SilcClientConnection conn,
                            SilcClientConnectionStatus status);

          /* Called to indicate that connection was disconnected to the server.
             The `status' may tell the reason of the disconnection, and if the
             `message' is non-NULL it may include the disconnection message
             received from server. Application must not call the
             silc_client_close_connection in this callback.  The 'conn' is also
             invalid after this function returns back to library. */
          void (*disconnected)(SilcClient client, SilcClientConnection conn,
                               SilcStatus status, const char *message);

          /* Find authentication method and authentication data by hostname and
             port. The hostname may be IP address as well. When the authentication
             method has been resolved the `completion' callback with the found
             authentication method and authentication data is called. The `conn'
             may be NULL. */
          void (*get_auth_method)(SilcClient client, SilcClientConnection conn,
                                  char *hostname, SilcUInt16 port,
                                  SilcGetAuthMeth completion, void *context);

          /* Verifies received public key. The `conn_type' indicates which entity
             (server, client etc.) has sent the public key. If user decides to trust
             the application may save the key as trusted public key for later
             use. The `completion' must be called after the public key has been
             verified. */
          void (*verify_public_key)(SilcClient client, SilcClientConnection conn,
                                    SilcSocketType conn_type, unsigned char *pk,
                                    SilcUInt32 pk_len, SilcSKEPKType pk_type,
                                    SilcVerifyPublicKey completion, void *context);

          /* Ask (interact, that is) a passphrase from user. The passphrase is
             returned to the library by calling the `completion' callback with
             the `context'. The returned passphrase SHOULD be in UTF-8 encoded,
             if not then the library will attempt to encode. */
          void (*ask_passphrase)(SilcClient client, SilcClientConnection conn,
                                 SilcAskPassphrase completion, void *context);

          /* Notifies application that failure packet was received.  This is called
             if there is some protocol active in the client.  The `protocol' is the
             protocol context.  The `failure' is opaque pointer to the failure
             indication.  Note, that the `failure' is protocol dependant and
             application must explicitly cast it to correct type.  Usually `failure'
             is 32 bit failure type (see protocol specs for all protocol failure
             types). */
          void (*failure)(SilcClient client, SilcClientConnection conn,
                          SilcProtocol protocol, void *failure);

          /* Asks whether the user would like to perform the key agreement protocol.
             This is called after we have received an key agreement packet or an
             reply to our key agreement packet. This returns TRUE if the user wants
             the library to perform the key agreement protocol and FALSE if it is not
             desired (application may start it later by calling the function
             silc_client_perform_key_agreement). If TRUE is returned also the
             `completion' and `context' arguments must be set by the application. */
          bool (*key_agreement)(SilcClient client, SilcClientConnection conn,
                                SilcClientEntry client_entry, const char *hostname,
                                SilcUInt16 port, SilcKeyAgreementCallback *completion,
                                void **context);

          /* Notifies application that file transfer protocol session is being
             requested by the remote client indicated by the `client_entry' from
             the `hostname' and `port'. The `session_id' is the file transfer
             session and it can be used to either accept or reject the file
             transfer request, by calling the silc_client_file_receive or
             silc_client_file_close, respectively. */
          void (*ftp)(SilcClient client, SilcClientConnection conn,
                      SilcClientEntry client_entry, SilcUInt32 session_id,
                      const char *hostname, SilcUInt16 port);

          /* Delivers SILC session detachment data indicated by `detach_data' to the
             application.  If application has issued SILC_COMMAND_DETACH command
             the client session in the SILC network is not quit.  The client remains
             in the network but is detached.  The detachment data may be used later
             to resume the session in the SILC Network.  The appliation is
             responsible of saving the `detach_data', to for example in a file.

             The detachment data can be given as argument to the functions
             silc_client_connect_to_server, or silc_client_add_connection when
             creating connection to remote server, inside SilcClientConnectionParams
             structure.  If it is provided the client library will attempt to resume
             the session in the network.  After the connection is created
             successfully, the application is responsible of setting the user
             interface for user into the same state it was before detaching (showing
             same channels, channel modes, etc).  It can do this by fetching the
             information (like joined channels) from the client library. */
          void (*detach)(SilcClient client, SilcClientConnection conn,
                         const unsigned char *detach_data,
                         SilcUInt32 detach_data_len);
        } SilcClientOperations;
Client Library Interface SilcClient SilcClientConnection SilcClientEntry SilcChannelEntry SilcChannelUser SilcServerEntry SilcKeyAgreementStatus SilcKeyAgreementCallback SilcPrivateMessageKeys SilcChannelPrivateKey SilcAskPassphrase SilcVerifyPublicKey SilcGetAuthMeth SilcClientMessageType SilcClientConnectionStatus SilcClientOperations SilcNicknameFormatParse SilcClientParams silc_client_alloc silc_client_free silc_client_init silc_client_run silc_client_run_one silc_client_stop SilcClientConnectionParams silc_client_connect_to_server silc_client_add_connection silc_client_del_connection silc_client_add_socket silc_client_del_socket silc_client_start_key_exchange silc_client_close_connection silc_client_send_channel_message silc_client_send_private_message SilcGetClientCallback silc_client_get_clients(1) silc_client_get_clients silc_client_get_clients_local silc_client_get_clients_by_channel silc_client_get_clients_by_list silc_client_get_client_by_id silc_client_get_client_by_id_resolve silc_client_del_client SilcGetChannelCallback silc_client_get_channel silc_client_get_channel_resolve silc_client_get_channel_by_id silc_client_get_channel_by_id_resolve silc_client_del_channel silc_client_get_server silc_client_get_server_by_id silc_client_del_server silc_client_on_channel silc_client_command_call silc_client_command_send silc_client_command_pending silc_client_add_private_message_key silc_client_add_private_message_key_ske silc_client_del_private_message_key silc_client_list_private_message_keys silc_client_send_private_message_key_request silc_client_free_private_message_keys silc_client_add_channel_private_key silc_client_del_channel_private_keys silc_client_del_channel_private_key silc_client_list_channel_private_keys silc_client_free_channel_private_keys silc_client_current_channel_private_key silc_client_send_key_agreement silc_client_perform_key_agreement silc_client_perform_key_agreement_fd silc_client_abort_key_agreement silc_client_set_away_message SilcConnectionAuthRequest silc_client_request_authentication_method SilcClientMonitorStatus SilcClientFileError SilcClientFileMonitor SilcClientFileName SilcClientFileAskName silc_client_file_send silc_client_file_receive silc_client_file_close silc_client_attribute_add silc_client_attribute_del silc_client_attributes_get silc_client_attributes_request silc_client_send_packet

Copyright © 2001 - 2002 SILC Project SILC Project Website | SILC Toolkit Reference Manual Index