updates
[silc.git] / apps / silcd / packet_send.c
index 5e478577eb88fb9304b922b768116aef920d1dee..41d5c22cf193cb251d0237041180ef2477212032 100644 (file)
@@ -587,8 +587,8 @@ void silc_server_packet_relay_to_channel(SilcServer server,
       sock = (SilcSocketConnection)client->connection;
       idata = (SilcIDListData)client;
 
-      SILC_LOG_DEBUG(("Sending packet to client %s", 
-                     sock->hostname ? sock->hostname : sock->ip));
+      SILC_LOG_DEBUG(("Sending packet to client %s (%s)", 
+                     sock->hostname, sock->ip));
 
       /* Send the packet */
       silc_server_packet_send_to_channel_real(server, sock, &packetdata,
@@ -1127,21 +1127,21 @@ void silc_server_send_channel_key(SilcServer server,
   SilcBuffer packet;
   unsigned char *chid;
   unsigned int tmp_len;
-
   SILC_LOG_DEBUG(("Start"));
-
   chid = silc_id_id2str(channel->id, SILC_ID_CHANNEL);
   if (!chid)
     return;
-
   /* Encode channel key packet */
   tmp_len = strlen(channel->channel_key->cipher->name);
   packet = silc_channel_key_payload_encode(SILC_ID_CHANNEL_LEN, chid, tmp_len,
-                                          channel->channel_key->cipher->name,
-                                          channel->key_len / 8, channel->key);
-
+                                           channel->channel_key->cipher->name,
+                                           channel->key_len / 8, channel->key);
   silc_server_packet_send_to_channel(server, channel, SILC_PACKET_CHANNEL_KEY,
-                                    route, packet->data, packet->len, FALSE);
+                                     route, packet->data, packet->len, FALSE);
   silc_buffer_free(packet);
   silc_free(chid);
 }
@@ -1164,3 +1164,25 @@ void silc_server_send_command(SilcServer server,
                          packet->data, packet->len, TRUE);
   silc_buffer_free(packet);
 }
+
+/* Function used to send REMOVE_ID packet. The packet is used to notify
+   routers that certain ID should be removed. After that the ID will become
+   invalid.  If the argument `broadcast' is TRUE then the packet is sent as
+   broadcast packet. */
+
+void silc_server_send_remove_id(SilcServer server,
+                               SilcSocketConnection sock,
+                               int broadcast,
+                               void *id, unsigned int id_len,
+                               SilcIdType id_type)
+{
+  SilcBuffer idp;
+
+  SILC_LOG_DEBUG(("Start"));
+
+  idp = silc_id_payload_encode(id, id_type);
+  silc_server_packet_send(server, sock, SILC_PACKET_REMOVE_ID, 
+                         broadcast ? SILC_PACKET_FLAG_BROADCAST : 0, 
+                         idp->data, idp->len, FALSE);
+  silc_buffer_free(idp);
+}