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