SILC_TASK_CALLBACK(silc_client_connect_to_server_final);
SILC_TASK_CALLBACK(silc_client_rekey_final);
-static SilcBool silc_client_packet_parse(SilcPacketParserContext *parser_context,
+static bool silc_client_packet_parse(SilcPacketParserContext *parser_context,
void *context);
static void silc_client_packet_parse_type(SilcClient client,
SilcSocketConnection sock,
SilcPacketContext *packet);
-void silc_client_resolve_auth_method(SilcBool success,
+void silc_client_resolve_auth_method(bool success,
SilcProtocolAuthMeth auth_meth,
const unsigned char *auth_data,
SilcUInt32 auth_data_len, void *context);
the client ready to be run. One must call silc_client_run to run the
client. Returns FALSE if error occured, TRUE otherwise. */
-SilcBool silc_client_init(SilcClient client)
+bool silc_client_init(SilcClient client)
{
SILC_LOG_DEBUG(("Initializing client"));
SilcIDCacheList list;
SilcIDCacheEntry entry;
SilcClientCommandPending *r;
- SilcBool ret;
+ bool ret;
if (silc_idcache_get_all(conn->internal->client_cache, &list)) {
ret = silc_idcache_list_first(list, &entry);
client operation to resolve the authentication method. We will continue
the executiong of the protocol in this function. */
-void silc_client_resolve_auth_method(SilcBool success,
+void silc_client_resolve_auth_method(bool success,
SilcProtocolAuthMeth auth_meth,
const unsigned char *auth_data,
SilcUInt32 auth_data_len, void *context)
int silc_client_packet_send_real(SilcClient client,
SilcSocketConnection sock,
- SilcBool force_send)
+ bool force_send)
{
int ret;
/* Parser callback called by silc_packet_receive_process. Thie merely
registers timeout that will handle the actual parsing when appropriate. */
-static SilcBool silc_client_packet_parse(SilcPacketParserContext *parser_context,
+static bool silc_client_packet_parse(SilcPacketParserContext *parser_context,
void *context)
{
SilcClient client = (SilcClient)context;
SilcHmac hmac,
unsigned char *data,
SilcUInt32 data_len,
- SilcBool force_send)
+ bool force_send)
{
SilcPacketContext packetdata;
const SilcBufferStruct packet;
int block_len;
SilcUInt32 sequence = 0;
+ int src_id_allocated = FALSE;
if (!sock)
return;
} else {
packetdata.src_id = silc_calloc(SILC_ID_CLIENT_LEN, sizeof(unsigned char));
packetdata.src_id_len = SILC_ID_CLIENT_LEN;
+ src_id_allocated = TRUE;
}
packetdata.src_id_type = SILC_ID_CLIENT;
if (dst_id) {
if (!silc_packet_assemble(&packetdata, client->rng, cipher, hmac, sock,
data, data_len, (const SilcBuffer)&packet)) {
SILC_LOG_ERROR(("Error assembling packet"));
- return;
+ goto out;
}
/* Encrypt the packet */
/* Now actually send the packet */
silc_client_packet_send_real(client, sock, force_send);
+
+ out:
+ if (src_id_allocated && packetdata.src_id)
+ silc_free(packetdata.src_id);
+ if (packetdata.dst_id)
+ silc_free(packetdata.dst_id);
}
/* Packet sending routine for application. This is the only routine that
is provided for application to send SILC packets. */
-SilcBool silc_client_send_packet(SilcClient client,
+bool silc_client_send_packet(SilcClient client,
SilcClientConnection conn,
SilcPacketType type,
const unsigned char *data,
static void silc_client_resume_session_cb(SilcClient client,
SilcClientConnection conn,
- SilcBool success,
+ bool success,
void *context)
{
SilcBuffer sidp;