1/* $OpenBSD: radiusd_ipcp.h,v 1.1 2024/07/09 17:26:14 yasuoka Exp $ */ 2 3/* 4 * Copyright (c) 2024 Internet Initiative Japan Inc. 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19#ifndef RADIUSD_IPCP_H 20#define RADIUSD_IPCP_H 1 21 22#include <netinet/in.h> 23#include <stdint.h> 24 25#include "radiusd.h" 26 27enum imsg_module_ipcp_type { 28 IMSG_RADIUSD_MODULE_IPCP_DUMP = IMSG_RADIUSD_MODULE_MIN, 29 IMSG_RADIUSD_MODULE_IPCP_MONITOR, 30 IMSG_RADIUSD_MODULE_IPCP_DUMP_AND_MONITOR, 31 IMSG_RADIUSD_MODULE_IPCP_START, 32 IMSG_RADIUSD_MODULE_IPCP_STOP, 33 IMSG_RADIUSD_MODULE_IPCP_DISCONNECT 34}; 35 36#define _PATH_RADIUSD_IPCP_DB "/var/run/radiusd_ipcp.db" 37 38struct radiusd_ipcp_db_record { 39 unsigned seq; 40 char session_id[256]; 41 char auth_method[16]; 42 char username[256]; 43 struct timespec start; /* Start time in boottime */ 44 struct timespec timeout;/* Timeout time in boottime */ 45 struct in_addr nas_ipv4; 46 struct in6_addr nas_ipv6; 47 char nas_id[256]; 48 char tun_type[8]; 49 union { 50 struct sockaddr_in sin4; 51 struct sockaddr_in6 sin6; 52 } tun_client; 53}; 54 55struct radiusd_ipcp_db_dump { 56 int islast; 57 struct { 58 int af; 59 union { 60 struct in_addr ipv4; 61 struct in6_addr ipv6; 62 } addr; 63 struct radiusd_ipcp_db_record 64 rec; 65 } records[0]; 66}; 67 68struct radiusd_ipcp_statistics { 69 uint32_t ipackets; 70 uint32_t opackets; 71 uint64_t ibytes; 72 uint64_t obytes; 73 char cause[80]; 74}; 75#endif 76