xref: /illumos-gate/usr/src/lib/libnisdb/yptol/shim_hooks.h (revision 012e6ce759c490003aed29439cc47d3d73a99ad3)
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 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	__SHIM_HOOKS_H
28 #define	__SHIM_HOOKS_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * DESCRIPTION: This file implements the hooks between old style DBM calls and
36  *              the shim version of the same calls. By including this file a
37  *              C files calls are diverted to the shim versions.
38  *
39  *		Do NOT include this in the shim code itself or you will be
40  *		unable to make real dbm calls.
41  *
42  *		Do NOT include this in the client side NIS files.
43  *
44  *		One day it may be possible to implement a more elegant version
45  *		of this based on the linkers 'interposition' mechanism.
46  */
47 
48 /*
49  * Extern defs for new calls. Must have identical args to traditional version.
50  */
51 extern void 	shim_dbm_close(DBM *db);
52 extern int 	shim_dbm_delete(DBM *db, datum key);
53 extern datum 	shim_dbm_fetch(DBM *db, datum key);
54 extern datum 	shim_dbm_fetch_noupdate(DBM *db, datum key);
55 extern datum	shim_dbm_firstkey(DBM *db);
56 extern datum 	shim_dbm_nextkey(DBM *db);
57 extern datum 	shim_dbm_do_nextkey(DBM *db, datum inkey);
58 extern DBM 	*shim_dbm_open(const  char  *file,  int  open_flags,
59 				mode_t file_mode);
60 extern int  	shim_dbm_store(DBM  *db,  datum  key,  datum  content,
61 				int store_mode);
62 void		shim_exit(int code);
63 
64 /*
65  * Externs for other function related to maps
66  */
67 extern char	*get_map_name(DBM *);
68 
69 /*
70  * Hooks. Alias standard dbm call names to new calls
71  */
72 
73 #define	dbm_close	shim_dbm_close
74 #define	dbm_delete	shim_dbm_delete
75 #define	dbm_fetch	shim_dbm_fetch
76 #define	dbm_firstkey	shim_dbm_firstkey
77 #define	dbm_nextkey	shim_dbm_nextkey
78 #define	dbm_do_nextkey	shim_dbm_do_nextkey
79 #define	dbm_open	shim_dbm_open
80 #define	dbm_store	shim_dbm_store
81 #define	exit		shim_exit
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* __SHIM_HOOKS_H */
88