xref: /titanic_50/usr/src/cmd/tnf/prex/cmd.h (revision 1cb6af97c6f66f456d4f726ef056e1ebc0f73305)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1994, by Sun Microsytems, Inc.
24  */
25 
26 #ifndef _CMD_H
27 #define	_CMD_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Includes
33  */
34 
35 #include <sys/types.h>
36 #include "queue.h"
37 #include "expr.h"
38 #include "set.h"
39 #include "fcn.h"
40 
41 #include <tnf/tnfctl.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * Typedefs
49  */
50 
51 typedef enum cmd_kind {
52 	CMD_ENABLE,
53 	CMD_DISABLE,
54 	CMD_CONNECT,
55 	CMD_CLEAR,
56 	CMD_TRACE,
57 	CMD_UNTRACE
58 } cmd_kind_t;
59 
60 typedef struct cmd {
61 	queue_node_t	qn;
62 	boolean_t	isnamed;
63 	boolean_t	isnew;
64 	union {
65 #ifdef LATEBINDSETS
66 		char		*setname_p;
67 #endif
68 		expr_t		*expr_p;
69 	} expr;
70 	char		*fcnname_p;
71 	cmd_kind_t	kind;
72 } cmd_t;
73 
74 typedef
75 tnfctl_errcode_t (*cmd_traverse_func_t) (
76 					expr_t * expr_p,
77 					cmd_kind_t kind,
78 					fcn_t * fcn_p,
79 					boolean_t isnew,
80 					void *calldata_p);
81 
82 
83 /*
84  * Declarations
85  */
86 
87 cmd_t *cmd_set(char *setname_p, cmd_kind_t kind, char *fcnname_p);
88 cmd_t *cmd_expr(expr_t * expr_p, cmd_kind_t kind, char *fcnname_p);
89 void cmd_list(void);
90 #if 0
91 void cmd_mark(void);
92 void cmd_delete(int cmdnum);
93 #endif
94 tnfctl_errcode_t cmd_traverse(cmd_traverse_func_t percmdfunc, void *calldata_p);
95 tnfctl_errcode_t cmd_callback(cmd_t *cmd, cmd_traverse_func_t percmdfunc,
96 	void *calldata_p);
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* _CMD_H */
103