Integer type name change.
[silc.git] / apps / silcd / server_backup.h
index 25fe49dbb33dfdd3f7ffb86e8e37128f215e2f38..d8a2ab3d10467c7fed46036bf74fb68d0660833a 100644 (file)
 #ifndef SERVER_BACKUP_H
 #define SERVER_BACKUP_H
 
+/* Backup resuming protocol types */
+#define SILC_SERVER_BACKUP_START            1
+#define SILC_SERVER_BACKUP_START_GLOBAL     2
+#define SILC_SERVER_BACKUP_CONNECTED        3
+#define SILC_SERVER_BACKUP_ENDING           4
+#define SILC_SERVER_BACKUP_RESUMED          5
+#define SILC_SERVER_BACKUP_RESUMED_GLOBAL   6
+#define SILC_SERVER_BACKUP_REPLACED         20
+
 /* Adds the `backup_server' to be one of our backup router. This can be
-   called multiple times to set multiple backup routers. If `local' is
-   TRUE then the `backup_server' is in the local cell, if FALSE it is
-   in some other cell. */
+   called multiple times to set multiple backup routers. The `replacing' is
+   the IP and port that the `backup_router' will replace if the `replacing'
+   will become unresponsive. If `local' is TRUE then the `backup_server' is
+   in the local cell, if FALSE it is in some other cell. */
 void silc_server_backup_add(SilcServer server, SilcServerEntry backup_server,
-                           bool local);
+                           const char *ip, int port, bool local);
 
-/* Returns the first backup router context. Returns NULL if we do not have
-   any backup servers. This removes the returned server from being 
-   backup router and needs to be added later with silc_server_backup_add
-   if it needs to be backup router again. */
-SilcServerEntry silc_server_backup_get(SilcServer server);
+/* Returns backup router for IP and port in `replacing' or NULL if there
+   does not exist backup router. */
+SilcServerEntry silc_server_backup_get(SilcServer server, 
+                                      SilcServerID *server_id);
 
-/* Deletes the backup server `server_entry. */
-void silc_server_backup_del(SilcServer server, 
-                           SilcServerEntry server_entry);
+/* Deletes the backup server `server_entry'. */
+void silc_server_backup_del(SilcServer server, SilcServerEntry server_entry);
 
 /* Marks the IP address and port from the `server_id' as  being replaced
    by backup router indicated by the `server'. If the router connects at
@@ -53,10 +61,9 @@ bool silc_server_backup_replaced_get(SilcServer server,
                                     SilcServerID *server_id,
                                     SilcServerEntry *server_entry);
 
-/* Deletes the IP address and port from the `server_id' from being replaced
-   by an backup router. */
+/* Deletes a replaced host by the set `server_entry. */
 void silc_server_backup_replaced_del(SilcServer server,
-                                    SilcServerID *server_id);
+                                    SilcServerEntry server_entry);
 
 /* Broadcast the received packet indicated by `packet' to all of our backup 
    routers. All router wide information is passed using broadcast packets. 
@@ -80,7 +87,7 @@ void silc_server_backup_send(SilcServer server,
                             SilcPacketType type,
                             SilcPacketFlags flags,
                             unsigned char *data,
-                            uint32 data_len,
+                            SilcUInt32 data_len,
                             bool force_send,
                             bool local);
 
@@ -95,7 +102,7 @@ void silc_server_backup_send_dest(SilcServer server,
                                  void *dst_id,
                                  SilcIdType dst_id_type,
                                  unsigned char *data,
-                                 uint32 data_len,
+                                 SilcUInt32 data_len,
                                  bool force_send,
                                  bool local);
 
@@ -110,7 +117,7 @@ void silc_server_backup_resume_router(SilcServer server,
    `ip' and `port'. The `connected' callback will be called when the
    connection is created. */
 void silc_server_backup_reconnect(SilcServer server,
-                                 const char *ip, uint16 port,
+                                 const char *ip, SilcUInt16 port,
                                  SilcServerConnectRouterCallback callback,
                                  void *context);