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.
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.
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]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #pragma ident "%Z%%M% %I% %E% SMI"
36 * DESCRIPTION: Shim header information not relating to hooks
41 * Structure for holding all the information relating to one map. These will
42 * probably end up in shared memory so everyone can get at them.
44 * DBM pointers are non NULL only while the file is open.
47 /* These are used in all modes */
48 DBM
*entries
; /* NIS entry DBM file */
49 int hash_val
; /* Hash of name (to save repeated rehashing) */
54 * There is some duplication of information here but this enables these
55 * strings to be worked out once (when the map_ctrl is created) rather
56 * than many times as it is used.
58 char *map_name
; /* Name of map, unqualified */
59 char *domain
; /* Domain name */
60 char *map_path
; /* Full qualified path to map */
62 /* These are used only in N2L mode */
63 DBM
*ttl
; /* TTL DBM file */
64 char *ttl_path
; /* Full qualified path to TTL file */
65 char *trad_map_path
; /* Equivalent qualified traditional map name */
66 datum key_data
; /* See NOTE at top of shim.c */
68 /* Open parameters (in case of reopen ) */
72 int magic
; /* Check that this really is a map_ctrl */
75 #define MAP_MAGIC 0x09876543
78 * Structure for holding unique map IDs.
79 * Used for locking purposes, in N2L mode only.
81 typedef struct map_id_elt
{
84 struct map_id_elt
*next
;
88 * Success and failure codes the same as used by DBM
95 * Extern defs for new DBM calls. Must have identical args to traditional
98 extern void shim_dbm_close(DBM
*db
);
99 extern int shim_dbm_delete(DBM
*db
, datum key
);
100 extern datum
shim_dbm_fetch(DBM
*db
, datum key
);
101 extern datum
shim_dbm_fetch_noupdate(DBM
*db
, datum key
);
102 extern datum
shim_dbm_firstkey(DBM
*db
);
103 extern datum
shim_dbm_nextkey(DBM
*db
);
104 extern DBM
*shim_dbm_open(const char *file
, int open_flags
,
106 extern int shim_dbm_store(DBM
*db
, datum key
, datum content
,
112 extern map_ctrl
*get_map_ctrl(DBM
*);
113 extern map_ctrl
*create_map_ctrl(char *);
114 extern void free_map_ctrl(map_ctrl
*);
115 extern map_ctrl
*dup_map_ctrl(map_ctrl
*);
116 extern void dump_map_ctrl(map_ctrl
*);
117 extern suc_code
map_ctrl_init(map_ctrl
*map
, char *name
);
118 extern int lock_map_ctrl(map_ctrl
*map
);
119 extern int unlock_map_ctrl(map_ctrl
*map
);
120 extern int map_id_list_init();
121 extern void get_list_max(map_id_elt_t
***list
, int *max
);
123 extern int try_lock_map_update(map_ctrl
*map
);
124 extern suc_code
lock_map_update(map_ctrl
*map
);
125 extern suc_code
unlock_map_update(map_ctrl
*map
);
126 extern bool_t
init_update_lock_map();
131 extern bool_t yptol_mode
;
132 extern bool_t yptol_newlock
;
133 extern bool_t ypxfrd_flag
;
137 * String extensions used in N2L
140 /* Prefix used for N2L map names */
141 #define NTOL_PREFIX "LDAP_"
143 /* Postfix used for TTL DBM files */
144 #define TTL_POSTFIX "_TTL"
146 /* Postfix for temporary files */
147 #define TEMP_POSTFIX "_TMP"
149 /* File separator character. If this is defined elsewhere can be removed */
153 * Special keys used in DBM files. No real NIS map can use these keys.
155 #define MAP_EXPIRY_KEY "YP_EXPIRY_TIME"
156 #define MAP_OLD_MAP_DATE_KEY "YP_OLD_MAP_DATE_TIME"
158 /* Mmaped file used for update flags shared memory */
159 #define SHM_FILE "/var/run/nis_shim"
161 /* used for map arrays reallocation purposes */
162 #define ARRAY_CHUNK 10
168 #endif /* __SHIM_H */