Added SILC Thread Queue API
[runtime.git] / doc / draft-riikonen-silc-pp-01.nroff
index 68283cb7e4eba210337e3ec855148b435128ec1c..da02ad4392341ae4e90dc9590774951e5f173c2b 100644 (file)
@@ -80,6 +80,7 @@ Table of Contents
       2.3.2 Generic payloads .................................... 16
             2.3.2.1 ID Payload .................................. 16
             2.3.2.2 Argument Payload ............................ 16
+            2.3.2.3 Channel Payload ............................. XXX
       2.3.3 Disconnect Payload .................................. 17
       2.3.4 Success Payload ..................................... 18
       2.3.5 Failure Payload ..................................... 18
@@ -97,6 +98,7 @@ Table of Contents
       2.3.17 New Client Payload ................................. 31
       2.3.18 New Server Payload ................................. 32
       2.3.19 New Channel Payload ................................ 33
+      2.3.20 Key Agreement Payload .............................. XXX
   2.4 SILC ID Types ............................................. 39
   2.5 Packet Encryption And Decryption .......................... 39
       2.5.1 Normal Packet Encryption And Decryption ............. 39
@@ -122,21 +124,23 @@ Figure 1:   Typical SILC Packet
 Figure 2:   SILC Packet Header
 Figure 3:   ID Payload
 Figure 4:   Argument Payload
-Figure 5:   Disconnect Payload
-Figure 6:   Success Payload
-Figure 7:   Failure Payload
-Figure 8:   Reject Payload
-Figure 9:   Notify Payload
-Figure 10:  Error Payload
-Figure 11:  Channel Message Payload
-Figure 12:  Channel Key Payload
-Figure 13:  Private Message Payload
-Figure 14:  Private Message Key Payload
-Figure 15:  Command Payload
-Figure 16:  Connection Auth Request Payload
-Figure 17:  New Client Payload
-Figure 18:  New Server Payload
-Figure 19:  New Channel Payload
+Figure 5:   Channel Payload
+Figure 6:   Disconnect Payload
+Figure 7:   Success Payload
+Figure 8:   Failure Payload
+Figure 9:   Reject Payload
+Figure 10:  Notify Payload
+Figure 11:  Error Payload
+Figure 12:  Channel Message Payload
+Figure 13:  Channel Key Payload
+Figure 14:  Private Message Payload
+Figure 15:  Private Message Key Payload
+Figure 16:  Command Payload
+Figure 17:  Connection Auth Request Payload
+Figure 18:  New Client Payload
+Figure 19:  New Server Payload
+Figure 20:  Key Agreement Payload
+Figure 21:  Cell Routers Payload
 
 
 .ti 0
@@ -599,7 +603,7 @@ List of SILC Packet types are defined as follows.
           This packet is used to request the authentication method to
           be used in the SILC Connection Authentication Protocol.  If 
           initiator of the protocol does not know the mandatory 
-          authentication method this packet is used to determine it.
+          authentication method this packet may be used to determine it.
 
           The party receiving this payload must respond with the same
           packet including the mandatory authentication method.
@@ -648,7 +652,7 @@ List of SILC Packet types are defined as follows.
           This packet must not be sent as list and the List flag must
          not be set.
 
-          Payload of the packet:  See section 2.3.19 New Client Payload
+          Payload of the packet:  See section 2.3.17 New Client Payload
 
 
      20   SILC_PACKET_NEW_SERVER
@@ -664,7 +668,7 @@ List of SILC Packet types are defined as follows.
           This packet must not be sent as list and the List flag must
          not be set.
 
-          Payload of the packet:  See section 2.3.20 New Server Payload
+          Payload of the packet:  See section 2.3.18 New Server Payload
 
 
      21   SILC_PACKET_NEW_CHANNEL
@@ -676,7 +680,7 @@ List of SILC Packet types are defined as follows.
           packet.  This packet maybe sent to entity that is indirectly
           connected to the sender.
 
-          Payload of the packet:  See section 2.3.21 New Channel Payload
+          Payload of the packet:  See section 2.3.19 New Channel Payload
 
 
      22   SILC_PACKET_REKEY
@@ -713,7 +717,32 @@ List of SILC Packet types are defined as follows.
          not be set.
 
 
