import from HEAD:
[freeradius.git] / src / modules / rlm_otp / otp_pw_valid.h
1 /*
2  * $Id$
3  *
4  *   This program is free software; you can redistribute it and/or modify
5  *   it under the terms of the GNU General Public License as published by
6  *   the Free Software Foundation; either version 2 of the License, or
7  *   (at your option) any later version.
8  *
9  *   This program is distributed in the hope that it will be useful,
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *   GNU General Public License for more details.
13  *
14  *   You should have received a copy of the GNU General Public License
15  *   along with this program; if not, write to the Free Software
16  *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  *
18  * Copyright 2006 TRI-D Systems, Inc.
19  */
20
21 #ifndef OTP_PW_VALID_H
22 #define OTP_PW_VALID_H
23
24 #include <pthread.h>
25 #include <sys/types.h>
26 #include "extern.h"     /* otp_option_t */
27 #include "otp.h"        /* otp_request_t, otp_reply_t */
28
29 typedef struct otp_fd_t {
30   pthread_mutex_t       mutex;
31   const char            *path;  /* allows diff instances to use diff otpds */
32   int                   fd;
33   struct otp_fd_t       *next;
34 } otp_fd_t;
35
36 static int otprc2rlmrc(int);
37 static int otp_verify(const otp_option_t *,
38                       const otp_request_t *, otp_reply_t *);
39 static int otp_read(otp_fd_t *, char *, size_t);
40 static int otp_write(otp_fd_t *, const char *, size_t);
41 static int otp_connect(const char *);
42 static otp_fd_t *otp_getfd(const otp_option_t *);
43 static void otp_putfd(otp_fd_t *, int);
44
45 #endif /* OTP_PW_VALID_H */