#ifndef OTP_H
#define OTP_H
#include <freeradius-devel/ident.h>
RCSIDH(otp_h, "$Id$")
#include <sys/types.h>
#ifndef OTP_MAX_CHALLENGE_LEN
#define OTP_MAX_CHALLENGE_LEN 16
#elif OTP_MAX_CHALLENGE_LEN != 16
#error OTP_MAX_CHALLENGE_LEN
#endif
#define OTP_RC_OK 0
#define OTP_RC_USER_UNKNOWN 1
#define OTP_RC_AUTHINFO_UNAVAIL 2
#define OTP_RC_AUTH_ERR 3
#define OTP_RC_MAXTRIES 4
#define OTP_RC_SERVICE_ERR 5
#define OTP_RC_NEXTPASSCODE 6
#define OTP_RC_IPIN 7
#define OTP_MAX_USERNAME_LEN 31
#define OTP_MAX_PASSCODE_LEN 47
#define OTP_MAX_CHAP_CHALLENGE_LEN 16
#define OTP_MAX_CHAP_RESPONSE_LEN 50
typedef enum otp_pwe_t {
PWE_PAP = 1,
PWE_CHAP = 3,
PWE_MSCHAP = 5,
PWE_MSCHAP2 = 7,
} otp_pwe_t;
typedef struct otp_request_t {
int version;
char username[OTP_MAX_USERNAME_LEN + 1];
char challenge[OTP_MAX_CHALLENGE_LEN + 1];
struct {
otp_pwe_t pwe;
union {
struct {
char passcode[OTP_MAX_PASSCODE_LEN + 1];
} pap;
struct {
unsigned char challenge[OTP_MAX_CHAP_CHALLENGE_LEN];
size_t clen;
unsigned char response[OTP_MAX_CHAP_RESPONSE_LEN];
size_t rlen;
} chap;
} u;
} pwe;
int allow_async;
int allow_sync;
unsigned challenge_delay;
int resync;
} otp_request_t;
typedef struct otp_reply_t {
int version;
int rc;
char passcode[OTP_MAX_PASSCODE_LEN + 1];
} otp_reply_t;
#endif