1 /*	$NetBSD: statement.h,v 1.1.1.3 2014/07/12 11:57:56 spz Exp $	*/
2 /* statement.h
3 
4    Definitions for executable statements... */
5 
6 /*
7  * Copyright (c) 2004,2007,2009,2014 by Internet Systems Consortium, Inc. ("ISC")
8  * Copyright (c) 1996-2003 by Internet Software Consortium
9  *
10  * Permission to use, copy, modify, and distribute this software for any
11  * purpose with or without fee is hereby granted, provided that the above
12  * copyright notice and this permission notice appear in all copies.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
15  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
17  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
20  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  *
22  *   Internet Systems Consortium, Inc.
23  *   950 Charter Street
24  *   Redwood City, CA 94063
25  *   <info@isc.org>
26  *   https://www.isc.org/
27  *
28  */
29 
30 struct executable_statement {
31 	int refcnt;
32 	struct executable_statement *next;
33 	enum statement_op {
34 		null_statement,
35 		if_statement,
36 		add_statement,
37 		eval_statement,
38 		break_statement,
39 		default_option_statement,
40 		supersede_option_statement,
41 		append_option_statement,
42 		prepend_option_statement,
43 		send_option_statement,
44 		statements_statement,
45 		on_statement,
46 		switch_statement,
47 		case_statement,
48 		default_statement,
49 		set_statement,
50 		unset_statement,
51 		let_statement,
52 		define_statement,
53 		log_statement,
54 		return_statement,
55 		execute_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