1 /* $NetBSD: statement.h,v 1.3 2022/04/03 01:10:58 christos Exp $ */ 2 3 /* statement.h 4 5 Definitions for executable statements... */ 6 7 /* 8 * Copyright (C) 2004-2022 Internet Systems Consortium, Inc. ("ISC") 9 * Copyright (c) 1996-2003 by Internet Software Consortium 10 * 11 * This Source Code Form is subject to the terms of the Mozilla Public 12 * License, v. 2.0. If a copy of the MPL was not distributed with this 13 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 16 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 17 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 18 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 20 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 21 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 22 * 23 * Internet Systems Consortium, Inc. 24 * PO Box 360 25 * Newmarket, NH 03857 USA 26 * <info@isc.org> 27 * https://www.isc.org/ 28 * 29 */ 30 31 struct executable_statement { 32 int refcnt; 33 struct executable_statement *next; 34 enum statement_op { 35 null_statement, 36 if_statement, 37 add_statement, 38 eval_statement, 39 break_statement, 40 default_option_statement, 41 supersede_option_statement, 42 append_option_statement, 43 prepend_option_statement, 44 send_option_statement, 45 statements_statement, 46 on_statement, 47 switch_statement, 48 case_statement, 49 default_statement, 50 set_statement, 51 unset_statement, 52 let_statement, 53 define_statement, 54 log_statement, 55 return_statement, 56 execute_statement, 57 vendor_opt_statement 58 } op; 59 union { 60 struct { 61 struct executable_statement *tc, *fc; 62 struct expression *expr; 63 } ie; 64 struct expression *eval; 65 struct expression *retval; 66 struct class *add; 67 struct option_cache *option; 68 struct option_cache *supersede; 69 struct option_cache *prepend; 70 struct option_cache *append; 71 struct executable_statement *statements; 72 struct { 73 int evtypes; 74 # define ON_COMMIT 1 75 # define ON_EXPIRY 2 76 # define ON_RELEASE 4 77 # define ON_TRANSMISSION 8 78 struct executable_statement *statements; 79 } on; 80 struct { 81 struct expression *expr; 82 struct executable_statement *statements; 83 } s_switch; 84 struct expression *c_case; 85 struct { 86 char *name; 87 struct expression *expr; 88 struct executable_statement *statements; 89 } set, let; 90 char *unset; 91 struct { 92 enum { 93 log_priority_fatal, 94 log_priority_error, 95 log_priority_debug, 96 log_priority_info 97 } priority; 98 struct expression *expr; 99 } log; 100 struct { 101 char *command; 102 struct expression *arglist; 103 int argc; 104 } execute; 105 } data; 106 }; 107