updates.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 28 Mar 2001 20:57:27 +0000 (20:57 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 28 Mar 2001 20:57:27 +0000 (20:57 +0000)
19 files changed:
CHANGES
README
TODO
apps/silc/client_ops.c
apps/silc/client_ops.h
apps/silc/local_command.c
apps/silc/local_command.h
apps/silc/silc.c
apps/silcd/packet_receive.c
apps/silcd/protocol.c
apps/silcd/testi2.conf
doc/draft-riikonen-silc-pp-01.nroff
lib/silcclient/client_channel.c
lib/silcclient/client_prvmsg.c
lib/silcclient/silcapi.h
lib/silccore/silcchannel.c
lib/silccore/silcchannel.h
lib/silccore/silcprivate.c
lib/silccore/silcprivate.h

diff --git a/CHANGES b/CHANGES
index f603d4365b6dbe55b4946b5317460e5732639952..d7dc9102a15ffbd7acfe73c426a6141ed73fbf59 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,15 @@
+Wed Mar 28 23:55:54 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
+
+       * Added new local command ME to the client.  It is used to send
+         message to a channel with SILC_MESSAGE_FLAG_ACTION to indicate
+         some action.  Affected file silc/local_command.[ch].
+
+       * Changed channel_message and private_message client operations 
+         to deliver the message flags to the application.  Added also
+         the `flags' arguments to the silc_client_send_channel_message
+         and silc_client_send_private_message functions.  Affected file
+         silcapi.h.
+
 Wed Mar 28 20:50:47 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Redefined the Private Message Payload to support private message
 Wed Mar 28 20:50:47 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Redefined the Private Message Payload to support private message
@@ -18,7 +30,7 @@ Wed Mar 28 20:50:47 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Defined some of the message (for channel and private message)
          flags.  Updated the protocol specs and added the flags to the
 
        * Defined some of the message (for channel and private message)
          flags.  Updated the protocol specs and added the flags to the
-         lib/silccore/silcchannel.h.
+         lib/silccore/silcchannel.h.  The type is SilcMessageFlags.
 
 Wed Mar 28 15:52:36 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
 
 Wed Mar 28 15:52:36 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
diff --git a/README b/README
index 6c0808f1da93443c2d6dcbef10ecb52053d681c4..85b85a3761ef2fb569c49e01fccda8614b5f4294 100644 (file)
--- a/README
+++ b/README
@@ -315,6 +315,10 @@ SILC Commands
                        and port of the remote client's key agreement
                        server.
 
                        and port of the remote client's key agreement
                        server.
 
+       /ME     <channel> <action message>
+
+               This command is used to send an action to the channel.
+               This equals to CTCP's ACTION (IRC's /ME) command.
 
 Features
 ========
 
 Features
 ========
diff --git a/TODO b/TODO
index ee740ec963d9196932a395f19e0431c26498e13e..ea32c29409c4f2e575eee7081f690a347834a4be 100644 (file)
--- a/TODO
+++ b/TODO
@@ -173,18 +173,6 @@ TODO in the protocol before SILC 0.x
          passphrase or public key that can be used in the authentication
          when regaining the founder rights.
 
          passphrase or public key that can be used in the authentication
          when regaining the founder rights.
 
- o New packets and features in the packets
-   (draft-riikonen-silc-pp-xx.txt):
-
-       o Define the Private Message packet to include private message
-         flags and define the flags.  The flags could indicate whether
-         the message is, for example autoreply or the receiver should not
-         reply to the private messages.  What other flags?
-       o Define the Channel Message packet to include channel message
-         flags and define the flags.  Actually the flags should be same
-         as for the private message flags.  This way we can implement
-         for example the CTCP style ACTION (/ME command) messages.
-
  o New features in the KE/auth protocol
    (draft-riikonen-silc-ke-auth-xx.txt):
 
  o New features in the KE/auth protocol
    (draft-riikonen-silc-ke-auth-xx.txt):
 
index 19d675b266087731d6a288c95b364b7a39dd37c7..c408656f6f582026c9577c7d8571853611236f4b 100644 (file)
@@ -46,24 +46,35 @@ void silc_say(SilcClient client, SilcClientConnection conn,
    received in the packet. The `channel_name' is the name of the channel. */
 
 void silc_channel_message(SilcClient client, SilcClientConnection conn,
    received in the packet. The `channel_name' is the name of the channel. */
 
 void silc_channel_message(SilcClient client, SilcClientConnection conn,
-                         SilcClientEntry sender, SilcChannelEntry channel
-                         , char *msg)
+                         SilcClientEntry sender, SilcChannelEntry channel,
+                         SilcMessageFlags flags, char *msg)
 {
   /* Message from client */
   if (conn && !strcmp(conn->current_channel->channel_name, 
                      channel->channel_name))
 {
   /* Message from client */
   if (conn && !strcmp(conn->current_channel->channel_name, 
                      channel->channel_name))
-    silc_print(client, "<%s> %s", sender ? sender->nickname : "[<unknown>]", 
-              msg);
+    if (flags & SILC_MESSAGE_FLAG_ACTION)
+      silc_print(client, "* %s %s", sender ? sender->nickname : "[<unknown>]", 
+                msg);
+    else
+      silc_print(client, "<%s> %s", sender ? sender->nickname : "[<unknown>]", 
+                msg);
   else
   else
-    silc_print(client, "<%s:%s> %s", sender ? sender->nickname : "[<unknown>]",
-              channel->channel_name, msg);
+    if (flags & SILC_MESSAGE_FLAG_ACTION)
+      silc_print(client, "* %s:%s %s", sender ? sender->nickname : 
+                "[<unknown>]",
+                channel->channel_name, msg);
+    else
+      silc_print(client, "<%s:%s> %s", sender ? sender->nickname : 
+                "[<unknown>]",
+                channel->channel_name, msg);
 }
 
 /* Private message to the client. The `sender' is the nickname of the
    sender received in the packet. */
 
 void silc_private_message(SilcClient client, SilcClientConnection conn,
 }
 
 /* Private message to the client. The `sender' is the nickname of the
    sender received in the packet. */
 
 void silc_private_message(SilcClient client, SilcClientConnection conn,
-                         SilcClientEntry sender, char *msg)
+                         SilcClientEntry sender, SilcMessageFlags flags,
+                         char *msg)
 {
   silc_print(client, "*%s* %s", sender->nickname, msg);
 }
 {
   silc_print(client, "*%s* %s", sender->nickname, msg);
 }
index 2dc68ce1d4a30388d56b65d574a8836da2efc04a..eb7f8c4f2a935c45d1a33766da7f64dbe6d7ed09 100644 (file)
 void silc_say(SilcClient client, SilcClientConnection conn, char *msg, ...);
 void silc_channel_message(SilcClient client, SilcClientConnection conn,
                          SilcClientEntry sender, 
 void silc_say(SilcClient client, SilcClientConnection conn, char *msg, ...);
 void silc_channel_message(SilcClient client, SilcClientConnection conn,
                          SilcClientEntry sender, 
-                         SilcChannelEntry channel, char *msg);
+                         SilcChannelEntry channel, 
+                         SilcMessageFlags flags, char *msg);
 void silc_private_message(SilcClient client, SilcClientConnection conn,
 void silc_private_message(SilcClient client, SilcClientConnection conn,
-                         SilcClientEntry sender, char *msg);
+                         SilcClientEntry sender, 
+                         SilcMessageFlags flags, char *msg);
 void silc_notify(SilcClient client, SilcClientConnection conn, 
                 SilcNotifyType type, ...);
 void silc_command(SilcClient client, SilcClientConnection conn, 
 void silc_notify(SilcClient client, SilcClientConnection conn, 
                 SilcNotifyType type, ...);
 void silc_command(SilcClient client, SilcClientConnection conn, 
index 3527a3ff9c06e3e761a6a2099d7c4cf65cbca2e9..af7cba4b4fc53130d8801c4da4612a5f9e910bdb 100644 (file)
@@ -32,6 +32,7 @@ SilcClientCommand silc_local_command_list[] =
   SILC_CLIENT_LCMD(msg, MSG, "MSG", 0, 3),
   SILC_CLIENT_LCMD(away, AWAY, "AWAY", 0, 2),
   SILC_CLIENT_LCMD(key, KEY, "KEY", 0, 7),
   SILC_CLIENT_LCMD(msg, MSG, "MSG", 0, 3),
   SILC_CLIENT_LCMD(away, AWAY, "AWAY", 0, 2),
   SILC_CLIENT_LCMD(key, KEY, "KEY", 0, 7),
+  SILC_CLIENT_LCMD(me, ME, "ME", 0, 3),
 
   { NULL, 0, NULL, 0, 0 },
 };
 
   { NULL, 0, NULL, 0, 0 },
 };
@@ -131,7 +132,7 @@ SILC_CLIENT_LCMD_FUNC(msg)
   silc_print(client, "-> *%s* %s", cmd->argv[1], cmd->argv[2]);
 
   /* Send the private message */
   silc_print(client, "-> *%s* %s", cmd->argv[1], cmd->argv[2]);
 
   /* Send the private message */
-  silc_client_send_private_message(client, conn, client_entry,
+  silc_client_send_private_message(client, conn, client_entry, 0,
                                   cmd->argv[2], cmd->argv_lens[2],
                                   TRUE);
 
                                   cmd->argv[2], cmd->argv_lens[2],
                                   TRUE);
 
@@ -691,3 +692,52 @@ SILC_CLIENT_LCMD_FUNC(key)
     silc_free(server);
   silc_client_command_free(cmd);
 }
     silc_free(server);
   silc_client_command_free(cmd);
 }
