Initial "gts1" commit.
[tac_plus.git] / choose_authen.h
diff --git a/choose_authen.h b/choose_authen.h
new file mode 100644 (file)
index 0000000..1276494
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef CHOOSE_AUTHEN_H
+#define CHOOSE_AUTHEN_H 1
+
+#include "tac_plus.h"
+
+#include <sys/types.h>         /* for u_* */
+
+
+/*
+ * This structure describes an authentication method.
+ *   authen_name     contains the name of the authentication method.
+ *   authen_func     is a pointer to the authentication function.
+ *   authen_method   numeric value of authentication method
+ */
+
+#define AUTHEN_NAME_SIZE 128
+
+struct authen_data;
+
+struct authen_type {
+    char authen_name[AUTHEN_NAME_SIZE];
+    int (*authen_func) TAC_ARGS((struct authen_data *data));
+    int authen_type;
+};
+
+/*
+ * The authen_data structure is the data structure for passing
+ * information to and from the authentication function
+ * (authen_type.authen_func).
+ */
+
+struct authen_data {
+    struct identity *NAS_id;   /* user identity */
+    char *server_msg;          /* null-terminated output msg */
+
+    int server_dlen;           /* output data length */
+    unsigned char *server_data;        /* output data */
+
+    char *client_msg;          /* null-terminated input msg a user typed */
+
+    int client_dlen;           /* input data length */
+    char *client_data;         /* input data */
+
+    void *method_data;         /* opaque private method data */
+    int action;                        /* what's to be done */
+    int service;               /* calling service */
+    int status;                        /* Authen status */
+    int type;                  /* Authen type */
+    u_char flags;               /* input & output flags fields */
+};
+
+/* return values for  choose_authen(); */
+
+#define CHOOSE_FAILED -1     /* failed to choose an authentication function */
+#define CHOOSE_OK      0     /* successfully chose an authentication function */
+#define CHOOSE_GETUSER 1     /* need a username before choosing */
+#define CHOOSE_BADTYPE 2     /* Invalid preferred authen function specified */
+
+
+extern int choose_authen TAC_ARGS((struct authen_data *data, struct authen_type *type));
+
+
+#endif /* CHOOSE_AUTHEN_H */