SilcBuffer packet;
va_list ap;
+ assert(client && conn);
+
va_start(ap, argc);
packet = silc_command_payload_encode_vap(command, ident, argc, ap);
{
SilcClientCommand cmd;
+ assert(client);
+
silc_list_start(client->internal->commands);
while ((cmd = silc_list_get(client->internal->commands)) != SILC_LIST_END) {
if (cmd->name && !strcmp(cmd->name, name))
void silc_client_command_call(SilcClientCommand command,
SilcClientCommandContext cmd)
{
+ assert(command);
(*command->command)((void *)cmd, NULL);
}
{
SilcClientCommandPending *reply;
+ assert(conn);
reply = silc_calloc(1, sizeof(*reply));
reply->reply_cmd = reply_cmd;
reply->ident = ident;
reply->context = context;
reply->callback = callback;
- silc_dlist_add(conn->pending_commands, reply);
+ silc_dlist_add(conn->internal->pending_commands, reply);
}
/* Deletes pending command by reply command type. */
{
SilcClientCommandPending *r;
- if (!conn->pending_commands)
+ if (!conn->internal->pending_commands)
return;
- silc_dlist_start(conn->pending_commands);
- while ((r = silc_dlist_get(conn->pending_commands)) != SILC_LIST_END) {
+ silc_dlist_start(conn->internal->pending_commands);
+ while ((r = silc_dlist_get(conn->internal->pending_commands))
+ != SILC_LIST_END) {
if ((r->reply_cmd == reply_cmd || (r->reply_cmd == SILC_COMMAND_NONE &&
r->reply_check))
&& r->ident == ident) {
- silc_dlist_del(conn->pending_commands, r);
+ silc_dlist_del(conn->internal->pending_commands, r);
silc_free(r);
}
}
SilcClientCommandPendingCallbacks callbacks = NULL;
int i = 0;
- silc_dlist_start(conn->pending_commands);
- while ((r = silc_dlist_get(conn->pending_commands)) != SILC_LIST_END) {
+ silc_dlist_start(conn->internal->pending_commands);
+ while ((r = silc_dlist_get(conn->internal->pending_commands))
+ != SILC_LIST_END) {
if ((r->reply_cmd == command || r->reply_cmd == SILC_COMMAND_NONE)
&& r->ident == ident) {
callbacks = silc_realloc(callbacks, sizeof(*callbacks) * (i + 1));
name = cmd->argv[1];
/* Get the Channel ID of the channel */
- if (silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
+ if (silc_idcache_find_by_name_one(conn->internal->channel_cache,
+ name, &id_cache)) {
channel = (SilcChannelEntry)id_cache->context;
idp = silc_id_payload_encode(id_cache->id, SILC_ID_CHANNEL);
}
}
/* Get the Channel ID of the channel */
- if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
+ if (!silc_idcache_find_by_name_one(conn->internal->channel_cache,
+ name, &id_cache)) {
COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
goto out;
}
QuitInternal q = (QuitInternal)context;
/* Close connection */
- q->client->internal->ops->disconnect(q->client, q->conn, 0, NULL);
+ q->client->internal->ops->disconnected(q->client, q->conn, 0, NULL);
silc_client_close_connection(q->client, q->conn->sock->user_data);
silc_free(q);
}
/* Start counting time */
- for (i = 0; i < conn->ping_count; i++) {
- if (conn->ping[i].dest_id == NULL) {
- conn->ping[i].start_time = time(NULL);
- conn->ping[i].dest_id = id;
- conn->ping[i].dest_name = strdup(conn->remote_host);
+ for (i = 0; i < conn->internal->ping_count; i++) {
+ if (conn->internal->ping[i].dest_id == NULL) {
+ conn->internal->ping[i].start_time = time(NULL);
+ conn->internal->ping[i].dest_id = id;
+ conn->internal->ping[i].dest_name = strdup(conn->remote_host);
break;
}
}
- if (i >= conn->ping_count) {
- i = conn->ping_count;
- conn->ping = silc_realloc(conn->ping, sizeof(*conn->ping) * (i + 1));
- conn->ping[i].start_time = time(NULL);
- conn->ping[i].dest_id = id;
- conn->ping[i].dest_name = strdup(conn->remote_host);
- conn->ping_count++;
+ if (i >= conn->internal->ping_count) {
+ i = conn->internal->ping_count;
+ conn->internal->ping =
+ silc_realloc(conn->internal->ping,
+ sizeof(*conn->internal->ping) * (i + 1));
+ conn->internal->ping[i].start_time = time(NULL);
+ conn->internal->ping[i].dest_id = id;
+ conn->internal->ping[i].dest_name = strdup(conn->remote_host);
+ conn->internal->ping_count++;
}
/* Notify application */
auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
cmd->client->private_key,
cmd->client->rng,
- cmd->client->internal->
- sha1hash,
+ cmd->client->sha1hash,
conn->local_id,
SILC_ID_CLIENT);
i++;
auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
cmd->client->private_key,
cmd->client->rng,
- cmd->client->internal->
- sha1hash,
+ cmd->client->sha1hash,
conn->local_id,
SILC_ID_CLIENT);
arg = auth->data;
auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
cmd->client->private_key,
cmd->client->rng,
- cmd->client->internal->
- sha1hash,
+ cmd->client->sha1hash,
conn->local_id,
SILC_ID_CLIENT);
mode |= SILC_CHANNEL_UMODE_CHANFO;
}
/* Get the Channel ID of the channel */
- if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
+ if (!silc_idcache_find_by_name_one(conn->internal->channel_cache,
+ name, &id_cache)) {
COMMAND_ERROR(SILC_STATUS_ERR_NOT_ON_CHANNEL);
goto out;
}
/* Encode the public key authentication payload */
auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
cmd->client->private_key,
- cmd->client->rng, conn->hash,
+ cmd->client->rng,
+ conn->internal->hash,
conn->local_id,
SILC_ID_CLIENT);
} else {
/* Encode the public key authentication payload */
auth = silc_auth_public_key_auth_generate(cmd->client->public_key,
cmd->client->private_key,
- cmd->client->rng, conn->hash,
+ cmd->client->rng,
+ conn->internal->hash,
conn->local_id,
SILC_ID_CLIENT);
} else {