+
+/* Sends an action to the channel.  Equals CTCP's ACTION (IRC's /ME) 
+   command. */
+
+SILC_CLIENT_LCMD_FUNC(me)
+{
+  SilcClientCommandContext cmd = (SilcClientCommandContext)context;
+  SilcClientConnection conn = cmd->conn;
+  SilcClient client = cmd->client;
+  SilcChannelEntry channel_entry;
+  char *name;
+
+  if (!cmd->conn) {
+    silc_say(client, conn,
+            "You are not connected to a server, use /SERVER to connect");
+    goto out;
+  }
+
+  if (cmd->argc < 3) {
+    silc_say(client, conn, "Usage: /ME <channel> <action message>");
+    goto out;
+  }
+
+  if (cmd->argv[1][0] == '*') {
+    if (!conn->current_channel) {
+      cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+      goto out;
+    }
+    name = conn->current_channel->channel_name;
+  } else {
+    name = cmd->argv[1];
+  }
+
+  channel_entry = silc_client_get_channel(client, conn, name);
+  if (!channel_entry) {
+    silc_say(client, conn, "You are not on that channel");
+    goto out;
+  }
+
+  /* Send the action message */
+  silc_client_send_channel_message(client, conn, channel_entry, NULL,
+                                  SILC_MESSAGE_FLAG_ACTION, 
+                                  cmd->argv[2], cmd->argv_lens[2], TRUE);
+
+  silc_print(client, "* %s %s", conn->nickname, cmd->argv[2]);
+
+ out:
+  silc_client_command_free(cmd);
+}
index bd61ae9c8feb9ea01c1ed4e96a1ded9ef76b8562..0e4fc3e910b22012a5b87a6816d391fcb2422b8a 100644 (file)
@@ -32,6 +32,7 @@ extern SilcClientCommand silc_local_command_list[];
 #define SILC_LOCAL_COMMAND_MSG                 5
 #define SILC_LOCAL_COMMAND_AWAY                6
 #define SILC_LOCAL_COMMAND_KEY         7
 #define SILC_LOCAL_COMMAND_MSG                 5
 #define SILC_LOCAL_COMMAND_AWAY                6
 #define SILC_LOCAL_COMMAND_KEY         7
