2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Gerald Carter 2002.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 /* Implementation of registry hook cache tree */
26 #define DBGC_CLASS DBGC_RPC_SRV
28 static SORTED_TREE *cache_tree;
30 /**********************************************************************
31 Initialize the cache tree
32 *********************************************************************/
34 BOOL reghook_cache_init( void )
36 cache_tree = sorted_tree_init( NULL, NULL );
38 return ( cache_tree == NULL );
41 /**********************************************************************
42 Add a new REGISTRY_HOOK to the cache. Note that the keyname
43 is not in the exact format that a SORTED_TREE expects.
44 *********************************************************************/
46 BOOL reghook_cache_add( REGISTRY_HOOK *hook )
54 pstrcat( key, hook->keyname );
56 pstring_sub( key, "\\", "/" );
58 DEBUG(10,("reghook_cache_add: Adding key [%s]\n", key));
60 return sorted_tree_add( cache_tree, key, hook );
63 /**********************************************************************
64 Initialize the cache tree
65 *********************************************************************/
67 REGISTRY_HOOK* reghook_cache_find( char *keyname )
74 if ( (key = strdup( keyname )) == NULL ) {
75 DEBUG(0,("reghook_cache_find: strdup() failed for string [%s] !?!?!\n",
80 string_sub( key, "\\", "/", 0 );
82 DEBUG(10,("reghook_cache_find: Searching for keyname [%s]\n", key));
84 return sorted_tree_find( cache_tree, key ) ;
87 /**********************************************************************
88 Initialize the cache tree
89 *********************************************************************/
91 void reghook_dump_cache( int debuglevel )
93 DEBUG(debuglevel,("reghook_dump_cache: Starting cache dump now...\n"));
95 sorted_tree_print_keys( cache_tree, debuglevel );