SILC_FSM_* macro API changes.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 23 Jan 2007 15:02:57 +0000 (15:02 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 23 Jan 2007 15:02:57 +0000 (15:02 +0000)
14 files changed:
lib/silcclient/DIRECTORY
lib/silcclient/README
lib/silcclient/client.c
lib/silcclient/client_attrs.c
lib/silcclient/client_channel.c
lib/silcclient/client_entry.c
lib/silcclient/client_ftp.c
lib/silcclient/client_internal.h
lib/silcclient/client_keyagr.c
lib/silcclient/client_notify.c
lib/silcclient/client_register.c
lib/silcclient/command.c
lib/silcclient/command_reply.c
lib/silcclient/silcclient.h

index a4fad88df39d8f60f23e4afd8314a82a9f1d6823..1f07de86ab9b7958c24bc1d4fd55efd700020299 100644 (file)
@@ -7,6 +7,7 @@
 @LINK=notifyargs.html:Arguments for <b>notify</b> Client Operation
 @LINK=silcclient_unicode.html:Unicode and UTF-8 Strings in Client Library
 @LINK=silcclient.html:Client Library Interface Reference
+@LINK=silcclient_entry.html:Client Entry Interface Reference
 -->
 
 <big><b>SILC Client Library</b></big>
index f2755c3149558f7195195aacc653fd868e17f9df..a1a73f51e3e48dbb0ea91771d69c4c82dc09d0b7 100644 (file)
@@ -82,19 +82,21 @@ Finishing threads when closing connection
    When closing SilcClientConnection all threads must first be finished
    before the connection machine is finished.  This is done by finishing
    all running command threads.  That will also finish all waiting packet
-   threads as they are always waiting for a command.  If any thread is
-   waiting for something else than a command (such as event threads) they
-   must be explicitly finished.  The threads are finished by continuing
-   them synchronously.  The threads will detect that we are disconnected
-   (see below).  SILC_FSM_YIELD must be returned in st_close() as that
-   gives the FSM scheduler time to finish the threads first.  After that
-   the machine can be finished.
+   and notify threads as they are always waiting for a command.  If any 
+   thread is waiting for something else than a command (such as event 
+   threads) they must be explicitly finished.  The threads are finished by 
+   continuing them synchronously.  The threads will detect that we are 
+   disconnected (see below).  SILC_FSM_YIELD must be returned in 
+   st_close() as that gives the FSM scheduler time to finish the threads 
+   first.  After that the machine can be finished.
 
    Also, any thread that runs in SilcClientConnection machine must always
    after returning from wait state to check if we are disconnected by doing
 
-     if (conn->internal->disconnected)
+     if (conn->internal->disconnected) {
        xxx;
+       return SILC_FSM_FINISH;
+     }
 
    If disconnected the thread must finish immediately by returning
    SILC_FSM_FINISH.
index d46f081837a6bf03fa0f575c85e504f697cda547..98424f427bd0dcef0d737b6ef9ac1f8250cab342 100644 (file)
@@ -218,7 +218,7 @@ SILC_FSM_STATE(silc_client_connection_st_start)
     SILC_FSM_EVENT_SIGNAL(&conn->internal->wait_event);
 
   /* Wait until this thread is terminated from the machine destructor */
-  SILC_FSM_WAIT;
+  return SILC_FSM_WAIT;
 }
 
 /* Connection machine main state.  This handles various connection related
@@ -244,7 +244,7 @@ SILC_FSM_STATE(silc_client_connection_st_run)
     silc_fsm_thread_init(thread, &conn->internal->fsm, conn,
                         NULL, NULL, FALSE);
     silc_fsm_start_sync(thread, silc_client_st_connect);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (conn->internal->key_exchange) {
@@ -255,7 +255,7 @@ SILC_FSM_STATE(silc_client_connection_st_run)
     silc_fsm_thread_init(thread, &conn->internal->fsm, conn,
                         NULL, NULL, FALSE);
     silc_fsm_start_sync(thread, silc_client_st_connect_set_stream);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (conn->internal->rekeying) {
@@ -266,19 +266,19 @@ SILC_FSM_STATE(silc_client_connection_st_run)
     silc_fsm_thread_init(thread, &conn->internal->fsm, conn,
                         NULL, NULL, FALSE);
     silc_fsm_start_sync(thread, silc_client_st_rekey);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (conn->internal->disconnected) {
     /** Event: disconnected */
     SILC_LOG_DEBUG(("Event: disconnected"));
     silc_fsm_next(fsm, silc_client_connection_st_close);
-    SILC_FSM_YIELD;
+    return SILC_FSM_YIELD;
   }
 
   /* NOT REACHED */
   SILC_ASSERT(FALSE);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /* Packet processor thread.  Each incoming packet is processed in FSM
@@ -365,16 +365,16 @@ SILC_FSM_STATE(silc_client_connection_st_packet)
     SILC_FSM_EVENT_SIGNAL(&conn->internal->wait_event);
 
     silc_packet_free(packet);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
     break;
 
   default:
     silc_packet_free(packet);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
     break;
   }
 
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /* Disconnection event to close remote connection.  We close the connection
@@ -401,7 +401,7 @@ SILC_FSM_STATE(silc_client_connection_st_close)
     }
 
     /* Give threads time to finish */
-    SILC_FSM_YIELD;
+    return SILC_FSM_YIELD;
   }
 
   /* Abort ongoing event */
@@ -415,7 +415,7 @@ SILC_FSM_STATE(silc_client_connection_st_close)
   if (silc_fsm_is_started(&conn->internal->event_thread)) {
     SILC_LOG_DEBUG(("Finish event thread"));
     silc_fsm_continue_sync(&conn->internal->event_thread);
-    SILC_FSM_YIELD;
+    return SILC_FSM_YIELD;
   }
 
   SILC_LOG_DEBUG(("Closing remote connection"));
