1 /* $OpenBSD: parser.h,v 1.3 2024/07/09 17:26:14 yasuoka Exp $ */ 2 3 /* This file is derived from OpenBSD:src/usr.sbin/ikectl/parser.h 1.9 */ 4 /* 5 * Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 #ifndef _RADIUSCTL_PARSER_H 21 #define _RADIUSCTL_PARSER_H 22 23 #include <sys/types.h> 24 #include <sys/time.h> 25 26 enum actions { 27 NONE, 28 TEST, 29 IPCP_SHOW, 30 IPCP_DUMP, 31 IPCP_MONITOR, 32 IPCP_DISCONNECT 33 }; 34 35 enum auth_method { 36 PAP, 37 CHAP, 38 MSCHAPV2 39 }; 40 41 #define TEST_TRIES_MIN 1 42 #define TEST_TRIES_MAX 32 43 #define TEST_TRIES_DEFAULT 3 44 45 #define TEST_INTERVAL_MIN 1 46 #define TEST_INTERVAL_MAX 10 47 #define TEST_INTERVAL_DEFAULT 2 48 49 #define TEST_MAXWAIT_MIN 3 50 #define TEST_MAXWAIT_MAX 60 51 #define TEST_MAXWAIT_DEFAULT 8 52 53 #define FLAGS_JSON 0x01 54 55 struct parse_result { 56 enum actions action; 57 const char *hostname; 58 const char *secret; 59 const char *username; 60 const char *password; 61 u_short port; 62 int nas_port; 63 enum auth_method auth_method; 64 65 /* number of packets to try sending */ 66 unsigned int tries; 67 /* how long between packet sends */ 68 struct timeval interval; 69 /* overall process wait time for a reply */ 70 struct timeval maxwait; 71 72 unsigned flags; 73 unsigned session_seq; 74 }; 75 76 struct parse_result *parse(int, char *[]); 77 78 #endif /* _RADIUSCTL_PARSER_H */ 79