f2bc667ccff0b7d1acf678de235fac05415489c1
[silc.git] / lib / silcclient / silcclient.h
1 /*
2
3   silcclient.h 
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2000 - 2002 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19
20 /****h* silcclient/Client Library Interface
21  *
22  * DESCRIPTION
23  *
24  * This interface defines the SILC Client Library API for the application.
25  * The client operations are defined first.  These are callback functions that
26  * the application MUST implement since the library may call the functions
27  * at any time.  At the end of file is the API for the application that
28  * it can use from the library.  This is the only file that the application
29  * may include from the SIlC Client Library.
30  *
31  * o SILC Client Operations
32  *
33  *   These functions must be implemented by the application calling the SILC
34  *   client library. The client library can call these functions at any time.
35  *
36  *   To use this structure: define a static SilcClientOperations variable,
37  *   fill it and pass its pointer to silc_client_alloc function.
38  *
39  * o SILC Client Library API
40  *
41  *   This is the API that is published by the SILC Client Library for the
42  *   applications.  These functions are implemented in the SILC Client Library.
43  *   Application may freely call these functions from the library.
44  *
45  * Please, refer to the README file in this directory for the directions
46  * of how to use the SILC Client Library.
47  *
48  ***/
49
50 #ifndef SILCCLIENT_H
51 #define SILCCLIENT_H
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 #include "client.h"
58
59 /* General definitions */
60
61 /****s* silcclient/SilcClientAPI/SilcClient
62  *
63  * NAME
64  *
65  *    typedef struct SilcClientStruct { ... } *SilcClient
66  *
67  * DESCRIPTION
68  *
69  *    This is the actual SILC Client structure which represents one
70  *    SILC Client.  It is allocated with the silc_client_alloc function
71  *    and given as argument to all SILC Client Library functions.  It
72  *    is initialized with silc_client_init function, and freed with
73  *    silc_client_free function.
74  *
75  * SOURCE
76  */
77 struct SilcClientStruct {
78   /*
79    * The following fields are set by application
80    */
81   char *nickname;               /* Nickname, MAY be set by application  */
82   char *username;               /* Username, MUST be set by application */
83   char *hostname;               /* hostname, MUST be set by application */
84   char *realname;               /* Real name, MUST be set be application */
85   
86   SilcPublicKey public_key;     /* Public key of user, set by application */
87   SilcPrivateKey private_key;   /* Private key of user, set by application */
88   SilcPKCS pkcs;                /* PKCS allocated by application */
89
90   /*
91    * The following fields are set by the library
92    */
93
94   /* Scheduler, set by library.  Application may use this pointer. */
95   SilcSchedule schedule;
96   
97   /* Random Number Generator. Application should use this as its primary
98      random number generator. */
99   SilcRng rng;
100   
101   /* Application specific user data pointer. Client library does not
102      touch this.  This the context sent as argument to silc_client_alloc.
103      Application can use it freely. */
104   void *application;
105      
106   /* Generic hash context for application usage */
107   SilcHash md5hash;
108   SilcHash sha1hash;
109
110   /* Internal data for client library. Application cannot access this
111      data at all. */
112   SilcClientInternal internal;
113 };  
114 /***/
115
116 /****s* silcclient/SilcClientAPI/SilcClientConnection
117  *
118  * NAME
119  *
120  *    typedef struct SilcClientConnectionStruct { ... }
121  *                      *SilcClientConnection
122  *
123  * DESCRIPTION
124  *
125  *    This structure represents a connection.  When connection is created
126  *    to server this is context is returned to the application in the
127  *    "connected" client operation.  It includes all the important
128  *    data for the session, such as nickname, local and remote IDs, and
129  *    other information.
130  *
131  * SOURCE
132  */
133 struct SilcClientConnectionStruct {
134   /*
135    * Local data
136    */
137   char *nickname;                 /* Current nickname */
138   SilcClientEntry local_entry;    /* Own Client Entry */
139   SilcClientID *local_id;         /* Current Client ID */
140   unsigned char *local_id_data;   /* Current Client ID decoded */
141   SilcUInt32 local_id_data_len;
142
143   /*
144    * Remote data
145    */
146   char *remote_host;              /* Remote host name */
147   int remote_port;                /* Remote port */
148   SilcServerID *remote_id;        /* Remote Server ID */
149   unsigned char *remote_id_data;  /* Remote Server ID decoded */
150   SilcUInt32 remote_id_data_len;
151
152   /*
153    * Common data
154    */
155
156   /* Current command identifier for a command that was sent last.
157      Application may get the value from this variable to find out the
158      command identifier for last command. */
159   SilcUInt16 cmd_ident;
160
161   /* User data context. Library does not touch this. Application may
162      freely set and use this pointer for its needs. */
163   void *context;
164
165   /* Pointer back to the SilcClient.  Application may use this. */
166   SilcClient client;
167
168   /* Current channel.  Application may use and set this pointer if needed. */
169   SilcChannelEntry current_channel;
170
171   /* Socket connection object for this connection.  Application may
172      use this if needed.  The sock->user_data is back pointer to this
173      structure. */
174   SilcSocketConnection sock;
175
176   /* Internal data for client library. Application cannot access this
177      data at all. */
178   SilcClientConnectionInternal internal;
179 };
180 /***/
181
182 /****s* silcclient/SilcClientAPI/SilcClientEntry
183  *
184  * NAME
185  *
186  *    typedef struct SilcClientEntryStruct { ... } *SilcClientEntry
187  *
188  * DESCRIPTION
189  *
190  *    This structure represents a client or a user in the SILC network.
191  *    The local user has this structure also and it can be accessed from
192  *    SilcClientConnection structure.  All other users in the SILC network
193  *    that are accessed using the Client Library routines will have their
194  *    own SilcClientEntry structure.  For example, when finding users by
195  *    their nickname the Client Library returns this structure back to
196  *    the application.
197  *
198  * SOURCE
199  */
200 struct SilcClientEntryStruct {
201   /* General information */
202   char *nickname;               /* nickname */
203   char *username;               /* username */
204   char *hostname;               /* hostname */
205   char *server;                 /* SILC server name */
206   char *realname;               /* Realname (userinfo) */
207
208   /* Mode, ID and other information */
209   SilcUInt32 mode;              /* User mode in SILC */
210   SilcClientID *id;             /* The Client ID */
211   SilcDList attrs;              /* Requested Attributes (maybe NULL) */
212   unsigned char *fingerprint;   /* Fingerprint of client's public key */
213   SilcUInt32 fingerprint_len;   /* Length of the fingerprint */
214
215   /* Private message keys */
216   SilcCipher send_key;          /* Private message key for sending */
217   SilcCipher receive_key;       /* Private message key for receiving */
218   SilcHmac hmac_send;           /* Private mesage key HMAC for sending */
219   SilcHmac hmac_receive;        /* Private mesage key HMAC for receiving */
220   unsigned char *key;           /* Set only if application provided the
221                                    key material. NULL if the library 
222                                    generated the key. */
223   SilcUInt32 key_len;           /* Key length */
224   SilcClientKeyAgreement ke;    /* Current key agreement context or NULL */
225
226   /* SilcClientEntry status information */
227   SilcEntryStatus status;       /* Status mask */
228   SilcHashTable channels;       /* All channels client has joined */
229   SilcUInt16 resolve_cmd_ident; /* Command identifier when resolving */
230   bool generated;               /* TRUE if library generated `key' */
231   bool valid;                   /* FALSE if this entry is not valid */
232 };
233 /***/
234
235 /****s* silcclient/SilcClientAPI/SilcChannelEntry
236  *
237  * NAME
238  *
239  *    typedef struct SilcChannelEntryStruct { ... } *SilcChannelEntry
240  *
241  * DESCRIPTION
242  *
243  *    This structure represents a channel in the SILC network.  All
244  *    channels that the client are aware of or have joined in will be
245  *    represented as SilcChannelEntry.  The structure includes information
246  *    about the channel.
247  *
248  * SOURCE
249  */
250 struct SilcChannelEntryStruct {
251   /* General information */
252   char *channel_name;                        /* Channel name */
253   SilcChannelID *id;                         /* Channel ID */
254   SilcUInt32 mode;                           /* Channel mode */
255
256   /* All clients that has joined this channel */
257   SilcHashTable user_list;
258
259   /* Channel keys */
260   SilcCipher channel_key;                    /* The channel key */
261   unsigned char *key;                        /* Raw key data */
262   SilcUInt32 key_len;                        /* Raw key data length */
263   unsigned char iv[SILC_CIPHER_MAX_IV_SIZE]; /* Current IV */
264   SilcHmac hmac;                             /* Current HMAC */
265
266   /* Channel private keys */
267   SilcDList private_keys;                    /* List of private keys or NULL */
268   SilcChannelPrivateKey curr_key;            /* Current private key */
269
270   /* SilcChannelEntry status information */
271   SilcCipher old_channel_key;
272   SilcHmac old_hmac;
273   SilcTask rekey_task;
274   SilcUInt16 resolve_cmd_ident;              /* Command identifier when
275                                                 resolving this entry */
276 };
277 /***/
278
279 /****s* silcclient/SilcClientAPI/SilcServerEntry
280  *
281  * NAME
282  *
283  *    typedef struct SilcServerEntryStruct { ... } *SilcServerEntry
284  *
285  * DESCRIPTION
286  *
287  *    This structure represents a server in the SILC network.  All servers
288  *    that the client is aware of and have for example resolved with
289  *    SILC_COMMAND_INFO command have their on SilcServerEntry structure.
290  *
291  * SOURCE
292  */
293 struct SilcServerEntryStruct {
294   /* General information */
295   char *server_name;                         /* Server name */
296   char *server_info;                         /* Server info */
297   SilcServerID *server_id;                   /* Server ID */
298   SilcUInt16 resolve_cmd_ident;              /* Command identifier when
299                                                 resolving this entry */
300 };
301 /***/
302
303 /****d* silcclient/SilcClientAPI/SilcKeyAgreementStatus
304  *
305  * NAME
306  *
307  *    typedef enum { ... } SilcKeyAgreementStatus;
308  *
309  * DESCRIPTION
310  *
311  *    Key agreement status types indicating the status of the key
312  *    agreement protocol.  These types are returned to the application 
313  *    in the SilcKeyAgreementCallback callback function.
314  *
315  * SOURCE
316  */
317 typedef enum {
318   SILC_KEY_AGREEMENT_OK,               /* Everything is Ok */
319   SILC_KEY_AGREEMENT_ERROR,            /* Unknown error occurred */
320   SILC_KEY_AGREEMENT_FAILURE,          /* The protocol failed */
321   SILC_KEY_AGREEMENT_TIMEOUT,          /* The protocol timeout */
322   SILC_KEY_AGREEMENT_ABORTED,          /* The protocol aborted */
323   SILC_KEY_AGREEMENT_ALREADY_STARTED,  /* Already started */
324   SILC_KEY_AGREEMENT_SELF_DENIED,      /* Negotiationg with itself denied */
325 } SilcKeyAgreementStatus;
326 /***/
327
328 /****f* silcclient/SilcClientAPI/SilcKeyAgreementCallback
329  *
330  * SYNOPSIS
331  *
332  *    typedef void (*SilcKeyAgreementCallback)(SilcClient client,
333  *                                             SilcClientConnection conn,
334  *                                             SilcClientEntry client_entry,
335  *                                             SilcKeyAgreementStatus status,
336  *                                             SilcSKEKeyMaterial *key,
337  *                                             void *context);
338  *
339  * DESCRIPTION
340  *
341  *    Key agreement callback that is called after the key agreement protocol
342  *    has been performed. This is called also if error occurred during the
343  *    key agreement protocol. The `key' is the allocated key material and
344  *    the caller is responsible of freeing it. The `key' is NULL if error
345  *    has occurred. The application can freely use the `key' to whatever
346  *    purpose it needs. See lib/silcske/silcske.h for the definition of
347  *    the SilcSKEKeyMaterial structure.
348  *
349  ***/
350 typedef void (*SilcKeyAgreementCallback)(SilcClient client,
351                                          SilcClientConnection conn,
352                                          SilcClientEntry client_entry,
353                                          SilcKeyAgreementStatus status,
354                                          SilcSKEKeyMaterial *key,
355                                          void *context);
356
357 /****s* silcclient/SilcClientAPI/SilcPrivateMessageKeys
358  *
359  * NAME
360  *
361  *    typedef struct { ... } SilcPrivateMessageKeys;
362  *
363  * DESCRIPTION
364  *
365  *    Structure to hold the list of private message keys. The array of this
366  *    structure is returned by the silc_client_list_private_message_keys
367  *    function.
368  *
369  * SOURCE
370  */
371 typedef struct {
372   SilcClientEntry client_entry;       /* The remote client entry */
373   char *cipher;                       /* The cipher name */
374   unsigned char *key;                 /* The original key, If the appliation
375                                          provided it. This is NULL if the
376                                          library generated the key or if
377                                          the SKE key material was used. */
378   SilcUInt32 key_len;                 /* The key length */
379 } *SilcPrivateMessageKeys;
380 /***/
381
382 /****s* silcclient/SilcClientAPI/SilcChannelPrivateKey
383  *
384  * NAME
385  *
386  *    typedef struct SilcChannelPrivateKeyStruct { ... }
387  *                      *SilcChannelPrivateKey;
388  *
389  * DESCRIPTION
390  *
391  *    Structure to hold one channel private key. The array of this structure
392  *    is returned by silc_client_list_channel_private_keys function.
393  *
394  * SOURCE
395  */
396 struct SilcChannelPrivateKeyStruct {
397   char *name;                         /* Application given name */
398   SilcCipher cipher;                  /* The cipher and key */
399   SilcHmac hmac;                      /* The HMAC and hmac key */
400   unsigned char *key;                 /* The key data */
401   SilcUInt32 key_len;                 /* The key length */
402 };
403 /***/
404
405 /****f* silcclient/SilcClientAPI/SilcAskPassphrase
406  *
407  * SYNOPSIS
408  *
409  *    typedef void (*SilcAskPassphrase)(unsigned char *passphrase,
410  *                                      SilcUInt32 passphrase_len,
411  *                                      void *context);
412  *
413  * DESCRIPTION
414  *
415  *    Ask passphrase callback. This is called by the application when the
416  *    library calls `ask_passphrase' client operation.  The callback delivers
417  *    the passphrase to the library.  The passphrases in SILC protocol
418  *    MUST be in UTF-8 encoding, therefore the `passphrase' SHOULD be UTF-8
419  *    encoded, and if it is not then library will attempt to encode it.
420  *
421  ***/
422 typedef void (*SilcAskPassphrase)(unsigned char *passphrase,
423                                   SilcUInt32 passphrase_len,
424                                   void *context);
425
426 /****f* silcclient/SilcClientAPI/SilcVerifyPublicKey
427  *
428  * SYNOPSIS
429  *
430  *    typedef void (*SilcVerifyPublicKey)(bool success, void *context);
431  *
432  * DESCRIPTION
433  *
434  *    Public key (or certificate) verification callback. This is called
435  *    by the application to indicate that the public key verification was
436  *    either success or failure.
437  *
438  ***/
439 typedef void (*SilcVerifyPublicKey)(bool success, void *context);
440
441 /****f* silcclient/SilcClientAPI/SilcGetAuthMeth
442  *
443  * SYNOPSIS
444  *
445  *    typedef void (*SilcGetAuthMeth)(bool success, 
446  *                                    SilcProtocolAuthMeth auth_meth,
447  *                                    const unsigned char *auth_data,
448  *                                    SilcUInt32 auth_data_len, void *context);
449  * 
450  * DESCRIPTION
451  *
452  *    Authentication method resolving callback. This is called by the
453  *    application to return the resolved authentication method. The client
454  *    library has called the get_auth_method client operation and given
455  *    this function pointer as argument. The `success' will indicate whether
456  *    the authentication method could be resolved. The `auth_meth' is the
457  *    resolved authentication method. The `auth_data' and the `auth_data_len'
458  *    are the resolved authentication data. The `context' is the libary's
459  *    context sent to the get_auth_method client operation.
460  *
461  ***/
462 typedef void (*SilcGetAuthMeth)(bool success, 
463                                 SilcProtocolAuthMeth auth_meth,
464                                 const unsigned char *auth_data,
465                                 SilcUInt32 auth_data_len, void *context);
466
467 /****d* silcclient/SilcClientAPI/SilcClientMessageType
468  *
469  * NAME
470  *
471  *    typedef enum { ... } SilcClientMessageType;
472  *
473  * DESCRIPTION
474  *
475  *    Different message types for `say' client operation.  The application
476  *    may filter the message sent by the library according this type.
477  *
478  * SOURCE
479  */
480 typedef enum {
481   SILC_CLIENT_MESSAGE_INFO,            /* Informational */
482   SILC_CLIENT_MESSAGE_WARNING,         /* Warning */
483   SILC_CLIENT_MESSAGE_ERROR,           /* Error */
484   SILC_CLIENT_MESSAGE_AUDIT,           /* Auditable */
485 } SilcClientMessageType;
486 /***/
487
488 /****d* silcclient/SilcClientAPI/SilcClientConnectionStatus
489  *
490  * NAME
491  *
492  *    typedef enum { ... } SilcClientConnectionStatus
493  *
494  * DESCRIPTION
495  *
496  *    This type is returned to the `connect' client operation to indicate
497  *    the status of the created connection.  It can indicated if it was
498  *    successful or whether an error occurred.
499  *
500  * SOURCE
501  */
502 typedef enum {
503   SILC_CLIENT_CONN_SUCCESS,            /* Successfully connected */
504   SILC_CLIENT_CONN_SUCCESS_RESUME,     /* Successfully connected and
505                                           resumed old detached session */
506   SILC_CLIENT_CONN_ERROR,              /* Error occurred during connecting */
507 } SilcClientConnectionStatus;
508 /***/
509
510 /****s* silcclient/SilcClientAPI/SilcClientOperations
511  *
512  * NAME
513  *
514  *    typedef struct { ... } SilcClientOperations;
515  *
516  * DESCRIPTION
517  *
518  *    SILC Client Operations. These must be implemented by the application.
519  *    The Client library may call any of these routines at any time.  The
520  *    routines are used to deliver certain information to the application
521  *    or from the application to the client library.
522  *
523  * SOURCE
524  */
525 typedef struct {
526   /* Message sent to the application by library. `conn' associates the
527      message to a specific connection.  `conn', however, may be NULL. 
528      The `type' indicates the type of the message sent by the library.
529      The application can for example filter the message according the
530      type. */
531   void (*say)(SilcClient client, SilcClientConnection conn, 
532               SilcClientMessageType type, char *msg, ...);
533
534   /* Message for a channel. The `sender' is the sender of the message 
535      The `channel' is the channel. The `message' is the message.  Note 
536      that `message' maybe NULL.  The `flags' indicates message flags 
537      and it is used to determine how the message can be interpreted
538      (like it may tell the message is multimedia message). */
539   void (*channel_message)(SilcClient client, SilcClientConnection conn, 
540                           SilcClientEntry sender, SilcChannelEntry channel, 
541                           SilcMessageFlags flags,
542                           const unsigned char *message,
543                           SilcUInt32 message_len);
544
545   /* Private message to the client. The `sender' is the sender of the
546      message. The message is `message'and maybe NULL.  The `flags' 
547      indicates message flags  and it is used to determine how the message 
548      can be interpreted (like it may tell the message is multimedia 
549      message). */
550   void (*private_message)(SilcClient client, SilcClientConnection conn,
551                           SilcClientEntry sender, SilcMessageFlags flags,
552                           const unsigned char *message,
553                           SilcUInt32 message_len);
554
555   /* Notify message to the client. The notify arguments are sent in the
556      same order as servers sends them. The arguments are same as received
557      from the server except for ID's.  If ID is received application receives
558      the corresponding entry to the ID. For example, if Client ID is received
559      application receives SilcClientEntry.  Also, if the notify type is
560      for channel the channel entry is sent to application (even if server
561      does not send it because client library gets the channel entry from
562      the Channel ID in the packet's header). */
563   void (*notify)(SilcClient client, SilcClientConnection conn, 
564                  SilcNotifyType type, ...);
565
566   /* Command handler. This function is called always in the command function.
567      If error occurs it will be called as well. `conn' is the associated
568      client connection. `cmd_context' is the command context that was
569      originally sent to the command. `success' is FALSE if error occurred
570      during command. `command' is the command being processed. It must be
571      noted that this is not reply from server. This is merely called just
572      after application has called the command. Just to tell application
573      that the command really was processed. */
574   void (*command)(SilcClient client, SilcClientConnection conn, 
575                   SilcClientCommandContext cmd_context, bool success,
576                   SilcCommand command, SilcStatus status);
577
578   /* Command reply handler. This function is called always in the command reply
579      function. If error occurs it will be called as well. Normal scenario
580      is that it will be called after the received command data has been parsed
581      and processed. The function is used to pass the received command data to
582      the application. 
583      
584      `conn' is the associated client connection. `cmd_payload' is the command
585      payload data received from server and it can be ignored. It is provided
586      if the application would like to re-parse the received command data,
587      however, it must be noted that the data is parsed already by the library
588      thus the payload can be ignored. `success' is FALSE if error occurred.
589      In this case arguments are not sent to the application. The `status' is
590      the command reply status server returned. The `command' is the command
591      reply being processed. The function has variable argument list and each
592      command defines the number and type of arguments it passes to the
593      application (on error they are not sent).
594
595      The arguments are sent in the same order as servers sends them.  The 
596      arguments are same as received from the server except for ID's.  If 
597      ID is received application receives the corresponding entry to the 
598      ID. For example, if Client ID is receives application receives 
599      SilcClientEntry. */
600   void (*command_reply)(SilcClient client, SilcClientConnection conn,
601                         SilcCommandPayload cmd_payload, bool success,
602                         SilcCommand command, SilcStatus status, ...);
603
604   /* Called to indicate that connection was either successfully established
605      or connecting failed.  This is also the first time application receives
606      the SilcClientConnection object which it should save somewhere.
607      The `status' indicated whether the connection were successful.  If it
608      is error value the application must always call the function
609      silc_client_close_connection. */
610   void (*connected)(SilcClient client, SilcClientConnection conn,
611                     SilcClientConnectionStatus status);
612
613   /* Called to indicate that connection was disconnected to the server.
614      The `status' may tell the reason of the disconnection, and if the
615      `message' is non-NULL it may include the disconnection message
616      received from server. */
617   void (*disconnected)(SilcClient client, SilcClientConnection conn,
618                        SilcStatus status, const char *message);
619
620   /* Find authentication method and authentication data by hostname and
621      port. The hostname may be IP address as well. When the authentication
622      method has been resolved the `completion' callback with the found
623      authentication method and authentication data is called. The `conn'
624      may be NULL. */
625   void (*get_auth_method)(SilcClient client, SilcClientConnection conn,
626                           char *hostname, SilcUInt16 port,
627                           SilcGetAuthMeth completion, void *context);
628
629   /* Verifies received public key. The `conn_type' indicates which entity
630      (server, client etc.) has sent the public key. If user decides to trust
631      the application may save the key as trusted public key for later 
632      use. The `completion' must be called after the public key has been 
633      verified. */
634   void (*verify_public_key)(SilcClient client, SilcClientConnection conn,
635                             SilcSocketType conn_type, unsigned char *pk, 
636                             SilcUInt32 pk_len, SilcSKEPKType pk_type,
637                             SilcVerifyPublicKey completion, void *context);
638
639   /* Ask (interact, that is) a passphrase from user. The passphrase is
640      returned to the library by calling the `completion' callback with
641      the `context'. The returned passphrase SHOULD be in UTF-8 encoded,
642      if not then the library will attempt to encode. */
643   void (*ask_passphrase)(SilcClient client, SilcClientConnection conn,
644                          SilcAskPassphrase completion, void *context);
645
646   /* Notifies application that failure packet was received.  This is called
647      if there is some protocol active in the client.  The `protocol' is the
648      protocol context.  The `failure' is opaque pointer to the failure
649      indication.  Note, that the `failure' is protocol dependant and
650      application must explicitly cast it to correct type.  Usually `failure'
651      is 32 bit failure type (see protocol specs for all protocol failure
652      types). */
653   void (*failure)(SilcClient client, SilcClientConnection conn, 
654                   SilcProtocol protocol, void *failure);
655
656   /* Asks whether the user would like to perform the key agreement protocol.
657      This is called after we have received an key agreement packet or an
658      reply to our key agreement packet. This returns TRUE if the user wants
659      the library to perform the key agreement protocol and FALSE if it is not
660      desired (application may start it later by calling the function
661      silc_client_perform_key_agreement). If TRUE is returned also the
662      `completion' and `context' arguments must be set by the application. */
663   bool (*key_agreement)(SilcClient client, SilcClientConnection conn,
664                         SilcClientEntry client_entry, const char *hostname,
665                         SilcUInt16 port, SilcKeyAgreementCallback *completion,
666                         void **context);
667
668   /* Notifies application that file transfer protocol session is being
669      requested by the remote client indicated by the `client_entry' from
670      the `hostname' and `port'. The `session_id' is the file transfer
671      session and it can be used to either accept or reject the file
672      transfer request, by calling the silc_client_file_receive or
673      silc_client_file_close, respectively. */
674   void (*ftp)(SilcClient client, SilcClientConnection conn,
675               SilcClientEntry client_entry, SilcUInt32 session_id,
676               const char *hostname, SilcUInt16 port);
677
678   /* Delivers SILC session detachment data indicated by `detach_data' to the
679      application.  If application has issued SILC_COMMAND_DETACH command     
680      the client session in the SILC network is not quit.  The client remains 
681      in the network but is detached.  The detachment data may be used later
682      to resume the session in the SILC Network.  The appliation is   
683      responsible of saving the `detach_data', to for example in a file.
684
685      The detachment data can be given as argument to the functions
686      silc_client_connect_to_server, or silc_client_add_connection when
687      creating connection to remote server, inside SilcClientConnectionParams
688      structure.  If it is provided the client library will attempt to resume
689      the session in the network.  After the connection is created
690      successfully, the application is responsible of setting the user
691      interface for user into the same state it was before detaching (showing
692      same channels, channel modes, etc).  It can do this by fetching the
693      information (like joined channels) from the client library. */
694   void (*detach)(SilcClient client, SilcClientConnection conn,
695                  const unsigned char *detach_data,
696                  SilcUInt32 detach_data_len);
697 } SilcClientOperations;
698 /***/
699
700 /****f* silcclient/SilcClientAPI/SilcNicknameFormatParse
701  *
702  * SYNOPSIS
703  *
704  *    typedef void (*SilcNicknameFormatParse)(const char *nickname,
705  *                                            char **ret_nickname);
706  *
707  * DESCRIPTION
708  *
709  *    A callback function provided by the application for the library in
710  *    SilcClientParams structure. This function parses the formatted
711  *    nickname string `nickname' and returns the true nickname to the
712  *    `ret_nickname' pointer. The library can call this function at
713  *    any time.
714  *
715  ***/
716 typedef void (*SilcNicknameFormatParse)(const char *nickname,
717                                         char **ret_nickname);
718
719 /****s* silcclient/SilcClientAPI/SilcClientParams
720  *
721  * NAME
722  *
723  *    typedef struct { ... } SilcClientParams;
724  *
725  * DESCRIPTION
726  *
727  *    Client parameters. This can be filled with proper values and
728  *    given as argument to the silc_client_alloc function. The structure
729  *    hold various parameters which affects the function of the client.
730  *
731  * SOURCE
732  */
733 typedef struct {
734   /* Number of maximum tasks the client library's scheduler can handle.
735      If set to zero, the default value will be used (200). For WIN32
736      systems this should be set to 64 as it is the hard limit dictated
737      by the WIN32. */
738   int task_max;
739
740   /* Rekey timeout in seconds. The client will perform rekey in this
741      time interval. If set to zero, the default value will be used. */
742   unsigned int rekey_secs;
743
744   /* Connection authentication method request timeout. If server does not
745      reply back the current authentication method when we've requested it
746      in this time interval we'll assume the reply will not come at all. 
747      If set to zero, the default value (2 seconds) will be used. */
748   unsigned int connauth_request_secs;
749
750   /* Nickname format string. This can be used to order the client library
751      to save the nicknames in the library in a certain format. Since 
752      nicknames are not unique in SILC it is possible to have multiple same
753      nicknames. Using this format string it is possible to order the library
754      to separate the multiple same nicknames from each other. The format
755      types are defined below and they can appear in any order in the format
756      string. If this is NULL then default format is used which is the
757      default nickname without anything else. The string MUST be NULL
758      terminated.
759      
760      Following format types are available:
761      
762      %n  nickname      - the real nickname returned by the server (mandatory)
763      %h  hostname      - the stripped hostname of the client
764      %H  full hostname - the full hostname of the client
765      %s  server name   - the server name the client is connected
766      %S  full server   - the full server name the client is connected
767      %a  number        - ascending number in case there are several
768                          same nicknames (fe. nick@host and nick@host2)
769
770      Example format strings: "%n@%h%a"   (fe. nick@host, nick@host2)
771                              "%a!%n@%s"  (fe. nick@server, 2!nick@server)
772                              "%n@%H"     (fe. nick@host.domain.com)
773
774      By default this format is employed to the nicknames by the libary
775      only when there appears multiple same nicknames. If the library has
776      only one nickname cached the nickname is saved as is and without the
777      defined format. If you want always to save the nickname in the defined
778      format set the boolean field `nickname_force_format' to value TRUE.
779   */
780   char nickname_format[32];
781
782   /* If this is set to TRUE then the `nickname_format' is employed to all
783      saved nicknames even if there are no multiple same nicknames in the 
784      cache. By default this is FALSE, which means that the `nickname_format'
785      is employed only if the library will receive a nickname that is
786      already saved in the cache. It is recommended to leave this to FALSE
787      value. */
788   bool nickname_force_format;
789
790   /* A callback function provided by the application for the library to
791      parse the nickname from the formatted nickname string. Even though
792      the libary formats the nicknames the application knows generally the
793      format better so this function should be provided for the library
794      if the application sets the `nickname_format' field. The library
795      will call this to get the true nickname from the provided formatted
796      nickname string whenever it needs the true nickname. */
797   SilcNicknameFormatParse nickname_parse;
798
799   /* If this is set to TRUE then the client will ignore all incoming
800      Requested Attributes queries and does not reply anything back.  This
801      usually leads into situation where server does not anymore send
802      the queries after seeing that client does not reply anything back.
803      If your application does not support Requested Attributes or you do
804      not want to use them set this to TRUE.  See SilcAttribute and
805      silc_client_attribute_add for more information on attributes. */
806   bool ignore_requested_attributes;
807
808 } SilcClientParams;
809 /***/
810
811
812 /* Initialization functions (client.c) */
813
814 /****f* silcclient/SilcClientAPI/silc_client_alloc
815  *
816  * SYNOPSIS
817  *
818  *    SilcClient silc_client_alloc(SilcClientOperations *ops, 
819  *                                 SilcClientParams *params,
820  *                                 void *application,
821  *                                 const char *silc_version);
822  *
823  * DESCRIPTION
824  *
825  *    Allocates new client object. This has to be done before client may
826  *    work. After calling this one must call silc_client_init to initialize
827  *    the client. The `application' is application specific user data pointer
828  *    and caller must free it. The `silc_version' is the application version
829  *    that will be used to compare against remote host's (usually a server)
830  *    version string.  The `application' context is accessible by the
831  *    application by client->application, client being SilcClient.
832  *
833  ***/
834 SilcClient silc_client_alloc(SilcClientOperations *ops, 
835                              SilcClientParams *params,
836                              void *application,
837                              const char *version_string);
838
839 /****f* silcclient/SilcClientAPI/silc_client_free
840  *
841  * SYNOPSIS
842  *
843  *    void silc_client_free(SilcClient client);
844  *
845  * DESCRIPTION
846  *
847  *    Frees client object and its internals.  The execution of the client
848  *    should be stopped with silc_client_stop function before calling
849  *    this function.
850  *
851  ***/
852 void silc_client_free(SilcClient client);
853
854 /****f* silcclient/SilcClientAPI/silc_client_init
855  *
856  * SYNOPSIS
857  *
858  *    bool silc_client_init(SilcClient client);
859  *
860  * DESCRIPTION
861  *
862  *    Initializes the client. This makes all the necessary steps to make
863  *    the client ready to be run. One must call silc_client_run to run the
864  *    client. Returns FALSE if error occurred, TRUE otherwise.
865  *
866  ***/
867 bool silc_client_init(SilcClient client);
868
869 /****f* silcclient/SilcClientAPI/silc_client_run
870  *
871  * SYNOPSIS
872  *
873  *    void silc_client_run(SilcClient client);
874  *
875  * DESCRIPTION
876  *
877  *    Runs the client. This starts the scheduler from the utility library.
878  *    When this functions returns the execution of the appliation is over.
879  *    The client must be initialized before calling this.
880  *
881  ***/
882 void silc_client_run(SilcClient client);
883
884 /****f* silcclient/SilcClientAPI/silc_client_run_one
885  *
886  * SYNOPSIS
887  *
888  *    void silc_client_run_one(SilcClient client);
889  *
890  * DESCRIPTION
891  *
892  *    Runs the client and returns immeadiately. This function is used when
893  *    the SILC Client object indicated by the `client' is run under some
894  *    other scheduler, or event loop or main loop.  On GUI applications,
895  *    for example this may be desired to used to run the client under the
896  *    GUI application's main loop.  Typically the GUI application would
897  *    register an idle task that calls this function multiple times in
898  *    a second to quickly process the SILC specific data.
899  *
900  ***/
901 void silc_client_run_one(SilcClient client);
902
903 /****f* silcclient/SilcClientAPI/silc_client_stop
904  *
905  * SYNOPSIS
906  *
907  *    void silc_client_stop(SilcClient client);
908  *
909  * DESCRIPTION
910  *
911  *    Stops the client. This is called to stop the client and thus to stop
912  *    the program.  The client context must be freed with the silc_client_free
913  *    function.
914  *
915  ***/
916 void silc_client_stop(SilcClient client);
917
918
919 /* Connecting functions (client.c) */
920
921 /****s* silcclient/SilcClientAPI/SilcClientConnectionParams
922  *
923  * NAME
924  *
925  *    typedef struct { ... } SilcClientConnectionParams;
926  *
927  * DESCRIPTION
928  *
929  *    Client connection parameters.  This can be filled by the application
930  *    and given as argument to silc_client_connect_to_server or to
931  *    silc_client_add_connection.
932  *
933  * SOURCE
934  */
935 typedef struct {
936   /* The SILC session detachment data that was returned by `detach' client
937      operation when the application detached from the network.  Application
938      is responsible of saving the data and giving it as argument here
939      for resuming the session in the SILC network.
940
941      If this is provided here the client library will attempt to resume
942      the session in the network.  After the connection is created
943      successfully, the application is responsible of setting the user
944      interface for user into the same state it was before detaching (showing
945      same channels, channel modes, etc).  It can do this by fetching the
946      information (like joined channels) from the client library. */
947   unsigned char *detach_data;
948   SilcUInt32 detach_data_len;
949
950 } SilcClientConnectionParams;
951 /***/
952
953 /****f* silcclient/SilcClientAPI/silc_client_connect_to_server
954  *
955  * SYNOPSIS
956  *
957  *    bool silc_client_connect_to_server(SilcClient client, 
958  *                                      SilcClientConnectionParams *params,
959  *                                      int port, char *host, void *context);
960  *
961  * DESCRIPTION
962  *
963  *    Connects to remote server. This is the main routine used to connect
964  *    to SILC server. Returns -1 on error and the created socket otherwise. 
965  *    The `context' is user context that is saved into the SilcClientConnection
966  *    that is created after the connection is created. Note that application
967  *    may handle the connecting process outside the library. If this is the
968  *    case then this function is not used at all. When the connecting is
969  *    done the `connect' client operation is called, and the `context' is
970  *    accessible with conn->context, conn being SilcClientConnection.
971  *    If the `params' is provided they are used by the routine.
972  *
973  ***/
974 bool silc_client_connect_to_server(SilcClient client, 
975                                    SilcClientConnectionParams *params,
976                                    int port, char *host, void *context);
977
978 /****f* silcclient/SilcClientAPI/silc_client_add_connection
979  *
980  * SYNOPSIS
981  *
982  *
983  *    SilcClientConnection
984  *    silc_client_add_connection(SilcClient client,
985  *                               SilcClientConnectionParams *params,
986  *                               char *hostname, int port, void *context);
987  *
988  * DESCRIPTION
989  *
990  *    Allocates and adds new connection to the client. This adds the allocated
991  *    connection to the connection table and returns a pointer to it. A client
992  *    can have multiple connections to multiple servers. Every connection must
993  *    be added to the client using this function. User data `context' may
994  *    be sent as argument.  If the `params' is provided they are used by 
995  *    the routine.
996  *
997  * NOTES
998  *
999  *    This function is normally used only if the application performed 
1000  *    the connecting outside the library, and did not called the
1001  *    silc_client_connect_to_server function at all. The library
1002  *    however may use this internally.
1003  *
1004  ***/
1005 SilcClientConnection
1006 silc_client_add_connection(SilcClient client,
1007                            SilcClientConnectionParams *params,
1008                            char *hostname, int port, void *context);
1009
1010 /****f* silcclient/SilcClientAPI/silc_client_del_connection
1011  *
1012  * SYNOPSIS
1013  *
1014  *    void silc_client_del_connection(SilcClient client, 
1015  *                                    SilcClientConnection conn);
1016  *
1017  * DESCRIPTION
1018  *
1019  *    Removes connection from client. Frees all memory. The library
1020  *    call this function automatically for all connection contexts.
1021  *    The application however may free the connection contexts it has
1022  *    allocated.
1023  *
1024  ***/
1025 void silc_client_del_connection(SilcClient client, SilcClientConnection conn);
1026
1027 /****f* silcclient/SilcClientAPI/silc_client_add_socket
1028  *
1029  * SYNOPSIS
1030  *
1031  *    void silc_client_add_socket(SilcClient client, 
1032  *                                SilcSocketConnection sock);
1033  *
1034  * DESCRIPTION
1035  *
1036  *    Adds listener socket to the listener sockets table. This function is
1037  *    used to add socket objects that are listeners to the client.  This should
1038  *    not be used to add other connection objects.
1039  *
1040  ***/
1041 void silc_client_add_socket(SilcClient client, SilcSocketConnection sock);
1042
1043 /****f* silcclient/SilcClientAPI/silc_client_del_socket
1044  *
1045  * SYNOPSIS
1046  *
1047  *    void silc_client_del_socket(SilcClient client, 
1048  *                                SilcSocketConnection sock);
1049  *
1050  * DESCRIPTION
1051  *
1052  *    Deletes listener socket from the listener sockets table.  If the
1053  *    application has added a socket with silc_client_add_socket it must
1054  *    also free it using this function.
1055  *
1056  ***/
1057 void silc_client_del_socket(SilcClient client, SilcSocketConnection sock);
1058
1059 /****f* silcclient/SilcClientAPI/silc_client_start_key_exchange
1060  *
1061  * SYNOPSIS
1062  *
1063  *    void silc_client_start_key_exchange(SilcClient client,
1064  *                                        SilcClientConnection conn,
1065  *                                        int fd);
1066  *
1067  * DESCRIPTION
1068  *
1069  *    Start SILC Key Exchange (SKE) protocol to negotiate shared secret
1070  *    key material between client and server.  This function can be called
1071  *    directly if application is performing its own connecting and does not
1072  *    use the connecting provided by this library. This function is normally
1073  *    used only if the application performed the connecting outside the
1074  *    library. The library however may use this internally.  After the
1075  *    key exchange is performed the `connect' client operation is called.
1076  *
1077  ***/
1078 void silc_client_start_key_exchange(SilcClient client,
1079                                     SilcClientConnection conn,
1080                                     int fd);
1081
1082 /****f* silcclient/SilcClientAPI/silc_client_close_connection
1083  *
1084  * SYNOPSIS
1085  *
1086  *    void silc_client_close_connection(SilcClient client,
1087  *                                      SilcClientConnection conn);
1088  *
1089  * DESCRIPTION
1090  *
1091  *    Closes connection to remote end. Free's all allocated data except
1092  *    for some information such as nickname etc. that are valid at all time. 
1093  *
1094  ***/
1095 void silc_client_close_connection(SilcClient client,
1096                                   SilcClientConnection conn);
1097
1098
1099 /* Message sending functions (client_channel.c and client_prvmsg.c) */
1100
1101 /****f* silcclient/SilcClientAPI/silc_client_send_channel_message
1102  *
1103  * SYNOPSIS
1104  *
1105  *    void silc_client_send_channel_message(SilcClient client, 
1106  *                                          SilcClientConnection conn,
1107  *                                          SilcChannelEntry channel,
1108  *                                          SilcChannelPrivateKey key,
1109  *                                          SilcMessageFlags flags,
1110  *                                          unsigned char *data, 
1111  *                                          SilcUInt32 data_len, 
1112  *                                          bool_force_send);
1113  *
1114  * DESCRIPTION
1115  *
1116  *    Sends packet to the `channel'. Packet to channel is always encrypted
1117  *    differently from "normal" packets. SILC header of the packet is 
1118  *    encrypted with the next receiver's key and the rest of the packet is
1119  *    encrypted with the channel specific key. Padding and HMAC is computed
1120  *    with the next receiver's key. The `data' is the channel message. If
1121  *    the `force_send' is TRUE then the packet is sent immediately. 
1122  *
1123  *    If `key' is provided then that private key is used to encrypt the
1124  *    channel message.  If it is not provided, private keys has not been
1125  *    set at all, the normal channel key is used automatically.  If private
1126  *    keys are set then the first key (the key that was added first as
1127  *    private key) is used. 
1128  *
1129  ***/
1130 void silc_client_send_channel_message(SilcClient client, 
1131                                       SilcClientConnection conn,
1132                                       SilcChannelEntry channel,
1133                                       SilcChannelPrivateKey key,
1134                                       SilcMessageFlags flags,
1135                                       unsigned char *data, 
1136                                       SilcUInt32 data_len, 
1137                                       bool force_send);
1138
1139 /****f* silcclient/SilcClientAPI/silc_client_send_private_message
1140  *
1141  * SYNOPSIS
1142  *
1143  *    void silc_client_send_private_message(SilcClient client,
1144  *                                          SilcClientConnection conn,
1145  *                                          SilcClientEntry client_entry,
1146  *                                          SilcMessageFlags flags,
1147  *                                          unsigned char *data, 
1148  *                                          SilcUInt32 data_len, 
1149  *                                          bool force_send);
1150  *
1151  * DESCRIPTION
1152  *
1153  *    Sends private message to remote client. If private message key has
1154  *    not been set with this client then the message will be encrypted using
1155  *    normal session keys. Private messages are special packets in SILC
1156  *    network hence we need this own function for them. This is similar
1157  *    to silc_client_packet_send_to_channel except that we send private
1158  *    message. The `data' is the private message. If the `force_send' is
1159  *    TRUE the packet is sent immediately. 
1160  *
1161  ***/
1162 void silc_client_send_private_message(SilcClient client,
1163                                       SilcClientConnection conn,
1164                                       SilcClientEntry client_entry,
1165                                       SilcMessageFlags flags,
1166                                       unsigned char *data, 
1167                                       SilcUInt32 data_len, 
1168                                       bool force_send);
1169
1170
1171 /* Client and Channel entry retrieval (idlist.c) */
1172
1173 /****f* silcclient/SilcClientAPI/SilcGetClientCallback
1174  *
1175  * SYNOPSIS
1176  *
1177  *    typedef void (*SilcGetClientCallback)(SilcClient client,
1178  *                                          SilcClientConnection conn,
1179  *                                          SilcClientEntry *clients,
1180  *                                          SilcUInt32 clients_count,
1181  *                                          void *context);
1182  *
1183  * DESCRIPTION
1184  *
1185  *    Callback function given to the silc_client_get_client function. The
1186  *    found entries are allocated into the `clients' array. The array must
1187  *    not be freed by the receiver, the library will free it later. If the
1188  *    `clients' is NULL, no such clients exist in the SILC Network.
1189  *
1190  ***/
1191 typedef void (*SilcGetClientCallback)(SilcClient client,
1192                                       SilcClientConnection conn,
1193                                       SilcClientEntry *clients,
1194                                       SilcUInt32 clients_count,
1195                                       void *context);
1196
1197 /****f* silcclient/SilcClientAPI/silc_client_get_clients
1198  *
1199  * SYNOPSIS
1200  *
1201  *    void silc_client_get_clients(SilcClient client,
1202  *                                 SilcClientConnection conn,
1203  *                                 const char *nickname,
1204  *                                 const char *server,
1205  *                                 SilcGetClientCallback completion,
1206  *                                 void *context);
1207  *
1208  * DESCRIPTION
1209  *
1210  *    Finds client entry or entries by the `nickname' and `server'. The 
1211  *    completion callback will be called when the client entries has been
1212  *    found.  After the server returns the client information it is cached
1213  *    and can be accesses locally at a later time.
1214  *
1215  * NOTES
1216  *
1217  *    NOTE: This function is always asynchronous and resolves the client
1218  *    information from the server. Thus, if you already know the client
1219  *    information then use the silc_client_get_client_by_id function to
1220  *    get the client entry since this function may be very slow and should
1221  *    be used only to initially get the client entries. 
1222  *
1223  ***/
1224 void silc_client_get_clients(SilcClient client,
1225                              SilcClientConnection conn,
1226                              const char *nickname,
1227                              const char *server,
1228                              SilcGetClientCallback completion,
1229                              void *context);
1230
1231 /****f* silcclient/SilcClientAPI/silc_client_get_clients_local
1232  *
1233  * SYNOPSIS
1234  *
1235  *    SilcClientEntry *silc_client_get_clients_local(SilcClient client,
1236  *                                                   SilcClientConnection conn,
1237  *                                                   const char *nickname,
1238  *                                                   const char *format,
1239  *                                                   SilcUInt32 *clients_count);
1240  *
1241  * DESCRIPTION
1242  *
1243  *    Same as silc_client_get_clients function but does not resolve anything
1244  *    from the server. This checks local cache and returns all matching
1245  *    clients from the local cache. If none was found this returns NULL.
1246  *    The `nickname' is the real nickname of the client, and the `format'
1247  *    is the formatted nickname to find exact match from multiple found
1248  *    entries. The format must be same as given in the SilcClientParams
1249  *    structure to the client library. If the `format' is NULL all found
1250  *    clients by `nickname' are returned. The caller must return the
1251  *    returned array.
1252  *
1253  ***/
1254 SilcClientEntry *silc_client_get_clients_local(SilcClient client,
1255                                                SilcClientConnection conn,
1256                                                const char *nickname,
1257                                                const char *format,
1258                                                SilcUInt32 *clients_count);
1259
1260 /****f* silcclient/SilcClientAPI/silc_client_get_clients_by_list
1261  *
1262  * SYNOPSIS
1263  *
1264  *    void silc_client_get_clients_by_list(SilcClient client,
1265  *                                         SilcClientConnection conn,
1266  *                                         SilcUInt32 list_count,
1267  *                                         SilcBuffer client_id_list,
1268  *                                         SilcGetClientCallback completion,
1269  *                                         void *context);
1270  *
1271  * DESCRIPTION
1272  *
1273  *    Gets client entries by the list of client ID's `client_id_list'. This
1274  *    always resolves those client ID's it does not know yet from the server
1275  *    so this function might take a while. The `client_id_list' is a list
1276  *    of ID Payloads added one after other.  JOIN command reply and USERS
1277  *    command reply for example returns this sort of list. The `completion'
1278  *    will be called after the entries are available. When server returns
1279  *    the client information it will be cached and can be accessed locally
1280  *    at a later time.
1281  *
1282  ***/
1283 void silc_client_get_clients_by_list(SilcClient client,
1284                                      SilcClientConnection conn,
1285                                      SilcUInt32 list_count,
1286                                      SilcBuffer client_id_list,
1287                                      SilcGetClientCallback completion,
1288                                      void *context);
1289
1290 /****f* silcclient/SilcClientAPI/silc_client_get_client_by_id
1291  *
1292  * SYNOPSIS
1293  *
1294  *    SilcClientEntry silc_client_get_client_by_id(SilcClient client,
1295  *                                                 SilcClientConnection conn,
1296  *                                                 SilcClientID *client_id);
1297  *
1298  * DESCRIPTION
1299  *
1300  *    Find entry for client by the client's ID. Returns the entry or NULL
1301  *    if the entry was not found.  This checks the local cache and does
1302  *    not resolve anything from server.
1303  *
1304  ***/
1305 SilcClientEntry silc_client_get_client_by_id(SilcClient client,
1306                                              SilcClientConnection conn,
1307                                              SilcClientID *client_id);
1308
1309 /****f* silcclient/SilcClientAPI/silc_client_get_client_by_id_resolve
1310  *
1311  * SYNOPSIS
1312  *
1313  *    void 
1314  *    silc_client_get_client_by_id_resolve(SilcClient client,
1315  *                                         SilcClientConnection conn,
1316  *                                         SilcClientID *client_id,
1317  *                                         SilcBuffer attributes,
1318  *                                         SilcGetClientCallback completion,
1319  *                                         void *context);
1320  *
1321  * DESCRIPTION
1322  *
1323  *    Same as silc_client_get_client_by_id but will always resolve the
1324  *    information from the server. Use this only if you know that you
1325  *    do not have the entry and the only thing you know about the client
1326  *    is its ID. When server returns the client information it will be
1327  *    cache and can be accessed locally at a later time.
1328  *
1329  *    If the `attributes' is non-NULL then the buffer includes Requested
1330  *    Attributes which can be used to fetch very detailed information
1331  *    about the user. If it is NULL then only normal WHOIS query is
1332  *    made (for more information about attributes see SilcAttribute).
1333  *    Caller may create the `attributes' with silc_client_attributes_request
1334  *    function.
1335  *
1336  ***/
1337 void silc_client_get_client_by_id_resolve(SilcClient client,
1338                                           SilcClientConnection conn,
1339                                           SilcClientID *client_id,
1340                                           SilcBuffer attributes,
1341                                           SilcGetClientCallback completion,
1342                                           void *context);
1343
1344 /****f* silcclient/SilcClientAPI/silc_client_del_client
1345  *
1346  * SYNOPSIS
1347  *
1348  *    bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
1349  *                                SilcClientEntry client_entry)
1350  *
1351  * DESCRIPTION
1352  *
1353  *    Removes client from local cache by the client entry indicated by
1354  *    the `client_entry'.  Returns TRUE if the deletion were successful.
1355  *
1356  ***/
1357 bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
1358                             SilcClientEntry client_entry);
1359
1360 /****f* silcclient/SilcClientAPI/SilcGetChannelCallback
1361  *
1362  * SYNOPSIS
1363  *
1364  *    typedef void (*SilcGetChannelCallback)(SilcClient client,
1365  *                                           SilcClientConnection conn,
1366  *                                           SilcChannelEntry *channels,
1367  *                                           SilcUInt32 channels_count,
1368  *                                           void *context);
1369  *
1370  * DESCRIPTION
1371  *
1372  *    Callback function given to the silc_client_get_channel_* functions.
1373  *    The found entries are allocated into the `channels' array. The array
1374  *    must not be freed by the receiver, the library will free it later.
1375  *    If the `channel' is NULL, no such channel exist in the SILC Network.
1376  *
1377  ***/
1378 typedef void (*SilcGetChannelCallback)(SilcClient client,
1379                                        SilcClientConnection conn,
1380                                        SilcChannelEntry *channels,
1381                                        SilcUInt32 channels_count,
1382                                        void *context);
1383
1384 /****f* silcclient/SilcClientAPI/silc_client_get_channel
1385  *
1386  * SYNOPSIS
1387  *
1388  *    SilcChannelEntry silc_client_get_channel(SilcClient client,
1389  *                                             SilcClientConnection conn,
1390  *                                             char *channel);
1391  *
1392  * DESCRIPTION
1393  *
1394  *    Finds entry for channel by the channel name. Returns the entry or NULL
1395  *    if the entry was not found. It is found only if the client is joined
1396  *    to the channel. 
1397  *
1398  ***/
1399 SilcChannelEntry silc_client_get_channel(SilcClient client,
1400                                          SilcClientConnection conn,
1401                                          char *channel);
1402
1403 /****f* silcclient/SilcClientAPI/silc_client_get_channel_by_id
1404  *
1405  * SYNOPSIS
1406  *
1407  *    SilcChannelEntry
1408  *    silc_client_get_channel_by_id(SilcClient client,
1409  *                                  SilcClientConnection conn,
1410  *                                  SilcChannelID *channel_id);
1411  *
1412  * DESCRIPTION
1413  *
1414  *    Finds channel entry by the channel name. Returns the entry or NULL
1415  *    if it was not found.
1416  *
1417  ***/
1418 SilcChannelEntry silc_client_get_channel_by_id(SilcClient client,
1419                                                SilcClientConnection conn,
1420                                                SilcChannelID *channel_id);
1421
1422 /****f* silcclient/SilcClientAPI/silc_client_get_channel_by_id_resolve
1423  *
1424  * SYNOPSIS
1425  *
1426  *    void 
1427  *    silc_client_get_channel_by_id_resolve(SilcClient client,
1428  *                                          SilcClientConnection conn,
1429  *                                          SilcChannelID *channel_id,
1430  *                                          SilcGetClientCallback completion,
1431  *                                          void *context);
1432  *
1433  * DESCRIPTION
1434  *
1435  *    Resolves the channel information (its name mainly) from the server
1436  *    by the `channel_id'. Use this only if you know that you do not have
1437  *    the entry cached locally.
1438  *
1439  ***/
1440 void silc_client_get_channel_by_id_resolve(SilcClient client,
1441                                            SilcClientConnection conn,
1442                                            SilcChannelID *channel_id,
1443                                            SilcGetChannelCallback completion,
1444                                            void *context);
1445
1446 /****f* silcclient/SilcClientAPI/silc_client_del_channel
1447  *
1448  * SYNOPSIS
1449  *
1450  *    bool silc_client_del_channel(SilcClient client, 
1451  *                                 SilcClientConnection conn,
1452  *                                 SilcChannelEntry channel)
1453  *
1454  * DESCRIPTION
1455  *
1456  *    Removes channel from local cache by the channel entry indicated by
1457  *    the `channel'.  Returns TRUE if the deletion were successful.
1458  *
1459  ***/
1460 bool silc_client_del_channel(SilcClient client, SilcClientConnection conn,
1461                              SilcChannelEntry channel);
1462
1463 /****f* silcclient/SilcClientAPI/silc_client_get_server
1464  *
1465  * SYNOPSIS
1466  *
1467  *    SilcServerEntry silc_client_get_server(SilcClient client,
1468  *                                           SilcClientConnection conn,
1469  *                                           char *server_name)
1470  *
1471  * DESCRIPTION
1472  *
1473  *    Finds entry for server by the server name. Returns the entry or NULL
1474  *    if the entry was not found.
1475  *
1476  ***/
1477 SilcServerEntry silc_client_get_server(SilcClient client,
1478                                        SilcClientConnection conn,
1479                                        char *server_name);
1480
1481 /****f* silcclient/SilcClientAPI/silc_client_get_server_by_id
1482  *
1483  * SYNOPSIS
1484  *
1485  *    SilcServerEntry silc_client_get_server_by_id(SilcClient client,
1486  *                                                 SilcClientConnection conn,
1487  *                                                 SilcServerID *server_id);
1488  *
1489  * DESCRIPTION
1490  *
1491  *    Finds entry for server by the server ID. Returns the entry or NULL
1492  *    if the entry was not found.
1493  *
1494  ***/
1495 SilcServerEntry silc_client_get_server_by_id(SilcClient client,
1496                                              SilcClientConnection conn,
1497                                              SilcServerID *server_id);
1498
1499 /****f* silcclient/SilcClientAPI/silc_client_del_server
1500  *
1501  * SYNOPSIS
1502  *
1503  *    bool silc_client_del_server(SilcClient client, SilcClientConnection conn,
1504  *                                SilcServerEntry server);
1505  *
1506  * DESCRIPTION
1507  *
1508  *    Removes server from local cache by the server entry indicated by
1509  *    the `server'.  Returns TRUE if the deletion were successful.
1510  *
1511  ***/
1512 bool silc_client_del_server(SilcClient client, SilcClientConnection conn,
1513                             SilcServerEntry server);
1514
1515 /****f* silcclient/SilcClientAPI/silc_client_on_channel
1516  *
1517  * SYNOPSIS
1518  *
1519  *    SilcChannelUser silc_client_on_channel(SilcChannelEntry channel,
1520  *                                           SilcClientEntry client_entry);
1521  *
1522  * DESCRIPTION
1523  *
1524  *    Returns the ChannelUser entry if the `client_entry' is joined on the 
1525  *    channel indicated by the `channel'. NULL if client is not joined on
1526  *    the channel. 
1527  *
1528  ***/
1529 SilcChannelUser silc_client_on_channel(SilcChannelEntry channel,
1530                                        SilcClientEntry client_entry);
1531
1532 /* Command management (command.c) */
1533
1534 /****f* silcclient/SilcClientAPI/silc_client_command_call
1535  *
1536  * SYNOPSIS
1537  *
1538  *    bool silc_client_command_call(SilcClient client,
1539  *                                  SilcClientConnection conn,
1540  *                                  const char *command_line, ...);
1541  *
1542  * DESCRIPTION
1543  *
1544  *    Calls and executes the command indicated by the `command_name'.
1545  *    The `command_line' is a string which includes the command's name and
1546  *    its arguments separated with whitespaces (' ').  If `command_line'
1547  *    is non-NULL then all variable arguments are ignored by default.
1548  *
1549  *    If `command_line' is NULL, then the variable arguments define the
1550  *    command's name and its arguments.  The first variable argument must
1551  *    be the command name.  The variable argument list must be terminated
1552  *    with NULL.
1553  *
1554  *    Returns FALSE if the command is not known and TRUE after command.
1555  *    execution.  The "command" client operation is called when the
1556  *    command is executed to indicate whether the command executed
1557  *    successfully or not.
1558  *
1559  *    The "command_reply" client operation will be called when reply is
1560  *    received from the server to the command.  Application may also use
1561  *    the silc_client_command_pending to attach to the command reply.
1562  *    The command identifier for silc_client_command_pending function after
1563  *    this function call is conn->cmd_ident, which application may use.
1564  *
1565  * EXAMPLE
1566  *
1567  *    silc_client_command_call(client, conn, NULL, "PING", "silc.silcnet.org",
1568  *                             NULL);
1569  *    silc_client_command_call(client, conn, "PING silc.silcnet.org");
1570  *
1571  ***/
1572 bool silc_client_command_call(SilcClient client,
1573                               SilcClientConnection conn,
1574                               const char *command_line, ...);
1575
1576 /****f* silcclient/SilcClientAPI/silc_client_command_send
1577  *
1578  * SYNOPSIS
1579  *
1580  *    void silc_client_command_send(SilcClient client, 
1581  *                                  SilcClientConnection conn,
1582  *                                  SilcCommand command, SilcUInt16 ident,
1583  *                                  SilcUInt32 argc, ...);
1584  *
1585  * DESCRIPTION
1586  *
1587  *    Generic function to send any command. The arguments must be sent already
1588  *    encoded into correct form and in correct order. If application wants
1589  *    to perform the commands by itself, it can do so and send the data
1590  *    directly to the server using this function.  If application is using
1591  *    the silc_client_command_call, this function is usually not used.
1592  *    Note that this overriders the Client Librarys commands and sends
1593  *    the command packet directly to server.
1594  *
1595  *    The variable arguments are a pair of { type, data, data_length },
1596  *    and the `argc' is the number of these pairs.
1597  *
1598  * EXAMPLE
1599  *
1600  *    silc_client_command_send(client, conn, SILC_COMMAND_WHOIS, 0, 1,
1601  *                             1, nickname, strlen(nickname));
1602  *
1603  ***/
1604 void silc_client_command_send(SilcClient client, SilcClientConnection conn,
1605                               SilcCommand command, SilcUInt16 ident,
1606                               SilcUInt32 argc, ...);
1607
1608 /****f* silcclient/SilcClientAPI/silc_client_command_pending
1609  *
1610  * SYNOPSIS
1611  *
1612  *    void silc_client_command_pending(SilcClientConnection conn,
1613  *                                     SilcCommand reply_cmd,
1614  *                                     SilcUInt16 ident,
1615  *                                     SilcCommandCb callback,
1616  *                                     void *context);
1617  *
1618  * DESCRIPTION
1619  *
1620  *    This function can be used to add pending command callback to be
1621  *    called when an command reply is received to an earlier sent command.
1622  *    The `reply_cmd' is the command that must be received in order for
1623  *    the pending command callback indicated by `callback' to be called.
1624  *    The `callback' will deliver the `context' and 
1625  *    SilcClientCommandReplyContext which includes the internals of the 
1626  *    command reply.
1627  *
1628  *    The `ident' is a command identifier which was set for the earlier
1629  *    sent command.  The command reply will include the same identifier
1630  *    and pending command callback will be called when the reply is 
1631  *    received with the same command identifier.  It is possible to
1632  *    add multiple pending command callbacks for same command and for
1633  *    same identifier.
1634  *
1635  *    Application may use this function to add its own command reply
1636  *    handlers if it wishes not to use the standard `command_reply'
1637  *    client operation.  However, note that the pending command callback
1638  *    does not deliver parsed command reply, but application must parse
1639  *    it itself.
1640  *
1641  *    Note also that the application is notified about the received command
1642  *    reply through the `command_reply' client operation before calling
1643  *    the `callback` pending command callback.  That is the normal 
1644  *    command reply handling, and is called regardless whether pending
1645  *    command callbacks are used or not.
1646  *
1647  *    Commands that application calls with silc_client_command_call
1648  *    will use a command identifier from conn->cmd_ident variable.  After
1649  *    calling the silc_client_command_call, the conn->cmd_ident includes
1650  *    the command identifier that was used for the command sending.
1651  *
1652  * EXAMPLE
1653  *
1654  *    silc_client_command_call(client, conn, "PING silc.silcnet.org");
1655  *    silc_client_command_pending(conn, SILC_COMMAND_PING, conn->cmd_ident,
1656  *                                my_ping_handler, my_ping_context);
1657  *
1658  ***/
1659 void silc_client_command_pending(SilcClientConnection conn,
1660                                  SilcCommand reply_cmd,
1661                                  SilcUInt16 ident,
1662                                  SilcCommandCb callback,
1663                                  void *context);
1664
1665
1666 /* Private Message key management (client_prvmsg.c) */
1667
1668 /****f* silcclient/SilcClientAPI/silc_client_add_private_message_key
1669  *
1670  * SYNOPSIS
1671  *
1672  *    bool silc_client_add_private_message_key(SilcClient client,
1673  *                                             SilcClientConnection conn,
1674  *                                             SilcClientEntry client_entry,
1675  *                                             const char *cipher,
1676  *                                             const char *hmac,
1677  *                                             unsigned char *key,
1678  *                                             SilcUInt32 key_len,
1679  *                                             bool generate_key,
1680  *                                             bool responder);
1681  *
1682  * DESCRIPTION
1683  *
1684  *    Adds private message key to the client library. The key will be used to
1685  *    encrypt all private message between the client and the remote client
1686  *    indicated by the `client_entry'. If the `key' is NULL and the boolean
1687  *    value `generate_key' is TRUE the library will generate random key.
1688  *    The `key' maybe for example pre-shared-key, passphrase or similar.
1689  *    The `cipher' and `hmac' MAY be provided but SHOULD be NULL to assure
1690  *    that the requirements of the SILC protocol are met. The API, however,
1691  *    allows to allocate any cipher and HMAC.
1692  *
1693  *    If `responder' is TRUE then the sending and receiving keys will be
1694  *    set according the client being the receiver of the private key.  If
1695  *    FALSE the client is being the sender (or negotiator) of the private
1696  *    key.
1697  *
1698  *    It is not necessary to set key for normal private message usage. If the
1699  *    key is not set then the private messages are encrypted using normal
1700  *    session keys. Setting the private key, however, increases the security. 
1701  *
1702  *    Returns FALSE if the key is already set for the `client_entry', TRUE
1703  *    otherwise. 
1704  *
1705  ***/
1706 bool silc_client_add_private_message_key(SilcClient client,
1707                                          SilcClientConnection conn,
1708                                          SilcClientEntry client_entry,
1709                                          const char *cipher,
1710                                          const char *hmac,
1711                                          unsigned char *key,
1712                                          SilcUInt32 key_len,
1713                                          bool generate_key,
1714                                          bool responder);
1715
1716 /****f* silcclient/SilcClientAPI/silc_client_add_private_message_key_ske
1717  *
1718  * SYNOPSIS
1719  *
1720  *    bool
1721  *    silc_client_add_private_message_key_ske(SilcClient client,
1722  *                                            SilcClientConnection conn,
1723  *                                            SilcClientEntry client_entry,
1724  *                                            const char *cipher,
1725  *                                            const char *hmac,
1726  *                                            SilcSKEKeyMaterial *key);
1727  *
1728  * DESCRIPTION
1729  *
1730  *    Same as silc_client_add_private_message_key but takes the key material
1731  *    from the SKE key material structure. This structure is received if
1732  *    the application uses the silc_client_send_key_agreement to negotiate
1733  *    the key material. The `cipher' and `hmac' SHOULD be provided as it is
1734  *    negotiated also in the SKE protocol. 
1735  *
1736  ***/
1737 bool silc_client_add_private_message_key_ske(SilcClient client,
1738                                              SilcClientConnection conn,
1739                                              SilcClientEntry client_entry,
1740                                              const char *cipher,
1741                                              const char *hmac,
1742                                              SilcSKEKeyMaterial *key,
1743                                              bool responder);
1744
1745 /****f* silcclient/SilcClientAPI/silc_client_del_private_message_key
1746  *
1747  * SYNOPSIS
1748  *
1749  *    bool silc_client_del_private_message_key(SilcClient client,
1750  *                                             SilcClientConnection conn,
1751  *                                             SilcClientEntry client_entry);
1752  *
1753  * DESCRIPTION
1754  *
1755  *    Removes the private message from the library. The key won't be used
1756  *    after this to protect the private messages with the remote `client_entry'
1757  *    client. Returns FALSE on error, TRUE otherwise. 
1758  *
1759  ***/
1760 bool silc_client_del_private_message_key(SilcClient client,
1761                                          SilcClientConnection conn,
1762                                          SilcClientEntry client_entry);
1763
1764 /****f* silcclient/SilcClientAPI/silc_client_list_private_message_keys
1765  *
1766  * SYNOPSIS
1767  *
1768  *    SilcPrivateMessageKeys
1769  *    silc_client_list_private_message_keys(SilcClient client,
1770  *                                          SilcClientConnection conn,
1771  *                                          SilcUInt32 *key_count);
1772  * 
1773  * DESCRIPTION
1774  *
1775  *    Returns array of set private message keys associated to the connection
1776  *    `conn'. Returns allocated SilcPrivateMessageKeys array and the array
1777  *    count to the `key_count' argument. The array must be freed by the caller
1778  *    by calling the silc_client_free_private_message_keys function. Note: 
1779  *    the keys returned in the array is in raw format. It might not be desired
1780  *    to show the keys as is. The application might choose not to show the keys
1781  *    at all or to show the fingerprints of the keys. 
1782  *
1783  ***/
1784 SilcPrivateMessageKeys
1785 silc_client_list_private_message_keys(SilcClient client,
1786                                       SilcClientConnection conn,
1787                                       SilcUInt32 *key_count);
1788
1789 /****f* silcclient/SilcClientAPI/silc_client_free_private_message_keys
1790  *
1791  * SYNOPSIS
1792  *
1793  *    void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
1794  *                                               SilcUInt32 key_count);
1795  * 
1796  * DESCRIPTION
1797  *
1798  *    Frees the SilcPrivateMessageKeys array returned by the function
1799  *    silc_client_list_private_message_keys. 
1800  *
1801  ***/
1802 void silc_client_free_private_message_keys(SilcPrivateMessageKeys keys,
1803                                            SilcUInt32 key_count);
1804
1805
1806 /* Channel private key management (client_channel.c, 
1807    SilcChannelPrivateKey is defined in idlist.h) */
1808
1809 /****f* silcclient/SilcClientAPI/silc_client_add_channel_private_key
1810  *
1811  * SYNOPSIS
1812  *
1813  *    bool silc_client_add_channel_private_key(SilcClient client,
1814  *                                             SilcClientConnection conn,
1815  *                                             SilcChannelEntry channel,
1816  *                                             const char *name,
1817  *                                             char *cipher,
1818  *                                             char *hmac,
1819  *                                             unsigned char *key,
1820  *                                             SilcUInt32 key_len);
1821  * 
1822  * DESCRIPTION
1823  *
1824  *    Adds private key for channel. This may be set only if the channel's mode
1825  *    mask includes the SILC_CHANNEL_MODE_PRIVKEY. This returns FALSE if the
1826  *    mode is not set. When channel has private key then the messages are
1827  *    encrypted using that key. All clients on the channel must also know the
1828  *    key in order to decrypt the messages. However, it is possible to have
1829  *    several private keys per one channel. In this case only some of the
1830  *    clients on the channel may know the one key and only some the other key.
1831  *    The `name' can be application given name for the key.
1832  *
1833  *    The private key for channel is optional. If it is not set then the
1834  *    channel messages are encrypted using the channel key generated by the
1835  *    server. However, setting the private key (or keys) for the channel 
1836  *    significantly adds security. If more than one key is set the library
1837  *    will automatically try all keys at the message decryption phase. Note:
1838  *    setting many keys slows down the decryption phase as all keys has to
1839  *    be tried in order to find the correct decryption key. However, setting
1840  *    a few keys does not have big impact to the decryption performace. 
1841  *
1842  * NOTES
1843  *
1844  *    NOTE: This is entirely local setting. The key set using this function
1845  *    is not sent to the network at any phase.
1846  *
1847  *    NOTE: If the key material was originated by the SKE protocol (using
1848  *    silc_client_send_key_agreement) then the `key' MUST be the
1849  *    key->send_enc_key as this is dictated by the SILC protocol. However,
1850  *    currently it is not expected that the SKE key material would be used
1851  *    as channel private key. However, this API allows it. 
1852  *
1853  ***/
1854 bool silc_client_add_channel_private_key(SilcClient client,
1855                                          SilcClientConnection conn,
1856                                          SilcChannelEntry channel,
1857                                          const char *name,
1858                                          char *cipher,
1859                                          char *hmac,
1860                                          unsigned char *key,
1861                                          SilcUInt32 key_len);
1862
1863 /****f* silcclient/SilcClientAPI/silc_client_del_channel_private_keys
1864  *
1865  * SYNOPSIS
1866  *
1867  *    bool silc_client_del_channel_private_keys(SilcClient client,
1868  *                                              SilcClientConnection conn,
1869  *                                              SilcChannelEntry channel);
1870  * 
1871  * DESCRIPTION
1872  *
1873  *    Removes all private keys from the `channel'. The old channel key is used
1874  *    after calling this to protect the channel messages. Returns FALSE on
1875  *    on error, TRUE otherwise. 
1876  *
1877  ***/
1878 bool silc_client_del_channel_private_keys(SilcClient client,
1879                                           SilcClientConnection conn,
1880                                           SilcChannelEntry channel);
1881
1882 /****f* silcclient/SilcClientAPI/silc_client_del_channel_private_key
1883  *
1884  * SYNOPSIS
1885  *
1886  *    bool silc_client_del_channel_private_key(SilcClient client,
1887  *                                            SilcClientConnection conn,
1888  *                                            SilcChannelEntry channel,
1889  *                                            SilcChannelPrivateKey key);
1890  * 
1891  * DESCRIPTION
1892  *
1893  *    Removes and frees private key `key' from the channel `channel'. 
1894  *    The `key' is retrieved by calling the function 
1895  *    silc_client_list_channel_private_keys. The key is not used after
1896  *    this. If the key was last private key then the old channel key is
1897  *    used hereafter to protect the channel messages. This returns FALSE
1898  *    on error, TRUE otherwise. 
1899  *
1900  ***/
1901 bool silc_client_del_channel_private_key(SilcClient client,
1902                                          SilcClientConnection conn,
1903                                          SilcChannelEntry channel,
1904                                          SilcChannelPrivateKey key);
1905
1906 /****f* silcclient/SilcClientAPI/silc_client_list_channel_private_keys
1907  *
1908  * SYNOPSIS
1909  *
1910  *    SilcChannelPrivateKey *
1911  *    silc_client_list_channel_private_keys(SilcClient client,
1912  *                                          SilcClientConnection conn,
1913  *                                          SilcChannelEntry channel,
1914  *                                          SilcUInt32 *key_count);
1915  *
1916  * DESCRIPTION
1917  *
1918  *    Returns array (pointers) of private keys associated to the `channel'.
1919  *    The caller must free the array by calling the function
1920  *    silc_client_free_channel_private_keys. The pointers in the array may be
1921  *    used to delete the specific key by giving the pointer as argument to the
1922  *    function silc_client_del_channel_private_key. 
1923  *
1924  ***/
1925 SilcChannelPrivateKey *
1926 silc_client_list_channel_private_keys(SilcClient client,
1927                                       SilcClientConnection conn,
1928                                       SilcChannelEntry channel,
1929                                       SilcUInt32 *key_count);
1930
1931 /****f* silcclient/SilcClientAPI/silc_client_free_channel_private_keys
1932  *
1933  * SYNOPSIS
1934  *
1935  *    void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
1936  *                                               SilcUInt32 key_count);
1937  *
1938  * DESCRIPTION
1939  *
1940  *    Frees the SilcChannelPrivateKey array.
1941  *
1942  ***/
1943 void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys,
1944                                            SilcUInt32 key_count);
1945
1946 /****f* silcclient/SilcClientAPI/silc_client_current_channel_private_key
1947  *
1948  * SYNOPSIS
1949  *
1950  *    void silc_client_current_channel_private_key(SilcClient client,
1951  *                                                 SilcClientConnection conn,
1952  *                                                 SilcChannelEntry channel,
1953  *                                                 SilcChannelPrivateKey key);
1954  *
1955  * DESCRIPTION
1956  *
1957  *    Sets the `key' to be used as current channel private key on the
1958  *    `channel'.  Packet sent after calling this function will be secured
1959  *    with `key'.
1960  *
1961  ***/
1962 void silc_client_current_channel_private_key(SilcClient client,
1963                                              SilcClientConnection conn,
1964                                              SilcChannelEntry channel,
1965                                              SilcChannelPrivateKey key);
1966
1967
1968 /* Key Agreement routines (client_keyagr.c) */
1969
1970 /****f* silcclient/SilcClientAPI/silc_client_send_key_agreement
1971  *
1972  * SYNOPSIS
1973  *
1974  *    void silc_client_send_key_agreement(SilcClient client,
1975  *                                        SilcClientConnection conn,
1976  *                                        SilcClientEntry client_entry,
1977  *                                        char *hostname,
1978  *                                        int port,
1979  *                                        SilcUInt32 timeout_secs,
1980  *                                        SilcKeyAgreementCallback completion,
1981  *                                        void *context);
1982  *
1983  * DESCRIPTION
1984  *
1985  *    Sends key agreement request to the remote client indicated by the
1986  *    `client_entry'. If the caller provides the `hostname' and the `port'
1987  *    arguments then the library will bind the client to that hostname and
1988  *    that port for the key agreement protocol. It also sends the `hostname'
1989  *    and the `port' in the key agreement packet to the remote client. This
1990  *    would indicate that the remote client may initiate the key agreement
1991  *    protocol to the `hostname' on the `port'.  If port is zero then the
1992  *    bound port is undefined (the operating system defines it).
1993  *
1994  *    If the `hostname' and `port' is not provided then empty key agreement
1995  *    packet is sent to the remote client. The remote client may reply with
1996  *    the same packet including its hostname and port. If the library receives
1997  *    the reply from the remote client the `key_agreement' client operation
1998  *    callback will be called to verify whether the user wants to perform the
1999  *    key agreement or not. 
2000  *
2001  * NOTES
2002  *
2003  *    NOTE: If the application provided the `hostname' and the `port' and the 
2004  *    remote side initiates the key agreement protocol it is not verified
2005  *    from the user anymore whether the protocol should be executed or not.
2006  *    By setting the `hostname' and `port' the user gives permission to
2007  *    perform the protocol (we are responder in this case).
2008  *
2009  *    NOTE: If the remote side decides not to initiate the key agreement
2010  *    or decides not to reply with the key agreement packet then we cannot
2011  *    perform the key agreement at all. If the key agreement protocol is
2012  *    performed the `completion' callback with the `context' will be called.
2013  *    If remote side decides to ignore the request the `completion' will be
2014  *    called after the specified timeout, `timeout_secs'. 
2015  *
2016  *    NOTE: If the `hostname' and the `port' was not provided the `completion'
2017  *    will not be called at all since this does nothing more than sending
2018  *    a packet to the remote host.
2019  *
2020  *    NOTE: There can be only one active key agreement for one client entry.
2021  *    Before setting new one, the old one must be finished (it is finished
2022  *    after calling the completion callback) or the function 
2023  *    silc_client_abort_key_agreement must be called. 
2024  *
2025  ***/
2026 void silc_client_send_key_agreement(SilcClient client,
2027                                     SilcClientConnection conn,
2028                                     SilcClientEntry client_entry,
2029                                     const char *hostname,
2030                                     const char *bindhost,
2031                                     int port,
2032                                     SilcUInt32 timeout_secs,
2033                                     SilcKeyAgreementCallback completion,
2034                                     void *context);
2035
2036 /****f* silcclient/SilcClientAPI/silc_client_perform_key_agreement
2037  *
2038  * SYNOPSIS
2039  *
2040  *    void 
2041  *    silc_client_perform_key_agreement(SilcClient client,
2042  *                                      SilcClientConnection conn,
2043  *                                      SilcClientEntry client_entry,
2044  *                                      char *hostname,
2045  *                                      int port,
2046  *                                      SilcKeyAgreementCallback completion,
2047  *                                      void *context);
2048  *
2049  * DESCRIPTION
2050  *
2051  *    Performs the actual key agreement protocol. Application may use this
2052  *    to initiate the key agreement protocol. This can be called for example
2053  *    after the application has received the `key_agreement' client operation,
2054  *    and did not return TRUE from it.
2055  *
2056  *    The `hostname' is the remote hostname (or IP address) and the `port'
2057  *    is the remote port. The `completion' callback with the `context' will
2058  *    be called after the key agreement protocol.
2059  *
2060  * NOTES
2061  * 
2062  *    NOTE: If the application returns TRUE in the `key_agreement' client
2063  *    operation the library will automatically start the key agreement. In this
2064  *    case the application must not call this function. However, application
2065  *    may choose to just ignore the `key_agreement' client operation (and
2066  *    merely just print information about it on the screen) and call this
2067  *    function when the user whishes to do so (by, for example, giving some
2068  *    specific command). Thus, the API provides both, automatic and manual
2069  *    initiation of the key agreement. Calling this function is the manual
2070  *    initiation and returning TRUE in the `key_agreement' client operation
2071  *    is the automatic initiation. 
2072  *
2073  ***/
2074 void silc_client_perform_key_agreement(SilcClient client,
2075                                        SilcClientConnection conn,
2076                                        SilcClientEntry client_entry,
2077                                        char *hostname,
2078                                        int port,
2079                                        SilcKeyAgreementCallback completion,
2080                                        void *context);
2081
2082 /****f* silcclient/SilcClientAPI/silc_client_perform_key_agreement_fd
2083  *
2084  * SYNOPSIS
2085  *
2086  *    void
2087  *    silc_client_perform_key_agreement_fd(SilcClient client,
2088  *                                         SilcClientConnection conn,
2089  *                                         SilcClientEntry client_entry,
2090  *                                         int sock,
2091  *                                         char *hostname,
2092  *                                         SilcKeyAgreementCallback completion,
2093  *                                         void *context);
2094  *
2095  * DESCRIPTION
2096  *
2097  *    Same as above but application has created already the connection to 
2098  *    the remote host. The `sock' is the socket to the remote connection. 
2099  *    Application can use this function if it does not want the client library
2100  *    to create the connection. 
2101  *
2102  ***/
2103 void silc_client_perform_key_agreement_fd(SilcClient client,
2104                                           SilcClientConnection conn,
2105                                           SilcClientEntry client_entry,
2106                                           int sock,
2107                                           char *hostname,
2108                                           SilcKeyAgreementCallback completion,
2109                                           void *context);
2110
2111 /****f* silcclient/SilcClientAPI/silc_client_abort_key_agreement
2112  *
2113  * SYNOPSIS
2114  *
2115  *    void silc_client_abort_key_agreement(SilcClient client,
2116  *                                         SilcClientConnection conn,
2117  *                                         SilcClientEntry client_entry);
2118  *
2119  * DESCRIPTION
2120  *
2121  *    This function can be called to unbind the hostname and the port for
2122  *    the key agreement protocol. However, this function has effect only 
2123  *    before the key agreement protocol has been performed. After it has
2124  *    been performed the library will automatically unbind the port. The 
2125  *    `client_entry' is the client to which we sent the key agreement 
2126  *    request.  The key agreement completion callback will be called
2127  *    with SILC_KEY_AGREEMENT_ABORTED status.
2128  *
2129  ***/
2130 void silc_client_abort_key_agreement(SilcClient client,
2131                                      SilcClientConnection conn,
2132                                      SilcClientEntry client_entry);
2133
2134
2135 /* Misc functions */
2136
2137 /****f* silcclient/SilcClientAPI/silc_client_set_away_message
2138  *
2139  * SYNOPSIS
2140  *
2141  *    void silc_client_set_away_message(SilcClient client,
2142  *                                      SilcClientConnection conn,
2143  *                                      char *message);
2144  *
2145  * DESCRIPTION
2146  *
2147  *    Sets away `message'.  The away message may be set when the client's
2148  *    mode is changed to SILC_UMODE_GONE and the client whishes to reply
2149  *    to anyone who sends private message.  The `message' will be sent
2150  *    automatically back to the the client who send private message.  If
2151  *    away message is already set this replaces the old message with the
2152  *    new one.  If `message' is NULL the old away message is removed. 
2153  *    The sender may freely free the memory of the `message'. 
2154  *
2155  ***/
2156 void silc_client_set_away_message(SilcClient client,
2157                                   SilcClientConnection conn,
2158                                   char *message);
2159
2160 /****f* silcclient/SilcClientAPI/SilcConnectionAuthRequest
2161  *
2162  * SYNOPSIS
2163  *
2164  *    typedef void (*SilcConnectionAuthRequest)(SilcClient client,
2165  *                                              SilcClientConnection conn,
2166  *                                              SilcAuthMethod auth_meth,
2167  *                                              void *context);
2168  *
2169  * DESCRIPTION
2170  *
2171  *    Connection authentication method request callback. This is called
2172  *    by the client library after it has received the authentication method
2173  *    that the application requested by calling the function
2174  *    silc_client_request_authentication_method.
2175  *
2176  ***/
2177 typedef void (*SilcConnectionAuthRequest)(SilcClient client,
2178                                           SilcClientConnection conn,
2179                                           SilcAuthMethod auth_meth,
2180                                           void *context);
2181
2182 /****f* silcclient/SilcClientAPI/silc_client_request_authentication_method
2183  *
2184  * SYNOPSIS
2185  *
2186  *    void 
2187  *    silc_client_request_authentication_method(SilcClient client,
2188  *                                              SilcClientConnection conn,
2189  *                                              SilcConnectionAuthRequest 
2190  *                                                callback,
2191  *                                              void *context);
2192  *
2193  * DESCRIPTION
2194  *
2195  *    This function can be used to request the current authentication method
2196  *    from the server. This may be called when connecting to the server
2197  *    and the client library requests the authentication data from the
2198  *    application. If the application does not know the current authentication
2199  *    method it can request it from the server using this function.
2200  *    The `callback' with `context' will be called after the server has
2201  *    replied back with the current authentication method.
2202  *
2203  ***/
2204 void 
2205 silc_client_request_authentication_method(SilcClient client,
2206                                           SilcClientConnection conn,
2207                                           SilcConnectionAuthRequest callback,
2208                                           void *context);
2209
2210 /****d* silcclient/SilcClientAPI/SilcClientMonitorStatus
2211  *
2212  * NAME
2213  *
2214  *    typedef enum { ... } SilcClientMonitorStatus;
2215  *
2216  * DESCRIPTION
2217  *
2218  *    File transmission session status types.  These will indicate
2219  *    the status of the file transmission session.
2220  *
2221  * SOURCE
2222  */
2223 typedef enum {
2224   SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT,    /* In key agreemenet phase */
2225   SILC_CLIENT_FILE_MONITOR_SEND,             /* Sending file */
2226   SILC_CLIENT_FILE_MONITOR_RECEIVE,          /* Receiving file */
2227   SILC_CLIENT_FILE_MONITOR_GET,
2228   SILC_CLIENT_FILE_MONITOR_PUT,
2229   SILC_CLIENT_FILE_MONITOR_CLOSED,           /* Session closed */
2230   SILC_CLIENT_FILE_MONITOR_ERROR,            /* Error during session */
2231 } SilcClientMonitorStatus;
2232 /***/
2233
2234 /****d* silcclient/SilcClientAPI/SilcClientFileError
2235  *
2236  * NAME
2237  *
2238  *    typedef enum { ... } SilcClientFileError;
2239  *
2240  * DESCRIPTION
2241  *
2242  *    File transmission error types.  These types are returned by
2243  *    some of the file transmission functions, and by the monitor
2244  *    callback to indicate error.
2245  *
2246  * SOURCE
2247  */
2248 typedef enum {
2249   SILC_CLIENT_FILE_OK,
2250   SILC_CLIENT_FILE_ERROR,
2251   SILC_CLIENT_FILE_UNKNOWN_SESSION,
2252   SILC_CLIENT_FILE_ALREADY_STARTED,
2253   SILC_CLIENT_FILE_NO_SUCH_FILE,
2254   SILC_CLIENT_FILE_PERMISSION_DENIED,
2255   SILC_CLIENT_FILE_KEY_AGREEMENT_FAILED,
2256 } SilcClientFileError;
2257 /***/
2258
2259 /****f* silcclient/SilcClientAPI/SilcClientFileMonitor
2260  *
2261  * SYNOPSIS
2262  *
2263  *    typedef void (*SilcClientFileMonitor)(SilcClient client,
2264  *                                          SilcClientConnection conn,
2265  *                                          SilcClientMonitorStatus status,
2266  *                                          SilcClientFileError error,
2267  *                                          SilcUInt64 offset,
2268  *                                          SilcUInt64 filesize,
2269  *                                          SilcClientEntry client_entry,
2270  *                                          SilcUInt32 session_id,
2271  *                                          const char *filepath,
2272  *                                          void *context);
2273  *
2274  * DESCRIPTION
2275  *
2276  *    Monitor callback that is called during the file transmission to
2277  *    monitor the transmission process.  The `status' indicates the current
2278  *    monitoring process.  The `error' will indicate the error type
2279  *    if `status' is SILC_CLIENT_FILE_MONITOR_ERROR.  The `offset' is the
2280  *    currently transmitted amount of total `filesize'.  The `client_entry'
2281  *    indicates the remote client, and the transmission session ID is the 
2282  *    `session_id'.  The filename being transmitted is indicated by the 
2283  *    `filepath'.
2284  *
2285  ***/
2286 typedef void (*SilcClientFileMonitor)(SilcClient client,
2287                                       SilcClientConnection conn,
2288                                       SilcClientMonitorStatus status,
2289                                       SilcClientFileError error,
2290                                       SilcUInt64 offset,
2291                                       SilcUInt64 filesize,
2292                                       SilcClientEntry client_entry,
2293                                       SilcUInt32 session_id,
2294                                       const char *filepath,
2295                                       void *context);
2296
2297 /****f* silcclient/SilcClientAPI/silc_client_file_send
2298  *
2299  * SYNOPSIS
2300  *
2301  *    SilcClientFileError 
2302  *    silc_client_file_send(SilcClient client,
2303  *                          SilcClientConnection conn,
2304  *                          SilcClientFileMonitor monitor,
2305  *                          void *monitor_context,
2306  *                          const char *local_ip,
2307  *                          SilcUInt32 local_port,
2308  *                          bool do_not_bind,
2309  *                          SilcClientEntry client_entry,
2310  *                          const char *filepath);
2311  *                          SilcUInt32 *session_id);
2312  *
2313  * DESCRIPTION
2314  *
2315  *    Sends a file indicated by the `filepath' to the remote client 
2316  *    indicated by the `client_entry'.  This will negotiate a secret key
2317  *    with the remote client before actually starting the transmission of
2318  *    the file.  The `monitor' callback will be called to monitor the
2319  *    transmission of the file.
2320  *
2321  *    This returns a file session ID for the file transmission to the
2322  *    `session_id' pointer.  It can be used to close the session (and
2323  *    abort the file transmission) by calling the silc_client_file_close
2324  *    function.  The session ID is also returned in the `monitor' callback. 
2325  *
2326  *    If the `local_ip' is provided then this will try to bind the 
2327  *    listener for key exchange protocol to that IP.  If `local_port' is
2328  *    non-zero that port is used.  If `local_ip' is NULL then this will
2329  *    automatically attempt to bind it to local IP address of the machine.
2330  *    If `do_not_bind' is TRUE then the `local_ip' and `local_port' are
2331  *    ignored and it is expected that the receiver will provide the
2332  *    point of contact.  This is usefull if the sender is behind NAT.
2333  *
2334  *    If error will occur during the file transfer process the error
2335  *    status will be returned in the monitor callback.  In this case
2336  *    the application must call silc_client_file_close to close the
2337  *    session.
2338  *
2339  ***/
2340 SilcClientFileError 
2341 silc_client_file_send(SilcClient client,
2342                       SilcClientConnection conn,
2343                       SilcClientFileMonitor monitor,
2344                       void *monitor_context,
2345                       const char *local_ip,
2346                       SilcUInt32 local_port,
2347                       bool do_not_bind,
2348                       SilcClientEntry client_entry,
2349                       const char *filepath,
2350                       SilcUInt32 *session_id);
2351
2352 /****f* silcclient/SilcClientAPI/silc_client_file_receive
2353  *
2354  * SYNOPSIS
2355  *
2356  *    SilcClientFileError 
2357  *    silc_client_file_receive(SilcClient client,
2358  *                             SilcClientConnection conn,
2359  *                             SilcClientFileMonitor monitor,
2360  *                             void *monitor_context,
2361  *                             const char *path,
2362  *                             SilcUInt32 session_id);
2363  *
2364  * DESCRIPTION
2365  *
2366  *    Receives a file from a client indicated by the `client_entry'.  The
2367  *    `session_id' indicates the file transmission session and it has been
2368  *    received in the `ftp' client operation function.  This will actually
2369  *    perform the key agreement protocol with the remote client before
2370  *    actually starting the file transmission.  The `monitor' callback
2371  *    will be called to monitor the transmission.  If `path' is non NULL
2372  *    the file will be saved into that directory.  If NULL the file is
2373  *    saved in the current working directory.
2374  *
2375  *    If error will occur during the file transfer process the error
2376  *    status will be returned in the monitor callback.  In this case
2377  *    the application must call silc_client_file_close to close the
2378  *    session.
2379  *
2380  ***/
2381 SilcClientFileError 
2382 silc_client_file_receive(SilcClient client,
2383                          SilcClientConnection conn,
2384                          SilcClientFileMonitor monitor,
2385                          void *monitor_context,
2386                          const char *path,
2387                          SilcUInt32 session_id);
2388
2389 /****f* silcclient/SilcClientAPI/silc_client_file_close
2390  *
2391  * SYNOPSIS
2392  *
2393  *    SilcClientFileError silc_client_file_close(SilcClient client,
2394  *                                               SilcClientConnection conn,
2395  *                                               SilcUInt32 session_id);
2396  *
2397  * DESCRIPTION
2398  *
2399  *    Closes file transmission session indicated by the `session_id'.
2400  *    If file transmission is being conducted it will be aborted
2401  *    automatically. This function is also used to close the session
2402  *    after successful file transmission. This function can be used
2403  *    also to reject incoming file transmission request.
2404  *
2405  ***/
2406 SilcClientFileError silc_client_file_close(SilcClient client,
2407                                            SilcClientConnection conn,
2408                                            SilcUInt32 session_id);
2409
2410 /****f* silcclient/SilcClientAPI/silc_client_attribute_add
2411  *
2412  * SYNOPSIS
2413  *
2414  *    SilcAttributePayload
2415  *    silc_client_attribute_add(SilcClient client,
2416  *                              SilcClientConnection conn,
2417  *                              SilcAttribute attribute,
2418  *                              void *object,
2419  *                              SilcUInt32 object_size);
2420  *
2421  * DESCRIPTION
2422  *
2423  *    Add new Requsted Attribute for WHOIS command to the client library.
2424  *    The `attribute' object indicated by `object' is added and allocated
2425  *    SilcAttributePayload is returned.  The `object' must be of correct
2426  *    type and of correct size.  See the SilcAttribute for object types
2427  *    for different attributes.  You may also get all added attributes
2428  *    from the client with silc_client_attributes_get function.
2429  *
2430  *    Requested Attributes are different personal information about the
2431  *    user, status information and other information which other users
2432  *    may query with WHOIS command.  Application may set these so that
2433  *    if someone sends WHOIS query these attributes will be replied back
2434  *    to the sender.  The library always puts the public key to the
2435  *    Requested Attributes, but if application wishes to add additional
2436  *    public keys (or certificates) it can be done with this interface.
2437  *    Library also always computes digital signature of the attributes
2438  *    automatically, so application does not need to do that.
2439  *
2440  ***/
2441 SilcAttributePayload silc_client_attribute_add(SilcClient client,
2442                                                SilcClientConnection conn,
2443                                                SilcAttribute attribute,
2444                                                void *object,
2445                                                SilcUInt32 object_size);
2446
2447 /****f* silcclient/SilcClientAPI/silc_client_attribute_del
2448  *
2449  * SYNOPSIS
2450  *
2451  *    bool silc_client_attribute_del(SilcClient client,
2452  *                                   SilcClientConnection conn,
2453  *                                   SilcAttribute attribute,
2454  *                                   SilcAttributePayload attr);
2455  *
2456  * DESCRIPTION
2457  *
2458  *    Delete a Requested Attribute from the client.  If the `attribute'
2459  *    is non-zero then all attributes of that type are deleted and the
2460  *    `attr' is ignored.  If `attr' is non-NULL then that specific
2461  *    attribute is deleted and `attribute' is ignored.
2462  *    
2463  *    You may get all added attributes with the function
2464  *    silc_client_attributes_get and to get the SilcAttributePayload.
2465  *    This function Returns TRUE if the attribute was found and deleted.
2466  *
2467  ***/
2468 bool silc_client_attribute_del(SilcClient client,
2469                                SilcClientConnection conn,
2470                                SilcAttribute attribute,
2471                                SilcAttributePayload attr);
2472
2473 /****f* silcclient/SilcClientAPI/silc_client_attributes_get
2474  *
2475  * SYNOPSIS
2476  *
2477  *    const SilcHashTable
2478  *    silc_client_attributes_get(SilcClient client,
2479  *                               SilcClientConnection conn);
2480  *
2481  * DESCRIPTION
2482  *
2483  *    Returns pointer to the SilcHashTable which includes all the added
2484  *    Requested Attributes.  The caller must not free the hash table.
2485  *    The caller may use SilcHashTableList and silc_hash_table_list to
2486  *    traverse the table.  Each entry in the hash table is one added
2487  *    SilcAttributePayload.  It is possible to delete a attribute
2488  *    payload while traversing the table.
2489  *
2490  ***/
2491 const SilcHashTable silc_client_attributes_get(SilcClient client,
2492                                                SilcClientConnection conn);
2493
2494 /****f* silcclient/SilcClientAPI/silc_client_attributes_request
2495  *
2496  * SYNOPSIS
2497  *
2498  *    SilcBuffer silc_client_attributes_request(SilcAttribute attribute, ...);
2499  *
2500  * DESCRIPTION
2501  *
2502  *    Constructs a Requested Attributes buffer. If the `attribute' is zero (0)
2503  *    then all attributes are requested.  Alternatively, `attribute' and
2504  *    all variable arguments can each be requested attribute.  In this case
2505  *    the last must be set to zero (0) to complete the variable list of
2506  *    requested attributes.  See SilcAttribute for all attributes.
2507  *    You can give the returned buffer as argument to for example
2508  *    silc_client_get_client_by_id_resolve function.
2509  *
2510  ***/
2511 SilcBuffer silc_client_attributes_request(SilcAttribute attribute, ...);
2512
2513 /* Low level packet sending functions */
2514
2515 /****f* silcclient/SilcClientAPI/silc_client_send_packet
2516  *
2517  * SYNOPSIS
2518  *
2519  *     bool silc_client_send_packet(SilcClient client, 
2520  *                                  SilcClientConnection conn,
2521  *                                  SilcPacketType type, 
2522  *                                  const unsigned char *data, 
2523  *                                  SilcUInt32 data_len);
2524  *
2525  * DESCRIPTION
2526  *
2527  *    This routine can be used by application to send packets directly
2528  *    to a connection indicated by `conn'.  Usually application does not
2529  *    need this routine since the Client Library handles the packet
2530  *    sending.  The `type' indicates the packet type.  If `data' is
2531  *    NULL then empty packet is sent.  This returns FALSE if packet cannot 
2532  *    be sent.
2533  *
2534  ***/
2535 bool silc_client_send_packet(SilcClient client, 
2536                              SilcClientConnection conn,
2537                              SilcPacketType type, 
2538                              const unsigned char *data, 
2539                              SilcUInt32 data_len);
2540
2541 #include "command.h"
2542 #include "command_reply.h"
2543 #include "idlist.h"
2544 #include "protocol.h"
2545
2546 #ifdef __cplusplus
2547 }
2548 #endif
2549
2550 #endif /* SILCCLIENT_H */