-     25 - 199
+     25   SILC_PACKET_KEY_AGREEMENT
+
+          This packet is used by clients to request key negotiation 
+          between another client in the SILC network.  If the negotiation
+          is started it is performed using the SKE protocol.  The result of
+          the negotiation, the secret key material, can be used for
+          example as private message key.  The server and router must not
+          send this packet.
+
+          Payload of the packet:  See section 2.3.20 Key Agreement Payload
+
+
+    26    SILC_PACKET_CELL_ROUTERS
+
+          This packet is used by primary router in the cell to notify its
+          primary router what other routers (backup routers) exist in the
+          cell.  In case of failure of the primary router in the cell the
+          first router in the list will act as primary router of the cell.
+          This packet may be sent at anytime after connection has been
+          registered to the primary router.  The client must not send this
+          packet.
+
+          Payload of the packet:  See section 2.3.21 Cell Routers Payload
+
+
+     27 - 199
 
          Currently undefined commands.
 
@@ -807,6 +836,7 @@ the packet payload needing the arguments.  Incorrect amount of argument
 payloads must cause rejection of the packet.  The following diagram represents
 the Argument Payload.
 
+The following diagram represents the Argument Payload.
 
 .in 5
 .nf
@@ -842,6 +872,58 @@ o Argument Data (variable length) - Argument data.
 .in 3
 
 
+.ti 0
+2.3.2.3 Channel Payload
+
+Generic Channel Payload may be used information about channel, its name,
+the Channel ID and a mode.
+
+The following diagram represents the Channel Payload Payload.
+
+
+.in 5
+.nf
+                     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
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|      Channel Name Length      |                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
+|                                                               |
+~                         Channel Name                          ~
+|                                                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|       Channel ID Length       |                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
+|                                                               |
+~                          Channel ID                           ~
+|                                                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|                           Mode Mask                           |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+.in 3
+
+.ce
+Figure 5:  New Channel Payload
+
+
+.in 6
+o Channel Name Length (2 bytes) - Length of the channel name
+  field.
+
+o Channel Name (variable length) - The name of the channel.
+
+o Channel ID Length (2 bytes) - Length of the Channel ID field.
+
+o Channel ID (variable length) - The Channel ID.
+
+o Mode Mask (4 bytes) - A mode.  This can be the mode of the
+  channel but it can also be the mode of the client on the
+  channel.  The contents of this field is dependent of the
+  usage of this payload.  The usage is defined separately
+  when this payload is used.  This is a 32 bit MSB first value.
+.in 3
+
+
 .ti 0
 2.3.3 Disconnect Payload
 
@@ -870,7 +952,7 @@ the Disconnect Payload.
 .in 3
 
 .ce
-Figure 5:  Disconnect Payload
+Figure 6:  Disconnect Payload
 
 
 
@@ -900,7 +982,7 @@ This maybe any data, including binary or human readable data.
 .in 3
 
 .ce
-Figure 6:  Success Payload
+Figure 7:  Success Payload
 
 
 .in 6
@@ -932,7 +1014,7 @@ some protocol is sent in the payload.
 .in 3
 
 .ce
-Figure 7:  Failure Payload
+Figure 8:  Failure Payload
 
 
 .in 6
@@ -966,7 +1048,7 @@ may be binary or human readable data.
 .in 3
 
 .ce
-Figure 8:  Reject Payload
+Figure 9:  Reject Payload
 
 
 .in 6
@@ -1007,7 +1089,7 @@ Notify Payload.
 .in 3
 
 .ce
-Figure 9:  Notify Payload
+Figure 10:  Notify Payload
 
 
 .in 6
@@ -1041,14 +1123,28 @@ ID's sent in arguments are sent inside ID Payload.
 
 1     SILC_NOTIFY_TYPE_INVITE
 
-      Sent when receiver has been invited to a channel.  This type must be
-      sent directly to the invited client.
+      Sent when an client is invited to a channel.  This is also sent
+      when the invite list of the channel is changed.  This notify type
+      is sent between routers and if an client was invited to the 
+      client as well.  In this case the packet is destined to the client.
 
