Changed the version string variables to #defines.
authorPekka Riikonen <priikone@silcnet.org>
Thu, 31 Oct 2002 21:30:07 +0000 (21:30 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Thu, 31 Oct 2002 21:30:07 +0000 (21:30 +0000)
Renamed "connect" and "disconnect" client operations to
"connected" and "disconnected".

CHANGES
apps/irssi/src/silc/core/silc-core.c
apps/silcd/protocol.c
includes/silcincludes.h
includes/silcversion.h
lib/doc/silcclient_using.html
lib/silcclient/client.c
lib/silcclient/client_ops_example.c
lib/silcclient/command.c
lib/silcclient/silcclient.h

diff --git a/CHANGES b/CHANGES
index 899011a0b85c029ad90e7c327aea02707f54e106..e0ef1234c211197797bfc86b8d9aebcfa9fc9f7e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,9 @@ Thu Oct 31 22:44:07 EET 2002  Pekka Riikonen <priikone@silcnet.org>
        * If version string in silc_clinet_alloc is NULL the library
          puts it automatically.  Affected file lib/silcclient/client.c.
 
+       * Changed the version strings from variables to #define's
+         in includes/silcversion.h.
+
 Wed Oct 30 16:17:30 CET 2002  Pekka Riikonen <priikone@silcnet.org>
 
        * Added shared library complation support.
index f1410e7f3e9cdd1f0a03a45f8b32578de71fd703..aec63667c6766ae70332e0fb9133638054f22d01 100644 (file)
@@ -29,7 +29,6 @@
 #include "silc-channels.h"
 #include "silc-queries.h"
 #include "silc-nicklist.h"
-#include "silcversion.h"
 
 #include "signals.h"
 #include "levels.h"
index e0d82738aa9c66c1e9b7f4d149ce7ddb3e9476ac..c033ff743e715fad0079c15d92d816b678a68ae2 100644 (file)
@@ -29,8 +29,6 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth);
 SILC_TASK_CALLBACK(silc_server_protocol_key_exchange);
 SILC_TASK_CALLBACK(silc_server_protocol_rekey);
 
-extern char *silc_version_string;
-
 /*
  * Key Exhange protocol functions
  */
