Lines Matching refs:entry
156 coap_cache_entry_t *entry = coap_malloc_type(COAP_CACHE_ENTRY,
158 if (!entry) {
162 memset(entry, 0, sizeof(coap_cache_entry_t));
163 entry->session = session;
165 entry->pdu = coap_pdu_init(pdu->type, pdu->code, pdu->mid, pdu->alloc_size);
166 if (entry->pdu) {
167 if (!coap_pdu_resize(entry->pdu, pdu->alloc_size)) {
168 coap_delete_pdu(entry->pdu);
169 coap_free_type(COAP_CACHE_ENTRY, entry);
173 memcpy(entry->pdu, pdu, offsetof(coap_pdu_t, token));
174 memcpy(entry->pdu->token, pdu->token, pdu->used_size);
176 entry->pdu->data = entry->pdu->token + (pdu->data - pdu->token);
179 entry->cache_key = coap_cache_derive_key(session, pdu, session_based);
180 if (!entry->cache_key) {
181 coap_free_type(COAP_CACHE_ENTRY, entry);
184 entry->idle_timeout = idle_timeout;
186 coap_ticks(&entry->expire_ticks);
187 entry->expire_ticks += idle_timeout * COAP_TICKS_PER_SECOND;
190 HASH_ADD(hh, session->context->cache, cache_key[0], sizeof(coap_cache_key_t), entry);
191 return entry;