X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/16efd15b675c87d22a4fd9fb12d7bb26f2a36031..2b645fb792c62ae0d38fcde4c39e1bd0889b0e06:/key.h diff --git a/key.h b/key.h index 980c561..8629a57 100644 --- a/key.h +++ b/key.h @@ -1,6 +1,6 @@ /* -*-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 * @@ -30,6 +30,12 @@ /*----- 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. @@ -168,10 +174,10 @@ typedef struct key_fetchdef { /* --- 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 --- */ @@ -252,7 +258,7 @@ extern int key_extract(key_file */*f*/, key */*k*/, FILE */*fp*/, * * 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 * @@ -266,7 +272,7 @@ extern int key_extract(key_file */*f*/, key */*k*/, FILE */*fp*/, * 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@ --- * @@ -303,7 +309,7 @@ extern int key_save(key_file */*f*/); * * 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. * @@ -318,7 +324,8 @@ extern int key_save(key_file */*f*/); * 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 ------------------------------------*/ @@ -370,6 +377,15 @@ extern key *key_new(key_file */*f*/, uint32 /*id*/, const char */*type*/, 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