X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcapputil%2Fsilcidcache.h;h=7d8e1427abfa2219e9b041185b6f475f6f6d3cba;hb=52e57c880aba9c5e89f59d962eb9af75670b76e0;hp=6fcaa573d7830135ff5f375d884523cf6a3dc4b2;hpb=510fa1da68f18f2c0e2518a690d254339a02a3bb;p=silc.git diff --git a/lib/silcapputil/silcidcache.h b/lib/silcapputil/silcidcache.h index 6fcaa573..7d8e1427 100644 --- a/lib/silcapputil/silcidcache.h +++ b/lib/silcapputil/silcidcache.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 2000 - 2006 Pekka Riikonen + Copyright (C) 2000 - 2007 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -140,11 +140,8 @@ void silc_idcache_free(SilcIDCache cache); * Add new entry to the cache. Returns the allocated cache entry if the * entry was added successfully, or NULL if error occurred. The `name' is * the name associated with the ID, the `id' the actual ID and the - * `context' a caller specific context. - * - * The `name', `id' and `context' pointers will be stored in the cache, - * and if the caller frees these pointers the caller is also responsible - * of deleting the cache entry. + * `context' a caller specific context. The caller is responsible of + * freeing the `name' and `id' when the entry is deleted. * ***/ SilcIDCacheEntry @@ -205,14 +202,14 @@ SilcBool silc_idcache_del_by_context(SilcIDCache cache, void *context, * SYNOPSIS * * SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, - * void *old_id, void *new_id, - * char *old_name, char *new_name, + * void *new_id, char *new_name, * SilcBool free_old_name); * * DESCRIPTION * * Updates cache `entry' with new values. If the `new_id' is non-NULL - * then the new value will be copied over the old value in the `entry'. + * then the new value will be copied over the old value in the `entry' + * unless the ID doesn't exist, when the `new_id' will be stored in `entry'. * If the `new_name' is non-NULL then the `entry' will be updated with * `new_name'. The caller is responsible of freeing the old name if it * was updated with new one. The old ID value does not need to be freed @@ -221,18 +218,16 @@ SilcBool silc_idcache_del_by_context(SilcIDCache cache, void *context, * ***/ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, - void *old_id, void *new_id, - char *old_name, char *new_name, + void *new_id, char *new_name, SilcBool free_old_name); -/****f* silcapputil/SilcIDCacheAPI/silc_idcache_update +/****f* silcapputil/SilcIDCacheAPI/silc_idcache_update_by_context * * SYNOPSIS * * SilcBool * silc_idcache_update_by_context(SilcIDCache cache, void *context, - * void *old_id, void *new_id, - * char *old_name, char *new_name, + * void *new_id, char *new_name, * SilcBool free_old_name); * * DESCRIPTION @@ -242,10 +237,27 @@ SilcBool silc_idcache_update(SilcIDCache cache, SilcIDCacheEntry entry, * ***/ SilcBool silc_idcache_update_by_context(SilcIDCache cache, void *context, - void *old_id, void *new_id, - char *old_name, char *new_name, + void *new_id, char *new_name, SilcBool free_old_name); +/****f* silcapputil/SilcIDCacheAPI/silc_idcache_move + * + * SYNOPSIS + * + * SilcBool silc_idcache_move(SilcIDCache from_cache, SilcIDCache to_cache, + * SilcIDCacheEntry entry); + * + * DESCRIPTION + * + * Moves the ID cache entry indicated by `entry' from the `from_cache' + * to `to_cache'. After this returns TRUE the `entry' is available only + * from the `to_cache'. Return FALSE if `entry' is not in `from_cache' + * or system is out of memory. + * + ***/ +SilcBool silc_idcache_move(SilcIDCache from_cache, SilcIDCache to_cache, + SilcIDCacheEntry entry); + /****f* silcapputil/SilcIDCacheAPI/silc_idcache_get_all * * SYNOPSIS