1/* $OpenBSD: npppd_auth.h,v 1.9 2017/08/11 16:41:47 goda Exp $ */ 2 3/*- 4 * Copyright (c) 2009 Internet Initiative Japan Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28#ifndef NPPPD_AUTH_H 29#define NPPPD_AUTH_H 1 30 31#include <netinet/in.h> 32 33/** local authentication realm */ 34#define NPPPD_AUTH_TYPE_LOCAL 1 35/** RADIUS authentication realm */ 36#define NPPPD_AUTH_TYPE_RADIUS 2 37 38struct _npppd_auth_base; 39struct _npppd_auth_radius; 40struct _npppd_auth_local; 41 42/** default type of local authentication realm */ 43typedef struct _npppd_auth_base npppd_auth_base; 44 45/** type of RADIUS authentication realm */ 46typedef struct _npppd_auth_radius npppd_auth_radius; 47typedef struct _npppd_auth_local npppd_auth_local; 48 49/** the type of user account */ 50typedef struct _npppd_auth_user { 51 /** username */ 52 char *username; 53 /** password */ 54 char *password; 55 /** Framed-IP-Address */ 56 struct in_addr framed_ip_address; 57 /** Framed-IP-Netmask */ 58 struct in_addr framed_ip_netmask; 59 /** Calling-Number */ 60 char *calling_number; 61 /** field for space assignment */ 62 char space[0]; 63} npppd_auth_user; 64 65#ifdef __cplusplus 66extern "C" { 67#endif 68 69npppd_auth_base *npppd_auth_create (int, const char *, void *); 70void npppd_auth_dispose (npppd_auth_base *); 71void npppd_auth_destroy (npppd_auth_base *); 72int npppd_auth_reload (npppd_auth_base *); 73int npppd_auth_get_user_password (npppd_auth_base *, const char *, char *, int *); 74int npppd_auth_get_framed_ip (npppd_auth_base *, const char *, struct in_addr *, struct in_addr *); 75int npppd_auth_get_calling_number (npppd_auth_base *, const char *, char *, int *); 76int npppd_auth_get_type (npppd_auth_base *); 77int npppd_auth_is_usable (npppd_auth_base *); 78int npppd_auth_is_ready (npppd_auth_base *); 79int npppd_auth_is_disposing (npppd_auth_base *); 80int npppd_auth_is_eap_capable (npppd_auth_base *); 81const char *npppd_auth_get_name (npppd_auth_base *); 82const char *npppd_auth_get_suffix (npppd_auth_base *); 83const char *npppd_auth_username_for_auth (npppd_auth_base *, const char *, char *); 84void *npppd_auth_radius_get_radius_auth_setting (npppd_auth_radius *); 85void *npppd_auth_radius_get_radius_acct_setting (npppd_auth_radius *); 86int npppd_auth_user_session_unlimited(npppd_auth_base *); 87int npppd_check_auth_user_max_session(npppd_auth_base *, int); 88 89#ifdef __cplusplus 90} 91#endif 92#endif 93