+#define SILC_LOCAL_COMMAND_ME          8
 
 /* Macros */
 
 
 /* Macros */
 
@@ -53,5 +54,6 @@ SILC_CLIENT_LCMD_FUNC(msg);
 SILC_CLIENT_LCMD_FUNC(server);
 SILC_CLIENT_LCMD_FUNC(away);
 SILC_CLIENT_LCMD_FUNC(key);
 SILC_CLIENT_LCMD_FUNC(server);
 SILC_CLIENT_LCMD_FUNC(away);
 SILC_CLIENT_LCMD_FUNC(key);
+SILC_CLIENT_LCMD_FUNC(me);
 
 #endif
 
 #endif
index ff7e28dc7240b99fc8f00e9c565218e2e2a8995c..06f98e2a97b1145f31972ade018deb3fd2260e64 100644 (file)
@@ -567,7 +567,7 @@ static void silc_client_process_message(SilcClientInternal app)
       silc_client_send_channel_message(app->client, 
                                       app->conn,
                                       app->conn->current_channel, NULL,
       silc_client_send_channel_message(app->client, 
                                       app->conn,
                                       app->conn->current_channel, NULL,
-                                      data, strlen(data), TRUE);
+                                      0, data, strlen(data), TRUE);
     }
   }
 
     }
   }
 
index ef4a97f4a27bf7227689b88c6475b93a08d318d7..4cdb7e074425d5fd3b35a5674da00ff9c0ec4646 100644 (file)
@@ -1130,7 +1130,8 @@ void silc_server_channel_message(SilcServer server,
       sock->type == SILC_SOCKET_TYPE_ROUTER &&
       !(channel->mode & SILC_CHANNEL_MODE_PRIVKEY)) {
     SilcBuffer chp;
       sock->type == SILC_SOCKET_TYPE_ROUTER &&
       !(channel->mode & SILC_CHANNEL_MODE_PRIVKEY)) {
     SilcBuffer chp;
-    unsigned int iv_len, i, data_len;
+    unsigned int iv_len, i;
+    unsigned short data_len, flags;
 
     iv_len = silc_cipher_get_block_len(channel->channel_key);
     if (channel->iv[0] == '\0')
 
     iv_len = silc_cipher_get_block_len(channel->channel_key);
     if (channel->iv[0] == '\0')
@@ -1140,12 +1141,13 @@ void silc_server_channel_message(SilcServer server,
       silc_hash_make(server->md5hash, channel->iv, iv_len, channel->iv);
     
     /* Encode new payload. This encrypts it also. */
       silc_hash_make(server->md5hash, channel->iv, iv_len, channel->iv);
     
     /* Encode new payload. This encrypts it also. */
-    SILC_GET16_MSB(data_len, packet->buffer->data);
-    chp = silc_channel_message_payload_encode(data_len, 
-                                             packet->buffer->data + 2,
+    SILC_GET16_MSB(flags, packet->buffer->data);
+    SILC_GET16_MSB(data_len, packet->buffer->data + 2);
+    chp = silc_channel_message_payload_encode(flags, data_len, 
+                                             packet->buffer->data + 4,
                                              iv_len, channel->iv,
                                              channel->channel_key,
                                              iv_len, channel->iv,
                                              channel->channel_key,
-                                             channel->hmac, server->rng);
+                                             channel->hmac);
     silc_buffer_put(packet->buffer, chp->data, chp->len);
     silc_buffer_free(chp);
   }
     silc_buffer_put(packet->buffer, chp->data, chp->len);
     silc_buffer_free(chp);
   }
