A LOT updates. Cannot separate. :)
[silc.git] / lib / silcclient / ops.h
index 69eb54e5df1621614f19fd112950b0cf957ddfc1..5c619192c2856dad9c5814ce44cae859de7c9305 100644 (file)
@@ -38,13 +38,13 @@ typedef struct {
   void (*private_message)(SilcClient client, SilcClientConnection conn,
                          char *sender, char *msg);
   void (*notify)(SilcClient client, SilcClientConnection conn, 
-                SilcNotifyType type, char *msg);
+                SilcNotifyType type, ...);
   void (*command)(SilcClient client, SilcClientConnection conn, 
                  SilcClientCommandContext cmd_context, int success,
                  SilcCommand command);
   void (*command_reply)(SilcClient client, SilcClientConnection conn,
                        SilcCommandPayload cmd_payload, int success,
-                       SilcCommand command, ...);
+                       SilcCommand command, SilcCommandStatus status, ...);
   void (*connect)(SilcClient client, SilcClientConnection conn, int success);
   void (*disconnect)(SilcClient client, SilcClientConnection conn);
   int (*get_auth_method)(SilcClient client, SilcClientConnection conn,
@@ -57,6 +57,8 @@ typedef struct {
                           SilcSKEPKType pk_type);
   unsigned char *(*ask_passphrase)(SilcClient client, 
                                   SilcClientConnection conn);
+  void (*failure)(SilcClient client, SilcClientConnection conn, 
+                 SilcProtocol protocol, void *failure);
 } SilcClientOperations;
 
 /* 
@@ -82,11 +84,16 @@ typedef struct {
    sender received in the packet.
 
 
-   void (*notify)(SilcClient client, SilcClientConnection conn, 
-                 SilcNotifyType type, char *msg);
+   void (*notify)(SilcClient client, SilcClientConnection conn, ...);
 
-   Notify message to the client.  The `type' is the notify type received
-   from server.  The `msg' is a human readable message sent by the server.
+   Notify message to the client. The notify arguments are sent in the
+   same order as servers sends them. The arguments are same as received
+   from the server except for ID's.  If ID is received application receives
+   the corresponding entry to the ID. For example, if Client ID is received
+   application receives SilcClientEntry.  Also, if the notify type is
+   for channel the channel entry is sent to application (even if server
+   does not send it because client library gets the channel entry from
+   the Channel ID in the packet's header).
 
 
    void (*command)(SilcClient client, SilcClientConnection conn, 
@@ -105,7 +112,7 @@ typedef struct {
 
    void (*command_reply)(SilcClient client, SilcClientConnection conn,
                         SilcCommandPayload cmd_payload, int success,
-                        SilcCommand command, ...);
+                        SilcCommandStatus status, SilcCommand command, ...);
 
    Command reply handler. This function is called always in the command reply
    function. If error occurs it will be called as well. Normal scenario
@@ -118,9 +125,10 @@ typedef struct {
    if the application would like to re-parse the received command data,
    however, it must be noted that the data is parsed already by the library
    thus the payload can be ignored. `success' is FALSE if error occured.
-   In this case arguments are not sent to the application. `command' is the
-   command reply being processed. The function has variable argument list
-   and each command defines the number and type of arguments it passes to the
+   In this case arguments are not sent to the application. The `status' is
+   the command reply status server returned. The `command' is the command
+   reply being processed. The function has variable argument list and each
+   command defines the number and type of arguments it passes to the
    application (on error they are not sent).
 
 
@@ -165,6 +173,17 @@ typedef struct {
    Ask (interact, that is) a passphrase from user. Returns the passphrase
    or NULL on error. 
 
+
+   void (*failure)(SilcClient client, SilcClientConnection conn, 
+                   SilcProtocol protocol, void *failure);
+
+   Notifies application that failure packet was received.  This is called
+   if there is some protocol active in the client.  The `protocol' is the
+   protocol context.  The `failure' is opaque pointer to the failure
+   indication.  Note, that the `failure' is protocol dependant and application
+   must explicitly cast it to correct type.  Usually `failure' is 32 bit
+   failure type (see protocol specs for all protocol failure types).
+
 */
 
 #endif