xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_tab.h (revision 72a1114b)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2013 by Delphix. All rights reserved.
23  * Copyright (c) 2012 Joyent, Inc. All rights reserved.
24  */
25 /*
26  * This file contains mdb private tab completion related functions. Public
27  * functions for modules are put into the module API, see mdb_modapi.h. Note
28  * that the mdb_ctf_id_t value is private to mdb and not a part of the module
29  * api, hence it has to stay in here.
30  */
31 
32 #ifndef	_MDB_TAB_H
33 #define	_MDB_TAB_H
34 
35 #include <sys/types.h>
36 #include <mdb/mdb_ctf.h>
37 #include <mdb/mdb_nv.h>
38 #include <mdb/mdb_modapi.h>
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 #ifdef	_MDB
45 
46 struct mdb_tab_cookie {
47 	mdb_nv_t	mtc_nv;
48 	char		mtc_match[MDB_SYM_NAMLEN];
49 	char		mtc_base[MDB_SYM_NAMLEN];
50 	void		*mtc_cba;
51 };
52 
53 extern mdb_tab_cookie_t *mdb_tab_init(void);
54 extern size_t mdb_tab_size(mdb_tab_cookie_t *);
55 extern const char *mdb_tab_match(mdb_tab_cookie_t *);
56 extern void mdb_tab_print(mdb_tab_cookie_t *);
57 extern void mdb_tab_fini(mdb_tab_cookie_t *);
58 extern int mdb_tab_complete_global(mdb_tab_cookie_t *, const char *);
59 extern int mdb_tab_complete_dcmd(mdb_tab_cookie_t *, const char *);
60 extern int mdb_tab_complete_walker(mdb_tab_cookie_t *, const char *);
61 extern int mdb_tab_complete_member_by_id(mdb_tab_cookie_t *, mdb_ctf_id_t,
62     const char *);
63 extern int mdb_tab_command(mdb_tab_cookie_t *, const char *);
64 
65 #endif	/* _MDB */
66 
67 #ifdef	__cplusplus
68 }
69 #endif
70 
71 #endif /* _MDB_TAB_H */
72