@@ -424,7 +424,7 @@ SILC_FSM_STATE(silc_client_connection_st_close)
   silc_packet_stream_destroy(conn->stream);
 
   SILC_LOG_DEBUG(("Finishing connection machine"));
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Received error packet from server.  Send it to application. */
@@ -444,7 +444,7 @@ SILC_FSM_STATE(silc_client_error)
   silc_free(msg);
   silc_packet_free(packet);
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Received disconnect packet from server.  We close the connection and
@@ -462,7 +462,7 @@ SILC_FSM_STATE(silc_client_disconnect)
 
   if (silc_buffer_len(&packet->buffer) < 1) {
     silc_packet_free(packet);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   status = (SilcStatus)packet->buffer.data[0];
@@ -489,7 +489,7 @@ SILC_FSM_STATE(silc_client_disconnect)
     SILC_FSM_EVENT_SIGNAL(&conn->internal->wait_event);
   }
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /*************************** Main client machine ****************************/
@@ -510,7 +510,7 @@ SILC_FSM_STATE(silc_client_st_run)
     SILC_LOG_DEBUG(("We are up, call running callback"));
     client->internal->run_callback = FALSE;
     client->internal->running(client, client->internal->running_context);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (client->internal->connection_closed) {
@@ -520,7 +520,7 @@ SILC_FSM_STATE(silc_client_st_run)
     if (silc_atomic_get_int16(&client->internal->conns) == 0 &&
        client->internal->stop)
       SILC_FSM_EVENT_SIGNAL(&client->internal->wait_event);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (client->internal->stop) {
@@ -529,12 +529,12 @@ SILC_FSM_STATE(silc_client_st_run)
     SILC_LOG_DEBUG(("Event: stop"));
     if (silc_atomic_get_int16(&client->internal->conns) == 0)
       silc_fsm_next(fsm, silc_client_st_stop);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* NOT REACHED */
   SILC_ASSERT(FALSE);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /* Stop event.  Stops the client library. */
@@ -553,7 +553,7 @@ SILC_FSM_STATE(silc_client_st_stop)
   if (client->internal->running)
     client->internal->running(client, client->internal->running_context);
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /******************************* Private API ********************************/
@@ -634,7 +634,7 @@ silc_client_add_connection(SilcClient client,
     return NULL;
   }
 
-  conn->internal->ftp_sessions = silc_dlist_init();
+  //  conn->internal->ftp_sessions = silc_dlist_init();
 
   /* Initialize our async operation so that application may abort us
      while we're connecting. */
index bee7ca746b32f24f576da02ac9c52d5670cc8748..8f131559bffbb4ce0450e98ab8bf37de1ad6d207 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2002 - 2004, 2006 Pekka Riikonen
+  Copyright (C) 2002 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -123,7 +123,7 @@ SilcBuffer silc_client_attributes_process(SilcClient client,
   /* Finally compute the digital signature of all the data we provided. */
   if (silc_pkcs_sign(conn->private_key, silc_buffer_data(buffer),
                     silc_buffer_len(buffer), sign, sizeof(sign), &sign_len,
-                    conn->internal->sha1hash)) {
+                    TRUE, conn->internal->sha1hash)) {
     pk.type = NULL;
     pk.data = sign;
     pk.data_len = sign_len;
@@ -184,9 +184,9 @@ static void silc_client_attribute_del_foreach(void *key, void *context,
 /* Delete one attribute */
 
 SilcBool silc_client_attribute_del(SilcClient client,
-                              SilcClientConnection conn,
-                              SilcAttribute attribute,
-                              SilcAttributePayload attr)
+                                  SilcClientConnection conn,
+                                  SilcAttribute attribute,
+                                  SilcAttributePayload attr)
 {
   SilcBool ret;
 
@@ -236,6 +236,7 @@ SilcBuffer silc_client_attributes_request(SilcAttribute attribute, ...)
 
   if (!attribute)
     return silc_client_attributes_request(SILC_ATTRIBUTE_USER_INFO,
+                                         SILC_ATTRIBUTE_USER_ICON,
                                          SILC_ATTRIBUTE_SERVICE,
                                          SILC_ATTRIBUTE_STATUS_MOOD,
                                          SILC_ATTRIBUTE_STATUS_FREETEXT,
index 4492153c0320b9d264edafb04d543c0bbbe6c09a..4d320bfbe10abc364b8c4e685185cc65250acfe0 100644 (file)
@@ -169,7 +169,7 @@ SILC_FSM_STATE(silc_client_channel_message)
   if (silc_unlikely(packet->dst_id_type != SILC_ID_CHANNEL)) {
     /** Invalid packet */
     silc_fsm_next(fsm, silc_client_channel_message_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (silc_unlikely(!silc_id_str2id(packet->src_id,
@@ -177,7 +177,7 @@ SILC_FSM_STATE(silc_client_channel_message)
                                    &remote_id, sizeof(remote_id)))) {
     /** Invalid source ID */
     silc_fsm_next(fsm, silc_client_channel_message_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* Get sender client entry */
@@ -197,7 +197,7 @@ SILC_FSM_STATE(silc_client_channel_message)
                                    sizeof(channel_id)))) {
     /** Invalid destination ID */
     silc_fsm_next(fsm, silc_client_channel_message_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* Find the channel */
@@ -205,7 +205,7 @@ SILC_FSM_STATE(silc_client_channel_message)
   if (silc_unlikely(!channel)) {
     /** Unknown channel */
     silc_fsm_next(fsm, silc_client_channel_message_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* Check that user is on channel */
@@ -214,7 +214,7 @@ SILC_FSM_STATE(silc_client_channel_message)
     SILC_LOG_WARNING(("Message from user not on channel, client or "
                      "server bug"));
     silc_fsm_next(fsm, silc_client_channel_message_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* If there is no channel private key then just decrypt the message
@@ -298,7 +298,7 @@ SILC_FSM_STATE(silc_client_channel_message)
   silc_client_unref_channel(client, conn, channel);
   if (payload)
     silc_message_payload_free(payload);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Channel message error. */
@@ -307,7 +307,7 @@ SILC_FSM_STATE(silc_client_channel_message_error)
 {
   SilcPacket packet = state_context;
   silc_packet_free(packet);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /******************************* Channel Key ********************************/
@@ -469,7 +469,7 @@ SILC_FSM_STATE(silc_client_channel_key)
   silc_client_save_channel_key(client, conn, &packet->buffer, NULL);
   silc_packet_free(packet);
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /**************************** Channel Private Key ***************************/
index 0f04e08401438cff0a70169910534725879f4128..a643597dae9b5c45e5b1d43d2c51ff60f162613a 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2001 - 2006 Pekka Riikonen
+  Copyright (C) 2001 - 2007 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -730,9 +730,6 @@ SilcClientEntry silc_client_add_client(SilcClient client,
     }
   }
 
-  /* Format the nickname */
-  silc_client_nickname_format(client, conn, client_entry, FALSE);
-
   silc_mutex_lock(conn->internal->lock);
 
   /* Add client to cache, the normalized nickname is saved to cache */
@@ -751,6 +748,9 @@ SilcClientEntry silc_client_add_client(SilcClient client,
   silc_mutex_unlock(conn->internal->lock);
   silc_client_ref_client(client, conn, client_entry);
 
+  /* Format the nickname */
+  silc_client_nickname_format(client, conn, client_entry, FALSE);
+
   SILC_LOG_DEBUG(("Added %p", client_entry));
 
   return client_entry;
index ecb361c99615ae9c6243b6493c4b2a6ba7bd90fe..c3bbd177cb3adc87a0c61b312e51095630e4bdbf 100644 (file)
@@ -821,13 +821,12 @@ void silc_client_ftp_session_free(SilcClientFtpSession session)
 
 SilcClientFileError
 silc_client_file_send(SilcClient client,
-                     SilcClientConnection conn,
+                     SilcClientEntry client_entry,
+                     SilcClientConnectionParams *params,
+                     SilcPublicKey public_key,
+                     SilcPrivateKey private_key,
                      SilcClientFileMonitor monitor,
                      void *monitor_context,
-                     const char *local_ip,
-                     SilcUInt32 local_port,
-                     SilcBool do_not_bind,
-                     SilcClientEntry client_entry,
                      const char *filepath,
                      SilcUInt32 *session_id)
 {
@@ -836,20 +835,20 @@ silc_client_file_send(SilcClient client,
   char *filename, *path;
   int fd;
 
-  assert(client && conn && client_entry);
+  SILC_LOG_DEBUG(("File send request (file: %s), filepath"));
 
-  SILC_LOG_DEBUG(("Start"));
+  if (!client || !client_entry || !filepath)
+    return SILC_CLIENT_FILE_ERROR;
 
   /* Check for existing session for `filepath'. */
-  silc_dlist_start(conn->internal->ftp_sessions);
-  while ((session = silc_dlist_get(conn->internal->ftp_sessions))
-        != SILC_LIST_END) {
+  silc_dlist_start(client->internal->ftp_sessions);
+  while ((session = silc_dlist_get(client->internal->ftp_sessions))) {
     if (session->filepath && !strcmp(session->filepath, filepath) &&
        session->client_entry == client_entry)
       return SILC_CLIENT_FILE_ALREADY_STARTED;
   }
 
-  /* See whether the file exists, and can be opened in generally speaking */
+  /* See whether the file exists and can be opened */
   fd = silc_file_open(filepath, O_RDONLY);
   if (fd < 0)
     return SILC_CLIENT_FILE_NO_SUCH_FILE;
@@ -857,7 +856,9 @@ silc_client_file_send(SilcClient client,
 
   /* Add new session */
   session = silc_calloc(1, sizeof(*session));
-  session->session_id = ++conn->internal->next_session_id;
+  if (!session)
+    return SILC_CLIENT_FILE_ERROR;
+  session->session_id = ++client->internal->next_session_id;
   session->client = client;
   session->conn = conn;
   session->server = TRUE;
@@ -881,34 +882,43 @@ silc_client_file_send(SilcClient client,
 
   session->filesize = silc_file_size(filepath);
 
-  /* Create the listener for incoming key exchange protocol. */
-  if (!do_not_bind) {
-    session->listener = -1;
-    if (local_ip)
-      session->hostname = strdup(local_ip);
-    else
-      silc_net_check_local_by_sock(conn->sock->sock, NULL,
-                                  &session->hostname);
-    if (session->hostname)
-      session->listener = silc_net_create_server(local_port,
-                                                session->hostname);
-    if (session->listener < 0) {
+  /* If local IP is provided, create listener for incoming key exchange */
+  if (params && (params->local_ip || params->bind_ip)) {
+    ke = silc_calloc(1, sizeof(*ke));
+    if (!ke) {
+      completion(client, conn, client_entry, SILC_KEY_AGREEMENT_NO_MEMORY,
+                NULL, context);
+      return;
+    }
+
+    /* TCP listener */
+    session->listener =
+      silc_net_tcp_create_listener(params->bind_ip ?
+                                  (const char **)&params->bind_ip :
+                                  (const char **)&params->local_ip,
+                                  1, params->local_port, FALSE, FALSE,
+                                  conn->internal->schedule,
+                                  silc_client_tcp_accept,
+                                  client_entry);
+    if (!session->listener) {
       /* Could not create listener. Do the second best thing; send empty
         key agreement packet and let the remote client provide the point
         for the key exchange. */
       SILC_LOG_DEBUG(("Could not create listener"));
       silc_free(session->hostname);
-      session->listener = 0;
       session->hostname = NULL;
       session->port = 0;
     } else {
-      /* Listener ready */
       SILC_LOG_DEBUG(("Bound listener"));
-      session->port = silc_net_get_local_port(session->listener);
-      silc_schedule_task_add(client->schedule, session->listener,
-                            silc_client_ftp_process_key_agreement, session,
-                            0, 0, SILC_TASK_FD, SILC_TASK_PRI_NORMAL);
       session->bound = TRUE;
+      session->port = params->local_port;
+      if (!session->port) {
+       /* Get listener port */
+       SilcUInt16 *ports;
+       ports = silc_net_listener_get_port(ke->tcp_listener, NULL);
+       session->port = ports[0];
+       silc_free(ports);
+      }
     }
   }
 
@@ -1236,5 +1246,5 @@ SILC_FSM_STATE(silc_client_ftp)
 
  out:
   silc_packet_free(packet);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
index c7bc0434a75c36009d737df2a02bbaa251bad56f..da5bef0f4b13fb4c6a7e40a2817476880409cb98 100644 (file)
@@ -111,10 +111,12 @@ struct SilcClientInternalStruct {
   SilcPacketEngine packet_engine;        /* Packet engine */
   SilcMutex lock;                       /* Client lock */
   SilcList commands;                    /* Registered commands */
+  SilcDList ftp_sessions;               /* FTP sessions */
   char *silc_client_version;            /* Version set by application */
   SilcClientRunning running;            /* Running/Stopped callback */
   void *running_context;                /* Context for runnign callback */
   SilcAtomic16 conns;                   /* Number of connections in client */
+  SilcUInt16 next_session_id;           /* Next FTP session ID */
 
   /* Events */
   unsigned int stop              : 1;   /* Stop client */
@@ -164,8 +166,6 @@ struct SilcClientConnectionInternalStruct {
   unsigned int auth_request       : 1;   /* Set when requesting auth method */
 
   SilcClientAway *away;
-  SilcDList ftp_sessions;
-  SilcUInt32 next_session_id;
   SilcClientFtpSession active_session;
   SilcHashTable privmsg_wait;           /* Waited private messages */
 };
index 3effa0569d56607d5c5c2b2a2ec889e2b67d77fe..63aed9d1dc065c0498105ffafeccbba4645c722a 100644 (file)
@@ -649,14 +649,14 @@ SILC_FSM_STATE(silc_client_key_agreement)
   if (packet->src_id_type != SILC_ID_CLIENT) {
     /** Invalid packet */
     silc_fsm_next(fsm, silc_client_key_agreement_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (!silc_id_str2id(packet->src_id, packet->src_id_len, SILC_ID_CLIENT,
                      &remote_id, sizeof(remote_id))) {
     /** Invalid source ID */
     silc_fsm_next(fsm, silc_client_key_agreement_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* Check whether we know this client already */
@@ -677,7 +677,7 @@ SILC_FSM_STATE(silc_client_key_agreement)
     /** Malformed Payload */
     SILC_LOG_DEBUG(("Malformed key agreement payload"));
     silc_fsm_next(fsm, silc_client_key_agreement_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* If remote did not provide connection endpoint, we will assume that we
@@ -697,7 +697,7 @@ SILC_FSM_STATE(silc_client_key_agreement)
   silc_key_agreement_payload_free(payload);
 
   silc_packet_free(packet);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Key agreement packet processing error */
@@ -706,5 +706,5 @@ SILC_FSM_STATE(silc_client_key_agreement_error)
 {
   SilcPacket packet = state_context;
   silc_packet_free(packet);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
index 7cdb688c5e0cbcadc544290eeb805be007569e8f..740e3e5942e89a92bf9bedec93ce4df60b682231 100644 (file)
@@ -95,24 +95,23 @@ SILC_FSM_STATE(silc_client_notify)
   if (!payload) {
     SILC_LOG_DEBUG(("Malformed notify payload"));
     silc_packet_free(packet);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   if (!silc_notify_get_args(payload)) {
     SILC_LOG_DEBUG(("Malformed notify %d", silc_notify_get_type(payload)));
     silc_notify_payload_free(payload);
     silc_packet_free(packet);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   notify = silc_calloc(1, sizeof(*notify));
   if (!notify) {
     silc_notify_payload_free(payload);
     silc_packet_free(packet);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
-  /* Save notify payload to packet context during processing */
   notify->packet = packet;
   notify->payload = payload;
   notify->fsm = fsm;
@@ -206,11 +205,11 @@ SILC_FSM_STATE(silc_client_notify)
     silc_notify_payload_free(payload);
     silc_packet_free(packet);
     silc_free(notify);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
     break;
   }
 
-  SILC_FSM_YIELD;
+  return SILC_FSM_YIELD;
 }
 
 /* Notify processed, finish the packet processing thread */
@@ -224,7 +223,7 @@ SILC_FSM_STATE(silc_client_notify_processed)
   silc_notify_payload_free(payload);
   silc_packet_free(packet);
   silc_free(notify);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************** NONE ************************************/
@@ -245,7 +244,7 @@ SILC_FSM_STATE(silc_client_notify_none)
 
   /** Notify processed */
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************* INVITE ***********************************/
@@ -320,7 +319,7 @@ SILC_FSM_STATE(silc_client_notify_invite)
   /** Notify processed */
   silc_client_unref_channel(client, conn, channel);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** JOIN ************************************/
@@ -396,7 +395,7 @@ SILC_FSM_STATE(silc_client_notify_join)
   /** Notify processed */
   silc_client_unref_channel(client, conn, channel);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** LEAVE ***********************************/
@@ -458,7 +457,7 @@ SILC_FSM_STATE(silc_client_notify_leave)
   /** Notify processed */
   silc_client_unref_channel(client, conn, channel);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************* SIGNOFF **********************************/
@@ -518,7 +517,7 @@ SILC_FSM_STATE(silc_client_notify_signoff)
  out:
   /** Notify processed */
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** TOPIC_SET *********************************/
@@ -635,7 +634,7 @@ SILC_FSM_STATE(silc_client_notify_topic_set)
   /** Notify processed */
   silc_client_unref_channel(client, conn, channel);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /****************************** NICK_CHANGE *********************************/
@@ -719,7 +718,7 @@ SILC_FSM_STATE(silc_client_notify_nick_change)
   /** Notify processed */
   silc_client_unref_client(client, conn, client_entry);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /****************************** CMODE_CHANGE ********************************/
@@ -899,7 +898,7 @@ SILC_FSM_STATE(silc_client_notify_cmode_change)
 
   /** Notify processed */
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /***************************** CUMODE_CHANGE ********************************/
@@ -1037,7 +1036,7 @@ SILC_FSM_STATE(silc_client_notify_cumode_change)
 
   /** Notify processed */
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************* MOTD *************************************/
@@ -1068,7 +1067,7 @@ SILC_FSM_STATE(silc_client_notify_motd)
  out:
   /** Notify processed */
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /**************************** CHANNEL CHANGE ********************************/
@@ -1123,7 +1122,7 @@ SILC_FSM_STATE(silc_client_notify_channel_change)
   /** Notify processed */
   silc_client_unref_channel(client, conn, channel);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** KICKED ************************************/
@@ -1219,7 +1218,7 @@ SILC_FSM_STATE(silc_client_notify_kicked)
   /** Notify processed */
   silc_client_unref_channel(client, conn, channel);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** KILLED ************************************/
@@ -1322,7 +1321,7 @@ SILC_FSM_STATE(silc_client_notify_killed)
 
   /** Notify processed */
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /**************************** SERVER SIGNOFF ********************************/
@@ -1374,7 +1373,7 @@ SILC_FSM_STATE(silc_client_notify_server_signoff)
   /** Notify processed */
   silc_client_list_free(client, conn, clients);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** ERROR *************************************/
@@ -1421,7 +1420,7 @@ SILC_FSM_STATE(silc_client_notify_error)
  out:
   /** Notify processed */
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** WATCH *************************************/
@@ -1529,5 +1528,5 @@ SILC_FSM_STATE(silc_client_notify_watch)
   /** Notify processed */
   silc_client_unref_client(client, conn, client_entry);
   silc_fsm_next(fsm, silc_client_notify_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
index 2901210288d95dfa50e8f8c41706131b17e3f998..ae5de0011b6243a6a15c5e4b042b6ae4eb0ff1a5 100644 (file)
@@ -144,7 +144,7 @@ SILC_FSM_STATE(silc_client_new_id)
  out:
   /** Packet processed */
   silc_packet_free(packet);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 
@@ -170,14 +170,14 @@ SILC_FSM_STATE(silc_client_st_register)
                           SILC_STR_END)) {
     /** Error sending packet */
     silc_fsm_next(fsm, silc_client_st_register_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /** Wait for new ID */
   conn->internal->registering = TRUE;
   silc_fsm_next_later(fsm, silc_client_st_register_complete,
                      conn->internal->retry_timer, 0);
-  SILC_FSM_WAIT;
+  return SILC_FSM_WAIT;
 }
 
 /* Wait for NEW_ID packet to arrive */
@@ -190,7 +190,7 @@ SILC_FSM_STATE(silc_client_st_register_complete)
   if (conn->internal->disconnected) {
     /** Disconnected */
     silc_fsm_next(fsm, silc_client_st_register_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (!conn->local_id) {
@@ -200,7 +200,7 @@ SILC_FSM_STATE(silc_client_st_register_complete)
       conn->internal->retry_count = 0;
       conn->internal->retry_timer = SILC_CLIENT_RETRY_MIN;
       silc_fsm_next(fsm, silc_client_st_register_error);
-      SILC_FSM_CONTINUE;
+      return SILC_FSM_CONTINUE;
     }
 
     /** Resend registering packet */
@@ -209,7 +209,7 @@ SILC_FSM_STATE(silc_client_st_register_complete)
                                    SILC_CLIENT_RETRY_MUL) +
                                   (silc_rng_get_rn16(client->rng) %
                                    SILC_CLIENT_RETRY_RAND));
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   SILC_LOG_DEBUG(("Registered to network"));
@@ -243,7 +243,7 @@ SILC_FSM_STATE(silc_client_st_register_complete)
   silc_schedule_task_del_by_all(conn->internal->schedule, 0,
                                silc_client_connect_timeout, conn);
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Error registering to network */
@@ -270,7 +270,7 @@ SILC_FSM_STATE(silc_client_st_register_error)
   silc_schedule_task_del_by_all(conn->internal->schedule, 0,
                                silc_client_connect_timeout, conn);
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /************************* Resume detached session **************************/
@@ -294,7 +294,7 @@ SILC_FSM_STATE(silc_client_st_resume)
   if (!resume) {
     /** Out of memory */
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
   silc_fsm_set_state_context(fsm, resume);
 
@@ -316,7 +316,7 @@ SILC_FSM_STATE(silc_client_st_resume)
     /** Malformed detach data */
     SILC_LOG_DEBUG(("Malformed detachment data"));
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (!silc_id_str2id(id, id_len, SILC_ID_CLIENT, &client_id,
@@ -324,7 +324,7 @@ SILC_FSM_STATE(silc_client_st_resume)
     /** Malformed ID */
     SILC_LOG_DEBUG(("Malformed ID"));
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* Generate authentication data that server will verify */
@@ -336,7 +336,7 @@ SILC_FSM_STATE(silc_client_st_resume)
   if (!auth) {
     /** Out of memory */
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /* Send RESUME_CLIENT packet to resume to network */
@@ -349,13 +349,13 @@ SILC_FSM_STATE(silc_client_st_resume)
     /** Error sending packet */
     SILC_LOG_DEBUG(("Error sending packet"));
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /** Wait for new ID */
   conn->internal->registering = TRUE;
   silc_fsm_next_later(fsm, silc_client_st_resume_resolve_channels, 15, 0);
-  SILC_FSM_WAIT;
+  return SILC_FSM_WAIT;
 }
 
 /* Resolve the old session information, user mode and joined channels. */
@@ -372,14 +372,14 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_channels)
   if (conn->internal->disconnected) {
     /** Disconnected */
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (!conn->local_id) {
     /** Timeout, ID not received */
     conn->internal->registering = FALSE;
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   /** Wait for channels */
@@ -397,7 +397,7 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_channels)
                           silc_buffer_len(conn->internal->local_idp));
 
   if (!resume->channel_count)
-    SILC_FSM_YIELD;
+    return SILC_FSM_YIELD;
 
   /* Send IDENTIFY command for all channels we know about.  These are the
      channels we've joined to according our detachment data. */
@@ -453,7 +453,7 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_channels)
   silc_free(res_argv_lens);
   silc_free(res_argv_types);
 
-  SILC_FSM_WAIT;
+  return SILC_FSM_WAIT;
 }
 
 /* Resolve joined channel modes, users and topics. */
@@ -471,7 +471,7 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_cmodes)
   if (conn->internal->disconnected) {
     /** Disconnected */
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   SILC_LOG_DEBUG(("Resolving channel details"));
@@ -480,7 +480,7 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_cmodes)
   silc_fsm_next(fsm, silc_client_st_resume_completed);
 
   if (!silc_idcache_get_all(conn->internal->channel_cache, &channels))
-    SILC_FSM_YIELD;
+    return SILC_FSM_YIELD;
 
   /* Resolve channels' mode, users and topic */
   resume->channel_count = silc_list_count(channels) * 3;
@@ -506,7 +506,7 @@ SILC_FSM_STATE(silc_client_st_resume_resolve_cmodes)
     silc_buffer_free(idp);
   }
 
-  SILC_FSM_WAIT;
+  return SILC_FSM_WAIT;
 }
 
 /* Resuming completed */
@@ -523,13 +523,13 @@ SILC_FSM_STATE(silc_client_st_resume_completed)
   if (conn->internal->disconnected) {
     /** Disconnected */
     silc_fsm_next(fsm, silc_client_st_resume_error);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   if (resume->channel_count > 0) {
     resume->channel_count--;
     if (resume->channel_count)
-      SILC_FSM_WAIT;
+      return SILC_FSM_WAIT;
   }
 
   SILC_LOG_DEBUG(("Resuming completed"));
@@ -591,7 +591,7 @@ SILC_FSM_STATE(silc_client_st_resume_completed)
   silc_free(resume->nickname);
   silc_free(resume);
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Error resuming to network */
@@ -607,7 +607,7 @@ SILC_FSM_STATE(silc_client_st_resume_error)
       silc_free(resume->nickname);
       silc_free(resume);
     }
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   SILC_LOG_DEBUG(("Error resuming to network"));
@@ -632,7 +632,7 @@ SILC_FSM_STATE(silc_client_st_resume_error)
     silc_free(resume);
   }
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Generates the session detachment data. This data can be used later
index 91f35f3275c194e51d47a2d46491bde70d96ce8b..32d436ac10ff55c8ff833084659223c6afdf08fe 100644 (file)
@@ -68,7 +68,7 @@ static SilcUInt16 silc_client_cmd_ident(SilcClientConnection conn)
 SILC_FSM_STATE(silc_client_command_continue_error)
 {
   /* Destructor will free all resources */
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Command reply callback to continue with the execution of a command.
@@ -623,7 +623,7 @@ SILC_FSM_STATE(silc_client_command_whois)
 
     /** Wait for command reply */
     silc_fsm_next(fsm, silc_client_command_reply_wait);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   for (i = 1; i < cmd->argc; i++) {
@@ -714,10 +714,10 @@ SILC_FSM_STATE(silc_client_command_whois)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /******************************** WHOWAS ************************************/
@@ -737,7 +737,7 @@ SILC_FSM_STATE(silc_client_command_whowas)
        "Usage: /WHOWAS <nickname>[@<server>] [<count>]");
     COMMAND_ERROR((cmd->argc < 2 ? SILC_STATUS_ERR_NOT_ENOUGH_PARAMS :
                   SILC_STATUS_ERR_TOO_MANY_PARAMS));
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   if (cmd->argc == 2) {
@@ -756,7 +756,7 @@ SILC_FSM_STATE(silc_client_command_whowas)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** IDENTIFY **********************************/
@@ -772,7 +772,7 @@ SILC_FSM_STATE(silc_client_command_identify)
   int c;
 
   if (cmd->argc < 2 || cmd->argc > 3)
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
 
   if (cmd->argc == 2) {
     silc_client_command_send_va(conn, cmd, cmd->cmd, NULL, NULL,
@@ -787,7 +787,7 @@ SILC_FSM_STATE(silc_client_command_identify)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** NICK ************************************/
@@ -837,10 +837,10 @@ SILC_FSM_STATE(silc_client_command_nick)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************** LIST ************************************/
@@ -876,7 +876,7 @@ SILC_FSM_STATE(silc_client_command_list)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** TOPIC ***********************************/
@@ -941,10 +941,10 @@ SILC_FSM_STATE(silc_client_command_topic)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************* INVITE ***********************************/
@@ -1067,11 +1067,11 @@ SILC_FSM_STATE(silc_client_command_invite)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
   silc_free(nickname);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************** QUIT ************************************/
@@ -1101,7 +1101,7 @@ SILC_FSM_STATE(silc_client_command_quit_final)
     SILC_FSM_EVENT_SIGNAL(&conn->internal->wait_event);
   }
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Command QUIT. Closes connection with current server. */
@@ -1122,7 +1122,7 @@ SILC_FSM_STATE(silc_client_command_quit)
 
   /* We close the connection with a little timeout */
   silc_fsm_next_later(fsm, silc_client_command_quit_final, 2, 0);
-  SILC_FSM_WAIT;
+  return SILC_FSM_WAIT;
 }
 
 /********************************** KILL ************************************/
@@ -1145,12 +1145,12 @@ SILC_FSM_STATE(silc_client_command_kill)
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
        "Usage: /KILL <nickname> [<comment>] [-pubkey]");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Parse the typed nickname. */
   if (!silc_client_nickname_parse(client, conn, cmd->argv[1], &nickname))
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
 
   /* Get the target client */
   clients = silc_client_get_clients_local(client, conn, nickname,
@@ -1195,7 +1195,7 @@ SILC_FSM_STATE(silc_client_command_kill)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** INFO ************************************/
@@ -1220,7 +1220,7 @@ SILC_FSM_STATE(silc_client_command_info)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** STATS ***********************************/
@@ -1242,7 +1242,7 @@ SILC_FSM_STATE(silc_client_command_stats)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** PING ************************************/
@@ -1256,7 +1256,7 @@ SILC_FSM_STATE(silc_client_command_ping)
 
   if (cmd->argc < 2) {
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Send the command */
@@ -1272,7 +1272,7 @@ SILC_FSM_STATE(silc_client_command_ping)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** JOIN ************************************/
@@ -1389,11 +1389,11 @@ SILC_FSM_STATE(silc_client_command_join)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
   silc_client_unref_channel(client, conn, channel);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************** MOTD ************************************/
@@ -1410,7 +1410,7 @@ SILC_FSM_STATE(silc_client_command_motd)
        "Usage: /MOTD [<server>]");
     COMMAND_ERROR((cmd->argc < 1 ? SILC_STATUS_ERR_NOT_ENOUGH_PARAMS :
                   SILC_STATUS_ERR_TOO_MANY_PARAMS));
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Send the command */
@@ -1427,7 +1427,7 @@ SILC_FSM_STATE(silc_client_command_motd)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** UMODE ***********************************/
@@ -1447,7 +1447,7 @@ SILC_FSM_STATE(silc_client_command_umode)
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
        "Usage: /UMODE +|-<modes>");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   mode = conn->local_entry->mode;
@@ -1548,7 +1548,7 @@ SILC_FSM_STATE(silc_client_command_umode)
       break;
     default:
       COMMAND_ERROR(SILC_STATUS_ERR_UNKNOWN_MODE);
-      SILC_FSM_FINISH;
+      return SILC_FSM_FINISH;
       break;
     }
   }
@@ -1566,7 +1566,7 @@ SILC_FSM_STATE(silc_client_command_umode)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** CMODE ***********************************/
@@ -1861,11 +1861,11 @@ SILC_FSM_STATE(silc_client_command_cmode)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
   silc_client_unref_channel(client, conn, channel);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************* CUMODE ***********************************/
@@ -2043,13 +2043,13 @@ SILC_FSM_STATE(silc_client_command_cumode)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
   silc_client_unref_channel(client, conn, channel);
   silc_client_list_free(client, conn, clients);
   silc_free(nickname);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************** KICK ************************************/
@@ -2135,12 +2135,12 @@ SILC_FSM_STATE(silc_client_command_kick)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
   silc_client_unref_channel(client, conn, channel);
   silc_free(nickname);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /***************************** OPER & SILCOPER ******************************/
@@ -2205,7 +2205,7 @@ SILC_FSM_STATE(silc_client_command_oper_send)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /* OPER command. Used to obtain server operator privileges. */
@@ -2220,14 +2220,14 @@ SILC_FSM_STATE(silc_client_command_oper)
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
        "Usage: /OPER <username> [-pubkey]");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Get passphrase */
   if (cmd->argc < 3) {
     oper = silc_calloc(1, sizeof(*oper));
     if (!oper)
-      SILC_FSM_FINISH;
+      return SILC_FSM_FINISH;
     cmd->context = oper;
     SILC_FSM_CALL(conn->client->internal->
                  ops->ask_passphrase(conn->client, conn,
@@ -2235,7 +2235,7 @@ SILC_FSM_STATE(silc_client_command_oper)
   }
 
   silc_fsm_next(fsm, silc_client_command_oper_send);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /* SILCOPER command. Used to obtain router operator privileges. */
@@ -2250,14 +2250,14 @@ SILC_FSM_STATE(silc_client_command_silcoper)
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
        "Usage: /SILCOPER <username> [-pubkey]");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Get passphrase */
   if (cmd->argc < 3) {
     oper = silc_calloc(1, sizeof(*oper));
     if (!oper)
-      SILC_FSM_FINISH;
+      return SILC_FSM_FINISH;
     cmd->context = oper;
     SILC_FSM_CALL(conn->client->internal->
                  ops->ask_passphrase(conn->client, conn,
@@ -2265,7 +2265,7 @@ SILC_FSM_STATE(silc_client_command_silcoper)
   }
 
   silc_fsm_next(fsm, silc_client_command_oper_send);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /*********************************** BAN ************************************/
@@ -2355,10 +2355,10 @@ SILC_FSM_STATE(silc_client_command_ban)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************* DETACH ***********************************/
@@ -2377,7 +2377,7 @@ SILC_FSM_STATE(silc_client_command_detach)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** WATCH ***********************************/
@@ -2449,10 +2449,10 @@ SILC_FSM_STATE(silc_client_command_watch)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************** LEAVE ***********************************/
@@ -2510,10 +2510,10 @@ SILC_FSM_STATE(silc_client_command_leave)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************** USERS ***********************************/
@@ -2553,10 +2553,10 @@ SILC_FSM_STATE(silc_client_command_users)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 
  out:
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /********************************* GETKEY ***********************************/
@@ -2578,13 +2578,13 @@ SILC_FSM_STATE(silc_client_command_getkey)
     client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_INFO,
                     "Usage: /GETKEY <nickname or server name>");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Parse the typed nickname. */
   if (!silc_client_nickname_parse(client, conn, cmd->argv[1], &nickname)) {
     COMMAND_ERROR(SILC_STATUS_ERR_RESOURCE_LIMIT);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Find client entry */
@@ -2599,7 +2599,7 @@ SILC_FSM_STATE(silc_client_command_getkey)
           errors are handled in the resolving callback. */
        COMMAND_ERROR(SILC_STATUS_ERR_NO_SUCH_NICK);
        COMMAND_ERROR(SILC_STATUS_ERR_NO_SUCH_SERVER);
-       SILC_FSM_FINISH;
+       return SILC_FSM_FINISH;
       }
 
       /* No client or server exist with this name, query for both. */
@@ -2634,7 +2634,7 @@ SILC_FSM_STATE(silc_client_command_getkey)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************* SERVICE **********************************/
@@ -2654,7 +2654,7 @@ SILC_FSM_STATE(silc_client_command_service)
     SAY(conn->client, conn, SILC_CLIENT_MESSAGE_INFO,
        "Usage: /SERVICE [<service name>] [-pubkey]");
     COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   name = cmd->argv[1];
@@ -2674,7 +2674,7 @@ SILC_FSM_STATE(silc_client_command_service)
 
   /** Wait for command reply */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /* Register all default commands provided by the client library for the
@@ -2815,7 +2815,7 @@ SILC_FSM_STATE(silc_client_command)
                                       silc_buffer_len(&packet->buffer));
   if (!payload) {
     SILC_LOG_DEBUG(("Bad command packet"));
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Get arguments */
@@ -2838,5 +2838,5 @@ SILC_FSM_STATE(silc_client_command)
   }
 
   silc_command_payload_free(payload);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
index 39e0f92837e71ecabbb53d3f1ea81e5972e7a900..a8411cc61c2b3faa4e33e469622231d540807cca 100644 (file)
@@ -47,7 +47,7 @@ do {                                                          \
     ERROR_CALLBACK(cmd->error);                                                \
     silc_client_command_process_error(cmd, state_context, cmd->error); \
     silc_fsm_next(fsm, silc_client_command_reply_processed);           \
-    SILC_FSM_CONTINUE;                                         \
+    return SILC_FSM_CONTINUE;                                          \
   }
 
 /* Check for correct arguments */
@@ -56,7 +56,7 @@ do {                                                          \
       silc_argument_get_arg_num(args) > max) {                 \
     ERROR_CALLBACK(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);         \
     silc_fsm_next(fsm, silc_client_command_reply_processed);   \
-    SILC_FSM_CONTINUE;                                 \
+    return SILC_FSM_CONTINUE;                                  \
   }
 
 #define SAY cmd->conn->client->internal->ops->say
@@ -174,7 +174,7 @@ SILC_FSM_STATE(silc_client_command_reply)
   silc_packet_free(packet);
   if (!payload) {
     SILC_LOG_DEBUG(("Bad command reply packet"));
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   cmd_ident = silc_command_get_ident(payload);
@@ -196,7 +196,7 @@ SILC_FSM_STATE(silc_client_command_reply)
     SILC_LOG_DEBUG(("Unknown command reply %s, ident %d",
                    silc_get_command_name(command), cmd_ident));
     silc_command_payload_free(payload);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   /* Signal command thread that command reply has arrived */
@@ -204,7 +204,7 @@ SILC_FSM_STATE(silc_client_command_reply)
   silc_fsm_next(&cmd->thread, silc_client_command_reply_process);
   silc_fsm_continue_sync(&cmd->thread);
 
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Wait here for command reply to arrive from remote host */
@@ -219,7 +219,7 @@ SILC_FSM_STATE(silc_client_command_reply_wait)
   silc_fsm_set_state_context(fsm, NULL);
   silc_fsm_next_later(fsm, silc_client_command_reply_timeout,
                      cmd->cmd != SILC_COMMAND_PING ? 25 : 60, 0);
-  SILC_FSM_WAIT;
+  return SILC_FSM_WAIT;
 }
 
 /* Timeout occurred while waiting command reply */
@@ -233,9 +233,9 @@ SILC_FSM_STATE(silc_client_command_reply_timeout)
   if (conn->internal->disconnected) {
     SILC_LOG_DEBUG(("Command %s canceled", silc_get_command_name(cmd->cmd)));
     silc_list_del(conn->internal->pending_commands, cmd);
-    if (!cmd->called)
+    if (!cmd->called && cmd->cmd != SILC_COMMAND_PING)
       ERROR_CALLBACK(SILC_STATUS_ERR_TIMEDOUT);
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
   SILC_LOG_DEBUG(("Command %s timeout", silc_get_command_name(cmd->cmd)));
@@ -243,7 +243,7 @@ SILC_FSM_STATE(silc_client_command_reply_timeout)
   /* Timeout, reply not received in timely fashion */
   silc_list_del(conn->internal->pending_commands, cmd);
   ERROR_CALLBACK(SILC_STATUS_ERR_TIMEDOUT);
-  SILC_FSM_FINISH;
+  return SILC_FSM_FINISH;
 }
 
 /* Process received command reply payload */
@@ -365,10 +365,10 @@ SILC_FSM_STATE(silc_client_command_reply_process)
     silc_fsm_next(fsm, silc_client_command_reply_service);
     break;
   default:
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
   }
 
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /* Completes command reply processing */
@@ -383,7 +383,7 @@ SILC_FSM_STATE(silc_client_command_reply_processed)
 
   if (cmd->status == SILC_STATUS_OK || cmd->status == SILC_STATUS_LIST_END ||
       SILC_STATUS_IS_ERROR(cmd->status))
-    SILC_FSM_FINISH;
+    return SILC_FSM_FINISH;
 
   /* Add back to pending command reply list */
   silc_mutex_lock(conn->internal->lock);
@@ -393,7 +393,7 @@ SILC_FSM_STATE(silc_client_command_reply_processed)
 
   /** Wait more command payloads */
   silc_fsm_next(fsm, silc_client_command_reply_wait);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** WHOIS *************************************/
@@ -513,7 +513,7 @@ SILC_FSM_STATE(silc_client_command_reply_whois)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** WHOWAS ************************************/
@@ -561,7 +561,7 @@ SILC_FSM_STATE(silc_client_command_reply_whowas)
  out:
   silc_client_unref_client(client, conn, client_entry);
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** IDENTIFY **********************************/
@@ -677,7 +677,7 @@ SILC_FSM_STATE(silc_client_command_reply_identify)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** NICK ************************************/
@@ -732,7 +732,7 @@ SILC_FSM_STATE(silc_client_command_reply_nick)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** LIST ************************************/
@@ -758,7 +758,7 @@ SILC_FSM_STATE(silc_client_command_reply_list)
     /* There were no channels in the network. */
     silc_client_command_callback(cmd, NULL, NULL, NULL, 0);
     silc_fsm_next(fsm, silc_client_command_reply_processed);
-    SILC_FSM_CONTINUE;
+    return SILC_FSM_CONTINUE;
   }
 
   CHECK_ARGS(3, 5);
@@ -794,7 +794,7 @@ SILC_FSM_STATE(silc_client_command_reply_list)
  out:
   silc_client_unref_channel(client, conn, channel_entry);
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************* TOPIC ************************************/
@@ -842,7 +842,7 @@ SILC_FSM_STATE(silc_client_command_reply_topic)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************* INVITE ***********************************/
@@ -892,7 +892,7 @@ SILC_FSM_STATE(silc_client_command_reply_invite)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** KILL ************************************/
@@ -933,7 +933,7 @@ SILC_FSM_STATE(silc_client_command_reply_kill)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** INFO ************************************/
@@ -994,7 +994,7 @@ SILC_FSM_STATE(silc_client_command_reply_info)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** STATS ***********************************/
@@ -1051,7 +1051,7 @@ SILC_FSM_STATE(silc_client_command_reply_stats)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** PING ************************************/
@@ -1075,7 +1075,7 @@ SILC_FSM_STATE(silc_client_command_reply_ping)
   silc_client_command_callback(cmd);
 
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** JOIN ************************************/
@@ -1287,7 +1287,7 @@ SILC_FSM_STATE(silc_client_command_reply_join)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** MOTD ************************************/
@@ -1341,7 +1341,7 @@ SILC_FSM_STATE(silc_client_command_reply_motd)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** UMODE ***********************************/
@@ -1375,7 +1375,7 @@ SILC_FSM_STATE(silc_client_command_reply_umode)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** CMODE ***********************************/
@@ -1453,7 +1453,7 @@ SILC_FSM_STATE(silc_client_command_reply_cmode)
   if (public_key)
     silc_pkcs_public_key_free(public_key);
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** CUMODE **********************************/
@@ -1524,7 +1524,7 @@ SILC_FSM_STATE(silc_client_command_reply_cumode)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** KICK ************************************/
@@ -1577,7 +1577,7 @@ SILC_FSM_STATE(silc_client_command_reply_kick)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /******************************** SILCOPER **********************************/
@@ -1596,7 +1596,7 @@ SILC_FSM_STATE(silc_client_command_reply_silcoper)
   silc_client_command_callback(cmd);
 
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** OPER ************************************/
@@ -1615,7 +1615,7 @@ SILC_FSM_STATE(silc_client_command_reply_oper)
   silc_client_command_callback(cmd);
 
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************* DETACH ***********************************/
@@ -1646,7 +1646,7 @@ SILC_FSM_STATE(silc_client_command_reply_detach)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** WATCH ***********************************/
@@ -1665,7 +1665,7 @@ SILC_FSM_STATE(silc_client_command_reply_watch)
   silc_client_command_callback(cmd);
 
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /*********************************** BAN ************************************/
@@ -1713,7 +1713,7 @@ SILC_FSM_STATE(silc_client_command_reply_ban)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** LEAVE ***********************************/
@@ -1759,7 +1759,7 @@ SILC_FSM_STATE(silc_client_command_reply_leave)
 
  out:
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************* USERS ************************************/
@@ -1908,7 +1908,7 @@ SILC_FSM_STATE(silc_client_command_reply_users)
  out:
   silc_client_unref_channel(client, conn, channel);
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** GETKEY **********************************/
@@ -1995,7 +1995,7 @@ SILC_FSM_STATE(silc_client_command_reply_getkey)
   if (public_key)
     silc_pkcs_public_key_free(public_key);
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /********************************** SERVICE *********************************/
@@ -2024,7 +2024,7 @@ SILC_FSM_STATE(silc_client_command_reply_service)
   silc_client_command_callback(cmd, service_list, name);
 
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
 
 /*********************************** QUIT ***********************************/
@@ -2034,5 +2034,5 @@ SILC_FSM_STATE(silc_client_command_reply_service)
 SILC_FSM_STATE(silc_client_command_reply_quit)
 {
   silc_fsm_next(fsm, silc_client_command_reply_processed);
-  SILC_FSM_CONTINUE;
+  return SILC_FSM_CONTINUE;
 }
index 659301fc55bb30fe6ae7f2c9afc1e38a732b0f95..a6d246841142018282d93fe6f4b4a2e3f58c5b8c 100644 (file)
@@ -795,7 +795,6 @@ void silc_client_run(SilcClient client);
  ***/
 void silc_client_run_one(SilcClient client);
 
-
 /****f* silcclient/SilcClientAPI/silc_client_stop
  *
  * SYNOPSIS
@@ -913,7 +912,7 @@ typedef struct {
   /* Rekey timeout in seconds.  The client will perform rekey in this
      time interval.  If set to zero, the default value will be used
      (3600 seconds, 1 hour). */
-  unsigned int rekey_secs;
+  SilcUInt32 rekey_secs;
 
   /* If this is set to TRUE then the client will ignore all incoming
      Requested Attributes queries and does not reply anything back.  This
@@ -1107,7 +1106,7 @@ silc_client_key_exchange(SilcClient client,
 void silc_client_close_connection(SilcClient client,
                                  SilcClientConnection conn);
 
-/* Message sending functions (client_channel.c and client_prvmsg.c) */
+/* Message sending functions */
 
 /****f* silcclient/SilcClientAPI/silc_client_send_channel_message
  *
@@ -1137,7 +1136,8 @@ void silc_client_close_connection(SilcClient client,
  *    private key) is used.
  *
  *    If the `flags' includes SILC_MESSAGE_FLAG_SIGNED the message will be
- *    digitally signed with the SILC key pair.
+ *    digitally signed with the SILC key pair.  In this case the `hash'
+ *    pointer must be provided as well.
  *
  *    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
@@ -1182,8 +1182,7 @@ silc_client_receive_channel_message(SilcClient client,
  *    not been set with this client then the message will be encrypted using
  *    normal session keys.  If the `flags' includes SILC_MESSAGE_FLAG_SIGNED
  *    the message will be digitally signed with the SILC key pair.  In this
- *    case the caller must also provide the `hash' pointer.  By default, the
- *    hash function must be SHA-1.
+ *    case the caller must also provide the `hash' pointer.
  *
  *    Returns TRUE if the message was sent, and FALSE if error occurred.
  *    This function is thread safe and private messages can be sent from
@@ -1268,10 +1267,40 @@ SilcUInt16 silc_client_command_call(SilcClient client,
                                    SilcClientConnection conn,
                                    const char *command_line, ...);
 
-/* If FALSE is returned the callback will not be called again, even if there
-   is more data coming in in the command reply.  If there are other pending
-   commands waiting for the reply, they will receive it even if some other
-   command reply has returned FALSE. */
+/****f* silcclient/SilcClientAPI/SilcClientCommandReply
+ *
+ * SYNOPSIS
+ *
+ *    typedef SilcBool (*SilcClientCommandReply)(SilcClient client,
+ *                                               SilcClientConnection conn,
+ *                                               SilcCommand command,
+ *                                               SilcStatus status,
+ *                                               SilcStatus error,
+ *                                               void *context,
+ *                                               va_list ap);
+ *
+ * DESCRIPTION
+ *
+ *    The command reply callback function given as argument to functions
+ *    silc_client_command_send and silc_client_command_pending.  This is
+ *    called to deliver the command replies to the caller.  Each command
+ *    reply received from the server to the `command' will be delivered
+ *    separately to the caller by calling this callback.  The `status' will
+ *    indicate whether there is only one reply or multiple replies.  The
+ *    `error' will indicate if an error occurred.  The `ap' will include
+ *    command reply arguments.  They are the same arguments as for
+ *    `command_reply' client operation in SilcClientOperations.
+ *
+ *    If `status' is SILC_STATUS_OK only one reply was received and error
+ *    did not occur.  If it is SILC_STATUS_LIST_START, SILC_STATUS_LIST_ITEM
+ *    or SILC_STATUS_LIST_END, there are will be two or more replies.  The
+ *    first reply is SILC_STATUS_LIST_START and last one SILC_STATUS_LIST_END.
+ *
+ *    If FALSE is returned in this function this callback will not be called
+ *    again for `command' even if there are more comand replies.  By returning
+ *    FALSE the caller my stop the command reply handling when needed.
+ *
+ ***/
 typedef SilcBool (*SilcClientCommandReply)(SilcClient client,
                                           SilcClientConnection conn,
                                           SilcCommand command,
@@ -1308,9 +1337,7 @@ typedef SilcBool (*SilcClientCommandReply)(SilcClient client,
  *    The `reply' callback must be provided, and it is called when the
  *    command reply is received from the server.  Note that, when using this
  *    function the default `command_reply' client operation will not be
- *    called, when reply is received.  Note however that, `reply' is almost
- *    identical with `command_reply' callback, and application may forward
- *    the reply from `reply' to `command_reply' callback, if desired.
+ *    called, when reply is received.
  *
  *    Returns command identifier for this sent command.  It can be used
  *    to additionally attach to the command reply using the function
@@ -1388,7 +1415,7 @@ SilcBool silc_client_command_pending(SilcClientConnection conn,
                                     void *context);
 
 
-/* Private Message key management (client_prvmsg.c) */
+/* Private Message key management */
 
 /****f* silcclient/SilcClientAPI/silc_client_add_private_message_key
  *
@@ -1523,8 +1550,7 @@ void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
                                           SilcUInt32 key_count);
 
 
-/* Channel private key management (client_channel.c,
-   SilcChannelPrivateKey is defined in idlist.h) */
+/* Channel private key management */
 
 /****f* silcclient/SilcClientAPI/silc_client_add_channel_private_key
  *
@@ -2042,13 +2068,12 @@ typedef void (*SilcClientFileAskName)(SilcClient client,
  ***/
 SilcClientFileError
 silc_client_file_send(SilcClient client,
-                     SilcClientConnection conn,
+                     SilcClientEntry client_entry,
+                     SilcClientConnectionParams *params,
+                     SilcPublicKey public_key,
+                     SilcPrivateKey private_key,
                      SilcClientFileMonitor monitor,
                      void *monitor_context,
-                     const char *local_ip,
-                     SilcUInt32 local_port,
-                     SilcBool do_not_bind,
-                     SilcClientEntry client_entry,
                      const char *filepath,
                      SilcUInt32 *session_id);