Move silc_client_packet_send back to internal, added
authorPekka Riikonen <priikone@silcnet.org>
Thu, 7 Nov 2002 09:05:18 +0000 (09:05 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Thu, 7 Nov 2002 09:05:18 +0000 (09:05 +0000)
silc_client_send_packet, a bit simpler function for application.

apps/irssi/src/silc/core/silc-servers.c
lib/silcclient/client.c
lib/silcclient/client_internal.h
lib/silcclient/silcclient.h

index f6e0403af4169d9ff6b26f5a3784b4ae30939e28..198926c11e240cd01732323ee1af22fc32bf733b 100644 (file)
@@ -266,8 +266,8 @@ void silc_send_heartbeat(SilcSocketConnection sock,
   if (server == NULL)
     return;
 
-  silc_client_packet_send(silc_client, sock, SILC_PACKET_HEARTBEAT,
-                         NULL, 0, NULL, NULL, NULL, 0, FALSE);
+  silc_client_send_packet(silc_client, server->conn, SILC_PACKET_HEARTBEAT,
+                         NULL, 0);
 }
 
 static void sig_connected(SILC_SERVER_REC *server)
index aa729e6fbccbc085245d9087060b3b9585261513..62dba28ceeeada8d0339efe853e77fd1c556556a 100644 (file)
@@ -1455,6 +1455,25 @@ void silc_client_packet_send(SilcClient client,
   silc_client_packet_send_real(client, sock, force_send);
 }
 
+/* Packet sending routine for application.  This is the only routine that
+   is provided for application to send SILC packets. */
+
+bool silc_client_send_packet(SilcClient client,
+                            SilcClientConnection conn,
+                            SilcPacketType type,
+                            const unsigned char *data,
+                            SilcUInt32 data_len)
+{
+
+  assert(client);
+  if (!conn)
+    return FALSE;
+
+  silc_client_packet_send(client, conn->sock, type, NULL, 0, NULL, NULL,
+                         (unsigned char *)data, data_len, TRUE);
+  return TRUE;
+}
+
 void silc_client_packet_queue_purge(SilcClient client,
                                    SilcSocketConnection sock)
 {
index d3de6db397fbbc631a1b68b836b321860f6a50d1..195f5cdf0ec2c47249903c4d9fb03ff96a59d10d 100644 (file)
@@ -208,6 +208,16 @@ do {                                                               \
 /* Prototypes */
 
 SILC_TASK_CALLBACK_GLOBAL(silc_client_packet_process);
+void silc_client_packet_send(SilcClient client,
+                             SilcSocketConnection sock,
+                             SilcPacketType type,
+                             void *dst_id,
+                             SilcIdType dst_id_type,
+                             SilcCipher cipher,
+                             SilcHmac hmac,
+                             unsigned char *data,
+                             SilcUInt32 data_len,
+                             bool force_send);
 int silc_client_packet_send_real(SilcClient client,
                                 SilcSocketConnection sock,
                                 bool force_send);
index 8a7bd07d4622fdcfe41f2fbe79546b6abe3e9507..f2b9760ea577b734673253a285ce94ea83423a76 100644 (file)
@@ -2378,42 +2378,31 @@ SilcBuffer silc_client_attributes_request(SilcAttribute attribute, ...);
 
 /* Low level packet sending functions */
 
-/****f* silcclient/SilcClientAPI/silc_client_packet_send
+/****f* silcclient/SilcClientAPI/silc_client_send_packet
  *
  * SYNOPSIS
  *
- *    void silc_client_packet_send(SilcClient client, 
- *                                 SilcSocketConnection sock,
- *                                 SilcPacketType type, 
- *                                 void *dst_id,
- *                                 SilcIdType dst_id_type,
- *                                 SilcCipher cipher,
- *                                 SilcHmac hmac,
- *                                 unsigned char *data, 
- *                                 SilcUInt32 data_len, 
- *                                 bool force_send);
+ *     bool silc_client_send_packet(SilcClient client, 
+ *                                  SilcClientConnection conn,
+ *                                  SilcPacketType type, 
+ *                                  const unsigned char *data, 
+ *                                  SilcUInt32 data_len);
  *
  * DESCRIPTION
  *
- *    Constructs a Requested Attributes buffer. If the `attribute' is zero (0)
- *    then all attributes are requested.  Alternatively, `attribute' and
- *    all variable arguments can each be requested attribute.  In this case
- *    the last must be set to zero (0) to complete the variable list of
- *    requested attributes.  See SilcAttribute for all attributes.
- *    You can give the returned buffer as argument to for example
- *    silc_client_get_client_by_id_resolve function.
+ *    This routine can be used by application to send packets directly
+ *    to a connection indicated by `conn'.  Usually application does not
+ *    need this routine since the Client Library handles the packet
+ *    sending.  The `type' indicates the packet type.  If `data' is
+ *    NULL then empty packet is sent.  This returns FALSE if packet cannot 
+ *    be sent.
  *
  ***/
-void silc_client_packet_send(SilcClient client, 
-                            SilcSocketConnection sock,
+bool silc_client_send_packet(SilcClient client, 
+                            SilcClientConnection conn,
                             SilcPacketType type, 
-                            void *dst_id,
-                            SilcIdType dst_id_type,
-                            SilcCipher cipher,
-                            SilcHmac hmac,
-                            unsigned char *data, 
-                            SilcUInt32 data_len, 
-                            bool force_send);
+                            const unsigned char *data, 
+                            SilcUInt32 data_len);
 
 #include "command.h"
 #include "command_reply.h"