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