2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * This module contains a cache used to optimized scope and DA 2N/A * discovery. Entries live for a short duration only (about 10 seconds), 2N/A * although their lifetime can be advanced somewhat by frequent use. 2N/A * The intent is that the canonical source for DAs will always be slpd, 2N/A * so the short lifetime of cache entries is designed to force clients 2N/A * to consult slpd frequently so as to pick up the latest DA state 2N/A * The cache is managed by a thread which monitors calls into the cache. 2N/A * If the cache has been unused for a certain amount of time, the thread 2N/A * frees the cache and exits. 2N/A * The cache is keyed on the queries sent to slpd to access slpd's DA 2N/A * table. Associated with each query is a reply (in the format of an 2N/A * on-the-wire SLP SRVRPLY message). 2N/A * The cache is accessed by the following two functions: 2N/A * slp_find_das_cached: searches the cache 2N/A * slp_put_das_cached: adds a reply to the cache 2N/A * All parameters added to the cache are copied in first, and all results 2N/A * read from the cache are copied out, so all memory must be freed by 2N/A/* These constants control the behaviour of the cache */ 2N/A/* Management thread components */ 2N/A/* The cache and cache synchronization */ 2N/A/* cache management and searching */ 2N/A * Searches the cache for the reply to 'query'. Returns the reply if 2N/A * found, otherwise NULL. 2N/A * The caller must free the result. 2N/A /* copy out the reply */ 2N/A /* notify cache thread of call */ 2N/A * Adds 'reply' to the cache under the index 'query'. Both parameters 2N/A * are copied in first, so the caller may free them after the call. 2N/A * 'len' is the length of 'reply' in bytes. 2N/A /* create the cache entry for this reply */ 2N/A /* write to the cache */ 2N/A /* overwrite existing entry */