index cba75ccf25327259ff0fa0f8c62dd6bd24e86f90..43580638644d0b7592c771018526f466d114e4e0 100644 (file)
@@ -599,8 +599,8 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
          /* Get authentication data */
          silc_buffer_pull(ctx->packet->buffer, 4);
          ret = silc_buffer_unformat(ctx->packet->buffer,
          /* Get authentication data */
          silc_buffer_pull(ctx->packet->buffer, 4);
          ret = silc_buffer_unformat(ctx->packet->buffer,
-                                    SILC_STR_UI_XNSTRING(&auth_data, 
-                                                         payload_len),
+                                    SILC_STR_UI_XNSTRING_ALLOC(&auth_data, 
+                                                               payload_len),
                                     SILC_STR_END);
          if (ret == -1) {
            SILC_LOG_DEBUG(("Bad payload in authentication packet"));
                                     SILC_STR_END);
          if (ret == -1) {
            SILC_LOG_DEBUG(("Bad payload in authentication packet"));
@@ -649,6 +649,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
              /* Authentication failed */
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
              /* Authentication failed */
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
+             silc_free(auth_data);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
@@ -669,6 +670,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
 
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
 
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
+             silc_free(auth_data);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
@@ -678,6 +680,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
            SILC_LOG_DEBUG(("No configuration for remote connection"));
            SILC_LOG_ERROR(("Remote connection not configured"));
            SILC_LOG_ERROR(("Authentication failed"));
            SILC_LOG_DEBUG(("No configuration for remote connection"));
            SILC_LOG_ERROR(("Remote connection not configured"));
            SILC_LOG_ERROR(("Authentication failed"));
+           silc_free(auth_data);
            protocol->state = SILC_PROTOCOL_STATE_ERROR;
            protocol->execute(server->timeout_queue, 0, 
                              protocol, fd, 0, 300000);
            protocol->state = SILC_PROTOCOL_STATE_ERROR;
            protocol->execute(server->timeout_queue, 0, 
                              protocol, fd, 0, 300000);
@@ -715,12 +718,13 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
              /* Authentication failed */
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
              /* Authentication failed */
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
+             silc_free(auth_data);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
              return;
              break;
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
              return;
              break;
-             
+
            case SILC_AUTH_PUBLIC_KEY:
              /* Public key authentication */
              SILC_LOG_DEBUG(("Public key authentication"));
            case SILC_AUTH_PUBLIC_KEY:
              /* Public key authentication */
              SILC_LOG_DEBUG(("Public key authentication"));
@@ -735,6 +739,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
 
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
 
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
+             silc_free(auth_data);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
@@ -747,6 +752,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
            protocol->state = SILC_PROTOCOL_STATE_ERROR;
            protocol->execute(server->timeout_queue, 0, 
                              protocol, fd, 0, 300000);
            protocol->state = SILC_PROTOCOL_STATE_ERROR;
            protocol->execute(server->timeout_queue, 0, 
                              protocol, fd, 0, 300000);
+           silc_free(auth_data);
            return;
          }
        }
            return;
          }
        }
@@ -781,6 +787,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
              /* Authentication failed */
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
              /* Authentication failed */
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
+             silc_free(auth_data);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
@@ -798,9 +805,10 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
                                                          
              if (ret)
                break;
                                                          
              if (ret)
                break;
-
+             
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
              SILC_LOG_ERROR(("Authentication failed"));
              SILC_LOG_DEBUG(("Authentication failed"));
+             silc_free(auth_data);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
              protocol->state = SILC_PROTOCOL_STATE_ERROR;
              protocol->execute(server->timeout_queue, 0, 
                                protocol, fd, 0, 300000);
@@ -810,6 +818,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
            SILC_LOG_DEBUG(("No configuration for remote connection"));
            SILC_LOG_ERROR(("Remote connection not configured"));
            SILC_LOG_ERROR(("Authentication failed"));
            SILC_LOG_DEBUG(("No configuration for remote connection"));
            SILC_LOG_ERROR(("Remote connection not configured"));
            SILC_LOG_ERROR(("Authentication failed"));
+           silc_free(auth_data);
            protocol->state = SILC_PROTOCOL_STATE_ERROR;
            protocol->execute(server->timeout_queue, 0, 
                              protocol, fd, 0, 300000);
            protocol->state = SILC_PROTOCOL_STATE_ERROR;
            protocol->execute(server->timeout_queue, 0, 
                              protocol, fd, 0, 300000);
@@ -817,6 +826,8 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
          }
        }
        
          }
        }
        
+       silc_free(auth_data);
+
        /* Save connection type. This is later used to create the
           ID for the connection. */
        ctx->conn_type = conn_type;
        /* Save connection type. This is later used to create the
           ID for the connection. */
        ctx->conn_type = conn_type;
index 0dc9377a1c3efa0800e8a1616305127c0dabd14f..905957981da5ff69256e08042aeea9987813b0d7 100644 (file)
@@ -1,17 +1,23 @@
 [Cipher]
 [Cipher]
-rc6:../lib/silcsim/modules/rc6.sim.so:16:16
-twofish:../lib/silcsim/modules/twofish.sim.so:16:16
-mars:../lib/silcsim/modules/mars.sim.so:16:16
+aes-256-cbc:../lib/silcsim/modules/aes.sim.so:32:16
+aes-192-cbc:../lib/silcsim/modules/aes.sim.so:24:16
+aes-128-cbc:../lib/silcsim/modules/aes.sim.so:16:16
+twofish-256-cbc:../lib/silcsim/modules/twofish.sim.so:32:16
+twofish-192-cbc:../lib/silcsim/modules/twofish.sim.so:24:16
+twofish-128-cbc:../lib/silcsim/modules/twofish.sim.so:16:16
+mars-256-cbc:../lib/silcsim/modules/mars.sim.so:32:16
+mars-192-cbc:../lib/silcsim/modules/mars.sim.so:24:16
+mars-128-cbc:../lib/silcsim/modules/mars.sim.so:16:16
 none:../lib/silcsim/modules/none.sim.so:0:0
 
 none:../lib/silcsim/modules/none.sim.so:0:0
 