-      Max Arguments:  2
-          Arguments:  (1) <Client ID>  (2) <Channel ID>
+      Max Arguments:  5
+          Arguments:  (1) <Channel ID>          (2) <channel name>
+                      (3) [<sender Client ID>]  (4) [<adding client>]
+                      (5) [<removing client>]
+
+      The <Channel ID> is the channel.  The <channel name> is the name
+      of the channel and is provided because the client which receives 
+      this notify packet may not have a way to resolve the name of the
+      channel from the <Channel ID>.  The <sender Client ID> is the
+      Client ID who invited the client to the channel.  The <adding client>
+      and the <removing client> indicates the added or removed client
+      from the channel's invite list.  The format of the <adding client
+      and the <removing client> is defined in the [SILC1] with
+      SILC_COMMAND_INVITE command.
 
-      The <Client ID> is the client who invites the receiver of this type 
-      to channel indicated by <Channel ID>.
+      The <adding client> and <removing client> is never sent when the
+      packet is destined to a client.
 
 
 2     SILC_NOTIFY_TYPE_JOIN
@@ -1060,7 +1156,7 @@ ID's sent in arguments are sent inside ID Payload.
       broadcast it to the network.
 
       Max Arguments:  2
-          Arguments:  (1) <Client ID>  (2) <Channel ID>
+          Arguments:  (1) [<Client ID>]       (2) <Channel ID>
 
       The <Client ID> is the client that joined to the channel indicated
       by the <Channel ID>.
@@ -1128,11 +1224,17 @@ ID's sent in arguments are sent inside ID Payload.
       Sent when channel mode has changed.  This type must be sent only to
       the clients who is joined on the channel whose mode was changed.
 
-      Max Arguments:  2
-          Arguments:  (1) <Client ID>  (2) <mode mask>
+      Max Arguments:  4
+          Arguments:  (1) <ID Payload>  (2) <mode mask>
+                      (3) [<cipher>]   (4) <[hmac>]     
 
-      The <Client ID> is the client who changed the mode.  The <mode mask>
-      is the new mode mask of the channel.
+      The <ID Payload> is the ID (usually Client ID but it can be Server ID
+      as well when the router is enforcing channel mode change) of the
+      entity which changed the mode.  The <mode mask> is the new mode mask
+      of the channel.  The client can safely ignore the <cipher> argument
+      since the SILC_PACKET_CHANNEL_KEY packet will force the new channel
+      key change anyway.  The <hmac> argument is important since the client
+      is responsible of setting the new HMAC and the hmac key into use.
 
 
 8     SILC_NOTIFY_TYPE_CUMODE_CHANGE
@@ -1163,9 +1265,10 @@ ID's sent in arguments are sent inside ID Payload.
 10    SILC_NOTIFY_TYPE_CHANNEL_CHANGE
 
       Sent when channel's ID has changed for a reason or another.  This 
-      is sent by noral server to the client.  Client must change the 
-      old Channel ID to the new one.  This type must be sent only to the
-      clients who is joined on the channel.
+      is sent by normal server to the client.  This can also be sent by
+      router to other server to force the Channel ID change.  The Channel
+      ID must be changed to use the new one.  When sent to clients, this
+      type must be sent only to the clients who is joined on the channel.
 
       Max Arguments:  2
           Arguments:  (1) <Old Channel ID>  (2) <New Channel ID>
@@ -1201,6 +1304,53 @@ ID's sent in arguments are sent inside ID Payload.
       The kicker may have set the <comment> to indicate the reason for
       the kicking.
 
