14a49301eSmrg/*
2af69d88dSmrg * Copyright 2008 VMware, Inc.
34a49301eSmrg * All Rights Reserved.
44a49301eSmrg *
54a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
64a49301eSmrg * copy of this software and associated documentation files (the "Software"),
74a49301eSmrg * to deal in the Software without restriction, including without limitation
84a49301eSmrg * on the rights to use, copy, modify, merge, publish, distribute, sub
94a49301eSmrg * license, and/or sell copies of the Software, and to permit persons to whom
104a49301eSmrg * the Software is furnished to do so, subject to the following conditions:
114a49301eSmrg *
124a49301eSmrg * The above copyright notice and this permission notice (including the next
134a49301eSmrg * paragraph) shall be included in all copies or substantial portions of the
144a49301eSmrg * Software.
154a49301eSmrg *
164a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
174a49301eSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
184a49301eSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
19af69d88dSmrg * VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
204a49301eSmrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
214a49301eSmrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
224a49301eSmrg * USE OR OTHER DEALINGS IN THE SOFTWARE.
234a49301eSmrg */
244a49301eSmrg#ifndef _TRANSLATE_CACHE_H
254a49301eSmrg#define _TRANSLATE_CACHE_H
264a49301eSmrg
274a49301eSmrg
284a49301eSmrg/*******************************************************************************
294a49301eSmrg * Translate cache.
304a49301eSmrg * Simply used to cache created translates. Avoids unecessary creation of
314a49301eSmrg * translate's if one suitable for a given translate_key has already been
324a49301eSmrg * created.
334a49301eSmrg *
344a49301eSmrg * Note: this functionality depends and requires the CSO module.
354a49301eSmrg */
364a49301eSmrgstruct translate_cache;
374a49301eSmrg
384a49301eSmrgstruct translate_key;
394a49301eSmrgstruct translate;
404a49301eSmrg
414a49301eSmrgstruct translate_cache *translate_cache_create( void );
424a49301eSmrgvoid translate_cache_destroy(struct translate_cache *cache);
434a49301eSmrg
444a49301eSmrg/**
454a49301eSmrg * Will try to find a translate structure matched by the given key.
464a49301eSmrg * If such a structure doesn't exist in the cache the function
474a49301eSmrg * will automatically create it, insert it in the cache and
484a49301eSmrg * return the created version.
494a49301eSmrg *
504a49301eSmrg */
514a49301eSmrgstruct translate *translate_cache_find(struct translate_cache *cache,
524a49301eSmrg                                       struct translate_key *key);
534a49301eSmrg
544a49301eSmrg#endif
55