-[Hash] 
+[Hash]
 md5::64:16
 sha1::64:20
 
 [hmac]
 hmac-sha1-96:sha1:12
 hmac-md5-96:md5:12
 md5::64:16
 sha1::64:20
 
 [hmac]
 hmac-sha1-96:sha1:12
 hmac-md5-96:md5:12
-hmac-sha1:sha1:20
+hmac-sha1:sha1:20   
 hmac-md5:md5:16
 
 #[PKCS]
 hmac-md5:md5:16
 
 #[PKCS]
@@ -25,10 +31,10 @@ nobody:nobody
 Mun huone:Mun servo:Pekka Riikonen:priikone@poseidon.pspt.fi
 
 [ServerInfo]
 Mun huone:Mun servo:Pekka Riikonen:priikone@poseidon.pspt.fi
 
 [ServerInfo]
-lassi.kuo.fi.ssh.com:10.2.1.7:Kuopio, Finland:1334
+lassi.kuo.fi.ssh.com:212.146.42.253:Kuopio, Finland:1334
 
 [ListenPort]
 
 [ListenPort]
-10.2.1.7:10.2.1.7:1334
+212.146.42.253:212.146.42.253:1334
 
 [Logging]
 infologfile:silcd2.log:10000
 
 [Logging]
 infologfile:silcd2.log:10000
@@ -47,15 +53,12 @@ errorlogfile:silcd2.log:10000
 :::1336:1
 
 [AdminConnection]
 :::1336:1
 
 [AdminConnection]
-*:silc:silc:passwd:testi
+*:priikone:*:passwd:testi
 
 [ServerConnection]
 
 [ServerConnection]
-10.2.1.7:passwd:priikone:1333:1:1
+212.146.42.253:passwd:priikone:1336:1:1
 
 [RouterConnection]
 
 [RouterConnection]
-10.2.1.7:passwd:priikone:1335:1:1:0
+212.146.42.253:passwd:priikone:1335:1:1:0
 
 [DenyConnection]
 
 [DenyConnection]
-
-[motd]
-./motd
index 65da1422e14d36309daf917a89c3a4996f055e5d..67b5fb79778b534f94e1e26645d1930a23b45ccb 100644 (file)
@@ -1436,8 +1436,8 @@ represents the Channel Message Payload.
                      1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                      1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-|         Message Length        |                               |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
+|            Flags              |         Message Length        |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 ~                         Message Data                          ~
 |                                                               |
 |                                                               |
 ~                         Message Data                          ~
 |                                                               |
@@ -1463,6 +1463,39 @@ Figure 12:  Channel Message Payload
 
 
 .in 6
 
 
 .in 6
+o Flags (2 bytes) - Includes the flags of the channel
+  messages.  The flags can indicate a reason or purpose
+  for the channel message.  Note, that the Private Message
+  Payload use these same flags for the same purpose.  The
+  following flags are defined:
+
+  0x0000  SILC_MESSAGE_FLAG_NONE
+
+          No specific flags set.
+
+  0x0001  SILC_MESSAGE_FLAG_AUTREPLY
+
+          This message is an automatic reply to a earlier
+          received message.
+
+  0x0002  SILC_MESSAGE_FLAG_NOREPLY
+
+          There should not be reply messages to this
+          message.
+
+  0x0004  SILC_MESSAGE_FLAG_ACTION
+
+          The sender is performing an action and the message
+          is the indication of the action.
+
+  0x0008 - 0x0200 RESERVED
+
+          Reserved for future flags
+
+  0x0400 - 0x8000 PRIVATE RANGE
+
+         Private range for free use.
+
 o Message Length (2 bytes) - Indicates the length of the
   the Message Data field in the payload, not including any 
   other field.
 o Message Length (2 bytes) - Indicates the length of the
   the Message Data field in the payload, not including any 
   other field.
@@ -1634,14 +1667,14 @@ diagram represents the Private Message Payload.
                      1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                      1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-|        Nickname Length        |                               |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
+|            Flags              |        Nickname Length        |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 ~                            Nickname                           ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 ~                            Nickname                           ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-|            Flags              |      Message Data Length      |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|      Message Data Length      |                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
 |                                                               |
 ~                          Message Data                         ~
 |                                                               |
 |                                                               |
 ~                          Message Data                         ~
 |                                                               |
@@ -1657,6 +1690,13 @@ Figure 14:  Private Message Payload
 
 
 .in 6
 
 
 .in 6
+o Flags (2 bytes) - This field includes the flags of the
+  private message.  They can indicate a different reason or
+  purpose for the private message.  See the section 2.3.9
+  Channel Message Payload for defined flags.  Note, that
+  the Channel Message Payload use the same flags for the
+  same purpose.
+
 o Nickname Length (2 bytes) - Indicates the length of the
   Nickname field, not including any other field.
 
 o Nickname Length (2 bytes) - Indicates the length of the
   Nickname field, not including any other field.
 
