next up previous contents
Next: Per-type functions that are Up: Key table functions Previous: Key table functions   Contents

The krb5_kt_ops structure

In order to implement a new key table type, the programmer should declare a krb5_kt_ops structure, and fill in the elements of the structure appropriately, by implementing each of the key table functions for the new key table type.

In order to reduce the size of binary programs when static linking is used, it is common to provide two krb5_kt_ops structures for each key table type, one for reading only in which the pointers to the add and delete functions are zero, and one for reading and writing.

typedef struct _krb5_kt_ops {
	char *prefix;
        /* routines always present */
	krb5_error_code (*resolve)((char *,
					  krb5_keytab *));
	krb5_error_code (*get_name)((krb5_keytab,
					  char *,
					  int));
	krb5_error_code (*close)((krb5_keytab));
	krb5_error_code (*get)((krb5_keytab,
					  krb5_principal,
					  krb5_kvno,
					  krb5_keytab_entry *));
	krb5_error_code (*start_seq_get)((krb5_keytab,
					  krb5_kt_cursor *));	
	krb5_error_code (*get_next)((krb5_keytab,
					  krb5_keytab_entry *,
					  krb5_kt_cursor *));
	krb5_error_code (*end_get)((krb5_keytab,
					  krb5_kt_cursor *));
	/* routines to be included on extended version (write routines) */
	krb5_error_code (*add)((krb5_keytab,
					  krb5_keytab_entry *));
	krb5_error_code (*remove)((krb5_keytab,
					  krb5_keytab_entry *));
} krb5_kt_ops;



Autobuild 2009-09-05