jcs's openbsd hax
openbsd
at jcs 80 lines 2.0 kB view raw
1/* $OpenBSD: parser.h,v 1.5 2024/09/15 05:26:05 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 26enum actions { 27 NONE, 28 TEST, 29 IPCP_SHOW, 30 IPCP_DUMP, 31 IPCP_MONITOR, 32 IPCP_DELETE, 33 IPCP_DISCONNECT 34}; 35 36enum auth_method { 37 PAP, 38 CHAP, 39 MSCHAPV2 40}; 41 42#define TEST_TRIES_MIN 1 43#define TEST_TRIES_MAX 32 44#define TEST_TRIES_DEFAULT 3 45 46#define TEST_INTERVAL_MIN 1 47#define TEST_INTERVAL_MAX 10 48#define TEST_INTERVAL_DEFAULT 2 49 50#define TEST_MAXWAIT_MIN 3 51#define TEST_MAXWAIT_MAX 60 52#define TEST_MAXWAIT_DEFAULT 8 53 54#define FLAGS_JSON 0x01 55 56struct parse_result { 57 enum actions action; 58 const char *hostname; 59 const char *secret; 60 const char *username; 61 const char *password; 62 u_short port; 63 int nas_port; 64 int msgauth; 65 enum auth_method auth_method; 66 67 /* number of packets to try sending */ 68 unsigned int tries; 69 /* how long between packet sends */ 70 struct timeval interval; 71 /* overall process wait time for a reply */ 72 struct timeval maxwait; 73 74 unsigned flags; 75 unsigned session_seq; 76}; 77 78struct parse_result *parse(int, char *[]); 79 80#endif /* _RADIUSCTL_PARSER_H */