+
+13    SILC_NOTIFY_TYPE_KILLED
+
+      Sent when a client has been killed from the network.  This is sent 
+      also to the client who was killed from the network.  The client
+      who was killed from the network must be removed from the network.
+      This notify type is destined directly to the client who was killed
+      and to channel if the client is on any channel.  The router or
+      server receiving the packet distributes this type to the local
+      clients on the channel and broadcast it to the network.
+
+      Max Arguments:  2
+          Arguments:  (1) <Client ID>  (2) [<comment>]
+
+      The <Client ID> is the client who was killed from the network.
+      The killer may have set the <comment> to indicate the reason for
+      the killing.
+
+
+14    SILC_NOTIFY_TYPE_UMODE_CHANGE
+
+      Sent when user's mode in the SILC changes.  This type is sent only
+      between routers as broadcast packet.
+
+      Max Arguments:  2
+          Arguments:  (1) <Client ID>  (2) <mode mask>
+
+      The <Client ID> is the client which mode was changed.  The <mode mask>
+      is the new mode mask.
+
+
+15    SILC_NOTIFY_TYPE_BAN
+
+      Sent when the ban list of the channel is changed.  This type is sent
+      only between routers as broadcast packet.
+
+      Max Arguments:  3
+          Arguments:  (1) <Channel ID>         (2) [<adding client>]
+                      (3) [<removing client>]
+
+      The <Channel ID> is the channel which ban list was changed.  The
+      <adding client> is used to indicate the a ban was added and the
+      <removing client> is used to indicate that a ban was removed from
+      the ban list.  The format of the <adding client> and the 
+      <removing client> is defined in the [SILC1] with SILC_COMMAND_BAN
+      command.
+
 .in 3
 
 Notify types starting from 16384 are reserved for private notify
@@ -1230,7 +1380,7 @@ that the client takes error packet seriously.
 .in 3
 
 .ce
-Figure 10:  Error Payload
+Figure 11:  Error Payload
 
 
 .in 6
@@ -1282,8 +1432,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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-|         Message Length        |                               |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
+|            Flags              |         Message Length        |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 ~                         Message Data                          ~
 |                                                               |
@@ -1295,16 +1445,63 @@ represents the Channel Message Payload.
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
+~                              MAC                              ~
+|                                                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|                                                               |
 ~                       Initial Vector *                        ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .in 3
 
 .ce
-Figure 11:  Channel Message Payload
+Figure 12:  Channel Message Payload
 
 
 .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  SILC_MESSAGE_FLAG_NOTICE
+
+          The message is for example and informational notice
+          type message.
+
+  0x0010  SILC_MESSAGE_FLAG_REQUEST
+
+          This is a generic request flag to send request
+          messages.
+
+  0x0020 - 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.
@@ -1320,6 +1517,16 @@ o Padding (variable length) - The padding that must be
   applied because this payload is encrypted separately from
   other parts of the packet.
 
+o MAC (variable legnth) - The MAC computed from the
+  Message Length, Message Data, Padding Length and Padding
+  fields.  This protects the integrity of the plaintext
+  channel message.  The receiver can verify from the MAC
+  whether the message decrypted correctly.  Also, if more than
+  one private key has been set for the channel, the receiver
+  can verify which of the keys decrypted the message 
+  correctly.  Note that, this field is encrypted and must
+  be added to the padding calculation.
+
 o Initial Vector (variable length) - The initial vector
   that has been used in packet encryption.  It needs to be
   used in the packet decryption as well.  What this field
@@ -1401,7 +1608,7 @@ represents the Channel Key Payload.
 .in 3
 
 .ce
-Figure 12:  Channel Key Payload
+Figure 13:  Channel Key Payload
 
 
 
@@ -1466,23 +1673,36 @@ 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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-|        Nickname Length        |                               |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
+|            Flags              |        Nickname Length        |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 ~                            Nickname                           ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|      Message Data Length      |                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
 |                                                               |
 ~                          Message Data                         ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|                                                               |
+~                             Padding                           ~
+|                                                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .in 3
 
 .ce
-Figure 13:  Private Message Payload
+Figure 14:  Private Message Payload
 
 
 .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.
 
@@ -1494,9 +1714,19 @@ 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.
 
+o Message Data Length (2 bytes) - Indicates the length of the
+  Message Data field, not includes any other field.
+
 o Message Data (variable length) - The actual message to
   the client.  Rest of the packet is reserved for the message
   data.
+
+o Padding (variable length) - This field is present only
+  when the private message payload is encrypted with private
+  message key.  In this case the padding is applied to make
+  the packet multiple by eight (8), or by the block size of
+  the cipher, which ever is larger.  When encrypted with
+  normal session keys, this field must not be included.
 .in 3
 
 
@@ -1530,10 +1760,16 @@ diagram represents the Private Message Key Payload.
 ~                      Private Message Key                      ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|      Cipher Name Length       |                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
+|                                                               |
+~                          Cipher Name                          ~
+|                                                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .in 3
 
 .ce
