chiark / gitweb /
Backgrounded commands and RELOAD.
[tripe] / tripe.h
diff --git a/tripe.h b/tripe.h
index 002b3735b61e41a949a56b1820f8b5d7e534ee1c..a358fb91c1d2a908e4f6d3d40f6a30219e7fb337 100644 (file)
--- a/tripe.h
+++ b/tripe.h
@@ -342,30 +342,54 @@ typedef struct obuf {
   char buf[OBUFSZ];                    /* The actual buffer */
 } obuf;
 
+typedef struct oqueue {
+  obuf *hd, *tl;                       /* Head and tail pointers */
+} oqueue;
+
+struct admin;
+
+typedef struct admin_bgop {
+  struct admin_bgop *next, *prev;      /* Links to next and previous */
+  struct admin *a;                     /* Owner job */
+  char *tag;                           /* Tag string for messages */
+  void (*cancel)(struct admin_bgop *); /* Destructor function */
+} admin_bgop;
+
+typedef struct admin_addop {
+  admin_bgop bg;                       /* Background operation header */
+  peerspec peer;                       /* Peer pending creation */
+  char *paddr;                         /* Hostname to be resolved */
+  bres_client r;                       /* Background resolver task */
+  sel_timer t;                         /* Timer for resolver */
+} admin_addop;
+
+typedef struct admin_pingop {
+  admin_bgop bg;                       /* Background operation header */
+  ping ping;                           /* Ping pending response */
+  struct timeval pingtime;             /* Time last ping was sent */
+} admin_pingop;  
+
 typedef struct admin {
   struct admin *next, *prev;           /* Links to next and previous */
   unsigned f;                          /* Various useful flags */
 #ifndef NTRACE
   unsigned seq;                                /* Sequence number for tracing */
 #endif
-  obuf *o_head, *o_tail;               /* Output buffer list */
+  oqueue out;                          /* Output buffer list */
+  oqueue delay;                                /* Delayed output buffer list */
+  admin_bgop *bg;                      /* Backgrounded operations */
   selbuf b;                            /* Line buffer for commands */
   sel_file w;                          /* Selector for write buffering */
-  peerspec peer;                       /* Peer pending creation */
-  char *paddr;                         /* Hostname to be resolved */
-  bres_client r;                       /* Background resolver task */
-  sel_timer t;                         /* Timer for resolver */
-  ping ping;                           /* Ping pending response */
-  struct timeval pingtime;             /* Time last ping was sent */
 } admin;
 
 #define AF_DEAD 1u                     /* Destroy this admin block */
 #define AF_LOCK 2u                     /* Don't destroy it yet */
 #define AF_NOTE 4u                     /* Catch notifications */
+#define AF_WARN 8u                     /* Catch warning messages */
 #ifndef NTRACE
-  #define AF_TRACE 8u                  /* Catch tracing */
+  #define AF_TRACE 16u                 /* Catch tracing */
 #endif
-#define AF_WARN 16u                    /* Catch warning messages */
+#define AF_CLOSE 32u                   /* Client closed connection */
 
 #ifndef NTRACE
 #  define AF_ALLMSGS (AF_NOTE | AF_TRACE | AF_WARN)
@@ -393,16 +417,16 @@ extern unsigned tr_flags;         /* Trace options flags */
 
 /*----- Key management ----------------------------------------------------*/
 
-/* --- @km_interval@ --- *
+/* --- @km_reload@ --- *
  *
  * Arguments:  ---
  *
  * Returns:    Zero if OK, nonzero to force reloading of keys.
  *
- * Use:                Called on the interval timer to perform various useful jobs.
+ * Use:                Checks the keyrings to see if they need reloading.
  */
 
-extern int km_interval(void);
+extern int km_reload(void);
 
 /* --- @km_init@ --- *
  *
@@ -437,6 +461,7 @@ extern int km_getpubkey(const char */*tag*/, ge */*kpub*/,
 /* --- @kx_start@ --- *
  *
  * Arguments:  @keyexch *kx@ = pointer to key exchange context
+ *             @int forcep@ = nonzero to ignore the quiet timer
  *
  * Returns:    ---
  *
@@ -445,7 +470,7 @@ extern int km_getpubkey(const char */*tag*/, ge */*kpub*/,
  *             this); if no exchange is in progress, one is commenced.
  */
 
-extern void kx_start(keyexch */*kx*/);
+extern void kx_start(keyexch */*kx*/, int /*forcep*/);
 
 /* --- @kx_message@ --- *
  *
@@ -806,6 +831,17 @@ extern void p_pingdone(ping */*p*/, int /*rc*/);
 
 extern void p_tun(peer */*p*/, buf */*b*/);
 
+/* --- @p_keyreload@ --- *
+ *
+ * Arguments:  ---
+ *
+ * Returns:    ---
+ *
+ * Use:                Forces a check of the daemon's keyring files.
+ */
+
+extern void p_keyreload(void);
+
 /* --- @p_interval@ --- *
  *
  * Arguments:  ---