/* -*-c-*-
*
- * $Id: key.h,v 1.7 2000/12/06 20:33:27 mdw Exp $
+ * $Id: key.h,v 1.9 2001/06/22 19:37:59 mdw Exp $
*
* Simple key management
*
/*----- Revision history --------------------------------------------------*
*
* $Log: key.h,v $
+ * Revision 1.9 2001/06/22 19:37:59 mdw
+ * New interface to enquire whether a key has expired.
+ *
+ * Revision 1.8 2001/02/03 11:57:38 mdw
+ * Allow creating keyfiles with no file attached.
+ *
* Revision 1.7 2000/12/06 20:33:27 mdw
* Make flags be macros rather than enumerations, to ensure that they're
* unsigned.
/* --- File opening options --- */
-enum {
- KOPEN_READ,
- KOPEN_WRITE
-};
+#define KOPEN_READ 0u
+#define KOPEN_WRITE 1u
+#define KOPEN_MASK 0xff
+#define KOPEN_NOFILE 0x100
/* --- Various other magic numbers --- */
*
* Arguments: @key_file *f@ = pointer to file structure to initialize
* @const char *file@ = pointer to the file name
- * @int how@ = opening options (@KOPEN_*@).
+ * @unsigned how@ = opening options (@KOPEN_*@).
* @key_reporter *rep@ = error reporting function
* @void *arg@ = argument for function
*
* owner only.
*/
-extern int key_open(key_file */*f*/, const char */*file*/, int /*how*/,
+extern int key_open(key_file */*f*/, const char */*file*/, unsigned /*how*/,
key_reporter */*rep*/, void */*arg*/);
/* --- @key_close@ --- *
*
* Arguments: @key_file *f@ = pointer to file structure to initialize
* @const char *file@ = pointer to the file name
- * @int how@ = opening options (@KOPEN_*@).
+ * @unsigned how@ = opening options (@KOPEN_*@).
*
* Returns: Zero if it worked, nonzero otherwise.
*
* for the private use of @key_open@.
*/
-extern int key_lockfile(key_file */*f*/, const char */*file*/, int /*how*/);
+extern int key_lockfile(key_file */*f*/, const char */*file*/,
+ unsigned /*how*/);
/*----- Creating and manipulating keys ------------------------------------*/
extern int key_delete(key_file */*f*/, key */*k*/);
+/* --- @key_expired@ --- *
+ *
+ * Arguments: @key *k@ = pointer to key block
+ *
+ * Returns: Zero if the key is OK, nonzero if it's expired.
+ */
+
+int key_expired(key */*k*/);
+
/* --- @key_expire@ --- *
*
* Arguments: @key_file *f@ = pointer to file block