-Figure 14:  Private Message Key Payload
+Figure 15:  Private Message Key Payload
 
 
 
@@ -1544,11 +1780,20 @@ o Private Message Key Length (2 bytes) - Indicates the length
   any other field.
 
 o Private Message Key (variable length) - The actual private
-  message key material.  This key is used as such as key material 
-  for encryption function.
+  message key material.
+
+o Cipher Name Length (2 bytes) - Indicates the length of the
+  Cipher Name field in the payload, not including any other
+  field.
+
+o Cipher Name (variable length) - Name of the cipher to use
+  in the private message encryption.  If this field does not
+  exist then the default cipher of the SILC protocol is used.
+  See the [SILC1] for defined ciphers.
 .in 3
 
 
+
 .ti 0
 2.3.13 Command Payload
 
@@ -1569,7 +1814,7 @@ represents the Command Payload.
 .in 3
 
 .ce
-Figure 15:  Command Payload
+Figure 16:  Command Payload
 
 
 .in 6
@@ -1651,7 +1896,7 @@ diagram represents the Connection Auth Request Payload.
 .in 3
 
 .ce
-Figure 16:  Connection Auth Request Payload
+Figure 17:  Connection Auth Request Payload
 
 
 .in 6
@@ -1725,7 +1970,7 @@ The packet uses generic ID Payload as New ID Payload.  See section
 
 
 .ti 0
-2.3.18 New Client Payload
+2.3.17 New Client Payload
 
 When client is connected to the server, keys has been exchanged and
 connection has been authenticated client must register itself to the 
@@ -1744,8 +1989,8 @@ set the real nickname of the user which is then used to create new
 client ID.
 
 The payload may only be sent with SILC_PACKET_NEW_CLIENT packet.  It
-must not be sent in any other packet type.  The following diagram represents
-the New Client Payload.
+must not be sent in any other packet type.  The following diagram
+represents the New Client Payload.
 
 
 
@@ -1769,7 +2014,7 @@ the New Client Payload.
 .in 3
 
 .ce
-Figure 17:  New Client Payload
+Figure 18:  New Client Payload
 
 
 .in 6
@@ -1786,7 +2031,7 @@ o Real Name (variable length) - The real name of the user
 
 
 .ti 0
-2.3.19 New Server Payload
+2.3.18 New Server Payload
 
 This payload is sent by server when it has completed successfully both
 key exchange and connection authentication protocols.  The server
@@ -1824,7 +2069,7 @@ the New Server Payload.
 .in 3
 
 .ce
-Figure 18:  New Server Payload
+Figure 19:  New Server Payload
 
 
 .in 6
@@ -1841,7 +2086,7 @@ o Server Name (variable length) - The server name.
 
 
 .ti 0
-2.3.20 New Channel Payload
+2.3.19 New Channel Payload
 
 Information about newly created channel is broadcasted to all routers
 in the SILC network by sending this packet payload.  Channels are
@@ -1852,46 +2097,136 @@ to the router (after it has received JOIN command from client) which
 then processes the command and creates the channel.  Client never sends
 this packet.
 
-The payload may only be sent with SILC_PACKET_NEW_CHANNEL packet.
+The packet uses generic Channel Payload as New Channel Payload.  See
+section 2.3.2.3 for generic Channel Payload.  The Mode Mask field in the
+Channel Payload is the mode of the channel.
+
+
+.ti 0
+2.3.20 Key Agreement Payload
+
+This payload is used by clients to request key negotiation between
+another client in the SILC Network.  The key agreement protocol used
+is the SKE protocol.  The result of the protocol, the secret key
+material, can be used for example as private message key between the
+two clients.  This significantly adds security as the key agreement
+is performed outside the SILC network.  The server and router must not
+send this payload.
+
+The sender may tell the receiver of this payload the hostname and the
+port where the SKE protocol is running in the sender's end.  The 
+receiver may then initiate the SKE negotiation with the sender.  The
+sender may also optionally not to include the hostname and the port
+of its SKE protocol.  In this case the receiver may reply to the
+request by sending the same payload filled with the receiver's hostname
+and the port where the SKE protocol is running.  The sender may then
+initiate the SKE negotiation with the receiver.
+
+The payload may only be sent with SILC_PACKET_KEY_AGREEMENT packet.
 It must not be sent in any other packet type.  The following diagram
