/* * When the local GSS-API library returns a single OID to the caller, * this gss_OID is assumed to be a pointer to stable storage, and need * not be freed by the caller. We cannot return this structure directly * to the caller, since it is in the incorrect ABI. (Neither can we * modify that stable storage directly, as it would break internal users * of the OID, violate the hosts alignment expectations, attempt a write * to immutable storage, or other bad things.) We must return a translated * copy instead. However, to retain the "caller does not free" property, * we must cache the values we hand out, and only ever allocate one OID * structure in the SAP ABI for any given OID. * * Returns 0 on success, and errno on failure. */ static int gss_OID_loc_to_sap(gss_OID loc, sapgss_OID *sap) { sapgss_OID s; int code; if (sap == NULL) return 0; if (loc == NULL) { *sap = NULL; return 0; } /* Try to find a cached copy to use. */ s = cache_lookup(loc); if (s != NULL) { *sap = s; return 0; } /* else */ /* Try to insert it into the cache. Success here means that the next * lookup will succeed. */ code = cache_insert(loc); if (code != 0) { *sap = NULL; return code; } *sap = cache_lookup(loc); return 0; }
struct cacheinfo * cache_add(char *uri) { int fd, bytes; int len; struct cacheinfo *entry; struct stat stat; char *cur; char header_buf[MAX_HEADER_LEN]; int header_len; int rc; char *rc_ptr; int trace_fd = 0; PRINT_TIME(NOFD, &tnow, &tprev, "cache_add: entered "); num_cache_add_calls++; if ((entry = cache_lookup(uri)) != 0) { num_cache_hits++; PRINT_TIME(NOFD, &tnow, &tprev, "cache_add: entry found - returning"); return (entry); } else { PRINT_TIME(NOFD, &tnow, &tprev, "cache_add: entry not found "); } if (cur_entry < CACHE_MAX) { TRACE(EVT_OPEN_FILE, trace_fd = 0; rc = open(uri, O_RDONLY););
static void set_schema (GConfSource *source, const gchar *key, const gchar *schema_key, GError **err) { XMLSource* xs = (XMLSource*)source; Dir* dir; gchar* parent; g_return_if_fail (source != NULL); g_return_if_fail (key != NULL); parent = gconf_key_directory (key); g_assert (parent != NULL); dir = cache_lookup (xs->cache, parent, TRUE, err); g_free (parent); parent = NULL; if (dir == NULL) return; /* error should be set */ else { const gchar* relative_key; relative_key = gconf_key_key (key); dir_set_schema (dir, relative_key, schema_key, err); } }
static inline void cache_sym (zbar_image_scanner_t *iscn, zbar_symbol_t *sym) { if(iscn->enable_cache) { zbar_symbol_t *entry = cache_lookup(iscn, sym); if(!entry) { /* FIXME reuse sym */ entry = _zbar_image_scanner_alloc_sym(iscn, sym->type, sym->datalen + 1); memcpy(entry->data, sym->data, sym->datalen); entry->time = sym->time - CACHE_HYSTERESIS; entry->cache_count = -CACHE_CONSISTENCY; /* add to cache */ entry->next = iscn->cache; iscn->cache = entry; } /* consistency check and hysteresis */ uint32_t age = sym->time - entry->time; entry->time = sym->time; int near_thresh = (age < CACHE_PROXIMITY); int far_thresh = (age >= CACHE_HYSTERESIS); int dup = (entry->cache_count >= 0); if((!dup && !near_thresh) || far_thresh) entry->cache_count = -CACHE_CONSISTENCY; else if(dup || near_thresh) entry->cache_count++; sym->cache_count = entry->cache_count; } else sym->cache_count = 0; }
static void unset_value (GConfSource* source, const gchar* key, const gchar* locale, GError** err) { XMLSource* xs = (XMLSource*)source; Dir* dir; gchar* parent; gconf_log(GCL_DEBUG, "XML backend: unset value `%s'", key); parent = gconf_key_directory(key); dir = cache_lookup(xs->cache, parent, FALSE, err); g_free(parent); if (dir == NULL) return; else { const gchar* relative_key; relative_key = gconf_key_key(key); dir_unset_value(dir, relative_key, locale, err); } }
static GSList* all_subdirs (GConfSource* source, const gchar* key, GError** err) { Dir* dir; XMLSource* xs = (XMLSource*)source; GError *sync_err; /* We have to sync before we can do this, to see which * subdirs have gone away. */ sync_err = NULL; cache_sync (xs->cache, &sync_err); if (sync_err) { gconf_log (GCL_WARNING, _("Error syncing the XML backend directory cache: %s"), sync_err->message); g_error_free (sync_err); sync_err = NULL; /* continue, may as well try our best. */ } dir = cache_lookup (xs->cache, key, FALSE, err); if (dir == NULL) return NULL; else return dir_all_subdirs (dir, err); }
static void set_value (GConfSource* source, const gchar* key, const GConfValue* value, GError** err) { XMLSource* xs = (XMLSource*)source; Dir* dir; gchar* parent; g_return_if_fail(value != NULL); g_return_if_fail(source != NULL); parent = gconf_key_directory(key); g_assert(parent != NULL); dir = cache_lookup(xs->cache, parent, TRUE, err); g_free(parent); parent = NULL; if (dir == NULL) { g_return_if_fail((err == NULL || *err != NULL)); return; } else { const gchar* relative_key; relative_key = gconf_key_key(key); dir_set_value(dir, relative_key, value, err); } }
static GConfMetaInfo* query_metainfo (GConfSource* source, const gchar* key, GError** err) { XMLSource* xs = (XMLSource*)source; gchar* parent; Dir* dir; parent = gconf_key_directory(key); if (parent != NULL) { dir = cache_lookup(xs->cache, parent, FALSE, err); g_free(parent); parent = NULL; if (dir != NULL) { const gchar* relative_key; relative_key = gconf_key_key (key); return dir_get_metainfo (dir, relative_key, err); } } /* No metainfo found */ return NULL; }
int fuse_vncache_lookup(vnode_t dvp, vnode_t *vpp, struct componentname *cnp) { #if M_OSXFUSE_ENABLE_BIG_LOCK /* * Make sure that biglock is actually held by the thread calling us before * trying to unlock it. fuse_vncache_lookup is called by notification * handlers that do not hold biglock. Trying to unlock it in this case would * result in a kernel panic. */ struct fuse_data *data = fuse_get_mpdata(vnode_mount(dvp)); bool biglock_locked = fuse_biglock_have_lock(data->biglock); if (biglock_locked) { fuse_biglock_unlock(data->biglock); } #endif /* M_OSXFUSE_ENABLE_BIG_LOCK */ int ret = cache_lookup(dvp, vpp, cnp); #if M_OSXFUSE_ENABLE_BIG_LOCK if (biglock_locked) { fuse_biglock_lock(data->biglock); } #endif #if FUSE_TRACE_VNCACHE IOLog("osxfuse: cache lookup ret=%d, dvp=%p, *vpp=%p, %s\n", ret, dvp, *vpp, cnp->cn_nameptr); #endif return ret; }
int update_block_list(char *addr, int err_level) { size_t addr_len = strlen(addr); if (cache_key_exist(block_list, addr, addr_len)) { int *count = NULL; cache_lookup(block_list, addr, addr_len, &count); if (count != NULL) { if (*count > MAX_TRIES) return 1; (*count) += err_level; } } else if (err_level > 0) { int *count = (int *)ss_malloc(sizeof(int)); *count = 1; cache_insert(block_list, addr, addr_len, count); #ifdef __linux__ if (mode != NO_FIREWALL_MODE) set_firewall_rule(addr, 1); #endif } return 0; }
static int nnpfs_dnlc_lookup_int(struct vnode *dvp, nnpfs_componentname *cnp, struct vnode **res) { int error; u_long saved_flags; NNPFSDEB(XDEBDNLC, ("nnpfs_dnlc_lookup(%lx, \"%s\")\n", (unsigned long)dvp, cnp->cn_nameptr)); NNPFSDEB(XDEBDNLC, ("nnpfs_dnlc_lookup: v_id = %lu\n", (u_long)dvp->v_id)); NNPFSDEB(XDEBDNLC, ("nnpfs_dnlc_lookup: calling cache_lookup:" "dvp = %lx, cnp = (%s, %ld), flags = %lx\n", (unsigned long)dvp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_flags)); saved_flags = cnp->cn_flags; cnp->cn_flags |= MAKEENTRY | LOCKPARENT | ISLASTCN; error = cache_lookup(dvp, res, cnp); cnp->cn_flags = saved_flags; NNPFSDEB(XDEBDNLC, ("nnpfs_dnlc_lookup: cache_lookup returned. " "error = %d, *res = %lx\n", error, (unsigned long)*res)); return error; }
void cache_add_packet(struct sr_instance * sr, uint8_t * packet, unsigned int length, char * interface, struct in_addr ip) { struct in_addr dest_ip = next_hop_ip(sr, ip); struct sr_arp_record *record = cache_lookup(sr, dest_ip); if(record == NULL) { // Check to see if there is an outstanding ARP request struct sr_arp_request *request = cache_lookup_outstanding(sr, dest_ip); if(request == NULL) { // Create a new ARP request if(arp_request(sr, dest_ip, interface) == 0) { request = cache_add_request(sr, dest_ip); // Add the recieved message to the outstanding arp request cache_add_message(request, packet, length, interface, ip); } /* endif: arp request sent succesfully */ else { printf("ARP request failed for address %s - dropping packet.\n", inet_ntoa(ip)); } /* endelse: arp request not sent succesfully */ } /* endif: no outstanding ARP request */ else { cache_add_message(request, packet, length, interface, ip); } /* endelse: ARP request already outstanding for this ip */ } /* endif: No record */ else { // Send packet struct sr_ethernet_hdr *eth_hdr = (struct sr_ethernet_hdr *)packet; memcpy(eth_hdr->ether_dhost, record->address, ETHER_ADDR_LEN); sr_send_packet(sr, packet, length, interface); } /* endelse: ARP record already exists */ }
/* try to find a 8.3 name in the cache, and if found then replace the string with the original long name. */ static bool lookup_name_from_8_3(TALLOC_CTX *ctx, const char *name, char **pp_out, /* talloced on the given context. */ const struct share_params *p) { unsigned int hash, multiplier; unsigned int i; char *prefix; char extension[4]; *pp_out = NULL; /* make sure that this is a mangled name from this cache */ if (!is_mangled(name, p)) { M_DEBUG(10,("lookup_name_from_8_3: %s -> not mangled\n", name)); return False; } /* we need to extract the hash from the 8.3 name */ hash = base_reverse[(unsigned char)name[7]]; for (multiplier=36, i=5;i>=mangle_prefix;i--) { unsigned int v = base_reverse[(unsigned char)name[i]]; hash += multiplier * v; multiplier *= 36; } /* now look in the prefix cache for that hash */ prefix = cache_lookup(ctx, hash); if (!prefix) { M_DEBUG(10,("lookup_name_from_8_3: %s -> %08X -> not found\n", name, hash)); return False; } /* we found it - construct the full name */ if (name[8] == '.') { strncpy(extension, name+9, 3); extension[3] = 0; } else { extension[0] = 0; } if (extension[0]) { M_DEBUG(10,("lookup_name_from_8_3: %s -> %s.%s\n", name, prefix, extension)); *pp_out = talloc_asprintf(ctx, "%s.%s", prefix, extension); } else { M_DEBUG(10,("lookup_name_from_8_3: %s -> %s\n", name, prefix)); *pp_out = talloc_strdup(ctx, prefix); } TALLOC_FREE(prefix); if (!*pp_out) { M_DEBUG(0,("talloc_fail")); return False; } return True; }
/* Insert one entry into the cache */ int cache_insert(char *key, SPDMessageType msgtype, FT_Wave * fwave) { GHashTable *cache; TCacheEntry *entry; TCounterEntry *centry; char *key_table; if (FestivalCacheOn == 0) return 0; if (key == NULL) return -1; if (fwave == NULL) return -1; /* Check if the entry isn't present already */ if (cache_lookup(key, msgtype, 0) != NULL) return 0; key_table = cache_gen_key(msgtype); log_msg(OTTS_LOG_DEBUG, "Cache: Inserting wave with key:'%s' into table '%s'", key, key_table); /* Clean less used cache entries if the size would exceed max. size */ if ((FestivalCache.size + fwave->num_samples * sizeof(short)) > (FestivalCacheMaxKBytes * 1024)) if (cache_clean(fwave->num_samples * sizeof(short)) != 0) return -1; /* Select the right table according to language, voice, etc. or create a new one */ cache = g_hash_table_lookup(FestivalCache.caches, key_table); if (cache == NULL) { cache = g_hash_table_new(g_str_hash, g_str_equal); g_hash_table_insert(FestivalCache.caches, key_table, cache); } else { g_free(key_table); } /* Fill the CounterEntry structure that will later allow us to remove the less used entries from cache */ centry = (TCounterEntry *) g_malloc(sizeof(TCounterEntry)); centry->start = time(NULL); centry->count = 1; centry->size = fwave->num_samples * sizeof(short); centry->p_caches = cache; centry->key = g_strdup(key); FestivalCache.cache_counter = g_list_append(FestivalCache.cache_counter, centry); entry = (TCacheEntry *) g_malloc(sizeof(TCacheEntry)); entry->p_counter_entry = centry; entry->fwave = fwave; FestivalCache.size += centry->size; g_hash_table_insert(cache, g_strdup(key), entry); return 0; }
void do_cache_set(void) { struct string *key = string_create(); read_into_string(key); struct cache_entry *entry = cache_lookup(key); if (entry == NULL) { // There's no existing entry for this key. Find a free slot to put // a new entry in. entry = find_free_slot(); } if (entry == NULL) { // No free slots, tell the client the cache is full :-( write(STDOUT_FILENO, &kCacheFull, sizeof(kCacheFull)); return; } write(STDOUT_FILENO, &kFound, sizeof(kFound)); entry->key = key; if (entry->value == NULL) { entry->value = string_create(); } read_into_string(entry->value); entry->lifetime = read_int(); }
unsigned char * file_data_read_compressed(struct file *file, long long offset, int size, int size_uncomp) { void *ret; char *buffer = 0; uLongf destLen=size_uncomp; if (file->cache) { struct file_cache_id id={offset,size,file->name_id,1}; ret=cache_lookup(file_cache,&id); if (ret) return ret; ret=cache_insert_new(file_cache,&id,size_uncomp); } else ret=g_malloc(size_uncomp); lseek(file->fd, offset, SEEK_SET); buffer = (char *)g_malloc(size); if (read(file->fd, buffer, size) != size) { g_free(ret); ret=NULL; } else { if (uncompress_int(ret, &destLen, (Bytef *)buffer, size) != Z_OK) { dbg(0,"uncompress failed\n"); g_free(ret); ret=NULL; } } g_free(buffer); return ret; }
static struct node *cache_get(const char *path) { struct node *node = cache_lookup(path); if (node == NULL) { char *pathcopy = g_strdup(path); node = g_new0(struct node, 1); g_hash_table_insert(cache.table, pathcopy, node); }
char *uhost_cache_lookup(const char *nick) { uhost_cache_entry_t *cache; cache = cache_lookup(nick); if (cache) return(cache->uhost); return(NULL); }
static void client_recv_cb(uv_udp_t *handle, ssize_t nread, const uv_buf_t *buf, const struct sockaddr *addr, unsigned flags) { struct server_context *server = container_of(handle, struct server_context, udp); if (nread > 0) { char key[KEY_BYTES + 1] = {0}; crypto_generickey((uint8_t *)key, sizeof(key) -1, (uint8_t*)addr, sizeof(*addr), NULL, 0); struct client_context *client = NULL; uv_mutex_lock(&mutex); cache_lookup(cache, key, (void *)&client); uv_mutex_unlock(&mutex); if (client == NULL) { client = new_client(); client->addr = *addr; client->local_handle = handle; memcpy(client->key, key, sizeof(key)); uv_timer_init(handle->loop, client->timer); uv_udp_init(handle->loop, &client->server_handle); client->server_handle.data = client; uv_udp_recv_start(&client->server_handle, server_alloc_cb, server_recv_cb); uv_mutex_lock(&mutex); cache_insert(cache, client->key, (void *)client); uv_mutex_unlock(&mutex); } int clen = nread + PRIMITIVE_BYTES + addrlen; int mlen = nread + addrlen; uint8_t *c = (uint8_t *)buf->base - PRIMITIVE_BYTES - addrlen; uint8_t *m = (uint8_t *)buf->base - addrlen; if (server->dest_addr->sa_family == AF_INET) { struct sockaddr_in *addr = (struct sockaddr_in *)server->dest_addr; m[0] = 1; memcpy(m + 1, &addr->sin_addr, 4); memcpy(m + 1 + 4, &addr->sin_port, 2); } else { struct sockaddr_in6 *addr = (struct sockaddr_in6 *)server->dest_addr; m[0] = 4; memcpy(m + 1, &addr->sin6_addr, 16); memcpy(m + 1 + 16, &addr->sin6_port, 2); } int rc = crypto_encrypt(c, m, mlen); if (!rc) { reset_timer(client); forward_to_server(server->server_addr, client, c, clen); } } else { goto error; } return; error: free(buf->base - addrlen - PRIMITIVE_BYTES); }
static void do_server_request(struct server *sv, int connfd) { int ret; struct request *rq; struct file_data *data; data = file_data_init(); rq = request_init(connfd, data); if (!rq) { file_data_free(data); return; } if(cache_active ==1){ pthread_mutex_lock( &conditionMutex); struct hash_node *cache_stored; cache_stored= cache_lookup(data->file_name); if(cache_stored!=NULL){ // check if it populated in the cache{ data->file_buf = Malloc(cache_stored->data->file_size); strncpy(data->file_buf, cache_stored->data->file_buf, cache_stored->data->file_size); data->file_size =cache_stored->data->file_size; } else{ /* reads file, * fills data->file_buf with the file contents, * data->file_size with file size. */ pthread_mutex_unlock( &conditionMutex ); ret = request_readfile(rq); pthread_mutex_lock( &conditionMutex ); // need to renew the cache if(data->file_size<max_cache){ if(data->file_size <=(max_cache-cache_current_size) ){ cache_insert(data); } else{ cache_evict(data->file_size); cache_insert(data); } } } pthread_mutex_unlock( &conditionMutex ); } else{ ret = request_readfile(rq); if (!ret) goto out; } /* sends file to client */ request_sendfile(rq); out: request_destroy(rq); file_data_free(data); }
/** * gst_vaapi_display_cache_lookup_by_name: * @cache: the #GstVaapiDisplayCache * @display_name: the display name to match * * Looks up the display cache for the specified display name. * * Return value: a #GstVaapiDisplayInfo matching @display_name, or * %NULL if none was found */ const GstVaapiDisplayInfo * gst_vaapi_display_cache_lookup_by_name (GstVaapiDisplayCache * cache, const gchar * display_name, guint display_types) { g_return_val_if_fail (cache != NULL, NULL); return cache_lookup (cache, compare_display_name, display_name, display_types); }
/** * gst_vaapi_display_cache_lookup_custom: * @cache: the #GstVaapiDisplayCache * @func: an comparison function * @data: user data passed to the function * * Looks up an element in the display @cache using the supplied * function @func to find the desired element. It iterates over all * elements in cache, calling the given function which should return * %TRUE when the desired element is found. * * The comparison function takes two gconstpointer arguments, a * #GstVaapiDisplayInfo as the first argument, and that is used to * compare against the given user @data argument as the second * argument. * * Return value: a #GstVaapiDisplayInfo causing @func to succeed * (i.e. returning %TRUE), or %NULL if none was found */ const GstVaapiDisplayInfo * gst_vaapi_display_cache_lookup_custom (GstVaapiDisplayCache * cache, GCompareFunc func, gconstpointer data, guint display_types) { g_return_val_if_fail (cache != NULL, NULL); g_return_val_if_fail (func != NULL, NULL); return cache_lookup (cache, func, data, display_types); }
/** * gst_vaapi_display_cache_lookup_by_native_display: * @cache: the #GstVaapiDisplayCache * @native_display: the native display to find * * Looks up the display cache for the specified native display. * * Return value: a #GstVaapiDisplayInfo matching @native_display, or * %NULL if none was found */ const GstVaapiDisplayInfo * gst_vaapi_display_cache_lookup_by_native_display (GstVaapiDisplayCache * cache, gpointer native_display, guint display_types) { g_return_val_if_fail (cache != NULL, NULL); g_return_val_if_fail (native_display != NULL, NULL); return cache_lookup (cache, compare_native_display, native_display, display_types); }
/** * gst_vaapi_display_cache_lookup_by_va_display: * @cache: the #GstVaapiDisplayCache * @va_display: the VA display to find * * Looks up the display cache for the specified VA display. * * Return value: a #GstVaapiDisplayInfo matching @va_display, or %NULL * if none was found */ const GstVaapiDisplayInfo * gst_vaapi_display_cache_lookup_by_va_display (GstVaapiDisplayCache * cache, VADisplay va_display) { g_return_val_if_fail (cache != NULL, NULL); g_return_val_if_fail (va_display != NULL, NULL); return cache_lookup (cache, compare_va_display, va_display, GST_VAAPI_DISPLAY_TYPE_ANY); }
static GConfValue* query_value (GConfSource* source, const gchar* key, const gchar** locales, gchar** schema_name, GError** err) { XMLSource* xs = (XMLSource*)source; gchar* parent; Dir* dir; GError* error = NULL; parent = gconf_key_directory(key); g_assert(parent != NULL); dir = cache_lookup(xs->cache, parent, FALSE, &error); /* We DO NOT want to return an error unless it represents a general problem with the backend; since we don't want to report stuff like "this key doesn't exist yet" - however this is a maintenance problem, since some errors may be added that need reporting. */ if (error != NULL) { gconf_log(GCL_WARNING, "%s", error->message); g_error_free(error); error = NULL; } g_free(parent); parent = NULL; if (dir != NULL) { const gchar* relative_key; GConfValue* retval; relative_key = gconf_key_key(key); retval = dir_get_value(dir, relative_key, locales, schema_name, &error); /* perhaps we should be reporting this error... */ if (error != NULL) { gconf_log(GCL_WARNING, "%s", error->message); g_error_free(error); error = NULL; } return retval; } else return NULL; }
int browse_manifest(struct asfd *srfd, struct cstat *cstat, struct bu *bu, const char *browse, struct conf **confs) { if(get_int(confs[OPT_MONITOR_BROWSE_CACHE])) { if(!cache_loaded(cstat, bu) && browse_manifest_start(srfd, cstat, bu, browse, confs)) return -1; return cache_lookup(browse); } return browse_manifest_start(srfd, cstat, bu, browse, confs); }
static gboolean dir_exists (GConfSource*source, const gchar* key, GError** err) { XMLSource *xs = (XMLSource*)source; Dir* dir; dir = cache_lookup(xs->cache, key, FALSE, err); return (dir != NULL); }
static int idmap_lookup_group( struct idmap_context *context, const struct idmap_lookup *lookup, struct idmap_group *group) { PCHAR* values[NUM_ATTRIBUTES] = { NULL }; const unsigned attributes = ATTR_FLAG(ATTR_GROUP_NAME) | ATTR_FLAG(ATTR_GID); int i, status; /* check the group cache for an existing entry */ status = cache_lookup(&context->groups, lookup, &group->entry); if (status == NO_ERROR) { /* don't return expired entries; query new attributes * and overwrite the entry with cache_insert() */ if (time(NULL) - group->last_updated < context->config.cache_ttl) goto out; } /* send the query to the ldap server */ status = idmap_query_attrs(context, lookup, attributes, 0, values, NUM_ATTRIBUTES); if (status) goto out_free_values; /* parse attributes */ if (FAILED(StringCchCopyA(group->name, VAL_LEN, *values[ATTR_GROUP_NAME]))) { eprintf("ldap attribute %s='%s' longer than %u characters\n", context->config.attributes[ATTR_GROUP_NAME], *values[ATTR_GROUP_NAME], VAL_LEN); status = ERROR_BUFFER_OVERFLOW; goto out_free_values; } if (!parse_uint(*values[ATTR_GID], &group->gid)) { eprintf("failed to parse ldap attribute %s='%s'\n", context->config.attributes[ATTR_GID], *values[ATTR_GID]); status = ERROR_INVALID_PARAMETER; goto out_free_values; } group->last_updated = time(NULL); if (context->config.cache_ttl) { /* insert the entry into the cache */ cache_insert(&context->groups, lookup, &group->entry); } out_free_values: for (i = 0; i < NUM_ATTRIBUTES; i++) ldap_value_free(values[i]); out: return status; }
static void list_ddn( uint32_t uid ) { lookup_ctrl_t lc; bmp_t *p; uint32_t n; if (uid != 0) { setup_ddid_lcp(&lc, uid); cache_lookup(&lc, &uid, cb_print_obj_n); } if (uid != 0) { printf("--------------------------------\n"); get_dd_matrix(uid, &p, &n); SET_UID_LCP(&lc, OBJ_ISCSI, 0); FOR_EACH_MEMBER(p, n, uid, { lc.data[0].ui = uid; cache_lookup(&lc, NULL, cb_print_obj_n); });
/** * Caches the HELLO of the given peer. Updates the HELLO if it was already * cached before * * @param peer_id the peer identity of the peer whose HELLO has to be cached * @param hello the HELLO message */ void GST_cache_add_hello (const unsigned int peer_id, const struct GNUNET_MessageHeader *hello) { struct CacheEntry *entry; if (NULL == cache) return; entry = cache_lookup (peer_id); if (NULL == entry) entry = add_entry (peer_id); GNUNET_free_non_null (entry->hello); entry->hello = GNUNET_copy_message (hello); }