/*
* $Id$
* $Log$
+ * Revision 1.3 2000/07/04 08:29:12 priikone
+ * Added support for PING command. The ping times are calculated
+ * and showed to the user.
+ *
* Revision 1.2 2000/07/03 05:49:48 priikone
* Implemented LEAVE command. Minor bug fixes.
*
silc_buffer_free(ctx->packet);
if (ctx->ske)
silc_ske_free(ctx->ske);
+ if (ctx->dest_id)
+ silc_free(ctx->dest_id);
silc_free(ctx);
sock->protocol = NULL;
return;
proto_ctx->client = (void *)client;
proto_ctx->sock = sock = ctx->sock;
proto_ctx->ske = ctx->ske; /* Save SKE object from previous protocol */
+ proto_ctx->dest_id_type = ctx->dest_id_type;
+ proto_ctx->dest_id = ctx->dest_id;
/* Resolve the authentication method to be used in this connection */
proto_ctx->auth_meth = SILC_PROTOCOL_CONN_AUTH_NONE;
silc_free(ctx->auth_data);
if (ctx->ske)
silc_ske_free(ctx->ske);
+ if (ctx->dest_id)
+ silc_free(ctx->dest_id);
silc_free(ctx);
win->sock->protocol = NULL;
return;
packet->data, packet->len, TRUE);
silc_buffer_free(packet);
+ /* Save remote ID. */
+ win->remote_id = ctx->dest_id;
+ win->remote_id_data = silc_id_id2str(ctx->dest_id, SILC_ID_CHANNEL);
+ win->remote_id_data_len = SILC_ID_CHANNEL_LEN;
+
silc_say(client, "Connected to port %d of host %s",
win->remote_port, win->remote_host);
silc_free(ctx->auth_data);
if (ctx->ske)
silc_ske_free(ctx->ske);
+ if (ctx->dest_id)
+ silc_free(ctx->dest_id);
silc_free(ctx);
win->sock->protocol = NULL;
}
/*
* Recived reply for a command
*/
- silc_client_command_reply_process(client, sock, buffer);
+ silc_client_command_reply_process(client, sock, packet);
break;
case SILC_PACKET_KEY_EXCHANGE:
(SilcClientKEInternalContext *)sock->protocol->context;
proto_ctx->packet = buffer;
+ proto_ctx->dest_id_type = packet->src_id_type;
+ proto_ctx->dest_id = silc_id_str2id(packet->src_id, packet->src_id_type);
/* Let the protocol handle the packet */
sock->protocol->execute(client->timeout_queue, 0,
silc_buffer_free(proto_ctx->packet);
proto_ctx->packet = buffer;
+ proto_ctx->dest_id_type = packet->src_id_type;
+ proto_ctx->dest_id = silc_id_str2id(packet->src_id, packet->src_id_type);
/* Let the protocol handle the packet */
sock->protocol->execute(client->timeout_queue, 0,
#ifndef CLIENT_H
#define CLIENT_H
+/* Structure to hold ping time information. Every PING command will
+ add entry of this structure and is removed after reply to the ping
+ as been received. */
+typedef struct SilcClientPingStruct {
+ time_t start_time;
+ void *dest_id;
+ char *dest_name;
+} SilcClientPing;
+
/* Window structure used in client to associate all the important
connection (window) specific data to this structure. How the window
actually appears on the screen in handeled by the silc_screen*
referencing (sock->user_data). */
SilcSocketConnection sock;
+ /* Requested pings. */
+ SilcClientPing *ping;
+ unsigned int ping_count;
+
/* The actual physical screen. This data is handled by the
screen handling routines. */
void *screen;