@@ -1668,11 +1708,6 @@ o Nickname (variable length) - Nickname of the sender of the
   to the Client ID in the SILC Packet Header.  This nickname 
   is merely provided to be displayed by the client.
 
   to the Client ID in the SILC Packet Header.  This nickname 
   is merely provided to be displayed by the client.
 
-o Flags (2 bytes) - This field includes the flags of the
-  private message.  They can indicate a different reason or
-  purpose for the private message.  See section XXX for the
-  defined flags.
-
 o Message Data Length (2 bytes) - Indicates the length of the
   Message Data field, not includes any other field.
 
 o Message Data Length (2 bytes) - Indicates the length of the
   Message Data field, not includes any other field.
 
index bec415ab8ff218d60e7916e138ea1e631f8a4a34..26ee63f9d1955c9ccdfd43cc174629e8eb0c795e 100644 (file)
@@ -36,6 +36,7 @@ void silc_client_send_channel_message(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcChannelEntry channel,
                                      SilcChannelPrivateKey key,
                                      SilcClientConnection conn,
                                      SilcChannelEntry channel,
                                      SilcChannelPrivateKey key,
+                                     SilcMessageFlags flags,
                                      unsigned char *data, 
                                      unsigned int data_len, 
                                      int force_send)
                                      unsigned char *data, 
                                      unsigned int data_len, 
                                      int force_send)
