4
* Copyright (c) 2010 Duo Security
5
* All rights reserved, all wrongs reversed.
11
#define DUO_API_HOST "api.duosecurity.com"
14
DUO_OK = 0, /* great success! */
15
DUO_FAIL, /* nice try */
16
DUO_ABORT, /* give up */
17
DUO_LIB_ERROR, /* unexpected library error */
18
DUO_CONN_ERROR, /* problem connecting */
19
DUO_CLIENT_ERROR, /* you screwed up */
20
DUO_SERVER_ERROR, /* we screwed up */
23
#define DUO_FLAG_SYNC (1 << 0) /* no incremental status reporting */
24
#define DUO_FLAG_AUTO (1 << 1) /* use default factor without prompt */
26
typedef struct duo_ctx duo_t;
28
/* Parse INI config file */
29
int duo_parse_config(const char *filename,
30
int (*callback)(void *arg, const char *section,
31
const char *name, const char *val),
34
/* Open Duo API handle */
35
duo_t *duo_open(const char *ikey, const char *skey, const char *progname);
37
/* Override conversation prompt/status functions */
38
void duo_set_conv_funcs(duo_t *d,
39
char *(*conv_prompt)(void *conv_arg, const char *prompt,
40
char *buf, size_t bufsz),
41
void (*conv_status)(void *conv_arg, const char *msg),
44
/* Override default host */
45
void duo_set_host(duo_t *d, const char *hostname);
47
/* Override SSL verification */
48
void duo_set_ssl_verify(duo_t *d, int bool);
50
/* Perform Duo authentication */
51
duo_code_t duo_login(duo_t *d, const char *username,
52
const char *client_ip, int flags);
54
/* Return error message from last API call */
55
const char *duo_geterr(duo_t *d);
57
/* Close API handle. */
58
void duo_close(duo_t *d);