1 /* $OpenBSD: parser.h,v 1.29 2014/02/04 15:22:39 eric Exp $ */ 2 3 /* 4 * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> 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 enum { 20 P_TOKEN, 21 P_STR, 22 P_INT, 23 P_MSGID, 24 P_EVPID, 25 P_ROUTEID, 26 P_ADDR, 27 }; 28 29 struct parameter { 30 int type; 31 union { 32 const char *u_str; 33 int u_int; 34 uint32_t u_msgid; 35 uint64_t u_evpid; 36 uint64_t u_routeid; 37 struct sockaddr_storage u_ss; 38 } u; 39 }; 40 41 int cmd_install(const char *, int (*)(int, struct parameter *)); 42 int cmd_run(int, char **); 43 int cmd_show_params(int argc, struct parameter *argv); 44