-represents the New Channel Payload.
+represents the Key Agreement Payload.
+
+
+.in 5
+.nf
+                     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
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|        Hostname Length        |                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
+|                                                               |
+~                           Hostname                            ~
+|                                                               |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|                             Port                              |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+.in 3
+
+.ce
+Figure 20:  Key Agreement Payload
+
 
+.in 6
+o Hostname Length (2 bytes) - Indicates the length of the Hostname
+  field.
+
+o Hostname (variable length) - The hostname or IP address where
+  the SKE protocol is running.  The sender may fill this field
+  when sending the payload.  If the receiver sends this payload
+  as reply to the request it must fill this field.
+
+o Port (4 bytes) - The port where the SKE protocol is bound.
+  The sender may fill this field when sending the payload.  If
+  the receiver sends this payload as reply to the request it 
+  must fill this field.  This is a 32 bit MSB first order value.
+.in 3
+
+
+After the key material has been received from the SKE protocol it is
+processed as the [SILC3] describes.  If the key material is used as
+channel private key then the Sending Encryption Key, as defined in
+[SILC3] is used as the channel private key.  Other key material must
+be discarded.  The [SILC1] defines the way to use the key material if
+it is intended to be used as private message keys.  Any other use for
+the key material is undefined.
+
+
+.ti 0
+2.3.21 Cell Routers Payload
 
+Cell Routers payload is used by router to notify its primary router what
+other routers exist in the cell.  The other routers are considered to be
+backup routers and one of them will come active only in the case of
+failure of the primary router.  Normal server can send this packet if it
+is acting as backup router.  Client must not send this packet.  To send
+more than one backup router set the List flag and assemble the payloads
+as list.
 
+The payload may only be sent with SILC_PACKET_CELL_ROUTERS packet.  It
+must not be sent in any other packet type.  The Following diagram
+represents the Cell Routers Payload.
 
+         
 .in 5
 .nf
                      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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-|      Channel Name Length      |                               |
+|        Hostname Length        |                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
 |                                                               |
-~                         Channel Name                          ~
+~                           Hostname                            ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-|       Channel ID Length       |                               |
+|                             Port                              |
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+|        Server ID Length       |                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
 |                                                               |
-~                          Channel ID                           ~
+~                           Server ID                           ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .in 3
 
 .ce
-Figure 19:  New Channel Payload
-
+Figure 21:  Cell Routers Payload
 
 
 .in 6
-o Channel Name Length (2 bytes) - Length of the channel name.
+o Hostname Length (2 bytes) - Indicates the length of the Hostname
+  field.
 
-o Channel Name (variable length) - The name of the created
-  channel.
+o Hostname (variable length) - The hostname or IP address of
+  the backup router.
 
-o Channel ID Length (2 bytes) - Length of the Channel ID.
+o Port (4 bytes) - The port of the backup router it currently uses.
+  This is a 32 bit MSB first order value.
 
-o Channel ID (variable length) - The created Channel ID.
+o Server ID Length (2 bytes) - Indicates the length of the Server
+  ID field.
+
+o Server ID (variable length) - Consists of the Server ID of the
+  backup router.
 .in 3
 
 
@@ -1984,7 +2319,7 @@ As the receiver founds the packet to be channel message, rest of the
 packet processing is special.  Rest of the SILC Packet header is
 decrypted with the same session key along with the padding of the
 packet.  After that the packet is protected with the channel specific
-key and hence can be decrypted only if the receiver is the client on
+key and thus can be decrypted only if the receiver is the client on
 the channel.  See section 2.7 Packet Padding Generation for more
 information about padding on special packets.
 
@@ -2011,6 +2346,12 @@ their own channel keys thus the channel message traveling from one
 cell to another must be protected as it would be any normal SILC
 packet.
 
+If the SILC_CMODE_PRIVKEY channel mode has been set for the channel
+then the router cannot decrypt the packet as it does not know the
+private key.  In this case the entire packet is encrypted with the
+session key and sent to the router.  The router receiving the packet
+must check the channel mode and decrypt the packet accordingly.
+
 
 .ti 0
 2.5.3 Private Message Encryption And Decryption