2 Unix SMB/CIFS implementation.
4 This file contains the _internal_ structs for the registry
5 subsystem. Backends and the subsystem itself are the only
6 files that need to include this file.
7 Copyright (C) Gerald Carter 2002.
8 Copyright (C) Jelmer Vernooij 2003-2004.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #ifndef _REGISTRY_REGISTRY_H /* _REGISTRY_REGISTRY_H */
26 #define _REGISTRY_REGISTRY_H
28 #define REGISTRY_INTERFACE_VERSION 1
30 /* structure to store the registry handles */
32 char *name; /* Name of the key */
33 char *path; /* Full path to the key */
34 smb_ucs2_t *class_name; /* Name of key class */
35 NTTIME last_mod; /* Time last modified */
39 REG_VAL **cache_values;
40 int cache_values_count;
41 REG_KEY **cache_subkeys;
42 int cache_subkeys_count;
52 void *data_blk; /* Might want a separate block */
61 typedef void (*key_notification_function) ();
62 typedef void (*value_notification_function) ();
66 * Container for function pointers to enumeration routines
67 * for virtual registry view
72 WERROR (*open_registry) (REG_HANDLE *, const char *location, const char *credentials);
73 WERROR (*sync_key)(REG_KEY *, const char *location);
74 WERROR (*close_registry) (REG_HANDLE *);
76 /* Either implement these */
77 WERROR (*open_root_key) (REG_HANDLE *, REG_KEY **);
78 WERROR (*num_subkeys) (REG_KEY *, int *count);
79 WERROR (*num_values) (REG_KEY *, int *count);
80 WERROR (*get_subkey_by_index) (REG_KEY *, int idx, REG_KEY **);
81 WERROR (*get_subkey_by_name) (REG_KEY *, const char *name, REG_KEY **);
82 WERROR (*get_value_by_index) (REG_KEY *, int idx, REG_VAL **);
83 WERROR (*get_value_by_name) (REG_KEY *, const char *name, REG_VAL **);
86 WERROR (*open_key) (REG_HANDLE *, const char *name, REG_KEY **);
87 WERROR (*fetch_subkeys) (REG_KEY *, int *count, REG_KEY ***);
88 WERROR (*fetch_values) (REG_KEY *, int *count, REG_VAL ***);
90 /* Security control */
91 WERROR (*key_get_sec_desc) (REG_KEY *, SEC_DESC **);
92 WERROR (*key_set_sec_desc) (REG_KEY *, SEC_DESC *);
95 WERROR (*request_key_change_notify) (REG_KEY *, key_notification_function);
96 WERROR (*request_value_change_notify) (REG_VAL *, value_notification_function);
99 WERROR (*add_key)(REG_KEY *, const char *name, uint32 access_mask, SEC_DESC *, REG_KEY **);
100 WERROR (*del_key)(REG_KEY *);
102 /* Value management */
103 WERROR (*add_value)(REG_KEY *, const char *name, int type, void *data, int len);
104 WERROR (*del_value)(REG_VAL *);
106 /* If update is not available, value will first be deleted and then added
108 WERROR (*update_value)(REG_VAL *, int type, void *data, int len);
110 void (*free_key_backend_data) (REG_KEY *);
111 void (*free_val_backend_data) (REG_VAL *);
114 typedef struct reg_sub_tree_s {
117 struct reg_sub_tree_s *prev, *next;
120 struct reg_handle_s {
121 struct registry_ops *functions;
122 REG_SUBTREE *subtrees;
129 struct reg_init_function_entry {
130 /* Function to create a member of the pdb_methods list */
131 struct registry_ops *functions;
132 struct reg_init_function_entry *prev, *next;
135 /* Used internally */
136 #define SMB_REG_ASSERT(a) { if(!(a)) { DEBUG(0,("%s failed! (%s:%d)", #a, __FILE__, __LINE__)); }}
138 #endif /* _REGISTRY_H */