index 1e5a8ad06eff2c0210e9d122d7b3e712d37bb580..060a357e95619f88c57f5bc90be39fb6a6a92808 100644 (file)
@@ -221,6 +221,7 @@ extern "C" {
 
 /* Include generic SILC type definitions */
 #include "silctypes.h"
+#include "silcversion.h"
 
 /* Math library includes */
 #include "silcmp.h"
index 3a29c13ad8343363b464e3b0f51282730e31ca84..9d1841651f5b51c751b345d28e5b77a36f054c62 100644 (file)
@@ -26,18 +26,15 @@ extern "C" {
 
 #include "version_internal.h"
 
-/* Version type definition */
-typedef unsigned char SilcVersion;
-
 /* SILC Protocol version number */
 #define SILC_PROTOCOL_VERSION_CURRENT 11
 
 /* SILC version string */
-const char *silc_version = SILC_VERSION_STRING;
-const char *silc_dist_version = SILC_DIST_VERSION_STRING;
-const char *silc_version_string = SILC_PROTOCOL_VERSION_STRING;
-const char *silc_name = SILC_NAME;
-const char *silc_fullname = "Secure Internet Live Conferencing";
+#define silc_version SILC_VERSION_STRING
+#define silc_dist_version SILC_DIST_VERSION_STRING
+#define silc_version_string SILC_PROTOCOL_VERSION_STRING
+#define silc_name SILC_NAME
+#define silc_fullname "Secure Internet Live Conferencing"
 
 #ifdef __cplusplus
 }
index 82cf3901704166b8ae394ba1900c08159e6b7dae..3dd3acf00ac752bda5362da7f8f36a8e9ce78016 100644 (file)
@@ -423,12 +423,6 @@ int main()
           in includes/version.h file. */
        client = silc_client_alloc(&ops, NULL, NULL, silc_version_string);
 
-       /* Register default ciphers, pkcs, hash funtions and hmacs. */
-       silc_cipher_register_default();
-       silc_pkcs_register_default();
-       silc_hash_register_default();
-       silc_hmac_register_default();
-
        /* Set the mandatory pointers, read public and private key from
           files (or somewhere) and return pointers and PKCS context. */
        client->username = silc_get_username();
index 93360e213538fd938e518f00aa23991e40b3d16f..278fa3796644a2fee864081c10097356826552da 100644 (file)
@@ -21,7 +21,6 @@
 #include "silcincludes.h"
 #include "silcclient.h"
 #include "client_internal.h"
-#include "silcversion.h"
 
 /* Static task callback prototypes */
 SILC_TASK_CALLBACK(silc_client_connect_to_server_start);
@@ -48,7 +47,7 @@ void silc_client_resolve_auth_method(bool success,
 SilcClient silc_client_alloc(SilcClientOperations *ops, 
                             SilcClientParams *params,
                             void *application,
-                            const char *silc_version)
+                            const char *version_string)
 {
   SilcClient new_client;
 
@@ -59,9 +58,9 @@ SilcClient silc_client_alloc(SilcClientOperations *ops,
   new_client->internal->ops = ops;
   new_client->internal->params = 
     silc_calloc(1, sizeof(*new_client->internal->params));
-  if (!silc_version)
-    silc_version = silc_version_string;
-  new_client->internal->silc_client_version = strdup(silc_version);
+  if (!version_string)
+    version_string = silc_version_string;
+  new_client->internal->silc_client_version = strdup(version_string);
 
   if (params)
     memcpy(new_client->internal->params, params, sizeof(*params));
@@ -427,7 +426,7 @@ static void silc_client_start_key_exchange_cb(SilcSocketConnection sock,
     client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
                               "Error: Could not start key exchange protocol");
     silc_net_close_connection(conn->sock->sock);
-    client->internal->ops->connect(client, conn, SILC_CLIENT_CONN_ERROR);
+    client->internal->ops->connected(client, conn, SILC_CLIENT_CONN_ERROR);
     return;
   }
   conn->sock->protocol = protocol;
@@ -482,8 +481,8 @@ SILC_TASK_CALLBACK(silc_client_connect_failure)
     (SilcClientKEInternalContext *)context;
   SilcClient client = (SilcClient)ctx->client;
 
-  client->internal->ops->connect(client, ctx->sock->user_data, 
-                                SILC_CLIENT_CONN_ERROR);
+  client->internal->ops->connected(client, ctx->sock->user_data, 
+                                  SILC_CLIENT_CONN_ERROR);
   if (ctx->packet)
     silc_packet_context_free(ctx->packet);
   silc_free(ctx);
@@ -498,8 +497,8 @@ SILC_TASK_CALLBACK(silc_client_connect_failure_auth)
     (SilcClientConnAuthInternalContext *)context;
   SilcClient client = (SilcClient)ctx->client;
 
-  client->internal->ops->connect(client, ctx->sock->user_data, 
-                                SILC_CLIENT_CONN_ERROR);
+  client->internal->ops->connected(client, ctx->sock->user_data, 
+                                  SILC_CLIENT_CONN_ERROR);
   silc_free(ctx);
 }
 
@@ -547,7 +546,7 @@ SILC_TASK_CALLBACK(silc_client_connect_to_server_start)
       silc_free(ctx);
 
       /* Notify application of failure */
-      client->internal->ops->connect(client, conn, SILC_CLIENT_CONN_ERROR);
+      client->internal->ops->connected(client, conn, SILC_CLIENT_CONN_ERROR);
       silc_client_del_connection(client, conn);
     }
     return;
@@ -905,14 +904,14 @@ SILC_TASK_CALLBACK_GLOBAL(silc_client_packet_process)
         close the connection */
       if (SILC_IS_DISCONNECTING(sock)) {
        if (sock == conn->sock && sock->type != SILC_SOCKET_TYPE_CLIENT)
-         client->internal->ops->disconnect(client, conn, 0, NULL);
+         client->internal->ops->disconnected(client, conn, 0, NULL);
        silc_client_close_connection_real(client, sock, conn);
        return;
       }
       
       SILC_LOG_DEBUG(("EOF from connection %d", sock->sock));
       if (sock == conn->sock && sock->type != SILC_SOCKET_TYPE_CLIENT)
-       client->internal->ops->disconnect(client, conn, 0, NULL);
+       client->internal->ops->disconnected(client, conn, 0, NULL);
       silc_client_close_connection_real(client, sock, conn);
       return;
     }
