1 /*- 2 * Copyright (c) 2009 Internet Initiative Japan Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 #ifndef NPPPD_H 27 #define NPPPD_H 1 28 29 30 #ifndef NPPPD_DEFAULT_TUN_IFNAME 31 #define NPPPD_DEFAULT_TUN_IFNAME "tun0" 32 #endif 33 34 35 #define DEFAULT_RADIUS_AUTH_IPADDR "127.0.0.1" 36 #define DEFAULT_RADIUS_AUTH_PORT 1812 37 #define DEFAULT_RADIUS_AUTH_TIMEOUT 9 38 39 #define DEFAULT_AUTH_TIMEOUT 30 40 41 /** ���������� */ 42 #define NPPPD_IP_ASSIGN_FIXED 0x0001 43 44 /** ��������Ƥ������ɥ쥹���������� */ 45 #define NPPPD_IP_ASSIGN_USER_SELECT 0x0002 46 47 /** RADIUS �� Framed-IP-Address ��Ȥ� */ 48 #define NPPPD_IP_ASSIGN_RADIUS 0x0004 49 50 /** sockaddr_npppd */ 51 struct sockaddr_npppd { 52 struct sockaddr_in sin4; 53 struct sockaddr_in sin4mask; 54 #define snp_len sin4.sin_len 55 #define snp_family sin4.sin_family 56 #define snp_addr sin4.sin_addr 57 int snp_type; /* SNP_POOL or SNP_PPP */ 58 #define snp_mask sin4mask.sin_addr 59 /** ���Υ���ȥ� */ 60 struct sockaddr_npppd *snp_next; 61 /** ����ȥ����� */ 62 void *snp_data_ptr; 63 }; 64 #define SNP_POOL 1 65 #define SNP_DYN_POOL 2 66 #define SNP_PPP 3 67 68 typedef struct _npppd npppd; 69 70 #include "ppp.h" 71 72 #ifdef __cplusplus 73 extern "C" { 74 #endif 75 76 77 npppd *npppd_get_npppd (void); 78 int npppd_init (npppd *, const char *); 79 void npppd_stop (npppd *); 80 void npppd_fini (npppd *); 81 int npppd_prepare_ip (npppd *, npppd_ppp *); 82 void npppd_release_ip (npppd *, npppd_ppp *); 83 int nppp_load_user_setting(npppd *, npppd_ppp *); 84 void npppd_set_ip_enabled (npppd *, npppd_ppp *, int); 85 int npppd_get_user_password (npppd *, npppd_ppp *, const char *, char *, int *); 86 struct in_addr *npppd_get_user_framed_ip_address(npppd *, npppd_ppp *, const char *); 87 int npppd_check_calling_number (npppd *, npppd_ppp *); 88 void npppd_network_output (npppd *, npppd_ppp *, int, u_char *, int); 89 void npppd_network_input (npppd *, uint8_t *, int); 90 npppd_ppp *npppd_get_ppp_by_ip (npppd *, struct in_addr); 91 slist *npppd_get_ppp_by_user (npppd *, const char *); 92 int npppd_check_user_max_session(npppd *, npppd_ppp *); 93 int npppd_get_all_users (npppd *, slist *); 94 int npppd_set_radish (npppd *, void *); 95 int npppd_ppp_iface_is_ready(npppd *, npppd_ppp *); 96 int sockaddr_npppd_match(void *, void *); 97 npppd_ppp *npppd_get_ppp_by_id(npppd *, int); 98 99 const char *npppd_config_str (npppd *, const char *); 100 int npppd_config_int (npppd *, const char *, int); 101 int npppd_config_str_equal (npppd *, const char *, const char *, int); 102 int npppd_config_str_equali (npppd *, const char *, const char *, int); 103 int npppd_modules_reload (npppd *); 104 int npppd_ifaces_load_config(npppd *); 105 int npppd_reload_config (npppd *); 106 int npppd_assign_ip_addr (npppd *, npppd_ppp *, uint32_t); 107 void npppd_release_ip_addr (npppd *, npppd_ppp *); 108 109 int npppd_ppp_bind_realm(npppd *, npppd_ppp *, const char *, int); 110 int npppd_ppp_is_realm_local(npppd *, npppd_ppp *); 111 int npppd_ppp_is_realm_radius(npppd *, npppd_ppp *); 112 int npppd_ppp_is_realm_ready(npppd *, npppd_ppp *); 113 const char *npppd_ppp_get_realm_name(npppd *, npppd_ppp *); 114 int npppd_ppp_bind_iface(npppd *, npppd_ppp *); 115 void npppd_ppp_unbind_iface(npppd *, npppd_ppp *); 116 const char *npppd_ppp_get_iface_name(npppd *, npppd_ppp *); 117 void npppd_radius_server_failure_notify(npppd *, npppd_ppp *, void *, const char *); 118 int npppd_ppp_pipex_enable(npppd *, npppd_ppp *); 119 int npppd_ppp_pipex_disable(npppd *, npppd_ppp *); 120 const char *npppd_ppp_get_username_for_auth(npppd *, npppd_ppp *, const char *, char *); 121 int npppd_reset_routing_table(npppd *, int); 122 #ifdef __cplusplus 123 } 124 #endif 125 #endif 126