- * void silc_client_stop(SilcClient client);
- *
- * DESCRIPTION
- *
- * Stops the client. This is called to stop the client and thus to stop
- * the program. The client context must be freed with the silc_client_free
- * function.
- *
- ***/
-void silc_client_stop(SilcClient client);
-
-
-/* Connecting functions (client.c) */
-
-/****s* silcclient/SilcClientAPI/SilcClientConnectionParams
- *
- * NAME
- *
- * typedef struct { ... } SilcClientConnectionParams;
- *
- * DESCRIPTION
- *
- * Client connection parameters. This can be filled by the application
- * and given as argument to silc_client_connect_to_server or to
- * silc_client_add_connection.
- *
- * SOURCE
- */
-typedef struct {
- /* The SILC session detachment data that was returned by `detach' client
- operation when the application detached from the network. Application
- is responsible of saving the data and giving it as argument here
- for resuming the session in the SILC network.
-
- If this is provided here 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. */
- unsigned char *detach_data;
- SilcUInt32 detach_data_len;
-
-} SilcClientConnectionParams;
-/***/
-
-/****f* silcclient/SilcClientAPI/silc_client_connect_to_server
- *
- * SYNOPSIS
- *
- * int silc_client_connect_to_server(SilcClient client,
- * SilcClientConnectionParams *params,
- * int port, char *host, void *context);
- *
- * DESCRIPTION
- *
- * Connects to remote server. This is the main routine used to connect
- * to SILC server. Returns -1 on error and the created socket otherwise.
- * The `context' is user context that is saved into the SilcClientConnection
- * that is created after the connection is created. Note that application
- * may handle the connecting process outside the library. If this is the
- * case then this function is not used at all. When the connecting is
- * done the `connect' client operation is called, and the `context' is
- * accessible with conn->context, conn being SilcClientConnection.
- * If the `params' is provided they are used by the routine.
- *
- ***/
-int silc_client_connect_to_server(SilcClient client,
- SilcClientConnectionParams *params,
- int port, char *host, void *context);
-
-/****f* silcclient/SilcClientAPI/silc_client_add_connection
- *
- * SYNOPSIS
- *
- *
- * SilcClientConnection
- * silc_client_add_connection(SilcClient client,
- * SilcClientConnectionParams *params,
- * char *hostname, int port, void *context);
- *
- * DESCRIPTION
- *
- * Allocates and adds new connection to the client. This adds the allocated
- * connection to the connection table and returns a pointer to it. A client
- * can have multiple connections to multiple servers. Every connection must
- * be added to the client using this function. User data `context' may
- * be sent as argument. If the `params' is provided they are used by
- * the routine.
- *
- * NOTES
- *
- * This function is normally used only if the application performed
- * the connecting outside the library, and did not called the
- * silc_client_connect_to_server function at all. The library
- * however may use this internally.
- *
- ***/
-SilcClientConnection
-silc_client_add_connection(SilcClient client,
- SilcClientConnectionParams *params,
- char *hostname, int port, void *context);
-
-/****f* silcclient/SilcClientAPI/silc_client_del_connection
- *
- * SYNOPSIS
- *
- * void silc_client_del_connection(SilcClient client,
- * SilcClientConnection conn);
- *
- * DESCRIPTION
- *
- * Removes connection from client. Frees all memory. The library
- * call this function automatically for all connection contexts.
- * The application however may free the connection contexts it has
- * allocated.
- *
- ***/
-void silc_client_del_connection(SilcClient client, SilcClientConnection conn);
-
-/****f* silcclient/SilcClientAPI/silc_client_add_socket
- *
- * SYNOPSIS
- *
- * void silc_client_add_socket(SilcClient client,
- * SilcSocketConnection sock);
- *
- * DESCRIPTION
- *
- * Adds listener socket to the listener sockets table. This function is
- * used to add socket objects that are listeners to the client. This should
- * not be used to add other connection objects.
- *
- ***/
-void silc_client_add_socket(SilcClient client, SilcSocketConnection sock);
-
-/****f* silcclient/SilcClientAPI/silc_client_del_socket
- *
- * SYNOPSIS
- *
- * void silc_client_del_socket(SilcClient client,
- * SilcSocketConnection sock);
- *
- * DESCRIPTION
- *
- * Deletes listener socket from the listener sockets table. If the
- * application has added a socket with silc_client_add_socket it must
- * also free it using this function.
- *
- ***/
-void silc_client_del_socket(SilcClient client, SilcSocketConnection sock);
-
-/****f* silcclient/SilcClientAPI/silc_client_start_key_exchange
- *
- * SYNOPSIS
- *
- * void silc_client_start_key_exchange(SilcClient client,
- * SilcClientConnection conn,
- * int fd);
- *
- * DESCRIPTION
- *
- * Start SILC Key Exchange (SKE) protocol to negotiate shared secret
- * key material between client and server. This function can be called
- * directly if application is performing its own connecting and does not
- * use the connecting provided by this library. This function is normally
- * used only if the application performed the connecting outside the
- * library. The library however may use this internally. After the
- * key exchange is performed the `connect' client operation is called.
- *
- * NOTES
- *
- * The silc_client_add_connection must be called before calling this
- * function to create the SilcClientConnection context for this
- * connection.
- *
- ***/
-void silc_client_start_key_exchange(SilcClient client,
- SilcClientConnection conn,
- int fd);
-
-/****f* silcclient/SilcClientAPI/silc_client_close_connection
- *
- * SYNOPSIS
- *
- * void silc_client_close_connection(SilcClient client,
- * SilcClientConnection conn);
- *
- * DESCRIPTION
- *
- * Closes connection to remote end. Free's all allocated data except
- * for some information such as nickname etc. that are valid at all time.
- * Usually application does not need to directly call this, except
- * when explicitly closing the connection, or if an error occurs
- * during connection to server (see 'connect' client operation for
- * more information).
- *
- ***/
-void silc_client_close_connection(SilcClient client,
- SilcClientConnection conn);
-
-
-/* Message sending functions (client_channel.c and client_prvmsg.c) */
-
-/****f* silcclient/SilcClientAPI/silc_client_send_channel_message
- *
- * SYNOPSIS
- *
- * bool silc_client_send_channel_message(SilcClient client,
- * SilcClientConnection conn,
- * SilcChannelEntry channel,
- * SilcChannelPrivateKey key,
- * SilcMessageFlags flags,
- * unsigned char *data,
- * SilcUInt32 data_len,
- * bool_force_send);
- *
- * DESCRIPTION
- *
- * Sends packet to the `channel'. Packet to channel is always encrypted
- * differently from "normal" packets. SILC header of the packet is
- * encrypted with the next receiver's key and the rest of the packet is
- * encrypted with the channel specific key. Padding and HMAC is computed
- * with the next receiver's key. The `data' is the channel message. If
- * the `force_send' is TRUE then the packet is sent immediately.
- *
- * If `key' is provided then that private key is used to encrypt the
- * channel message. If it is not provided, private keys has not been
- * set at all, the normal channel key is used automatically. If private
- * keys are set then the first key (the key that was added first as
- * private key) is used.
- *
- * If the `flags' includes SILC_MESSAGE_FLAG_SIGNED the message will be
- * digitally signed with the SILC key pair.
- *
- * Returns TRUE if the message was sent, and FALSE if error occurred or
- * the sending is not allowed due to channel modes (like sending is
- * blocked).
- *
- ***/
-bool silc_client_send_channel_message(SilcClient client,
- SilcClientConnection conn,
- SilcChannelEntry channel,
- SilcChannelPrivateKey key,
- SilcMessageFlags flags,
- unsigned char *data,
- SilcUInt32 data_len,
- bool force_send);
-
-/****f* silcclient/SilcClientAPI/silc_client_send_private_message
- *
- * SYNOPSIS
- *
- * bool silc_client_send_private_message(SilcClient client,
- * SilcClientConnection conn,
- * SilcClientEntry client_entry,
- * SilcMessageFlags flags,
- * unsigned char *data,
- * SilcUInt32 data_len,
- * bool force_send);
- *
- * DESCRIPTION
- *
- * Sends private message to remote client. If private message key has
- * not been set with this client then the message will be encrypted using
- * normal session keys. Private messages are special packets in SILC
- * network hence we need this own function for them. This is similar
- * to silc_client_packet_send_to_channel except that we send private
- * message. The `data' is the private message. If the `force_send' is
- * TRUE the packet is sent immediately.
- *
- * If the `flags' includes SILC_MESSAGE_FLAG_SIGNED the message will be
- * digitally signed with the SILC key pair.
- *
- * Returns TRUE if the message was sent, and FALSE if error occurred.
- *
- ***/
-bool silc_client_send_private_message(SilcClient client,
- SilcClientConnection conn,
- SilcClientEntry client_entry,
- SilcMessageFlags flags,
- unsigned char *data,
- SilcUInt32 data_len,
- bool force_send);
-
-
-/* Client and Channel entry retrieval (idlist.c) */
-
-/****f* silcclient/SilcClientAPI/SilcGetClientCallback
- *
- * SYNOPSIS
- *
- * typedef void (*SilcGetClientCallback)(SilcClient client,
- * SilcClientConnection conn,
- * SilcClientEntry *clients,
- * SilcUInt32 clients_count,
- * void *context);
- *
- * DESCRIPTION
- *
- * Callback function given to the silc_client_get_client function. The
- * found entries are allocated into the `clients' array. The array must
- * not be freed by the receiver, the library will free it later. If the
- * `clients' is NULL, no such clients exist in the SILC Network.
- *
- ***/
-typedef void (*SilcGetClientCallback)(SilcClient client,
- SilcClientConnection conn,
- SilcClientEntry *clients,
- SilcUInt32 clients_count,
- void *context);
-
-/****f* silcclient/SilcClientAPI/silc_client_get_clients
- *
- * SYNOPSIS
- *
- * void silc_client_get_clients(SilcClient client,
- * SilcClientConnection conn,
- * const char *nickname,
- * const char *server,
- * SilcGetClientCallback completion,
- * void *context);
- *
- * DESCRIPTION
- *
- * Finds client entry or entries by the `nickname' and `server'. The
- * completion callback will be called when the client entries has been
- * found. After the server returns the client information it is cached
- * and can be accesses locally at a later time. The resolving is done
- * with IDENTIFY command. The `server' may be NULL.
- *
- * NOTES
- *
- * NOTE: This function is always asynchronous and resolves the client
- * information from the server. Thus, if you already know the client
- * information then use the silc_client_get_client_by_id function to
- * get the client entry since this function may be very slow and should
- * be used only to initially get the client entries.
- *
- * Since this routine resolves with IDENTIFY command only the relevant
- * information (user's nickname and username) is resolved. For example,
- * user's real name, channel list and others are not resolved. Caller
- * can/must resolve those separately if they are needed (for example,
- * with silc_client_get_client_by_id_resolve).
- *
- ***/
-void silc_client_get_clients(SilcClient client,
- SilcClientConnection conn,
- const char *nickname,
- const char *server,
- SilcGetClientCallback completion,
- void *context);
-
-/****f* silcclient/SilcClientAPI/silc_client_get_clients_whois
- *
- * SYNOPSIS
- *
- * void silc_client_get_clients_whois(SilcClient client,
- * SilcClientConnection conn,
- * const char *nickname,
- * const char *server,
- * SilcBuffer attributes,
- * SilcGetClientCallback completion,
- * void *context);
- *
- * DESCRIPTION
- *
- * Finds client entry or entries by the `nickname' and `server'. The
- * completion callback will be called when the client entries has been
- * found. After the server returns the client information it is cached
- * and can be accesses locally at a later time. The resolving is done
- * with WHOIS command. The `server' may be NULL.
- *
- * If the `attributes' is non-NULL then the buffer includes Requested
- * Attributes which can be used to fetch very detailed information
- * about the user. If it is NULL then only normal WHOIS query is
- * made (for more information about attributes see SilcAttribute).
- * Caller may create the `attributes' with silc_client_attributes_request
- * function.
- *
- * NOTES
- *
- * The resolving is done with WHOIS command. For this reason this
- * command may take a long time because it resolves detailed user
- * information.
- *
- ***/
-void silc_client_get_clients_whois(SilcClient client,
- SilcClientConnection conn,
- const char *nickname,
- const char *server,
- SilcBuffer attributes,
- SilcGetClientCallback completion,
- void *context);
-
-/****f* silcclient/SilcClientAPI/silc_client_get_clients_local
- *
- * SYNOPSIS
- *
- * SilcClientEntry *silc_client_get_clients_local(SilcClient client,
- * SilcClientConnection conn,
- * const char *nickname,
- * const char *format,
- * SilcUInt32 *clients_count);
- *
- * DESCRIPTION
- *
- * Same as silc_client_get_clients function but does not resolve anything
- * from the server. This checks local cache and returns all matching
- * clients from the local cache. If none was found this returns NULL.
- * The `nickname' is the real nickname of the client, and the `format'
- * is the formatted nickname to find exact match from multiple found
- * entries. The format must be same as given in the SilcClientParams
- * structure to the client library. If the `format' is NULL all found
- * clients by `nickname' are returned. The caller must return the
- * returned array.
- *
- ***/
-SilcClientEntry *silc_client_get_clients_local(SilcClient client,
- SilcClientConnection conn,
- const char *nickname,
- const char *format,
- SilcUInt32 *clients_count);
-
-/****f* silcclient/SilcClientAPI/silc_client_get_clients_by_channel
- *
- * SYNOPSIS
- *
- * void silc_client_get_clients_by_channel(SilcClient client,
- * SilcClientConnection conn,
- * SilcChannelEntry channel,
- * SilcGetClientCallback completion,
- * void *context);
- *
- * DESCRIPTION
- *
- * Gets client entries by the channel indicated by `channel'. Thus,
- * it resovles the users currently on that channel. If all users are
- * already resolved this returns the users from the channel. If the
- * users are resolved only partially this resolves the complete user
- * information. If no users are resolved on this channel at all, this
- * calls USERS command to resolve all users on the channel. The `completion'
- * will be called after the entries are available. When server returns
- * the client information it will be cached and can be accessed locally
- * at a later time.
- *
- * This function can be used for example in SILC_COMMAND_JOIN command
- * reply handling in application to resolve users on that channel. It
- * also can be used after calling silc_client_get_channel_resolve to
- * resolve users on that channel.
- *
- * NOTES
- *
- * The resolving is done with WHOIS command. For this reason this
- * command may take a long time because it resolves detailed user
- * information.
- *
- ***/
-void silc_client_get_clients_by_channel(SilcClient client,
- SilcClientConnection conn,
- SilcChannelEntry channel,
- SilcGetClientCallback completion,
- void *context);
-
-/****f* silcclient/SilcClientAPI/silc_client_get_clients_by_list
- *
- * SYNOPSIS
- *
- * void silc_client_get_clients_by_list(SilcClient client,
- * SilcClientConnection conn,
- * SilcUInt32 list_count,
- * SilcBuffer client_id_list,
- * SilcGetClientCallback completion,
- * void *context);
- *
- * DESCRIPTION
- *
- * Gets client entries by the list of client ID's `client_id_list'. This
- * always resolves those client ID's it does not know yet from the server
- * so this function might take a while. The `client_id_list' is a list
- * of ID Payloads added one after other. JOIN command reply and USERS
- * command reply for example returns this sort of list. The `completion'
- * will be called after the entries are available. When server returns
- * the client information it will be cached and can be accessed locally
- * at a later time.
- *
- * NOTES
- *
- * The resolving is done with IDENTIFY command. This means that only
- * the relevant information of user (it's nickname and username) is
- * resolved. For example, user's real name, channel lists and others
- * are not resolved. Caller can/must resolve those separately if they
- * are needed (for example, with silc_client_get_client_by_id_resolve).
- *
- ***/
-void silc_client_get_clients_by_list(SilcClient client,
- SilcClientConnection conn,
- SilcUInt32 list_count,
- SilcBuffer client_id_list,
- SilcGetClientCallback completion,
- void *context);
-
-/****f* silcclient/SilcClientAPI/silc_client_get_client_by_id
- *
- * SYNOPSIS
- *
- * SilcClientEntry silc_client_get_client_by_id(SilcClient client,
- * SilcClientConnection conn,
- * SilcClientID *client_id);
- *
- * DESCRIPTION
- *
- * Find entry for client by the client's ID. Returns the entry or NULL
- * if the entry was not found. This checks the local cache and does
- * not resolve anything from server.
- *
- ***/
-SilcClientEntry silc_client_get_client_by_id(SilcClient client,
- SilcClientConnection conn,
- SilcClientID *client_id);
-
-/****f* silcclient/SilcClientAPI/silc_client_get_client_by_id_resolve
- *
- * SYNOPSIS
- *
- * void
- * silc_client_get_client_by_id_resolve(SilcClient client,
- * SilcClientConnection conn,
- * SilcClientID *client_id,
- * SilcBuffer attributes,
- * SilcGetClientCallback completion,
- * void *context);