@@ -98,7 +99,7 @@ void silc_client_send_channel_message(SilcClient client,
     silc_hash_make(client->md5hash, channel->iv, iv_len, channel->iv);
 
   /* Encode the channel payload. This also encrypts the message payload. */
     silc_hash_make(client->md5hash, channel->iv, iv_len, channel->iv);
 
   /* Encode the channel payload. This also encrypts the message payload. */
-  payload = silc_channel_message_payload_encode(0, data_len, data, iv_len, 
+  payload = silc_channel_message_payload_encode(flags, data_len, data, iv_len, 
                                                channel->iv, cipher, hmac);
 
   /* Get data used in packet header encryption, keys and stuff. */
                                                channel->iv, cipher, hmac);
 
   /* Get data used in packet header encryption, keys and stuff. */
@@ -233,7 +234,9 @@ void silc_client_channel_message(SilcClient client,
 
   /* Pass the message to application */
   client->ops->channel_message(client, conn, found ? chu->client : NULL,
 
   /* Pass the message to application */
   client->ops->channel_message(client, conn, found ? chu->client : NULL,
-                              channel, message);
+                              channel, 
+                              silc_channel_message_get_flags(payload),
+                              message);
 
  out:
   if (id)
 
  out:
   if (id)
index 698f51cb36def47984e112bdfa66cae5f65626e7..f9f6aa450cf7257a5e0c72080fbb67a90178cf4f 100644 (file)
@@ -35,6 +35,7 @@
 void silc_client_send_private_message(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcClientEntry client_entry,
 void silc_client_send_private_message(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcClientEntry client_entry,
+                                     SilcMessageFlags flags,
                                      unsigned char *data, 
                                      unsigned int data_len, 
                                      int force_send)
                                      unsigned char *data, 
                                      unsigned int data_len, 
                                      int force_send)
@@ -48,7 +49,7 @@ void silc_client_send_private_message(SilcClient client,
   SILC_LOG_DEBUG(("Sending private message"));
 
   /* Encode private message payload */
   SILC_LOG_DEBUG(("Sending private message"));
 
   /* Encode private message payload */
-  buffer = silc_private_message_payload_encode(0, strlen(conn->nickname),
+  buffer = silc_private_message_payload_encode(flags, strlen(conn->nickname),
                                               conn->nickname,
                                               data_len, data,
                                               client_entry->send_key);
                                               conn->nickname,
                                               data_len, data,
                                               client_entry->send_key);
@@ -172,7 +173,8 @@ void silc_client_private_message(SilcClient client,
   }
 
   /* Pass the private message to application */
   }
 
   /* Pass the private message to application */
-  client->ops->private_message(client, conn, remote_client, 
+  client->ops->private_message(client, conn, remote_client,
+                              silc_private_message_get_flags(payload),
                               silc_private_message_get_message(payload, 
                                                                NULL));
 
                               silc_private_message_get_message(payload, 
                                                                NULL));
 
@@ -185,6 +187,7 @@ void silc_client_private_message(SilcClient client,
 
     /* Send the away message */
     silc_client_send_private_message(client, conn, remote_client,
 
     /* Send the away message */
     silc_client_send_private_message(client, conn, remote_client,
+                                    SILC_MESSAGE_FLAG_AUTOREPLY,
                                     conn->away->away,
                                     strlen(conn->away->away), TRUE);
   }
                                     conn->away->away,
                                     strlen(conn->away->away), TRUE);
   }
index b9253518cd38cbd7886a6f40017b8fa612b43a8f..bdf210bb9c7aee8b9d7a3a51c51593ed1dcd184b 100644 (file)
@@ -94,12 +94,13 @@ typedef struct {
      The `channel' is the channel. */
   void (*channel_message)(SilcClient client, SilcClientConnection conn, 
                          SilcClientEntry sender, SilcChannelEntry channel, 
      The `channel' is the channel. */
   void (*channel_message)(SilcClient client, SilcClientConnection conn, 
                          SilcClientEntry sender, SilcChannelEntry channel, 
-                         char *msg);
+                         SilcMessageFlags flags, char *msg);
 
   /* Private message to the client. The `sender' is the sender of the
      message. */
   void (*private_message)(SilcClient client, SilcClientConnection conn,
 
   /* Private message to the client. The `sender' is the sender of the
      message. */
   void (*private_message)(SilcClient client, SilcClientConnection conn,
-                         SilcClientEntry sender, char *msg);
+                         SilcClientEntry sender, SilcMessageFlags flags,
+                         char *msg);
 
   /* Notify message to the client. The notify arguments are sent in the
      same order as servers sends them. The arguments are same as received
 
   /* Notify message to the client. The notify arguments are sent in the
      same order as servers sends them. The arguments are same as received
@@ -307,6 +308,7 @@ void silc_client_send_channel_message(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcChannelEntry channel,
                                      SilcChannelPrivateKey key,
                                      SilcClientConnection conn,
                                      SilcChannelEntry channel,
                                      SilcChannelPrivateKey key,
+                                     SilcMessageFlags flags,
                                      unsigned char *data, 
                                      unsigned int data_len, 
                                      int force_send);
                                      unsigned char *data, 
                                      unsigned int data_len, 
                                      int force_send);
@@ -321,6 +323,7 @@ void silc_client_send_channel_message(SilcClient client,
 void silc_client_send_private_message(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcClientEntry client_entry,
 void silc_client_send_private_message(SilcClient client,
                                      SilcClientConnection conn,
                                      SilcClientEntry client_entry,
+                                     SilcMessageFlags flags,
                                      unsigned char *data, 
                                      unsigned int data_len, 
                                      int force_send);
                                      unsigned char *data, 
                                      unsigned int data_len, 
                                      int force_send);
index 5d1dd7d9261359662ba18f8578898a1c1ad37455..d9c19deb5f93313d6c54bff2d3410322c3487895 100644 (file)
@@ -396,6 +396,14 @@ void silc_channel_message_payload_free(SilcChannelMessagePayload payload)
   silc_free(payload);
 }
 
   silc_free(payload);
 }
 
+/* Return flags */
+
+unsigned short 
+silc_channel_message_get_flags(SilcChannelMessagePayload payload)
+{
+  return payload->flags;
+}
+
 /* Return data */
 
 unsigned char *silc_channel_message_get_data(SilcChannelMessagePayload payload,
 /* Return data */
 
 unsigned char *silc_channel_message_get_data(SilcChannelMessagePayload payload,
index 2bd14d101c3f51327098eb46b51b39447d616b73..33422f82e2cb1c8c24847a7eb4e25e39e1e0e2ff 100644 (file)
@@ -78,6 +78,8 @@ SilcBuffer silc_channel_message_payload_encode(unsigned short flags,
                                               SilcCipher cipher,
                                               SilcHmac hmac);
 void silc_channel_message_payload_free(SilcChannelMessagePayload payload);
                                               SilcCipher cipher,
                                               SilcHmac hmac);
 void silc_channel_message_payload_free(SilcChannelMessagePayload payload);
+unsigned short 
+silc_channel_message_get_flags(SilcChannelMessagePayload payload);
 unsigned char *silc_channel_message_get_data(SilcChannelMessagePayload payload,
                                     unsigned int *data_len);
 unsigned char *silc_channel_message_get_mac(SilcChannelMessagePayload payload);
 unsigned char *silc_channel_message_get_data(SilcChannelMessagePayload payload,
                                     unsigned int *data_len);
 unsigned char *silc_channel_message_get_mac(SilcChannelMessagePayload payload);
index 45e81d8544408dcb0fc5f9b2bf7fd417997f3c6e..41d948e2daeddec433a9238ce9b3ab84cbd7bd42 100644 (file)
@@ -32,9 +32,9 @@
 /* Private Message Payload structure. Contents of this structure is parsed
    from SILC packets. */
 struct SilcPrivateMessagePayloadStruct {
 /* Private Message Payload structure. Contents of this structure is parsed
    from SILC packets. */
 struct SilcPrivateMessagePayloadStruct {
+  unsigned short flags;
   unsigned short nickname_len;
   unsigned char *nickname;
   unsigned short nickname_len;
   unsigned char *nickname;
-  unsigned short flags;
   unsigned short message_len;
   unsigned char *message;
 };
   unsigned short message_len;
   unsigned char *message;
 };
@@ -59,9 +59,9 @@ silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher)
 
   /* Parse the Private Message Payload. Ignore the padding. */
   ret = silc_buffer_unformat(buffer,
 
   /* Parse the Private Message Payload. Ignore the padding. */
   ret = silc_buffer_unformat(buffer,
+                            SILC_STR_UI_SHORT(&new->flags),
                             SILC_STR_UI16_NSTRING_ALLOC(&new->nickname, 
                                                         &new->nickname_len),
                             SILC_STR_UI16_NSTRING_ALLOC(&new->nickname, 
                                                         &new->nickname_len),
-                            SILC_STR_UI_SHORT(&new->flags),
                             SILC_STR_UI16_NSTRING_ALLOC(&new->message, 
                                                         &new->message_len),
                             SILC_STR_END);
                             SILC_STR_UI16_NSTRING_ALLOC(&new->message, 
                                                         &new->message_len),
                             SILC_STR_END);
@@ -86,9 +86,9 @@ silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher)
    the cipher is provided the packet is also encrypted here.  It is provided
    if the private message private keys are used. */
 
    the cipher is provided the packet is also encrypted here.  It is provided
    if the private message private keys are used. */
 
