application performed the connecting outside the library. The library
however may use this internally. */
-SilcClientConnection silc_client_add_connection(SilcClient client,
- char *hostname,
- int port,
- void *context)
+SilcClientConnection
+silc_client_add_connection(SilcClient client,
+ SilcClientConnectionParams *params,
+ char *hostname, int port, void *context)
{
SilcClientConnection conn;
int i;
conn->pending_commands = silc_dlist_init();
conn->ftp_sessions = silc_dlist_init();
+ if (params) {
+ if (params->detach_data)
+ conn->params.detach_data = silc_memdup(params->detach_data,
+ params->detach_data_len);
+ conn->params.detach_data_len = params->detach_data_len;
+ }
+
/* Add the connection to connections table */
for (i = 0; i < client->internal->conns_count; i++)
if (client->internal->conns && !client->internal->conns[i]) {
case then this function is not used at all. When the connecting is
done the `connect' client operation is called. */
-int silc_client_connect_to_server(SilcClient client, int port,
- char *host, void *context)
+int silc_client_connect_to_server(SilcClient client,
+ SilcClientConnectionParams *params,
+ int port, char *host, void *context)
{
SilcClientInternalConnectContext *ctx;
SilcClientConnection conn;
SILC_LOG_DEBUG(("Connecting to port %d of server %s",
port, host));
- conn = silc_client_add_connection(client, host, port, context);
+ conn = silc_client_add_connection(client, params, host, port, context);
client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_AUDIT,
"Connecting to port %d of server %s", port, host);
NULL, session->monitor_context);
/* Add new connection for this session */
- conn = silc_client_add_connection(client, session->hostname,
+ conn = silc_client_add_connection(client, NULL, session->hostname,
session->port, session);
/* Allocate new socket connection object */
NULL, session->monitor_context);
/* Add new connection for this session */
- conn = silc_client_add_connection(client, newsocket->hostname,
+ conn = silc_client_add_connection(client, NULL, newsocket->hostname,
newsocket->port, session);
conn->sock = newsocket;
conn->sock->user_data = conn;
/* 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. */
+ 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, int port,
- * char *host, void *context);
+ * int silc_client_connect_to_server(SilcClient client,
+ * SilcClientConnectionParams *params,
+ * int port, char *host, void *context);
*
* DESCRIPTION
*
* 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.
+ * 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, int port,
- char *host, void *context);
+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,
- * char *hostname,
- * int port,
- * void *context);
+ *
+ * SilcClientConnection
+ * silc_client_add_connection(SilcClient client,
+ * SilcClientConnectionParams *params,
+ * char *hostname, int port, void *context);
*
* DESCRIPTION
*
* 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. This function is normally used only if the
- * application performed the connecting outside the library. The library
+ * 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,
- char *hostname,
- int port,
- void *context);
+SilcClientConnection
+silc_client_add_connection(SilcClient client,
+ SilcClientConnectionParams *params,
+ char *hostname, int port, void *context);
/****f* silcclient/SilcClientAPI/silc_client_del_connection
*