@@ -1427,7 +1426,7 @@ void silc_client_close_connection_real(SilcClient client,
       sock->protocol->state = SILC_PROTOCOL_STATE_ERROR;
       silc_protocol_execute_final(sock->protocol, client->schedule);
       /* The application will recall this function with these protocols
-        (the ops->connect client operation). */
+        (the ops->connected client operation). */
       return;
     } else {
       sock->protocol->state = SILC_PROTOCOL_STATE_ERROR;
@@ -1566,7 +1565,7 @@ void silc_client_disconnected_by_server(SilcClient client,
 
   conn = (SilcClientConnection)sock->user_data;
   if (sock == conn->sock && sock->type != SILC_SOCKET_TYPE_CLIENT)
-    client->internal->ops->disconnect(client, conn, status, message);
+    client->internal->ops->disconnected(client, conn, status, message);
 
   silc_free(message);
 
@@ -1619,9 +1618,9 @@ static void silc_client_resume_session_cb(SilcClient client,
   SilcBuffer sidp;
 
   /* Notify application that connection is created to server */
-  client->internal->ops->connect(client, conn, success ?
-                                SILC_CLIENT_CONN_SUCCESS_RESUME :
-                                SILC_CLIENT_CONN_ERROR);
+  client->internal->ops->connected(client, conn, success ?
+                                  SILC_CLIENT_CONN_SUCCESS_RESUME :
+                                  SILC_CLIENT_CONN_ERROR);
 
   if (success) {
     /* Issue INFO command to fetch the real server name and server
@@ -1714,7 +1713,7 @@ void silc_client_receive_new_id(SilcClient client,
 
       /* Notify application of successful connection. We do it here now that
         we've received the Client ID and are allowed to send traffic. */
-      client->internal->ops->connect(client, conn, SILC_CLIENT_CONN_SUCCESS);
+      client->internal->ops->connected(client, conn, SILC_CLIENT_CONN_SUCCESS);
 
       /* Issue INFO command to fetch the real server name and server
         information and other stuff. */
index b5f5c2684030c2fc45d20037b992f329e7f19a4e..c94692da3574ac644ee80aa42b5a21f797c17351 100644 (file)
@@ -122,8 +122,8 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
    silc_client_close_connection. */
 
 static void
-silc_connect(SilcClient client, SilcClientConnection conn,
-            SilcClientConnectionStatus status)
+silc_connected(SilcClient client, SilcClientConnection conn,
+              SilcClientConnectionStatus status)
 {
 
 }
@@ -135,8 +135,8 @@ silc_connect(SilcClient client, SilcClientConnection conn,
    received from server. */
 
 static void
-silc_disconnect(SilcClient client, SilcClientConnection conn,
-               SilcStatus status, const char *message)
+silc_disconnected(SilcClient client, SilcClientConnection conn,
+                 SilcStatus status, const char *message)
 {
 
 }
@@ -270,8 +270,8 @@ SilcClientOperations ops = {
   silc_notify,
   silc_command,
   silc_command_reply,
-  silc_connect,
-  silc_disconnect,
+  silc_connected,
+  silc_disconnected,
   silc_get_auth_method,
   silc_verify_public_key,
   silc_ask_passphrase,
index f7b3ec0e9aad14c4bbd38320682321ae48285c35..f033dc25d0dd53770b8c7d983472c9ca827dccda 100644 (file)
@@ -662,7 +662,7 @@ SILC_TASK_CALLBACK(silc_client_command_quit_cb)
   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);
index 2d578ef1ed758f04e131c3df89d85b34f9677e23..8b9ad8f6c2151cb4c1c8175f4f5c1122a52c2a86 100644 (file)
@@ -378,15 +378,15 @@ typedef struct {
      The `status' indicated whether the connection were successful.  If it
      is error value the application must always call the function
      silc_client_close_connection. */
-  void (*connect)(SilcClient client, SilcClientConnection conn,
-                 SilcClientConnectionStatus status);
+  void (*connected)(SilcClient client, SilcClientConnection conn,
+                   SilcClientConnectionStatus status);
 
   /* Called to indicate that connection was disconnected to the server.
      The `status' may tell the reason of the disconnection, and if the
      `message' is non-NULL it may include the disconnection message
      received from server. */
-  void (*disconnect)(SilcClient client, SilcClientConnection conn,
-                    SilcStatus status, const char *message);
+  void (*disconnected)(SilcClient client, SilcClientConnection conn,
+                      SilcStatus status, const char *message);
 
   /* Find authentication method and authentication data by hostname and
      port. The hostname may be IP address as well. When the authentication
@@ -605,7 +605,7 @@ typedef struct {
 SilcClient silc_client_alloc(SilcClientOperations *ops, 
                             SilcClientParams *params,
                             void *application,
-                            const char *silc_version);
+                            const char *version_string);
 
 /****f* silcclient/SilcClientAPI/silc_client_free
  *
@@ -1405,6 +1405,14 @@ void silc_client_command_call(SilcClientCommand command,
  *    directly to the server using this function.  If application is using
  *    the silc_client_command_call, this function is usually not used.
  *
+ *    The variable arguments are a pair of { type, data, data_length },
+ *    and the `argc' is the number of these pairs.
+ *
+ * EXAMPLE
+ *
+ *    silc_client_command_send(client, conn, SILC_COMMAND_WHOIS, 0, 1,
+ *                             1, nickname, strlen(nickname));
+ *
  ***/
 void silc_client_command_send(SilcClient client, SilcClientConnection conn,
                              SilcCommand command, SilcUInt16 ident,