-SilcBuffer silc_private_message_payload_encode(unsigned int nickname_len,
+SilcBuffer silc_private_message_payload_encode(unsigned short flags,
+                                              unsigned int nickname_len,
                                               unsigned char *nickname,
                                               unsigned char *nickname,
-                                              unsigned short flags,
                                               unsigned short data_len,
                                               unsigned char *data,
                                               SilcCipher cipher)
                                               unsigned short data_len,
                                               unsigned char *data,
                                               SilcCipher cipher)
@@ -100,7 +100,7 @@ SilcBuffer silc_private_message_payload_encode(unsigned int nickname_len,
 
   SILC_LOG_DEBUG(("Encoding private message payload"));
 
 
   SILC_LOG_DEBUG(("Encoding private message payload"));
 
-  len = 2 + nickname_len + 4 + data_len;
+  len = 4 + nickname_len + 2 + data_len;
 
   if (cipher) {
     /* Calculate length of padding. */
 
   if (cipher) {
     /* Calculate length of padding. */
@@ -117,9 +117,9 @@ SilcBuffer silc_private_message_payload_encode(unsigned int nickname_len,
   /* Encode the Channel Message Payload */
   silc_buffer_pull_tail(buffer, SILC_BUFFER_END(buffer));
   silc_buffer_format(buffer, 
   /* Encode the Channel Message Payload */
   silc_buffer_pull_tail(buffer, SILC_BUFFER_END(buffer));
   silc_buffer_format(buffer, 
+                    SILC_STR_UI_SHORT(flags),
                     SILC_STR_UI_SHORT(nickname_len),
                     SILC_STR_UI_XNSTRING(nickname, nickname_len),
                     SILC_STR_UI_SHORT(nickname_len),
                     SILC_STR_UI_XNSTRING(nickname, nickname_len),
-                    SILC_STR_UI_SHORT(flags),
                     SILC_STR_UI_SHORT(data_len),
                     SILC_STR_UI_XNSTRING(data, data_len),
                     SILC_STR_UI_XNSTRING(pad, pad_len),
                     SILC_STR_UI_SHORT(data_len),
                     SILC_STR_UI_XNSTRING(data, data_len),
                     SILC_STR_UI_XNSTRING(pad, pad_len),
@@ -147,6 +147,14 @@ void silc_private_message_payload_free(SilcPrivateMessagePayload payload)
   silc_free(payload);
 }
 
   silc_free(payload);
 }
 
+/* Return flags */
+
+unsigned short 
+silc_private_message_get_flags(SilcPrivateMessagePayload payload)
+{
+  return payload->flags;
+}
+
 /* Return nickname */
 
 unsigned char *
 /* Return nickname */
 
 unsigned char *
@@ -170,11 +178,3 @@ silc_private_message_get_message(SilcPrivateMessagePayload payload,
 
   return payload->message;
 }
 
   return payload->message;
 }
-
-/* Return flags */
-
-unsigned short 
-silc_private_message_get_flags(SilcPrivateMessagePayload payload)
-{
-  return payload->flags;
-}
index 4cc2872f9b2c2aa8706dad51c69a32724d866cfa..dd8358c6df9fb9b6ef40f4632a5c1d7caaac4de0 100644 (file)
@@ -28,20 +28,20 @@ typedef struct SilcPrivateMessagePayloadStruct *SilcPrivateMessagePayload;
 
 SilcPrivateMessagePayload 
 silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher);
 
 SilcPrivateMessagePayload 
 silc_private_message_payload_parse(SilcBuffer buffer, SilcCipher cipher);
-SilcBuffer silc_private_message_payload_encode(unsigned int nickname_len,
+SilcBuffer silc_private_message_payload_encode(unsigned short flags,
+                                              unsigned int nickname_len,
                                               unsigned char *nickname,
                                               unsigned char *nickname,
-                                              unsigned short flags,
                                               unsigned short data_len,
                                               unsigned char *data,
                                               SilcCipher cipher);
 void silc_private_message_payload_free(SilcPrivateMessagePayload payload);
                                               unsigned short data_len,
                                               unsigned char *data,
                                               SilcCipher cipher);
 void silc_private_message_payload_free(SilcPrivateMessagePayload payload);
+unsigned short 
+silc_private_message_get_flags(SilcPrivateMessagePayload payload);
 unsigned char *
 silc_private_message_get_nickname(SilcPrivateMessagePayload payload,
                                  unsigned int *nickname_len);
 unsigned char *
 silc_private_message_get_message(SilcPrivateMessagePayload payload,
                                 unsigned int *message_len);
 unsigned char *
 silc_private_message_get_nickname(SilcPrivateMessagePayload payload,
                                  unsigned int *nickname_len);
 unsigned char *
 silc_private_message_get_message(SilcPrivateMessagePayload payload,
                                 unsigned int *message_len);
-unsigned short 
-silc_private_message_get_flags(SilcPrivateMessagePayload payload);
 
 #endif
 
 #endif